diff --git a/bin/packages/get-babel-config.js b/bin/packages/get-babel-config.js index e79bc306d07c4..b2646da46955c 100644 --- a/bin/packages/get-babel-config.js +++ b/bin/packages/get-babel-config.js @@ -10,14 +10,7 @@ const babel = require( '@babel/core' ); const { options: babelDefaultConfig } = babel.loadPartialConfig( { configFile: '@wordpress/babel-preset-default', } ); -const plugins = babelDefaultConfig.plugins; -if ( ! process.env.SKIP_JSX_PRAGMA_TRANSFORM ) { - plugins.push( [ '@wordpress/babel-plugin-import-jsx-pragma', { - scopeVariable: 'createElement', - source: '@wordpress/element', - isDefault: false, - } ] ); -} +const { plugins, presets } = babelDefaultConfig; const overrideOptions = ( target, targetName, options ) => { if ( get( target, [ 'file', 'request' ] ) === targetName ) { @@ -37,7 +30,7 @@ const babelConfigs = { { plugins, presets: map( - babelDefaultConfig.presets, + presets, ( preset ) => overrideOptions( preset, '@babel/preset-env', { modules: 'commonjs', } ) @@ -55,7 +48,7 @@ const babelConfigs = { } ) ), presets: map( - babelDefaultConfig.presets, + presets, ( preset ) => overrideOptions( preset, '@babel/preset-env', { modules: false, } ) diff --git a/bin/packages/get-packages.js b/bin/packages/get-packages.js index 30093a22abba6..ed271db0434f2 100644 --- a/bin/packages/get-packages.js +++ b/bin/packages/get-packages.js @@ -3,7 +3,7 @@ */ const fs = require( 'fs' ); const path = require( 'path' ); -const { overEvery, compact, includes, negate } = require( 'lodash' ); +const { overEvery } = require( 'lodash' ); /** * Absolute path to packages directory. @@ -12,36 +12,6 @@ const { overEvery, compact, includes, negate } = require( 'lodash' ); */ const PACKAGES_DIR = path.resolve( __dirname, '../../packages' ); -const { - /** - * Comma-separated string of packages to include in build. - * - * @type {string} - */ - INCLUDE_PACKAGES, - - /** - * Comma-separated string of packages to exclude from build. - * - * @type {string} - */ - EXCLUDE_PACKAGES, -} = process.env; - -/** - * Given a comma-separated string, returns a filter function which returns true - * if the item is contained within as a comma-separated entry. - * - * @param {Function} filterFn Filter function to call with item to test. - * @param {string} list Comma-separated list of items. - * - * @return {Function} Filter function. - */ -const createCommaSeparatedFilter = ( filterFn, list ) => { - const listItems = list.split( ',' ); - return ( item ) => filterFn( listItems, item ); -}; - /** * Returns true if the given base file name for a file within the packages * directory is itself a directory. @@ -62,11 +32,7 @@ function isDirectory( file ) { * * @return {boolean} Whether to include file in build. */ -const filterPackages = overEvery( compact( [ - isDirectory, - INCLUDE_PACKAGES && createCommaSeparatedFilter( includes, INCLUDE_PACKAGES ), - EXCLUDE_PACKAGES && createCommaSeparatedFilter( negate( includes ), EXCLUDE_PACKAGES ), -] ) ); +const filterPackages = overEvery( isDirectory ); /** * Returns the absolute path of all WordPress packages diff --git a/package-lock.json b/package-lock.json index 30246ca516f38..e46af7f835f3e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2283,10 +2283,7 @@ }, "@wordpress/babel-plugin-import-jsx-pragma": { "version": "file:packages/babel-plugin-import-jsx-pragma", - "dev": true, - "requires": { - "@babel/runtime": "^7.0.0" - } + "dev": true }, "@wordpress/babel-plugin-makepot": { "version": "file:packages/babel-plugin-makepot", @@ -2308,6 +2305,7 @@ "@babel/plugin-transform-runtime": "^7.0.0", "@babel/preset-env": "^7.0.0", "@babel/runtime": "^7.0.0", + "@wordpress/babel-plugin-import-jsx-pragma": "file:packages/babel-plugin-import-jsx-pragma", "@wordpress/browserslist-config": "file:packages/browserslist-config", "babel-core": "^7.0.0-bridge.0" } @@ -2740,7 +2738,6 @@ "version": "file:packages/postcss-themes", "dev": true, "requires": { - "@babel/runtime": "^7.0.0", "autoprefixer": "^9.4.5", "postcss": "^7.0.13", "postcss-color-function": "^4.0.1" diff --git a/package.json b/package.json index c59a6c200a189..527b4d5bd2945 100644 --- a/package.json +++ b/package.json @@ -147,8 +147,8 @@ "scripts": { "prebuild": "npm run check-engines", "clean:packages": "rimraf ./packages/*/build ./packages/*/build-module ./packages/*/build-style", - "prebuild:packages": "npm run clean:packages && lerna run build && cross-env INCLUDE_PACKAGES=babel-plugin-import-jsx-pragma,postcss-themes,jest-console SKIP_JSX_PRAGMA_TRANSFORM=1 node ./bin/packages/build.js", - "build:packages": "cross-env EXCLUDE_PACKAGES=babel-plugin-import-jsx-pragma,jest-console,postcss-themes node ./bin/packages/build.js", + "prebuild:packages": "npm run clean:packages && lerna run build", + "build:packages": "node ./bin/packages/build.js", "build": "npm run build:packages && wp-scripts build", "check-engines": "wp-scripts check-engines", "check-licenses": "concurrently \"wp-scripts check-licenses --prod --gpl2\" \"wp-scripts check-licenses --dev\"", diff --git a/packages/babel-plugin-import-jsx-pragma/CHANGELOG.md b/packages/babel-plugin-import-jsx-pragma/CHANGELOG.md index 33b89b5ae57b0..852dbcaf235c1 100644 --- a/packages/babel-plugin-import-jsx-pragma/CHANGELOG.md +++ b/packages/babel-plugin-import-jsx-pragma/CHANGELOG.md @@ -1,3 +1,9 @@ +## 2.0.0 (Unreleased) + +### Breaking change + +- Stop using Babel transpilation internally and set node 8 as a minimal version required ([#13540](https://github.com/WordPress/gutenberg/pull/13540)). + ## 1.1.0 (2018-09-05) ### New Feature diff --git a/packages/babel-plugin-import-jsx-pragma/src/index.js b/packages/babel-plugin-import-jsx-pragma/index.js similarity index 96% rename from packages/babel-plugin-import-jsx-pragma/src/index.js rename to packages/babel-plugin-import-jsx-pragma/index.js index 89963e67d27e8..7b69a3d7bc72e 100644 --- a/packages/babel-plugin-import-jsx-pragma/src/index.js +++ b/packages/babel-plugin-import-jsx-pragma/index.js @@ -26,15 +26,12 @@ const DEFAULT_OPTIONS = { * * @return {Object} Babel transform plugin. */ -export default function( babel ) { +module.exports = function( babel ) { const { types: t } = babel; function getOptions( state ) { if ( ! state._options ) { - state._options = { - ...DEFAULT_OPTIONS, - ...state.opts, - }; + state._options = Object.assign( {}, DEFAULT_OPTIONS, state.opts ); } return state._options; @@ -99,4 +96,4 @@ export default function( babel ) { }, }, }; -} +}; diff --git a/packages/babel-plugin-import-jsx-pragma/package.json b/packages/babel-plugin-import-jsx-pragma/package.json index 12637993733e6..1adcaa57b9caa 100644 --- a/packages/babel-plugin-import-jsx-pragma/package.json +++ b/packages/babel-plugin-import-jsx-pragma/package.json @@ -19,15 +19,13 @@ "bugs": { "url": "https://github.com/WordPress/gutenberg/issues" }, + "engines": { + "node": ">=8" + }, "files": [ - "build", - "build-module" + "index.js" ], - "main": "build/index.js", - "module": "build-module/index.js", - "dependencies": { - "@babel/runtime": "^7.0.0" - }, + "main": "index.js", "peerDependencies": { "@babel/core": "^7.0.0" }, diff --git a/packages/babel-plugin-import-jsx-pragma/test/index.js b/packages/babel-plugin-import-jsx-pragma/test/index.js index 800b75e9727d6..13d299b462606 100644 --- a/packages/babel-plugin-import-jsx-pragma/test/index.js +++ b/packages/babel-plugin-import-jsx-pragma/test/index.js @@ -6,7 +6,7 @@ import { transformSync } from '@babel/core'; /** * Internal dependencies */ -import plugin from '../src'; +import plugin from '../'; describe( 'babel-plugin-import-jsx-pragma', () => { function getTransformedCode( source, options = {} ) { diff --git a/packages/babel-preset-default/CHANGELOG.md b/packages/babel-preset-default/CHANGELOG.md index 532f693d43279..0d12ff6ade95b 100644 --- a/packages/babel-preset-default/CHANGELOG.md +++ b/packages/babel-preset-default/CHANGELOG.md @@ -2,7 +2,7 @@ ## Braking change -- Plugin updated to include `@wordpress/babel-plugin-import-jsx-pragma` plugin integration. +- Preset updated to include `@wordpress/babel-plugin-import-jsx-pragma` plugin integration ([#13540](https://github.com/WordPress/gutenberg/pull/13540)). ## 3.0.0 (2018-09-30) diff --git a/packages/babel-preset-default/package.json b/packages/babel-preset-default/package.json index 1a22f93300864..36ab1cbdbb015 100644 --- a/packages/babel-preset-default/package.json +++ b/packages/babel-preset-default/package.json @@ -21,6 +21,9 @@ "engines": { "node": ">=8" }, + "files": [ + "index.js" + ], "main": "index.js", "dependencies": { "@babel/core": "^7.0.0", @@ -30,6 +33,7 @@ "@babel/plugin-transform-runtime": "^7.0.0", "@babel/preset-env": "^7.0.0", "@babel/runtime": "^7.0.0", + "@wordpress/babel-plugin-import-jsx-pragma": "file:../babel-plugin-import-jsx-pragma", "@wordpress/browserslist-config": "file:../browserslist-config", "babel-core": "^7.0.0-bridge.0" }, diff --git a/packages/postcss-themes/CHANGELOG.md b/packages/postcss-themes/CHANGELOG.md new file mode 100644 index 0000000000000..23a814422fd86 --- /dev/null +++ b/packages/postcss-themes/CHANGELOG.md @@ -0,0 +1,5 @@ +## 2.0.0 (Unreleased) + +### Breaking change + +- Stop using Babel transpilation internally and set node 8 as a minimal version required ([#13540](https://github.com/WordPress/gutenberg/pull/13540)). diff --git a/packages/postcss-themes/src/index.js b/packages/postcss-themes/index.js similarity index 98% rename from packages/postcss-themes/src/index.js rename to packages/postcss-themes/index.js index 5018a0dd39a4e..9c7dd80c64501 100644 --- a/packages/postcss-themes/src/index.js +++ b/packages/postcss-themes/index.js @@ -1,3 +1,6 @@ +/** + * External dependencies + */ const postcss = require( 'postcss' ); module.exports = postcss.plugin( 'postcss-themes', function( options ) { diff --git a/packages/postcss-themes/package.json b/packages/postcss-themes/package.json index ced2f27afbd11..4f5f233ac4eb6 100644 --- a/packages/postcss-themes/package.json +++ b/packages/postcss-themes/package.json @@ -20,13 +20,14 @@ "bugs": { "url": "https://github.com/WordPress/gutenberg/issues" }, + "engines": { + "node": ">=8" + }, "files": [ - "build", - "build-module" + "index.js" ], - "main": "build/index.js", + "main": "index.js", "dependencies": { - "@babel/runtime": "^7.0.0", "autoprefixer": "^9.4.5", "postcss": "^7.0.13", "postcss-color-function": "^4.0.1" diff --git a/packages/postcss-themes/test/index.js b/packages/postcss-themes/test/index.js index 9a670ba55a588..45a058d6e2a31 100644 --- a/packages/postcss-themes/test/index.js +++ b/packages/postcss-themes/test/index.js @@ -6,7 +6,7 @@ import postcss from 'postcss'; /** * Internal dependencies */ -import plugin from '../src'; +import plugin from '../'; /** * Module constants