From babee1f35343cfab154beed83c7823212b5a91bc Mon Sep 17 00:00:00 2001 From: Riad Benguella Date: Wed, 22 Jan 2020 10:26:51 +0100 Subject: [PATCH 1/3] Bundle the icons package instead of using it as an external --- packages/components/src/circular-option-picker/index.js | 2 +- packages/components/src/custom-select-control/index.js | 2 +- packages/dependency-extraction-webpack-plugin/util.js | 5 +++++ packages/editor/src/components/post-saved-state/index.js | 2 +- packages/icons/README.md | 2 +- packages/icons/src/index.js | 2 +- webpack.config.js | 6 +++++- 7 files changed, 15 insertions(+), 6 deletions(-) diff --git a/packages/components/src/circular-option-picker/index.js b/packages/components/src/circular-option-picker/index.js index 92bd47b051592b..53b4c3016c957d 100644 --- a/packages/components/src/circular-option-picker/index.js +++ b/packages/components/src/circular-option-picker/index.js @@ -6,7 +6,7 @@ import classnames from 'classnames'; /** * WordPress dependencies */ -import { __experimentalIcon as Icon, check } from '@wordpress/icons'; +import { Icon, check } from '@wordpress/icons'; /** * Internal dependencies diff --git a/packages/components/src/custom-select-control/index.js b/packages/components/src/custom-select-control/index.js index e81ec97c83c23d..b6570ec4ae7b91 100644 --- a/packages/components/src/custom-select-control/index.js +++ b/packages/components/src/custom-select-control/index.js @@ -7,7 +7,7 @@ import classnames from 'classnames'; /** * WordPress dependencies */ -import { __experimentalIcon as Icon, check } from '@wordpress/icons'; +import { Icon, check } from '@wordpress/icons'; /** * Internal dependencies */ diff --git a/packages/dependency-extraction-webpack-plugin/util.js b/packages/dependency-extraction-webpack-plugin/util.js index 88db5088e3b88f..371751b0bad139 100644 --- a/packages/dependency-extraction-webpack-plugin/util.js +++ b/packages/dependency-extraction-webpack-plugin/util.js @@ -1,4 +1,5 @@ const WORDPRESS_NAMESPACE = '@wordpress/'; +const BUNDLED_PACKAGES = '@wordpress/icons'; /** * Default request to global transformation @@ -34,6 +35,10 @@ function defaultRequestToExternal( request ) { return 'ReactDOM'; } + if ( BUNDLED_PACKAGES.includes( request ) ) { + return undefined; + } + if ( request.startsWith( WORDPRESS_NAMESPACE ) ) { return [ 'wp', camelCaseDash( request.substring( WORDPRESS_NAMESPACE.length ) ) ]; } diff --git a/packages/editor/src/components/post-saved-state/index.js b/packages/editor/src/components/post-saved-state/index.js index b6dbf6792112c3..a097955b292e3d 100644 --- a/packages/editor/src/components/post-saved-state/index.js +++ b/packages/editor/src/components/post-saved-state/index.js @@ -14,7 +14,7 @@ import { withSelect, withDispatch } from '@wordpress/data'; import { displayShortcut } from '@wordpress/keycodes'; import { withSafeTimeout, compose } from '@wordpress/compose'; import { withViewportMatch } from '@wordpress/viewport'; -import { __experimentalIcon as Icon, check } from '@wordpress/icons'; +import { Icon, check } from '@wordpress/icons'; /** * Internal dependencies diff --git a/packages/icons/README.md b/packages/icons/README.md index 9f03b4ee895630..61efd9b62eada4 100644 --- a/packages/icons/README.md +++ b/packages/icons/README.md @@ -15,7 +15,7 @@ _This package assumes that your code will run in an **ES2015+** environment. If ## Usage ```js -import { __experimentalIcon as Icon, check } from '@wordpress/icons'; +import { Icon, check } from '@wordpress/icons'; ``` diff --git a/packages/icons/src/index.js b/packages/icons/src/index.js index b3b5316dc9a050..d2a11cbe14382b 100644 --- a/packages/icons/src/index.js +++ b/packages/icons/src/index.js @@ -1,4 +1,4 @@ -export { default as __experimentalIcon } from './icon'; +export { default as Icon } from './icon'; export { default as check } from './library/check'; export { default as paragraph } from './library/paragraph'; diff --git a/webpack.config.js b/webpack.config.js index 0f7f5bb91039a8..306ea1e17a1933 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -26,9 +26,13 @@ const { } = process.env; const WORDPRESS_NAMESPACE = '@wordpress/'; +const BUNDLED_PACKAGES = [ '@wordpress/icons' ]; const gutenbergPackages = Object.keys( dependencies ) - .filter( ( packageName ) => packageName.startsWith( WORDPRESS_NAMESPACE ) ) + .filter( ( packageName ) => + ! BUNDLED_PACKAGES.includes( packageName ) && + packageName.startsWith( WORDPRESS_NAMESPACE ) + ) .map( ( packageName ) => packageName.replace( WORDPRESS_NAMESPACE, '' ) ); module.exports = { From a5e0740063a2a0c8dc9a9b845ef0a2c7c99907a9 Mon Sep 17 00:00:00 2001 From: Riad Benguella Date: Wed, 22 Jan 2020 10:33:25 +0100 Subject: [PATCH 2/3] Fixes review comments --- .../src/color-palette/test/__snapshots__/index.js.snap | 6 ------ packages/icons/CHANGELOG.md | 2 +- packages/icons/src/library/check.js | 8 +------- packages/primitives/CHANGELOG.md | 2 +- 4 files changed, 3 insertions(+), 15 deletions(-) diff --git a/packages/components/src/color-palette/test/__snapshots__/index.js.snap b/packages/components/src/color-palette/test/__snapshots__/index.js.snap index 1813d62aaccd87..15d8de9fe85497 100644 --- a/packages/components/src/color-palette/test/__snapshots__/index.js.snap +++ b/packages/components/src/color-palette/test/__snapshots__/index.js.snap @@ -321,9 +321,6 @@ exports[`ColorPalette should render a dynamic toolbar of colors 1`] = ` @@ -334,10 +331,7 @@ exports[`ColorPalette should render a dynamic toolbar of colors 1`] = ` } > + ); diff --git a/packages/primitives/CHANGELOG.md b/packages/primitives/CHANGELOG.md index 73e17d12c9cf65..e597eb0e1e333d 100644 --- a/packages/primitives/CHANGELOG.md +++ b/packages/primitives/CHANGELOG.md @@ -1,3 +1,3 @@ -### Master +## Master Initial release. From 563624170af8a6654c4ba3f9d1bdb97b38d2835b Mon Sep 17 00:00:00 2001 From: Riad Benguella Date: Wed, 22 Jan 2020 12:32:30 +0100 Subject: [PATCH 3/3] Fix typo Co-Authored-By: Jon Surrell --- packages/dependency-extraction-webpack-plugin/util.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/dependency-extraction-webpack-plugin/util.js b/packages/dependency-extraction-webpack-plugin/util.js index 371751b0bad139..a5d36c8853163b 100644 --- a/packages/dependency-extraction-webpack-plugin/util.js +++ b/packages/dependency-extraction-webpack-plugin/util.js @@ -1,5 +1,5 @@ const WORDPRESS_NAMESPACE = '@wordpress/'; -const BUNDLED_PACKAGES = '@wordpress/icons'; +const BUNDLED_PACKAGES = [ '@wordpress/icons' ]; /** * Default request to global transformation