-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Optimize exports of the wp/compose package (#17945)
Adds `sideEffects:false` to `package.json` so that unused exports can be optimized away by the bundler. Moves the `compose` definition (i.e., reexport from Lodash) to its own module, so that we don't pull in Lodash just by importing something from `@wordpress/compose`. After this patch, one needs to import `compose` explicitly to trigger the Lodash import.
- Loading branch information
Showing
3 changed files
with
17 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
/** | ||
* External dependencies | ||
*/ | ||
import { flowRight as compose } from 'lodash'; | ||
|
||
/** | ||
* Composes multiple higher-order components into a single higher-order component. Performs right-to-left function | ||
* composition, where each successive invocation is supplied the return value of the previous. | ||
* | ||
* @param {...Function} hocs The HOC functions to invoke. | ||
* | ||
* @return {Function} Returns the new composite function. | ||
*/ | ||
export default compose; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters