diff --git a/.github/workflows/check_package_structure.yml b/.github/workflows/check_package_structure.yml new file mode 100644 index 000000000000..fa5e79f46b49 --- /dev/null +++ b/.github/workflows/check_package_structure.yml @@ -0,0 +1,45 @@ +name: Check Package Structure +on: [push, pull_request] +jobs: + build: + runs-on: ubuntu-latest + strategy: + matrix: + node-version: [13.x] + + steps: + - uses: actions/checkout@v1 + + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v1 + with: + node-version: ${{ matrix.node-version }} + + + - name: Get yarn cache path + id: yarn-cache + run: echo "::set-output name=dir::$(yarn cache dir)" + + - uses: actions/cache@v1 + name: Cache yarn cache + id: cache-yarn-cache + with: + path: ${{ steps.yarn-cache.outputs.dir }} + key: ${{ runner.os }}-${{ matrix.node-version }}-yarn-${{ hashFiles('**/yarn.lock') }} + + - uses: actions/cache@v1 + name: Cache node_modules + id: cache-node-modules + with: + path: node_modules + key: ${{ runner.os }}-${{ matrix.node-version }}-nodemodules-${{ hashFiles('**/yarn.lock') }} + + - run: yarn install + if: steps.cache-yarn-cache.outputs.cache-hit != 'true' || steps.cache-node-modules.outputs.cache-hit != 'true' + name: Install Dependencies + + - run: yarn build + name: Build + + - run: yarn test-package-structure + name: Verify Package Structure diff --git a/.gitignore b/.gitignore index 902e6c9c8838..0bc854377c96 100644 --- a/.gitignore +++ b/.gitignore @@ -6,7 +6,7 @@ scripts/flow/*/.flowconfig .grunt _SpecRunner.html __benchmarks__ -build/ +/build remote-repo/ coverage/ .module-cache @@ -32,4 +32,4 @@ packages/react-devtools-extensions/firefox/*.xpi packages/react-devtools-extensions/firefox/*.pem packages/react-devtools-extensions/shared/build packages/react-devtools-inline/dist -packages/react-devtools-shell/dist \ No newline at end of file +packages/react-devtools-shell/dist diff --git a/package.json b/package.json index 3b615ba29d06..88a345adb4fb 100644 --- a/package.json +++ b/package.json @@ -37,6 +37,7 @@ "babel-eslint": "^10.0.0", "babel-plugin-syntax-trailing-function-commas": "^6.5.0", "babylon": "6.18.0", + "canvas": "^2.6.0", "chalk": "^1.1.3", "cli-table": "^0.3.1", "coffee-script": "^1.8.0", @@ -65,6 +66,7 @@ "jest": "^24.9.0", "jest-diff": "^24.9.0", "jest-snapshot-serializer-raw": "^1.1.0", + "jsdom": "^15.2.1", "minimatch": "^3.0.4", "minimist": "^1.2.0", "mkdirp": "^0.5.1", @@ -76,13 +78,14 @@ "random-seed": "^0.3.0", "react-lifecycles-compat": "^3.0.2", "rimraf": "^2.6.1", - "rollup": "^0.52.1", - "rollup-plugin-babel": "^4.0.1", - "rollup-plugin-commonjs": "^8.2.6", - "rollup-plugin-node-resolve": "^2.1.1", - "rollup-plugin-prettier": "^0.3.0", - "rollup-plugin-replace": "^2.0.0", - "rollup-plugin-strip-banner": "^0.2.0", + "rollup": "^1.27.5", + "rollup-plugin-babel": "^4.3.3", + "rollup-plugin-commonjs": "^10.1.0", + "rollup-plugin-node-resolve": "^5.2.0", + "rollup-plugin-prettier": "^0.6.0", + "rollup-plugin-replace": "^2.2.0", + "rollup-plugin-strip-banner": "^1.0.0", + "rollup-plugin-terser": "^5.1.2", "semver": "^5.5.0", "targz": "^1.0.1", "through2": "^2.0.0", @@ -91,13 +94,13 @@ "webpack": "^4.41.2" }, "devEngines": { - "node": "8.x || 9.x || 10.x || 11.x || 12.x" + "node": "8.x || 9.x || 10.x || 11.x || 12.x || 13.x" }, "jest": { "testRegex": "/scripts/jest/dont-run-jest-directly\\.js$" }, "scripts": { - "build": "node ./scripts/rollup/build.js", + "build": "node ./scripts/rollup/build", "linc": "node ./scripts/tasks/linc.js", "lint": "node ./scripts/tasks/eslint.js", "lint-build": "node ./scripts/rollup/validate/index.js", @@ -112,6 +115,7 @@ "test-build": "cross-env NODE_ENV=development jest --config ./scripts/jest/config.build.js", "test-build-prod": "cross-env NODE_ENV=production jest --config ./scripts/jest/config.build.js", "test-build-devtools": "cross-env NODE_ENV=development jest --config ./scripts/jest/config.build-devtools.js", + "test-package-structure": "node --experimental-conditional-exports ./build/package-check.js", "debug-test-build-devtools": "cross-env NODE_ENV=development node --inspect-brk node_modules/.bin/jest --config ./scripts/jest/config.build-devtools.js", "test-dom-fixture": "cd fixtures/dom && yarn && yarn prestart && yarn test", "flow": "node ./scripts/tasks/flow.js", diff --git a/packages/babel-plugin-react-jsx/package.json b/packages/babel-plugin-react-jsx/package.json index 41243452d4f1..6ce575476f3f 100644 --- a/packages/babel-plugin-react-jsx/package.json +++ b/packages/babel-plugin-react-jsx/package.json @@ -6,13 +6,14 @@ "main": "index.js", "dependencies": { "esutils": "^2.0.0" - + }, "files": [ "README.md", "index.js", "build-info.json", "cjs/", - "umd/" + "umd/", + "esm/" ] } diff --git a/packages/create-subscription/package.json b/packages/create-subscription/package.json index 34b87144a92b..d157f921e0b2 100644 --- a/packages/create-subscription/package.json +++ b/packages/create-subscription/package.json @@ -2,6 +2,7 @@ "name": "create-subscription", "description": "utility for subscribing to external data sources inside React components", "version": "16.12.0", + "main": "index.js", "repository": { "type": "git", "url": "https://github.com/facebook/react.git", diff --git a/packages/eslint-plugin-react-hooks/npm/index.mjs b/packages/eslint-plugin-react-hooks/npm/index.mjs new file mode 100644 index 000000000000..81d1bb42de16 --- /dev/null +++ b/packages/eslint-plugin-react-hooks/npm/index.mjs @@ -0,0 +1,8 @@ +import dev from './esm/eslint-plugin-react-hooks.development.mjs'; +import prod from './esm/eslint-plugin-react-hooks.production.min.mjs'; + +const isProduction = process.env.NODE_ENV === 'production'; + +const defaultValue = isProduction ? prod : dev; +export default defaultValue; + diff --git a/packages/eslint-plugin-react-hooks/package.json b/packages/eslint-plugin-react-hooks/package.json index 6f523bcd5b6f..297dbb00c3a4 100644 --- a/packages/eslint-plugin-react-hooks/package.json +++ b/packages/eslint-plugin-react-hooks/package.json @@ -7,13 +7,22 @@ "url": "https://github.com/facebook/react.git", "directory": "packages/eslint-plugin-react-hooks" }, + "main": "index.js", "files": [ "LICENSE", "README.md", "build-info.json", "index.js", - "cjs" + "index.mjs", + "cjs/", + "esm/" ], + "__exports": { + ".": { + "require": "./index.js", + "default": "./index.mjs" + } + }, "keywords": [ "eslint", "eslint-plugin", diff --git a/packages/jest-mock-scheduler/npm/index.mjs b/packages/jest-mock-scheduler/npm/index.mjs new file mode 100644 index 000000000000..569a00811e24 --- /dev/null +++ b/packages/jest-mock-scheduler/npm/index.mjs @@ -0,0 +1,4 @@ +import * as mock from 'scheduler/unstable_mock'; + +export default mock; + diff --git a/packages/jest-mock-scheduler/package.json b/packages/jest-mock-scheduler/package.json index d53fe97f2513..300d3bd94b93 100644 --- a/packages/jest-mock-scheduler/package.json +++ b/packages/jest-mock-scheduler/package.json @@ -27,6 +27,8 @@ "README.md", "build-info.json", "index.js", - "cjs/" + "index.mjs", + "cjs/", + "esm/" ] } diff --git a/packages/jest-react/npm/index.mjs b/packages/jest-react/npm/index.mjs new file mode 100644 index 000000000000..c8564a618fcf --- /dev/null +++ b/packages/jest-react/npm/index.mjs @@ -0,0 +1,9 @@ +import * as dev from './esm/jest-react.development.mjs'; +import * as prod from './esm/jest-react.production.min.mjs'; + +const isProduction = process.env.NODE_ENV === 'production'; +function select(key) { + return isProduction ? prod[key] : dev[key] +} + +export const unstable_toMatchRenderedOutput = select('unstable_toMatchRenderedOutput'); diff --git a/packages/jest-react/package.json b/packages/jest-react/package.json index f79d8c48ab49..0b2e4ba3e02d 100644 --- a/packages/jest-react/package.json +++ b/packages/jest-react/package.json @@ -28,6 +28,14 @@ "README.md", "build-info.json", "index.js", - "cjs/" - ] + "index.mjs", + "cjs/", + "esm/" + ], + "__exports": { + ".": { + "require": "./index.js", + "default": "./index.mjs" + } + } } diff --git a/packages/react-cache/npm/index.mjs b/packages/react-cache/npm/index.mjs new file mode 100644 index 000000000000..95edee35f3fa --- /dev/null +++ b/packages/react-cache/npm/index.mjs @@ -0,0 +1,11 @@ +import * as dev from './esm/react-cache.development.mjs'; +import * as prod from './esm/react-cache.production.min.mjs'; + +const isProduction = process.env.NODE_ENV === 'production'; +function select(key) { + return isProduction ? prod[key] : dev[key] +} + +export const unstable_createResource = select('unstable_createResource'); +export const unstable_setGlobalCacheLimit = select('unstable_setGlobalCacheLimit'); + diff --git a/packages/react-cache/package.json b/packages/react-cache/package.json index b593f6d5811e..7744971006ea 100644 --- a/packages/react-cache/package.json +++ b/packages/react-cache/package.json @@ -3,6 +3,7 @@ "name": "react-cache", "description": "A basic cache for React applications", "version": "2.0.0-alpha.0", + "main": "index.js", "repository": { "type" : "git", "url" : "https://github.com/facebook/react.git", @@ -13,10 +14,18 @@ "README.md", "build-info.json", "index.js", + "index.mjs", "cjs/", - "umd/" + "umd/", + "esm/" ], "peerDependencies": { "react": "^16.3.0-alpha.1" + }, + "__exports": { + ".": { + "require": "./index.js", + "default": "./index.mjs" + } } } diff --git a/packages/react-debug-tools/npm/index.mjs b/packages/react-debug-tools/npm/index.mjs new file mode 100644 index 000000000000..056536be8698 --- /dev/null +++ b/packages/react-debug-tools/npm/index.mjs @@ -0,0 +1,14 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @flow + */ +import dev from './esm/react-debug-tools.development.mjs'; +import prod from './esm/react-debug-tools.production.min.mjs'; + +const isProduction = process.env.NODE_ENV === 'production'; + +export default isProduction ? prod : dev; diff --git a/packages/react-debug-tools/package.json b/packages/react-debug-tools/package.json index 1a2e787d12bc..9f052a0ba9a2 100644 --- a/packages/react-debug-tools/package.json +++ b/packages/react-debug-tools/package.json @@ -14,6 +14,8 @@ "README.md", "build-info.json", "index.js", + "index.mjs", + "esm/", "cjs/" ], "main": "index.js", @@ -30,5 +32,11 @@ }, "dependencies": { "error-stack-parser": "^2.0.2" + }, + "__exports": { + ".": { + "require": "./index.js", + "default": "./index.mjs" + } } } diff --git a/packages/react-dom/package.json b/packages/react-dom/package.json index 7e6cf5e5c0ee..39395187ad04 100644 --- a/packages/react-dom/package.json +++ b/packages/react-dom/package.json @@ -35,7 +35,6 @@ "server.browser.js", "server.node.js", "test-utils.js", - "unstable-fire.js", "unstable-fizz.js", "unstable-fizz.browser.js", "unstable-fizz.node.js", diff --git a/packages/react-flight-dom-webpack/npm/index.mjs b/packages/react-flight-dom-webpack/npm/index.mjs new file mode 100644 index 000000000000..f46589e94df5 --- /dev/null +++ b/packages/react-flight-dom-webpack/npm/index.mjs @@ -0,0 +1,6 @@ +import dev from './esm/react-flight-dom-webpack.development.mjs'; +import prod from './esm/react-flight-dom-webpack.production.min.mjs'; + +const isProduction = process.env.NODE_ENV === 'production'; + +export default isProduction ? prod : dev; diff --git a/packages/react-flight-dom-webpack/package.json b/packages/react-flight-dom-webpack/package.json index 8f48fae57f51..2e5c8fb9b0d7 100644 --- a/packages/react-flight-dom-webpack/package.json +++ b/packages/react-flight-dom-webpack/package.json @@ -13,11 +13,13 @@ "LICENSE", "README.md", "index.js", + "index.mjs", "server.js", "server.browser.js", "server.node.js", "cjs/", - "umd/" + "umd/", + "esm/" ], "browser": { "./server.js": "./server.browser.js" @@ -44,5 +46,11 @@ "transform": [ "loose-envify" ] + }, + "__exports": { + ".": { + "require": "./index.js", + "default": "./index.mjs" + } } } diff --git a/packages/react-interactions/package.json b/packages/react-interactions/package.json index fe926f849c1e..753a83c5f7ab 100644 --- a/packages/react-interactions/package.json +++ b/packages/react-interactions/package.json @@ -26,9 +26,9 @@ "events/tap.js", "build-info.json", "cjs/", - "umd/" + "umd/", + "esm/" ], - "main": "index.js", "repository": { "type": "git", "url": "https://github.com/facebook/react.git", diff --git a/packages/react-is/npm/index.mjs b/packages/react-is/npm/index.mjs new file mode 100644 index 000000000000..a65b302f9905 --- /dev/null +++ b/packages/react-is/npm/index.mjs @@ -0,0 +1,22 @@ +import * as dev from './esm/react-is.development.mjs'; +import * as prod from './esm/react-is.production.min.mjs'; + +const isProduction = process.env.NODE_ENV === 'production'; +function select(key) { + return isProduction ? prod[key] : dev[key] +} + +// AsyncMode should be deprecated +export const isAsyncMode = select('isAsyncMode'); +export const isConcurrentMode = select('isConcurrentMode'); +export const isContextConsumer = select('isContextConsumer'); +export const isContextProvider = select('isContextProvider'); +export const isElement = select('isElement'); +export const isForwardRef = select('isForwardRef'); +export const isFragment = select('isFragment'); +export const isLazy = select('isLazy'); +export const isMemo = select('isMemo'); +export const isPortal = select('isPortal'); +export const isProfiler = select('isProfiler'); +export const isStrictMode = select('isStrictMode'); +export const isSuspense = select('isSuspense'); diff --git a/packages/react-is/package.json b/packages/react-is/package.json index 16177d8e8b1f..472f315decd1 100644 --- a/packages/react-is/package.json +++ b/packages/react-is/package.json @@ -21,7 +21,15 @@ "README.md", "build-info.json", "index.js", + "index.mjs", "cjs/", - "umd/" - ] + "umd/", + "esm/" + ], + "__exports": { + ".": { + "require": "./index.js", + "default": "./index.mjs" + } + } } diff --git a/packages/react-noop-renderer/npm/index.mjs b/packages/react-noop-renderer/npm/index.mjs new file mode 100644 index 000000000000..e338429d61bd --- /dev/null +++ b/packages/react-noop-renderer/npm/index.mjs @@ -0,0 +1,6 @@ +import dev from './esm/react-noop-renderer.development.mjs'; +import prod from './esm/react-noop-renderer.production.min.mjs'; + +const isProduction = process.env.NODE_ENV === 'production'; + +export default isProduction ? prod : dev; diff --git a/packages/react-noop-renderer/package.json b/packages/react-noop-renderer/package.json index 0f95472ae41e..188a640d4a42 100644 --- a/packages/react-noop-renderer/package.json +++ b/packages/react-noop-renderer/package.json @@ -26,10 +26,18 @@ "README.md", "build-info.json", "index.js", + "index.mjs", "persistent.js", "server.js", "flight-client.js", "flight-server.js", - "cjs/" - ] + "cjs/", + "esm/" + ], + "__exports": { + ".": { + "require": "./index.js", + "default": "./index.mjs" + } + } } diff --git a/packages/react-refresh/package.json b/packages/react-refresh/package.json index 3951e27734f9..9490ab46b28f 100644 --- a/packages/react-refresh/package.json +++ b/packages/react-refresh/package.json @@ -15,9 +15,9 @@ "runtime.js", "build-info.json", "cjs/", - "umd/" + "umd/", + "esm/" ], - "main": "index.js", "repository": { "type": "git", "url": "https://github.com/facebook/react.git", diff --git a/packages/react/package.json b/packages/react/package.json index a1d1a21e0d93..7a3da14f54ae 100644 --- a/packages/react/package.json +++ b/packages/react/package.json @@ -16,7 +16,7 @@ "cjs/", "umd/" ], - "main": "index.js", + "main": "./index.js", "repository": { "type": "git", "url": "https://github.com/facebook/react.git", diff --git a/packages/scheduler/npm/index.mjs b/packages/scheduler/npm/index.mjs new file mode 100644 index 000000000000..f2574a36c749 --- /dev/null +++ b/packages/scheduler/npm/index.mjs @@ -0,0 +1,28 @@ +import * as dev from './esm/scheduler.development.mjs'; +import * as prod from './esm/scheduler.production.min.mjs'; + +const isProduction = process.env.NODE_ENV === 'production'; +function select(key) { + return isProduction ? prod[key] : dev[key] +} + +export const unstable_IdlePriority = select('unstable_IdlePriority'); +export const unstable_ImmediatePriority = select('unstable_ImmediatePriority'); +export const unstable_LowPriority = select('unstable_LowPriority'); +export const unstable_NormalPriority = select('unstable_NormalPriority'); +export const unstable_Profiling = select('unstable_Profiling'); +export const unstable_UserBlockingPriority = select('unstable_UserBlockingPriority'); +export const unstable_cancelCallback = select('unstable_cancelCallback'); +export const unstable_continueExecution = select('unstable_continueExecution'); +export const unstable_forceFrameRate = select('unstable_forceFrameRate'); +export const unstable_getCurrentPriorityLevel = select('unstable_getCurrentPriorityLevel'); +export const unstable_getFirstCallbackNode = select('unstable_getFirstCallbackNode'); +export const unstable_next = select('unstable_next'); +export const unstable_now = select('unstable_now'); +export const unstable_pauseExecution = select('unstable_pauseExecution'); +export const unstable_requestPaint = select('unstable_requestPaint'); +export const unstable_runWithPriority = select('unstable_runWithPriority'); +export const unstable_scheduleCallback = select('unstable_scheduleCallback'); +export const unstable_shouldYield = select('unstable_shouldYield'); +export const unstable_wrapCallback = select('unstable_wrapCallback'); + diff --git a/packages/scheduler/npm/tracing.mjs b/packages/scheduler/npm/tracing.mjs new file mode 100644 index 000000000000..a7823dae8db7 --- /dev/null +++ b/packages/scheduler/npm/tracing.mjs @@ -0,0 +1,18 @@ +import * as dev from './esm/scheduler-tracing.development.mjs'; +import * as prod from './esm/scheduler-tracing.production.min.mjs'; + +const isProduction = process.env.NODE_ENV === 'production'; +function select(key) { + return isProduction ? prod[key] : dev[key] +} + +export const __interactionsRef = select('__interactionsRef'); +export const __subscriberRef = select('__subscriberRef'); +export const unstable_clear = select('unstable_clear'); +export const unstable_getCurrent = select('unstable_getCurrent'); +export const unstable_getThreadID = select('unstable_getThreadID'); +export const unstable_subscribe = select('unstable_subscribe'); +export const unstable_trace = select('unstable_trace'); +export const unstable_unsubscribe = select('unstable_unsubscribe'); +export const unstable_wrap = select('unstable_wrap'); + diff --git a/packages/scheduler/npm/unstable_mock.mjs b/packages/scheduler/npm/unstable_mock.mjs new file mode 100644 index 000000000000..ffcf3492e433 --- /dev/null +++ b/packages/scheduler/npm/unstable_mock.mjs @@ -0,0 +1,35 @@ +import * as dev from './esm/scheduler-unstable_mock.development.mjs'; +import * as prod from './esm/scheduler-unstable_mock.production.min.mjs'; + +const isProduction = process.env.NODE_ENV === 'production'; +function select(key) { + return isProduction ? prod[key] : dev[key] +} + +export const unstable_IdlePriority = select('unstable_IdlePriority') +export const unstable_ImmediatePriority = select('unstable_ImmediatePriority') +export const unstable_LowPriority = select('unstable_LowPriority') +export const unstable_NormalPriority = select('unstable_NormalPriority') +export const unstable_Profiling = select('unstable_Profiling') +export const unstable_UserBlockingPriority = select('unstable_UserBlockingPriority') +export const unstable_advanceTime = select('unstable_advanceTime') +export const unstable_cancelCallback = select('unstable_cancelCallback') +export const unstable_clearYields = select('unstable_clearYields') +export const unstable_continueExecution = select('unstable_continueExecution') +export const unstable_flushAll = select('unstable_flushAll') +export const unstable_flushAllWithoutAsserting = select('unstable_flushAllWithoutAsserting') +export const unstable_flushExpired = select('unstable_flushExpired') +export const unstable_flushNumberOfYields = select('unstable_flushNumberOfYields') +export const unstable_flushUntilNextPaint = select('unstable_flushUntilNextPaint') +export const unstable_forceFrameRate = select('unstable_forceFrameRate') +export const unstable_getCurrentPriorityLevel = select('unstable_getCurrentPriorityLevel') +export const unstable_getFirstCallbackNode = select('unstable_getFirstCallbackNode') +export const unstable_next = select('unstable_next') +export const unstable_now = select('unstable_now') +export const unstable_pauseExecution = select('unstable_pauseExecution') +export const unstable_requestPaint = select('unstable_requestPaint') +export const unstable_runWithPriority = select('unstable_runWithPriority') +export const unstable_scheduleCallback = select('unstable_scheduleCallback') +export const unstable_shouldYield = select('unstable_shouldYield') +export const unstable_wrapCallback = select('unstable_wrapCallback') +export const unstable_yieldValue = select('unstable_yieldValue') diff --git a/packages/scheduler/package.json b/packages/scheduler/package.json index 81315b6d5e0b..d68cf148728f 100644 --- a/packages/scheduler/package.json +++ b/packages/scheduler/package.json @@ -25,12 +25,30 @@ "README.md", "build-info.json", "index.js", + "index.mjs", "tracing.js", + "tracing.mjs", "tracing-profiling.js", "unstable_mock.js", + "unstable_mock.mjs", "cjs/", - "umd/" + "umd/", + "esm/" ], + "__exports": { + ".": { + "require": "./index.js", + "default": "./index.mjs" + }, + "./unstable_mock": { + "require": "./unstable_mock.js", + "default": "./unstable_mock.mjs" + }, + "./tracing": { + "require": "./tracing.js", + "default": "./tracing.mjs" + } + }, "browserify": { "transform": [ "loose-envify" diff --git a/packages/use-subscription/package.json b/packages/use-subscription/package.json index 3e6138921d75..171dd7fc9a0a 100644 --- a/packages/use-subscription/package.json +++ b/packages/use-subscription/package.json @@ -2,6 +2,7 @@ "name": "use-subscription", "description": "Reusable hooks", "version": "1.3.0", + "main": "index.js", "repository": { "type": "git", "url": "https://github.com/facebook/react.git", diff --git a/scripts/babel/__tests__/transform-remove-getters-test.js b/scripts/babel/__tests__/transform-remove-getters-test.js new file mode 100644 index 000000000000..252bd8fd2a9c --- /dev/null +++ b/scripts/babel/__tests__/transform-remove-getters-test.js @@ -0,0 +1,69 @@ +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +'use strict'; + +const babel = require('babel-core'); +const removeGetters = require('../transform-remove-getters'); + +function transform(input) { + const result = babel.transform(input, { + babelrc: false, + presets: [], + plugins: [removeGetters], + }); + return result.code; +} + +function compare(input, output) { + const compiled = transform(input); + expect(compiled).toEqual(output); +} + +describe('remove-getters', () => { + it('should remove getters', () => { + compare( + `const object = { + get prop() { + return variable; + } +};`, + `var object = { + prop: variable +};` + ); + }); + + it('should not remove other methods or properties', () => { + compare( + `const object = { + prop: 'foo', + method() { + return 'bar'; + } +};`, + `var object = { + prop: 'foo', + method: function () { + return 'bar'; + } +};` + ); + }); + + it('should throw when finding getters with a different syntax from the ones generated by Rollup', () => { + expect(() => { + transform( + `const object = { + get prop() { + const foo = 'foo'; + return foo; + } +};` + ); + }).toThrow(); + }); +}); diff --git a/scripts/babel/transform-object-assign-require.js b/scripts/babel/transform-object-assign-require.js index 79c7421c5e2e..1d35a1872fa7 100644 --- a/scripts/babel/transform-object-assign-require.js +++ b/scripts/babel/transform-object-assign-require.js @@ -9,6 +9,10 @@ const helperModuleImports = require('@babel/helper-module-imports'); +/** + * This babel plugin will scan modules for usage of Object.assign and auto-insert + * a `require('object-assign')` statement in for polyfilling. + */ module.exports = function autoImporter(babel) { function getAssignIdent(path, file, state) { if (state.id) { diff --git a/scripts/babel/transform-remove-getters.js b/scripts/babel/transform-remove-getters.js new file mode 100644 index 000000000000..fff2cdfdb930 --- /dev/null +++ b/scripts/babel/transform-remove-getters.js @@ -0,0 +1,56 @@ +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +'use strict'; + +module.exports = ({ + types: {isIdentifier, isReturnStatement, objectProperty, identifier}, +}) => { + return { + visitor: { + ObjectMethod: path => { + // Turns this code: + // + // get prop() { + // return variable; + // } + // + // into this: + // + // prop: variable; + if (path.node.kind !== 'get') { + return; + } + + const keyNode = path.node.key; + const isValidKey = isIdentifier(keyNode); + if (!isValidKey) { + throw path.buildCodeFrameError( + 'Getter key format not supported. Expected identifier.' + ); + } + + const bodyNode = path.node.body; + const isValidBody = + bodyNode.body.length === 1 && + isReturnStatement(bodyNode.body[0]) && + isIdentifier(bodyNode.body[0].argument); + if (!isValidBody) { + throw path.buildCodeFrameError( + 'Getter body format not supported. Expected return of identifier.' + ); + } + + const prop = keyNode.name; + const variable = bodyNode.body[0].argument.name; + + path.replaceWith( + objectProperty(identifier(prop), identifier(variable)) + ); + }, + }, + }; +}; diff --git a/scripts/rollup/build.js b/scripts/rollup/build.js deleted file mode 100644 index ff0f9760bde1..000000000000 --- a/scripts/rollup/build.js +++ /dev/null @@ -1,719 +0,0 @@ -'use strict'; - -const rollup = require('rollup'); -const babel = require('rollup-plugin-babel'); -const closure = require('./plugins/closure-plugin'); -const commonjs = require('rollup-plugin-commonjs'); -const prettier = require('rollup-plugin-prettier'); -const replace = require('rollup-plugin-replace'); -const stripBanner = require('rollup-plugin-strip-banner'); -const chalk = require('chalk'); -const path = require('path'); -const resolve = require('rollup-plugin-node-resolve'); -const fs = require('fs'); -const argv = require('minimist')(process.argv.slice(2)); -const Modules = require('./modules'); -const Bundles = require('./bundles'); -const Stats = require('./stats'); -const Sync = require('./sync'); -const sizes = require('./plugins/sizes-plugin'); -const useForks = require('./plugins/use-forks-plugin'); -const stripUnusedImports = require('./plugins/strip-unused-imports'); -const extractErrorCodes = require('../error-codes/extract-errors'); -const Packaging = require('./packaging'); -const {asyncCopyTo, asyncRimRaf} = require('./utils'); -const codeFrame = require('babel-code-frame'); -const Wrappers = require('./wrappers'); - -const RELEASE_CHANNEL = process.env.RELEASE_CHANNEL; - -// Default to building in experimental mode. If the release channel is set via -// an environment variable, then check if it's "experimental". -const __EXPERIMENTAL__ = - typeof RELEASE_CHANNEL === 'string' - ? RELEASE_CHANNEL === 'experimental' - : true; - -// Errors in promises should be fatal. -let loggedErrors = new Set(); -process.on('unhandledRejection', err => { - if (loggedErrors.has(err)) { - // No need to print it twice. - process.exit(1); - } - throw err; -}); - -const { - UMD_DEV, - UMD_PROD, - UMD_PROFILING, - NODE_DEV, - NODE_PROD, - NODE_PROFILING, - FB_WWW_DEV, - FB_WWW_PROD, - FB_WWW_PROFILING, - RN_OSS_DEV, - RN_OSS_PROD, - RN_OSS_PROFILING, - RN_FB_DEV, - RN_FB_PROD, - RN_FB_PROFILING, -} = Bundles.bundleTypes; - -function parseRequestedNames(names, toCase) { - let result = []; - for (let i = 0; i < names.length; i++) { - let splitNames = names[i].split(','); - for (let j = 0; j < splitNames.length; j++) { - let name = splitNames[j].trim(); - if (!name) { - continue; - } - if (toCase === 'uppercase') { - name = name.toUpperCase(); - } else if (toCase === 'lowercase') { - name = name.toLowerCase(); - } - result.push(name); - } - } - return result; -} - -const requestedBundleTypes = argv.type - ? parseRequestedNames([argv.type], 'uppercase') - : []; -const requestedBundleNames = parseRequestedNames(argv._, 'lowercase'); -const forcePrettyOutput = argv.pretty; -const isWatchMode = argv.watch; -const syncFBSourcePath = argv['sync-fbsource']; -const syncWWWPath = argv['sync-www']; -const shouldExtractErrors = argv['extract-errors']; -const errorCodeOpts = { - errorMapFilePath: 'scripts/error-codes/codes.json', -}; - -const closureOptions = { - compilation_level: 'SIMPLE', - language_in: 'ECMASCRIPT5_STRICT', - language_out: 'ECMASCRIPT5_STRICT', - env: 'CUSTOM', - warning_level: 'QUIET', - apply_input_source_maps: false, - use_types_for_optimization: false, - process_common_js_modules: false, - rewrite_polyfills: false, -}; - -function getBabelConfig(updateBabelOptions, bundleType, filename) { - let options = { - exclude: '/**/node_modules/**', - presets: [], - plugins: [], - }; - if (updateBabelOptions) { - options = updateBabelOptions(options); - } - switch (bundleType) { - case FB_WWW_DEV: - case FB_WWW_PROD: - case FB_WWW_PROFILING: - return Object.assign({}, options, { - plugins: options.plugins.concat([ - // Minify invariant messages - require('../error-codes/transform-error-messages'), - // Wrap warning() calls in a __DEV__ check so they are stripped from production. - require('../babel/wrap-warning-with-env-check'), - ]), - }); - case RN_OSS_DEV: - case RN_OSS_PROD: - case RN_OSS_PROFILING: - case RN_FB_DEV: - case RN_FB_PROD: - case RN_FB_PROFILING: - return Object.assign({}, options, { - plugins: options.plugins.concat([ - [ - require('../error-codes/transform-error-messages'), - // Preserve full error messages in React Native build - {noMinify: true}, - ], - // Wrap warning() calls in a __DEV__ check so they are stripped from production. - require('../babel/wrap-warning-with-env-check'), - ]), - }); - case UMD_DEV: - case UMD_PROD: - case UMD_PROFILING: - case NODE_DEV: - case NODE_PROD: - case NODE_PROFILING: - return Object.assign({}, options, { - plugins: options.plugins.concat([ - // Use object-assign polyfill in open source - path.resolve('./scripts/babel/transform-object-assign-require'), - // Minify invariant messages - require('../error-codes/transform-error-messages'), - // Wrap warning() calls in a __DEV__ check so they are stripped from production. - require('../babel/wrap-warning-with-env-check'), - ]), - }); - default: - return options; - } -} - -function getRollupOutputOptions( - outputPath, - format, - globals, - globalName, - bundleType -) { - const isProduction = isProductionBundleType(bundleType); - - return Object.assign( - {}, - { - file: outputPath, - format, - globals, - freeze: !isProduction, - interop: false, - name: globalName, - sourcemap: false, - } - ); -} - -function getFormat(bundleType) { - switch (bundleType) { - case UMD_DEV: - case UMD_PROD: - case UMD_PROFILING: - return `umd`; - case NODE_DEV: - case NODE_PROD: - case NODE_PROFILING: - case FB_WWW_DEV: - case FB_WWW_PROD: - case FB_WWW_PROFILING: - case RN_OSS_DEV: - case RN_OSS_PROD: - case RN_OSS_PROFILING: - case RN_FB_DEV: - case RN_FB_PROD: - case RN_FB_PROFILING: - return `cjs`; - } -} - -function getFilename(name, globalName, bundleType) { - // we do this to replace / to -, for react-dom/server - name = name.replace('/', '-'); - switch (bundleType) { - case UMD_DEV: - return `${name}.development.js`; - case UMD_PROD: - return `${name}.production.min.js`; - case UMD_PROFILING: - return `${name}.profiling.min.js`; - case NODE_DEV: - return `${name}.development.js`; - case NODE_PROD: - return `${name}.production.min.js`; - case NODE_PROFILING: - return `${name}.profiling.min.js`; - case FB_WWW_DEV: - case RN_OSS_DEV: - case RN_FB_DEV: - return `${globalName}-dev.js`; - case FB_WWW_PROD: - case RN_OSS_PROD: - case RN_FB_PROD: - return `${globalName}-prod.js`; - case FB_WWW_PROFILING: - case RN_FB_PROFILING: - case RN_OSS_PROFILING: - return `${globalName}-profiling.js`; - } -} - -function isProductionBundleType(bundleType) { - switch (bundleType) { - case UMD_DEV: - case NODE_DEV: - case FB_WWW_DEV: - case RN_OSS_DEV: - case RN_FB_DEV: - return false; - case UMD_PROD: - case NODE_PROD: - case UMD_PROFILING: - case NODE_PROFILING: - case FB_WWW_PROD: - case FB_WWW_PROFILING: - case RN_OSS_PROD: - case RN_OSS_PROFILING: - case RN_FB_PROD: - case RN_FB_PROFILING: - return true; - default: - throw new Error(`Unknown type: ${bundleType}`); - } -} - -function isProfilingBundleType(bundleType) { - switch (bundleType) { - case FB_WWW_DEV: - case FB_WWW_PROD: - case NODE_DEV: - case NODE_PROD: - case RN_FB_DEV: - case RN_FB_PROD: - case RN_OSS_DEV: - case RN_OSS_PROD: - case UMD_DEV: - case UMD_PROD: - return false; - case FB_WWW_PROFILING: - case NODE_PROFILING: - case RN_FB_PROFILING: - case RN_OSS_PROFILING: - case UMD_PROFILING: - return true; - default: - throw new Error(`Unknown type: ${bundleType}`); - } -} - -function forbidFBJSImports() { - return { - name: 'forbidFBJSImports', - resolveId(importee, importer) { - if (/^fbjs\//.test(importee)) { - throw new Error( - `Don't import ${importee} (found in ${importer}). ` + - `Use the utilities in packages/shared/ instead.` - ); - } - }, - }; -} - -function getPlugins( - entry, - externals, - updateBabelOptions, - filename, - packageName, - bundleType, - globalName, - moduleType, - pureExternalModules -) { - const findAndRecordErrorCodes = extractErrorCodes(errorCodeOpts); - const forks = Modules.getForks(bundleType, entry, moduleType); - const isProduction = isProductionBundleType(bundleType); - const isProfiling = isProfilingBundleType(bundleType); - const isUMDBundle = - bundleType === UMD_DEV || - bundleType === UMD_PROD || - bundleType === UMD_PROFILING; - const isFBBundle = - bundleType === FB_WWW_DEV || - bundleType === FB_WWW_PROD || - bundleType === FB_WWW_PROFILING; - const isRNBundle = - bundleType === RN_OSS_DEV || - bundleType === RN_OSS_PROD || - bundleType === RN_OSS_PROFILING || - bundleType === RN_FB_DEV || - bundleType === RN_FB_PROD || - bundleType === RN_FB_PROFILING; - const shouldStayReadable = isFBBundle || isRNBundle || forcePrettyOutput; - return [ - // Extract error codes from invariant() messages into a file. - shouldExtractErrors && { - transform(source) { - findAndRecordErrorCodes(source); - return source; - }, - }, - // Shim any modules that need forking in this environment. - useForks(forks), - // Ensure we don't try to bundle any fbjs modules. - forbidFBJSImports(), - // Replace any externals with their valid internal FB mappings - isFBBundle && replace(Bundles.fbBundleExternalsMap), - // Use Node resolution mechanism. - resolve({ - skip: externals, - }), - // Remove license headers from individual modules - stripBanner({ - exclude: 'node_modules/**/*', - }), - // Compile to ES5. - babel(getBabelConfig(updateBabelOptions, bundleType)), - // Remove 'use strict' from individual source files. - { - transform(source) { - return source.replace(/['"]use strict["']/g, ''); - }, - }, - // Turn __DEV__ and process.env checks into constants. - replace({ - __DEV__: isProduction ? 'false' : 'true', - __PROFILE__: isProfiling || !isProduction ? 'true' : 'false', - __UMD__: isUMDBundle ? 'true' : 'false', - 'process.env.NODE_ENV': isProduction ? "'production'" : "'development'", - __EXPERIMENTAL__, - }), - // We still need CommonJS for external deps like object-assign. - commonjs(), - // Apply dead code elimination and/or minification. - isProduction && - closure( - Object.assign({}, closureOptions, { - // Don't let it create global variables in the browser. - // https://github.com/facebook/react/issues/10909 - assume_function_wrapper: !isUMDBundle, - renaming: !shouldStayReadable, - }) - ), - // HACK to work around the fact that Rollup isn't removing unused, pure-module imports. - // Note that this plugin must be called after closure applies DCE. - isProduction && stripUnusedImports(pureExternalModules), - // Add the whitespace back if necessary. - shouldStayReadable && prettier({parser: 'babylon'}), - // License and haste headers, top-level `if` blocks. - { - transformBundle(source) { - return Wrappers.wrapBundle( - source, - bundleType, - globalName, - filename, - moduleType - ); - }, - }, - // Record bundle size. - sizes({ - getSize: (size, gzip) => { - const currentSizes = Stats.currentBuildResults.bundleSizes; - const recordIndex = currentSizes.findIndex( - record => - record.filename === filename && record.bundleType === bundleType - ); - const index = recordIndex !== -1 ? recordIndex : currentSizes.length; - currentSizes[index] = { - filename, - bundleType, - packageName, - size, - gzip, - }; - }, - }), - ].filter(Boolean); -} - -function shouldSkipBundle(bundle, bundleType) { - const shouldSkipBundleType = bundle.bundleTypes.indexOf(bundleType) === -1; - if (shouldSkipBundleType) { - return true; - } - if (requestedBundleTypes.length > 0) { - const isAskingForDifferentType = requestedBundleTypes.every( - requestedType => bundleType.indexOf(requestedType) === -1 - ); - if (isAskingForDifferentType) { - return true; - } - } - if (requestedBundleNames.length > 0) { - const isAskingForDifferentNames = requestedBundleNames.every( - // If the name ends with `something/index` we only match if the - // entry ends in something. Such as `react-dom/index` only matches - // `react-dom` but not `react-dom/server`. Everything else is fuzzy - // search. - requestedName => - (bundle.entry + '/index.js').indexOf(requestedName) === -1 - ); - if (isAskingForDifferentNames) { - return true; - } - } - return false; -} - -async function createBundle(bundle, bundleType) { - if (shouldSkipBundle(bundle, bundleType)) { - return; - } - - const filename = getFilename(bundle.entry, bundle.global, bundleType); - const logKey = - chalk.white.bold(filename) + chalk.dim(` (${bundleType.toLowerCase()})`); - const format = getFormat(bundleType); - const packageName = Packaging.getPackageName(bundle.entry); - - let resolvedEntry = require.resolve(bundle.entry); - const isFBBundle = - bundleType === FB_WWW_DEV || - bundleType === FB_WWW_PROD || - bundleType === FB_WWW_PROFILING; - if (isFBBundle) { - const resolvedFBEntry = resolvedEntry.replace('.js', '.fb.js'); - if (fs.existsSync(resolvedFBEntry)) { - resolvedEntry = resolvedFBEntry; - } - } - - const shouldBundleDependencies = - bundleType === UMD_DEV || - bundleType === UMD_PROD || - bundleType === UMD_PROFILING; - const peerGlobals = Modules.getPeerGlobals(bundle.externals, bundleType); - let externals = Object.keys(peerGlobals); - if (!shouldBundleDependencies) { - const deps = Modules.getDependencies(bundleType, bundle.entry); - externals = externals.concat(deps); - } - if (isFBBundle) { - // Add any mapped fb bundle externals - externals = externals.concat(Object.values(Bundles.fbBundleExternalsMap)); - } - - const importSideEffects = Modules.getImportSideEffects(); - const pureExternalModules = Object.keys(importSideEffects).filter( - module => !importSideEffects[module] - ); - - const rollupConfig = { - input: resolvedEntry, - treeshake: { - pureExternalModules, - }, - external(id) { - const containsThisModule = pkg => id === pkg || id.startsWith(pkg + '/'); - const isProvidedByDependency = externals.some(containsThisModule); - if (!shouldBundleDependencies && isProvidedByDependency) { - return true; - } - return !!peerGlobals[id]; - }, - onwarn: handleRollupWarning, - plugins: getPlugins( - bundle.entry, - externals, - bundle.babel, - filename, - packageName, - bundleType, - bundle.global, - bundle.moduleType, - pureExternalModules - ), - // We can't use getters in www. - legacy: - bundleType === FB_WWW_DEV || - bundleType === FB_WWW_PROD || - bundleType === FB_WWW_PROFILING, - }; - const [mainOutputPath, ...otherOutputPaths] = Packaging.getBundleOutputPaths( - bundleType, - filename, - packageName - ); - const rollupOutputOptions = getRollupOutputOptions( - mainOutputPath, - format, - peerGlobals, - bundle.global, - bundleType - ); - - if (isWatchMode) { - rollupConfig.output = [rollupOutputOptions]; - const watcher = rollup.watch(rollupConfig); - watcher.on('event', async event => { - switch (event.code) { - case 'BUNDLE_START': - console.log(`${chalk.bgYellow.black(' BUILDING ')} ${logKey}`); - break; - case 'BUNDLE_END': - for (let i = 0; i < otherOutputPaths.length; i++) { - await asyncCopyTo(mainOutputPath, otherOutputPaths[i]); - } - console.log(`${chalk.bgGreen.black(' COMPLETE ')} ${logKey}\n`); - break; - case 'ERROR': - case 'FATAL': - console.log(`${chalk.bgRed.black(' OH NOES! ')} ${logKey}\n`); - handleRollupError(event.error); - break; - } - }); - } else { - console.log(`${chalk.bgYellow.black(' BUILDING ')} ${logKey}`); - try { - const result = await rollup.rollup(rollupConfig); - await result.write(rollupOutputOptions); - } catch (error) { - console.log(`${chalk.bgRed.black(' OH NOES! ')} ${logKey}\n`); - handleRollupError(error); - throw error; - } - for (let i = 0; i < otherOutputPaths.length; i++) { - await asyncCopyTo(mainOutputPath, otherOutputPaths[i]); - } - console.log(`${chalk.bgGreen.black(' COMPLETE ')} ${logKey}\n`); - } -} - -function handleRollupWarning(warning) { - if (warning.code === 'UNUSED_EXTERNAL_IMPORT') { - const match = warning.message.match(/external module '([^']+)'/); - if (!match || typeof match[1] !== 'string') { - throw new Error( - 'Could not parse a Rollup warning. ' + 'Fix this method.' - ); - } - const importSideEffects = Modules.getImportSideEffects(); - const externalModule = match[1]; - if (typeof importSideEffects[externalModule] !== 'boolean') { - throw new Error( - 'An external module "' + - externalModule + - '" is used in a DEV-only code path ' + - 'but we do not know if it is safe to omit an unused require() to it in production. ' + - 'Please add it to the `importSideEffects` list in `scripts/rollup/modules.js`.' - ); - } - // Don't warn. We will remove side effectless require() in a later pass. - return; - } - - if (typeof warning.code === 'string') { - // This is a warning coming from Rollup itself. - // These tend to be important (e.g. clashes in namespaced exports) - // so we'll fail the build on any of them. - console.error(); - console.error(warning.message || warning); - console.error(); - process.exit(1); - } else { - // The warning is from one of the plugins. - // Maybe it's not important, so just print it. - console.warn(warning.message || warning); - } -} - -function handleRollupError(error) { - loggedErrors.add(error); - if (!error.code) { - console.error(error); - return; - } - console.error( - `\x1b[31m-- ${error.code}${error.plugin ? ` (${error.plugin})` : ''} --` - ); - console.error(error.stack); - if (error.loc && error.loc.file) { - const {file, line, column} = error.loc; - // This looks like an error from Rollup, e.g. missing export. - // We'll use the accurate line numbers provided by Rollup but - // use Babel code frame because it looks nicer. - const rawLines = fs.readFileSync(file, 'utf-8'); - // column + 1 is required due to rollup counting column start position from 0 - // whereas babel-code-frame counts from 1 - const frame = codeFrame(rawLines, line, column + 1, { - highlightCode: true, - }); - console.error(frame); - } else if (error.codeFrame) { - // This looks like an error from a plugin (e.g. Babel). - // In this case we'll resort to displaying the provided code frame - // because we can't be sure the reported location is accurate. - console.error(error.codeFrame); - } -} - -async function buildEverything() { - if (!argv['unsafe-partial']) { - await asyncRimRaf('build'); - } - - // Run them serially for better console output - // and to avoid any potential race conditions. - - let bundles = []; - // eslint-disable-next-line no-for-of-loops/no-for-of-loops - for (const bundle of Bundles.bundles) { - bundles.push( - [bundle, UMD_DEV], - [bundle, UMD_PROD], - [bundle, UMD_PROFILING], - [bundle, NODE_DEV], - [bundle, NODE_PROD], - [bundle, NODE_PROFILING], - [bundle, RN_OSS_DEV], - [bundle, RN_OSS_PROD], - [bundle, RN_OSS_PROFILING], - [bundle, RN_FB_DEV], - [bundle, RN_FB_PROD], - [bundle, RN_FB_PROFILING] - ); - - if (__EXPERIMENTAL__) { - // www uses experimental builds only. - bundles.push( - [bundle, FB_WWW_DEV], - [bundle, FB_WWW_PROD], - [bundle, FB_WWW_PROFILING] - ); - } - } - - if (!shouldExtractErrors && process.env.CIRCLE_NODE_TOTAL) { - // In CI, parallelize bundles across multiple tasks. - const nodeTotal = parseInt(process.env.CIRCLE_NODE_TOTAL, 10); - const nodeIndex = parseInt(process.env.CIRCLE_NODE_INDEX, 10); - bundles = bundles.filter((_, i) => i % nodeTotal === nodeIndex); - } - - // eslint-disable-next-line no-for-of-loops/no-for-of-loops - for (const [bundle, bundleType] of bundles) { - await createBundle(bundle, bundleType); - } - - await Packaging.copyAllShims(); - await Packaging.prepareNpmPackages(); - - if (syncFBSourcePath) { - await Sync.syncReactNative(syncFBSourcePath); - } else if (syncWWWPath) { - await Sync.syncReactDom('build/facebook-www', syncWWWPath); - } - - console.log(Stats.printResults()); - if (!forcePrettyOutput) { - Stats.saveResults(); - } - - if (shouldExtractErrors) { - console.warn( - '\nWarning: this build was created with --extract-errors enabled.\n' + - 'this will result in extremely slow builds and should only be\n' + - 'used when the error map needs to be rebuilt.\n' - ); - } -} - -buildEverything(); diff --git a/scripts/rollup/build/createBundle.js b/scripts/rollup/build/createBundle.js new file mode 100644 index 000000000000..532ee314ddb5 --- /dev/null +++ b/scripts/rollup/build/createBundle.js @@ -0,0 +1,171 @@ +'use strict'; + +const rollup = require('rollup'); +const chalk = require('chalk'); +const fs = require('fs'); +const path = require('path'); +const argv = require('minimist')(process.argv.slice(2)); +const Modules = require('../modules'); +const Bundles = require('../bundles'); +const Packaging = require('../packaging'); +const {asyncCopyTo} = require('../utils'); +const { + isProductionBundleType, + isSkippableBundle, + isFatBundle, + isFacebookBundle, + isWatchMode, +} = require('./predicates'); +const getFilename = require('./getFilename'); +const getFormat = require('./getFormat'); +const { + handleRollupWarning, + handleRollupError, +} = require('./handleRollupIssues'); +const getRollupPlugins = require('./getRollupPlugins'); +const {building, complete, fatal} = require('./messages'); + +module.exports = async function createBundle(bundle, bundleType) { + if (isSkippableBundle(bundle, bundleType)) { + return; + } + + const filename = getFilename(bundle.entry, bundle.global, bundleType); + const logKey = + chalk.white.bold(filename) + chalk.dim(` (${bundleType.toLowerCase()})`); + const format = getFormat(bundleType); + const packageName = Packaging.getPackageName(bundle.entry); + const peerGlobals = Modules.getPeerGlobals(bundle.externals, bundleType); + const rollupConfig = getRollupConfig(bundle, bundleType, packageName); + const [mainOutputPath, ...otherOutputPaths] = Packaging.getBundleOutputPaths( + bundleType, + filename, + packageName + ); + const rollupOutputOptions = getRollupOutputOptions( + mainOutputPath, + format, + peerGlobals, + bundle.global, + bundleType + ); + + if (isWatchMode()) { + rollupConfig.output = [rollupOutputOptions]; + const watcher = rollup.watch(rollupConfig); + watcher.on('event', async event => { + switch (event.code) { + case 'BUNDLE_START': + console.log(building(logKey)); + break; + case 'BUNDLE_END': + for (let i = 0; i < otherOutputPaths.length; i++) { + await asyncCopyTo(mainOutputPath, otherOutputPaths[i]); + } + console.log(complete(logKey)); + break; + case 'ERROR': + case 'FATAL': + console.log(fatal(logKey)); + handleRollupError(event.error); + break; + } + }); + } else { + console.log(building(logKey)); + try { + const spec = await rollup.rollup(rollupConfig); + await spec.write(rollupOutputOptions); + } catch (error) { + console.log(fatal(logKey)); + handleRollupError(error); + throw error; + } + for (let i = 0; i < otherOutputPaths.length; i++) { + await asyncCopyTo(mainOutputPath, otherOutputPaths[i]); + } + console.log(complete(logKey)); + } +}; + +function getRollupOutputOptions( + outputPath, + format, + globals, + globalName, + bundleType +) { + const isProduction = isProductionBundleType(bundleType); + return Object.assign( + {}, + { + file: outputPath, + format, + globals, + freeze: !isProduction, + interop: false, + name: globalName, + sourcemap: false, + } + ); +} + +function getRollupConfig(bundle, bundleType, packageName) { + const filename = getFilename(bundle.entry, bundle.global, bundleType); + let resolvedEntry = require.resolve(bundle.entry); + const isFBBundle = isFacebookBundle(bundleType); + + if (isFBBundle) { + const resolvedFBEntry = resolvedEntry.replace('.js', '.fb.js'); + if (fs.existsSync(resolvedFBEntry)) { + resolvedEntry = resolvedFBEntry; + } + } + + const shouldBundleDependencies = isFatBundle(bundleType); + const peerGlobals = Modules.getPeerGlobals(bundle.externals, bundleType); + let externals = Object.keys(peerGlobals); + if (!shouldBundleDependencies) { + const deps = Modules.getDependencies(bundleType, bundle.entry); + externals = externals.concat(deps); + } + if (isFBBundle) { + // Add any mapped fb bundle externals + externals = externals.concat(Object.values(Bundles.fbBundleExternalsMap)); + } + + const importSideEffects = Modules.getImportSideEffects(); + const pureExternalModules = Object.keys(importSideEffects).filter( + module => !importSideEffects[module] + ); + + return { + input: resolvedEntry, + treeshake: { + pureExternalModules, + }, + external(id) { + const containsThisModule = pkg => id === pkg || id.startsWith(pkg + '/'); + const isProvidedByDependency = externals.some(containsThisModule); + if (!shouldBundleDependencies && isProvidedByDependency) { + return true; + } + return !!peerGlobals[id]; + }, + onwarn: handleRollupWarning, + plugins: getRollupPlugins( + bundle.entry, + externals, + bundle.babel, + filename, + packageName, + bundleType, + bundle.global, + bundle.moduleType, + pureExternalModules + ), + // We can't use getters in www. + // TODO + // legacy: isFacebookBundle(bundleType), + }; +} diff --git a/scripts/rollup/build/getBabelConfig.js b/scripts/rollup/build/getBabelConfig.js new file mode 100644 index 000000000000..e89c2c084ebb --- /dev/null +++ b/scripts/rollup/build/getBabelConfig.js @@ -0,0 +1,91 @@ +'use strict'; + +const path = require('path'); +const Bundles = require('../bundles'); + +const { + UMD_DEV, + UMD_PROD, + UMD_PROFILING, + ESM_DEV, + ESM_PROD, + NODE_DEV, + NODE_PROD, + NODE_PROFILING, + FB_WWW_DEV, + FB_WWW_PROD, + FB_WWW_PROFILING, + RN_OSS_DEV, + RN_OSS_PROD, + RN_OSS_PROFILING, + RN_FB_DEV, + RN_FB_PROD, + RN_FB_PROFILING, +} = Bundles.bundleTypes; + +module.exports = function getBabelConfig( + updateBabelOptions, + bundleType, + filename +) { + let options = { + exclude: '/**/node_modules/**', + presets: [], + plugins: [], + }; + if (updateBabelOptions) { + options = updateBabelOptions(options); + } + switch (bundleType) { + case FB_WWW_DEV: + case FB_WWW_PROD: + case FB_WWW_PROFILING: + return Object.assign({}, options, { + plugins: options.plugins.concat([ + // Minify invariant messages + require('../../error-codes/transform-error-messages'), + // Wrap warning() calls in a __DEV__ check so they are stripped from production. + require('../../babel/wrap-warning-with-env-check'), + // Remove getters for IE8 support + require('../../babel/transform-remove-getters'), + ]), + }); + case RN_OSS_DEV: + case RN_OSS_PROD: + case RN_OSS_PROFILING: + case RN_FB_DEV: + case RN_FB_PROD: + case RN_FB_PROFILING: + return Object.assign({}, options, { + plugins: options.plugins.concat([ + [ + require('../../error-codes/transform-error-messages'), + // Preserve full error messages in React Native build + {noMinify: true}, + ], + // Wrap warning() calls in a __DEV__ check so they are stripped from production. + require('../../babel/wrap-warning-with-env-check'), + ]), + }); + case UMD_DEV: + case UMD_PROD: + case UMD_PROFILING: + case ESM_DEV: + case ESM_PROD: + case NODE_DEV: + case NODE_PROD: + case NODE_PROFILING: + return Object.assign({}, options, { + plugins: options.plugins.concat([ + // Use object-assign polyfill in open source + path.resolve('./scripts/babel/transform-object-assign-require'), + // Minify invariant messages + require('../../error-codes/transform-error-messages'), + // Wrap warning() calls in a __DEV__ check so they are stripped from production. + require('../../babel/wrap-warning-with-env-check'), + ]), + }); + default: + return options; + } +}; diff --git a/scripts/rollup/build/getBundlesToBuild.js b/scripts/rollup/build/getBundlesToBuild.js new file mode 100644 index 000000000000..5466611a2ea9 --- /dev/null +++ b/scripts/rollup/build/getBundlesToBuild.js @@ -0,0 +1,56 @@ +'use strict'; + +const {isExperimental} = require('./predicates'); +const Bundles = require('../bundles'); +const { + UMD_DEV, + UMD_PROD, + UMD_PROFILING, + ESM_DEV, + ESM_PROD, + NODE_DEV, + NODE_PROD, + NODE_PROFILING, + FB_WWW_DEV, + FB_WWW_PROD, + FB_WWW_PROFILING, + RN_OSS_DEV, + RN_OSS_PROD, + RN_OSS_PROFILING, + RN_FB_DEV, + RN_FB_PROD, + RN_FB_PROFILING, +} = Bundles.bundleTypes; + +module.exports = function getBundlesToBuild() { + let bundles = []; + // eslint-disable-next-line no-for-of-loops/no-for-of-loops + for (const bundle of Bundles.bundles) { + bundles.push( + [bundle, UMD_DEV], + [bundle, UMD_PROD], + [bundle, UMD_PROFILING], + [bundle, NODE_DEV], + [bundle, NODE_PROD], + [bundle, NODE_PROFILING], + [bundle, ESM_DEV], + [bundle, ESM_PROD], + [bundle, RN_OSS_DEV], + [bundle, RN_OSS_PROD], + [bundle, RN_OSS_PROFILING], + [bundle, RN_FB_DEV], + [bundle, RN_FB_PROD], + [bundle, RN_FB_PROFILING] + ); + + if (isExperimental()) { + // www uses experimental builds only. + bundles.push( + [bundle, FB_WWW_DEV], + [bundle, FB_WWW_PROD], + [bundle, FB_WWW_PROFILING] + ); + } + } + return bundles; +}; diff --git a/scripts/rollup/build/getFilename.js b/scripts/rollup/build/getFilename.js new file mode 100644 index 000000000000..f876cfae075a --- /dev/null +++ b/scripts/rollup/build/getFilename.js @@ -0,0 +1,59 @@ +'use strict'; +const Bundles = require('../bundles'); +const { + UMD_DEV, + UMD_PROD, + UMD_PROFILING, + ESM_DEV, + ESM_PROD, + NODE_DEV, + NODE_PROD, + NODE_PROFILING, + FB_WWW_DEV, + FB_WWW_PROD, + FB_WWW_PROFILING, + RN_OSS_DEV, + RN_OSS_PROD, + RN_OSS_PROFILING, + RN_FB_DEV, + RN_FB_PROD, + RN_FB_PROFILING, +} = Bundles.bundleTypes; + +/** + * Gets the output filename to use based on the bundle type + */ +module.exports = function getFilename(name, globalName, bundleType) { + // we do this to replace / to -, for react-dom/server + name = name.replace('/', '-'); + switch (bundleType) { + case UMD_DEV: + return `${name}.development.js`; + case UMD_PROD: + return `${name}.production.min.js`; + case UMD_PROFILING: + return `${name}.profiling.min.js`; + case ESM_DEV: + return `${name}.development.mjs`; + case ESM_PROD: + return `${name}.production.min.mjs`; + case NODE_DEV: + return `${name}.development.js`; + case NODE_PROD: + return `${name}.production.min.js`; + case NODE_PROFILING: + return `${name}.profiling.min.js`; + case FB_WWW_DEV: + case RN_OSS_DEV: + case RN_FB_DEV: + return `${globalName}-dev.js`; + case FB_WWW_PROD: + case RN_OSS_PROD: + case RN_FB_PROD: + return `${globalName}-prod.js`; + case FB_WWW_PROFILING: + case RN_FB_PROFILING: + case RN_OSS_PROFILING: + return `${globalName}-profiling.js`; + } +}; diff --git a/scripts/rollup/build/getFormat.js b/scripts/rollup/build/getFormat.js new file mode 100644 index 000000000000..5f10b95ce859 --- /dev/null +++ b/scripts/rollup/build/getFormat.js @@ -0,0 +1,50 @@ +'use strict'; + +const Bundles = require('../bundles'); +const { + UMD_DEV, + UMD_PROD, + UMD_PROFILING, + ESM_DEV, + ESM_PROD, + NODE_DEV, + NODE_PROD, + NODE_PROFILING, + FB_WWW_DEV, + FB_WWW_PROD, + FB_WWW_PROFILING, + RN_OSS_DEV, + RN_OSS_PROD, + RN_OSS_PROFILING, + RN_FB_DEV, + RN_FB_PROD, + RN_FB_PROFILING, +} = Bundles.bundleTypes; + +/** + * Gets the rollup output format to use based on the bundle type + */ +module.exports = function getFormat(bundleType) { + switch (bundleType) { + case UMD_DEV: + case UMD_PROD: + case UMD_PROFILING: + return `umd`; + case ESM_DEV: + case ESM_PROD: + return 'es'; + case NODE_DEV: + case NODE_PROD: + case NODE_PROFILING: + case FB_WWW_DEV: + case FB_WWW_PROD: + case FB_WWW_PROFILING: + case RN_OSS_DEV: + case RN_OSS_PROD: + case RN_OSS_PROFILING: + case RN_FB_DEV: + case RN_FB_PROD: + case RN_FB_PROFILING: + return `cjs`; + } +}; diff --git a/scripts/rollup/build/getRollupPlugins.js b/scripts/rollup/build/getRollupPlugins.js new file mode 100644 index 000000000000..c016a16b91d8 --- /dev/null +++ b/scripts/rollup/build/getRollupPlugins.js @@ -0,0 +1,168 @@ +'use strict'; +require('./handlePromiseErrors'); +const babel = require('rollup-plugin-babel'); +const closure = require('../plugins/closure-plugin'); +const commonjs = require('rollup-plugin-commonjs'); +const prettier = require('rollup-plugin-prettier'); +const replace = require('rollup-plugin-replace'); +const stripBanner = require('rollup-plugin-strip-banner'); +const {terser} = require('rollup-plugin-terser'); +const resolve = require('rollup-plugin-node-resolve'); +const argv = require('minimist')(process.argv.slice(2)); +const Modules = require('../modules'); +const Bundles = require('../bundles'); +const Stats = require('../stats'); +const sizes = require('../plugins/sizes-plugin'); +const useForks = require('../plugins/use-forks-plugin'); +const forbidFBJSImports = require('../plugins/forbid-fbjs'); +const stripUnusedImports = require('../plugins/strip-unused-imports'); +const extractErrorCodes = require('../../error-codes/extract-errors'); +const Wrappers = require('../wrappers'); +const getBabelConfig = require('./getBabelConfig'); +const { + isProductionBundleType, + isEsmBundle, + isProfilingBundleType, + isExperimental, + isFacebookBundle, + isUmdBundle, + isReactNativeBundleType, + isPrettyOutput, +} = require('./predicates'); + +const shouldExtractErrors = argv['extract-errors']; +const errorCodeOpts = { + errorMapFilePath: 'scripts/error-codes/codes.json', +}; + +const closureOptions = { + compilation_level: 'SIMPLE', + env: 'CUSTOM', + warning_level: 'QUIET', + module_resolution: 'NODE', + apply_input_source_maps: false, + use_types_for_optimization: false, + process_common_js_modules: false, + rewrite_polyfills: false, +}; + +function getOutputType(bundleType) { + if (isEsmBundle(bundleType)) { + return 'ECMASCRIPT6_STRICT'; + } else { + return 'ECMASCRIPT5_STRICT'; + } +} + +module.exports = function getPlugins( + entry, + externals, + updateBabelOptions, + filename, + packageName, + bundleType, + globalName, + moduleType, + pureExternalModules +) { + const findAndRecordErrorCodes = extractErrorCodes(errorCodeOpts); + const forks = Modules.getForks(bundleType, entry, moduleType); + const isProduction = isProductionBundleType(bundleType); + const isProfiling = isProfilingBundleType(bundleType); + const isUMDBundle = isUmdBundle(bundleType); + const isFBBundle = isFacebookBundle(bundleType); + const shouldStayReadable = + isFBBundle || isReactNativeBundleType(bundleType) || isPrettyOutput(); + + return [ + // Extract error codes from invariant() messages into a file. + shouldExtractErrors && { + transform(source) { + findAndRecordErrorCodes(source); + return source; + }, + }, + // Shim any modules that need forking in this environment. + useForks(forks), + // Ensure we don't try to bundle any fbjs modules. + forbidFBJSImports(), + // Replace any externals with their valid internal FB mappings + isFBBundle && replace(Bundles.fbBundleExternalsMap), + // Use Node resolution mechanism. + resolve({ + external: externals, + }), + // Remove license headers from individual modules + stripBanner({ + exclude: 'node_modules/**/*', + }), + // Compile to ES5. + babel(getBabelConfig(updateBabelOptions, bundleType)), + // Remove 'use strict' from individual source files. + { + transform(source) { + return source.replace(/['"]use strict["']/g, ''); + }, + }, + // Turn __DEV__ and process.env checks into constants. + replace({ + __DEV__: isProduction ? 'false' : 'true', + __PROFILE__: isProfiling || !isProduction ? 'true' : 'false', + __UMD__: isUMDBundle ? 'true' : 'false', + 'process.env.NODE_ENV': isProduction ? "'production'" : "'development'", + __EXPERIMENTAL__: isExperimental(), + }), + // We still need CommonJS for external deps like object-assign. + commonjs(), + // Apply dead code elimination and/or minification. + // TODO: using terser on ESM code is a stopgap until we can get + // closure compiler working on ESM + isProduction && + (isEsmBundle(bundleType) + ? terser() + : closure( + Object.assign({}, closureOptions, { + // Don't let it create global variables in the browser. + // https://github.com/facebook/react/issues/10909 + assume_function_wrapper: !isUMDBundle, + renaming: !shouldStayReadable, + language_out: getOutputType(bundleType), + }) + )), + // HACK to work around the fact that Rollup isn't removing unused, pure-module imports. + // Note that this plugin must be called after closure applies DCE. + isProduction && stripUnusedImports(pureExternalModules), + // Add the whitespace back if necessary. + shouldStayReadable && prettier({parser: 'babylon'}), + // License and haste headers, top-level `if` blocks. + { + renderChunk(source) { + return Wrappers.wrapBundle( + source, + bundleType, + globalName, + filename, + moduleType + ); + }, + }, + // Record bundle size. + sizes({ + getSize: (size, gzip) => { + const currentSizes = Stats.currentBuildResults.bundleSizes; + const recordIndex = currentSizes.findIndex( + record => + record.filename === filename && record.bundleType === bundleType + ); + const index = recordIndex !== -1 ? recordIndex : currentSizes.length; + currentSizes[index] = { + filename, + bundleType, + packageName, + size, + gzip, + }; + }, + }), + ].filter(Boolean); +}; diff --git a/scripts/rollup/build/handlePromiseErrors.js b/scripts/rollup/build/handlePromiseErrors.js new file mode 100644 index 000000000000..6274b122d375 --- /dev/null +++ b/scripts/rollup/build/handlePromiseErrors.js @@ -0,0 +1,11 @@ +// Errors in promises should be fatal. +let loggedErrors = new Set(); +process.on('unhandledRejection', err => { + if (loggedErrors.has(err)) { + // No need to print it twice. + process.exit(1); + } + throw err; +}); + +module.exports = loggedErrors; diff --git a/scripts/rollup/build/handleRollupIssues.js b/scripts/rollup/build/handleRollupIssues.js new file mode 100644 index 000000000000..ed031e366e46 --- /dev/null +++ b/scripts/rollup/build/handleRollupIssues.js @@ -0,0 +1,82 @@ +'use strict'; +const fs = require('fs'); +const Modules = require('../modules'); +const codeFrame = require('babel-code-frame'); +const loggedErrors = require('./handlePromiseErrors'); + +function handleRollupWarning(warning) { + if (warning.code === 'CIRCULAR_DEPENDENCY') { + // TODO: filter valid circular deps + return; + } + if (warning.code === 'UNUSED_EXTERNAL_IMPORT') { + const match = warning.message.match(/external module '([^']+)'/); + if (!match || typeof match[1] !== 'string') { + throw new Error( + 'Could not parse a Rollup warning. ' + 'Fix this method.' + ); + } + const importSideEffects = Modules.getImportSideEffects(); + const externalModule = match[1]; + if (typeof importSideEffects[externalModule] !== 'boolean') { + throw new Error( + 'An external module "' + + externalModule + + '" is used in a DEV-only code path ' + + 'but we do not know if it is safe to omit an unused require() to it in production. ' + + 'Please add it to the `importSideEffects` list in `scripts/rollup/modules.js`.' + ); + } + // Don't warn. We will remove side effectless require() in a later pass. + return; + } + + if (typeof warning.code === 'string') { + // This is a warning coming from Rollup itself. + // These tend to be important (e.g. clashes in namespaced exports) + // so we'll fail the build on any of them. + console.error(); + console.error(warning.message || warning); + console.error(); + process.exit(1); + } else { + // The warning is from one of the plugins. + // Maybe it's not important, so just print it. + console.warn(warning.message || warning); + } +} + +function handleRollupError(error) { + loggedErrors.add(error); + if (!error.code) { + console.error(error); + return; + } + console.error( + `\x1b[31m-- ${error.code}${error.plugin ? ` (${error.plugin})` : ''} --` + ); + console.error(error.stack); + if (error.loc && error.loc.file) { + const {file, line, column} = error.loc; + // This looks like an error from Rollup, e.g. missing export. + // We'll use the accurate line numbers provided by Rollup but + // use Babel code frame because it looks nicer. + const rawLines = fs.readFileSync(file, 'utf-8'); + // column + 1 is required due to rollup counting column start position from 0 + // whereas babel-code-frame counts from 1 + const frame = codeFrame(rawLines, line, column + 1, { + highlightCode: true, + }); + console.error(frame); + } else if (error.codeFrame) { + // This looks like an error from a plugin (e.g. Babel). + // In this case we'll resort to displaying the provided code frame + // because we can't be sure the reported location is accurate. + console.error(error.codeFrame); + } +} + +module.exports = { + handleRollupError, + handleRollupWarning, +}; diff --git a/scripts/rollup/build/index.js b/scripts/rollup/build/index.js new file mode 100644 index 000000000000..2e88557eca65 --- /dev/null +++ b/scripts/rollup/build/index.js @@ -0,0 +1,74 @@ +'use strict'; + +require('./handlePromiseErrors'); +const argv = require('minimist')(process.argv.slice(2)); +const Stats = require('../stats'); +const Sync = require('../sync'); +const path = require('path'); +const Packaging = require('../packaging'); +const {asyncRimRaf, asyncCopyTo} = require('../utils'); +const getBundlesToBuild = require('./getBundlesToBuild'); +const createBundle = require('./createBundle'); +const { + isUnsafePartialBuild, + isPrettyOutput, + shouldExtractErrors, +} = require('./predicates'); + +const syncFBSourcePath = argv['sync-fbsource']; +const syncWWWPath = argv['sync-www']; + +async function buildEverything() { + /** + * Remove the build directory unless the unsafe-partial CLI flag is set + */ + if (!isUnsafePartialBuild()) { + await asyncRimRaf('build'); + } + + // Copy the package-check script + asyncCopyTo( + path.join(__dirname, '../../tasks/package-check.js'), + path.join(__dirname, '../../../build/package-check.js') + ); + + // Run bundle builds serially for better console output + // and to avoid any potential race conditions. + let bundles = getBundlesToBuild(); + + if (!shouldExtractErrors() && process.env.CIRCLE_NODE_TOTAL) { + // In CI, parallelize bundles across multiple tasks. + const nodeTotal = parseInt(process.env.CIRCLE_NODE_TOTAL, 10); + const nodeIndex = parseInt(process.env.CIRCLE_NODE_INDEX, 10); + bundles = bundles.filter((_, i) => i % nodeTotal === nodeIndex); + } + + // eslint-disable-next-line no-for-of-loops/no-for-of-loops + for (const [bundle, bundleType] of bundles) { + await createBundle(bundle, bundleType); + } + + await Packaging.copyAllShims(); + await Packaging.prepareNpmPackages(); + + if (syncFBSourcePath) { + await Sync.syncReactNative(syncFBSourcePath); + } else if (syncWWWPath) { + await Sync.syncReactDom('build/facebook-www', syncWWWPath); + } + + console.log(Stats.printResults()); + if (!isPrettyOutput()) { + Stats.saveResults(); + } + + if (shouldExtractErrors()) { + console.warn( + '\nWarning: this build was created with --extract-errors enabled.\n' + + 'this will result in extremely slow builds and should only be\n' + + 'used when the error map needs to be rebuilt.\n' + ); + } +} + +buildEverything(); diff --git a/scripts/rollup/build/messages.js b/scripts/rollup/build/messages.js new file mode 100644 index 000000000000..2e391a4bf420 --- /dev/null +++ b/scripts/rollup/build/messages.js @@ -0,0 +1,21 @@ +'use strict'; + +const chalk = require('chalk'); + +function building(logKey) { + return `${chalk.bgYellow.black(' BUILDING ')} ${logKey}`; +} + +function complete(logKey) { + return `${chalk.bgGreen.black(' COMPLETE ')} ${logKey}\n`; +} + +function fatal(logKey) { + return `${chalk.bgRed.black(' OH NOES! ')} ${logKey}\n`; +} + +module.exports = { + building, + complete, + fatal, +}; diff --git a/scripts/rollup/build/predicates.js b/scripts/rollup/build/predicates.js new file mode 100644 index 000000000000..0f168311f8dd --- /dev/null +++ b/scripts/rollup/build/predicates.js @@ -0,0 +1,209 @@ +'use strict'; +const Bundles = require('../bundles'); +const argv = require('minimist')(process.argv.slice(2)); +const RELEASE_CHANNEL = process.env.RELEASE_CHANNEL; + +// Default to building in experimental mode. If the release channel is set via +// an environment variable, then check if it's "experimental". +function isExperimental() { + return typeof RELEASE_CHANNEL === 'string' + ? RELEASE_CHANNEL === 'experimental' + : true; +} + +function isWatchMode() { + return argv.watch; +} + +function isUnsafePartialBuild() { + return argv['unsafe-partial']; +} + +function isPrettyOutput() { + return argv.pretty; +} + +function shouldExtractErrors() { + return argv['extract-errors']; +} + +const { + UMD_DEV, + UMD_PROD, + UMD_PROFILING, + ESM_DEV, + ESM_PROD, + NODE_DEV, + NODE_PROD, + NODE_PROFILING, + FB_WWW_DEV, + FB_WWW_PROD, + FB_WWW_PROFILING, + RN_OSS_DEV, + RN_OSS_PROD, + RN_OSS_PROFILING, + RN_FB_DEV, + RN_FB_PROD, + RN_FB_PROFILING, +} = Bundles.bundleTypes; + +function isReactNativeBundleType(bundleType) { + return ( + bundleType === RN_OSS_DEV || + bundleType === RN_OSS_PROD || + bundleType === RN_OSS_PROFILING || + bundleType === RN_FB_DEV || + bundleType === RN_FB_PROD || + bundleType === RN_FB_PROFILING + ); +} + +function isProductionBundleType(bundleType) { + switch (bundleType) { + case UMD_DEV: + case NODE_DEV: + case ESM_DEV: + case FB_WWW_DEV: + case RN_OSS_DEV: + case RN_FB_DEV: + return false; + case UMD_PROD: + case NODE_PROD: + case UMD_PROFILING: + case NODE_PROFILING: + case ESM_PROD: + case FB_WWW_PROD: + case FB_WWW_PROFILING: + case RN_OSS_PROD: + case RN_OSS_PROFILING: + case RN_FB_PROD: + case RN_FB_PROFILING: + return true; + default: + throw new Error(`Unknown type: ${bundleType}`); + } +} + +function isEsmBundle(bundleType) { + return bundleType === ESM_DEV || bundleType === ESM_PROD; +} + +function isProfilingBundleType(bundleType) { + switch (bundleType) { + case FB_WWW_DEV: + case FB_WWW_PROD: + case NODE_DEV: + case NODE_PROD: + case RN_FB_DEV: + case RN_FB_PROD: + case RN_OSS_DEV: + case RN_OSS_PROD: + case UMD_DEV: + case UMD_PROD: + case ESM_DEV: + case ESM_PROD: + return false; + case FB_WWW_PROFILING: + case NODE_PROFILING: + case RN_FB_PROFILING: + case RN_OSS_PROFILING: + case UMD_PROFILING: + return true; + default: + throw new Error(`Unknown type: ${bundleType}`); + } +} + +function isFatBundle(bundleType) { + return ( + bundleType === UMD_DEV || + bundleType === UMD_PROD || + bundleType === UMD_PROFILING + ); +} + +function isFacebookBundle(bundleType) { + return ( + bundleType === FB_WWW_DEV || + bundleType === FB_WWW_PROD || + bundleType === FB_WWW_PROFILING + ); +} + +function isUmdBundle(bundleType) { + return ( + bundleType === UMD_DEV || + bundleType === UMD_PROD || + bundleType === UMD_PROFILING + ); +} + +function isSkippableBundle(bundle, bundleType) { + const shouldSkipBundleType = bundle.bundleTypes.indexOf(bundleType) === -1; + if (shouldSkipBundleType) { + return true; + } + if (requestedBundleTypes.length > 0) { + const isAskingForDifferentType = requestedBundleTypes.every( + requestedType => bundleType.indexOf(requestedType) === -1 + ); + if (isAskingForDifferentType) { + return true; + } + } + if (requestedBundleNames.length > 0) { + const isAskingForDifferentNames = requestedBundleNames.every( + // If the name ends with `something/index` we only match if the + // entry ends in something. Such as `react-dom/index` only matches + // `react-dom` but not `react-dom/server`. Everything else is fuzzy + // search. + requestedName => + (bundle.entry + '/index.js').indexOf(requestedName) === -1 + ); + if (isAskingForDifferentNames) { + return true; + } + } + return false; +} + +const requestedBundleTypes = argv.type + ? parseRequestedNames([argv.type], 'uppercase') + : []; +const requestedBundleNames = parseRequestedNames(argv._, 'lowercase'); + +function parseRequestedNames(names, toCase) { + let result = []; + for (let i = 0; i < names.length; i++) { + let splitNames = names[i].split(','); + for (let j = 0; j < splitNames.length; j++) { + let name = splitNames[j].trim(); + if (!name) { + continue; + } + if (toCase === 'uppercase') { + name = name.toUpperCase(); + } else if (toCase === 'lowercase') { + name = name.toLowerCase(); + } + result.push(name); + } + } + return result; +} + +module.exports = { + isProductionBundleType, + isEsmBundle, + isProfilingBundleType, + isSkippableBundle, + isFatBundle, + isFacebookBundle, + isExperimental, + isWatchMode, + isUnsafePartialBuild, + isPrettyOutput, + isUmdBundle, + shouldExtractErrors, + isReactNativeBundleType, +}; diff --git a/scripts/rollup/bundles.js b/scripts/rollup/bundles.js index 956e67065326..1b7706c2d07a 100644 --- a/scripts/rollup/bundles.js +++ b/scripts/rollup/bundles.js @@ -4,6 +4,8 @@ const bundleTypes = { UMD_DEV: 'UMD_DEV', UMD_PROD: 'UMD_PROD', UMD_PROFILING: 'UMD_PROFILING', + ESM_DEV: 'ESM_DEV', + ESM_PROD: 'ESM_PROD', NODE_DEV: 'NODE_DEV', NODE_PROD: 'NODE_PROD', NODE_PROFILING: 'NODE_PROFILING', @@ -24,6 +26,8 @@ const { UMD_PROFILING, NODE_DEV, NODE_PROD, + ESM_DEV, + ESM_PROD, NODE_PROFILING, FB_WWW_DEV, FB_WWW_PROD, @@ -64,6 +68,8 @@ const bundles = [ UMD_DEV, UMD_PROD, UMD_PROFILING, + ESM_DEV, + ESM_PROD, NODE_DEV, NODE_PROD, FB_WWW_DEV, @@ -82,6 +88,8 @@ const bundles = [ UMD_DEV, UMD_PROD, UMD_PROFILING, + ESM_DEV, + ESM_PROD, NODE_DEV, NODE_PROD, NODE_PROFILING, @@ -98,7 +106,15 @@ const bundles = [ /******* Test Utils *******/ { moduleType: RENDERER_UTILS, - bundleTypes: [FB_WWW_DEV, NODE_DEV, NODE_PROD, UMD_DEV, UMD_PROD], + bundleTypes: [ + FB_WWW_DEV, + NODE_DEV, + NODE_PROD, + UMD_DEV, + UMD_PROD, + ESM_DEV, + ESM_PROD, + ], entry: 'react-dom/test-utils', global: 'ReactTestUtils', externals: ['react', 'react-dom'], @@ -111,6 +127,8 @@ const bundles = [ UMD_PROD, NODE_DEV, NODE_PROD, + ESM_DEV, + ESM_PROD, FB_WWW_DEV, FB_WWW_PROD, ], @@ -127,6 +145,8 @@ const bundles = [ UMD_PROD, NODE_DEV, NODE_PROD, + ESM_DEV, + ESM_PROD, FB_WWW_DEV, FB_WWW_PROD, ], @@ -142,7 +162,7 @@ const bundles = [ }), }, { - bundleTypes: [NODE_DEV, NODE_PROD], + bundleTypes: [NODE_DEV, NODE_PROD, ESM_DEV, ESM_PROD], moduleType: NON_FIBER_RENDERER, entry: 'react-dom/server.node', externals: ['react', 'stream'], @@ -156,14 +176,21 @@ const bundles = [ /******* React DOM Fizz Server *******/ { - bundleTypes: [NODE_DEV, NODE_PROD, UMD_DEV, UMD_PROD], + bundleTypes: [NODE_DEV, NODE_PROD, UMD_DEV, UMD_PROD, ESM_DEV, ESM_PROD], moduleType: RENDERER, entry: 'react-dom/unstable-fizz.browser', global: 'ReactDOMFizzServer', externals: ['react', 'react-dom/server'], }, { - bundleTypes: [NODE_DEV, NODE_PROD, FB_WWW_DEV, FB_WWW_PROD], + bundleTypes: [ + NODE_DEV, + NODE_PROD, + FB_WWW_DEV, + FB_WWW_PROD, + ESM_DEV, + ESM_PROD, + ], moduleType: RENDERER, entry: 'react-dom/unstable-fizz.node', global: 'ReactDOMFizzServer', @@ -172,14 +199,21 @@ const bundles = [ /******* React DOM Flight Server Webpack *******/ { - bundleTypes: [NODE_DEV, NODE_PROD, UMD_DEV, UMD_PROD], + bundleTypes: [NODE_DEV, NODE_PROD, UMD_DEV, UMD_PROD, ESM_DEV, ESM_PROD], moduleType: RENDERER, entry: 'react-flight-dom-webpack/server.browser', global: 'ReactFlightDOMServer', externals: ['react', 'react-dom/server'], }, { - bundleTypes: [NODE_DEV, NODE_PROD, FB_WWW_DEV, FB_WWW_PROD], + bundleTypes: [ + NODE_DEV, + NODE_PROD, + FB_WWW_DEV, + FB_WWW_PROD, + ESM_DEV, + ESM_PROD, + ], moduleType: RENDERER, entry: 'react-flight-dom-webpack/server.node', global: 'ReactFlightDOMServer', @@ -193,6 +227,8 @@ const bundles = [ NODE_PROD, UMD_DEV, UMD_PROD, + ESM_DEV, + ESM_PROD, FB_WWW_DEV, FB_WWW_PROD, ], @@ -209,6 +245,8 @@ const bundles = [ UMD_PROD, NODE_DEV, NODE_PROD, + ESM_DEV, + ESM_PROD, FB_WWW_DEV, FB_WWW_PROD, ], @@ -287,7 +325,15 @@ const bundles = [ /******* React Test Renderer *******/ { - bundleTypes: [FB_WWW_DEV, NODE_DEV, NODE_PROD, UMD_DEV, UMD_PROD], + bundleTypes: [ + FB_WWW_DEV, + NODE_DEV, + NODE_PROD, + ESM_DEV, + ESM_PROD, + UMD_DEV, + UMD_PROD, + ], moduleType: RENDERER, entry: 'react-test-renderer', global: 'ReactTestRenderer', @@ -300,7 +346,15 @@ const bundles = [ }), }, { - bundleTypes: [FB_WWW_DEV, NODE_DEV, NODE_PROD, UMD_DEV, UMD_PROD], + bundleTypes: [ + FB_WWW_DEV, + NODE_DEV, + NODE_PROD, + ESM_DEV, + ESM_PROD, + UMD_DEV, + UMD_PROD, + ], moduleType: NON_FIBER_RENDERER, entry: 'react-test-renderer/shallow', global: 'ReactShallowRenderer', @@ -315,7 +369,7 @@ const bundles = [ /******* React Noop Renderer (used for tests) *******/ { - bundleTypes: [NODE_DEV, NODE_PROD], + bundleTypes: [NODE_DEV, NODE_PROD, ESM_DEV, ESM_PROD], moduleType: RENDERER, entry: 'react-noop-renderer', global: 'ReactNoopRenderer', @@ -324,7 +378,7 @@ const bundles = [ /******* React Noop Persistent Renderer (used for tests) *******/ { - bundleTypes: [NODE_DEV, NODE_PROD], + bundleTypes: [NODE_DEV, NODE_PROD, ESM_DEV, ESM_PROD], moduleType: RENDERER, entry: 'react-noop-renderer/persistent', global: 'ReactNoopRendererPersistent', @@ -333,7 +387,7 @@ const bundles = [ /******* React Noop Server Renderer (used for tests) *******/ { - bundleTypes: [NODE_DEV, NODE_PROD], + bundleTypes: [NODE_DEV, NODE_PROD, ESM_DEV, ESM_PROD], moduleType: RENDERER, entry: 'react-noop-renderer/server', global: 'ReactNoopRendererServer', @@ -342,7 +396,7 @@ const bundles = [ /******* React Noop Flight Server (used for tests) *******/ { - bundleTypes: [NODE_DEV, NODE_PROD], + bundleTypes: [NODE_DEV, NODE_PROD, ESM_DEV, ESM_PROD], moduleType: RENDERER, entry: 'react-noop-renderer/flight-server', global: 'ReactNoopFlightServer', @@ -351,7 +405,7 @@ const bundles = [ /******* React Noop Flight Client (used for tests) *******/ { - bundleTypes: [NODE_DEV, NODE_PROD], + bundleTypes: [NODE_DEV, NODE_PROD, ESM_DEV, ESM_PROD], moduleType: RENDERER, entry: 'react-noop-renderer/flight-client', global: 'ReactNoopFlightClient', @@ -360,7 +414,13 @@ const bundles = [ /******* React Reconciler *******/ { - bundleTypes: [NODE_DEV, NODE_PROD], + bundleTypes: [ + NODE_DEV, + NODE_PROD, + // TODO: update reconcilers to be usable with esm + // ESM_DEV, + // ESM_PROD, + ], moduleType: RECONCILER, entry: 'react-reconciler', global: 'ReactReconciler', @@ -369,7 +429,13 @@ const bundles = [ /******* React Persistent Reconciler *******/ { - bundleTypes: [NODE_DEV, NODE_PROD], + bundleTypes: [ + NODE_DEV, + NODE_PROD, + // TODO: update reconcilers to be usable with esm + // ESM_DEV, + // ESM_PROD, + ], moduleType: RECONCILER, entry: 'react-reconciler/persistent', global: 'ReactPersistentReconciler', @@ -378,7 +444,13 @@ const bundles = [ /******* React Server *******/ { - bundleTypes: [NODE_DEV, NODE_PROD], + bundleTypes: [ + NODE_DEV, + NODE_PROD, + // TODO: update reconcilers to be usable with esm + // ESM_DEV, + // ESM_PROD, + ], moduleType: RECONCILER, entry: 'react-server', global: 'ReactServer', @@ -387,7 +459,13 @@ const bundles = [ /******* React Flight Server *******/ { - bundleTypes: [NODE_DEV, NODE_PROD], + bundleTypes: [ + NODE_DEV, + NODE_PROD, + // TODO: update reconcilers to be usable with esm + // ESM_DEV, + // ESM_PROD, + ], moduleType: RECONCILER, entry: 'react-server/flight', global: 'ReactFlightServer', @@ -396,7 +474,13 @@ const bundles = [ /******* React Flight Client *******/ { - bundleTypes: [NODE_DEV, NODE_PROD], + bundleTypes: [ + NODE_DEV, + NODE_PROD, + // TODO: update reconcilers to be usable with esm + // ESM_DEV, + // ESM_PROD, + ], moduleType: RECONCILER, entry: 'react-flight', global: 'ReactFlightClient', @@ -406,7 +490,13 @@ const bundles = [ /******* Reflection *******/ { moduleType: RENDERER_UTILS, - bundleTypes: [NODE_DEV, NODE_PROD], + bundleTypes: [ + NODE_DEV, + NODE_PROD, + // TODO: update reconcilers to be usable with esm + // ESM_DEV, + // ESM_PROD, + ], entry: 'react-reconciler/reflection', global: 'ReactFiberTreeReflection', externals: [], @@ -417,6 +507,8 @@ const bundles = [ bundleTypes: [ NODE_DEV, NODE_PROD, + ESM_DEV, + ESM_PROD, FB_WWW_DEV, FB_WWW_PROD, UMD_DEV, @@ -430,7 +522,7 @@ const bundles = [ /******* React Debug Tools *******/ { - bundleTypes: [NODE_DEV, NODE_PROD], + bundleTypes: [NODE_DEV, NODE_PROD, ESM_DEV, ESM_PROD], moduleType: ISOMORPHIC, entry: 'react-debug-tools', global: 'ReactDebugTools', @@ -444,6 +536,8 @@ const bundles = [ FB_WWW_PROD, NODE_DEV, NODE_PROD, + ESM_DEV, + ESM_PROD, UMD_DEV, UMD_PROD, ], @@ -455,7 +549,7 @@ const bundles = [ /******* createComponentWithSubscriptions *******/ { - bundleTypes: [NODE_DEV, NODE_PROD], + bundleTypes: [NODE_DEV, NODE_PROD, ESM_DEV, ESM_PROD], moduleType: ISOMORPHIC, entry: 'create-subscription', global: 'createSubscription', @@ -470,7 +564,7 @@ const bundles = [ /******* Hook for managing subscriptions safely *******/ { - bundleTypes: [NODE_DEV, NODE_PROD], + bundleTypes: [NODE_DEV, NODE_PROD, ESM_DEV, ESM_PROD], moduleType: ISOMORPHIC, entry: 'use-subscription', global: 'useSubscription', @@ -482,6 +576,8 @@ const bundles = [ bundleTypes: [ NODE_DEV, NODE_PROD, + ESM_DEV, + ESM_PROD, FB_WWW_DEV, FB_WWW_PROD, FB_WWW_PROFILING, @@ -499,6 +595,8 @@ const bundles = [ UMD_PROD, NODE_DEV, NODE_PROD, + ESM_DEV, + ESM_PROD, FB_WWW_DEV, FB_WWW_PROD, ], @@ -510,7 +608,14 @@ const bundles = [ /******* Jest React (experimental) *******/ { - bundleTypes: [NODE_DEV, NODE_PROD, FB_WWW_DEV, FB_WWW_PROD], + bundleTypes: [ + NODE_DEV, + NODE_PROD, + ESM_DEV, + ESM_PROD, + FB_WWW_DEV, + FB_WWW_PROD, + ], moduleType: ISOMORPHIC, entry: 'jest-react', global: 'JestReact', @@ -523,7 +628,7 @@ const bundles = [ // won't get copied. We also can't create just DEV bundle because it contains a // NODE_ENV check inside. We should probably tweak our build process to allow // "raw" packages that don't get bundled. - bundleTypes: [NODE_DEV, NODE_PROD], + bundleTypes: [NODE_DEV, NODE_PROD, ESM_DEV, ESM_PROD], moduleType: ISOMORPHIC, entry: 'eslint-plugin-react-hooks', global: 'ESLintPluginReactHooks', @@ -532,14 +637,14 @@ const bundles = [ /******* React Fresh *******/ { - bundleTypes: [NODE_DEV, NODE_PROD], + bundleTypes: [NODE_DEV, NODE_PROD, ESM_DEV, ESM_PROD], moduleType: ISOMORPHIC, entry: 'react-refresh/babel', global: 'ReactFreshBabelPlugin', externals: [], }, { - bundleTypes: [NODE_DEV, NODE_PROD, FB_WWW_DEV], + bundleTypes: [NODE_DEV, NODE_PROD, ESM_DEV, ESM_PROD, FB_WWW_DEV], moduleType: ISOMORPHIC, entry: 'react-refresh/runtime', global: 'ReactFreshRuntime', @@ -554,6 +659,8 @@ const bundles = [ NODE_DEV, NODE_PROD, NODE_PROFILING, + ESM_DEV, + ESM_PROD, ], moduleType: ISOMORPHIC, entry: 'scheduler/tracing', @@ -569,6 +676,8 @@ const bundles = [ UMD_PROD, NODE_DEV, NODE_PROD, + ESM_DEV, + ESM_PROD, FB_WWW_DEV, FB_WWW_PROD, ], @@ -584,6 +693,8 @@ const bundles = [ UMD_PROD, NODE_DEV, NODE_PROD, + ESM_DEV, + ESM_PROD, FB_WWW_DEV, FB_WWW_PROD, ], @@ -599,6 +710,8 @@ const bundles = [ UMD_PROD, NODE_DEV, NODE_PROD, + ESM_DEV, + ESM_PROD, FB_WWW_DEV, FB_WWW_PROD, ], @@ -614,6 +727,8 @@ const bundles = [ UMD_PROD, NODE_DEV, NODE_PROD, + ESM_DEV, + ESM_PROD, FB_WWW_DEV, FB_WWW_PROD, ], @@ -629,6 +744,8 @@ const bundles = [ UMD_PROD, NODE_DEV, NODE_PROD, + ESM_DEV, + ESM_PROD, FB_WWW_DEV, FB_WWW_PROD, ], @@ -644,6 +761,8 @@ const bundles = [ UMD_PROD, NODE_DEV, NODE_PROD, + ESM_DEV, + ESM_PROD, FB_WWW_DEV, FB_WWW_PROD, ], @@ -659,6 +778,8 @@ const bundles = [ UMD_PROD, NODE_DEV, NODE_PROD, + ESM_DEV, + ESM_PROD, FB_WWW_DEV, FB_WWW_PROD, ], @@ -678,6 +799,8 @@ const bundles = [ UMD_PROD, NODE_DEV, NODE_PROD, + ESM_DEV, + ESM_PROD, FB_WWW_DEV, FB_WWW_PROD, ], @@ -693,6 +816,8 @@ const bundles = [ UMD_PROD, NODE_DEV, NODE_PROD, + ESM_DEV, + ESM_PROD, FB_WWW_DEV, FB_WWW_PROD, ], @@ -708,6 +833,8 @@ const bundles = [ UMD_PROD, NODE_DEV, NODE_PROD, + ESM_DEV, + ESM_PROD, FB_WWW_DEV, FB_WWW_PROD, ], @@ -723,6 +850,8 @@ const bundles = [ UMD_PROD, NODE_DEV, NODE_PROD, + ESM_DEV, + ESM_PROD, FB_WWW_DEV, FB_WWW_PROD, ], diff --git a/scripts/rollup/packaging.js b/scripts/rollup/packaging.js index 840e290f23c1..3bee5553f473 100644 --- a/scripts/rollup/packaging.js +++ b/scripts/rollup/packaging.js @@ -1,7 +1,8 @@ 'use strict'; -const {existsSync, readdirSync, unlinkSync} = require('fs'); +const {existsSync, readdirSync, unlinkSync, writeFileSync} = require('fs'); const Bundles = require('./bundles'); +const path = require('path'); const { asyncCopyTo, asyncExecuteCommand, @@ -15,6 +16,8 @@ const { UMD_PROFILING, NODE_DEV, NODE_PROD, + ESM_DEV, + ESM_PROD, NODE_PROFILING, FB_WWW_DEV, FB_WWW_PROD, @@ -40,6 +43,9 @@ function getBundleOutputPaths(bundleType, filename, packageName) { case NODE_PROD: case NODE_PROFILING: return [`build/node_modules/${packageName}/cjs/${filename}`]; + case ESM_DEV: + case ESM_PROD: + return [`build/node_modules/${packageName}/esm/${filename}`]; case UMD_DEV: case UMD_PROD: case UMD_PROFILING: @@ -135,14 +141,35 @@ async function prepareNpmPackage(name) { ), asyncCopyTo(`packages/${name}/npm`, `build/node_modules/${name}`), ]); + await injectExportsMapInPackageJson(name); const tgzName = (await asyncExecuteCommand( `npm pack build/node_modules/${name}` )).trim(); + await asyncRimRaf(`build/node_modules/${name}`); await asyncExtractTar(getTarOptions(tgzName, name)); unlinkSync(tgzName); } +async function injectExportsMapInPackageJson(name) { + const pkgJsonPath = path.join( + __dirname, + '../..', + `build/node_modules/${name}/package.json` + ); + const pkgJson = require(pkgJsonPath); + + // Copy the __exports into exports + // This is done because the exports map interferes with + // module resolution during builds. It is meant to be used + // with the built and packaged package. + if (pkgJson.files.some(file => file === 'index.mjs')) { + pkgJson.exports = pkgJson.__exports; + delete pkgJson.__exports; + writeFileSync(pkgJsonPath, JSON.stringify(pkgJson, null, 2)); + } +} + async function prepareNpmPackages() { if (!existsSync('build/node_modules')) { // We didn't build any npm packages. diff --git a/scripts/rollup/plugins/closure-plugin.js b/scripts/rollup/plugins/closure-plugin.js index 0c95ee99e22e..258f3b6be785 100644 --- a/scripts/rollup/plugins/closure-plugin.js +++ b/scripts/rollup/plugins/closure-plugin.js @@ -22,7 +22,7 @@ function compile(flags) { module.exports = function closure(flags = {}) { return { name: 'scripts/rollup/plugins/closure-plugin', - async transformBundle(code) { + async renderChunk(code) { const inputFile = tmp.fileSync(); const tempPath = inputFile.name; flags = Object.assign({}, flags, {js: tempPath}); diff --git a/scripts/rollup/plugins/forbid-fbjs.js b/scripts/rollup/plugins/forbid-fbjs.js new file mode 100644 index 000000000000..646e79fa21f4 --- /dev/null +++ b/scripts/rollup/plugins/forbid-fbjs.js @@ -0,0 +1,15 @@ +'use strict'; + +module.exports = function forbidFBJSImports() { + return { + name: 'forbidFBJSImports', + resolveId(importee, importer) { + if (/^fbjs\//.test(importee)) { + throw new Error( + `Don't import ${importee} (found in ${importer}). ` + + `Use the utilities in packages/shared/ instead.` + ); + } + }, + }; +}; diff --git a/scripts/rollup/plugins/sizes-plugin.js b/scripts/rollup/plugins/sizes-plugin.js index d2b994ef48ba..ac9da401a959 100644 --- a/scripts/rollup/plugins/sizes-plugin.js +++ b/scripts/rollup/plugins/sizes-plugin.js @@ -11,9 +11,13 @@ const gzip = require('gzip-size'); module.exports = function sizes(options) { return { name: 'scripts/rollup/plugins/sizes-plugin', - ongenerate(bundle, obj) { - const size = Buffer.byteLength(obj.code); - const gzipSize = gzip.sync(obj.code); + generateBundle(bundle, obj) { + const code = Object.keys(obj) + .map(key => obj[key].code) + .join('\n'); + + const size = Buffer.byteLength(code); + const gzipSize = gzip.sync(code); options.getSize(size, gzipSize); }, diff --git a/scripts/rollup/plugins/strip-unused-imports.js b/scripts/rollup/plugins/strip-unused-imports.js index b5da1f292e0b..c0cd811d6462 100644 --- a/scripts/rollup/plugins/strip-unused-imports.js +++ b/scripts/rollup/plugins/strip-unused-imports.js @@ -9,7 +9,7 @@ module.exports = function stripUnusedImports(pureExternalModules) { return { name: 'scripts/rollup/plugins/strip-unused-imports', - transformBundle(code) { + renderChunk(code) { pureExternalModules.forEach(module => { // Ideally this would use a negative lookbehind: (? + +`, + {runScripts: 'dangerously'} +); + +global.window = window; +global.document = window.document; +global.navigator = window.navigator; + +const IGNORED_PACKAGES = { + 'react-refresh': true, + 'react-interactions': true, +}; +const IGONORED_FILES = { + 'build-info.json': true, +}; + +const packagesDir = path.join(__dirname, 'node_modules'); +const packages = fs.readdirSync(packagesDir).filter(t => !IGNORED_PACKAGES[t]); +let errors = []; + +process.on('unhandledRejection', err => { + console.error(err); + errors.push({err}); +}); + +function ok(key) { + console.log(`\t${chalk.green('✓')} ${key}`); +} + +function fail(key, message) { + errors.push({key, message}); + if (message) { + console.log(`\t${chalk.red('x')} ${key}\n\t\t`, message); + } else { + console.log(`\t${chalk.red('x')} ${key}`); + } +} + +function check(key, predicate) { + if (predicate) { + ok(key); + } else { + fail(key); + } +} + +async function checkPackages() { + for (let packageName of packages) { + console.log(` 📦 ${chalk.bold.underline(packageName)}`); + const packageDir = path.join(packagesDir, packageName); + const packageJson = require(path.join(packageDir, 'package.json')); + let mainFileName; + + // check main file existence + if (packageJson.main) { + mainFileName = path.join(packageDir, packageJson.main); + check('pkg.main file exists', fs.existsSync(mainFileName)); + } + + for (let fileName of packageJson.files.filter(f => !IGONORED_FILES[f])) { + check( + `pkg.files@[${fileName}] exists`, + fs.existsSync(path.join(packageDir, fileName)) + ); + } + + // check exports map file existence + if (packageJson.exports) { + const exportKeys = Object.keys(packageJson.exports); + exportKeys.forEach(key => { + if (packageJson.exports[key].require) { + check( + `pkg.exports[${key}].require file exists`, + fs.existsSync( + path.join(packageDir, packageJson.exports[key].require) + ) + ); + } + if (packageJson.exports[key].default) { + check( + `pkg.exports[${key}].default file exists`, + fs.existsSync( + path.join(packageDir, packageJson.exports[key].default) + ) + ); + } + }); + } + + // check top-level require + checkRequire(packageName); + + if (packageJson.exports) { + for (let exportKey of Object.keys(packageJson.exports)) { + let importPath = path.join(packageName, exportKey); + + checkRequire(importPath); + await checkImport(importPath); + } + } + } +} + +function checkRequire(requirePath) { + try { + const result = require(requirePath); + ok(`require('${requirePath}') doesn't throw`); + check(`require('${requirePath}') has valid exports`, result); + } catch (err) { + fail(`require('${requirePath}') doesn't throw`, err); + } +} + +function checkImport(importPath) { + return import(importPath) + .then(result => { + check( + `${chalk.yellow('import')}('${importPath}') has valid exports`, + result && Object.keys(result).length > 0 + ); + }) + .catch(err => { + fail(`import('${importPath}') doesn't throw`, err.message); + }); +} + +checkPackages() + .then(() => { + if (errors.length > 0) { + console.log(`caught ${errors.length} errors`); + process.exit(1); + } + }) + .catch(error => { + console.log(`unhnadled error`, error); + process.exit(2); + }); diff --git a/yarn.lock b/yarn.lock index e235f8485770..20bd2a5f537d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1182,6 +1182,16 @@ resolved "https://registry.yarnpkg.com/@types/debug/-/debug-4.1.5.tgz#b14efa8852b7768d898906613c23f688713e02cd" integrity sha512-Q1y515GcOdTHgagaVFhHnIFQ38ygs/kmxdNpvpou+raI9UO3YZcHDngBSYKQklcKlvA7iuQlmIKbzvmxcOE9CQ== +"@types/estree@*": + version "0.0.40" + resolved "https://registry.yarnpkg.com/@types/estree/-/estree-0.0.40.tgz#0e6cb9b9bbd098031fa19e4b4e8131bc70e5de13" + integrity sha512-p3KZgMto/JyxosKGmnLDJ/dG5wf+qTRMUjHJcspC2oQKa4jP7mz+tv0ND56lLBu3ojHlhzY33Ol+khLyNmilkA== + +"@types/estree@0.0.39": + version "0.0.39" + resolved "https://registry.yarnpkg.com/@types/estree/-/estree-0.0.39.tgz#e177e699ee1b8c22d23174caaa7422644389509f" + integrity sha512-EYNwp3bU+98cpU4lAWYYL7Zz+2gryWH1qbdDTidVd6hkiR6weksdbMadyXKXNPEkQFhXM+hVO9ZygomHXp+AIw== + "@types/events@*": version "3.0.0" resolved "https://registry.yarnpkg.com/@types/events/-/events-3.0.0.tgz#2862f3f58a9a7f7c3e78d79f130dd4d71c25c2a7" @@ -1253,6 +1263,13 @@ dependencies: package-json "*" +"@types/resolve@0.0.8": + version "0.0.8" + resolved "https://registry.yarnpkg.com/@types/resolve/-/resolve-0.0.8.tgz#f26074d238e02659e323ce1a13d041eee280e194" + integrity sha512-auApPaJf3NPfe18hSoJkp8EbZzer2ISk7o8mCC3M9he/a04+gbMF97NkpD2S8riMGvm4BMRI59/SZQSaLTKpsQ== + dependencies: + "@types/node" "*" + "@types/semver@^5.5.0": version "5.5.0" resolved "https://registry.yarnpkg.com/@types/semver/-/semver-5.5.0.tgz#146c2a29ee7d3bae4bf2fcb274636e264c813c45" @@ -1522,6 +1539,14 @@ acorn-globals@^4.1.0: acorn "^6.0.1" acorn-walk "^6.0.1" +acorn-globals@^4.3.2: + version "4.3.4" + resolved "https://registry.yarnpkg.com/acorn-globals/-/acorn-globals-4.3.4.tgz#9fa1926addc11c97308c4e66d7add0d40c3272e7" + integrity sha512-clfQEh21R+D0leSbUdWf3OcfqyaCSAQ8Ryq00bofSekfr9W8u1jyYZo6ir0xu9Gtcf7BjcHJpnbZH7JOCpP60A== + dependencies: + acorn "^6.0.1" + acorn-walk "^6.0.1" + acorn-jsx@^3.0.0: version "3.0.1" resolved "https://registry.yarnpkg.com/acorn-jsx/-/acorn-jsx-3.0.1.tgz#afdf9488fb1ecefc8348f6fb22f464e32a58b36b" @@ -1544,7 +1569,7 @@ acorn@^3.0.4: resolved "https://registry.yarnpkg.com/acorn/-/acorn-3.3.0.tgz#45e37fb39e8da3f25baee3ff5369e2bb5f22017a" integrity sha1-ReN/s56No/JbruP/U2niu18iAXo= -acorn@^5.2.1, acorn@^5.3.0, acorn@^5.5.0: +acorn@^5.3.0, acorn@^5.5.0: version "5.7.3" resolved "https://registry.yarnpkg.com/acorn/-/acorn-5.7.3.tgz#67aa231bf8812974b85235a96771eb6bd07ea279" integrity sha512-T/zvzYRfbVojPWahDsE5evJdHb3oJoQfFbsrKM7w5Zcs++Tr257tia3BmMP8XYVjp1S9RZXQMh7gao96BlqZOw== @@ -1554,6 +1579,11 @@ acorn@^6.0.1, acorn@^6.0.7, acorn@^6.2.1: resolved "https://registry.yarnpkg.com/acorn/-/acorn-6.3.0.tgz#0087509119ffa4fc0a0041d1e93a417e68cb856e" integrity sha512-/czfa8BwS88b9gWQVhc8eknunSA2DoJpJyTQkhheIf5E48u1N0R4q/YxxsAeqRrmK9TQ/uYfgLDfZo91UlANIA== +acorn@^7.1.0: + version "7.1.0" + resolved "https://registry.yarnpkg.com/acorn/-/acorn-7.1.0.tgz#949d36f2c292535da602283586c2477c57eb2d6c" + integrity sha512-kL5CuoXA/dgxlBbVrflsflzQ3PAas7RYZB52NOm/6839iVYJgKMJ3cQJD+t2i5+qFa8h3MDpEOJiS64E8JLnSQ== + adbkit-logcat@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/adbkit-logcat/-/adbkit-logcat-1.1.0.tgz#01d7f9b0cef9093a30bcb3b007efff301508962f" @@ -1922,13 +1952,6 @@ arr-diff@^1.0.1: arr-flatten "^1.0.1" array-slice "^0.2.3" -arr-diff@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/arr-diff/-/arr-diff-2.0.0.tgz#8f3b827f955a8bd669697e4a4256ac3ceae356cf" - integrity sha1-jzuCf5Vai9ZpaX5KQlasPOrjVs8= - dependencies: - arr-flatten "^1.0.1" - arr-diff@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/arr-diff/-/arr-diff-4.0.0.tgz#d6461074febfec71e7e15235761a329a5dc7c520" @@ -2016,11 +2039,6 @@ array-uniq@^1.0.1: resolved "https://registry.yarnpkg.com/array-uniq/-/array-uniq-1.0.3.tgz#af6ac877a25cc7f74e058894753858dfdb24fdb6" integrity sha1-r2rId6Jcx/dOBYiUdThY39sk/bY= -array-unique@^0.2.1: - version "0.2.1" - resolved "https://registry.yarnpkg.com/array-unique/-/array-unique-0.2.1.tgz#a1d97ccafcbc2625cc70fadceb36a50c58b01a53" - integrity sha1-odl8yvy8JiXMcPrc6zalDFiwGlM= - array-unique@^0.3.2: version "0.3.2" resolved "https://registry.yarnpkg.com/array-unique/-/array-unique-0.3.2.tgz#a894b75d4bc4f6cd679ef3244a9fd8f46ae2d428" @@ -2887,15 +2905,6 @@ brace-expansion@^1.1.7: balanced-match "^1.0.0" concat-map "0.0.1" -braces@^1.8.2: - version "1.8.5" - resolved "https://registry.yarnpkg.com/braces/-/braces-1.8.5.tgz#ba77962e12dff969d6b76711e914b737857bf6a7" - integrity sha1-uneWLhLf+WnWt2cR6RS3N4V79qc= - dependencies: - expand-range "^1.8.1" - preserve "^0.2.0" - repeat-element "^1.1.2" - braces@^2.3.1, braces@^2.3.2: version "2.3.2" resolved "https://registry.yarnpkg.com/braces/-/braces-2.3.2.tgz#5979fd3f14cd531565e5fa2df1abfff1dfaee729" @@ -2922,7 +2931,7 @@ browser-process-hrtime@^0.1.2: resolved "https://registry.yarnpkg.com/browser-process-hrtime/-/browser-process-hrtime-0.1.3.tgz#616f00faef1df7ec1b5bf9cfe2bdc3170f26c7b4" integrity sha512-bRFnI4NnjO6cnyLmOV/7PVoDEMJChlcfN0z4s1YMBY989/SvlfMI1lgCnkFUs53e9gQF+w7qu7XdllSTiSl8Aw== -browser-resolve@^1.11.0, browser-resolve@^1.11.3: +browser-resolve@^1.11.3: version "1.11.3" resolved "https://registry.yarnpkg.com/browser-resolve/-/browser-resolve-1.11.3.tgz#9b7cbb3d0f510e4cb86bdbd796124d28b5890af6" integrity sha512-exDi1BYWB/6raKHmDTCicQfTkqwN5fioMFV4j8BsfMU4R2DK/QfZfK7kOVkmWCNANf0snkBzqGqAJBao9gZMdQ== @@ -3085,10 +3094,10 @@ buffer@^5.1.0: base64-js "^1.0.2" ieee754 "^1.1.4" -builtin-modules@^1.1.0: - version "1.1.1" - resolved "https://registry.yarnpkg.com/builtin-modules/-/builtin-modules-1.1.1.tgz#270f076c5a72c02f5b65a47df94c5fe3a278892f" - integrity sha1-Jw8HbFpywC9bZaR9+Uxf46J4iS8= +builtin-modules@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/builtin-modules/-/builtin-modules-3.1.0.tgz#aad97c15131eb76b65b50ef208e7584cd76a7484" + integrity sha512-k0KL0aWZuBt2lrxrcASWDfwOLMnodeQjodT/1SxEQAXsHANgo6ZC/VEaSEHCXt7aSTZ4/4H5LKa+tBXmW7Vtvw== builtin-status-codes@^3.0.0: version "3.0.0" @@ -3214,6 +3223,15 @@ caniuse-lite@^1.0.30000984: resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30000989.tgz#b9193e293ccf7e4426c5245134b8f2a56c0ac4b9" integrity sha512-vrMcvSuMz16YY6GSVZ0dWDTJP8jqk3iFQ/Aq5iqblPwxSVVZI+zxDyTX0VPqtQsDnfdrBDcsmhgTEOh5R8Lbpw== +canvas@^2.6.0: + version "2.6.0" + resolved "https://registry.yarnpkg.com/canvas/-/canvas-2.6.0.tgz#7a8f87b6148845d97e6ee30947fba1508bed4941" + integrity sha512-bEO9f1ThmbknLPxCa8Es7obPlN9W3stB1bo7njlhOFKIdUTldeTqXCh9YclCPAi2pSQs84XA0jq/QEZXSzgyMw== + dependencies: + nan "^2.14.0" + node-pre-gyp "^0.11.0" + simple-get "^3.0.3" + capture-exit@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/capture-exit/-/capture-exit-2.0.0.tgz#fb953bfaebeb781f62898239dabb426d08a509a4" @@ -3992,11 +4010,16 @@ cssesc@^0.1.0: resolved "https://registry.yarnpkg.com/cssesc/-/cssesc-0.1.0.tgz#c814903e45623371a0477b40109aaafbeeaddbb4" integrity sha1-yBSQPkViM3GgR3tAEJqq++6t27Q= -cssom@0.3.x, "cssom@>= 0.3.2 < 0.4.0": +cssom@0.3.x, "cssom@>= 0.3.2 < 0.4.0", cssom@~0.3.6: version "0.3.8" resolved "https://registry.yarnpkg.com/cssom/-/cssom-0.3.8.tgz#9f1276f5b2b463f2114d3f2c75250af8c1a36f4a" integrity sha512-b0tGHbfegbhPJpxpiBPU2sCkigAqtM9O121le6bbOlgyV+NyGyCmVfJ6QW9eRjz8CpNfWEOYBIMIGRYkLwsIYg== +cssom@^0.4.1: + version "0.4.4" + resolved "https://registry.yarnpkg.com/cssom/-/cssom-0.4.4.tgz#5a66cf93d2d0b661d80bf6a44fb65f5c2e4e0a10" + integrity sha512-p3pvU7r1MyyqbTk+WbNJIgJjG2VmTIaB10rI93LzVPrmDJKkzKYMtxxyAvQXR/NS6otuzveI7+7BBq3SjBS2mw== + "cssstyle@>= 0.3.1 < 0.4.0": version "0.3.1" resolved "https://registry.yarnpkg.com/cssstyle/-/cssstyle-0.3.1.tgz#6da9b4cff1bc5d716e6e5fe8e04fcb1b50a49adf" @@ -4004,6 +4027,13 @@ cssom@0.3.x, "cssom@>= 0.3.2 < 0.4.0": dependencies: cssom "0.3.x" +cssstyle@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/cssstyle/-/cssstyle-2.0.0.tgz#911f0fe25532db4f5d44afc83f89cc4b82c97fe3" + integrity sha512-QXSAu2WBsSRXCPjvI43Y40m6fMevvyRm8JVAuF9ksQz5jha4pWP1wpaK7Yu5oLFc6+XAY+hj8YhefyXcBB53gg== + dependencies: + cssom "~0.3.6" + currently-unhandled@^0.4.1: version "0.4.1" resolved "https://registry.yarnpkg.com/currently-unhandled/-/currently-unhandled-0.4.1.tgz#988df33feab191ef799a61369dd76c17adf957ea" @@ -4080,7 +4110,7 @@ data-uri-to-buffer@2: dependencies: "@types/node" "^8.0.7" -data-urls@^1.0.0: +data-urls@^1.0.0, data-urls@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/data-urls/-/data-urls-1.1.0.tgz#15ee0582baa5e22bb59c77140da8f9c76963bbfe" integrity sha512-YTWYI9se1P55u58gL5GkQHW4P6VJBJ5iBT+B5a7i2Tjadhv52paJG0qHX4A0OR6/t52odI64KP2YvFpkDOi3eQ== @@ -4151,6 +4181,13 @@ decompress-response@^3.3.0: dependencies: mimic-response "^1.0.0" +decompress-response@^4.2.0: + version "4.2.1" + resolved "https://registry.yarnpkg.com/decompress-response/-/decompress-response-4.2.1.tgz#414023cc7a302da25ce2ec82d0d5238ccafd8986" + integrity sha512-jOSne2qbyE+/r8G1VU+G/82LBs2Fs4LAsTiLSHOCOMZQl2OKZ6i8i4IyHemTe+/yIXOtTcRQMzPcgyhoFlqPkw== + dependencies: + mimic-response "^2.0.0" + deep-assign@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/deep-assign/-/deep-assign-3.0.0.tgz#c8e4c4d401cba25550a2f0f486a2e75bc5f219a2" @@ -4329,12 +4366,7 @@ diff-sequences@^24.9.0: resolved "https://registry.yarnpkg.com/diff-sequences/-/diff-sequences-24.9.0.tgz#5715d6244e2aa65f48bba0bc972db0b0b11e95b5" integrity sha512-Dj6Wk3tWyTE+Fo1rW8v0Xhwk80um6yFYKbuAxc9c3EZxIHFDYwbi34Uk42u1CdnIiVorvt4RmlSDjIPyzGC2ew== -diff@3.3.0: - version "3.3.0" - resolved "https://registry.yarnpkg.com/diff/-/diff-3.3.0.tgz#056695150d7aa93237ca7e378ac3b1682b7963b9" - integrity sha512-w0XZubFWn0Adlsapj9EAWX0FqWdO4tz8kc3RiYdWLh4k/V8PTb6i0SMgXt0vRM3zyKnT8tKO7mUlieRQHIjMNg== - -diff@^4.0.1: +diff@4.0.1, diff@^4.0.1: version "4.0.1" resolved "https://registry.yarnpkg.com/diff/-/diff-4.0.1.tgz#0c667cb467ebbb5cea7f14f135cc2dba7780a8ff" integrity sha512-s2+XdvhPCOF01LRQBC8hf4vhbVmI2CGS5aZnxLJlT5FtdhPCDFq80q++zK2KlrVorVDdL5BOGZ/VfLrVtYNF+Q== @@ -4443,7 +4475,7 @@ domelementtype@^2.0.1: resolved "https://registry.yarnpkg.com/domelementtype/-/domelementtype-2.0.1.tgz#1f8bdfe91f5a78063274e803b4bdcedf6e94f94d" integrity sha512-5HOHUDsYZWV8FGWN0Njbr/Rn7f/eWSQi1v7+HsUVwXgn8nWWlL64zKDkS0n8ZmQ3mlWOMuXOnR+7Nx/5tMO5AQ== -domexception@^1.0.0: +domexception@^1.0.0, domexception@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/domexception/-/domexception-1.0.1.tgz#937442644ca6a31261ef36e3ec677fe805582c90" integrity sha512-raigMkn7CJNNo6Ihro1fzG7wr3fHuYVytzquZKX5n0yizGsTcYgzdIUwj1X9pK0VvjeihV+XiclP+DjwbsSKug== @@ -4797,7 +4829,7 @@ escape-string-regexp@1.0.5, escape-string-regexp@^1.0.2, escape-string-regexp@^1 resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4" integrity sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ= -escodegen@1.x.x, escodegen@^1.9.0: +escodegen@1.x.x, escodegen@^1.11.1, escodegen@^1.9.0: version "1.12.0" resolved "https://registry.yarnpkg.com/escodegen/-/escodegen-1.12.0.tgz#f763daf840af172bb3a2b6dd7219c0e17f7ff541" integrity sha512-TuA+EhsanGcme5T3R0L80u4t8CpbXQjegRmf7+FPTJrtCTErXFeelblRgHQa1FofEzqYYJmJ/OqjTwREp9qgmg== @@ -5099,16 +5131,6 @@ estraverse@^4.0.0, estraverse@^4.1.0, estraverse@^4.1.1, estraverse@^4.2.0: resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-4.2.0.tgz#0dee3fed31fcd469618ce7342099fc1afa0bdb13" integrity sha1-De4/7TH81GlhjOc0IJn8GvoL2xM= -estree-walker@^0.3.0: - version "0.3.1" - resolved "https://registry.yarnpkg.com/estree-walker/-/estree-walker-0.3.1.tgz#e6b1a51cf7292524e7237c312e5fe6660c1ce1aa" - integrity sha1-5rGlHPcpJSTnI3wxLl/mZgwc4ao= - -estree-walker@^0.5.0: - version "0.5.0" - resolved "https://registry.yarnpkg.com/estree-walker/-/estree-walker-0.5.0.tgz#aae3b57c42deb8010e349c892462f0e71c5dd1aa" - integrity sha512-/bEAy+yKAZQrEWUhGmS3H9XpGqSDBtRzX0I2PgMw9kA2n1jN22uV5B5p7MFdZdvWdXCRJztXAfx6ZeRfgkEETg== - estree-walker@^0.6.1: version "0.6.1" resolved "https://registry.yarnpkg.com/estree-walker/-/estree-walker-0.6.1.tgz#53049143f40c6eb918b23671d1fe3219f3a1b362" @@ -5214,13 +5236,6 @@ exit@^0.1.2: resolved "https://registry.yarnpkg.com/exit/-/exit-0.1.2.tgz#0632638f8d877cc82107d30a0fff1a17cba1cd0c" integrity sha1-BjJjj42HfMghB9MKD/8aF8uhzQw= -expand-brackets@^0.1.4: - version "0.1.5" - resolved "https://registry.yarnpkg.com/expand-brackets/-/expand-brackets-0.1.5.tgz#df07284e342a807cd733ac5af72411e581d1177b" - integrity sha1-3wcoTjQqgHzXM6xa9yQR5YHRF3s= - dependencies: - is-posix-bracket "^0.1.0" - expand-brackets@^2.1.4: version "2.1.4" resolved "https://registry.yarnpkg.com/expand-brackets/-/expand-brackets-2.1.4.tgz#b77735e315ce30f6b6eff0f83b04151a22449622" @@ -5234,13 +5249,6 @@ expand-brackets@^2.1.4: snapdragon "^0.8.1" to-regex "^3.0.1" -expand-range@^1.8.1: - version "1.8.2" - resolved "https://registry.yarnpkg.com/expand-range/-/expand-range-1.8.2.tgz#a299effd335fe2721ebae8e257ec79644fc85337" - integrity sha1-opnv/TNf4nIeuujiV+x5ZE/IUzc= - dependencies: - fill-range "^2.1.0" - expand-tilde@^2.0.0, expand-tilde@^2.0.2: version "2.0.2" resolved "https://registry.yarnpkg.com/expand-tilde/-/expand-tilde-2.0.2.tgz#97e801aa052df02454de46b02bf621642cdc8502" @@ -5332,13 +5340,6 @@ external-editor@^3.0.3: iconv-lite "^0.4.24" tmp "^0.0.33" -extglob@^0.3.1: - version "0.3.2" - resolved "https://registry.yarnpkg.com/extglob/-/extglob-0.3.2.tgz#2e18ff3d2f49ab2765cec9023f011daa8d8349a1" - integrity sha1-Lhj/PS9JqydlzskCPwEdqo2DSaE= - dependencies: - is-extglob "^1.0.0" - extglob@^2.0.4: version "2.0.4" resolved "https://registry.yarnpkg.com/extglob/-/extglob-2.0.4.tgz#ad00fe4dc612a9232e8718711dc5cb5ab0285543" @@ -5550,27 +5551,11 @@ file-uri-to-path@1: resolved "https://registry.yarnpkg.com/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz#553a7b8446ff6f684359c445f1e37a05dacc33dd" integrity sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw== -filename-regex@^2.0.0: - version "2.0.1" - resolved "https://registry.yarnpkg.com/filename-regex/-/filename-regex-2.0.1.tgz#c1c4b9bee3e09725ddb106b75c1e301fe2f18b26" - integrity sha1-wcS5vuPglyXdsQa3XB4wH+LxiyY= - filesize@^3.5.6: version "3.5.6" resolved "https://registry.yarnpkg.com/filesize/-/filesize-3.5.6.tgz#5fd98f3eac94ec9516ef8ed5782fad84a01a0a1a" integrity sha1-X9mPPqyU7JUW747VeC+thKAaCho= -fill-range@^2.1.0: - version "2.2.3" - resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-2.2.3.tgz#50b77dfd7e469bc7492470963699fe7a8485a723" - integrity sha1-ULd9/X5Gm8dJJHCWNpn+eoSFpyM= - dependencies: - is-number "^2.1.0" - isobject "^2.0.0" - randomatic "^1.1.3" - repeat-element "^1.1.2" - repeat-string "^1.5.2" - fill-range@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-4.0.0.tgz#d544811d428f98eb06a63dc402d2403c328c38f7" @@ -5726,13 +5711,6 @@ for-in@^1.0.1, for-in@^1.0.2: resolved "https://registry.yarnpkg.com/for-in/-/for-in-1.0.2.tgz#81068d295a8142ec0ac726c6e2200c30fb6d5e80" integrity sha1-gQaNKVqBQuwKxybG4iAMMPttXoA= -for-own@^0.1.4: - version "0.1.5" - resolved "https://registry.yarnpkg.com/for-own/-/for-own-0.1.5.tgz#5265c681a4f294dabbf17c9509b6763aa84510ce" - integrity sha1-UmXGgaTylNq78XyVCbZ2OqhFEM4= - dependencies: - for-in "^1.0.1" - for-own@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/for-own/-/for-own-1.0.0.tgz#c63332f415cedc4b04dbfe70cf836494c53cb44b" @@ -6032,21 +6010,6 @@ gitlab@^10.0.1: query-string "^6.8.2" universal-url "^2.0.0" -glob-base@^0.3.0: - version "0.3.0" - resolved "https://registry.yarnpkg.com/glob-base/-/glob-base-0.3.0.tgz#dbb164f6221b1c0b1ccf82aea328b497df0ea3c4" - integrity sha1-27Fk9iIbHAscz4Kuoyi0l98Oo8Q= - dependencies: - glob-parent "^2.0.0" - is-glob "^2.0.0" - -glob-parent@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-2.0.0.tgz#81383d72db054fcccf5336daa902f182f6edbb28" - integrity sha1-gTg9ctsFT8zPUzbaqQLxgvbtuyg= - dependencies: - is-glob "^2.0.0" - glob-parent@^3.1.0: version "3.1.0" resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-3.1.0.tgz#9e6af6299d8d3bd2bd40430832bd113df906c5ae" @@ -6963,18 +6926,6 @@ is-descriptor@^1.0.0, is-descriptor@^1.0.2: is-data-descriptor "^1.0.0" kind-of "^6.0.2" -is-dotfile@^1.0.0: - version "1.0.3" - resolved "https://registry.yarnpkg.com/is-dotfile/-/is-dotfile-1.0.3.tgz#a6a2f32ffd2dfb04f5ca25ecd0f6b83cf798a1e1" - integrity sha1-pqLzL/0t+wT1yiXs0Pa4PPeYoeE= - -is-equal-shallow@^0.1.3: - version "0.1.3" - resolved "https://registry.yarnpkg.com/is-equal-shallow/-/is-equal-shallow-0.1.3.tgz#2238098fc221de0bcfa5d9eac4c45d638aa1c534" - integrity sha1-IjgJj8Ih3gvPpdnqxMRdY4qhxTQ= - dependencies: - is-primitive "^2.0.0" - is-extendable@^0.1.0, is-extendable@^0.1.1: version "0.1.1" resolved "https://registry.yarnpkg.com/is-extendable/-/is-extendable-0.1.1.tgz#62b110e289a471418e3ec36a617d472e301dfc89" @@ -6987,11 +6938,6 @@ is-extendable@^1.0.1: dependencies: is-plain-object "^2.0.4" -is-extglob@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/is-extglob/-/is-extglob-1.0.0.tgz#ac468177c4943405a092fc8f29760c6ffc6206c0" - integrity sha1-rEaBd8SUNAWgkvyPKXYMb/xiBsA= - is-extglob@^2.1.0, is-extglob@^2.1.1: version "2.1.1" resolved "https://registry.yarnpkg.com/is-extglob/-/is-extglob-2.1.1.tgz#a88c02535791f02ed37c76a1b9ea9773c833f8c2" @@ -7026,13 +6972,6 @@ is-generator-fn@^2.0.0: resolved "https://registry.yarnpkg.com/is-generator-fn/-/is-generator-fn-2.1.0.tgz#7d140adc389aaf3011a8f2a2a4cfa6faadffb118" integrity sha512-cTIB4yPYL/Grw0EaSzASzg6bBy9gqCofvWN8okThAYIxKJZC+udlRAmGbM0XLeniEJSs8uEgHPGuHSe1XsOLSQ== -is-glob@^2.0.0, is-glob@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/is-glob/-/is-glob-2.0.1.tgz#d096f926a3ded5600f3fdfd91198cb0888c2d863" - integrity sha1-0Jb5JqPe1WAPP9/ZEZjLCIjC2GM= - dependencies: - is-extglob "^1.0.0" - is-glob@^3.1.0: version "3.1.0" resolved "https://registry.yarnpkg.com/is-glob/-/is-glob-3.1.0.tgz#7ba5ae24217804ac70707b96922567486cc3e84a" @@ -7060,6 +6999,11 @@ is-mergeable-object@1.1.0: resolved "https://registry.yarnpkg.com/is-mergeable-object/-/is-mergeable-object-1.1.0.tgz#a846e8cf0e2bad6a8cf8b243b63b4c43b9907990" integrity sha512-JfyDDwUdtS4yHCgUpxOyKB9dnfZ0gecufxB0eytX6BmSXSE+8dbxDGt+V7CNRIRJ9sYFV/WQt2KJG6hNob2sBw== +is-module@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/is-module/-/is-module-1.0.0.tgz#3258fb69f78c14d5b815d664336b4cffb6441591" + integrity sha1-Mlj7afeMFNW4FdZkM2tM/7ZEFZE= + is-my-ip-valid@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/is-my-ip-valid/-/is-my-ip-valid-1.0.0.tgz#7b351b8e8edd4d3995d4d066680e664d94696824" @@ -7091,13 +7035,6 @@ is-npm@^3.0.0: resolved "https://registry.yarnpkg.com/is-npm/-/is-npm-3.0.0.tgz#ec9147bfb629c43f494cf67936a961edec7e8053" integrity sha512-wsigDr1Kkschp2opC4G3yA6r9EgVA6NjRpWzIi9axXqeIaAATPRJc4uLujXe3Nd9uO8KoDyA4MD6aZSeXTADhA== -is-number@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/is-number/-/is-number-2.1.0.tgz#01fcbbb393463a548f2f466cce16dece49db908f" - integrity sha1-Afy7s5NGOlSPL0ZszhbezknbkI8= - dependencies: - kind-of "^3.0.2" - is-number@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/is-number/-/is-number-3.0.0.tgz#24fd6201a4782cf50561c810276afc7d12d71195" @@ -7155,16 +7092,6 @@ is-plain-object@^3.0.0: dependencies: isobject "^4.0.0" -is-posix-bracket@^0.1.0: - version "0.1.1" - resolved "https://registry.yarnpkg.com/is-posix-bracket/-/is-posix-bracket-0.1.1.tgz#3334dc79774368e92f016e6fbc0a88f5cd6e6bc4" - integrity sha1-MzTceXdDaOkvAW5vvAqI9c1ua8Q= - -is-primitive@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/is-primitive/-/is-primitive-2.0.0.tgz#207bab91638499c07b2adf240a41a87210034575" - integrity sha1-IHurkWOEmcB7Kt8kCkGochADRXU= - is-promise@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/is-promise/-/is-promise-2.1.0.tgz#79a2a9ece7f096e80f36d2b2f3bc16c1ff4bf3fa" @@ -7180,6 +7107,13 @@ is-redirect@^1.0.0: resolved "https://registry.yarnpkg.com/is-redirect/-/is-redirect-1.0.0.tgz#1d03dded53bd8db0f30c26e4f95d36fc7c87dc24" integrity sha1-HQPd7VO9jbDzDCbk+V02/HyH3CQ= +is-reference@^1.1.2: + version "1.1.4" + resolved "https://registry.yarnpkg.com/is-reference/-/is-reference-1.1.4.tgz#3f95849886ddb70256a3e6d062b1a68c13c51427" + integrity sha512-uJA/CDPO3Tao3GTrxYn6AwkM4nUPJiGGYu5+cB8qbC7WGFlrKZbiRo7SFKxUAEpFUfiHofWCXBUNhvYJMh+6zw== + dependencies: + "@types/estree" "0.0.39" + is-regex@^1.0.4: version "1.0.4" resolved "https://registry.yarnpkg.com/is-regex/-/is-regex-1.0.4.tgz#5517489b547091b0930e095654ced25ee97e9491" @@ -7812,6 +7746,38 @@ jsdom@^11.5.1: ws "^4.0.0" xml-name-validator "^3.0.0" +jsdom@^15.2.1: + version "15.2.1" + resolved "https://registry.yarnpkg.com/jsdom/-/jsdom-15.2.1.tgz#d2feb1aef7183f86be521b8c6833ff5296d07ec5" + integrity sha512-fAl1W0/7T2G5vURSyxBzrJ1LSdQn6Tr5UX/xD4PXDx/PDgwygedfW6El/KIj3xJ7FU61TTYnc/l/B7P49Eqt6g== + dependencies: + abab "^2.0.0" + acorn "^7.1.0" + acorn-globals "^4.3.2" + array-equal "^1.0.0" + cssom "^0.4.1" + cssstyle "^2.0.0" + data-urls "^1.1.0" + domexception "^1.0.1" + escodegen "^1.11.1" + html-encoding-sniffer "^1.0.2" + nwsapi "^2.2.0" + parse5 "5.1.0" + pn "^1.1.0" + request "^2.88.0" + request-promise-native "^1.0.7" + saxes "^3.1.9" + symbol-tree "^3.2.2" + tough-cookie "^3.0.1" + w3c-hr-time "^1.0.1" + w3c-xmlserializer "^1.1.2" + webidl-conversions "^4.0.2" + whatwg-encoding "^1.0.5" + whatwg-mimetype "^2.3.0" + whatwg-url "^7.0.0" + ws "^7.0.0" + xml-name-validator "^3.0.0" + jsesc@^1.3.0: version "1.3.0" resolved "https://registry.yarnpkg.com/jsesc/-/jsesc-1.3.0.tgz#46c3fec8c1892b12b0833db9bc7622176dbab34b" @@ -8256,6 +8222,11 @@ lodash.get@^4.4.2: resolved "https://registry.yarnpkg.com/lodash.get/-/lodash.get-4.4.2.tgz#2d177f652fa31e939b4438d5341499dfa3825e99" integrity sha1-LRd/ZS+jHpObRDjVNBSZ36OCXpk= +lodash.hasin@4.5.2: + version "4.5.2" + resolved "https://registry.yarnpkg.com/lodash.hasin/-/lodash.hasin-4.5.2.tgz#f91e352378d21ef7090b9e7687c2ca35c5b4d52a" + integrity sha1-+R41I3jSHvcJC552h8LKNcW01So= + lodash.includes@^4.3.0: version "4.3.0" resolved "https://registry.yarnpkg.com/lodash.includes/-/lodash.includes-4.3.0.tgz#60bb98a87cb923c68ca1e51325483314849f553f" @@ -8266,11 +8237,21 @@ lodash.isboolean@^3.0.3: resolved "https://registry.yarnpkg.com/lodash.isboolean/-/lodash.isboolean-3.0.3.tgz#6c2e171db2a257cd96802fd43b01b20d5f5870f6" integrity sha1-bC4XHbKiV82WgC/UOwGyDV9YcPY= +lodash.isempty@4.4.0: + version "4.4.0" + resolved "https://registry.yarnpkg.com/lodash.isempty/-/lodash.isempty-4.4.0.tgz#6f86cbedd8be4ec987be9aaf33c9684db1b31e7e" + integrity sha1-b4bL7di+TsmHvpqvM8loTbGzHn4= + lodash.isinteger@^4.0.4: version "4.0.4" resolved "https://registry.yarnpkg.com/lodash.isinteger/-/lodash.isinteger-4.0.4.tgz#619c0af3d03f8b04c31f5882840b77b11cd68343" integrity sha1-YZwK89A/iwTDH1iChAt3sRzWg0M= +lodash.isnil@4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/lodash.isnil/-/lodash.isnil-4.0.0.tgz#49e28cd559013458c814c5479d3c663a21bfaa6c" + integrity sha1-SeKM1VkBNFjIFMVHnTxmOiG/qmw= + lodash.isnumber@^3.0.3: version "3.0.3" resolved "https://registry.yarnpkg.com/lodash.isnumber/-/lodash.isnumber-3.0.3.tgz#3ce76810c5928d03352301ac287317f11c0b1ffc" @@ -8306,6 +8287,11 @@ lodash.memoize@^4.1.2: resolved "https://registry.yarnpkg.com/lodash.memoize/-/lodash.memoize-4.1.2.tgz#bcc6c49a42a2840ed997f323eada5ecd182e0bfe" integrity sha1-vMbEmkKihA7Zl/Mj6tpezRguC/4= +lodash.omitby@4.6.0: + version "4.6.0" + resolved "https://registry.yarnpkg.com/lodash.omitby/-/lodash.omitby-4.6.0.tgz#5c15ff4754ad555016b53c041311e8f079204791" + integrity sha1-XBX/R1StVVAWtTwEExHo8HkgR5E= + lodash.once@^4.0.0: version "4.1.1" resolved "https://registry.yarnpkg.com/lodash.once/-/lodash.once-4.1.1.tgz#0dd3971213c7c56df880977d504c88fb471a97ac" @@ -8401,19 +8387,19 @@ macos-release@^2.2.0: resolved "https://registry.yarnpkg.com/macos-release/-/macos-release-2.3.0.tgz#eb1930b036c0800adebccd5f17bc4c12de8bb71f" integrity sha512-OHhSbtcviqMPt7yfw5ef5aghS2jzFVKEFyCJndQt2YpSQ9qRVSEv2axSJI1paVThEu+FFGs584h/1YhxjVqajA== -magic-string@0.19.1: - version "0.19.1" - resolved "https://registry.yarnpkg.com/magic-string/-/magic-string-0.19.1.tgz#14d768013caf2ec8fdea16a49af82fc377e75201" - integrity sha1-FNdoATyvLsj96hakmvgvw3fnUgE= +magic-string@0.25.1: + version "0.25.1" + resolved "https://registry.yarnpkg.com/magic-string/-/magic-string-0.25.1.tgz#b1c248b399cd7485da0fe7385c2fc7011843266e" + integrity sha512-sCuTz6pYom8Rlt4ISPFn6wuFodbKMIHUMv4Qko9P17dpxb7s52KJTmRuZZqHdGmLCK9AOcDare039nRIcfdkEg== dependencies: - vlq "^0.2.1" + sourcemap-codec "^1.4.1" -magic-string@0.22.4, magic-string@^0.22.4: - version "0.22.4" - resolved "https://registry.yarnpkg.com/magic-string/-/magic-string-0.22.4.tgz#31039b4e40366395618c1d6cf8193c53917475ff" - integrity sha512-kxBL06p6iO2qPBHsqGK2b3cRwiRGpnmSuVWNhwHcMX7qJOUr1HvricYP1LZOCdkQBUp0jiWg2d6WJwR3vYgByw== +magic-string@0.25.4, magic-string@^0.25.2: + version "0.25.4" + resolved "https://registry.yarnpkg.com/magic-string/-/magic-string-0.25.4.tgz#325b8a0a79fc423db109b77fd5a19183b7ba5143" + integrity sha512-oycWO9nEVAP2RVPbIoDoA4Y7LFIJ3xRYov93gAyJhZkET1tNuB0u7uWkZS2LpBWTJUWnmau/To8ECWRC+jKNfw== dependencies: - vlq "^0.2.1" + sourcemap-codec "^1.4.4" make-dir@^1.0.0: version "1.3.0" @@ -8569,25 +8555,6 @@ methods@~1.1.2: resolved "https://registry.yarnpkg.com/methods/-/methods-1.1.2.tgz#5529a4d67654134edcc5266656835b0f851afcee" integrity sha1-VSmk1nZUE07cxSZmVoNbD4Ua/O4= -micromatch@^2.3.11: - version "2.3.11" - resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-2.3.11.tgz#86677c97d1720b363431d04d0d15293bd38c1565" - integrity sha1-hmd8l9FyCzY0MdBNDRUpO9OMFWU= - dependencies: - arr-diff "^2.0.0" - array-unique "^0.2.1" - braces "^1.8.2" - expand-brackets "^0.1.4" - extglob "^0.3.1" - filename-regex "^2.0.0" - is-extglob "^1.0.0" - is-glob "^2.0.1" - kind-of "^3.0.2" - normalize-path "^2.0.1" - object.omit "^2.0.0" - parse-glob "^3.0.4" - regex-cache "^0.4.2" - micromatch@^3.0.4, micromatch@^3.1.10, micromatch@^3.1.4: version "3.1.10" resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-3.1.10.tgz#70859bc95c9840952f359a068a3fc49f9ecfac23" @@ -8652,6 +8619,11 @@ mimic-response@^1.0.0, mimic-response@^1.0.1: resolved "https://registry.yarnpkg.com/mimic-response/-/mimic-response-1.0.1.tgz#4923538878eef42063cb8a3e3b0798781487ab1b" integrity sha512-j5EctnkH7amfV/q5Hgmoal1g2QHFJRraOtmx0JpIqkxhBhI/lJSl1nMpQ45hVarwNETOoWEimndZ4QK0RHxuxQ== +mimic-response@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/mimic-response/-/mimic-response-2.0.0.tgz#996a51c60adf12cb8a87d7fb8ef24c2f3d5ebb46" + integrity sha512-8ilDoEapqA4uQ3TwS0jakGONKXVJqpy+RpM+3b7pLdOjghCrEiGp9SRkFbUHAmZW9vdnrENWHjaweIoTIJExSQ== + minimalistic-assert@^1.0.0, minimalistic-assert@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz#2e194de044626d4a10e7f7fbc00ce73e83e4d5c7" @@ -8662,7 +8634,7 @@ minimalistic-crypto-utils@^1.0.0, minimalistic-crypto-utils@^1.0.1: resolved "https://registry.yarnpkg.com/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz#f6c00c1c0b082246e5c4d99dfb8c7c083b2b582a" integrity sha1-9sAMHAsIIkblxNmd+4x8CDsrWCo= -"minimatch@2 || 3", minimatch@^3.0.2, minimatch@^3.0.4: +"minimatch@2 || 3", minimatch@^3.0.4: version "3.0.4" resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083" integrity sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA== @@ -8831,7 +8803,7 @@ mz@2.7.0: object-assign "^4.0.1" thenify-all "^1.0.0" -nan@^2.10.0, nan@^2.12.1: +nan@^2.10.0, nan@^2.12.1, nan@^2.14.0: version "2.14.0" resolved "https://registry.yarnpkg.com/nan/-/nan-2.14.0.tgz#7818f722027b2459a86f0295d434d1fc2336c52c" integrity sha512-INOFj37C7k3AfaNTtX8RhsTw7qRy7eLET14cROi9+5HAVbbHuIWUHEauBv5qT4Av2tWasiTY1Jw6puUNqRJXQg== @@ -9039,6 +9011,22 @@ node-notifier@^5.4.2: shellwords "^0.1.1" which "^1.3.0" +node-pre-gyp@^0.11.0: + version "0.11.0" + resolved "https://registry.yarnpkg.com/node-pre-gyp/-/node-pre-gyp-0.11.0.tgz#db1f33215272f692cd38f03238e3e9b47c5dd054" + integrity sha512-TwWAOZb0j7e9eGaf9esRx3ZcLaE5tQ2lvYy1pb5IAaG1a2e2Kv5Lms1Y4hpj+ciXJRofIxxlt5haeQ/2ANeE0Q== + dependencies: + detect-libc "^1.0.2" + mkdirp "^0.5.1" + needle "^2.2.1" + nopt "^4.0.1" + npm-packlist "^1.1.6" + npmlog "^4.0.2" + rc "^1.2.7" + rimraf "^2.6.1" + semver "^5.3.0" + tar "^4" + node-pre-gyp@^0.12.0: version "0.12.0" resolved "https://registry.yarnpkg.com/node-pre-gyp/-/node-pre-gyp-0.12.0.tgz#39ba4bb1439da030295f899e3b520b7785766149" @@ -9105,7 +9093,7 @@ normalize-package-data@^2.3.2, normalize-package-data@^2.3.4, normalize-package- semver "2 || 3 || 4 || 5" validate-npm-package-license "^3.0.1" -normalize-path@^2.0.0, normalize-path@^2.0.1, normalize-path@^2.1.1: +normalize-path@^2.0.0, normalize-path@^2.1.1: version "2.1.1" resolved "https://registry.yarnpkg.com/normalize-path/-/normalize-path-2.1.1.tgz#1ab28b556e198363a8c1a6f7e6fa20137fe6aed9" integrity sha1-GrKLVW4Zg2Oowab35vogE3/mrtk= @@ -9223,6 +9211,11 @@ nwsapi@^2.0.0: resolved "https://registry.yarnpkg.com/nwsapi/-/nwsapi-2.1.4.tgz#e006a878db23636f8e8a67d33ca0e4edf61a842f" integrity sha512-iGfd9Y6SFdTNldEy2L0GUhcarIutFmk+MPWIn9dmj8NMIup03G08uUF2KGbbmv/Ux4RT0VZJoP/sVbWA6d/VIw== +nwsapi@^2.2.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/nwsapi/-/nwsapi-2.2.0.tgz#204879a9e3d068ff2a55139c2c772780681a38b7" + integrity sha512-h2AatdwYH+JHiZpv7pt/gSX1XoRGb7L/qSIeuqA6GwYoF9w1vP1cw42TO0aI2pNyshRK5893hNSl+1//vHK7hQ== + oauth-sign@~0.8.1, oauth-sign@~0.8.2: version "0.8.2" resolved "https://registry.yarnpkg.com/oauth-sign/-/oauth-sign-0.8.2.tgz#46a6ab7f0aead8deae9ec0565780b7d4efeb9d43" @@ -9287,14 +9280,6 @@ object.getownpropertydescriptors@^2.0.3: define-properties "^1.1.2" es-abstract "^1.5.1" -object.omit@^2.0.0: - version "2.0.1" - resolved "https://registry.yarnpkg.com/object.omit/-/object.omit-2.0.1.tgz#1a9c744829f39dbb858c76ca3579ae2a54ebd1fa" - integrity sha1-Gpx0SCnznbuFjHbKNXmuKlTr0fo= - dependencies: - for-own "^0.1.4" - is-extendable "^0.1.1" - object.pick@^1.3.0: version "1.3.0" resolved "https://registry.yarnpkg.com/object.pick/-/object.pick-1.3.0.tgz#87a10ac4c1694bd2e1cbf53591a66141fb5dd747" @@ -9696,16 +9681,6 @@ parse-github-url@^1.0.2: resolved "https://registry.yarnpkg.com/parse-github-url/-/parse-github-url-1.0.2.tgz#242d3b65cbcdda14bb50439e3242acf6971db395" integrity sha512-kgBf6avCbO3Cn6+RnzRGLkUsv4ZVqv/VfAYkRsyBcgkshNvVBkRn1FEZcW0Jb+npXQWm2vHPnnOqFteZxRRGNw== -parse-glob@^3.0.4: - version "3.0.4" - resolved "https://registry.yarnpkg.com/parse-glob/-/parse-glob-3.0.4.tgz#b2c376cfb11f35513badd173ef0bb6e3a388391c" - integrity sha1-ssN2z7EfNVE7rdFz7wu246OIORw= - dependencies: - glob-base "^0.3.0" - is-dotfile "^1.0.0" - is-extglob "^1.0.0" - is-glob "^2.0.0" - parse-json@4.0.0, parse-json@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/parse-json/-/parse-json-4.0.0.tgz#be35f5425be1f7f6c747184f98a788cb99477ee0" @@ -9756,6 +9731,11 @@ parse5@4.0.0: resolved "https://registry.yarnpkg.com/parse5/-/parse5-4.0.0.tgz#6d78656e3da8d78b4ec0b906f7c08ef1dfe3f608" integrity sha512-VrZ7eOd3T1Fk4XWNXMgiGBK/z0MG48BWG2uQNU4I72fkQuKUTZpl+u9k+CxEG0twMVzSmXEEz12z5Fnw1jIQFA== +parse5@5.1.0: + version "5.1.0" + resolved "https://registry.yarnpkg.com/parse5/-/parse5-5.1.0.tgz#c59341c9723f414c452975564c7c00a68d58acd2" + integrity sha512-fxNG2sQjHvlVAYmzBZS9YlDp6PTSSDwa98vkD4QgVDDCAo84z5X1t5XyJQ62ImdLXx5NdIIfihey6xpum9/gRQ== + parse5@^3.0.1: version "3.0.3" resolved "https://registry.yarnpkg.com/parse5/-/parse5-3.0.3.tgz#042f792ffdd36851551cf4e9e066b3874ab45b5c" @@ -10050,11 +10030,6 @@ prepend-http@^2.0.0: resolved "https://registry.yarnpkg.com/prepend-http/-/prepend-http-2.0.0.tgz#e92434bfa5ea8c19f41cdfd401d741a3c819d897" integrity sha1-6SQ0v6XqjBn0HN/UAddBo8gZ2Jc= -preserve@^0.2.0: - version "0.2.0" - resolved "https://registry.yarnpkg.com/preserve/-/preserve-0.2.0.tgz#815ed1f6ebc65926f865b310c0713bcb3315ce4b" - integrity sha1-gV7R9uvGWSb4ZbMQwHE7yzMVzks= - prettier@1.13.7, prettier@^1.0.0: version "1.13.7" resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.13.7.tgz#850f3b8af784a49a6ea2d2eaa7ed1428a34b7281" @@ -10348,14 +10323,6 @@ random-seed@^0.3.0: dependencies: json-stringify-safe "^5.0.1" -randomatic@^1.1.3: - version "1.1.7" - resolved "https://registry.yarnpkg.com/randomatic/-/randomatic-1.1.7.tgz#c7abe9cc8b87c0baa876b19fde83fd464797e38c" - integrity sha512-D5JUjPyJbaJDkuAazpVnSfVkLlpeO3wDlPROTMLGKG1zMFNFRgrciKo1ltz/AzNTkqE0HzDx655QOL51N06how== - dependencies: - is-number "^3.0.0" - kind-of "^4.0.0" - randombytes@^2.0.0, randombytes@^2.0.1, randombytes@^2.0.5: version "2.1.0" resolved "https://registry.yarnpkg.com/randombytes/-/randombytes-2.1.0.tgz#df6f84372f0270dc65cdf6291349ab7a473d4f2a" @@ -10616,13 +10583,6 @@ regenerator-transform@^0.14.0: dependencies: private "^0.1.6" -regex-cache@^0.4.2: - version "0.4.4" - resolved "https://registry.yarnpkg.com/regex-cache/-/regex-cache-0.4.4.tgz#75bdc58a2a1496cec48a12835bc54c8d562336dd" - integrity sha512-nVIZwtCjkC9YgvWkpM55B5rBhBYRZhAaJbgcFYXXsHnbZ9UZI9nnVWYZpBlCqv9ho2eZryPnWrZGsOdPwVWXWQ== - dependencies: - is-equal-shallow "^0.1.3" - regex-not@^1.0.0, regex-not@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/regex-not/-/regex-not-1.0.2.tgz#1f4ece27e00b0b65e0247a6810e6a85d83a5752c" @@ -10734,7 +10694,7 @@ repeat-element@^1.1.2: resolved "https://registry.yarnpkg.com/repeat-element/-/repeat-element-1.1.2.tgz#ef089a178d1483baae4d93eb98b4f9e4e11d990a" integrity sha1-7wiaF40Ug7quTZPrmLT55OEdmQo= -repeat-string@^1.5.2, repeat-string@^1.6.1: +repeat-string@^1.6.1: version "1.6.1" resolved "https://registry.yarnpkg.com/repeat-string/-/repeat-string-1.6.1.tgz#8dcae470e1c88abc2d600fff4a776286da75e637" integrity sha1-jcrkcOHIirwtYA//Sndihtp15jc= @@ -10758,6 +10718,13 @@ request-promise-core@1.1.2: dependencies: lodash "^4.17.11" +request-promise-core@1.1.3: + version "1.1.3" + resolved "https://registry.yarnpkg.com/request-promise-core/-/request-promise-core-1.1.3.tgz#e9a3c081b51380dfea677336061fea879a829ee9" + integrity sha512-QIs2+ArIGQVp5ZYbWD5ZLCY29D5CfWizP8eWnm8FoGD1TX61veauETVQbrV60662V0oFBkrDOuaBI8XgtuyYAQ== + dependencies: + lodash "^4.17.15" + request-promise-native@^1.0.5: version "1.0.7" resolved "https://registry.yarnpkg.com/request-promise-native/-/request-promise-native-1.0.7.tgz#a49868a624bdea5069f1251d0a836e0d89aa2c59" @@ -10767,6 +10734,15 @@ request-promise-native@^1.0.5: stealthy-require "^1.1.1" tough-cookie "^2.3.3" +request-promise-native@^1.0.7: + version "1.0.8" + resolved "https://registry.yarnpkg.com/request-promise-native/-/request-promise-native-1.0.8.tgz#a455b960b826e44e2bf8999af64dff2bfe58cb36" + integrity sha512-dapwLGqkHtwL5AEbfenuzjTYg35Jd6KPytsC2/TLkVMz8rm+tNt72MGUWT1RP/aYawMpN6HqbNGBQaRcBtjQMQ== + dependencies: + request-promise-core "1.1.3" + stealthy-require "^1.1.1" + tough-cookie "^2.3.3" + request@2.79.0: version "2.79.0" resolved "https://registry.yarnpkg.com/request/-/request-2.79.0.tgz#4dfe5bf6be8b8cdc37fcf93e04b65577722710de" @@ -10819,7 +10795,7 @@ request@2.87.0: tunnel-agent "^0.6.0" uuid "^3.1.0" -request@^2.45.0, request@^2.83.0, request@~2.88.0: +request@^2.45.0, request@^2.83.0, request@^2.88.0, request@~2.88.0: version "2.88.0" resolved "https://registry.yarnpkg.com/request/-/request-2.88.0.tgz#9c2fca4f7d35b592efe57c7f0a55e81052124fef" integrity sha512-NAqBSrijGLZdM0WZNsInLJpkJokL72XYjUpnB0iwsRgxh7dB6COrHnTBNwN0E+lHDAJzu7kLAkDeY08z2/A0hg== @@ -10933,13 +10909,20 @@ resolve@1.1.7: resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.1.7.tgz#203114d82ad2c5ed9e8e0411b3932875e889e97b" integrity sha1-IDEU2CrSxe2ejgQRs5ModeiJ6Xs= -resolve@^1.1.6, resolve@^1.10.0, resolve@^1.3.2, resolve@^1.4.0: +resolve@^1.1.6, resolve@^1.10.0, resolve@^1.3.2: version "1.12.0" resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.12.0.tgz#3fc644a35c84a48554609ff26ec52b66fa577df6" integrity sha512-B/dOmuoAik5bKcD6s6nXDCjzUKnaDvdkRyAk6rsmsKLipWj4797iothd7jmmUhWTfinVMU+wc56rYKsit2Qy4w== dependencies: path-parse "^1.0.6" +resolve@^1.11.0, resolve@^1.11.1: + version "1.13.1" + resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.13.1.tgz#be0aa4c06acd53083505abb35f4d66932ab35d16" + integrity sha512-CxqObCX8K8YtAhOBRg+lrcdn+LK+WYOS8tSjqSFbjtrI5PnS63QPhZl4+yKfrU9tdsbMu9Anr/amegT87M9Z6w== + dependencies: + path-parse "^1.0.6" + responselike@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/responselike/-/responselike-1.0.2.tgz#918720ef3b631c5642be068f15ade5a46f4ba1e7" @@ -11017,7 +11000,7 @@ ripemd160@^2.0.0, ripemd160@^2.0.1: hash-base "^3.0.0" inherits "^2.0.1" -rollup-plugin-babel@^4.0.1: +rollup-plugin-babel@^4.3.3: version "4.3.3" resolved "https://registry.yarnpkg.com/rollup-plugin-babel/-/rollup-plugin-babel-4.3.3.tgz#7eb5ac16d9b5831c3fd5d97e8df77ba25c72a2aa" integrity sha512-tKzWOCmIJD/6aKNz0H1GMM+lW1q9KyFubbWzGiOG540zxPPifnEAHTZwjo0g991Y+DyOZcLqBgqOdqazYE5fkw== @@ -11025,72 +11008,91 @@ rollup-plugin-babel@^4.0.1: "@babel/helper-module-imports" "^7.0.0" rollup-pluginutils "^2.8.1" -rollup-plugin-commonjs@^8.2.6: - version "8.2.6" - resolved "https://registry.yarnpkg.com/rollup-plugin-commonjs/-/rollup-plugin-commonjs-8.2.6.tgz#27e5b9069ff94005bb01e01bb46a1e4873784677" - integrity sha512-qK0+uhktmnAgZkHkqFuajNmPw93fjrO7+CysDaxWE5jrUR9XSlSvuao5ZJP+XizxA8weakhgYYBtbVz9SGBpjA== +rollup-plugin-commonjs@^10.1.0: + version "10.1.0" + resolved "https://registry.yarnpkg.com/rollup-plugin-commonjs/-/rollup-plugin-commonjs-10.1.0.tgz#417af3b54503878e084d127adf4d1caf8beb86fb" + integrity sha512-jlXbjZSQg8EIeAAvepNwhJj++qJWNJw1Cl0YnOqKtP5Djx+fFGkp3WRh+W0ASCaFG5w1jhmzDxgu3SJuVxPF4Q== dependencies: - acorn "^5.2.1" - estree-walker "^0.5.0" - magic-string "^0.22.4" - resolve "^1.4.0" - rollup-pluginutils "^2.0.1" + estree-walker "^0.6.1" + is-reference "^1.1.2" + magic-string "^0.25.2" + resolve "^1.11.0" + rollup-pluginutils "^2.8.1" -rollup-plugin-node-resolve@^2.1.1: - version "2.1.1" - resolved "https://registry.yarnpkg.com/rollup-plugin-node-resolve/-/rollup-plugin-node-resolve-2.1.1.tgz#cbb783b0d15b02794d58915350b2f0d902b8ddc8" - integrity sha1-y7eDsNFbAnlNWJFTULLw2QK43cg= +rollup-plugin-node-resolve@^5.2.0: + version "5.2.0" + resolved "https://registry.yarnpkg.com/rollup-plugin-node-resolve/-/rollup-plugin-node-resolve-5.2.0.tgz#730f93d10ed202473b1fb54a5997a7db8c6d8523" + integrity sha512-jUlyaDXts7TW2CqQ4GaO5VJ4PwwaV8VUGA7+km3n6k6xtOEacf61u0VXwN80phY/evMcaS+9eIeJ9MOyDxt5Zw== dependencies: - browser-resolve "^1.11.0" - builtin-modules "^1.1.0" - resolve "^1.1.6" + "@types/resolve" "0.0.8" + builtin-modules "^3.1.0" + is-module "^1.0.0" + resolve "^1.11.1" + rollup-pluginutils "^2.8.1" -rollup-plugin-prettier@^0.3.0: - version "0.3.0" - resolved "https://registry.yarnpkg.com/rollup-plugin-prettier/-/rollup-plugin-prettier-0.3.0.tgz#1000df8a2914d367b79507c1caa582fdbed8b0f3" - integrity sha1-EADfiikU02e3lQfByqWC/b7YsPM= - dependencies: - diff "3.3.0" - magic-string "0.22.4" +rollup-plugin-prettier@^0.6.0: + version "0.6.0" + resolved "https://registry.yarnpkg.com/rollup-plugin-prettier/-/rollup-plugin-prettier-0.6.0.tgz#3b53b4ac2def23f150f496cff9106f4042a4ade1" + integrity sha512-BgfyZ1biKcAaRNzfUyG/CeI5dFn+WsygK7kYjuXM6aL4m3t/53ZpJI2ZSMAeaKj6w2dj3CkOYbT0gulwh2SvKA== + dependencies: + diff "4.0.1" + lodash.hasin "4.5.2" + lodash.isempty "4.4.0" + lodash.isnil "4.0.0" + lodash.omitby "4.6.0" + magic-string "0.25.1" prettier "^1.0.0" -rollup-plugin-replace@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/rollup-plugin-replace/-/rollup-plugin-replace-2.0.0.tgz#19074089c8ed57184b8cc64e967a03d095119277" - integrity sha512-pK9mTd/FNrhtBxcTBXoh0YOwRIShV0gGhv9qvUtNcXHxIMRZMXqfiZKVBmCRGp8/2DJRy62z2JUE7/5tP6WxOQ== +rollup-plugin-replace@^2.2.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/rollup-plugin-replace/-/rollup-plugin-replace-2.2.0.tgz#f41ae5372e11e7a217cde349c8b5d5fd115e70e3" + integrity sha512-/5bxtUPkDHyBJAKketb4NfaeZjL5yLZdeUihSfbF2PQMz+rSTEb8ARKoOl3UBT4m7/X+QOXJo3sLTcq+yMMYTA== dependencies: - magic-string "^0.22.4" - minimatch "^3.0.2" - rollup-pluginutils "^2.0.1" + magic-string "^0.25.2" + rollup-pluginutils "^2.6.0" -rollup-plugin-strip-banner@^0.2.0: - version "0.2.0" - resolved "https://registry.yarnpkg.com/rollup-plugin-strip-banner/-/rollup-plugin-strip-banner-0.2.0.tgz#d5c86979c7871427f9d7f797e09a493750769fd4" - integrity sha1-1chpeceHFCf51/eX4JpJN1B2n9Q= +rollup-plugin-strip-banner@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/rollup-plugin-strip-banner/-/rollup-plugin-strip-banner-1.0.0.tgz#28ddfb74e7b9c1fe3e612124fa83e571b914e893" + integrity sha512-hatiuCbYCM7db/JmogCn5a4/Un5dLnAIT4ixXmH9qNCbzXJqd0/jnVd/8ZDA3fF7WmmVh7D18GAzha0MMmRpSQ== dependencies: extract-banner "0.1.2" - magic-string "0.19.1" - rollup-pluginutils "2.0.1" + magic-string "0.25.4" + rollup-pluginutils "2.8.2" -rollup-pluginutils@2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/rollup-pluginutils/-/rollup-pluginutils-2.0.1.tgz#7ec95b3573f6543a46a6461bd9a7c544525d0fc0" - integrity sha1-fslbNXP2VDpGpkYb2afFRFJdD8A= +rollup-plugin-terser@^5.1.2: + version "5.1.2" + resolved "https://registry.yarnpkg.com/rollup-plugin-terser/-/rollup-plugin-terser-5.1.2.tgz#3e41256205cb75f196fc70d4634227d1002c255c" + integrity sha512-sWKBCOS+vUkRtHtEiJPAf+WnBqk/C402fBD9AVHxSIXMqjsY7MnYWKYEUqGixtr0c8+1DjzUEPlNgOYQPVrS1g== dependencies: - estree-walker "^0.3.0" - micromatch "^2.3.11" + "@babel/code-frame" "^7.0.0" + jest-worker "^24.6.0" + rollup-pluginutils "^2.8.1" + serialize-javascript "^1.7.0" + terser "^4.1.0" + +rollup-pluginutils@2.8.2, rollup-pluginutils@^2.6.0: + version "2.8.2" + resolved "https://registry.yarnpkg.com/rollup-pluginutils/-/rollup-pluginutils-2.8.2.tgz#72f2af0748b592364dbd3389e600e5a9444a351e" + integrity sha512-EEp9NhnUkwY8aif6bxgovPHMoMoNr2FulJziTndpt5H9RdwC47GSGuII9XxpSdzVGM0GWrNPHV6ie1LTNJPaLQ== + dependencies: + estree-walker "^0.6.1" -rollup-pluginutils@^2.0.1, rollup-pluginutils@^2.8.1: +rollup-pluginutils@^2.8.1: version "2.8.1" resolved "https://registry.yarnpkg.com/rollup-pluginutils/-/rollup-pluginutils-2.8.1.tgz#8fa6dd0697344938ef26c2c09d2488ce9e33ce97" integrity sha512-J5oAoysWar6GuZo0s+3bZ6sVZAC0pfqKz68De7ZgDi5z63jOVZn1uJL/+z1jeKHNbGII8kAyHF5q8LnxSX5lQg== dependencies: estree-walker "^0.6.1" -rollup@^0.52.1: - version "0.52.1" - resolved "https://registry.yarnpkg.com/rollup/-/rollup-0.52.1.tgz#610e8e1be432f18fcfbfa865408a1cd7618cd707" - integrity sha512-cVOL8rUMivChVcScL7zq1JCl4+4gMiVOllnX9r2l6MlkUzyXRbBK7szGDGaFXyqZl6uruFtX+gFhize9o7iiKg== +rollup@^1.27.5: + version "1.27.5" + resolved "https://registry.yarnpkg.com/rollup/-/rollup-1.27.5.tgz#d100fb0ffd8353575cb2057152547b9abfddfe59" + integrity sha512-8rfVdzuTg2kt8ObD9LNJpEwUN7B6lsl3sHc5fddtgICpLjpYeSf4m2+RftBzcCaBTMi1iYX3Ez8zFT4Gj2nJjg== + dependencies: + "@types/estree" "*" + "@types/node" "*" + acorn "^7.1.0" rsvp@^4.8.4: version "4.8.5" @@ -11184,6 +11186,13 @@ sax@>=0.6.0, sax@^1.2.4: resolved "https://registry.yarnpkg.com/sax/-/sax-1.2.4.tgz#2816234e2378bddc4e5354fab5caa895df7100d9" integrity sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw== +saxes@^3.1.9: + version "3.1.11" + resolved "https://registry.yarnpkg.com/saxes/-/saxes-3.1.11.tgz#d59d1fd332ec92ad98a2e0b2ee644702384b1c5b" + integrity sha512-Ydydq3zC+WYDJK1+gRxRapLIED9PWeSuuS41wqyoRmzvhhh9nc+QQrVMKJYzJFULazeGhzSV0QleN2wD3boh2g== + dependencies: + xmlchars "^2.1.1" + scheduler@^0.11.0: version "0.11.3" resolved "https://registry.yarnpkg.com/scheduler/-/scheduler-0.11.3.tgz#b5769b90cf8b1464f3f3cfcafe8e3cd7555a2d6b" @@ -11434,6 +11443,20 @@ signal-exit@^3.0.0, signal-exit@^3.0.2: resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.2.tgz#b5fdc08f1287ea1178628e415e25132b73646c6d" integrity sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0= +simple-concat@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/simple-concat/-/simple-concat-1.0.0.tgz#7344cbb8b6e26fb27d66b2fc86f9f6d5997521c6" + integrity sha1-c0TLuLbib7J9ZrL8hvn21Zl1IcY= + +simple-get@^3.0.3: + version "3.1.0" + resolved "https://registry.yarnpkg.com/simple-get/-/simple-get-3.1.0.tgz#b45be062435e50d159540b576202ceec40b9c6b3" + integrity sha512-bCR6cP+aTdScaQCnQKbPKtJOKDp/hj9EDLJo3Nw4y1QksqaovlW/bnptB6/c1e+qmNIDHRK+oXFDdEqBT8WzUA== + dependencies: + decompress-response "^4.2.0" + once "^1.3.1" + simple-concat "^1.0.0" + single-line-log@^1.1.2: version "1.1.2" resolved "https://registry.yarnpkg.com/single-line-log/-/single-line-log-1.1.2.tgz#c2f83f273a3e1a16edb0995661da0ed5ef033364" @@ -11851,6 +11874,11 @@ source-map@^0.6.0, source-map@^0.6.1, source-map@~0.6.1: resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263" integrity sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g== +sourcemap-codec@^1.4.1, sourcemap-codec@^1.4.4: + version "1.4.6" + resolved "https://registry.yarnpkg.com/sourcemap-codec/-/sourcemap-codec-1.4.6.tgz#e30a74f0402bad09807640d39e971090a08ce1e9" + integrity sha512-1ZooVLYFxC448piVLBbtOxFcXwnymH9oUF8nRd3CuYDVvkRBxRl6pB4Mtas5a4drtL+E8LDgFkQNcgIw6tc8Hg== + spawn-sync@1.0.15: version "1.0.15" resolved "https://registry.yarnpkg.com/spawn-sync/-/spawn-sync-1.0.15.tgz#b00799557eb7fb0c8376c29d44e8a1ea67e57476" @@ -12375,6 +12403,15 @@ terser-webpack-plugin@^1.4.1: webpack-sources "^1.4.0" worker-farm "^1.7.0" +terser@^4.1.0: + version "4.4.0" + resolved "https://registry.yarnpkg.com/terser/-/terser-4.4.0.tgz#22c46b4817cf4c9565434bfe6ad47336af259ac3" + integrity sha512-oDG16n2WKm27JO8h4y/w3iqBGAOSCtq7k8dRmrn4Wf9NouL0b2WpMHGChFGZq4nFAQy1FsNJrVQHfurXOSTmOA== + dependencies: + commander "^2.20.0" + source-map "~0.6.1" + source-map-support "~0.5.12" + terser@^4.1.2: version "4.1.4" resolved "https://registry.yarnpkg.com/terser/-/terser-4.1.4.tgz#4478b6a08bb096a61e793fea1a4434408bab936c" @@ -12599,6 +12636,15 @@ tough-cookie@^2.3.3: psl "^1.1.28" punycode "^2.1.1" +tough-cookie@^3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/tough-cookie/-/tough-cookie-3.0.1.tgz#9df4f57e739c26930a018184887f4adb7dca73b2" + integrity sha512-yQyJ0u4pZsv9D4clxO69OEjLWYw+jbgspjTue4lTQZLfV0c5l1VmK2y1JK8E9ahdpltPOaAThPcp5nKPUgSnsg== + dependencies: + ip-regex "^2.1.0" + psl "^1.1.28" + punycode "^2.1.1" + tough-cookie@~2.3.0, tough-cookie@~2.3.3: version "2.3.4" resolved "https://registry.yarnpkg.com/tough-cookie/-/tough-cookie-2.3.4.tgz#ec60cee38ac675063ffc97a5c18970578ee83655" @@ -13049,11 +13095,6 @@ vinyl@^2.0.1: remove-trailing-separator "^1.0.1" replace-ext "^1.0.0" -vlq@^0.2.1: - version "0.2.2" - resolved "https://registry.yarnpkg.com/vlq/-/vlq-0.2.2.tgz#e316d5257b40b86bb43cb8d5fea5d7f54d6b0ca1" - integrity sha1-4xbVJXtAuGu0PLjV/qXX9U1rDKE= - vm-browserify@0.0.4: version "0.0.4" resolved "https://registry.yarnpkg.com/vm-browserify/-/vm-browserify-0.0.4.tgz#5d7ea45bbef9e4a6ff65f95438e0a87c357d5a73" @@ -13078,6 +13119,15 @@ w3c-hr-time@^1.0.1: dependencies: browser-process-hrtime "^0.1.2" +w3c-xmlserializer@^1.1.2: + version "1.1.2" + resolved "https://registry.yarnpkg.com/w3c-xmlserializer/-/w3c-xmlserializer-1.1.2.tgz#30485ca7d70a6fd052420a3d12fd90e6339ce794" + integrity sha512-p10l/ayESzrBMYWRID6xbuCKh2Fp77+sA0doRuGn4tTIMrrZVeqfpKjXHY+oDh3K4nLdPgNwMTVP6Vp4pvqbNg== + dependencies: + domexception "^1.0.1" + webidl-conversions "^4.0.2" + xml-name-validator "^3.0.0" + walker@^1.0.7, walker@~1.0.5: version "1.0.7" resolved "https://registry.yarnpkg.com/walker/-/walker-1.0.7.tgz#2f7f9b8fd10d677262b18a884e28d19618e028fb" @@ -13311,7 +13361,7 @@ websocket-extensions@>=0.1.1: resolved "https://registry.yarnpkg.com/websocket-extensions/-/websocket-extensions-0.1.3.tgz#5d2ff22977003ec687a4b87073dfbbac146ccf29" integrity sha512-nqHUnMXmBzT0w570r2JpJxfiSD1IzoI+HGVdd3aZ0yNi3ngvQ4jv1dtHt5VGxfI2yj5yqImPhOK4vmIh2xMbGg== -whatwg-encoding@^1.0.1, whatwg-encoding@^1.0.3: +whatwg-encoding@^1.0.1, whatwg-encoding@^1.0.3, whatwg-encoding@^1.0.5: version "1.0.5" resolved "https://registry.yarnpkg.com/whatwg-encoding/-/whatwg-encoding-1.0.5.tgz#5abacf777c32166a51d085d6b4f3e7d27113ddb0" integrity sha512-b5lim54JOPN9HtzvK9HFXvBma/rnfFeqsic0hSpjtDbVxR3dJKLc+KB4V6GgiGOvl7CY/KNh8rxSo9DKQrnUEw== @@ -13323,7 +13373,7 @@ whatwg-fetch@>=0.10.0: resolved "https://registry.yarnpkg.com/whatwg-fetch/-/whatwg-fetch-2.0.4.tgz#dde6a5df315f9d39991aa17621853d720b85566f" integrity sha512-dcQ1GWpOD/eEQ97k66aiEVpNnapVj90/+R+SXTPYGHpYBBypfKJEQjLrvMZ7YXbKm21gXd4NcuxUTjiv1YtLng== -whatwg-mimetype@^2.1.0, whatwg-mimetype@^2.2.0: +whatwg-mimetype@^2.1.0, whatwg-mimetype@^2.2.0, whatwg-mimetype@^2.3.0: version "2.3.0" resolved "https://registry.yarnpkg.com/whatwg-mimetype/-/whatwg-mimetype-2.3.0.tgz#3d4b1e0312d2079879f826aff18dbeeca5960fbf" integrity sha512-M4yMwr6mAnQz76TbJm914+gPpB/nCwvZbJU28cUD6dR004SAxDLOOSUaB1JDRqLtaOV/vi0IC5lEAGFgrjGv/g== @@ -13495,6 +13545,13 @@ ws@^7: dependencies: async-limiter "^1.0.0" +ws@^7.0.0: + version "7.2.0" + resolved "https://registry.yarnpkg.com/ws/-/ws-7.2.0.tgz#422eda8c02a4b5dba7744ba66eebbd84bcef0ec7" + integrity sha512-+SqNqFbwTm/0DC18KYzIsMTnEWpLwJsiasW/O17la4iDRRIO9uaHbvKiAS3AHgTiuuWerK/brj4O6MYZkei9xg== + dependencies: + async-limiter "^1.0.0" + xdg-basedir@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/xdg-basedir/-/xdg-basedir-3.0.0.tgz#496b2cc109eca8dbacfe2dc72b603c17c5870ad4" @@ -13518,6 +13575,11 @@ xmlbuilder@~9.0.1: resolved "https://registry.yarnpkg.com/xmlbuilder/-/xmlbuilder-9.0.7.tgz#132ee63d2ec5565c557e20f4c22df9aca686b10d" integrity sha1-Ey7mPS7FVlxVfiD0wi35rKaGsQ0= +xmlchars@^2.1.1: + version "2.2.0" + resolved "https://registry.yarnpkg.com/xmlchars/-/xmlchars-2.2.0.tgz#060fe1bcb7f9c76fe2a17db86a9bc3ab894210cb" + integrity sha512-JZnDKK8B0RCDw84FNdDAIpZK+JuJw+s7Lz8nksI7SIuU3UXJJslUthsi+uWBUYOwPFwW7W7PRLRfUKpxjtjFCw== + xregexp@2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/xregexp/-/xregexp-2.0.0.tgz#52a63e56ca0b84a7f3a5f3d61872f126ad7a5943"