diff --git a/.circleci/config.yml b/.circleci/config.yml index cb085191b714..edf8c3c68d42 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,4 +1,5 @@ -version: 2 +version: 2.1 + aliases: - &restore-node-modules-cache keys: @@ -30,27 +31,178 @@ aliases: - &artifact_env_min path: ~/babel/packages/babel-preset-env-standalone/babel-preset-env.min.js -jobs: - build: + - &test262_workdir + working_directory: ~/babel/babel-test262-runner + + - &artifact_test262_tap + path: ~/test262.tap + + - &artifact_test262_xunit + path: ~/test-results + + - &artifact_test262_diff_tap + path: ~/diff.tap + +executors: + node-executor: + docker: + - image: circleci/node:13 working_directory: ~/babel + # e2e-vue-cli test requires chromium + node-browsers-executor: docker: - - image: circleci/node:12 + - image: circleci/node:13-browsers + working_directory: ~/babel + +jobs: + build-standalone: + executor: node-executor steps: - checkout - - restore-cache: *restore-yarn-cache - - restore-cache: *restore-node-modules-cache - - run: yarn --version - - run: make test-ci-coverage - # Builds babel-standalone with the regular Babel config - - run: IS_PUBLISH=true make build - # test-ci-coverage doesn't test babel-standalone, as trying to gather coverage - # data for a JS file that's several megabytes large is bound to fail. Here, - # we just run the babel-standalone test separately. - - run: ./node_modules/.bin/jest packages/babel-standalone/test/ - - run: ./node_modules/.bin/jest packages/babel-preset-env-standalone/test/ + - restore_cache: *restore-yarn-cache + - restore_cache: *restore-node-modules-cache + # Builds babel-standalone with the regular Babel config + # test-ci-coverage doesn't test babel-standalone, as trying to gather coverage + - run: IS_PUBLISH=true make -j build-standalone-ci + # data for a JS file that's several megabytes large is bound to fail. Here, + # we just run the babel-standalone test separately. + - run: yarn jest "\-standalone/test" - store_artifacts: *artifact_babel - store_artifacts: *artifact_babel_min - store_artifacts: *artifact_env - store_artifacts: *artifact_env_min - save_cache: *save-node-modules-cache - save_cache: *save-yarn-cache + + test262: + executor: node-executor + steps: + - checkout + - run: + name: Sync with latest master branch (only on PRs) + command: | + if [ -n "$CIRCLE_PULL_REQUEST" ] + then + git fetch origin refs/pull/$CIRCLE_PR_NUMBER/merge + git checkout -qf FETCH_HEAD + fi + - restore_cache: *restore-yarn-cache + - restore_cache: *restore-node-modules-cache + - run: + name: Build Babel + command: BABEL_ENV=test make bootstrap + - run: + name: Setup Test Runner + command: | + git clone --recurse-submodules https://github.com/babel/babel-test262-runner + cd babel-test262-runner + yarn + yarn add tap-mocha-reporter --dev + node lib/download-node + - run: + name: Download master branch Test262 artifact + command: node lib/download-master-artifact ~/master.tap + <<: *test262_workdir + - run: + name: Run Test262 + command: BABEL_PATH=.. node lib/run-tests I_AM_SURE | tee ~/test262.tap + <<: *test262_workdir + - store_artifacts: *artifact_test262_tap + - run: + name: Output Test262 results + command: | + cat ~/test262.tap | $(npm bin)/tap-mocha-reporter spec || true + <<: *test262_workdir + - run: + name: Compare previous master branch & current job results + command: | + mkdir -p ~/test-results/test262 + node lib/compare-results ~/master.tap ~/test262.tap | tee ~/diff.tap + <<: *test262_workdir + - store_artifacts: *artifact_test262_diff_tap + - run: + name: Output comparision results and report to CircleCI + command: | + mkdir -p ~/test-results/test262 + cat ~/diff.tap | $(npm bin)/tap-merge | $(npm bin)/tap-mocha-reporter xunit | tee ~/test-results/test262/results.xml + <<: *test262_workdir + - store_test_results: *artifact_test262_xunit + - save_cache: *save-node-modules-cache + - save_cache: *save-yarn-cache + + publish-verdaccio: + executor: node-executor + steps: + - checkout + - run: yarn install + - run: ./scripts/integration-tests/publish-local.sh + - persist_to_workspace: + root: /tmp/verdaccio-workspace + paths: + - storage + - htpasswd + + e2e-babel: + executor: node-executor + steps: + - checkout + - attach_workspace: + at: /tmp/verdaccio-workspace + - run: ./scripts/integration-tests/e2e-babel.sh + + e2e-create-react-app: + executor: node-executor + steps: + - checkout + - attach_workspace: + at: /tmp/verdaccio-workspace + - run: ./scripts/integration-tests/e2e-create-react-app.sh + + e2e-vue-cli: + executor: node-browsers-executor + steps: + - checkout + - attach_workspace: + at: /tmp/verdaccio-workspace + - run: ./scripts/integration-tests/e2e-vue-cli.sh + +workflows: + version: 2 + build-standalone: + jobs: + - build-standalone + test262-master: + jobs: + - test262: + filters: + branches: + only: + - master + test262: + jobs: + - approve-test262-run: + type: approval + filters: + branches: + ignore: + - master + - test262: + requires: + - approve-test262-run + filters: + branches: + ignore: + - master + e2e: + jobs: + - publish-verdaccio + - e2e-babel: + requires: + - publish-verdaccio + - e2e-create-react-app: + requires: + - publish-verdaccio + - e2e-vue-cli: + requires: + - publish-verdaccio + diff --git a/.codesandbox/ci.json b/.codesandbox/ci.json new file mode 100644 index 000000000000..b1f6755c74df --- /dev/null +++ b/.codesandbox/ci.json @@ -0,0 +1,5 @@ +{ + "installCommand": "bootstrap", + "buildCommand": false, + "sandboxes": ["kypop"] +} diff --git a/.eslintignore b/.eslintignore index 092fbbb802cd..a94d6e6b5aff 100644 --- a/.eslintignore +++ b/.eslintignore @@ -17,10 +17,15 @@ codemods/*/lib codemods/*/dist codemods/*/test/fixtures codemods/*/test/tmp -packages/babel-preset-env/data +packages/babel-preset-env/data/[^(plugin-features|shipped-proposals).js] packages/babel-preset-env/test/debug-fixtures packages/babel-preset-env-standalone/babel-preset-env.js packages/babel-preset-env-standalone/babel-preset-env.min.js packages/babel-standalone/babel.js packages/babel-standalone/babel.min.js packages/babel-parser/test/expressions + +eslint/*/lib +eslint/*/node_modules +eslint/*/test +eslint/*/tests diff --git a/.eslintrc.js b/.eslintrc.js new file mode 100644 index 000000000000..b1ca90ef1f7d --- /dev/null +++ b/.eslintrc.js @@ -0,0 +1,48 @@ +module.exports = { + root: true, + plugins: ["prettier", "@babel/development", "import"], + extends: "babel", + rules: { + "prettier/prettier": "error", + // TODO: remove after babel-eslint-config-internal is fully integrated into this repository. + "max-len": "off", + }, + env: { + node: true, + }, + overrides: [ + { + files: [ + "packages/*/src/**/*.js", + "codemods/*/src/**/*.js", + "eslint/*/src/**/*.js", + ], + rules: { + "@babel/development/no-undefined-identifier": "error", + "@babel/development/no-deprecated-clone": "error", + "import/no-extraneous-dependencies": "error", + "guard-for-in": "error", + }, + }, + { + files: [ + "packages/*/test/**/*.js", + "codemods/*/test/**/*.js", + "eslint/*/test/**/*.js", + "packages/babel-helper-transform-fixture-test-runner/src/helpers.js", + "test/**/*.js", + ], + env: { + jest: true, + }, + }, + { + files: ["packages/babel-plugin-*/src/index.js"], + excludedFiles: ["packages/babel-plugin-transform-regenerator/**/*.js"], + rules: { + "@babel/development/plugin-name": "error", + eqeqeq: ["error", "always", { null: "ignore" }], + }, + }, + ], +}; diff --git a/.eslintrc.json b/.eslintrc.json deleted file mode 100644 index a59dc0d9e2dd..000000000000 --- a/.eslintrc.json +++ /dev/null @@ -1,41 +0,0 @@ -{ - "root": true, - "plugins": ["prettier", "@babel/development", "import"], - "extends": "babel", - "rules": { - "prettier/prettier": "error" - }, - "env": { - "node": true - }, - "overrides": [ - { - "files": ["packages/*/src/**/*.js", "codemods/*/src/**/*.js"], - "rules": { - "@babel/development/no-undefined-identifier": "error", - "@babel/development/no-deprecated-clone": "error", - "import/no-extraneous-dependencies": "error", - "guard-for-in": "error" - } - }, - { - "files": [ - "packages/*/test/**/*.js", - "codemods/*/test/**/*.js", - "packages/babel-helper-transform-fixture-test-runner/src/helpers.js", - "test/**/*.js" - ], - "env": { - "jest": true - } - }, - { - "files": ["packages/babel-plugin-*/src/index.js"], - "excludedFiles": ["packages/babel-plugin-transform-regenerator/**/*.js"], - "rules": { - "@babel/development/plugin-name": "error", - "eqeqeq": ["error", "always", { "null": "ignore" }] - } - } - ] -} diff --git a/.flowconfig b/.flowconfig index 694811e55964..4ba284f66add 100644 --- a/.flowconfig +++ b/.flowconfig @@ -24,4 +24,6 @@ suppress_comment= \\(.\\|\n\\)*\\$FlowIgnore suppress_type=$FlowFixMe suppress_type=$FlowSubtype esproposal.export_star_as=enable +esproposal.optional_chaining=enable +esproposal.nullish_coalescing=enable module.name_mapper='^@babel\/\([a-zA-Z0-9_\-]+\)$' -> '/packages/babel-\1/src/index' diff --git a/packages/babel-preset-env/CHANGELOG.md b/.github/CHANGELO-preset-env-v0-v1.md similarity index 100% rename from packages/babel-preset-env/CHANGELOG.md rename to .github/CHANGELO-preset-env-v0-v1.md diff --git a/.github/CHANGELOG-6to5.md b/.github/CHANGELOG-6to5.md index 45afe2368d8d..88016f402214 100644 --- a/.github/CHANGELOG-6to5.md +++ b/.github/CHANGELOG-6to5.md @@ -122,7 +122,7 @@ * Restructure transformers so they're only ran if the AST contains nodes that they need to worry about. Improves transpilation speed significantly. * **Bug Fix** * Fix source maps not tracking end of node locations. - * **Spec Compliancy** + * **Spec Compliance** * Use static super references as the home object is actually done at definition time. * **Polish** * Force the `es6.destructuring` transformer to be whitelisted when the `es7.objectSpread` transformer is. @@ -479,7 +479,7 @@ ## 2.12.3 - * **Spec Compliancy** + * **Spec Compliance** * Optional `typeof` transformer checks for `undefined` before passing it to the helper. * Class methods are now named. @@ -551,7 +551,7 @@ * Add `classesFastSuper` optional transformer that doesn't support parent getters and prototype changing. * Add `forOfFast` transformer that speeds up `for...of` on arrays but produces more code. * Add `--react-compat` to `bin/6to5`. - * **Spec Compliancy** + * **Spec Compliance** * Disallow setters without a single parameter. * Add `configurable` and `writable` to defined properties. * Use define instead of assignment for class methods. @@ -619,7 +619,7 @@ ## 2.7.0 - * **Spec Compliancy** + * **Spec Compliance** * Disallow reassignments of imports. * **New Feature** * `reactCompat` option to enable pre-v0.12 react components. @@ -662,7 +662,7 @@ * **Polish** * Move `"use strict";` to inside module bodies instead of at the top of the file. * Better handling of dynamic imports. - * **Spec Compliancy** + * **Spec Compliance** * Class inheritance now has a `function` or `null` type check. * Add `interopRequireWildcard` around wildcard imports and exports to handle non-object exports. diff --git a/.github/CHANGELOG-v4.md b/.github/CHANGELOG-v4.md index 7a06b2c93eee..ea6c1d496f50 100644 --- a/.github/CHANGELOG-v4.md +++ b/.github/CHANGELOG-v4.md @@ -110,7 +110,7 @@ * Throw an error on different `babel` and `babel-runtime` versions. * Replicate module environment for `babel-node` eval. * Clean up classes output. - * **Spec Compliancy** + * **Spec Compliance** * Make it illegal to use a rest parameter on a setter. ## 4.6.6 @@ -150,8 +150,8 @@ * **New Feature** * Desugar sticky regexes to a new constructor expression so it can be handled by a polyfill. - * **Spec Compliancy** - * `for...of` now outputs in a lengthy `try...catch` this is to ensure spec compliancy in regards to iterator returns and abrupt completions. See [google/traceur-compiler#1773](https://github.com/google/traceur-compiler/issues/1773) and [babel/babel/#838](https://github.com/babel/babel/issues/838) for more information. + * **Spec Compliance** + * `for...of` now outputs in a lengthy `try...catch` this is to ensure spec compliance in regards to iterator returns and abrupt completions. See [google/traceur-compiler#1773](https://github.com/google/traceur-compiler/issues/1773) and [babel/babel/#838](https://github.com/babel/babel/issues/838) for more information. * **Polish** * Rest parameters that are only referred to via number properties on member expressions are desugared into a direct `arguments` reference. Thanks [@neVERberleRfellerER](https://github.com/neVERberleRfellerER)! * `$ babel` no longer exits on syntax errors. diff --git a/.github/CHANGELOG-v5.md b/.github/CHANGELOG-v5.md index 64d4999d58df..30d9f2d051ff 100644 --- a/.github/CHANGELOG-v5.md +++ b/.github/CHANGELOG-v5.md @@ -12,7 +12,7 @@ ## 5.8.24 - * **Spec Compliancy** + * **Spec Compliance** * Updated `optimisation.react.inlineElements` transformer to React 0.14 output. Thanks [@spicyj](https://github.com/spicyj)! * **Polish** * Add support for evaluating more static nodes. Thanks [@hzoo](https://github.com/hzoo)! @@ -451,7 +451,7 @@ Issues with publish process. ![gifs lol](https://31.media.tumblr.com/568205a0e37ae15eca510fa639589a59/tumblr_n8kw8kpcSb1sg6cg8o1_500.gif) - * **Spec Compliancy** + * **Spec Compliance** * Allow trailing param commas for methods when using the `es7.trailingCommas` transformer. * **Bug Fix** * Fix `es6.blockScoping` transformer not properly ignoring `break` in `SwitchCase`. @@ -481,7 +481,7 @@ Issues with publish process. * Fix correct function scope being passed to `nameMethod.property` when inferring the function name for class methods. * Fix incorrect extensions reference causing weird issues when using the Babel CLI. * Fix destructuring param reference replacements not inheriting from their original param. - * **Spec Compliancy** + * **Spec Compliance** * Fix order that method decorators are ran in. ## 5.2.15 @@ -616,7 +616,7 @@ Issues with publish process. * Fix `externalHelpers` option being incorrectly listed as type `string`. * **Internal** * Upgrade `core-js` to `0.9.0`. - * **Spec Compliancy** + * **Spec Compliance** * Fix object decorators not using the `initializer` pattern. * Remove property initializer descriptor reflection. diff --git a/.github/CHANGELOG-v6.md b/.github/CHANGELOG-v6.md index 92d9173db5b8..4094b38395a1 100644 --- a/.github/CHANGELOG-v6.md +++ b/.github/CHANGELOG-v6.md @@ -22,7 +22,7 @@ > Backports for some folks (also other's when we accidentally merged PRs from both 6.x/master) > Lesson learned: just use `master` and backport on another branch. -#### :eyeglasses: Spec Compliancy +#### :eyeglasses: Spec Compliance * `babel-core`, `babel-generator`, `babel-plugin-transform-flow-comments`, `babel-plugin-transform-flow-strip-types`, `babel-traverse`, `babel-types` * [#6081](https://github.com/babel/babel/pull/6081) Flow opaque type 6.x backport. ([@jbrown215](https://github.com/jbrown215)) @@ -1468,7 +1468,7 @@ It's a one-time use tool (helpful after the initial release when upgrading from ## v6.17.0 (2016-10-01) -#### :eyeglasses: Spec Compliancy +#### :eyeglasses: Spec Compliance * `babel-preset-stage-2`, `babel-preset-stage-3` * [#4617](https://github.com/babel/babel/pull/4617) Move async-generators to stage-3. ([@hzoo](https://github.com/hzoo)) @@ -1476,7 +1476,7 @@ It's a one-time use tool (helpful after the initial release when upgrading from Specification repo: https://github.com/tc39/proposal-async-iteration -Asynchronous Iteration was already added in [6.16.0](http://babeljs.io/blog/2016/09/28/6.16.0#spec-compliancy) under stage-2 but it was moved to stage-3 at the [latest TC-39 meeting](https://github.com/tc39/agendas/blob/master/2016/09.md#agenda-for-the-54th-meeting-of-ecma-tc39). +Asynchronous Iteration was already added in [6.16.0](http://babeljs.io/blog/2016/09/28/6.16.0#spec-compliance) under stage-2 but it was moved to stage-3 at the [latest TC-39 meeting](https://github.com/tc39/agendas/blob/master/2016/09.md#agenda-for-the-54th-meeting-of-ecma-tc39). ```js // async generator syntax @@ -1569,7 +1569,7 @@ First PR! Babel 6.16: Happy 2nd Birthday 🎂! -#### :eyeglasses: Spec Compliancy +#### :eyeglasses: Spec Compliance * `babel-core`, `babel-generator`, `babel-helper-remap-async-to-generator`, `babel-helpers`, `babel-plugin-transform-async-generator-functions`, `babel-types`, `babel-preset-stage-2`, ... * [#3473](https://github.com/babel/babel/pull/3473) via [#4576](https://github.com/babel/babel/pull/4576) Implement support for async generator functions and for-await statements. ([@zenparsing](https://github.com/zenparsing)) @@ -2036,7 +2036,7 @@ It's also a lot folk's first PR (or first code PR)! * `babel-generator`, `babel-types` * [#3570](https://github.com/babel/babel/pull/3570) Add support for the new declare module.exports of flow. ([@danez](https://github.com/danez)) -#### Spec Compliancy +#### Spec Compliance * `babel-plugin-transform-es2015-modules-amd`, `babel-plugin-transform-es2015-modules-commonjs`, `babel-plugin-transform-es2015-modules-umd` * [#3518](https://github.com/babel/babel/pull/3518) Throw error for multiple exports default. ([@kaicataldo](https://github.com/kaicataldo)) @@ -2332,7 +2332,7 @@ Length: The number of characters in the output code * `babel-plugin-transform-react-jsx-self`, `babel-preset-react` * [#3540](https://github.com/babel/babel/pull/3540) Added jsx-self babel transform plugin. ([@jimfb](https://github.com/jimfb)) -#### Spec Compliancy +#### Spec Compliance * `babel-plugin-transform-es2015-unicode-regex` * [#3338](https://github.com/babel/babel/pull/3338) Update to `regexpu-core@2.0.0` for ES2016 compliance. ([@mathiasbynens](https://github.com/mathiasbynens)) @@ -3206,7 +3206,7 @@ Changes to note: - Reverting the class properties semicolon parser error. - Fix regression with plugin ordering with `babel-register`. -#### Spec Compliancy +#### Spec Compliance * `babel-plugin-transform-class-properties`, `babylon` * [#3332](https://github.com/babel/babel/pull/3332) Revert to standard ASI behavior for class properties. ([@loganfsmyth](https://github.com/loganfsmyth)) @@ -3628,7 +3628,7 @@ Thanks to @samwgoldman for all the new flow support! * `babel-plugin-transform-es2015-parameters`: [#3191](https://github.com/babel/babel/pull/3191) Fix the order of arguments initialization (fixes [T6809](http://phabricator.babeljs.io/T6809)) * `babel-traverse`: [#3198](https://github.com/babel/babel/pull/3198) In `evaluate()`, it should not mistake lack of confidence for falsy -* **Spec Compliancy** +* **Spec Compliance** * `babylon`, `babel-generator`, `babel-plugin-transform-regenerator`: [#3190](https://github.com/babel/babel/pull/3190): Remove `await *` from `babylon` and raise an error for that syntax since it was removed from the proposal and was causing an issue at runtime but not at compile time (fixes [T6688](http://phabricator.babeljs.io/T6688)). * **Internal** @@ -3863,7 +3863,7 @@ Thanks to @samwgoldman for all the new flow support! * Move `children` prop pushing to after props to ensure correct order in the react inline elements plugin. * Fix `buildExternalHelpers` script ignoring non-underscored helpers. * Fix exported classes with static class properties. - * **Spec Compliancy** + * **Spec Compliance** * Add support for computed mutators in `babel-plugin-transform-es2015-computed-properties`. * **Polish** * Make interop for plugins with the `__esModule` work for all plugins no matter how they're imported/specified. @@ -3904,7 +3904,7 @@ Thanks to @samwgoldman for all the new flow support! * **Polish** * Add npm 3 check to `babel-doctor`. * Autoclear the `babel/register` cache when it gets too big to be serialised. - * **Spec Compliancy** + * **Spec Compliance** * Add support for flow existential type parameters. ## 6.1.1 @@ -3969,7 +3969,7 @@ Thanks to @samwgoldman for all the new flow support! ## 6.0.14 - * **Spec Compliancy** + * **Spec Compliance** * Update exponentiation operator precedence. * Fix parser bug where arrow functions have a higher precedence than they should. * **Bug Fix** diff --git a/.github/ISSUE_TEMPLATE/Bug_report.md b/.github/ISSUE_TEMPLATE/Bug_report.md index 344922e4702c..63e446c69272 100644 --- a/.github/ISSUE_TEMPLATE/Bug_report.md +++ b/.github/ISSUE_TEMPLATE/Bug_report.md @@ -9,6 +9,14 @@ assignees: '' ## Bug Report + +- [ ] I would like to work on a fix! + + + **Current Behavior** A clear and concise description of the behavior. @@ -22,7 +30,8 @@ var your => (code) => here; **Expected behavior/code** A clear and concise description of what you expected to happen (or code). -**Babel Configuration (.babelrc, package.json, cli command)** +**Babel Configuration (babel.config.js, .babelrc, package.json#babel, cli command, .eslintrc)** +- Filename: `babel.config.js` ```js { @@ -31,6 +40,10 @@ A clear and concise description of what you expected to happen (or code). ``` **Environment** + +``` + +``` - Babel version(s): [e.g. v6.0.0, v7.0.0-beta.34] - Node/npm version: [e.g. Node 8/npm 5] - OS: [e.g. OSX 10.13.4, Windows 10] @@ -38,7 +51,7 @@ A clear and concise description of what you expected to happen (or code). - How you are using Babel: [e.g. `cli`, `register`, `loader`] **Possible Solution** - + **Additional context/Screenshots** Add any other context about the problem here. If applicable, add screenshots to help explain. diff --git a/.github/ISSUE_TEMPLATE/Feature_request.md b/.github/ISSUE_TEMPLATE/Feature_request.md index b9c82542ff8c..dd65864dce47 100644 --- a/.github/ISSUE_TEMPLATE/Feature_request.md +++ b/.github/ISSUE_TEMPLATE/Feature_request.md @@ -9,6 +9,9 @@ assignees: '' ## Feature Request + +- [ ] I would like to work on this feature! + **Is your feature request related to a problem? Please describe.** A clear and concise description of what the problem is. Ex. I have an issue when [...] diff --git a/.github/ISSUE_TEMPLATE/Regression-v7.md b/.github/ISSUE_TEMPLATE/Regression-v7.md index a700b90ba073..e2d524c4aac7 100644 --- a/.github/ISSUE_TEMPLATE/Regression-v7.md +++ b/.github/ISSUE_TEMPLATE/Regression-v7.md @@ -10,6 +10,9 @@ assignees: '' # v7 Regression + +- [ ] I would like to work on a fix! + > First check out: https://babeljs.io/docs/en/v7-migration > Also a partial upgrade tool: https://github.com/babel/babel-upgrade @@ -26,7 +29,10 @@ A clear and concise description of what the regression is. var your => (code) => here; ``` -**Babel Configuration (.babelrc, package.json, cli command)** +**Expected behavior/code** +A clear and concise description of what you expected to happen (or code). + +**Babel Configuration (babel.config.js, .babelrc, package.json#babel, cli command)** ```js { @@ -34,10 +40,11 @@ var your => (code) => here; } ``` -**Expected behavior/code** -A clear and concise description of what you expected to happen (or code). - **Environment** + +``` + +``` - Babel version(s): [e.g. v6.0.0, v7.0.0-beta.34] - Node/npm version: [e.g. Node 8/npm 5] - OS: [e.g. OSX 10.13.4, Windows 10] diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index e5a78bd6542d..f805376b4926 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -2,6 +2,8 @@ Before making a PR, please read our contributing guidelines https://github.com/babel/babel/blob/master/CONTRIBUTING.md +Please note that the Babel Team requires two approvals before merging most PRs. + For issue references: Add a comma-separated list of a [closing word](https://help.github.com/articles/closing-issues-via-commit-messages/) followed by the ticket number fixed by the PR. (it should be underlined in the preview if done correctly) If you are making a change that should have a docs update: submit another PR to https://github.com/babel/website @@ -9,7 +11,7 @@ If you are making a change that should have a docs update: submit another PR to | Q                       | A | ------------------------ | --- -| Fixed Issues? | `Fixes #1, Fixes #2` +| Fixed Issues? | `Fixes #1, Fixes #2` | Patch: Bug Fix? | | Major: Breaking Change? | | Minor: New Feature? | diff --git a/.github/lock.yml b/.github/lock.yml index 7737237177e2..9e005246746c 100644 --- a/.github/lock.yml +++ b/.github/lock.yml @@ -4,7 +4,7 @@ daysUntilLock: 91 # Comment to post before locking. Set to `false` to disable lockComment: false -only: issues +# The label to be applied when an issue is locked lockLabel: 'outdated' # Issues or pull requests with these labels will not be locked diff --git a/.github/main.workflow b/.github/main.workflow deleted file mode 100644 index 3267641c50ce..000000000000 --- a/.github/main.workflow +++ /dev/null @@ -1,76 +0,0 @@ -workflow "Release" { - on = "push" - resolves = ["Trigger GitHub release"] -} - -action "Is version tag" { - uses = "actions/bin/filter@0dbb077f64d0ec1068a644d25c71b1db66148a24" - args = "tag v*" -} - -action "Is tag from master" { - uses = "babel/actions/commit-matches-branch@master" - needs = [ - "Is version tag", - ] - args = "master" -} - -action "Trigger GitHub release" { - uses = "babel/actions/trigger-github-release@master" - secrets = ["GITHUB_TOKEN"] - env = { - COMMIT_AUTHOR_NAME = "Babel Bot" - COMMIT_AUTHOR_EMAIL = "babel-bot@users.noreply.github.com" - } - needs = [ - "Is version tag", - "Is tag from master", - ] -} - -workflow "Welcome" { - resolves = [ - "Create Welcome Comment" - ] - on = "issues" -} - -action "Is action 'opened'" { - uses = "actions/bin/filter@master" - args = "action opened" -} - -action "Create Welcome Comment" { - uses = "babel/actions/create-welcome-comment@master" - secrets = ["GITHUB_TOKEN", "BOT_TOKEN"] - needs = ["Is action 'opened'"] -} - -workflow "Needs Info" { - resolves = [ - "Create Needs Info Comment" - ] - on = "issues" -} - -action "Is action 'labeled'" { - uses = "actions/bin/filter@master" - args = "action labeled" -} - -action "Has label 'Needs Info'" { - uses = "actions/bin/filter@master" - needs = [ - "Is action 'labeled'" - ] - args = "label 'Needs Info'" -} - -action "Create Needs Info Comment" { - uses = "babel/actions/create-needs-info-comment@master" - needs = [ - "Has label 'Needs Info'", - ] - secrets = ["BOT_TOKEN", "GITHUB_TOKEN"] -} diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml new file mode 100644 index 000000000000..03738da23034 --- /dev/null +++ b/.github/workflows/coverage.yml @@ -0,0 +1,29 @@ +name: Report Coverage + +on: [push, pull_request] + +jobs: + build: + runs-on: ubuntu-latest + strategy: + matrix: + node-version: [13.x] + steps: + - name: Checkout code + uses: actions/checkout@v1 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v1 + with: + node-version: ${{ matrix.node-version }} + - name: Environment log + id: env + run: | + yarn --version + - name: Generate coverage report + run: | + yarn --version + make -j test-ci-coverage + - name: Upload coverage report + uses: codecov/codecov-action@v1 + with: + token: ${{ secrets.CODECOV_TOKEN }} diff --git a/.github/workflows/issue-triage.yml b/.github/workflows/issue-triage.yml new file mode 100644 index 000000000000..574fd4f550d4 --- /dev/null +++ b/.github/workflows/issue-triage.yml @@ -0,0 +1,81 @@ +name: Issue Triage + +on: + issues: + types: [opened, labeled] + +jobs: + welcome: + name: Welcome comment + runs-on: ubuntu-latest + steps: + - name: Check if Babel member + id: is_babel_member + if: github.event.action == 'opened' + uses: babel/actions/is-org-member@v2 + with: + org: babel + username: ${{ github.event.issue.user.login }} + token: ${{ secrets.GITHUB_TOKEN }} + - name: Create Welcome Comment + uses: babel/actions/create-comment@v2 + if: | + github.event.action == 'opened' && + steps.is_babel_member.outputs.result == 0 + with: + token: ${{ secrets.BOT_TOKEN }} + issue: ${{ github.event.issue.number }} + comment: > + Hey @${{ github.event.issue.user.login }}! + We really appreciate you taking the time to report an issue. The + collaborators on this project attempt to help as many people as + possible, but we're a limited number of volunteers, so it's + possible this won't be addressed swiftly. + + + If you need any help, or just have general Babel or JavaScript questions, we have a + vibrant [Slack community](https://babeljs.slack.com) that typically always has someone + willing to help. You can sign-up [here](https://slack.babeljs.io/) for an invite." + + needs_info: + name: Needs Info + runs-on: ubuntu-latest + steps: + - name: Create Needs Info Comment + uses: babel/actions/create-comment@v2 + if: | + github.event.action == 'labeled' && + github.event.label.name == 'Needs Info' + with: + token: ${{ secrets.BOT_TOKEN }} + issue: ${{ github.event.issue.number }} + comment: > + Hi @${{ github.event.issue.user.login }}! + This issue is missing some important information we'll need + to be able to reproduce this issue. + + + Please understand that we receive a high volume of issues, + and there are only a limited number of volunteers that help + maintain this project. The easier it is for us to decipher an + issue with the info provided, the more likely it is that we'll + be able to help. + + + Please make sure you have the following information documented in + this ticket: + + 1. Your Babel configuration (typically from `.babelrc` or `babel.config.js`) + + 2. The current (incorrect) behavior you're seeing + + 3. The behavior you expect + + 4. A [short, self-contained example](http://sscce.org/) + + + Please provide either a link to the problem via the + [`repl`](https://babeljs.io/repl/), or if the `repl` is + insufficient, a new and minimal repository with instructions on + how to build/replicate the issue. + diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 000000000000..f56849952c55 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,53 @@ +name: Release + +on: + push: + tags: ["v*"] + +jobs: + github_release: + name: Trigger GitHub release + runs-on: ubuntu-latest + steps: + - name: Checkout the new tag + uses: actions/checkout@v1.0.0 + + - name: Get tag info + id: tags + uses: babel/actions/get-release-tags@v2 + + - name: Generate the changelog + id: changelog + uses: babel/actions/generate-lerna-changelog@v2 + with: + from: ${{ steps.tags.outputs.old }} + to: ${{ steps.tags.outputs.new }} + env: + GITHUB_AUTH: ${{ secrets.GITHUB_TOKEN }} + + - name: Create a draft GitHub release + uses: babel/actions/publish-github-release@v2 + with: + tag: ${{ steps.tags.outputs.new }} + changelog: ${{ steps.changelog.outputs.changelog }} + token: ${{ secrets.BOT_TOKEN }} + + - name: Check if releasing from master + id: is_master + uses: babel/actions/ref-matches-branch@v2 + with: + name: master + + - name: Update CHANGELOG.md + if: steps.is_master.outputs.result == 1 + uses: babel/actions/update-changelog@v2 + with: + changelog: ${{ steps.changelog.outputs.changelog }} + + - name: Commit CHANGELOG.md + if: steps.is_master.outputs.result == 1 + run: | + git add CHANGELOG.md + git -c user.name="Babel Bot" -c user.email="babel-bot@users.noreply.github.com" \ + commit -m "Add ${{ steps.tags.outputs.new }} to CHANGELOG.md [skip ci]" --no-verify --quiet + git push "https://babel-bot:${{ secrets.BOT_TOKEN }}@github.com/${GITHUB_REPOSITORY}.git" master diff --git a/.gitignore b/.gitignore index 2f99b017304b..4f32ee12788d 100644 --- a/.gitignore +++ b/.gitignore @@ -20,6 +20,8 @@ dist package-lock.json !/.github/actions/*/package-lock.json +/packages/babel-compat-data/build + /packages/babel-runtime/helpers/*.js !/packages/babel-runtime/helpers/toArray.js !/packages/babel-runtime/helpers/iterableToArray.js @@ -52,11 +54,18 @@ package-lock.json .nyc_output /babel.sublime-workspace packages/babel-standalone/babel.js +packages/babel-standalone/babel.js.map packages/babel-standalone/babel.min.js packages/babel-preset-env-standalone/babel-preset-env.js +packages/babel-preset-env-standalone/babel-preset-env.js.map packages/babel-preset-env-standalone/babel-preset-env.min.js /codemods/*/lib /codemods/*/node_modules /packages/babel-parser/build .idea/ /.changelog + +/eslint/*/lib +/eslint/*/node_modules +/eslint/*/LICENSE +!/packages/babel-eslint-plugin/LICENSE diff --git a/.prettierignore b/.prettierignore index e86c7aa505d3..19e8316f03eb 100644 --- a/.prettierignore +++ b/.prettierignore @@ -1,5 +1,7 @@ package.json packages/babel-preset-env/data +packages/babel-compat-data/data +packages/babel-compat-data/scripts/data/overlapping-plugins.js packages/*/test/fixtures/**/input.* packages/*/test/fixtures/**/exec.* packages/*/test/fixtures/**/output.* diff --git a/.prettierrc b/.prettierrc index 5c53b22f8ab7..bfe4721c3432 100644 --- a/.prettierrc +++ b/.prettierrc @@ -13,10 +13,12 @@ "**/codemods/*/src/**/*.js", "**/codemods/*/test/**/*.js", "**/packages/*/src/**/*.js", - "**/packages/*/test/**/*.js" + "**/packages/*/test/**/*.js", + "**/eslint/*/src/**/*.js", + "**/eslint/*/test/**/*.js" ], - "parser": "babylon", "options": { + "parser": "babel", "trailingComma": "all" } }] diff --git a/.travis.yml b/.travis.yml index 3957c277c102..cfa5354434b1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,43 +3,52 @@ git: language: node_js cache: yarn: true -node_js: - # We test the latest version on circleci - - '11' - - '10' - - '8' - - '6' + +os: linux env: global: - PATH=$HOME/.yarn/bin:$PATH - JOB=test -before_install: - - curl -o- -L https://yarnpkg.com/install.sh | bash - -install: - # the `make test-ci` script runs this command already - - if [ "$JOB" != "test" ] && [ "$JOB" != "lint" ]; then yarn install; fi - - if [ "$JOB" = "lint" ]; then make bootstrap; fi - +install: skip before_script: - - if [ "$JOB" = "babel-parser-flow-tests" ]; then make bootstrap-flow; fi - - if [ "$JOB" = "babel-parser-test262-tests" ]; then make bootstrap-test262; fi + - curl -o- -L https://yarnpkg.com/install.sh | bash + - if [ "$TRAVIS_OS_NAME" = "windows" ]; then choco install make; fi script: - - if [ "$JOB" = "test" ]; then make test-ci; fi - - if [ "$JOB" = "lint" ]; then make lint && make flow; fi - - if [ "$JOB" = "babel-parser-flow-tests" ]; then make test-flow-ci; fi - - if [ "$JOB" = "babel-parser-test262-tests" ]; then make test-test262-ci; fi + - if [ "$JOB" = "test" ]; then make -j test-ci; fi + - if [ "$JOB" = "lint" ]; then make -j code-quality-ci; fi + - if [ "$JOB" = "babel-parser-flow-tests" ]; then make -j test-flow-ci; fi + - if [ "$JOB" = "babel-parser-typescript-tests" ]; then make -j test-typescript-ci; fi + - if [ "$JOB" = "babel-parser-test262-tests" ]; then make -j test-test262-ci; fi matrix: fast_finish: true include: - node_js: "node" env: JOB=lint + # We test the latest version on circleci + - node_js: "12" + # Move `windows` build to be the third since it is slow + - os: windows + node_js: "node" + env: + - JOB=test + # https://travis-ci.community/t/build-doesnt-finish-after-completing-tests/288/9 + - YARN_GPG=no + cache: + yarn: true + directories: + - $HOME/AppData/Local/Temp/chocolatey + # Continue node_js matrix + - node_js: "6" + - node_js: "10" + - node_js: "8" - node_js: "node" env: JOB=babel-parser-flow-tests + - node_js: "node" + env: JOB=babel-parser-typescript-tests - node_js: "node" env: JOB=babel-parser-test262-tests diff --git a/CHANGELOG.md b/CHANGELOG.md index 9ce2fc517e3d..f3a9b0d9f8c9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ > **Tags:** > - :boom: [Breaking Change] -> - :eyeglasses: [Spec Compliancy] +> - :eyeglasses: [Spec Compliance] > - :rocket: [New Feature] > - :bug: [Bug Fix] > - :memo: [Documentation] @@ -13,10 +13,577 @@ _Note: Gaps between patch versions are faulty, broken or test releases._ See [CHANGELOG - v4](/.github/CHANGELOG-v4.md), [CHANGELOG - v5](/.github/CHANGELOG-v5.md), and [CHANGELOG - v6](/.github/CHANGELOG-v6.md) for v4.x-v6.x changes. See [CHANGELOG - 6to5](/.github/CHANGELOG-6to5.md) for the pre-4.0.0 version changelog. -See [Babylon's CHANGELOG](packages/babylon/CHANGELOG.md) for the Babylon pre-7.0.0-beta.29 version changelog. +See [Babylon's CHANGELOG](packages/babel-parser/CHANGELOG.md) for the Babylon pre-7.0.0-beta.29 version changelog. +See [`babel-eslint`'s releases](https://github.com/babel/babel-eslint/releases) for the changelog before `@babel/eslint-parser` 7.8.0. +See [`eslint-plugin-babel`'s releases](https://github.com/babel/eslint-plugin-babel/releases) for the changelog before `@babel/eslint-plugin` 7.8.0. +## v7.8.3 (2020-01-13) + +#### :bug: Bug Fix +* `babel-types` + * [#11002](https://github.com/babel/babel/pull/11002) fix: generated builder parameter should respect builder keys ([@JLHwung](https://github.com/JLHwung)) + +#### :house: Internal +* `babel-preset-env-standalone`, `babel-standalone` + * [#10994](https://github.com/babel/babel/pull/10994) Ignore .map files in standalone packages ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo)) +* `babel-plugin-proposal-decorators`, `babel-plugin-proposal-dynamic-import`, `babel-plugin-proposal-logical-assignment-operators`, `babel-plugin-proposal-object-rest-spread`, `babel-plugin-syntax-async-generators`, `babel-plugin-syntax-bigint`, `babel-plugin-syntax-dynamic-import`, `babel-plugin-syntax-json-strings`, `babel-plugin-syntax-nullish-coalescing-operator`, `babel-plugin-syntax-object-rest-spread`, `babel-plugin-syntax-optional-catch-binding`, `babel-plugin-syntax-optional-chaining`, `babel-plugin-transform-flow-strip-types`, `babel-plugin-transform-modules-commonjs`, `babel-plugin-transform-modules-systemjs`, `babel-plugin-transform-react-constant-elements`, `babel-preset-env-standalone`, `babel-preset-env`, `babel-standalone` + * [#10820](https://github.com/babel/babel/pull/10820) Archive syntax plugins enabled by default ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo)) + +#### :leftwards_arrow_with_hook: Revert +* `babel-cli`, `babel-code-frame`, `babel-core`, `babel-generator`, `babel-helper-annotate-as-pure`, `babel-helper-bindify-decorators`, `babel-helper-builder-binary-assignment-operator-visitor`, `babel-helper-builder-react-jsx`, `babel-helper-call-delegate`, `babel-helper-compilation-targets`, `babel-helper-create-class-features-plugin`, `babel-helper-create-regexp-features-plugin`, `babel-helper-define-map`, `babel-helper-explode-assignable-expression`, `babel-helper-explode-class`, `babel-helper-fixtures`, `babel-helper-function-name`, `babel-helper-get-function-arity`, `babel-helper-hoist-variables`, `babel-helper-member-expression-to-functions`, `babel-helper-module-imports`, `babel-helper-module-transforms`, `babel-helper-optimise-call-expression`, `babel-helper-plugin-test-runner`, `babel-helper-plugin-utils`, `babel-helper-regex`, `babel-helper-remap-async-to-generator`, `babel-helper-replace-supers`, `babel-helper-simple-access`, `babel-helper-split-export-declaration`, `babel-helper-transform-fixture-test-runner`, `babel-helper-wrap-function`, `babel-helpers`, `babel-highlight`, `babel-node`, `babel-parser`, `babel-plugin-external-helpers`, `babel-plugin-proposal-async-generator-functions`, `babel-plugin-proposal-class-properties`, `babel-plugin-proposal-decorators`, `babel-plugin-proposal-do-expressions`, `babel-plugin-proposal-dynamic-import`, `babel-plugin-proposal-export-default-from`, `babel-plugin-proposal-export-namespace-from`, `babel-plugin-proposal-function-bind`, `babel-plugin-proposal-function-sent`, `babel-plugin-proposal-json-strings`, `babel-plugin-proposal-logical-assignment-operators`, `babel-plugin-proposal-nullish-coalescing-operator`, `babel-plugin-proposal-numeric-separator`, `babel-plugin-proposal-object-rest-spread`, `babel-plugin-proposal-optional-catch-binding`, `babel-plugin-proposal-optional-chaining`, `babel-plugin-proposal-partial-application`, `babel-plugin-proposal-pipeline-operator`, `babel-plugin-proposal-private-methods`, `babel-plugin-proposal-throw-expressions`, `babel-plugin-proposal-unicode-property-regex`, `babel-plugin-syntax-class-properties`, `babel-plugin-syntax-decorators`, `babel-plugin-syntax-do-expressions`, `babel-plugin-syntax-export-default-from`, `babel-plugin-syntax-export-namespace-from`, `babel-plugin-syntax-flow`, `babel-plugin-syntax-function-bind`, `babel-plugin-syntax-function-sent`, `babel-plugin-syntax-import-meta`, `babel-plugin-syntax-jsx`, `babel-plugin-syntax-logical-assignment-operators`, `babel-plugin-syntax-numeric-separator`, `babel-plugin-syntax-partial-application`, `babel-plugin-syntax-pipeline-operator`, `babel-plugin-syntax-throw-expressions`, `babel-plugin-syntax-top-level-await`, `babel-plugin-syntax-typescript`, `babel-plugin-transform-arrow-functions`, `babel-plugin-transform-async-to-generator`, `babel-plugin-transform-block-scoped-functions`, `babel-plugin-transform-block-scoping`, `babel-plugin-transform-classes`, `babel-plugin-transform-computed-properties`, `babel-plugin-transform-destructuring`, `babel-plugin-transform-dotall-regex`, `babel-plugin-transform-duplicate-keys`, `babel-plugin-transform-exponentiation-operator`, `babel-plugin-transform-flow-comments`, `babel-plugin-transform-flow-strip-types`, `babel-plugin-transform-for-of`, `babel-plugin-transform-function-name`, `babel-plugin-transform-instanceof`, `babel-plugin-transform-jscript`, `babel-plugin-transform-literals`, `babel-plugin-transform-member-expression-literals`, `babel-plugin-transform-modules-amd`, `babel-plugin-transform-modules-commonjs`, `babel-plugin-transform-modules-systemjs`, `babel-plugin-transform-modules-umd`, `babel-plugin-transform-named-capturing-groups-regex`, `babel-plugin-transform-new-target`, `babel-plugin-transform-object-assign`, `babel-plugin-transform-object-set-prototype-of-to-assign`, `babel-plugin-transform-object-super`, `babel-plugin-transform-parameters`, `babel-plugin-transform-property-literals`, `babel-plugin-transform-property-mutators`, `babel-plugin-transform-proto-to-assign`, `babel-plugin-transform-react-constant-elements`, `babel-plugin-transform-react-display-name`, `babel-plugin-transform-react-inline-elements`, `babel-plugin-transform-react-jsx-compat`, `babel-plugin-transform-react-jsx-self`, `babel-plugin-transform-react-jsx-source`, `babel-plugin-transform-react-jsx`, `babel-plugin-transform-regenerator`, `babel-plugin-transform-reserved-words`, `babel-plugin-transform-runtime`, `babel-plugin-transform-shorthand-properties`, `babel-plugin-transform-spread`, `babel-plugin-transform-sticky-regex`, `babel-plugin-transform-strict-mode`, `babel-plugin-transform-template-literals`, `babel-plugin-transform-typeof-symbol`, `babel-plugin-transform-typescript`, `babel-plugin-transform-unicode-regex`, `babel-polyfill`, `babel-preset-env`, `babel-preset-flow`, `babel-preset-react`, `babel-preset-stage-0`, `babel-preset-stage-1`, `babel-preset-stage-2`, `babel-preset-stage-3`, `babel-preset-typescript`, `babel-register`, `babel-runtime-corejs2`, `babel-runtime-corejs3`, `babel-runtime`, `babel-template`, `babel-traverse`, `babel-types` + * [#11003](https://github.com/babel/babel/pull/11003) Revert "chore: specify package type (#10849)" ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo)) +## v7.8.2 (2020-01-12) + +#### :bug: Bug Fix +* `babel-preset-env` + * [#10992](https://github.com/babel/babel/pull/10992) fix: `isPluginRequired` returns the opposite result in v7.8.0 ([@sodatea](https://github.com/sodatea)) +## v7.8.1 (2020-01-12) + +#### :bug: Bug Fix +* `babel-compat-data`, `babel-helper-compilation-targets` + * [#10991](https://github.com/babel/babel/pull/10991) Downgrade semver for compatibility with Node 6 ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo)) +## v7.8.0 (2020-01-12) + +#### :eyeglasses: Spec Compliance +* `babel-parser` + * [#10980](https://github.com/babel/babel/pull/10980) Disallow private name in object elements and TS type elements ([@JLHwung](https://github.com/JLHwung)) + * [#10955](https://github.com/babel/babel/pull/10955) LiteralPropertyName should allow BigIntLiteral ([@JLHwung](https://github.com/JLHwung)) + * [#10953](https://github.com/babel/babel/pull/10953) fix: check await when parsing AsyncArrowBindingIdentifier ([@JLHwung](https://github.com/JLHwung)) + * [#10947](https://github.com/babel/babel/pull/10947) Fix: TopLevelAwait should respect await identifiers defined in sub scope. ([@JLHwung](https://github.com/JLHwung)) + * [#10946](https://github.com/babel/babel/pull/10946) fix: Class Field Initializer should not allow await expression as immediate child ([@JLHwung](https://github.com/JLHwung)) +* `babel-plugin-proposal-numeric-separator` + * [#10938](https://github.com/babel/babel/pull/10938) StringNumericLiteral does not include NumericLiteralSeparator ([@JLHwung](https://github.com/JLHwung)) +* `babel-generator`, `babel-parser`, `babel-plugin-proposal-private-methods` + * [#10456](https://github.com/babel/babel/pull/10456) [parser] Disallow duplicate and undeclared private names ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo)) + +#### :boom: Breaking Change +* `babel-types` + * [#10917](https://github.com/babel/babel/pull/10917) (opt-in) Improve @babel/types with env.BABEL_TYPES_8_BREAKING ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo)) + +#### :rocket: New Feature +* `babel-standalone` + * [#10821](https://github.com/babel/babel/pull/10821) Merge env-standalone to babel-standalone ([@JLHwung](https://github.com/JLHwung)) +* `babel-core` + * [#10783](https://github.com/babel/babel/pull/10783) Add babelrc.json support ([@yordis](https://github.com/yordis)) + * [#10903](https://github.com/babel/babel/pull/10903) Add support for babel.config.mjs and .babelrc.mjs ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo)) +* `babel-compat-data`, `babel-preset-env-standalone`, `babel-preset-env` + * [#10811](https://github.com/babel/babel/pull/10811) Add optional-chaining and nullish-coalescing to preset-env ([@Druotic](https://github.com/Druotic)) +* `babel-helper-module-transforms`, `babel-plugin-transform-modules-systemjs` + * [#10780](https://github.com/babel/babel/pull/10780) add `allowTopLevelThis` option to `transform-modules-systemjs` ([@JLHwung](https://github.com/JLHwung)) +* `babel-parser` + * [#10817](https://github.com/babel/babel/pull/10817) enable optional chaining by default in @babel/parser ([@jackisherwood](https://github.com/jackisherwood)) +* `babel-cli` + * [#10887](https://github.com/babel/babel/pull/10887) --copy-ignored flag added to CLI ([@rajasekarm](https://github.com/rajasekarm)) + * [#9144](https://github.com/babel/babel/pull/9144) Add --out-file-extension option to babel-cli ([@eps1lon](https://github.com/eps1lon)) +* `babel-core`, `babel-generator`, `babel-parser` + * [#10819](https://github.com/babel/babel/pull/10819) Enable nullish coalescing by default in @babel/parser ([@layershifter](https://github.com/layershifter)) +* `babel-core`, `babel-parser` + * [#10843](https://github.com/babel/babel/pull/10843) [parser] enable dynamic import by default ([@AbdulAli19](https://github.com/AbdulAli19)) + +#### :bug: Bug Fix +* `babel-node` + * [#10763](https://github.com/babel/babel/pull/10763) Filename detection should respect short flags ([@JLHwung](https://github.com/JLHwung)) +* `babel-plugin-proposal-numeric-separator` + * [#10938](https://github.com/babel/babel/pull/10938) StringNumericLiteral does not include NumericLiteralSeparator ([@JLHwung](https://github.com/JLHwung)) +* `babel-preset-env` + * [#10790](https://github.com/babel/babel/pull/10790) Use chrome data when android is absent ([@JLHwung](https://github.com/JLHwung)) + * [#10930](https://github.com/babel/babel/pull/10930) fix: Promise.any requires global.AggregateError ([@JLHwung](https://github.com/JLHwung)) +* `babel-parser` + * [#10944](https://github.com/babel/babel/pull/10944) When reading a new string, U+2028/2029 should correctly set the new column ([@JLHwung](https://github.com/JLHwung)) + * [#10937](https://github.com/babel/babel/pull/10937) Refactor parseSubscript ([@JLHwung](https://github.com/JLHwung)) + * [#10901](https://github.com/babel/babel/pull/10901) fix: lost leading comment after named import ([@elevatebart](https://github.com/elevatebart)) +* `babel-traverse` + * [#10949](https://github.com/babel/babel/pull/10949) Override toString in case this function is printed ([@jayenashar](https://github.com/jayenashar)) +* `babel-helper-module-transforms`, `babel-plugin-transform-modules-commonjs` + * [#10934](https://github.com/babel/babel/pull/10934) helper-module-transforms: dereference imported template tag ([@ajafff](https://github.com/ajafff)) +* `babel-traverse`, `babel-types` + * [#10912](https://github.com/babel/babel/pull/10912) Fix parameter expression get binding ([@JLHwung](https://github.com/JLHwung)) +* `babel-core` + * [#10914](https://github.com/babel/babel/pull/10914) @babel-core: parse should parse only ([@kaicataldo](https://github.com/kaicataldo)) +* `babel-helpers` + * [#10902](https://github.com/babel/babel/pull/10902) fix: Object.getOwnPropertySymbols called on non-object ([@bassaer](https://github.com/bassaer)) + +#### :nail_care: Polish +* `babel-node` + * [#9695](https://github.com/babel/babel/pull/9695) Use `babel > ` as prompt in babel-node ([@ZYSzys](https://github.com/ZYSzys)) +* `babel-parser` + * [#10906](https://github.com/babel/babel/pull/10906) refactor: remove inClassProperty parser state ([@JLHwung](https://github.com/JLHwung)) + +#### :memo: Documentation +* `babel-preset-env` + * [#10982](https://github.com/babel/babel/pull/10982) CONTRIBUTING: Update link to plugin-features.js [skip ci] ([@andersk](https://github.com/andersk)) +* Other + * [#10973](https://github.com/babel/babel/pull/10973) Added instructions to fork the repo in order to setup. ([@sidntrivedi012](https://github.com/sidntrivedi012)) + +#### :house: Internal +* `babel-preset-env` + * [#10983](https://github.com/babel/babel/pull/10983) chore: update corejs fixtures ([@JLHwung](https://github.com/JLHwung)) + * [#10974](https://github.com/babel/babel/pull/10974) chore: update caniuse-usage Chrome 49 related fixtures ([@JLHwung](https://github.com/JLHwung)) + * [#10924](https://github.com/babel/babel/pull/10924) Replace custom "findSuggestion" function with "levenary" ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo)) +* `babel-core` + * [#10507](https://github.com/babel/babel/pull/10507) Prepare @babel/core for asynchronicity ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo)) +* Other + * [#10979](https://github.com/babel/babel/pull/10979) Reduce false negative cases of typescript parser tests ([@JLHwung](https://github.com/JLHwung)) + * [#10976](https://github.com/babel/babel/pull/10976) Update Test262, Flow and TS parser tests ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo)) + * [#10964](https://github.com/babel/babel/pull/10964) Bump coverage target from 80% to 90% ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo)) + * [#10958](https://github.com/babel/babel/pull/10958) Fix recent e2e-vuejs-cli error ([@JLHwung](https://github.com/JLHwung)) + * [#10919](https://github.com/babel/babel/pull/10919) Add integration test: e2e-vue-cli ([@JLHwung](https://github.com/JLHwung)) + * [#10943](https://github.com/babel/babel/pull/10943) chore: update test262 ([@JLHwung](https://github.com/JLHwung)) + * [#10918](https://github.com/babel/babel/pull/10918) chore: refine e2e test scripts ([@JLHwung](https://github.com/JLHwung)) + * [#10905](https://github.com/babel/babel/pull/10905) chore: separate build-standalone with coverage ([@JLHwung](https://github.com/JLHwung)) + * [#10898](https://github.com/babel/babel/pull/10898) Move coverage to GitHub actions ([@JLHwung](https://github.com/JLHwung)) +* `babel-compat-data`, `babel-helper-compilation-targets`, `babel-preset-env` + * [#10899](https://github.com/babel/babel/pull/10899) Extract targets parser and compat data from preset-env ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo)) +* `babel-parser` + * [#10950](https://github.com/babel/babel/pull/10950) test: add invalid-lone-import test ([@JLHwung](https://github.com/JLHwung)) + * [#10936](https://github.com/babel/babel/pull/10936) refactor: remove unecessary checkYieldAwaitInDefaultParams ([@JLHwung](https://github.com/JLHwung)) + * [#10935](https://github.com/babel/babel/pull/10935) refactor: remove unused invalidTemplateEscapePosition tokenizer state ([@JLHwung](https://github.com/JLHwung)) + * [#10939](https://github.com/babel/babel/pull/10939) TSTypeCastExpression should not be inside call parameters ([@JLHwung](https://github.com/JLHwung)) + * [#10942](https://github.com/babel/babel/pull/10942) Remove unused parser methods ([@JLHwung](https://github.com/JLHwung)) +* _Every package_ + * [#10849](https://github.com/babel/babel/pull/10849) chore: specify package type [skip-ci] ([@JLHwung](https://github.com/JLHwung)) + +#### :leftwards_arrow_with_hook: Revert +* `babel-cli` + * [#10923](https://github.com/babel/babel/pull/10923) fix: minified should not accept optional argument ([@JLHwung](https://github.com/JLHwung)) +## v7.7.7 (2019-12-19) + +#### :eyeglasses: Spec Compliance +* `babel-parser` + * [#10576](https://github.com/babel/babel/pull/10576) [parser] validation for parentheses in the left-hand side of assignment expressions ([@boweihan](https://github.com/boweihan)) + +#### :bug: Bug Fix +* `babel-plugin-proposal-object-rest-spread` + * [#10863](https://github.com/babel/babel/pull/10863) fix: add computed property support for object Ref ([@JLHwung](https://github.com/JLHwung)) +* `babel-core` + * [#10890](https://github.com/babel/babel/pull/10890) fix: skip merging large input sourcemaps ([@JLHwung](https://github.com/JLHwung)) + * [#10885](https://github.com/babel/babel/pull/10885) fix: avoid string copy when processing input source-map ([@JLHwung](https://github.com/JLHwung)) +* `babel-node` + * [#10871](https://github.com/babel/babel/pull/10871) Allow -r from node_modules with @babel/node ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo)) +* `babel-plugin-transform-parameters` + * [#10053](https://github.com/babel/babel/pull/10053) Check shadow variable to identifier in default parameters ([@JLHwung](https://github.com/JLHwung)) +* `babel-parser` + * [#10828](https://github.com/babel/babel/pull/10828) @babel/parser: fix ImportExpression node to match ESTree spec ([@kaicataldo](https://github.com/kaicataldo)) + * [#10827](https://github.com/babel/babel/pull/10827) @babel/parser: fix BigIntLiteral node to match ESTree spec ([@kaicataldo](https://github.com/kaicataldo)) + +#### :nail_care: Polish +* `babel-plugin-transform-react-jsx` + * [#10868](https://github.com/babel/babel/pull/10868) Fix pragmaFrag spelling in error message ([@azizhk](https://github.com/azizhk)) + +#### :house: Internal +* `babel-generator`, `babel-plugin-proposal-pipeline-operator`, `babel-plugin-proposal-unicode-property-regex`, `babel-plugin-syntax-pipeline-operator`, `babel-plugin-transform-dotall-regex`, `babel-preset-env-standalone`, `babel-preset-typescript`, `babel-standalone` + * [#10882](https://github.com/babel/babel/pull/10882) Ignore some files in npm package ([@JLHwung](https://github.com/JLHwung)) +* Other + * [#10874](https://github.com/babel/babel/pull/10874) chore: cache chocolatey installation temporary files ([@JLHwung](https://github.com/JLHwung)) + * [#10880](https://github.com/babel/babel/pull/10880) chore: add PR Intent checkbox [ci-skip] ([@JLHwung](https://github.com/JLHwung)) + * [#10870](https://github.com/babel/babel/pull/10870) chore: update babel-eslint to 11.0.0-beta.2 ([@JLHwung](https://github.com/JLHwung)) + * [#10848](https://github.com/babel/babel/pull/10848) Tune eslint packages test configuration ([@JLHwung](https://github.com/JLHwung)) +* `babel-preset-env` + * [#10873](https://github.com/babel/babel/pull/10873) chore: download compat-table when build-data is run ([@JLHwung](https://github.com/JLHwung)) + * [#10846](https://github.com/babel/babel/pull/10846) Update corejs fixtures ([@JLHwung](https://github.com/JLHwung)) + * [#10837](https://github.com/babel/babel/pull/10837) refactor: rewrite available-plugins to esm ([@JLHwung](https://github.com/JLHwung)) +* `babel-parser` + * [#10858](https://github.com/babel/babel/pull/10858) Properly serialize non-json values in parser tests ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo)) +* `babel-cli`, `babel-node`, `babel-register` + * [#10847](https://github.com/babel/babel/pull/10847) Add missing dev dependencies ([@JLHwung](https://github.com/JLHwung)) + +#### :leftwards_arrow_with_hook: Revert +* `babel-plugin-transform-classes`, `babel-plugin-transform-regenerator`, `babel-preset-env` + * [#10839](https://github.com/babel/babel/pull/10839) Use `async-to-generator` even when `regenerator` is enabled ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo)) +## v7.7.6 (2019-12-08) + +#### :house: Internal +* [#10836](https://github.com/babel/babel/pull/10836) chore: add PR Revert labels to changelog [ci-skip] ([@JLHwung](https://github.com/JLHwung)) + +#### :leftwards_arrow_with_hook: Revert +* `babel-plugin-transform-modules-commonjs`, `babel-plugin-transform-regenerator`, `babel-plugin-transform-runtime`, `babel-preset-env`, `babel-runtime-corejs2` + * [#10835](https://github.com/babel/babel/pull/10835) Revert "Add ".js" extension to injected polyfill imports" ([@JLHwung](https://github.com/JLHwung)) +## v7.7.5 (2019-12-06) + +#### :bug: Bug Fix +* `babel-plugin-transform-modules-commonjs`, `babel-plugin-transform-regenerator`, `babel-plugin-transform-runtime`, `babel-preset-env`, `babel-runtime-corejs2` + * [#10549](https://github.com/babel/babel/pull/10549) Add ".js" extension to injected polyfill imports ([@shimataro](https://github.com/shimataro)) +* `babel-cli` + * [#10283](https://github.com/babel/babel/pull/10283) `babel --watch` should have equivalent file selection logic with `babel` ([@JLHwung](https://github.com/JLHwung)) +* `babel-parser` + * [#10801](https://github.com/babel/babel/pull/10801) Use scope flags to check arguments ([@JLHwung](https://github.com/JLHwung)) + * [#10800](https://github.com/babel/babel/pull/10800) Allow tuple rest trailing comma ([@yeonjuan](https://github.com/yeonjuan)) + * [#10475](https://github.com/babel/babel/pull/10475) Correctly disambiguate / after async fuctions ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo)) +* `babel-parser`, `babel-plugin-proposal-optional-chaining`, `babel-plugin-transform-modules-amd` + * [#10806](https://github.com/babel/babel/pull/10806) fix(optional chaining): Optional delete returns true with nullish base ([@mpaarating](https://github.com/mpaarating)) +* `babel-helper-module-transforms`, `babel-plugin-transform-modules-amd` + * [#10764](https://github.com/babel/babel/pull/10764) fix: rewriteBindingInitVisitor should skip on scopable node ([@JLHwung](https://github.com/JLHwung)) + +#### :nail_care: Polish +* `babel-plugin-transform-runtime` + * [#10788](https://github.com/babel/babel/pull/10788) Do not transpile typeof helper with itself in babel/runtime ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo)) +* `babel-core` + * [#10778](https://github.com/babel/babel/pull/10778) refactor: Improve error message in @babel/core ([@jaroslav-kubicek](https://github.com/jaroslav-kubicek)) + +#### :house: Internal +* `babel-preset-env-standalone` + * [#10779](https://github.com/babel/babel/pull/10779) Bundle standalone using rollup ([@JLHwung](https://github.com/JLHwung)) +* Other + * [#10781](https://github.com/babel/babel/pull/10781) Tune makefile scripts ([@JLHwung](https://github.com/JLHwung)) +* `babel-helper-transform-fixture-test-runner` + * [#10566](https://github.com/babel/babel/pull/10566) Incorrect trace position in fixture runner ([@JLHwung](https://github.com/JLHwung)) + +## v7.7.4 (2019-11-23) + +#### :bug: Bug Fix +* `babel-runtime-corejs2`, `babel-runtime-corejs3`, `babel-runtime` + * [#10748](https://github.com/babel/babel/pull/10748) Add support for native esm to @babel/runtime. ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo)) +* `babel-preset-env` + * [#10742](https://github.com/babel/babel/pull/10742) Update preset-env mappings. ([@existentialism](https://github.com/existentialism)) +* `babel-parser` + * [#10737](https://github.com/babel/babel/pull/10737) Flow enums: fix enum body location. ([@gkz](https://github.com/gkz)) + * [#10657](https://github.com/babel/babel/pull/10657) Fix some incorrect typeof parsing in flow. ([@existentialism](https://github.com/existentialism)) + * [#10582](https://github.com/babel/babel/pull/10582) [parser] Allow optional async methods. ([@gonzarodriguezt](https://github.com/gonzarodriguezt)) + * [#10710](https://github.com/babel/babel/pull/10710) register import equals specifier. ([@JLHwung](https://github.com/JLHwung)) + * [#10592](https://github.com/babel/babel/pull/10592) Allow TypeScript type assertions in array destructuring. ([@SakibulMowla](https://github.com/SakibulMowla)) +* `babel-preset-env-standalone` + * [#10732](https://github.com/babel/babel/pull/10732) fix: add missing available plugins to babel-preset-env-standalone. ([@JLHwung](https://github.com/JLHwung)) +* `babel-plugin-transform-function-name`, `babel-plugin-transform-modules-umd`, `babel-preset-env` + * [#10701](https://github.com/babel/babel/pull/10701) Circumvent typeof transform for umd build template. ([@JLHwung](https://github.com/JLHwung)) +* `babel-cli` + * [#10698](https://github.com/babel/babel/pull/10698) Babel should not silently remove unknown options after commander arguments. ([@JLHwung](https://github.com/JLHwung)) +* `babel-plugin-proposal-optional-chaining` + * [#10694](https://github.com/babel/babel/pull/10694) Fix optional method chaining in derived classes. ([@Shriram-Balaji](https://github.com/Shriram-Balaji)) +* `babel-parser`, `babel-types` + * [#10677](https://github.com/babel/babel/pull/10677) Add `asserts this [is type]` parsing support. ([@JLHwung](https://github.com/JLHwung)) +* `babel-traverse` + * [#10598](https://github.com/babel/babel/pull/10598) Fix parentheses on replaceWithMultiple for JSX. ([@khoumani](https://github.com/khoumani)) +* `babel-helpers`, `babel-plugin-proposal-object-rest-spread`, `babel-preset-env` + * [#10683](https://github.com/babel/babel/pull/10683) Fix: Don't call Object.keys on non-objects (babel#10482). ([@chrishinrichs](https://github.com/chrishinrichs)) + +#### :nail_care: Polish +* `babel-plugin-proposal-nullish-coalescing-operator` + * [#10720](https://github.com/babel/babel/pull/10720) polish: skip creating extra reference for safely re-used node. ([@JLHwung](https://github.com/JLHwung)) + +#### :house: Internal +* Other + * [#10731](https://github.com/babel/babel/pull/10731) Removed duplicate key in package.json. ([@rajasekarm](https://github.com/rajasekarm)) + * [#10718](https://github.com/babel/babel/pull/10718) chore: use loose mode of transform. ([@JLHwung](https://github.com/JLHwung)) + * [#10579](https://github.com/babel/babel/pull/10579) Implement PR workflow for running test262 on babel PRs. ([@jbhoosreddy](https://github.com/jbhoosreddy)) + * [#10648](https://github.com/babel/babel/pull/10648) bump @babel/* dev dependencies. ([@JLHwung](https://github.com/JLHwung)) + * [#10569](https://github.com/babel/babel/pull/10569) E2E test Babel with itself before publishing. ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo)) +* `babel-core` + * [#10668](https://github.com/babel/babel/pull/10668) Reduce standalone build size. ([@JLHwung](https://github.com/JLHwung)) +* `babel-plugin-transform-literals`, `babel-preset-env-standalone` + * [#10725](https://github.com/babel/babel/pull/10725) fix typo [ci-skip]. ([@JLHwung](https://github.com/JLHwung)) +* `babel-cli` + * [#10692](https://github.com/babel/babel/pull/10692) Add missing flow type to babel-cli for consistency. ([@ZYSzys](https://github.com/ZYSzys)) + +## v7.7.3 (2019-11-08) + +#### :bug: Bug Fix +* `babel-parser` + * [#10682](https://github.com/babel/babel/pull/10682) Don't recover from "adjacent jsx elements" parser error ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo)) +## v7.7.2 (2019-11-07) + +#### :bug: Bug Fix +* `babel-parser` + * [#10669](https://github.com/babel/babel/pull/10669) Parse arrows with params annotations in conditional expressions ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo)) +* `babel-plugin-transform-typescript` + * [#10658](https://github.com/babel/babel/pull/10658) fix: remove accessibility of constructor ([@JLHwung](https://github.com/JLHwung)) +* `babel-traverse` + * [#10656](https://github.com/babel/babel/pull/10656) fix: add inList setter for compatibility with babel-minify ([@JLHwung](https://github.com/JLHwung)) +## v7.7.1 (2019-11-05) + +#### :bug: Bug Fix +* `babel-types` + * [#10650](https://github.com/babel/babel/pull/10650) Revert "throw a TypeError if identifier validation fails (#10621)" ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo)) +* `babel-preset-env` + * [#10649](https://github.com/babel/babel/pull/10649) Fix(babel-preset-env): check api.caller is a function to avoid to thr… ([@love2me](https://github.com/love2me)) + +## v7.7.0 (2019-11-05) + +#### :eyeglasses: Spec Compliance +* `babel-types` + * [#10621](https://github.com/babel/babel/pull/10621) throw a TypeError if identifier validation fails. ([@dentrado](https://github.com/dentrado)) +* `babel-parser` + * [#10559](https://github.com/babel/babel/pull/10559) fix: Exclude catch clause from let identifier error. ([@gonzarodriguezt](https://github.com/gonzarodriguezt)) + * [#10567](https://github.com/babel/babel/pull/10567) [parser] Exception to 8 and 9 in tagged template. ([@pnowak](https://github.com/pnowak)) + * [#10532](https://github.com/babel/babel/pull/10532) Allow duplicate __proto__ keys in patterns, simple case (#6705). ([@alejo90](https://github.com/alejo90)) + +#### :rocket: New Feature +* `babel-generator`, `babel-helper-create-class-features-plugin`, `babel-parser`, `babel-plugin-transform-typescript`, `babel-preset-typescript`, `babel-types` + * [#10545](https://github.com/babel/babel/pull/10545) Add support for TS declare modifier on fields. ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo)) +* `babel-core`, `babel-parser`, `babel-preset-typescript` + * [#10363](https://github.com/babel/babel/pull/10363) @babel/parser error recovery. ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo)) +* `babel-core` + * [#10599](https://github.com/babel/babel/pull/10599) Add support for .cjs config files. ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo)) + * [#10501](https://github.com/babel/babel/pull/10501) Add support for babel.config.json. ([@devongovett](https://github.com/devongovett)) + * [#10361](https://github.com/babel/babel/pull/10361) feat: if code frame error is on a single line, highlight the whole path. ([@SimenB](https://github.com/SimenB)) +* `babel-plugin-syntax-top-level-await`, `babel-preset-env` + * [#10573](https://github.com/babel/babel/pull/10573) Create @babel/plugin-syntax-top-level-await. ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo)) +* `babel-helper-builder-react-jsx`, `babel-plugin-transform-react-jsx`, `babel-preset-react` + * [#10572](https://github.com/babel/babel/pull/10572) [transform-react-jsx] Add useSpread option to transform JSX. ([@ivandevp](https://github.com/ivandevp)) +* `babel-generator`, `babel-parser`, `babel-plugin-proposal-decorators`, `babel-plugin-syntax-flow`, `babel-types` + * [#10344](https://github.com/babel/babel/pull/10344) Flow enums parsing. ([@gkz](https://github.com/gkz)) +* `babel-plugin-transform-function-name`, `babel-plugin-transform-modules-umd`, `babel-preset-env` + * [#10477](https://github.com/babel/babel/pull/10477) Changes UMD callsite to be more likely to pass in the intended object.. ([@MicahZoltu](https://github.com/MicahZoltu)) +* `babel-parser` + * [#10449](https://github.com/babel/babel/pull/10449) Create parser plugin "topLevelAwait". ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo)) + * [#10521](https://github.com/babel/babel/pull/10521) [parser] Enable "exportNamespaceFrom" by default. ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo)) + * [#10483](https://github.com/babel/babel/pull/10483) [parser] Add support for private fields in TypeScript. ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo)) +* `babel-generator`, `babel-parser`, `babel-types` + * [#10543](https://github.com/babel/babel/pull/10543) add assertions signature for TypeScript. ([@tanhauhau](https://github.com/tanhauhau)) +* `babel-cli`, `babel-register` + * [#8622](https://github.com/babel/babel/pull/8622) Make dir for babel --out-file. ([@TrySound](https://github.com/TrySound)) +* `babel-cli` + * [#10399](https://github.com/babel/babel/pull/10399) Closes [#8326](https://github.com/babel/babel/issues/8326), add back --quiet option.. ([@chris-peng-1244](https://github.com/chris-peng-1244)) + +#### :bug: Bug Fix +* `babel-helpers`, `babel-plugin-proposal-async-generator-functions`, `babel-plugin-proposal-function-sent`, `babel-preset-env` + * [#10422](https://github.com/babel/babel/pull/10422) Correctly delegate .return() in async generator. ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo)) +* `babel-helper-module-transforms`, `babel-plugin-transform-modules-commonjs` + * [#10628](https://github.com/babel/babel/pull/10628) Don't throw when destructuring into a var named as an import. ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo)) +* `babel-plugin-transform-modules-systemjs` + * [#10638](https://github.com/babel/babel/pull/10638) fix: remove ExportNamedDeclaration when the specifier is empty. ([@JLHwung](https://github.com/JLHwung)) +* `babel-parser` + * [#10631](https://github.com/babel/babel/pull/10631) [TS] Parse calls with type args in optional chains. ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo)) + * [#10607](https://github.com/babel/babel/pull/10607) fixed missing errors on assignment pattern in object expression. ([@vivek12345](https://github.com/vivek12345)) + * [#10594](https://github.com/babel/babel/pull/10594) [parser] Parse only modifiers of actual methods. ([@gonzarodriguezt](https://github.com/gonzarodriguezt)) +* `babel-plugin-transform-typescript` + * [#10555](https://github.com/babel/babel/pull/10555) [TS] Correctly transform computed strings and templates in enums. ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo)) +* `babel-core` + * [#10623](https://github.com/babel/babel/pull/10623) Fix: inputSourceMap should work when it is an external file. ([@JLHwung](https://github.com/JLHwung)) + * [#10539](https://github.com/babel/babel/pull/10539) fix: remove filename annotation in buildCodeFrameError. ([@JLHwung](https://github.com/JLHwung)) +* `babel-plugin-proposal-decorators` + * [#10578](https://github.com/babel/babel/pull/10578) [decorators] fix: support string literal properties. ([@mwhitworth](https://github.com/mwhitworth)) +* `babel-helpers`, `babel-plugin-proposal-dynamic-import`, `babel-plugin-transform-modules-commonjs`, `babel-preset-env` + * [#10574](https://github.com/babel/babel/pull/10574) fix: _interopRequireWildcard should only cache objects. ([@samMeow](https://github.com/samMeow)) +* `babel-traverse` + * [#9777](https://github.com/babel/babel/pull/9777) [traverse] Allow skipping nodes inserted with .replaceWith(). ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo)) +* `babel-preset-env` + * [#10146](https://github.com/babel/babel/pull/10146) Inject core-js@3 imports in Program:exit instead of on post(). ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo)) +* `babel-generator` + * [#10519](https://github.com/babel/babel/pull/10519) Fix generator missing parens around an arrow returning function type. ([@existentialism](https://github.com/existentialism)) +* `babel-plugin-transform-async-to-generator`, `babel-preset-env`, `babel-traverse` + * [#9939](https://github.com/babel/babel/pull/9939) Don't use args rest/spread to hoist super method calls. ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo)) + +#### :nail_care: Polish +* `babel-plugin-transform-classes`, `babel-plugin-transform-regenerator`, `babel-preset-env` + * [#9481](https://github.com/babel/babel/pull/9481) [preset-env] Don't use async-to-generator when already using regenerator. ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo)) +* `babel-helpers`, `babel-plugin-transform-modules-commonjs`, `babel-preset-env` + * [#10585](https://github.com/babel/babel/pull/10585) fix(babel‑helpers/interopRequireWildcard): Avoid double nullish check. ([@ExE-Boss](https://github.com/ExE-Boss)) +* `babel-register` + * [#10557](https://github.com/babel/babel/pull/10557) fix: disable caching when babel could not read/write cache. ([@JLHwung](https://github.com/JLHwung)) + +#### :house: Internal +* `babel-cli`, `babel-node` + * [#10619](https://github.com/babel/babel/pull/10619) chore: remove output-file-sync dependency. ([@JLHwung](https://github.com/JLHwung)) +* `babel-register` + * [#10614](https://github.com/babel/babel/pull/10614) chore: bump source-map-support to 0.5.14. ([@JLHwung](https://github.com/JLHwung)) +* `babel-helper-create-regexp-features-plugin`, `babel-plugin-proposal-unicode-property-regex`, `babel-plugin-transform-dotall-regex`, `babel-plugin-transform-named-capturing-groups-regex`, `babel-plugin-transform-unicode-regex`, `babel-preset-env` + * [#10447](https://github.com/babel/babel/pull/10447) Merge multiple regex transform plugin. ([@JLHwung](https://github.com/JLHwung)) +* `babel-preset-env` + * [#10612](https://github.com/babel/babel/pull/10612) chore: update web.immediate support fixtures. ([@JLHwung](https://github.com/JLHwung)) +* `babel-helper-module-imports` + * [#10608](https://github.com/babel/babel/pull/10608) Use .find instead of .filter to get targetPath in ImportInjector. ([@Andarist](https://github.com/Andarist)) +* Other + * [#10600](https://github.com/babel/babel/pull/10600) Test node@13 on circle. ([@existentialism](https://github.com/existentialism)) + * [#10593](https://github.com/babel/babel/pull/10593) chore: replace outdated travis-ci.org badges [ci skip]. ([@JLHwung](https://github.com/JLHwung)) + * [#10591](https://github.com/babel/babel/pull/10591) chore: test against Node.js 13. ([@JLHwung](https://github.com/JLHwung)) + * [#10556](https://github.com/babel/babel/pull/10556) Add master branch workflow for test262 tests. ([@jbhoosreddy](https://github.com/jbhoosreddy)) + * [#10553](https://github.com/babel/babel/pull/10553) chore: introduce envinfo into environment section. ([@JLHwung](https://github.com/JLHwung)) +* `babel-runtime` + * [#10418](https://github.com/babel/babel/pull/10418) docs: add homepage link. ([@DanArthurGallagher](https://github.com/DanArthurGallagher)) +* `babel-helper-annotate-as-pure`, `babel-helper-bindify-decorators`, `babel-helper-builder-binary-assignment-operator-visitor`, `babel-helper-builder-react-jsx`, `babel-helper-call-delegate`, `babel-helper-define-map`, `babel-helper-explode-assignable-expression`, `babel-helper-explode-class`, `babel-helper-function-name`, `babel-helper-get-function-arity`, `babel-helper-hoist-variables`, `babel-helper-member-expression-to-functions`, `babel-helper-module-imports`, `babel-helper-module-transforms`, `babel-helper-optimise-call-expression`, `babel-helper-remap-async-to-generator`, `babel-helper-replace-supers`, `babel-helper-simple-access`, `babel-helper-split-export-declaration`, `babel-helper-wrap-function`, `babel-helpers`, `babel-template` + * [#10568](https://github.com/babel/babel/pull/10568) Bump babel-types to ^7.6.3. ([@JLHwung](https://github.com/JLHwung)) + +#### :running_woman: Performance +* `babel-traverse` + * [#10480](https://github.com/babel/babel/pull/10480) Traverse performance. ([@JLHwung](https://github.com/JLHwung)) + +## v7.6.4 (2019-10-10) + +#### :eyeglasses: Spec Compliance +* `babel-parser` + * [#10491](https://github.com/babel/babel/pull/10491) Trailing comma after rest - The final fix ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo)) + +#### :bug: Bug Fix +* `babel-cli`, `babel-core`, `babel-generator`, `babel-helper-transform-fixture-test-runner` + * [#10536](https://github.com/babel/babel/pull/10536) Revert "chore: Upgrade source-map to 0.6.1 (#10446)" ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo)) +## v7.6.3 (2019-10-08) + +#### :eyeglasses: Spec Compliance +* `babel-parser` + * [#10469](https://github.com/babel/babel/pull/10469) Disallow await inside async arrow params ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo)) + * [#10493](https://github.com/babel/babel/pull/10493) [parser] Disallow numeric separators in legacy octal like integers ([@gonzarodriguezt](https://github.com/gonzarodriguezt)) + +#### :rocket: New Feature +* `babel-types` + * [#10504](https://github.com/babel/babel/pull/10504) Add declarations for more of @babel/types exports ([@Jessidhia](https://github.com/Jessidhia)) + +#### :bug: Bug Fix +* `babel-plugin-transform-block-scoping` + * [#10343](https://github.com/babel/babel/pull/10343) Do not remove let bindings even they are wrapped in closure ([@JLHwung](https://github.com/JLHwung)) +* `babel-parser` + * [#10119](https://github.com/babel/babel/pull/10119) add scope to TSModuleDeclaration ([@tanhauhau](https://github.com/tanhauhau)) + * [#10332](https://github.com/babel/babel/pull/10332) Do not allow member expressions to start async arrows ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo)) + * [#10490](https://github.com/babel/babel/pull/10490) [parser] Don't crash on comment after trailing comma after elision ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo)) +* `babel-plugin-transform-react-constant-elements`, `babel-traverse` + * [#10529](https://github.com/babel/babel/pull/10529) Do not hoist jsx referencing a mutable binding ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo)) +* `babel-generator`, `babel-parser`, `babel-plugin-transform-block-scoping`, `babel-plugin-transform-flow-comments`, `babel-plugin-transform-flow-strip-types`, `babel-plugin-transform-typescript` + * [#10220](https://github.com/babel/babel/pull/10220) Flow: interface identifier should be declared in the scope ([@JLHwung](https://github.com/JLHwung)) + +#### :nail_care: Polish +* `babel-core` + * [#10419](https://github.com/babel/babel/pull/10419) assertNoDuplicates throw with more context ([@hjdivad](https://github.com/hjdivad)) + * [#10511](https://github.com/babel/babel/pull/10511) Add filename to transform error ([@JLHwung](https://github.com/JLHwung)) + +#### :house: Internal +* Other + * [#10506](https://github.com/babel/babel/pull/10506) Use `make -j` for parallel build ([@JLHwung](https://github.com/JLHwung)) + * [#10443](https://github.com/babel/babel/pull/10443) perf: only apply lazy cjs module transform on cli and core ([@JLHwung](https://github.com/JLHwung)) + * [#10494](https://github.com/babel/babel/pull/10494) Enable optional chaining and nullish coalescing plugins ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo)) +* `babel-cli`, `babel-core`, `babel-generator`, `babel-helper-fixtures`, `babel-helper-transform-fixture-test-runner`, `babel-node`, `babel-plugin-transform-react-jsx-source`, `babel-plugin-transform-runtime`, `babel-preset-env`, `babel-preset-react` + * [#10249](https://github.com/babel/babel/pull/10249) Add windows to travis ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo)) + +#### :running_woman: Performance +* `babel-parser` + * [#10371](https://github.com/babel/babel/pull/10371) perf: replace lookahead by lookaheadCharCode ([@JLHwung](https://github.com/JLHwung)) +* Other + * [#10443](https://github.com/babel/babel/pull/10443) perf: only apply lazy cjs module transform on cli and core ([@JLHwung](https://github.com/JLHwung)) +## v7.6.2 (2019-09-23) + +#### :eyeglasses: Spec Compliance +* `babel-parser` + * [#10472](https://github.com/babel/babel/pull/10472) added check to disallow super.private variable access and test case added. ([@vivek12345](https://github.com/vivek12345)) + * [#10468](https://github.com/babel/babel/pull/10468) [parser] Disallow numeric separator in unicode scape sequences. ([@ivandevp](https://github.com/ivandevp)) + * [#10467](https://github.com/babel/babel/pull/10467) [parser] Invalid NonOctal Decimal. ([@gonzarodriguezt](https://github.com/gonzarodriguezt)) + * [#10461](https://github.com/babel/babel/pull/10461) [parser] Disallow static fields named `constructor`. ([@guywaldman](https://github.com/guywaldman)) + * [#10455](https://github.com/babel/babel/pull/10455) [parser] Report escapes in kws only if they won't be used as identifiers. ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo)) + +#### :bug: Bug Fix +* `babel-parser` + * [#10445](https://github.com/babel/babel/pull/10445) Leave trailing comments after handling a possible trailing comma. ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo)) +* `babel-cli` + * [#10400](https://github.com/babel/babel/pull/10400) fix: allow the process to exit naturally. ([@JLHwung](https://github.com/JLHwung)) +* `babel-core` + * [#10402](https://github.com/babel/babel/pull/10402) fix: pass optionLoc when validating plugin object. ([@JLHwung](https://github.com/JLHwung)) +* `babel-plugin-transform-block-scoping`, `babel-plugin-transform-spread`, `babel-traverse` + * [#10417](https://github.com/babel/babel/pull/10417) Do not guess relative execution status for exported fns. ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo)) +* `babel-plugin-proposal-object-rest-spread`, `babel-preset-env` + * [#10275](https://github.com/babel/babel/pull/10275) fix object rest in array pattern. ([@tanhauhau](https://github.com/tanhauhau)) + +#### :house: Internal +* `babel-plugin-transform-named-capturing-groups-regex` + * [#10430](https://github.com/babel/babel/pull/10430) refactor: replace regexp-tree by regexpu. ([@JLHwung](https://github.com/JLHwung)) +* Other + * [#10441](https://github.com/babel/babel/pull/10441) Update GitHub actions to v2. ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo)) + * [#10427](https://github.com/babel/babel/pull/10427) chore: add lint-ts rule. ([@JLHwung](https://github.com/JLHwung)) +* `babel-helper-fixtures` + * [#10428](https://github.com/babel/babel/pull/10428) chore: remove tryResolve dependency. ([@JLHwung](https://github.com/JLHwung)) +* `babel-node` + * [#10429](https://github.com/babel/babel/pull/10429) Remove babel polyfill dependency of babel-node. ([@bdwain](https://github.com/bdwain)) +* `babel-generator`, `babel-helper-fixtures` + * [#10420](https://github.com/babel/babel/pull/10420) chore: remove trim-right dependency. ([@JLHwung](https://github.com/JLHwung)) +* `babel-core`, `babel-plugin-transform-runtime`, `babel-register` + * [#10405](https://github.com/babel/babel/pull/10405) Remove circular dependency. ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo)) + +#### :running_woman: Performance +* `babel-parser` + * [#10421](https://github.com/babel/babel/pull/10421) Miscellaneous perf tweak. ([@JLHwung](https://github.com/JLHwung)) + +## v7.6.1 (2019-09-06) + +#### :bug: Bug Fix +* `babel-types` + * [#10404](https://github.com/babel/babel/pull/10404) fix(types): correct typescript function headers ([@forstermatth](https://github.com/forstermatth)) +* `babel-node` + * [#9758](https://github.com/babel/babel/pull/9758) Remove process.exit(1) from babel-node ([@dword-design](https://github.com/dword-design)) + +## v7.6.0 (2019-09-06) + +#### :eyeglasses: Spec Compliance +* `babel-generator`, `babel-parser` + * [#10269](https://github.com/babel/babel/pull/10269) Fix parenthesis for nullish coalescing ([@vivek12345](https://github.com/vivek12345)) +* `babel-helpers`, `babel-plugin-transform-block-scoping`, `babel-traverse` + * [#9498](https://github.com/babel/babel/pull/9498) Fix tdz checks in transform-block-scoping plugin ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo)) + +#### :rocket: New Feature +* `babel-core` + * [#10181](https://github.com/babel/babel/pull/10181) feat(errors): validate preset when filename is absent ([@JLHwung](https://github.com/JLHwung)) +* `babel-helper-create-class-features-plugin`, `babel-helpers`, `babel-plugin-proposal-private-methods` + * [#10217](https://github.com/babel/babel/pull/10217) Class Private Static Accessors ([@tim-mc](https://github.com/tim-mc)) +* `babel-generator`, `babel-parser`, `babel-types` + * [#10148](https://github.com/babel/babel/pull/10148) V8intrinsic syntax plugin ([@JLHwung](https://github.com/JLHwung)) +* `babel-preset-typescript` + * [#10382](https://github.com/babel/babel/pull/10382) Allow setting 'allowNamespaces' in typescript preset ([@dsgkirkby](https://github.com/dsgkirkby)) +* `babel-parser` + * [#10352](https://github.com/babel/babel/pull/10352) Do not register ambient classes to the TS scope ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo)) +* `babel-types` + * [#10248](https://github.com/babel/babel/pull/10248) Add static to class property builder ([@yuri-karadzhov](https://github.com/yuri-karadzhov)) + +#### :bug: Bug Fix +* `babel-helpers`, `babel-plugin-transform-destructuring`, `babel-plugin-transform-modules-commonjs`, `babel-preset-env` + * [#10396](https://github.com/babel/babel/pull/10396) fix: early return when instance is not iterable ([@JLHwung](https://github.com/JLHwung)) +* `babel-plugin-transform-runtime` + * [#10398](https://github.com/babel/babel/pull/10398) Add supports for polyfill computed methods ([@rhyzx](https://github.com/rhyzx)) +* `babel-preset-env` + * [#10397](https://github.com/babel/babel/pull/10397) Don't polyfill when evaluation is not confident ([@rhyzx](https://github.com/rhyzx)) + * [#10218](https://github.com/babel/babel/pull/10218) [preset-env] Include / exclude module plugins properly ([@AdamRamberg](https://github.com/AdamRamberg)) + * [#10284](https://github.com/babel/babel/pull/10284) Replace es.string.reverse with es.array.reverse ([@epicfaace](https://github.com/epicfaace)) +* `babel-plugin-transform-named-capturing-groups-regex` + * [#10395](https://github.com/babel/babel/pull/10395) fix: transform name capturing regex once ([@JLHwung](https://github.com/JLHwung)) +* `babel-types` + * [#10098](https://github.com/babel/babel/pull/10098) fix typescript for babel-types ([@tanhauhau](https://github.com/tanhauhau)) + * [#10319](https://github.com/babel/babel/pull/10319) Add a builder definition including name for tsTypeParameter ([@deificx](https://github.com/deificx)) +* `babel-parser` + * [#10380](https://github.com/babel/babel/pull/10380) Refactor trailing comment adjustment ([@banga](https://github.com/banga)) + * [#10369](https://github.com/babel/babel/pull/10369) Retain trailing comments in array expressions ([@banga](https://github.com/banga)) + * [#10292](https://github.com/babel/babel/pull/10292) fix: assign trailing comment to ObjectProperty only when inside an ObjectExpression ([@JLHwung](https://github.com/JLHwung)) +* `babel-parser`, `babel-types` + * [#10366](https://github.com/babel/babel/pull/10366) Don't allow JSXNamespacedName to chain ([@jridgewell](https://github.com/jridgewell)) +* `babel-generator`, `babel-plugin-transform-typescript`, `babel-types` + * [#10341](https://github.com/babel/babel/pull/10341) Add TSBigIntKeyword to @babel/types ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo)) +* `babel-core`, `babel-types` + * [#9960](https://github.com/babel/babel/pull/9960) Do not delete "fake" source map comments from strings ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo)) +* `babel-plugin-transform-flow-comments` + * [#10329](https://github.com/babel/babel/pull/10329) Fix flow comments plugin issues ([@zaygraveyard](https://github.com/zaygraveyard)) +* `babel-helpers`, `babel-plugin-transform-react-constant-elements` + * [#10307](https://github.com/babel/babel/pull/10307) [fix] jsx helper calls order ([@Sinewyk](https://github.com/Sinewyk)) +* `babel-plugin-proposal-decorators` + * [#10302](https://github.com/babel/babel/pull/10302) fix: register inserted class declaration ([@thiagoarrais](https://github.com/thiagoarrais)) +* `babel-plugin-proposal-do-expressions`, `babel-traverse` + * [#10070](https://github.com/babel/babel/pull/10070) Do expressions transform for switch statements ([@tanhauhau](https://github.com/tanhauhau)) + * [#10277](https://github.com/babel/babel/pull/10277) remove finally from completion record in try statement ([@tanhauhau](https://github.com/tanhauhau)) +* `babel-helpers`, `babel-plugin-transform-named-capturing-groups-regex` + * [#10136](https://github.com/babel/babel/pull/10136) fix capturing group for matchAll ([@tanhauhau](https://github.com/tanhauhau)) + +#### :nail_care: Polish +* `babel-plugin-transform-runtime`, `babel-preset-env` + * [#10372](https://github.com/babel/babel/pull/10372) Don't allow instance properties transformation on namespace ([@rhyzx](https://github.com/rhyzx)) + +#### :memo: Documentation +* [#10313](https://github.com/babel/babel/pull/10313) Adds note about two approval policy to PR template ([@thiagoarrais](https://github.com/thiagoarrais)) + +#### :house: Internal +* `babel-register` + * [#9847](https://github.com/babel/babel/pull/9847) Remove core-js dependency from @babel/register ([@coreyfarrell](https://github.com/coreyfarrell)) +* `babel-helper-fixtures`, `babel-helper-transform-fixture-test-runner`, `babel-preset-env` + * [#10401](https://github.com/babel/babel/pull/10401) Use "validateLogs" for preset-env's debug fixtures ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo)) +* `babel-parser` + * [#10380](https://github.com/babel/babel/pull/10380) Refactor trailing comment adjustment ([@banga](https://github.com/banga)) +* `babel-helper-fixtures`, `babel-helper-transform-fixture-test-runner`, `babel-plugin-proposal-dynamic-import`, `babel-preset-env` + * [#10326](https://github.com/babel/babel/pull/10326) Allow testing logs with `@babel/helper-transform-fixture-test-runner` ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo)) +* `babel-runtime-corejs2`, `babel-runtime`, `babel-types` + * [#10331](https://github.com/babel/babel/pull/10331) Commit generated code ([@JLHwung](https://github.com/JLHwung)) +* `babel-cli`, `babel-core`, `babel-generator`, `babel-helper-create-class-features-plugin`, `babel-helper-fixtures`, `babel-node`, `babel-parser`, `babel-plugin-proposal-do-expressions`, `babel-plugin-proposal-pipeline-operator`, `babel-plugin-transform-modules-commonjs`, `babel-plugin-transform-runtime`, `babel-preset-env`, `babel-standalone`, `babel-template`, `babel-traverse`, `babel-types` + * [#10228](https://github.com/babel/babel/pull/10228) Update dev dependencies and fix linting errors ([@danez](https://github.com/danez)) +* `babel-cli` + * [#10244](https://github.com/babel/babel/pull/10244) added flow to babel cli ([@Letladi](https://github.com/Letladi)) + +#### :running_woman: Performance +* `babel-helpers`, `babel-plugin-transform-modules-commonjs`, `babel-preset-env` + * [#10161](https://github.com/babel/babel/pull/10161) Improves the logic to import objects in helpers ([@ifsnow](https://github.com/ifsnow)) +* `babel-traverse` + * [#10243](https://github.com/babel/babel/pull/10243) perf: always return `void 0` as undefined node ([@JLHwung](https://github.com/JLHwung)) ## v7.5.5 (2019-07-17) @@ -389,7 +956,7 @@ See [Babylon's CHANGELOG](packages/babylon/CHANGELOG.md) for the Babylon pre-7.0 ## v7.3.3 (2019-02-15) -#### :eyeglasses: Spec Compliancy +#### :eyeglasses: Spec Compliance * `babel-generator` * [#9501](https://github.com/babel/babel/pull/9501) Correctly output escapes in directives ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo)) @@ -411,11 +978,11 @@ See [Babylon's CHANGELOG](packages/babylon/CHANGELOG.md) for the Babylon pre-7.0 * [#9491](https://github.com/babel/babel/pull/9491) Better error output in parser tests ([@danez](https://github.com/danez)) ## v7.3.2 (2019-02-04) -Various spec compliancy fixes and better support for smart pipelines and private methods. +Various spec compliance fixes and better support for smart pipelines and private methods. Thanks @gverni, @naffiq, @spondbob and @dstaley for their first PRs! -#### :eyeglasses: Spec Compliancy +#### :eyeglasses: Spec Compliance * `babel-parser` * [#9403](https://github.com/babel/babel/pull/9403) Fix line continuation with Unicode line terminators. ([@danez](https://github.com/danez)) * [#9400](https://github.com/babel/babel/pull/9400) Make yield a contextual keyword. ([@danez](https://github.com/danez)) @@ -463,7 +1030,7 @@ This release fixes some regressions introduced in v7.3.0 Thanks to @jamesgeorge007 and @armano2 for their first PR! -#### :eyeglasses: Spec Compliancy +#### :eyeglasses: Spec Compliance * `babel-parser` * [#9314](https://github.com/babel/babel/pull/9314) Disallow async functions as loop body. ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo)) * [#9315](https://github.com/babel/babel/pull/9315) Parse class heritage as strict mode code. ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo)) @@ -684,7 +1251,7 @@ You can read more about this release at https://babeljs.io/blog/2018/12/03/7.2.0 ## v7.1.5 (2018-11-06) -#### :eyeglasses: Spec Compliancy +#### :eyeglasses: Spec Compliance * `babel-parser`, `babylon` * [#7727](https://github.com/babel/babel/pull/7727) Fix await in function name and parameters. ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo)) @@ -1147,7 +1714,7 @@ Fixed a peerDep issue Mostly bug fixes and some decorator updates -#### :eyeglasses: Spec Compliancy +#### :eyeglasses: Spec Compliance * `babel-plugin-proposal-unicode-property-regex` * [#8127](https://github.com/babel/babel/pull/8127) Update plugin-proposal-unicode-property-regex for Unicode v11. ([@mathiasbynens](https://github.com/mathiasbynens)) * `babel-parser` @@ -1247,7 +1814,7 @@ Mostly bugfix release for a regression in decorators, and a quick fix for some n - Fix IE10 class regression - Various fixes, many TS fixes -#### :eyeglasses: Spec Compliancy +#### :eyeglasses: Spec Compliance * `babel-parser`, `babel-plugin-proposal-json-strings`, `babel-plugin-syntax-json-strings`, `babel-preset-stage-3` * [#7985](https://github.com/babel/babel/pull/7985) Subsume json. ([@jridgewell](https://github.com/jridgewell)) @@ -1437,7 +2004,7 @@ Mostly bugfix release for a regression in decorators, and a quick fix for some n * `babel-generator`, `babel-helper-define-map`, `babel-plugin-syntax-class-properties`, `babel-plugin-transform-parameters`, `babel-plugin-transform-react-constant-elements`, `babel-traverse`, `babel-types` * [#7666](https://github.com/babel/babel/pull/7666) Private Properties phase 1. ([@jridgewell](https://github.com/jridgewell)) -#### :eyeglasses: Spec Compliancy +#### :eyeglasses: Spec Compliance * `babel-helper-simple-access`, `babel-plugin-transform-modules-commonjs`, `babel-plugin-transform-modules-systemjs` * [#7766](https://github.com/babel/babel/pull/7766) Correct update expression Number coercion. ([@jridgewell](https://github.com/jridgewell)) * `babel-core`, `babel-generator`, `babel-plugin-proposal-decorators`, `babel-types`, `babylon` @@ -1525,7 +2092,7 @@ Mostly bugfix release for a regression in decorators, and a quick fix for some n Various fixes, also lazy-load `@babel/core` dependencies (should make config lookup and other API methods fast for other projects to use). -#### :eyeglasses: Spec Compliancy +#### :eyeglasses: Spec Compliance * `babel-plugin-proposal-logical-assignment-operators` * [#7604](https://github.com/babel/babel/pull/7604) Logical Assignment: ensure computed key isn't recomputed. ([@jridgewell](https://github.com/jridgewell)) @@ -1624,7 +2191,7 @@ We'll need to update tooling for this ^. Also published `gulp-babel@8.0.0-beta.2 * `babel-register` * [#7416](https://github.com/babel/babel/pull/7416) Replace instead of merging babel-register options, and resolve cwd up front. ([@loganfsmyth](https://github.com/loganfsmyth)) -#### :eyeglasses: Spec Compliancy +#### :eyeglasses: Spec Compliance * `babylon` * [#7503](https://github.com/babel/babel/pull/7503) Update test262 test script and a few keyword escape fixes. ([@existentialism](https://github.com/existentialism)) * [#7498](https://github.com/babel/babel/pull/7498) Disallow setters to have RestElement. ([@danez](https://github.com/danez)) @@ -1772,7 +2339,7 @@ We'll need to update tooling for this ^. Also published `gulp-babel@8.0.0-beta.2 ## v7.0.0-beta.39 (2018-01-30) -#### :eyeglasses: Spec Compliancy +#### :eyeglasses: Spec Compliance * `babel-plugin-proposal-optional-chaining` * [#6345](https://github.com/babel/babel/pull/6345) Remove old optional chain features. ([@jridgewell](https://github.com/jridgewell)) @@ -1985,7 +2552,7 @@ Fixes + [overrides](https://github.com/babel/babel/pull/7091) config feature Various bug fixes, first version of Babel to use the MIT version of `regenerator` -#### :eyeglasses: Spec Compliancy +#### :eyeglasses: Spec Compliance * `babylon` * [#6986](https://github.com/babel/babel/pull/6986) Fix destructuring assignment spec violation. ([@ksashikumar](https://github.com/ksashikumar)) * `babel-helper-replace-supers`, `babel-helpers`, `babel-plugin-proposal-class-properties`, `babel-plugin-transform-classes`, `babel-plugin-transform-parameters` @@ -2038,7 +2605,7 @@ Various bug fixes, first version of Babel to use the MIT version of `regenerator * `babel-preset-stage-1`, `babel-preset-stage-2` * [#6949](https://github.com/babel/babel/pull/6949) Fix stage refs to exportNamespaceFrom and exportDefaultFrom. ([@existentialism](https://github.com/existentialism)) -#### :eyeglasses: Spec Compliancy +#### :eyeglasses: Spec Compliance * `babel-preset-stage-0`, `babel-preset-stage-1` * [#6943](https://github.com/babel/babel/pull/6943) Moving Do expression to stage 1. ([@rajzshkr](https://github.com/rajzshkr)) @@ -2052,7 +2619,7 @@ Various bug fixes, first version of Babel to use the MIT version of `regenerator ## v7.0.0-beta.33 (2017-12-01) -#### :eyeglasses: Spec Compliancy +#### :eyeglasses: Spec Compliance * `babel-generator`, `babel-plugin-proposal-export-default-from`, `babel-plugin-proposal-export-default`, `babel-plugin-proposal-export-namespace-from`, `babel-plugin-proposal-export-namespace`, `babel-plugin-syntax-export-default-from`, `babel-plugin-syntax-export-extensions`, `babel-plugin-syntax-export-namespace-from`, `babel-standalone`, `babylon` * [#6920](https://github.com/babel/babel/pull/6920) Split exportExtensions into exportDefault and exportNamespace plugins…. ([@existentialism](https://github.com/existentialism)) * `babylon` @@ -2237,7 +2804,7 @@ Various bug fixes, first version of Babel to use the MIT version of `regenerator > Note: don't use ^ in your dependencies when using a beta. It can still break between (we should try not to do it but it can), so pin all the packages like `"@babel/cli" : "7.0.0-beta.4"` -#### :eyeglasses: Spec Compliancy +#### :eyeglasses: Spec Compliance * `babel-plugin-transform-optional-chaining` * [#6525](https://github.com/babel/babel/pull/6525) Optional Chaining: Account for document.all. ([@azz](https://github.com/azz)) * `babel-preset-env`, `babel-helper-remap-async-to-generator`, `babel-helpers`, `babel-plugin-transform-async-generator-functions`, `babel-plugin-transform-async-to-generator`, `babel-plugin-transform-function-sent` @@ -2517,7 +3084,7 @@ let {...{}} = {}; let {...[]} = {}; - Add `--config-file` CLI flag to explicitly pass a config location - Move `babel-standalone` into the repo (another form of this used to be `babel-browser`) -#### :eyeglasses: Spec Compliancy +#### :eyeglasses: Spec Compliance * `babel-plugin-transform-async-to-generator`, `babel-*` * [#6094](https://github.com/babel/babel/pull/6094) Spec compatibility for iteratorClose condition.. ([@yavorsky](https://github.com/yavorsky)) * `babel-helpers`, `babel-plugin-transform-es2015-computed-properties` @@ -2653,7 +3220,7 @@ Initial release of typescript equivalent of how Babel handles flow with a new `b ## v7.0.0-alpha.18 (2017-08-03) -#### :eyeglasses: Spec Compliancy +#### :eyeglasses: Spec Compliance * `babel-generator`, `babel-plugin-transform-flow-comments`, `babel-plugin-transform-flow-strip-types`, `babel-types` * [#5990](https://github.com/babel/babel/pull/5990) Flow opaque type aliases. ([@jbrown215](https://github.com/jbrown215)) * `babel-preset-stage-3` @@ -2702,9 +3269,9 @@ Initial release of typescript equivalent of how Babel handles flow with a new `b - Optional catch binding `try {} catch {}`: `babel-plugin-transform-optional-catch-binding` - es2015-parameters `loose` mode that doesn't use `arguments` -#### :eyeglasses: Spec Compliancy +#### :eyeglasses: Spec Compliance * `babel-plugin-check-es2015-constants` - * [#5930](https://github.com/babel/babel/pull/5930) Spec compliancy of check-es2015-constants plugin. ([@maurobringolf](https://github.com/maurobringolf)) + * [#5930](https://github.com/babel/babel/pull/5930) Spec compliance of check-es2015-constants plugin. ([@maurobringolf](https://github.com/maurobringolf)) > Instead of throwing a compile time error when const is violated, Babel should insert a throw statement before the violation. @@ -3009,7 +3576,7 @@ var A = function A() { ## v7.0.0-alpha.12 (2017-05-31) -#### :eyeglasses: Spec Compliancy +#### :eyeglasses: Spec Compliance * `babel-core`, `babel-generator`, `babel-plugin-syntax-numeric-separator`, `babel-plugin-transform-numeric-separator`, `babel-preset-stage-1`, `babel-template`, `babel-traverse`, `babel-types` * [#5793](https://github.com/babel/babel/pull/5793) Support for NumericLiteralSeparator, Stage 1 feature. ([@rwaldron](https://github.com/rwaldron)) @@ -3050,7 +3617,7 @@ var A = function A() { Update Babylon: https://github.com/babel/babylon/releases/tag/v7.0.0-beta.9, https://github.com/babel/babylon/releases/tag/v7.0.0-beta.10 -#### :eyeglasses: Spec Compliancy +#### :eyeglasses: Spec Compliance * `babel-generator`, `babel-plugin-transform-flow-strip-types`, `babel-types` * [#5525](https://github.com/babel/babel/pull/5525) Add support for object type spread. ([@conartist6](https://github.com/conartist6)) @@ -3124,7 +3691,7 @@ Update Babylon: https://github.com/babel/babylon/releases/tag/v7.0.0-beta.9, htt ## v7.0.0-alpha.8 (2017-04-17) -#### :eyeglasses: Spec Compliancy +#### :eyeglasses: Spec Compliance * `babel-preset-stage-2`, `babel-preset-stage-3` * [#5610](https://github.com/babel/babel/pull/5610) Move syntax-dynamic-import to stage-3. ([@dkaoster](https://github.com/dkaoster)) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index e7b9bd953b54..d7bfa3d7a463 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,4 +1,4 @@ ----- +---

Setup @@ -12,8 +12,7 @@ Internals

----- - +--- # Contributing @@ -24,14 +23,15 @@ contributing, please read the ## Not sure where to start? - If you aren't just making a documentation change, you'll probably want to learn a bit about a few topics. - - [ASTs](https://en.wikipedia.org/wiki/Abstract_syntax_tree) (Abstract Syntax Tree): The Babel AST [spec](https://github.com/babel/babel/blob/master/packages/babel-parser/ast/spec.md) is a bit different from [ESTree](https://github.com/estree/estree). The differences are listed [here](https://babeljs.io/docs/en/next/babel-parser.html#output). - - Check out [`/doc`](https://github.com/babel/babel/tree/master/doc) for information about Babel's internals - - Check out [the Babel Plugin Handbook](https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#babel-plugin-handbook) - core plugins are written the same way as any other plugin! - - Check out [AST Explorer](http://astexplorer.net/#/scUfOmVOG5) to learn more about ASTs or make your own plugin in the browser + - [ASTs](https://en.wikipedia.org/wiki/Abstract_syntax_tree) (Abstract Syntax Tree): The Babel AST [spec](https://github.com/babel/babel/blob/master/packages/babel-parser/ast/spec.md) is a bit different from [ESTree](https://github.com/estree/estree). The differences are listed [here](https://babeljs.io/docs/en/next/babel-parser.html#output). + - Check out [`/doc`](https://github.com/babel/babel/tree/master/doc) for information about Babel's internals + - Check out [the Babel Plugin Handbook](https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#babel-plugin-handbook) - core plugins are written the same way as any other plugin! + - Check out [AST Explorer](http://astexplorer.net/#/scUfOmVOG5) to learn more about ASTs or make your own plugin in the browser - When you feel ready to jump into the Babel source code, a good place to start is to look for issues tagged with [help wanted](https://github.com/babel/babel/labels/help%20wanted) and/or [good first issue](https://github.com/babel/babel/labels/good%20first%20issue). - Follow along with what we are working on by joining our [Slack](https://babeljs.slack.com) (you can sign-up [here](https://slack.babeljs.io/) - for an invite), following our announcements on [Twitter](https://twitter.com/babeljs), and reading (or participating!) in our [meeting notes](https://github.com/babel/notes). + for an invite), following our announcements on [Twitter](https://twitter.com/babeljs), and reading (or participating!) in our [meeting notes](https://github.com/babel/notes). - Check out our [website](http://babeljs.io/) and the [repo](https://github.com/babel/website) +- You can contribute by triaging issues which may include reproducing bug reports or asking for vital information, such as version numbers or reproduction instructions. If you would like to start triaging issues, one easy way to get started is to [subscribe to babel on CodeTriage](https://www.codetriage.com/babel/babel). [![Open Source Helpers](https://www.codetriage.com/babel/babel/badges/users.svg)](https://www.codetriage.com/babel/babel) ## Chat @@ -48,8 +48,12 @@ Installation instructions can be found here: https://yarnpkg.com/en/docs/install ### Setup +Fork the `babel` repository to your GitHub Account. + +Then, run: + ```sh -$ git clone https://github.com/babel/babel +$ git clone https://github.com//babel $ cd babel $ make bootstrap ``` @@ -157,12 +161,12 @@ $ ./scripts/test-cov.sh In case you're not able to reproduce an error on CI locally, it may be due to - - Node Version: Travis CI runs the tests against all major node versions. If your tests use JavaScript features unsupported by lower versions of node, then use [minNodeVersion option](#writing-tests) in options.json. - - Timeout: Check the CI log and if the only errors are timeout errors and you are sure that it's not related to the changes you made, ask someone in the slack channel to trigger rebuild on the CI build and it might be resolved +- Node Version: Travis CI runs the tests against all major node versions. If your tests use JavaScript features unsupported by lower versions of node, then use [minNodeVersion option](#writing-tests) in options.json. +- Timeout: Check the CI log and if the only errors are timeout errors and you are sure that it's not related to the changes you made, ask someone in the slack channel to trigger rebuild on the CI build and it might be resolved In case you're locally getting errors which are not on the CI, it may be due to - - Updates in Dependencies: Make sure you run `make bootstrap` before you run `make build` or `make watch` before you run the tests. +- Updates in Dependencies: Make sure you run `make bootstrap` before you run `make build` or `make watch` before you run the tests. ### Writing tests @@ -176,15 +180,16 @@ For example, in [`@babel/plugin-transform-exponentiation-operator/test`](https:/ - There is an `index.js` file. It imports our [test helper](https://github.com/babel/babel/tree/master/packages/babel-helper-plugin-test-runner). (You don't have to worry about this). - There can be multiple folders under [`/fixtures`](https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-exponentiation-operator/test/fixtures) - - There is an [`options.json`](https://github.com/babel/babel/blob/master/packages/babel-plugin-transform-exponentiation-operator/test/fixtures/exponentian-operator/options.json) file whose function is similar to a `.babelrc` file, allowing you to pass in the plugins and settings you need for your tests. - - For this test, we only need the relevant plugin, so it's just `{ "plugins": ["@babel/plugin-transform-exponentiation-operator"] }`. - - If necessary, you can have an `options.json` with different options in each subfolder. + + - There is an [`options.json`](https://github.com/babel/babel/blob/master/packages/babel-plugin-transform-exponentiation-operator/test/fixtures/exponentian-operator/options.json) file whose function is similar to a `.babelrc` file, allowing you to pass in the plugins and settings you need for your tests. + - For this test, we only need the relevant plugin, so it's just `{ "plugins": ["@babel/plugin-transform-exponentiation-operator"] }`. + - If necessary, you can have an `options.json` with different options in each subfolder. - In each subfolder, you can organize your directory structure by categories of tests. (Example: these folders can be named after the feature you are testing or can reference the issue number they fix) - Generally, there are two kinds of tests for plugins -   - The first is a simple test of the input and output produced by running Babel on some code. We do this by creating an [`input.js`](https://github.com/babel/babel/blob/master/packages/babel-plugin-transform-exponentiation-operator/test/fixtures/exponentian-operator/binary/input.js) file and an [`output.js`](https://github.com/babel/babel/blob/master/packages/babel-plugin-transform-exponentiation-operator/test/fixtures/exponentian-operator/binary/output.js) file. This kind of test only works in sub-subdirectories of `/fixtures`, i.e. `/fixtures/exponentian-operator/binary/input.js` and **not** `/fixtures/exponentian-operator/input.js`. - - If you need to expect an error, you can ignore creating the `output.js` file and pass a new `throws` key to the `options.json` that contains the error string that is created. - - The second and preferred type is a test that actually evaluates the produced code and asserts that certain properties are true or false. We do this by creating an [`exec.js`](https://github.com/babel/babel/blob/master/packages/babel-plugin-transform-exponentiation-operator/test/fixtures/exponentian-operator/comprehensive/exec.js) file. +   - The first is a simple test of the input and output produced by running Babel on some code. We do this by creating an [`input.js`](https://github.com/babel/babel/blob/master/packages/babel-plugin-transform-exponentiation-operator/test/fixtures/exponentian-operator/binary/input.js) file and an [`output.js`](https://github.com/babel/babel/blob/master/packages/babel-plugin-transform-exponentiation-operator/test/fixtures/exponentian-operator/binary/output.js) file. This kind of test only works in sub-subdirectories of `/fixtures`, i.e. `/fixtures/exponentian-operator/binary/input.js` and **not** `/fixtures/exponentian-operator/input.js`. + - If you need to expect an error, you can ignore creating the `output.js` file and pass a new `throws` key to the `options.json` that contains the error string that is created. + - The second and preferred type is a test that actually evaluates the produced code and asserts that certain properties are true or false. We do this by creating an [`exec.js`](https://github.com/babel/babel/blob/master/packages/babel-plugin-transform-exponentiation-operator/test/fixtures/exponentian-operator/comprehensive/exec.js) file. In a fixture test, you simply write out the code you want to transform in `input.js`. @@ -199,6 +204,7 @@ and the expected output after transforming it with your `options.json` in `outpu // output.js Math.pow(2, 2); ``` + In an `exec.js` test, we run or check that the code actually does what it's supposed to do rather than just check the static output. ```js @@ -234,9 +240,9 @@ Inside the `packages/babel-parser/test/fixtures` folder are categories/groupings etc.). To add a test, create a folder under one of these groupings (or create a new one) with a descriptive name, and add the following: -* Create an `input.js` file that contains the code you want the babel parser to parse. +- Create an `input.js` file that contains the code you want the babel parser to parse. -* Add an `output.json` file with the expected parser output. For added convenience, if there is no `output.json` present, the test runner will generate one for you. +- Add an `output.json` file with the expected parser output. For added convenience, if there is no `output.json` present, the test runner will generate one for you. After writing tests for @babel/parser, just build it by running: @@ -316,6 +322,7 @@ Note that the code shown in Chrome DevTools is compiled code and therefore diffe - Start working about the Babel transform itself! ## Internals + - AST spec ([babel-parser/ast/spec.md](https://github.com/babel/babel/blob/master/packages/babel-parser/ast/spec.md)) - Versioning ([doc/design/versioning.md](https://github.com/babel/babel/blob/master/doc/design/versioning.md)) - Monorepo ([doc/design/monorepo.md](https://github.com/babel/babel/blob/master/doc/design/monorepo.md)) diff --git a/Gulpfile.js b/Gulpfile.js index 5df9882ca3f2..a78f68ea4914 100644 --- a/Gulpfile.js +++ b/Gulpfile.js @@ -10,26 +10,26 @@ const fancyLog = require("fancy-log"); const filter = require("gulp-filter"); const gulp = require("gulp"); const path = require("path"); -const webpack = require("webpack"); -const merge = require("merge-stream"); const rollup = require("rollup"); +const rollupAlias = require("@rollup/plugin-alias"); const rollupBabel = require("rollup-plugin-babel"); +const rollupBabelSource = require("./scripts/rollup-plugin-babel-source"); +const rollupCommonJs = require("rollup-plugin-commonjs"); +const rollupJson = require("@rollup/plugin-json"); +const rollupNodeBuiltins = require("rollup-plugin-node-builtins"); +const rollupNodeGlobals = require("rollup-plugin-node-globals"); const rollupNodeResolve = require("rollup-plugin-node-resolve"); const rollupReplace = require("rollup-plugin-replace"); -const { registerStandalonePackageTask } = require("./scripts/gulp-tasks"); +const { terser: rollupTerser } = require("rollup-plugin-terser"); -const sources = ["codemods", "packages"]; +const defaultSourcesGlob = "./@(codemods|packages|eslint)/*/src/**/*.js"; function swapSrcWithLib(srcPath) { const parts = srcPath.split(path.sep); - parts[1] = "lib"; + parts[2] = "lib"; return parts.join(path.sep); } -function getGlobFromSource(source) { - return `./${source}/*/src/**/*.js`; -} - function getIndexFromPackage(name) { return `${name}/src/index.js`; } @@ -56,68 +56,234 @@ function rename(fn) { }); } -function buildBabel(exclude) { - return merge( - sources.map(source => { - const base = path.join(__dirname, source); +function buildBabel(exclude, sourcesGlob = defaultSourcesGlob) { + const base = __dirname; - let stream = gulp.src(getGlobFromSource(source), { base: base }); + let stream = gulp.src(sourcesGlob, { base: __dirname }); - if (exclude) { - const filters = exclude.map(p => `!**/${p}/**`); - filters.unshift("**"); - stream = stream.pipe(filter(filters)); - } + if (exclude) { + const filters = exclude.map(p => `!**/${p}/**`); + filters.unshift("**"); + stream = stream.pipe(filter(filters)); + } - return stream - .pipe(errorsLogger()) - .pipe(newer({ dest: base, map: swapSrcWithLib })) - .pipe(compilationLogger()) - .pipe(babel()) - .pipe( - // Passing 'file.relative' because newer() above uses a relative - // path and this keeps it consistent. - rename(file => path.resolve(file.base, swapSrcWithLib(file.relative))) - ) - .pipe(gulp.dest(base)); - }) - ); + return stream + .pipe(errorsLogger()) + .pipe(newer({ dest: base, map: swapSrcWithLib })) + .pipe(compilationLogger()) + .pipe(babel()) + .pipe( + // Passing 'file.relative' because newer() above uses a relative + // path and this keeps it consistent. + rename(file => path.resolve(file.base, swapSrcWithLib(file.relative))) + ) + .pipe(gulp.dest(base)); } +let babelVersion = require("./packages/babel-core/package.json").version; function buildRollup(packages) { + const sourcemap = process.env.NODE_ENV === "production"; + const minify = !!process.env.IS_PUBLISH; return Promise.all( - packages.map(pkg => { - const input = getIndexFromPackage(pkg); - fancyLog(`Compiling '${chalk.cyan(input)}' with rollup ...`); - return rollup - .rollup({ - input, - plugins: [ - rollupReplace({ - "process.env.NODE_ENV": JSON.stringify(process.env.NODE_ENV), - }), - rollupBabel({ - envName: "babel-parser", - }), - rollupNodeResolve(), - ], - }) - .then(bundle => { - return bundle.write({ - file: path.join(pkg, "lib/index.js"), - format: "cjs", - name: "babel-parser", - sourcemap: process.env.NODE_ENV !== "production", + packages.map( + ({ src, format, dest, name, filename, version = babelVersion }) => { + const extraPlugins = []; + let inputExternal = undefined, + outputGlobals = undefined, + nodeResolveBrowser = false, + babelEnvName = "rollup"; + switch (src) { + case "packages/babel-standalone": + nodeResolveBrowser = true; + babelEnvName = "standalone"; + if (minify) { + extraPlugins.push( + rollupTerser({ + include: /^.+\.min\.js$/, + }) + ); + } + break; + case "packages/babel-preset-env-standalone": + nodeResolveBrowser = true; + babelEnvName = "standalone"; + if (minify) { + extraPlugins.push( + rollupTerser({ + include: /^.+\.min\.js$/, + }) + ); + } + inputExternal = ["@babel/standalone"]; + outputGlobals = { + "@babel/standalone": "Babel", + }; + extraPlugins.push( + rollupAlias({ + entries: [ + { + find: "./available-plugins", + replacement: require.resolve( + path.join(__dirname, src, "./src/available-plugins") + ), + }, + { + find: "caniuse-lite/data/regions", + replacement: require.resolve( + path.join(__dirname, src, "./src/caniuse-lite-regions") + ), + }, + ], + }) + ); + break; + } + // If this build is part of a pull request, include the pull request number in + // the version number. + if (process.env.CIRCLE_PR_NUMBER) { + const prVersion = "+pr." + process.env.CIRCLE_PR_NUMBER; + babelVersion += prVersion; + version += prVersion; + } + const input = getIndexFromPackage(src); + fancyLog(`Compiling '${chalk.cyan(input)}' with rollup ...`); + return rollup + .rollup({ + input, + external: inputExternal, + plugins: [ + ...extraPlugins, + rollupBabelSource(), + rollupReplace({ + "process.env.NODE_ENV": JSON.stringify(process.env.NODE_ENV), + BABEL_VERSION: JSON.stringify(babelVersion), + VERSION: JSON.stringify(version), + }), + rollupBabel({ + envName: babelEnvName, + babelrc: false, + extends: "./babel.config.js", + }), + rollupNodeResolve({ + browser: nodeResolveBrowser, + preferBuiltins: true, + //todo: When Yarn workspaces is enabled, remove `dedupe` option + dedupe(importee) { + return ( + importee.startsWith("lodash/") || + [ + "babel-plugin-dynamic-import-node/utils", + "esutils", + "semver", + "source-map", + ].includes(importee) + ); + }, + }), + rollupCommonJs({ + include: [ + /node_modules/, + "packages/babel-runtime/regenerator/**", + "packages/babel-preset-env/data/*.js", + // Rollup doesn't read export maps, so it loads the cjs fallback + "packages/babel-compat-data/*.js", + ], + namedExports: { + "babel-plugin-dynamic-import-node/utils.js": [ + "createDynamicImportTransform", + "getImportSource", + ], + "@babel/standalone": ["availablePlugins", "registerPlugin"], + }, + }), + rollupJson(), + rollupNodeBuiltins(), + rollupNodeGlobals({ sourceMap: sourcemap }), + ], + }) + .then(bundle => { + const outputFile = path.resolve(src, dest, filename || "index.js"); + return bundle + .write({ + file: outputFile, + format, + name, + globals: outputGlobals, + sourcemap: sourcemap, + }) + .then(() => { + if (!process.env.IS_PUBLISH) { + fancyLog( + chalk.yellow( + `Skipped minification of '${chalk.cyan( + path.relative(path.join(__dirname, ".."), outputFile) + )}' because not publishing` + ) + ); + return undefined; + } + fancyLog( + `Minifying '${chalk.cyan( + path.relative(path.join(__dirname, ".."), outputFile) + )}'...` + ); + + return bundle.write({ + file: outputFile.replace(/\.js$/, ".min.js"), + format, + name, + globals: outputGlobals, + sourcemap: sourcemap, + }); + }); }); - }); - }) + } + ) ); } -const bundles = ["packages/babel-parser"]; +const libBundles = [ + { + src: "packages/babel-parser", + format: "cjs", + dest: "lib", + version: require("./packages/babel-parser/package").version, + }, +]; + +const standaloneBundle = [ + { + src: "packages/babel-standalone", + format: "umd", + name: "Babel", + filename: "babel.js", + dest: "", + version: require("./packages/babel-core/package").version, + }, +]; + +const presetEnvStandaloneBundle = [ + { + src: "packages/babel-preset-env-standalone", + format: "umd", + name: "BabelPresetEnv", + filename: "babel-preset-env.js", + dest: "", + version: require("./packages/babel-preset-env/package").version, + }, +]; -gulp.task("build-rollup", () => buildRollup(bundles)); -gulp.task("build-babel", () => buildBabel(/* exclude */ bundles)); +gulp.task("build-rollup", () => buildRollup(libBundles)); +gulp.task("build-babel-standalone", () => buildRollup(standaloneBundle)); + +gulp.task("build-babel-preset-env-standalone", () => + buildRollup(presetEnvStandaloneBundle) +); + +gulp.task("build-babel", () => buildBabel(/* exclude */ libBundles)); +gulp.task("build-babel-types", () => + buildBabel(/* exclude */ libBundles, "packages/babel-types/src/**/*.js") +); gulp.task("build", gulp.parallel("build-rollup", "build-babel")); gulp.task("default", gulp.series("build")); @@ -128,47 +294,9 @@ gulp.task( "watch", gulp.series("build-no-bundle", function watch() { gulpWatch( - sources.map(getGlobFromSource), + defaultSourcesGlob, { debounceDelay: 200 }, gulp.task("build-no-bundle") ); }) ); - -registerStandalonePackageTask( - gulp, - "babel", - "Babel", - path.join(__dirname, "packages"), - require("./packages/babel-standalone/package.json").version -); - -const presetEnvWebpackPlugins = [ - new webpack.NormalModuleReplacementPlugin( - /\.\/available-plugins/, - require.resolve( - path.join( - __dirname, - "./packages/babel-preset-env-standalone/src/available-plugins" - ) - ) - ), - new webpack.NormalModuleReplacementPlugin( - /caniuse-lite\/data\/regions\/.+/, - require.resolve( - path.join( - __dirname, - "./packages/babel-preset-env-standalone/src/caniuse-lite-regions" - ) - ) - ), -]; - -registerStandalonePackageTask( - gulp, - "babel-preset-env", - "babelPresetEnv", - path.join(__dirname, "packages"), - require("./packages/babel-preset-env-standalone/package.json").version, - presetEnvWebpackPlugins -); diff --git a/Makefile b/Makefile index 5fa5cb0cfdbf..dfe03b547e9c 100644 --- a/Makefile +++ b/Makefile @@ -1,67 +1,129 @@ -MAKEFLAGS = -j1 -FLOW_COMMIT = 09669846b7a7ca5a6c23c12d56bb3bebdafd67e9 -TEST262_COMMIT = de567d3aa5de4eaa11e00131d26b9fe77997dfb0 +FLOW_COMMIT = a1f9a4c709dcebb27a5084acf47755fbae699c25 +TEST262_COMMIT = 28b4fcca4b1b1d278dfe0cc0e69c7d9d59b31aab +TYPESCRIPT_COMMIT = 5fc917be2e4dd64c8e9504d36615cd7fbfdd4cd3 + +FORCE_PUBLISH = "@babel/runtime,@babel/runtime-corejs2,@babel/runtime-corejs3,@babel/standalone,@babel/preset-env-standalone" # Fix color output until TravisCI fixes https://github.com/travis-ci/travis-ci/issues/7967 export FORCE_COLOR = true -SOURCES = packages codemods +SOURCES = packages codemods eslint + +COMMA := , +EMPTY := +SPACE := $(EMPTY) $(EMPTY) +COMMA_SEPARATED_SOURCES = $(subst $(SPACE),$(COMMA),$(SOURCES)) + +YARN := yarn --silent +NODE := $(YARN) node + .PHONY: build build-dist watch lint fix clean test-clean test-only test test-ci publish bootstrap -build: clean clean-lib - ./node_modules/.bin/gulp build - node ./packages/babel-standalone/scripts/generate.js - node ./packages/babel-types/scripts/generateTypeHelpers.js - # call build again as the generated files might need to be compiled again. - ./node_modules/.bin/gulp build - # generate flow and typescript typings - node packages/babel-types/scripts/generators/flow.js > ./packages/babel-types/lib/index.js.flow - node packages/babel-types/scripts/generators/typescript.js > ./packages/babel-types/lib/index.d.ts +build: build-bundle ifneq ("$(BABEL_COVERAGE)", "true") - make build-standalone - make build-preset-env-standalone + $(MAKE) build-standalone endif -build-standalone: - ./node_modules/.bin/gulp build-babel-standalone +build-bundle: clean clean-lib + $(YARN) gulp build + $(MAKE) generate-standalone generate-type-helpers + # call build again as the generated files might need to be compiled again. + $(YARN) gulp build + $(MAKE) build-typings + $(MAKE) build-dist + +build-bundle-ci: bootstrap-only + $(MAKE) build-bundle + +generate-standalone: + $(NODE) packages/babel-standalone/scripts/generate.js + +generate-type-helpers: + $(NODE) packages/babel-types/scripts/generateTypeHelpers.js + +build-typings: build-flow-typings build-typescript-typings + +build-flow-typings: + $(NODE) packages/babel-types/scripts/generators/flow.js > packages/babel-types/lib/index.js.flow + +build-typescript-typings: + $(NODE) packages/babel-types/scripts/generators/typescript.js > packages/babel-types/lib/index.d.ts + +build-standalone: build-babel-standalone build-preset-env-standalone + +build-standalone-ci: build-bundle-ci + $(MAKE) build-standalone + +build-babel-standalone: + $(YARN) gulp build-babel-standalone build-preset-env-standalone: - ./node_modules/.bin/gulp build-babel-preset-env-standalone + $(YARN) gulp build-babel-preset-env-standalone prepublish-build-standalone: - BABEL_ENV=production IS_PUBLISH=true ./node_modules/.bin/gulp build-babel-standalone + BABEL_ENV=production IS_PUBLISH=true $(YARN) gulp build-babel-standalone prepublish-build-preset-env-standalone: - BABEL_ENV=production IS_PUBLISH=true ./node_modules/.bin/gulp build-babel-preset-env-standalone + BABEL_ENV=production IS_PUBLISH=true $(YARN) gulp build-babel-preset-env-standalone -build-dist: build +build-dist: build-polyfill-dist build-plugin-transform-runtime-dist + +build-polyfill-dist: cd packages/babel-polyfill; \ scripts/build-dist.sh - cd packages/babel-plugin-transform-runtime; \ - node scripts/build-dist.js -watch: clean clean-lib +build-plugin-transform-runtime-dist: + cd packages/babel-plugin-transform-runtime; \ + $(NODE) scripts/build-dist.js +build-no-bundle: clean clean-lib + BABEL_ENV=development $(YARN) gulp build-no-bundle # Ensure that build artifacts for types are created during local # development too. - BABEL_ENV=development ./node_modules/.bin/gulp build-no-bundle - node ./packages/babel-types/scripts/generateTypeHelpers.js - node packages/babel-types/scripts/generators/flow.js > ./packages/babel-types/lib/index.js.flow - node packages/babel-types/scripts/generators/typescript.js > ./packages/babel-types/lib/index.d.ts - BABEL_ENV=development ./node_modules/.bin/gulp watch + $(MAKE) generate-type-helpers + $(MAKE) build-typings + +watch: build-no-bundle + BABEL_ENV=development $(YARN) gulp watch + +code-quality-ci: flowcheck-ci lint-ci + +flowcheck-ci: bootstrap-flowcheck + $(MAKE) flow + +code-quality: flow lint flow: - ./node_modules/.bin/flow check --strip-root + $(YARN) flow check --strip-root + +bootstrap-flowcheck: bootstrap-only + $(YARN) gulp build-babel-types + $(MAKE) build-typings + +lint-ci: lint-js-ci lint-ts-ci + +lint-js-ci: bootstrap-only + $(MAKE) lint-js + +lint-ts-ci: bootstrap-flowcheck + $(MAKE) lint-ts -lint: - ./node_modules/.bin/eslint scripts $(SOURCES) '*.js' --format=codeframe +lint: lint-js lint-ts -fix: fix-json - ./node_modules/.bin/eslint scripts $(SOURCES) '*.js' --format=codeframe --fix +lint-js: + $(YARN) eslint scripts $(SOURCES) '*.js' --format=codeframe + +lint-ts: + scripts/lint-ts-typings.sh + +fix: fix-json fix-js + +fix-js: + $(YARN) eslint scripts $(SOURCES) '*.js' --format=codeframe --fix fix-json: - ./node_modules/.bin/prettier "{packages,codemod}/*/test/fixtures/**/options.json" --write --loglevel warn + $(YARN) prettier "{$(COMMA_SEPARATED_SOURCES)}/*/test/fixtures/**/options.json" --write --loglevel warn clean: test-clean rm -f .npmrc @@ -74,72 +136,92 @@ test-clean: $(foreach source, $(SOURCES), \ $(call clean-source-test, $(source))) +# Does not work on Windows; use "$(YARN) jest" instead test-only: BABEL_ENV=test ./scripts/test.sh - make test-clean + $(MAKE) test-clean test: lint test-only -test-ci: bootstrap test-only +test-ci: jest-ci + +jest-ci: build-standalone-ci + BABEL_ENV=test $(YARN) jest --maxWorkers=4 --ci + $(MAKE) test-clean +# Does not work on Windows test-ci-coverage: SHELL:=/bin/bash test-ci-coverage: - BABEL_COVERAGE=true BABEL_ENV=test make bootstrap + BABEL_COVERAGE=true BABEL_ENV=test $(MAKE) bootstrap BABEL_ENV=test TEST_TYPE=cov ./scripts/test-cov.sh bash <(curl -s https://codecov.io/bash) -f coverage/coverage-final.json bootstrap-flow: - rm -rf ./build/flow - mkdir -p ./build - git clone --branch=master --single-branch --shallow-since=2018-11-01 https://github.com/facebook/flow.git ./build/flow + rm -rf build/flow + mkdir -p build + git clone --branch=master --single-branch --shallow-since=2018-11-01 https://github.com/facebook/flow.git build/flow cd build/flow && git checkout $(FLOW_COMMIT) test-flow: - node scripts/tests/flow/run_babel_parser_flow_tests.js + $(NODE) scripts/parser-tests/flow -test-flow-ci: bootstrap test-flow +test-flow-ci: build-bundle-ci bootstrap-flow + $(MAKE) test-flow test-flow-update-whitelist: - node scripts/tests/flow/run_babel_parser_flow_tests.js --update-whitelist + $(NODE) scripts/parser-tests/flow --update-whitelist -bootstrap-test262: - rm -rf ./build/test262 +bootstrap-typescript: + rm -rf ./build/typescript mkdir -p ./build - git clone --branch=master --single-branch --shallow-since=2019-01-01 https://github.com/tc39/test262.git ./build/test262 + git clone --branch=master --single-branch --shallow-since=2019-09-01 https://github.com/microsoft/TypeScript.git ./build/typescript + cd build/typescript && git checkout $(TYPESCRIPT_COMMIT) + +test-typescript: + $(NODE) scripts/parser-tests/typescript + +test-typescript-ci: build-bundle-ci bootstrap-typescript + $(MAKE) test-typescript + +test-typescript-update-whitelist: + $(NODE) scripts/parser-tests/typescript --update-whitelist + +bootstrap-test262: + rm -rf build/test262 + mkdir -p build + git clone --branch=master --single-branch --shallow-since=2019-12-01 https://github.com/tc39/test262.git build/test262 cd build/test262 && git checkout $(TEST262_COMMIT) test-test262: - node scripts/tests/test262/run_babel_parser_test262.js + $(NODE) scripts/parser-tests/test262 -test-test262-ci: bootstrap test-test262 +test-test262-ci: build-bundle-ci bootstrap-test262 + $(MAKE) test-test262 test-test262-update-whitelist: - node scripts/tests/test262/run_babel_parser_test262.js --update-whitelist + $(NODE) scripts/parser-tests/test262 --update-whitelist +# Does not work on Windows clone-license: ./scripts/clone-license.sh -prepublish-build: - make clean-lib - rm -rf packages/babel-runtime/helpers - rm -rf packages/babel-runtime-corejs2/helpers - rm -rf packages/babel-runtime-corejs2/core-js - NODE_ENV=production BABEL_ENV=production make build-dist - make clone-license +prepublish-build: clean-lib clean-runtime-helpers + NODE_ENV=production BABEL_ENV=production $(MAKE) build + $(MAKE) clone-license prepublish: - make bootstrap-only - make prepublish-build - make test + $(MAKE) bootstrap-only + $(MAKE) prepublish-build + IS_PUBLISH=true $(MAKE) test new-version: git pull --rebase - ./node_modules/.bin/lerna version --force-publish="@babel/runtime,@babel/runtime-corejs2,@babel/runtime-corejs3,@babel/standalone,@babel/preset-env-standalone" + $(YARN) lerna version --force-publish=$(FORCE_PUBLISH) # NOTE: Run make new-version first publish: prepublish - ./node_modules/.bin/lerna publish from-git --require-scripts - make clean + $(YARN) lerna publish from-git + $(MAKE) clean publish-ci: prepublish ifneq ("$(NPM_TOKEN)", "") @@ -148,22 +230,48 @@ else echo "Missing NPM_TOKEN env var" exit 1 endif - ./node_modules/.bin/lerna publish from-git --require-scripts --yes + $(YARN) lerna publish from-git --yes rm -f .npmrc - make clean + $(MAKE) clean -bootstrap-only: clean-all +publish-test: +ifneq ("$(I_AM_USING_VERDACCIO)", "I_AM_SURE") + echo "You probably don't know what you are doing" + exit 1 +endif + $(MAKE) prepublish-build + $(YARN) lerna version patch --force-publish=$(FORCE_PUBLISH) --no-push --yes --tag-version-prefix="version-e2e-test-" + $(YARN) lerna publish from-git --registry http://localhost:4873 --yes --tag-version-prefix="version-e2e-test-" + $(MAKE) clean + +publish-eslint: + $(call set-json-field, ./eslint/$(PKG)/package.json, private, false) + cd eslint/$(PKG); yarn publish + $(call set-json-field, ./eslint/$(PKG)/package.json, private, true) + +bootstrap-only: lerna-bootstrap + +yarn-install: clean-all yarn --ignore-engines - ./node_modules/.bin/lerna bootstrap -- --ignore-engines + +lerna-bootstrap: yarn-install +# todo: remove `-- -- --ignore-engines` in Babel 8 + $(YARN) lerna bootstrap -- -- --ignore-engines bootstrap: bootstrap-only - make build - cd packages/babel-plugin-transform-runtime; \ - node scripts/build-dist.js + $(MAKE) build clean-lib: + # TODO: Don't delete eslint/*/lib when they use src $(foreach source, $(SOURCES), \ - $(call clean-source-lib, $(source))) + $(if $(filter-out $(source), eslint), \ + $(call clean-source-lib, $(source)))) + +clean-runtime-helpers: + rm -f packages/babel-runtime/helpers/**/*.js + rm -f packages/babel-runtime-corejs2/helpers/**/*.js + rm -f packages/babel-runtime-corejs3/helpers/**/*.js + rm -rf packages/babel-runtime-corejs2/core-js clean-all: rm -rf node_modules @@ -173,7 +281,13 @@ clean-all: $(foreach source, $(SOURCES), \ $(call clean-source-all, $(source))) - make clean + $(MAKE) clean + +update-env-corejs-fixture: + rm -rf packages/babel-preset-env/node_modules/core-js-compat + $(YARN) lerna bootstrap + $(MAKE) build-bundle + OVERWRITE=true $(YARN) jest packages/babel-preset-env define clean-source-lib rm -rf $(1)/*/lib @@ -187,8 +301,16 @@ define clean-source-test endef define clean-source-all - rm -rf $(1)/*/lib + # TODO: Don't delete eslint/*/lib when they use src + $(if $(filter-out $1, eslint), $(call clean-source-lib, $1)) rm -rf $(1)/*/node_modules rm -rf $(1)/*/package-lock.json endef + +define set-json-field + $(NODE) -e "\ + require('fs').writeFileSync('$1'.trim(), \ + JSON.stringify({ ...require('$1'.trim()), $2: $3 }, null, 2) + '\\n' \ + )" +endef diff --git a/README.md b/README.md index 579b85a7cd88..0b17712e2e75 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ v6 npm Downloads

- Travis Status + Travis Status CircleCI Status Coverage Status Slack Status @@ -80,14 +80,14 @@ Try it out at our [REPL](https://babeljs.io/repl/build/master#?code_lz=NoRgNATGD Mostly a handful of volunteers, funded by you! Please check out our [team page](https://babeljs.io/team)! -### Looking for support? - -For questions and support please join our [Slack Community](https://slack.babeljs.io/) (you can sign-up [here](https://slack.babeljs.io/) for an invite), ask a question on [Stack Overflow](https://stackoverflow.com/questions/tagged/babeljs), or ping us on [Twitter](https://twitter.com/babeljs). - ### Is there a Babel song? I'm so glad you asked: [Hallelujah —— In Praise of Babel](SONG.md) by [@angus-c](https://github.com/angus-c), [audio version](https://youtu.be/40abpedBKK8) by [@swyx](https://twitter.com/@swyx). Tweet us your recordings! +### Looking for support? + +For questions and support please join our [Slack Community](https://slack.babeljs.io/) (you can sign-up [here](https://slack.babeljs.io/) for an invite), ask a question on [Stack Overflow](https://stackoverflow.com/questions/tagged/babeljs), or ping us on [Twitter](https://twitter.com/babeljs). + ### Where are the docs? Check out our website: [babeljs.io](https://babeljs.io/), and report issues/features at [babel/website](https://github.com/babel/website/issues). @@ -98,12 +98,19 @@ Please read through our [CONTRIBUTING.md](CONTRIBUTING.md) and fill out the issu ### Want to contribute to Babel? -Check out our [CONTRIBUTING.md](CONTRIBUTING.md) to get started with setting up the repo. +Check out: + +- Our [#development](https://babeljs.slack.com/messages/development) Slack channel and say hi ([signup](https://slack.babeljs.io))! +- Issues with the [good first issue](https://github.com/babel/babel/labels/good%20first%20issue) and [help wanted](https://github.com/babel/babel/labels/help%20wanted) label. We suggest also looking at the [closed ones](https://github.com/babel/babel/issues?utf8=%E2%9C%93&q=is%3Aclosed+label%3A%22good+first+issue%22) to get a sense of the kinds of issues you can tackle. + +Some resources: -- If you have already joined Slack, join our [#development](https://babeljs.slack.com/messages/development) channel and say hi! -- Check out the issues with the [good first issue](https://github.com/babel/babel/labels/good%20first%20issue) and [help wanted](https://github.com/babel/babel/labels/help%20wanted) label. We suggest also looking at the closed ones to get a sense of the kinds of issues you can tackle. +- Our [CONTRIBUTING.md](CONTRIBUTING.md) to get started with setting up the repo. - Our discussions/notes/roadmap: [babel/notes](https://github.com/babel/notes) - Our progress on TC39 proposals: [babel/proposals](https://github.com/babel/proposals) +- Our blog which contains release posts and explanations: [/blog](https://babeljs.io/blog) +- Our videos page with talks about open source and Babel: [/videos](https://babeljs.io/videos) +- Our [podcast](https://podcast.babeljs.io) ### How is the repo structured? diff --git a/babel.config.js b/babel.config.js index 82966a7f07ca..ae2cb5a99cb3 100644 --- a/babel.config.js +++ b/babel.config.js @@ -14,22 +14,38 @@ module.exports = function(api) { let convertESM = true; let ignoreLib = true; - let includeRuntime = false; + let includeRegeneratorRuntime = false; + + let transformRuntimeOptions; + const nodeVersion = "6.9"; + // The vast majority of our src files are modules, but we use + // unambiguous to keep things simple until we get around to renaming + // the modules to be more easily distinguished from CommonJS + const unambiguousSources = [ + "packages/*/src", + "packages/*/test", + "codemods/*/src", + "codemods/*/test", + "eslint/*/src", + "eslint/*/test", + ]; switch (env) { // Configs used during bundling builds. - case "babel-parser": - convertESM = false; - ignoreLib = false; - envOpts.targets = { - node: nodeVersion, - }; - break; case "standalone": + includeRegeneratorRuntime = true; + unambiguousSources.push("packages/babel-runtime/regenerator"); + case "rollup": convertESM = false; ignoreLib = false; - includeRuntime = true; + // rollup-commonjs will converts node_modules to ESM + unambiguousSources.push( + "**/node_modules", + "packages/babel-preset-env/data", + "packages/babel-compat-data" + ); + if (env === "rollup") envOpts.targets = { node: nodeVersion }; break; case "production": // Config during builds before publish. @@ -50,6 +66,16 @@ module.exports = function(api) { break; } + if (includeRegeneratorRuntime) { + const babelRuntimePkgPath = require.resolve("@babel/runtime/package.json"); + + transformRuntimeOptions = { + helpers: false, // Helpers are handled by rollup when needed + regenerator: true, + version: require(babelRuntimePkgPath).version, + }; + } + const config = { // Our dependencies are all standard CommonJS, along with all sorts of // other random files in Babel's codebase, so we use script as the default, @@ -77,9 +103,14 @@ module.exports = function(api) { "@babel/proposal-object-rest-spread", { useBuiltIns: true, loose: true }, ], + ["@babel/plugin-proposal-optional-chaining", { loose: true }], + ["@babel/plugin-proposal-nullish-coalescing-operator", { loose: true }], - // Explicitly use the lazy version of CommonJS modules. - convertESM ? ["@babel/transform-modules-commonjs", { lazy: true }] : null, + convertESM ? "@babel/transform-modules-commonjs" : null, + // Until Jest supports native mjs, we must simulate it 🤷 + env === "test" || env === "development" + ? "@babel/plugin-proposal-dynamic-import" + : null, ].filter(Boolean), overrides: [ { @@ -90,42 +121,25 @@ module.exports = function(api) { ], }, { - test: "./packages/babel-register", + test: ["./packages/babel-cli", "./packages/babel-core"], plugins: [ - // Override the root options to disable lazy imports for babel-register - // because otherwise the require hook will try to lazy-import things - // leading to dependency cycles. - convertESM ? "@babel/transform-modules-commonjs" : null, + // Explicitly use the lazy version of CommonJS modules. + convertESM + ? ["@babel/transform-modules-commonjs", { lazy: true }] + : null, ].filter(Boolean), }, { test: "./packages/babel-polyfill", presets: [["@babel/env", envOptsNoTargets]], - plugins: [["@babel/transform-modules-commonjs", { lazy: false }]], }, { - // The vast majority of our src files are modules, but we use - // unambiguous to keep things simple until we get around to renaming - // the modules to be more easily distinguished from CommonJS - test: [ - "packages/*/src", - "packages/*/test", - "codemods/*/src", - "codemods/*/test", - ], + test: unambiguousSources, sourceType: "unambiguous", }, - { - // The runtime transform shouldn't process its own runtime or core-js. - exclude: [ - "packages/babel-runtime", - /[\\/]node_modules[\\/](?:@babel\/runtime|babel-runtime|core-js)[\\/]/, - ], - plugins: [ - includeRuntime - ? ["@babel/transform-runtime", { version: "7.4.4" }] - : null, - ].filter(Boolean), + includeRegeneratorRuntime && { + exclude: /regenerator-runtime/, + plugins: [["@babel/transform-runtime", transformRuntimeOptions]], }, ].filter(Boolean), }; diff --git a/codecov.yml b/codecov.yml index ed4545a1bf7d..17d3dfb026d0 100644 --- a/codecov.yml +++ b/codecov.yml @@ -5,7 +5,7 @@ coverage: status: project: default: - target: "80%" + target: "90%" patch: enabled: false ignore: diff --git a/codemods/babel-plugin-codemod-object-assign-to-object-spread/package.json b/codemods/babel-plugin-codemod-object-assign-to-object-spread/package.json index 747fa0fe68e7..e432a89a4486 100644 --- a/codemods/babel-plugin-codemod-object-assign-to-object-spread/package.json +++ b/codemods/babel-plugin-codemod-object-assign-to-object-spread/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-codemod-object-assign-to-object-spread", - "version": "7.0.0", + "version": "7.7.4", "description": "Transforms Object.assign into object spread syntax", "repository": "https://github.com/babel/babel/tree/master/codemods/babel-plugin-codemod-object-assign-to-object-spread", "license": "MIT", @@ -13,16 +13,13 @@ "@babel/plugin" ], "dependencies": { - "@babel/plugin-syntax-object-rest-spread": "^7.0.0" + "@babel/plugin-syntax-object-rest-spread": "^7.7.4" }, "peerDependencies": { "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.0.0", - "@babel/helper-plugin-test-runner": "^7.0.0" - }, - "publishConfig": { - "access": "public" + "@babel/core": "^7.7.4", + "@babel/helper-plugin-test-runner": "^7.7.4" } } diff --git a/codemods/babel-plugin-codemod-optional-catch-binding/package.json b/codemods/babel-plugin-codemod-optional-catch-binding/package.json index 45913353021c..68196e27c1ba 100644 --- a/codemods/babel-plugin-codemod-optional-catch-binding/package.json +++ b/codemods/babel-plugin-codemod-optional-catch-binding/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-codemod-optional-catch-binding", - "version": "7.0.0", + "version": "7.7.4", "description": "Remove unused catch bindings", "repository": "https://github.com/babel/babel/tree/master/codemods/babel-plugin-codemod-remove-unused-catch-binding", "license": "MIT", @@ -13,13 +13,13 @@ "@babel/plugin" ], "dependencies": { - "@babel/plugin-syntax-optional-catch-binding": "^7.0.0" + "@babel/plugin-syntax-optional-catch-binding": "^7.7.4" }, "peerDependencies": { "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.0.0", - "@babel/helper-plugin-test-runner": "^7.0.0" + "@babel/core": "^7.7.4", + "@babel/helper-plugin-test-runner": "^7.7.4" } } diff --git a/codemods/babel-plugin-codemod-optional-catch-binding/test/fixtures/codemod-optional-catch-binding/try-catch-finally-used-binding/options.json b/codemods/babel-plugin-codemod-optional-catch-binding/test/fixtures/codemod-optional-catch-binding/try-catch-finally-used-binding/options.json index 0587911559c4..cbe0e9893752 100644 --- a/codemods/babel-plugin-codemod-optional-catch-binding/test/fixtures/codemod-optional-catch-binding/try-catch-finally-used-binding/options.json +++ b/codemods/babel-plugin-codemod-optional-catch-binding/test/fixtures/codemod-optional-catch-binding/try-catch-finally-used-binding/options.json @@ -1,3 +1,3 @@ { - "plugins": ["../../../../lib"] - } + "plugins": ["../../../../lib"] +} diff --git a/doc/design/monorepo.md b/doc/design/monorepo.md index d10cc9741b76..0460dcd82b73 100644 --- a/doc/design/monorepo.md +++ b/doc/design/monorepo.md @@ -15,7 +15,7 @@ This is quite taboo but let's look at the pros and cons: * Easy to coordinate changes across modules. * Single place to report issues. * Easier to setup a development environment. - * Tests across modules are run together which finds bugs that touch multiple modules easier. + * Tests across modules are run together which finds bugs that touch multiple modules more easily. **Cons:** diff --git a/eslint/babel-eslint-config-internal/.npmignore b/eslint/babel-eslint-config-internal/.npmignore new file mode 100644 index 000000000000..ad69326ce8c2 --- /dev/null +++ b/eslint/babel-eslint-config-internal/.npmignore @@ -0,0 +1,4 @@ +src +test +.* +*.log diff --git a/eslint/babel-eslint-config-internal/README.md b/eslint/babel-eslint-config-internal/README.md new file mode 100644 index 000000000000..20d79ebc44bb --- /dev/null +++ b/eslint/babel-eslint-config-internal/README.md @@ -0,0 +1,4 @@ +## @babel/eslint-config-internal +--- + +ESLint config for the Babel codebase (originally taken from `eslint-config-kittens`) diff --git a/eslint/babel-eslint-config-internal/index.js b/eslint/babel-eslint-config-internal/index.js new file mode 100644 index 000000000000..752207e50245 --- /dev/null +++ b/eslint/babel-eslint-config-internal/index.js @@ -0,0 +1,49 @@ +"use strict"; + +module.exports = { + parser: "babel-eslint", + extends: "eslint:recommended", + plugins: ["flowtype"], + parserOptions: { + ecmaVersion: 2020, + sourceType: "module", + }, + globals: { + // Flow + Iterator: true, + $Keys: true, + }, + env: { + node: true, + es2020: true, + browser: true, + }, + rules: { + camelcase: "off", + "consistent-return": "off", + curly: ["error", "multi-line"], + "linebreak-style": ["error", "unix"], + "new-cap": "off", + "no-case-declarations": "error", + "no-cond-assign": "off", + "no-confusing-arrow": "error", + "no-console": "off", + "no-constant-condition": "off", + "no-empty": "off", + "no-fallthrough": "off", + "no-inner-declarations": "off", + "no-labels": "off", + "no-loop-func": "off", + "no-process-exit": "off", + "no-return-assign": "off", + "no-shadow": "off", + "no-underscore-dangle": "off", + "no-unreachable": "off", + "no-use-before-define": "off", + "no-var": "error", + "prefer-const": "error", + strict: "off", + "flowtype/define-flow-type": "warn", + "flowtype/use-flow-type": "warn", + }, +}; diff --git a/eslint/babel-eslint-config-internal/package.json b/eslint/babel-eslint-config-internal/package.json new file mode 100644 index 000000000000..37a02b8826ab --- /dev/null +++ b/eslint/babel-eslint-config-internal/package.json @@ -0,0 +1,15 @@ +{ + "name": "@babel/eslint-config-internal", + "version": "0.0.0", + "description": "The Babel Team's ESLint configuration. Since it's internal, it might not respect semver.", + "author": "Sebastian McKenzie ", + "homepage": "https://babeljs.io/", + "license": "MIT", + "private": true, + "repository": "https://github.com/babel/babel/tree/master/eslint/babel-eslint-config-internal", + "main": "lib/index.js", + "peerDependencies": { + "babel-eslint": "^10.0.0 || ^11.0.0-0", + "eslint-plugin-flowtype": "^3.0.0" + } +} diff --git a/eslint/babel-eslint-parser/.npmignore b/eslint/babel-eslint-parser/.npmignore new file mode 100644 index 000000000000..c3aafe7a7721 --- /dev/null +++ b/eslint/babel-eslint-parser/.npmignore @@ -0,0 +1,4 @@ +src +test +.* +*.log \ No newline at end of file diff --git a/eslint/babel-eslint-parser/README.md b/eslint/babel-eslint-parser/README.md new file mode 100644 index 000000000000..5d27fc7211eb --- /dev/null +++ b/eslint/babel-eslint-parser/README.md @@ -0,0 +1,124 @@ +# @babel/eslint-parser [![npm](https://img.shields.io/npm/v/@babel/eslint-parser.svg)](https://www.npmjs.com/package/@babel/eslint-parser) [![travis](https://img.shields.io/travis/babel/@babel/eslint-parser/master.svg)](https://travis-ci.org/babel/@babel/eslint-parser) [![npm-downloads](https://img.shields.io/npm/dm/@babel/eslint-parser.svg)](https://www.npmjs.com/package/@babel/eslint-parser) + +**@babel/eslint-parser** allows you to lint **ALL** valid Babel code with the fantastic +[ESLint](https://github.com/eslint/eslint). + +## When should I use @babel/eslint-parser? + +ESLint's default parser and core rules [only support the latest final ECMAScript standard](https://github.com/eslint/eslint/blob/a675c89573836adaf108a932696b061946abf1e6/README.md#what-about-experimental-features) and do not support experimental (such as new features) and non-standard (such as Flow or TypeScript types) syntax provided by Babel. @babel/eslint-parser is a parser that allows ESLint to run on source code that is transformed by Babel. + +**Note:** You only need to use @babel/parser-eslint if you are using Babel to transform your code. If this is not the case, please use the relevant parser for your chosen flavor of ECMAScript (note that the default parser supports all non-experimental syntax as well as JSX). + +## How does it work? + +ESLint allows for the use of [custom parsers](https://eslint.org/docs/developer-guide/working-with-custom-parsers). When using this plugin, your code is parsed by Babel's parser (using the configuration specified in your [Babel configuration file](https://babeljs.io/docs/en/configuration)) and the resulting AST is +transformed into an [ESTree](https://github.com/estree/estree)-compliant structure that ESLint can understand. All location info such as line numbers, +columns is also retained so you can track down errors with ease. + +**Note:** ESLint's core rules do not support experimental syntax and may therefore not work as expected when using `@babel/eslint-parser`. Please use the companion [`@babel/eslint-plugin`](https://github.com/babel/babel/tree/master/eslint/babel-eslint-plugin) plugin for core rules that you have issues with. + +## Usage + +### Installation + +```sh +$ npm install eslint @babel/core @babel/eslint-parser --save-dev +# or +$ yarn add eslint @babel/core @babel/eslint-parser -D +``` + +**Note:** @babel/eslint-parser requires `@babel/core@>=7.2.0` and a valid Babel configuration file to run. If you do not have this already set up, please see the [Babel Usage Guide](https://babeljs.io/docs/en/usage). + +### Setup + +To use @babel/eslint-parser, `"@babel/eslint-parser"` must be specified as the `parser` in your ESLint configuration file (see [here](https://eslint.org/docs/user-guide/configuring#specifying-parser) for more detailed information). + +**.eslintrc.js** + +```js +module.exports = { + parser: "@babel/eslint-parser", +}; +``` + +With the parser set, your configuration can be configured as described in the [Configuring ESLint](https://eslint.org/docs/user-guide/configuring) documentation. + +**Note:** The `parserOptions` described in the [official documentation](https://eslint.org/docs/user-guide/configuring#specifying-parser-options) are for the default parser and are not necessarily supported by @babel/eslint-parser. Please see the section directly below for supported `parserOptions`. + +### Additional parser configuration + +Additional configuration options can be set in your ESLint configuration under the `parserOptions` key. Please note that the `ecmaFeatures` config property may still be required for ESLint to work properly with features not in ECMAScript 5 by default. + +- `requireConfigFile` (default `true`) can be set to `false` to allow @babel/eslint-parser to run on files that do not have a Babel configuration associated with them. This can be useful for linting files that are not transformed by Babel (such as tooling configuration files), though we recommend using the default parser via [glob-based configuration](https://eslint.org/docs/user-guide/configuring#configuration-based-on-glob-patterns). Note: @babel/eslint-parser will not parse any experimental syntax when no configuration file is found. +- `sourceType` can be set to `"module"`(default) or `"script"` if your code isn't using ECMAScript modules. +- `allowImportExportEverywhere` (default `false`) can be set to `true` to allow import and export declarations to appear anywhere a statement is allowed if your build environment supports that. Otherwise import and export declarations can only appear at a program's top level. +- `ecmaFeatures.globalReturn` (default `false`) allow return statements in the global scope when used with `sourceType: "script"`. +- `babelOptions` passes through Babel's configuration [loading](https://babeljs.io/docs/en/options#config-loading-options) and [merging](https://babeljs.io/docs/en/options#config-merging-options) options (for instance, in case of a monorepo). When not defined, @babel/eslint-parser will use Babel's default configuration file resolution logic. + +**.eslintrc.js** + +```js +module.exports = { + parser: "@babel/eslint-parser", + parserOptions: { + sourceType: "module", + allowImportExportEverywhere: false, + ecmaFeatures: { + globalReturn: false, + }, + babelOptions: { + configFile: "path/to/config.js", + }, + }, +}; +``` + +**.eslintrc.js using glob-based configuration** + +This configuration would use the default parser for all files except for those found by the `"files/transformed/by/babel/*.js"` glob. + +```js +module.exports = { + rules: { + indent: "error" + }, + overrides: [ + { + files: ["files/transformed/by/babel/*.js"], + parser: "@babel/eslint-parser", + } + ] +}; +``` + +### Run + +```sh +$ ./node_modules/.bin/eslint yourfile.js +``` + +## Known issues + +Flow: + +> Check out [eslint-plugin-flowtype](https://github.com/gajus/eslint-plugin-flowtype): An `eslint` plugin that makes flow type annotations global variables and marks declarations as used. Solves the problem of false positives with `no-undef` and `no-unused-vars`. + +- `no-undef` for global flow types: `ReactElement`, `ReactClass` [#130](https://github.com/babel/@babel/eslint-parser/issues/130#issuecomment-111215076) + - Workaround: define types as globals in `.eslintrc` or define types and import them `import type ReactElement from './types'` +- `no-unused-vars/no-undef` with Flow declarations (`declare module A {}`) [#132](https://github.com/babel/@babel/eslint-parser/issues/132#issuecomment-112815926) + +Modules/strict mode + +- `no-unused-vars: ["error", { vars: local }]` [#136](https://github.com/babel/@babel/eslint-parser/issues/136) + +Please check out [eslint-plugin-react](https://github.com/yannickcr/eslint-plugin-react) for React/JSX issues. + +- `no-unused-vars` with jsx + +Please check out [eslint-plugin-babel](https://github.com/babel/eslint-plugin-babel) for other issues. + +## Questions and support + +If you have an issue, please first check if it can be reproduced with the default parser and with the latest versions of `eslint` and `@babel/eslint-parser`. If it is not reproducible with the default parser, it is most likely an issue with `@babel/eslint-parser`. + +For questions and support please visit the [`#discussion`](https://babeljs.slack.com/messages/discussion/) Babel Slack channel (sign up [here](https://github.com/babel/notes/issues/38)) or the ESLint [Gitter](https://gitter.im/eslint/eslint). diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json new file mode 100644 index 000000000000..bf3ea3e45b05 --- /dev/null +++ b/eslint/babel-eslint-parser/package.json @@ -0,0 +1,37 @@ +{ + "name": "@babel/eslint-parser", + "version": "0.0.0", + "description": "ESLint parser that allows for linting of experimental syntax transformed by Babel", + "author": "Sebastian McKenzie ", + "license": "MIT", + "private": true, + "repository": { + "type": "git", + "url": "https://github.com/babel/babel.git", + "directory": "eslint/babel-eslint-parser" + }, + "bugs": { + "url": "https://github.com/babel/babel/issues" + }, + "homepage": "https://github.com/babel/babel/tree/master/eslint/babel-eslint-parser", + "engines": { + "node": ">=10.9" + }, + "main": "lib/index.js", + "peerDependencies": { + "@babel/core": ">=7.2.0", + "eslint": ">=6.0.0" + }, + "dependencies": { + "eslint-scope": "5.0.0", + "eslint-visitor-keys": "^1.1.0", + "semver": "^6.3.0" + }, + "devDependencies": { + "@babel/eslint-shared-fixtures": "*", + "@babel/core": "^7.2.0", + "dedent": "^0.7.0", + "eslint": "^6.0.1", + "espree": "^6.0.0" + } +} diff --git a/eslint/babel-eslint-parser/src/analyze-scope.js b/eslint/babel-eslint-parser/src/analyze-scope.js new file mode 100644 index 000000000000..ffb9eb95ba82 --- /dev/null +++ b/eslint/babel-eslint-parser/src/analyze-scope.js @@ -0,0 +1,344 @@ +import { types as t } from "@babel/core"; +import escope from "eslint-scope"; +import { Definition } from "eslint-scope/lib/definition"; +import OriginalPatternVisitor from "eslint-scope/lib/pattern-visitor"; +import OriginalReferencer from "eslint-scope/lib/referencer"; +import { getKeys as fallback } from "eslint-visitor-keys"; +import childVisitorKeys from "./visitor-keys"; + +const flowFlippedAliasKeys = t.FLIPPED_ALIAS_KEYS.Flow.concat([ + "ArrayPattern", + "ClassDeclaration", + "ClassExpression", + "FunctionDeclaration", + "FunctionExpression", + "Identifier", + "ObjectPattern", + "RestElement", +]); + +const visitorKeysMap = Object.entries(t.VISITOR_KEYS).reduce( + (acc, [key, value]) => { + if (!flowFlippedAliasKeys.includes(value)) { + acc[key] = value; + } + return acc; + }, + {}, +); + +const propertyTypes = { + // loops + callProperties: { type: "loop", values: ["value"] }, + indexers: { type: "loop", values: ["key", "value"] }, + properties: { type: "loop", values: ["argument", "value"] }, + types: { type: "loop" }, + params: { type: "loop" }, + // single property + argument: { type: "single" }, + elementType: { type: "single" }, + qualification: { type: "single" }, + rest: { type: "single" }, + returnType: { type: "single" }, + // others + typeAnnotation: { type: "typeAnnotation" }, + typeParameters: { type: "typeParameters" }, + id: { type: "id" }, +}; + +class PatternVisitor extends OriginalPatternVisitor { + ArrayPattern(node) { + node.elements.forEach(this.visit, this); + } + + ObjectPattern(node) { + node.properties.forEach(this.visit, this); + } +} + +class Referencer extends OriginalReferencer { + // inherits. + visitPattern(node, options, callback) { + if (!node) { + return; + } + + // Visit type annotations. + this._checkIdentifierOrVisit(node.typeAnnotation); + if (t.isAssignmentPattern(node)) { + this._checkIdentifierOrVisit(node.left.typeAnnotation); + } + + // Overwrite `super.visitPattern(node, options, callback)` in order to not visit `ArrayPattern#typeAnnotation` and `ObjectPattern#typeAnnotation`. + if (typeof options === "function") { + callback = options; + options = { processRightHandNodes: false }; + } + + const visitor = new PatternVisitor(this.options, node, callback); + visitor.visit(node); + + // Process the right hand nodes recursively. + if (options.processRightHandNodes) { + visitor.rightHandNodes.forEach(this.visit, this); + } + } + + // inherits. + visitClass(node) { + // Decorators. + this._visitArray(node.decorators); + + // Flow type parameters. + const typeParamScope = this._nestTypeParamScope(node); + + // Flow super types. + this._visitTypeAnnotation(node.implements); + this._visitTypeAnnotation( + node.superTypeParameters && node.superTypeParameters.params, + ); + + // Basic. + super.visitClass(node); + + // Close the type parameter scope. + if (typeParamScope) { + this.close(node); + } + } + + // inherits. + visitFunction(node) { + const typeParamScope = this._nestTypeParamScope(node); + + // Flow return types. + this._checkIdentifierOrVisit(node.returnType); + + // Basic. + super.visitFunction(node); + + // Close the type parameter scope. + if (typeParamScope) { + this.close(node); + } + } + + // inherits. + visitProperty(node) { + if (node.value?.type === "TypeCastExpression") { + this._visitTypeAnnotation(node.value); + } + this._visitArray(node.decorators); + super.visitProperty(node); + } + + InterfaceDeclaration(node) { + this._createScopeVariable(node, node.id); + + const typeParamScope = this._nestTypeParamScope(node); + + // TODO: Handle mixins + this._visitArray(node.extends); + this.visit(node.body); + + if (typeParamScope) { + this.close(node); + } + } + + TypeAlias(node) { + this._createScopeVariable(node, node.id); + + const typeParamScope = this._nestTypeParamScope(node); + + this.visit(node.right); + + if (typeParamScope) { + this.close(node); + } + } + + ClassProperty(node) { + this._visitClassProperty(node); + } + + ClassPrivateProperty(node) { + this._visitClassProperty(node); + } + + // TODO: Update to visit type annotations when TypeScript/Flow support this syntax. + ClassPrivateMethod(node) { + super.MethodDefinition(node); + } + + DeclareModule(node) { + this._visitDeclareX(node); + } + + DeclareFunction(node) { + this._visitDeclareX(node); + } + + DeclareVariable(node) { + this._visitDeclareX(node); + } + + DeclareClass(node) { + this._visitDeclareX(node); + } + + // visit OptionalMemberExpression as a MemberExpression. + OptionalMemberExpression(node) { + super.MemberExpression(node); + } + + _visitClassProperty(node) { + this._visitTypeAnnotation(node.typeAnnotation); + this.visitProperty(node); + } + + _visitDeclareX(node) { + if (node.id) { + this._createScopeVariable(node, node.id); + } + + const typeParamScope = this._nestTypeParamScope(node); + if (typeParamScope) { + this.close(node); + } + } + + _createScopeVariable(node, name) { + this.currentScope().variableScope.__define( + name, + new Definition("Variable", name, node, null, null, null), + ); + } + + _nestTypeParamScope(node) { + if (!node.typeParameters) { + return null; + } + + const parentScope = this.scopeManager.__currentScope; + const scope = new escope.Scope( + this.scopeManager, + "type-parameters", + parentScope, + node, + false, + ); + + this.scopeManager.__nestScope(scope); + for (let j = 0; j < node.typeParameters.params.length; j++) { + const name = node.typeParameters.params[j]; + scope.__define(name, new Definition("TypeParameter", name, name)); + if (name.typeAnnotation) { + this._checkIdentifierOrVisit(name); + } + } + scope.__define = function() { + return parentScope.__define.apply(parentScope, arguments); + }; + + return scope; + } + + _visitTypeAnnotation(node) { + if (!node) { + return; + } + if (Array.isArray(node)) { + node.forEach(this._visitTypeAnnotation, this); + return; + } + + // get property to check (params, id, etc...) + const visitorValues = visitorKeysMap[node.type]; + if (!visitorValues) { + return; + } + + // can have multiple properties + for (let i = 0; i < visitorValues.length; i++) { + const visitorValue = visitorValues[i]; + const propertyType = propertyTypes[visitorValue]; + const nodeProperty = node[visitorValue]; + // check if property or type is defined + if (propertyType == null || nodeProperty == null) { + continue; + } + if (propertyType.type === "loop") { + for (let j = 0; j < nodeProperty.length; j++) { + if (Array.isArray(propertyType.values)) { + for (let k = 0; k < propertyType.values.length; k++) { + const loopPropertyNode = nodeProperty[j][propertyType.values[k]]; + if (loopPropertyNode) { + this._checkIdentifierOrVisit(loopPropertyNode); + } + } + } else { + this._checkIdentifierOrVisit(nodeProperty[j]); + } + } + } else if (propertyType.type === "single") { + this._checkIdentifierOrVisit(nodeProperty); + } else if (propertyType.type === "typeAnnotation") { + this._visitTypeAnnotation(node.typeAnnotation); + } else if (propertyType.type === "typeParameters") { + for (let l = 0; l < node.typeParameters.params.length; l++) { + this._checkIdentifierOrVisit(node.typeParameters.params[l]); + } + } else if (propertyType.type === "id") { + if (node.id.type === "Identifier") { + this._checkIdentifierOrVisit(node.id); + } else { + this._visitTypeAnnotation(node.id); + } + } + } + } + + _checkIdentifierOrVisit(node) { + if (node?.typeAnnotation) { + this._visitTypeAnnotation(node.typeAnnotation); + } else if (node?.type === "Identifier") { + this.visit(node); + } else { + this._visitTypeAnnotation(node); + } + } + + _visitArray(nodeList) { + if (nodeList) { + for (const node of nodeList) { + this.visit(node); + } + } + } +} + +export default function(ast, parserOptions) { + const options = { + ignoreEval: true, + optimistic: false, + directive: false, + nodejsScope: + ast.sourceType === "script" && + (parserOptions.ecmaFeatures && + parserOptions.ecmaFeatures.globalReturn) === true, + impliedStrict: false, + sourceType: ast.sourceType, + ecmaVersion: parserOptions.ecmaVersion, + fallback, + }; + + options.childVisitorKeys = childVisitorKeys; + + const scopeManager = new escope.ScopeManager(options); + const referencer = new Referencer(options, scopeManager); + + referencer.visit(ast); + + return scopeManager; +} diff --git a/eslint/babel-eslint-parser/src/babylon-to-espree/convertAST.js b/eslint/babel-eslint-parser/src/babylon-to-espree/convertAST.js new file mode 100644 index 000000000000..4e048668717b --- /dev/null +++ b/eslint/babel-eslint-parser/src/babylon-to-espree/convertAST.js @@ -0,0 +1,96 @@ +import { types as t, traverse } from "@babel/core"; +import convertProgramNode from "./convertProgramNode"; + +const astTransformVisitor = { + noScope: true, + enter(path) { + const node = path.node; + + // private var to track original node type + node._babelType = node.type; + + if (node.innerComments) { + delete node.innerComments; + } + + if (node.trailingComments) { + delete node.trailingComments; + } + + if (node.leadingComments) { + delete node.leadingComments; + } + }, + exit(path) { + const node = path.node; + + if (path.isTypeParameter()) { + node.type = "Identifier"; + node.typeAnnotation = node.bound; + delete node.bound; + } + + // flow: prevent "no-undef" + // for "Component" in: "let x: React.Component" + if (path.isQualifiedTypeIdentifier()) { + delete node.id; + } + // for "b" in: "var a: { b: Foo }" + if (path.isObjectTypeProperty()) { + delete node.key; + } + // for "indexer" in: "var a: {[indexer: string]: number}" + if (path.isObjectTypeIndexer()) { + delete node.id; + } + // for "param" in: "var a: { func(param: Foo): Bar };" + if (path.isFunctionTypeParam()) { + delete node.name; + } + + // modules + if (path.isImportDeclaration()) { + delete node.isType; + } + + // template string range fixes + if (path.isTemplateLiteral()) { + for (let i = 0; i < node.quasis.length; i++) { + const q = node.quasis[i]; + q.range[0] -= 1; + if (q.tail) { + q.range[1] += 1; + } else { + q.range[1] += 2; + } + q.loc.start.column -= 1; + if (q.tail) { + q.loc.end.column += 1; + } else { + q.loc.end.column += 2; + } + } + } + }, +}; + +export default function(ast, code) { + const state = { source: code }; + + // Monkey patch visitor keys in order to be able to traverse the estree nodes + t.VISITOR_KEYS.Property = t.VISITOR_KEYS.ObjectProperty; + t.VISITOR_KEYS.MethodDefinition = [ + "key", + "value", + "decorators", + "returnType", + "typeParameters", + ]; + + traverse(ast, astTransformVisitor, null, state); + + delete t.VISITOR_KEYS.Property; + delete t.VISITOR_KEYS.MethodDefinition; + + convertProgramNode(ast); +} diff --git a/eslint/babel-eslint-parser/src/babylon-to-espree/convertComments.js b/eslint/babel-eslint-parser/src/babylon-to-espree/convertComments.js new file mode 100644 index 000000000000..b52ec9ff5a48 --- /dev/null +++ b/eslint/babel-eslint-parser/src/babylon-to-espree/convertComments.js @@ -0,0 +1,15 @@ +export default function(comments) { + for (let i = 0; i < comments.length; i++) { + const comment = comments[i]; + if (comment.type === "CommentBlock") { + comment.type = "Block"; + } else if (comment.type === "CommentLine") { + comment.type = "Line"; + } + // sometimes comments don't get ranges computed, + // even with options.ranges === true + if (!comment.range) { + comment.range = [comment.start, comment.end]; + } + } +} diff --git a/eslint/babel-eslint-parser/src/babylon-to-espree/convertProgramNode.js b/eslint/babel-eslint-parser/src/babylon-to-espree/convertProgramNode.js new file mode 100644 index 000000000000..a435487cb6a9 --- /dev/null +++ b/eslint/babel-eslint-parser/src/babylon-to-espree/convertProgramNode.js @@ -0,0 +1,38 @@ +export default function(ast) { + ast.type = "Program"; + ast.sourceType = ast.program.sourceType; + ast.directives = ast.program.directives; + ast.body = ast.program.body; + delete ast.program; + + if (ast.comments.length) { + const lastComment = ast.comments[ast.comments.length - 1]; + + if (!ast.tokens.length) { + // if no tokens, the program starts at the end of the last comment + ast.start = lastComment.end; + ast.loc.start.line = lastComment.loc.end.line; + ast.loc.start.column = lastComment.loc.end.column; + } else { + const lastToken = ast.tokens[ast.tokens.length - 1]; + + if (lastComment.end > lastToken.end) { + // If there is a comment after the last token, the program ends at the + // last token and not the comment + ast.range[1] = lastToken.end; + ast.loc.end.line = lastToken.loc.end.line; + ast.loc.end.column = lastToken.loc.end.column; + } + } + } else { + if (!ast.tokens.length) { + ast.loc.start.line = 1; + ast.loc.end.line = 1; + } + } + + if (ast.body && ast.body.length > 0) { + ast.loc.start.line = ast.body[0].loc.start.line; + ast.range[0] = ast.body[0].start; + } +} diff --git a/eslint/babel-eslint-parser/src/babylon-to-espree/convertTemplateType.js b/eslint/babel-eslint-parser/src/babylon-to-espree/convertTemplateType.js new file mode 100644 index 000000000000..3b674adae624 --- /dev/null +++ b/eslint/babel-eslint-parser/src/babylon-to-espree/convertTemplateType.js @@ -0,0 +1,92 @@ +import { tokTypes as tt } from "@babel/core"; + +export default function(tokens) { + let curlyBrace = null; + let templateTokens = []; + const result = []; + + function addTemplateType() { + const start = templateTokens[0]; + const end = templateTokens[templateTokens.length - 1]; + + const value = templateTokens.reduce((result, token) => { + if (token.value) { + result += token.value; + } else if (token.type !== tt.template) { + result += token.type.label; + } + + return result; + }, ""); + + result.push({ + type: "Template", + value: value, + start: start.start, + end: end.end, + loc: { + start: start.loc.start, + end: end.loc.end, + }, + }); + + templateTokens = []; + } + + tokens.forEach(token => { + switch (token.type) { + case tt.backQuote: + if (curlyBrace) { + result.push(curlyBrace); + curlyBrace = null; + } + + templateTokens.push(token); + + if (templateTokens.length > 1) { + addTemplateType(); + } + + break; + + case tt.dollarBraceL: + templateTokens.push(token); + addTemplateType(); + break; + + case tt.braceR: + if (curlyBrace) { + result.push(curlyBrace); + } + + curlyBrace = token; + break; + + case tt.template: + if (curlyBrace) { + templateTokens.push(curlyBrace); + curlyBrace = null; + } + + templateTokens.push(token); + break; + + case tt.eof: + if (curlyBrace) { + result.push(curlyBrace); + } + + break; + + default: + if (curlyBrace) { + result.push(curlyBrace); + curlyBrace = null; + } + + result.push(token); + } + }); + + return result; +} diff --git a/eslint/babel-eslint-parser/src/babylon-to-espree/convertToken.js b/eslint/babel-eslint-parser/src/babylon-to-espree/convertToken.js new file mode 100644 index 000000000000..d8c9f09092f7 --- /dev/null +++ b/eslint/babel-eslint-parser/src/babylon-to-espree/convertToken.js @@ -0,0 +1,88 @@ +import { tokTypes as tt } from "@babel/core"; + +export default function(token, source) { + const type = token.type; + token.range = [token.start, token.end]; + + if (type === tt.name) { + token.type = "Identifier"; + } else if ( + type === tt.semi || + type === tt.comma || + type === tt.parenL || + type === tt.parenR || + type === tt.braceL || + type === tt.braceR || + type === tt.slash || + type === tt.dot || + type === tt.bracketL || + type === tt.bracketR || + type === tt.ellipsis || + type === tt.arrow || + type === tt.pipeline || + type === tt.star || + type === tt.incDec || + type === tt.colon || + type === tt.question || + type === tt.questionDot || + type === tt.template || + type === tt.backQuote || + type === tt.dollarBraceL || + type === tt.at || + type === tt.logicalOR || + type === tt.logicalAND || + type === tt.nullishCoalescing || + type === tt.bitwiseOR || + type === tt.bitwiseXOR || + type === tt.bitwiseAND || + type === tt.equality || + type === tt.relational || + type === tt.bitShift || + type === tt.plusMin || + type === tt.modulo || + type === tt.exponent || + type === tt.bang || + type === tt.tilde || + type === tt.doubleColon || + type === tt.hash || + type.isAssign + ) { + token.type = "Punctuator"; + if (!token.value) token.value = type.label; + } else if (type === tt.jsxTagStart) { + token.type = "Punctuator"; + token.value = "<"; + } else if (type === tt.jsxTagEnd) { + token.type = "Punctuator"; + token.value = ">"; + } else if (type === tt.jsxName) { + token.type = "JSXIdentifier"; + } else if (type === tt.jsxText) { + token.type = "JSXText"; + } else if (type.keyword === "null") { + token.type = "Null"; + } else if (type.keyword === "false" || type.keyword === "true") { + token.type = "Boolean"; + } else if (type.keyword) { + token.type = "Keyword"; + } else if (type === tt.num) { + token.type = "Numeric"; + token.value = source.slice(token.start, token.end); + } else if (type === tt.string) { + token.type = "String"; + token.value = source.slice(token.start, token.end); + } else if (type === tt.regexp) { + token.type = "RegularExpression"; + const value = token.value; + token.regex = { + pattern: value.pattern, + flags: value.flags, + }; + token.value = `/${value.pattern}/${value.flags}`; + } else if (type === tt.bigint) { + token.type = "Numeric"; + token.value = `${token.value}n`; + } + + return token; +} diff --git a/eslint/babel-eslint-parser/src/babylon-to-espree/convertTokens.js b/eslint/babel-eslint-parser/src/babylon-to-espree/convertTokens.js new file mode 100644 index 000000000000..44f4ef41bc3f --- /dev/null +++ b/eslint/babel-eslint-parser/src/babylon-to-espree/convertTokens.js @@ -0,0 +1,8 @@ +import convertTemplateType from "./convertTemplateType"; +import convertToken from "./convertToken"; + +export default function(tokens, code) { + return convertTemplateType(tokens) + .filter(t => t.type !== "CommentLine" && t.type !== "CommentBlock") + .map(t => convertToken(t, code)); +} diff --git a/eslint/babel-eslint-parser/src/babylon-to-espree/index.js b/eslint/babel-eslint-parser/src/babylon-to-espree/index.js new file mode 100644 index 000000000000..7a9de2b4cc0b --- /dev/null +++ b/eslint/babel-eslint-parser/src/babylon-to-espree/index.js @@ -0,0 +1,9 @@ +import convertTokens from "./convertTokens"; +import convertComments from "./convertComments"; +import convertAST from "./convertAST"; + +export default function(ast, code) { + ast.tokens = convertTokens(ast.tokens, code); + convertComments(ast.comments); + convertAST(ast, code); +} diff --git a/eslint/babel-eslint-parser/src/configuration.js b/eslint/babel-eslint-parser/src/configuration.js new file mode 100644 index 000000000000..e6d036372f12 --- /dev/null +++ b/eslint/babel-eslint-parser/src/configuration.js @@ -0,0 +1,61 @@ +import { loadPartialConfig } from "@babel/core"; + +export function normalizeESLintConfig(options) { + const defaultOptions = { + babelOptions: {}, + ecmaVersion: 2020, + sourceType: "module", + allowImportExportEverywhere: false, + }; + + return Object.assign(defaultOptions, options); +} + +export function normalizeBabelParseConfig(options) { + const parseOptions = { + sourceType: options.sourceType, + filename: options.filePath, + cwd: options.babelOptions.cwd, + root: options.babelOptions.root, + rootMode: options.babelOptions.rootMode, + envName: options.babelOptions.envName, + configFile: options.babelOptions.configFile, + babelrc: options.babelOptions.babelrc, + babelrcRoots: options.babelOptions.babelrcRoots, + extends: options.babelOptions.extends, + env: options.babelOptions.env, + overrides: options.babelOptions.overrides, + test: options.babelOptions.test, + include: options.babelOptions.include, + exclude: options.babelOptions.exclude, + ignore: options.babelOptions.ignore, + only: options.babelOptions.only, + parserOpts: { + allowImportExportEverywhere: options.allowImportExportEverywhere, + allowReturnOutsideFunction: true, + allowSuperOutsideMethod: true, + ranges: true, + tokens: true, + plugins: ["estree"], + }, + caller: { + name: "@babel/eslint-parser", + }, + }; + + if (options.requireConfigFile !== false) { + const config = loadPartialConfig(parseOptions); + + if (config !== null) { + if (!config.hasFilesystemConfig()) { + throw new Error( + `No Babel config file detected for ${config.options.filename}. Either disable config file checking with requireConfigFile: false, or configure Babel so that it can find the config files.`, + ); + } + + return config.options; + } + } + + return parseOptions; +} diff --git a/eslint/babel-eslint-parser/src/index.js b/eslint/babel-eslint-parser/src/index.js new file mode 100644 index 000000000000..2d54014b4468 --- /dev/null +++ b/eslint/babel-eslint-parser/src/index.js @@ -0,0 +1,26 @@ +import semver from "semver"; +import { version as CURRENT_BABEL_VERSION } from "@babel/core"; +import parseWithScope from "./parse-with-scope"; +import { normalizeESLintConfig } from "./configuration"; +import packageJson from "../package.json"; + +const SUPPORTED_BABEL_VERSION_RANGE = + packageJson.peerDependencies["@babel/core"]; +const IS_RUNNING_SUPPORTED_VERSION = semver.satisfies( + CURRENT_BABEL_VERSION, + SUPPORTED_BABEL_VERSION_RANGE, +); + +export function parse(code, options) { + return parseForESLint(code, options).ast; +} + +export function parseForESLint(code, options = {}) { + if (!IS_RUNNING_SUPPORTED_VERSION) { + throw new Error( + `babel-eslint@${packageJson.version} does not support @babel/core@${CURRENT_BABEL_VERSION}. Please downgrade to babel-eslint@^10 or upgrade to @babel/core@${SUPPORTED_BABEL_VERSION_RANGE}`, + ); + } + + return parseWithScope(code, normalizeESLintConfig(options)); +} diff --git a/eslint/babel-eslint-parser/src/parse-with-scope.js b/eslint/babel-eslint-parser/src/parse-with-scope.js new file mode 100644 index 000000000000..17516f5724d7 --- /dev/null +++ b/eslint/babel-eslint-parser/src/parse-with-scope.js @@ -0,0 +1,10 @@ +import visitorKeys from "./visitor-keys"; +import analyzeScope from "./analyze-scope"; +import parse from "./parse"; + +export default function(code, options) { + const ast = parse(code, options); + const scopeManager = analyzeScope(ast, options); + + return { ast, scopeManager, visitorKeys }; +} diff --git a/eslint/babel-eslint-parser/src/parse.js b/eslint/babel-eslint-parser/src/parse.js new file mode 100644 index 000000000000..e39f371295d6 --- /dev/null +++ b/eslint/babel-eslint-parser/src/parse.js @@ -0,0 +1,23 @@ +import { parseSync as babelParse } from "@babel/core"; +import babylonToEspree from "./babylon-to-espree"; +import { normalizeBabelParseConfig } from "./configuration"; + +export default function parse(code, options) { + const parseOptions = normalizeBabelParseConfig(options); + let ast; + + try { + ast = babelParse(code, parseOptions); + } catch (err) { + if (err instanceof SyntaxError) { + err.lineNumber = err.loc.line; + err.column = err.loc.column; + } + + throw err; + } + + babylonToEspree(ast, code); + + return ast; +} diff --git a/eslint/babel-eslint-parser/src/visitor-keys.js b/eslint/babel-eslint-parser/src/visitor-keys.js new file mode 100644 index 000000000000..6676a86602e3 --- /dev/null +++ b/eslint/babel-eslint-parser/src/visitor-keys.js @@ -0,0 +1,15 @@ +import { types as t } from "@babel/core"; +import { KEYS as ESLINT_VISITOR_KEYS } from "eslint-visitor-keys"; + +const { VISITOR_KEYS: BABEL_VISITOR_KEYS } = t; + +export default Object.assign( + { + Literal: ESLINT_VISITOR_KEYS.Literal, + MethodDefinition: ["decorators"].concat( + ESLINT_VISITOR_KEYS.MethodDefinition, + ), + Property: ["decorators"].concat(ESLINT_VISITOR_KEYS.Property), + }, + BABEL_VISITOR_KEYS, +); diff --git a/eslint/babel-eslint-parser/test/babel-eslint-parser.js b/eslint/babel-eslint-parser/test/babel-eslint-parser.js new file mode 100644 index 000000000000..3e692340ce59 --- /dev/null +++ b/eslint/babel-eslint-parser/test/babel-eslint-parser.js @@ -0,0 +1,535 @@ +import assert from "assert"; +import espree from "espree"; +import escope from "eslint-scope"; +import unpad from "dedent"; +import { parseForESLint } from "../src"; +import assertImplementsAST from "./helpers/assert-implements-ast"; + +const babelOptions = { + configFile: require.resolve( + "@babel/eslint-shared-fixtures/config/babel.config.js", + ), +}; + +function parseAndAssertSame(code) { + code = unpad(code); + const esAST = espree.parse(code, { + ecmaFeatures: { + // enable JSX parsing + jsx: true, + // enable return in global scope + globalReturn: true, + // enable implied strict mode (if ecmaVersion >= 5) + impliedStrict: true, + // allow experimental object rest/spread + experimentalObjectRestSpread: true, + }, + tokens: true, + loc: true, + range: true, + comment: true, + ecmaVersion: 2020, + sourceType: "module", + }); + const babylonAST = parseForESLint(code, { + eslintVisitorKeys: true, + eslintScopeManager: true, + babelOptions, + }).ast; + assertImplementsAST(esAST, babylonAST); +} + +describe("babylon-to-espree", () => { + describe("compatibility", () => { + it("should allow ast.analyze to be called without options", function() { + const esAST = parseForESLint("`test`", { + eslintScopeManager: true, + eslintVisitorKeys: true, + babelOptions, + }).ast; + expect(() => { + escope.analyze(esAST); + }).not.toThrow(new TypeError("Should allow no options argument.")); + }); + }); + + describe("templates", () => { + it("empty template string", () => { + parseAndAssertSame("``"); + }); + + it("template string", () => { + parseAndAssertSame("`test`"); + }); + + it("template string using $", () => { + parseAndAssertSame("`$`"); + }); + + it("template string with expression", () => { + parseAndAssertSame("`${a}`"); + }); + + it("template string with multiple expressions", () => { + parseAndAssertSame("`${a}${b}${c}`"); + }); + + it("template string with expression and strings", () => { + parseAndAssertSame("`a${a}a`"); + }); + + it("template string with binary expression", () => { + parseAndAssertSame("`a${a + b}a`"); + }); + + it("tagged template", () => { + parseAndAssertSame("jsx``"); + }); + + it("tagged template with expression", () => { + parseAndAssertSame("jsx``"); + }); + + it("tagged template with new operator", () => { + parseAndAssertSame("new raw`42`"); + }); + + it("template with nested function/object", () => { + parseAndAssertSame( + "`outer${{x: {y: 10}}}bar${`nested${function(){return 1;}}endnest`}end`", + ); + }); + + it("template with braces inside and outside of template string #96", () => { + parseAndAssertSame( + "if (a) { var target = `{}a:${webpackPort}{}}}}`; } else { app.use(); }", + ); + }); + + it("template also with braces #96", () => { + parseAndAssertSame(` + export default function f1() { + function f2(foo) { + const bar = 3; + return \`\${foo} \${bar}\`; + } + return f2; + } + `); + }); + + it("template with destructuring #31", () => { + parseAndAssertSame(` + module.exports = { + render() { + var {name} = this.props; + return Math.max(null, \`Name: \${name}, Name: \${name}\`); + } + }; + `); + }); + + it("template with arrow returning template #603", () => { + parseAndAssertSame(` + var a = \`\${() => { + \`\${''}\` + }}\`; + `); + }); + + it("template string with object with template string inside", () => { + parseAndAssertSame("`${ { a:`${2}` } }`"); + }); + }); + + it("simple expression", () => { + parseAndAssertSame("a = 1"); + }); + + it("logical NOT", () => { + parseAndAssertSame("!0"); + }); + + it("bitwise NOT", () => { + parseAndAssertSame("~0"); + }); + + it("class declaration", () => { + parseAndAssertSame("class Foo {}"); + }); + + it("class expression", () => { + parseAndAssertSame("var a = class Foo {}"); + }); + + it("jsx expression", () => { + parseAndAssertSame(""); + }); + + it("jsx expression with 'this' as identifier", () => { + parseAndAssertSame(""); + }); + + it("jsx expression with a dynamic attribute", () => { + parseAndAssertSame(""); + }); + + it("jsx expression with a member expression as identifier", () => { + parseAndAssertSame(""); + }); + + it("jsx expression with spread", () => { + parseAndAssertSame("var myDivElement =

;"); + }); + + it("empty jsx text", () => { + parseAndAssertSame(""); + }); + + it("jsx text with content", () => { + parseAndAssertSame("Hello, world!"); + }); + + it("nested jsx", () => { + parseAndAssertSame("
\n

Wat

\n
"); + }); + + it("default import", () => { + parseAndAssertSame('import foo from "foo";'); + }); + + it("import specifier", () => { + parseAndAssertSame('import { foo } from "foo";'); + }); + + it("import specifier with name", () => { + parseAndAssertSame('import { foo as bar } from "foo";'); + }); + + it("import bare", () => { + parseAndAssertSame('import "foo";'); + }); + + it("export default class declaration", () => { + parseAndAssertSame("export default class Foo {}"); + }); + + it("export default class expression", () => { + parseAndAssertSame("export default class {}"); + }); + + it("export default function declaration", () => { + parseAndAssertSame("export default function Foo() {}"); + }); + + it("export default function expression", () => { + parseAndAssertSame("export default function () {}"); + }); + + it("export all", () => { + parseAndAssertSame('export * from "foo";'); + }); + + it("export named", () => { + parseAndAssertSame("var foo = 1;export { foo };"); + }); + + it("export named alias", () => { + parseAndAssertSame("var foo = 1;export { foo as bar };"); + }); + + // Espree doesn't support the optional chaining operator yet + it("optional chaining operator (token)", () => { + const code = "foo?.bar"; + const babylonAST = parseForESLint(code, { + eslintVisitorKeys: true, + eslintScopeManager: true, + babelOptions, + }).ast; + assert.strictEqual(babylonAST.tokens[1].type, "Punctuator"); + }); + + // Espree doesn't support the nullish coalescing operator yet + it("nullish coalescing operator (token)", () => { + const code = "foo ?? bar"; + const babylonAST = parseForESLint(code, { + eslintVisitorKeys: true, + eslintScopeManager: true, + babelOptions, + }).ast; + assert.strictEqual(babylonAST.tokens[1].type, "Punctuator"); + }); + + // Espree doesn't support the pipeline operator yet + it("pipeline operator (token)", () => { + const code = "foo |> bar"; + const babylonAST = parseForESLint(code, { + eslintVisitorKeys: true, + eslintScopeManager: true, + babelOptions, + }).ast; + assert.strictEqual(babylonAST.tokens[1].type, "Punctuator"); + }); + + // Espree doesn't support private fields yet + it("hash (token)", () => { + const code = "class A { #x }"; + const babylonAST = parseForESLint(code, { + eslintVisitorKeys: true, + eslintScopeManager: true, + babelOptions, + }).ast; + assert.strictEqual(babylonAST.tokens[3].type, "Punctuator"); + assert.strictEqual(babylonAST.tokens[3].value, "#"); + }); + + it.skip("empty program with line comment", () => { + parseAndAssertSame("// single comment"); + }); + + it.skip("empty program with block comment", () => { + parseAndAssertSame(" /* multiline\n * comment\n*/"); + }); + + it("line comments", () => { + parseAndAssertSame(` + // single comment + var foo = 15; // comment next to statement + // second comment after statement + `); + }); + + it("block comments", () => { + parseAndAssertSame(` + /* single comment */ + var foo = 15; /* comment next to statement */ + /* + * multiline + * comment + */ + `); + }); + + it("block comments #124", () => { + parseAndAssertSame(` + React.createClass({ + render() { + // return ( + //
+ // ); // <-- this is the line that is reported + } + }); + `); + }); + + it("null", () => { + parseAndAssertSame("null"); + }); + + it("boolean", () => { + parseAndAssertSame("if (true) {} else if (false) {}"); + }); + + it("regexp", () => { + parseAndAssertSame("/affix-top|affix-bottom|affix|[a-z]/"); + }); + + it("regexp", () => { + parseAndAssertSame("const foo = /foo/;"); + }); + + it("regexp y flag", () => { + parseAndAssertSame("const foo = /foo/y;"); + }); + + it("regexp u flag", () => { + parseAndAssertSame("const foo = /foo/u;"); + }); + + it("regexp in a template string", () => { + parseAndAssertSame('`${/\\d/.exec("1")[0]}`'); + }); + + it("first line is empty", () => { + parseAndAssertSame('\nimport Immutable from "immutable";'); + }); + + it("empty", () => { + parseAndAssertSame(""); + }); + + it("jsdoc", () => { + parseAndAssertSame(` + /** + * @param {object} options + * @return {number} + */ + const test = function({ a, b, c }) { + return a + b + c; + }; + module.exports = test; + `); + }); + + it("empty block with comment", () => { + parseAndAssertSame(` + function a () { + try { + b(); + } catch (e) { + // asdf + } + } + `); + }); + + describe("babel tests", () => { + it("MethodDefinition", () => { + parseAndAssertSame(` + export default class A { + a() {} + } + `); + }); + + it("MethodDefinition 2", () => { + parseAndAssertSame( + "export default class Bar { get bar() { return 42; }}", + ); + }); + + it("ClassMethod", () => { + parseAndAssertSame(` + class A { + constructor() { + } + } + `); + }); + + it("ClassMethod multiple params", () => { + parseAndAssertSame(` + class A { + constructor(a, b, c) { + } + } + `); + }); + + it("ClassMethod multiline", () => { + parseAndAssertSame(` + class A { + constructor ( + a, + b, + c + ) + + { + + } + } + `); + }); + + it("ClassMethod oneline", () => { + parseAndAssertSame("class A { constructor(a, b, c) {} }"); + }); + + it("ObjectMethod", () => { + parseAndAssertSame(` + var a = { + b(c) { + } + } + `); + }); + + it("do not allow import export everywhere", () => { + assert.throws(() => { + parseAndAssertSame('function F() { import a from "a"; }'); + }, /SyntaxError: 'import' and 'export' may only appear at the top level/); + }); + + it("return outside function", () => { + parseAndAssertSame("return;"); + }); + + it("super outside method", () => { + assert.throws(() => { + parseAndAssertSame("function F() { super(); }"); + }, /SyntaxError: 'super' keyword outside a method/); + }); + + it("StringLiteral", () => { + parseAndAssertSame(""); + parseAndAssertSame(""); + parseAndAssertSame("a"); + }); + + it("getters and setters", () => { + parseAndAssertSame("class A { get x ( ) { ; } }"); + parseAndAssertSame(` + class A { + get x( + ) + { + ; + } + } + `); + parseAndAssertSame("class A { set x (a) { ; } }"); + parseAndAssertSame(` + class A { + set x(a + ) + { + ; + } + } + `); + parseAndAssertSame(` + var B = { + get x () { + return this.ecks; + }, + set x (ecks) { + this.ecks = ecks; + } + }; + `); + }); + + it("RestOperator", () => { + parseAndAssertSame("var { a, ...b } = c"); + parseAndAssertSame("var [ a, ...b ] = c"); + parseAndAssertSame("var a = function (...b) {}"); + }); + + it("SpreadOperator", () => { + parseAndAssertSame("var a = { b, ...c }"); + parseAndAssertSame("var a = [ a, ...b ]"); + parseAndAssertSame("var a = sum(...b)"); + }); + + it("Async/Await", () => { + parseAndAssertSame(` + async function a() { + await 1; + } + `); + }); + + it("BigInt", () => { + parseAndAssertSame(` + const a = 1n; + `); + }); + + it("Dynamic Import", () => { + parseAndAssertSame(` + const a = import('a'); + `); + }); + }); +}); diff --git a/eslint/babel-eslint-parser/test/fixtures/eslint-plugin-import/.eslintrc.yml b/eslint/babel-eslint-parser/test/fixtures/eslint-plugin-import/.eslintrc.yml new file mode 100644 index 000000000000..418b3d0c0ceb --- /dev/null +++ b/eslint/babel-eslint-parser/test/fixtures/eslint-plugin-import/.eslintrc.yml @@ -0,0 +1,11 @@ +root: true + +# babel-eslint +parser: ../../../lib/index.js + +# use eslint-plugin-import +plugins: + - import +rules: + import/no-named-as-default: error + no-unused-vars: error diff --git a/eslint/babel-eslint-parser/test/fixtures/eslint-plugin-import/a.js b/eslint/babel-eslint-parser/test/fixtures/eslint-plugin-import/a.js new file mode 100644 index 000000000000..e8d96fc4d62d --- /dev/null +++ b/eslint/babel-eslint-parser/test/fixtures/eslint-plugin-import/a.js @@ -0,0 +1 @@ +export default function foo() { } diff --git a/eslint/babel-eslint-parser/test/fixtures/eslint-plugin-import/b.js b/eslint/babel-eslint-parser/test/fixtures/eslint-plugin-import/b.js new file mode 100644 index 000000000000..b3a52f870198 --- /dev/null +++ b/eslint/babel-eslint-parser/test/fixtures/eslint-plugin-import/b.js @@ -0,0 +1 @@ +import foo from './a.js'; diff --git a/eslint/babel-eslint-parser/test/fixtures/eslint-plugin-import/c.js b/eslint/babel-eslint-parser/test/fixtures/eslint-plugin-import/c.js new file mode 100644 index 000000000000..2beac98f3b74 --- /dev/null +++ b/eslint/babel-eslint-parser/test/fixtures/eslint-plugin-import/c.js @@ -0,0 +1,4 @@ +// @flow +type Foo = {}; + +const FlowTypeButton = ({ }: Foo) => { }; diff --git a/eslint/babel-eslint-parser/test/fixtures/rules/strict/function-with.js b/eslint/babel-eslint-parser/test/fixtures/rules/strict/function-with.js new file mode 100644 index 000000000000..3df7515269d5 --- /dev/null +++ b/eslint/babel-eslint-parser/test/fixtures/rules/strict/function-with.js @@ -0,0 +1,3 @@ +function x () { + "use strict"; +} diff --git a/eslint/babel-eslint-parser/test/fixtures/rules/strict/function-without.js b/eslint/babel-eslint-parser/test/fixtures/rules/strict/function-without.js new file mode 100644 index 000000000000..20b3e9e55005 --- /dev/null +++ b/eslint/babel-eslint-parser/test/fixtures/rules/strict/function-without.js @@ -0,0 +1 @@ +function x () {} diff --git a/eslint/babel-eslint-parser/test/fixtures/rules/strict/global-with-function-with.js b/eslint/babel-eslint-parser/test/fixtures/rules/strict/global-with-function-with.js new file mode 100644 index 000000000000..ef682f72c947 --- /dev/null +++ b/eslint/babel-eslint-parser/test/fixtures/rules/strict/global-with-function-with.js @@ -0,0 +1,5 @@ +"use strict"; + +function x () { + "use strict"; +} diff --git a/eslint/babel-eslint-parser/test/fixtures/rules/strict/global-with-function-without.js b/eslint/babel-eslint-parser/test/fixtures/rules/strict/global-with-function-without.js new file mode 100644 index 000000000000..206f708141b7 --- /dev/null +++ b/eslint/babel-eslint-parser/test/fixtures/rules/strict/global-with-function-without.js @@ -0,0 +1,3 @@ +"use strict"; + +function x () {} diff --git a/eslint/babel-eslint-parser/test/fixtures/rules/strict/global-with.js b/eslint/babel-eslint-parser/test/fixtures/rules/strict/global-with.js new file mode 100644 index 000000000000..e967aa4994d0 --- /dev/null +++ b/eslint/babel-eslint-parser/test/fixtures/rules/strict/global-with.js @@ -0,0 +1,6 @@ +"use strict"; +/* +The empty statement is intentional. As of now, ESLint won't enforce +string: [2, "global"] on a program with an empty body. A test for that without +massaging the AST to ESlint's input format should fail. +*/ diff --git a/eslint/babel-eslint-parser/test/fixtures/rules/strict/none.js b/eslint/babel-eslint-parser/test/fixtures/rules/strict/none.js new file mode 100644 index 000000000000..4a6db98f6226 --- /dev/null +++ b/eslint/babel-eslint-parser/test/fixtures/rules/strict/none.js @@ -0,0 +1 @@ +"no use strict anywhere"; diff --git a/eslint/babel-eslint-parser/test/fixtures/rules/syntax-error.js b/eslint/babel-eslint-parser/test/fixtures/rules/syntax-error.js new file mode 100644 index 000000000000..6fa194a18f9e --- /dev/null +++ b/eslint/babel-eslint-parser/test/fixtures/rules/syntax-error.js @@ -0,0 +1,6 @@ +class ClassName { + constructor() { + + }, + aMethod() {} +} diff --git a/eslint/babel-eslint-parser/test/helpers/assert-implements-ast.js b/eslint/babel-eslint-parser/test/helpers/assert-implements-ast.js new file mode 100644 index 000000000000..3c435940a4cf --- /dev/null +++ b/eslint/babel-eslint-parser/test/helpers/assert-implements-ast.js @@ -0,0 +1,40 @@ +// Checks if the source ast implements the target ast. Ignores extra keys on source ast +export default function assertImplementsAST(target, source, path) { + if (!path) { + path = []; + } + + function error(text) { + const err = new Error(`At ${path.join(".")}: ${text}:`); + err.depth = path.length + 1; + throw err; + } + + const typeA = target === null ? "null" : typeof target; + const typeB = source === null ? "null" : typeof source; + if (typeA !== typeB) { + error( + `have different types (${typeA} !== ${typeB}) (${target} !== ${source})`, + ); + } else if ( + typeA === "object" && + ["RegExp"].indexOf(target.constructor.name) !== -1 && + target.constructor.name !== source.constructor.name + ) { + error( + `object have different constructors (${target.constructor.name} !== ${source.constructor.name}`, + ); + } else if (typeA === "object") { + const keysTarget = Object.keys(target); + for (const i in keysTarget) { + const key = keysTarget[i]; + path.push(key); + assertImplementsAST(target[key], source[key], path); + path.pop(); + } + } else if (target !== source) { + error( + `are different (${JSON.stringify(target)} !== ${JSON.stringify(source)})`, + ); + } +} diff --git a/eslint/babel-eslint-parser/test/integration.js b/eslint/babel-eslint-parser/test/integration.js new file mode 100644 index 000000000000..d2df877c562e --- /dev/null +++ b/eslint/babel-eslint-parser/test/integration.js @@ -0,0 +1,237 @@ +import eslint from "eslint"; +import fs from "fs"; +import path from "path"; +import * as parser from "../src"; + +eslint.linter.defineParser("current-babel-eslint", parser); + +const paths = { + fixtures: path.join(__dirname, "fixtures", "rules"), +}; + +const encoding = "utf8"; +const errorLevel = 2; + +const baseEslintOpts = { + parser: "current-babel-eslint", + parserOptions: { + sourceType: "script", + requireConfigFile: false, + babelOptions: { configFile: false } + }, +}; + +/** + * Load a fixture and run eslint.linter.verify() on it. + * Pass the return value to done(). + * @param object opts + * @param function done + */ +function lint(opts, done) { + readFixture(opts.fixture, (err, src) => { + if (err) return done(err); + done(null, eslint.linter.verify(src, opts.eslint)); + }); +} + +/** + * Read a fixture file, passing the content to done(). + * @param string|array id + * @param function done + */ +function readFixture(id, done) { + if (Array.isArray(id)) id = path.join.apply(path, id); + if (!path.extname(id)) id += ".js"; + fs.readFile(path.join(paths.fixtures, id), encoding, done); +} +// readFixture + +describe("Rules:", () => { + describe("`strict`", strictSuite); +}); +// describe + +function strictSuite() { + const ruleId = "strict"; + + describe("when set to 'never'", () => { + const eslintOpts = Object.assign({}, baseEslintOpts, { + rules: {}, + }); + eslintOpts.rules[ruleId] = [errorLevel, "never"]; + + ["global-with", "function-with"].forEach(fixture => { + it(`should error on ${fixture.match(/^[^-]+/)[0]} directive`, done => { + lint( + { + fixture: ["strict", fixture], + eslint: eslintOpts, + }, + (err, report) => { + if (err) return done(err); + expect(report[0].ruleId).toBe(ruleId); + done(); + }, + ); + }); + // it + }); + }); + // describe + + describe("when set to 'global'", () => { + const eslintOpts = Object.assign({}, baseEslintOpts, { + rules: {}, + }); + eslintOpts.rules[ruleId] = [errorLevel, "global"]; + + it("shouldn't error on single global directive", done => { + lint( + { + fixture: ["strict", "global-with"], + eslint: eslintOpts, + }, + (err, report) => { + if (err) return done(err); + expect(report.length).toBe(0); + done(); + }, + ); + }); + // it + + it("should error twice on global directive: no and function directive: yes", done => { + lint( + { + fixture: ["strict", "function-with"], + eslint: eslintOpts, + }, + (err, report) => { + if (err) return done(err); + [0, 1].forEach(i => { + expect(report[0].ruleId).toBe(ruleId); + }); + done(); + }, + ); + }); + // it + + it("should error on function directive", done => { + lint( + { + fixture: ["strict", "global-with-function-with"], + eslint: eslintOpts, + }, + (err, report) => { + if (err) return done(err); + expect(report[0].ruleId).toBe(ruleId); + // This is to make sure the test fails prior to adapting Babel AST + // directive representation to ESLint format. Otherwise it reports an + // error for missing global directive that masquerades as the expected + // result of the previous assertion. + expect(report[0].nodeType).not.toBe("Program"); + done(); + }, + ); + }); + // it + + it("should error on no directive", done => { + lint( + { + fixture: ["strict", "none"], + eslint: eslintOpts, + }, + (err, report) => { + if (err) return done(err); + expect(report[0].ruleId).toBe(ruleId); + done(); + }, + ); + }); + // it + }); + // describe + + describe("when set to 'function'", () => { + const eslintOpts = Object.assign({}, baseEslintOpts, { + rules: {}, + }); + eslintOpts.rules[ruleId] = [errorLevel, "function"]; + + it("shouldn't error on single function directive", done => { + lint( + { + fixture: ["strict", "function-with"], + eslint: eslintOpts, + }, + (err, report) => { + if (err) return done(err); + expect(report.length).toBe(0); + done(); + }, + ); + }); + // it + + it("should error twice on function directive: no and global directive: yes", done => { + lint( + { + fixture: ["strict", "global-with-function-without"], + eslint: eslintOpts, + }, + (err, report) => { + if (err) return done(err); + [0, 1].forEach(i => { + expect(report[i].ruleId).toBe(ruleId); + }); + done(); + }, + ); + }); + // it + + it("should error on only global directive", done => { + lint( + { + fixture: ["strict", "global-with"], + eslint: eslintOpts, + }, + (err, report) => { + if (err) return done(err); + expect(report[0].ruleId).toBe(ruleId); + done(); + }, + ); + }); + // it + + it("should error on extraneous global directive", done => { + lint( + { + fixture: ["strict", "global-with-function-with"], + eslint: eslintOpts, + }, + (err, report) => { + if (err) return done(err); + expect(report[0].ruleId).toBe(ruleId); + expect(report[0].nodeType.indexOf("Function")).toBe(-1); + done(); + }, + ); + }); + // it + }); +} + +describe("https://github.com/babel/babel-eslint/issues/558", () => { + it("doesn't crash with eslint-plugin-import", () => { + const engine = new eslint.CLIEngine({ ignore: false }); + const files = ["a.js", "b.js", "c.js"]; + let fileWithPath = files.map(file => + path.resolve(__dirname, `./fixtures/eslint-plugin-import/${file}`), + ); + engine.executeOnFiles(fileWithPath); + }); +}); diff --git a/eslint/babel-eslint-parser/test/non-regression.js b/eslint/babel-eslint-parser/test/non-regression.js new file mode 100644 index 000000000000..13524702e335 --- /dev/null +++ b/eslint/babel-eslint-parser/test/non-regression.js @@ -0,0 +1,1955 @@ +import eslint from "eslint"; +import path from "path"; +import unpad from "dedent"; +import * as parser from "../src"; + +function verifyAndAssertMessagesWithSpecificESLint( + code, + rules, + expectedMessages, + sourceType, + overrideConfig, + linter, +) { + const config = { + parser: "current-babel-eslint", + rules, + env: { + node: true, + es6: true, + }, + ...overrideConfig, + parserOptions: { + sourceType, + requireConfigFile: false, + babelOptions: { + configFile: require.resolve( + "@babel/eslint-shared-fixtures/config/babel.config.js", + ), + }, + ...overrideConfig?.parserOptions, + }, + }; + + const messages = linter.verify(code, config); + + if (messages.length !== expectedMessages.length) { + throw new Error( + `Expected ${expectedMessages.length} message(s), got ${ + messages.length + }\n${JSON.stringify(messages, null, 2)}`, + ); + } + + messages.forEach((message, i) => { + const formatedMessage = `${message.line}:${message.column} ${ + message.message + }${message.ruleId ? ` ${message.ruleId}` : ""}`; + if (formatedMessage !== expectedMessages[i]) { + throw new Error( + ` + Message ${i} does not match: + Expected: ${expectedMessages[i]} + Actual: ${formatedMessage} + `, + ); + } + }); +} + +function verifyAndAssertMessages( + code, + rules, + expectedMessages, + sourceType, + overrideConfig, +) { + const linter = new eslint.Linter(); + linter.defineParser("current-babel-eslint", parser); + + verifyAndAssertMessagesWithSpecificESLint( + unpad(`${code}`), + rules || {}, + expectedMessages || [], + sourceType, + overrideConfig, + linter, + ); +} + +describe("verify", () => { + it("arrow function support (issue #1)", () => { + verifyAndAssertMessages("describe('stuff', () => {});"); + }); + + it("EOL validation (issue #2)", () => { + verifyAndAssertMessages( + 'module.exports = "something";', + { "eol-last": 1, semi: 1 }, + ["1:30 Newline required at end of file but not found. eol-last"], + ); + }); + + xit("Readable error messages (issue #3)", () => { + verifyAndAssertMessages("{ , res }", {}, [ + "1:3 Parsing error: Unexpected token", + ]); + }); + + it("Modules support (issue #5)", () => { + verifyAndAssertMessages( + ` + import Foo from 'foo'; + export default Foo; + export const c = 'c'; + export class Store {} + `, + ); + }); + + it("Rest parameters (issue #7)", () => { + verifyAndAssertMessages("function foo(...args) { return args; }", { + "no-undef": 1, + }); + }); + + it("Exported classes should be used (issue #8)", () => { + verifyAndAssertMessages("class Foo {} module.exports = Foo;", { + "no-unused-vars": 1, + }); + }); + + it("super keyword in class (issue #10)", () => { + verifyAndAssertMessages("class Foo { constructor() { super() } }", { + "no-undef": 1, + }); + }); + + it("Rest parameter in destructuring assignment (issue #11)", () => { + verifyAndAssertMessages( + "const [a, ...rest] = ['1', '2', '3']; module.exports = rest;", + { "no-undef": 1 }, + ); + }); + + it("JSX attribute names marked as variables (issue #12)", () => { + verifyAndAssertMessages('module.exports =
', { + "no-undef": 1, + }); + }); + + it("Multiple destructured assignment with compound properties (issue #16)", () => { + verifyAndAssertMessages("module.exports = { ...a.a, ...a.b };", { + "no-dupe-keys": 1, + }); + }); + + it("Arrow function with non-block bodies (issue #20)", () => { + verifyAndAssertMessages( + '"use strict"; () => 1', + { strict: [1, "global"] }, + [], + "script", + ); + }); + + it("#242", () => { + verifyAndAssertMessages('"use strict"; asdf;', { + "no-irregular-whitespace": 1, + }); + }); + + it("await keyword (issue #22)", () => { + verifyAndAssertMessages("async function foo() { await bar(); }", { + "no-unused-expressions": 1, + }); + }); + + it("arrow functions (issue #27)", () => { + verifyAndAssertMessages("[1, 2, 3].map(i => i * 2);", { + "func-names": 1, + "space-before-blocks": 1, + }); + }); + + it("comment with padded-blocks (issue #33)", () => { + verifyAndAssertMessages( + ` + if (a) { + // i'm a comment! + let b = c + } + `, + { "padded-blocks": [1, "never"] }, + ); + }); + + describe("flow", () => { + it("check regular function", () => { + verifyAndAssertMessages( + "function a(b, c) { b += 1; c += 1; return b + c; } a;", + { "no-unused-vars": 1, "no-undef": 1 }, + ); + }); + + it("type alias", () => { + verifyAndAssertMessages("type SomeNewType = any;", { "no-undef": 1 }); + }); + + it("type cast expression #102", () => { + verifyAndAssertMessages("for (let a of (a: Array)) {}"); + }); + + it("multiple nullable type annotations and return #108", () => { + verifyAndAssertMessages( + ` + import type Foo from 'foo'; + import type Foo2 from 'foo'; + import type Foo3 from 'foo'; + function log(foo: ?Foo, foo2: ?Foo2): ?Foo3 { + console.log(foo, foo2); + } + log(1, 2); + `, + { "no-unused-vars": 1, "no-undef": 1 }, + ); + }); + + it("interface declaration", () => { + verifyAndAssertMessages( + ` + interface Foo {}; + interface Bar { + foo: Foo, + }; + `, + { "no-unused-vars": 1, "no-undef": 1 }, + ["2:11 'Bar' is defined but never used. no-unused-vars"], + ); + }); + + it("type parameter bounds (classes)", () => { + verifyAndAssertMessages( + ` + import type {Foo, Foo2} from 'foo'; + import Base from 'base'; + class Log extends Base { + messages: {[T1]: T2}; + } + new Log(); + `, + { "no-unused-vars": 1, "no-undef": 1 }, + ["3:34 'T4' is defined but never used. no-unused-vars"], + ); + }); + + it("type parameter scope (classes)", () => { + verifyAndAssertMessages( + ` + T; + class Foo {} + T; + new Foo(); + `, + { "no-unused-vars": 1, "no-undef": 1 }, + [ + "1:1 'T' is not defined. no-undef", + "2:11 'T' is defined but never used. no-unused-vars", + "3:1 'T' is not defined. no-undef", + ], + ); + }); + + it("type parameter bounds (interfaces)", () => { + verifyAndAssertMessages( + ` + import type {Foo, Foo2, Bar} from ''; + interface Log extends Bar { + messages: {[T1]: T2}; + } + `, + { "no-unused-vars": 1, "no-undef": 1 }, + [ + "2:11 'Log' is defined but never used. no-unused-vars", + "2:38 'T4' is defined but never used. no-unused-vars", + ], + ); + }); + + it("type parameter scope (interfaces)", () => { + verifyAndAssertMessages( + ` + T; + interface Foo {}; + T; + Foo; + `, + { "no-unused-vars": 1, "no-undef": 1 }, + [ + "1:1 'T' is not defined. no-undef", + "2:15 'T' is defined but never used. no-unused-vars", + "3:1 'T' is not defined. no-undef", + ], + ); + }); + + it("type parameter bounds (type aliases)", () => { + verifyAndAssertMessages( + ` + import type {Foo, Foo2, Foo3} from 'foo'; + type Log = { + messages: {[T1]: T2}; + delay: Foo3; + }; + `, + { "no-unused-vars": 1, "no-undef": 1 }, + [ + "2:6 'Log' is defined but never used. no-unused-vars", + "2:29 'T3' is defined but never used. no-unused-vars", + ], + ); + }); + + it("type parameter scope (type aliases)", () => { + verifyAndAssertMessages( + ` + T; + type Foo = {}; + T; + Foo; + `, + { "no-unused-vars": 1, "no-undef": 1 }, + [ + "1:1 'T' is not defined. no-undef", + "2:10 'T' is defined but never used. no-unused-vars", + "3:1 'T' is not defined. no-undef", + ], + ); + }); + + it("type parameter bounds (functions)", () => { + verifyAndAssertMessages( + ` + import type Foo from 'foo'; + import type Foo2 from 'foo'; + function log(a: T1, b: T2): T3 { return a + b; } + log(1, 2); + `, + { "no-unused-vars": 1, "no-undef": 1 }, + ["3:37 'T4' is defined but never used. no-unused-vars"], + ); + }); + + it("type parameter scope (functions)", () => { + verifyAndAssertMessages( + ` + T; + function log() {} + T; + log; + `, + { "no-unused-vars": 1, "no-undef": 1 }, + [ + "1:1 'T' is not defined. no-undef", + "2:14 'T' is defined but never used. no-unused-vars", + "3:1 'T' is not defined. no-undef", + ], + ); + }); + + it("nested type annotations", () => { + verifyAndAssertMessages( + ` + import type Foo from 'foo'; + function foo(callback: () => Foo) { + return callback(); + } + foo(); + `, + { "no-unused-vars": 1, "no-undef": 1 }, + ); + }); + + it("type in var declaration", () => { + verifyAndAssertMessages( + ` + import type Foo from 'foo'; + var x: Foo = 1; + x; + `, + { "no-unused-vars": 1, "no-undef": 1 }, + ); + }); + + it("object type annotation", () => { + verifyAndAssertMessages( + ` + import type Foo from 'foo'; + var a: {numVal: Foo}; + a; + `, + { "no-unused-vars": 1, "no-undef": 1 }, + ); + }); + + it("object property types", () => { + verifyAndAssertMessages( + ` + import type Foo from 'foo'; + import type Foo2 from 'foo'; + var a = { + circle: (null : ?{ setNativeProps(props: Foo): Foo2 }) + }; + a; + `, + { "no-unused-vars": 1, "no-undef": 1 }, + ); + }); + + it("namespaced types", () => { + verifyAndAssertMessages( + ` + var React = require('react-native'); + var b = { + openExternalExample: (null: ?React.Component) + }; + var c = { + render(): React.Component {} + }; + b; + c; + `, + { "no-unused-vars": 1, "no-undef": 1 }, + ); + }); + + it("ArrayTypeAnnotation", () => { + verifyAndAssertMessages( + ` + import type Foo from 'foo'; + var x: Foo[]; x; + `, + { "no-unused-vars": 1, "no-undef": 1 }, + ); + }); + + it("ClassImplements", () => { + verifyAndAssertMessages( + ` + import type Bar from 'foo'; + export default class Foo implements Bar {} + `, + { "no-unused-vars": 1, "no-undef": 1 }, + ); + }); + + it("type alias creates declaration + usage", () => { + verifyAndAssertMessages( + ` + type Foo = any; + var x : Foo = 1; x; + `, + { "no-unused-vars": 1, "no-undef": 1 }, + ); + }); + + it("type alias with type parameters", () => { + verifyAndAssertMessages( + ` + import type Bar from 'foo'; + import type Foo3 from 'foo'; + type Foo = Bar + var x : Foo = 1; x; + `, + { "no-unused-vars": 1, "no-undef": 1 }, + ); + }); + + it("export type alias", () => { + verifyAndAssertMessages( + ` + import type Foo2 from 'foo'; + export type Foo = Foo2; + `, + { "no-unused-vars": 1, "no-undef": 1 }, + ); + }); + + it("polymorphic types #109", () => { + verifyAndAssertMessages( + "export default function groupByEveryN(array: Array, n: number): Array> { n; }", + { "no-unused-vars": 1, "no-undef": 1 }, + ); + }); + + it("types definition from import", () => { + verifyAndAssertMessages( + ` + import type Promise from 'bluebird'; + type Operation = () => Promise; + x: Operation; + `, + { "no-unused-vars": 1, "no-undef": 1 }, + ); + }); + + it("polymorphic/generic types for class #123", () => { + verifyAndAssertMessages( + ` + class Box { + value: T; + } + var box = new Box(); + console.log(box.value); + `, + { "no-unused-vars": 1, "no-undef": 1 }, + ); + }); + + it("polymorphic/generic types for function #123", () => { + verifyAndAssertMessages( + ` + export function identity(value) { + var a: T = value; a; + } + `, + { "no-unused-vars": 1, "no-undef": 1 }, + ); + }); + + it("polymorphic/generic types for type alias #123", () => { + verifyAndAssertMessages( + ` + import Bar from './Bar'; + type Foo = Bar; var x: Foo = 1; console.log(x); + `, + { "no-unused-vars": 1, "no-undef": 1 }, + ); + }); + + it("polymorphic/generic types - outside of fn scope #123", () => { + verifyAndAssertMessages( + ` + export function foo(value) { value; }; + var b: T = 1; b; + `, + { "no-unused-vars": 1, "no-undef": 1 }, + [ + "1:21 'T' is defined but never used. no-unused-vars", + "2:8 'T' is not defined. no-undef", + ], + ); + }); + + it("polymorphic/generic types - extending unknown #123", () => { + verifyAndAssertMessages( + ` + import Bar from 'bar'; + export class Foo extends Bar {} + `, + { "no-unused-vars": 1, "no-undef": 1 }, + ["2:30 'T' is not defined. no-undef"], + ); + }); + + it("polymorphic/generic types - function calls", () => { + verifyAndAssertMessages( + ` + function f(): T {} + f(); + `, + { "no-unused-vars": 1, "no-undef": 1 }, + ["2:3 'T' is not defined. no-undef"], + ); + }); + + it("polymorphic/generic types - function calls #644", () => { + verifyAndAssertMessages( + ` + import type {Type} from 'Type'; + function f(): T {} + f(); + `, + { "no-unused-vars": 1, "no-undef": 1 }, + ); + }); + + it("support declarations #132", () => { + verifyAndAssertMessages( + ` + declare class A { static () : number } + declare module B { declare var x: number; } + declare function foo(): void; + declare var bar + A; B; foo(); bar; + `, + { "no-undef": 1, "no-unused-vars": 1 }, + ); + }); + + it("supports type spreading", () => { + verifyAndAssertMessages( + ` + type U = {}; + type T = {a: number, ...U, ...V}; + `, + { "no-undef": 1, "no-unused-vars": 1 }, + [ + "2:6 'T' is defined but never used. no-unused-vars", + "2:31 'V' is not defined. no-undef", + ], + ); + }); + + it("1", () => { + verifyAndAssertMessages( + ` + import type Foo from 'foo'; + import type Foo2 from 'foo'; + export default function(a: Foo, b: ?Foo2, c){ a; b; c; } + `, + { "no-unused-vars": 1, "no-undef": 1 }, + ); + }); + + it("2", () => { + verifyAndAssertMessages( + ` + import type Foo from 'foo'; + export default function(a: () => Foo){ a; } + `, + { "no-unused-vars": 1, "no-undef": 1 }, + ); + }); + + it("3", () => { + verifyAndAssertMessages( + ` + import type Foo from 'foo'; + import type Foo2 from 'foo'; + export default function(a: (_:Foo) => Foo2){ a; } + `, + { "no-unused-vars": 1, "no-undef": 1 }, + ); + }); + + it("4", () => { + verifyAndAssertMessages( + ` + import type Foo from 'foo'; + import type Foo2 from 'foo'; + import type Foo3 from 'foo'; + export default function(a: (_1:Foo, _2:Foo2) => Foo3){ a; } + `, + { "no-unused-vars": 1, "no-undef": 1 }, + ); + }); + + it("5", () => { + verifyAndAssertMessages( + ` + import type Foo from 'foo'; + import type Foo2 from 'foo'; + export default function(a: (_1:Foo, ...foo:Array) => number){ a; } + `, + { "no-unused-vars": 1, "no-undef": 1 }, + ); + }); + + it("6", () => { + verifyAndAssertMessages( + ` + import type Foo from 'foo'; + export default function(): Foo {} + `, + { "no-unused-vars": 1, "no-undef": 1 }, + ); + }); + + it("7", () => { + verifyAndAssertMessages( + ` + import type Foo from 'foo'; + export default function():() => Foo {} + `, + { "no-unused-vars": 1, "no-undef": 1 }, + ); + }); + + it("8", () => { + verifyAndAssertMessages( + ` + import type Foo from 'foo'; + import type Foo2 from 'foo'; + export default function():(_?:Foo) => Foo2{} + `, + { "no-unused-vars": 1, "no-undef": 1 }, + ); + }); + + it("9", () => { + verifyAndAssertMessages( + "export default function (a: T1, b: T2) { b; }", + { "no-unused-vars": 1, "no-undef": 1 }, + ); + }); + + it("10", () => { + verifyAndAssertMessages( + "var a=function(a: T1, b: T2) {return a + b;}; a;", + { "no-unused-vars": 1, "no-undef": 1 }, + ); + }); + + it("11", () => { + verifyAndAssertMessages("var a={*id(x: T): T { x; }}; a;", { + "no-unused-vars": 1, + "no-undef": 1, + }); + }); + + it("12", () => { + verifyAndAssertMessages("var a={async id(x: T): T { x; }}; a;", { + "no-unused-vars": 1, + "no-undef": 1, + }); + }); + + it("13", () => { + verifyAndAssertMessages("var a={123(x: T): T { x; }}; a;", { + "no-unused-vars": 1, + "no-undef": 1, + }); + }); + + it("14", () => { + verifyAndAssertMessages( + ` + import type Foo from 'foo'; + import type Foo2 from 'foo'; + export default class Bar {set fooProp(value:Foo):Foo2{ value; }} + `, + { "no-unused-vars": 1, "no-undef": 1 }, + ); + }); + + it("15", () => { + verifyAndAssertMessages( + ` + import type Foo2 from 'foo'; + export default class Foo {get fooProp(): Foo2{}} + `, + { "no-unused-vars": 1, "no-undef": 1 }, + ); + }); + + it("16", () => { + verifyAndAssertMessages( + ` + import type Foo from 'foo'; + var numVal:Foo; numVal; + `, + { "no-unused-vars": 1, "no-undef": 1 }, + ); + }); + + it("17", () => { + verifyAndAssertMessages( + ` + import type Foo from 'foo'; + var a: {numVal: Foo;}; a; + `, + { "no-unused-vars": 1, "no-undef": 1 }, + ); + }); + + it("18", () => { + verifyAndAssertMessages( + ` + import type Foo from 'foo'; + import type Foo2 from 'foo'; + import type Foo3 from 'foo'; + var a: ?{numVal: Foo; [indexer: Foo2]: Foo3}; a; + `, + { "no-unused-vars": 1, "no-undef": 1 }, + ); + }); + + it("19", () => { + verifyAndAssertMessages( + ` + import type Foo from 'foo'; + import type Foo2 from 'foo'; + var a: {numVal: Foo; subObj?: ?{strVal: Foo2}}; a; + `, + { "no-unused-vars": 1, "no-undef": 1 }, + ); + }); + + it("20", () => { + verifyAndAssertMessages( + ` + import type Foo from 'foo'; + import type Foo2 from 'foo'; + import type Foo3 from 'foo'; + import type Foo4 from 'foo'; + var a: { [a: Foo]: Foo2; [b: Foo3]: Foo4; }; a; + `, + { "no-unused-vars": 1, "no-undef": 1 }, + ); + }); + + it("21", () => { + verifyAndAssertMessages( + ` + import type Foo from 'foo'; + import type Foo2 from 'foo'; + import type Foo3 from 'foo'; + var a: {add(x:Foo, ...y:Array): Foo3}; a; + `, + { "no-unused-vars": 1, "no-undef": 1 }, + ); + }); + + it("22", () => { + verifyAndAssertMessages( + ` + import type Foo from 'foo'; + import type Foo2 from 'foo'; + import type Foo3 from 'foo'; + var a: { id(x: Foo2): Foo3; }; a; + `, + { "no-unused-vars": 1, "no-undef": 1 }, + ); + }); + + it("23", () => { + verifyAndAssertMessages( + ` + import type Foo from 'foo'; + var a:Array = [1, 2, 3]; a; + `, + { "no-unused-vars": 1, "no-undef": 1 }, + ); + }); + + it("24", () => { + verifyAndAssertMessages( + ` + import type Baz from 'baz'; + export default class Bar extends Baz { }; + `, + { "no-unused-vars": 1, "no-undef": 1 }, + ); + }); + + it("25", () => { + verifyAndAssertMessages( + "export default class Bar { bar(): T { return 42; }}", + { "no-unused-vars": 1, "no-undef": 1 }, + ); + }); + + it("26", () => { + verifyAndAssertMessages( + ` + import type Foo from 'foo'; + import type Foo2 from 'foo'; + export default class Bar { static prop1:Foo; prop2:Foo2; } + `, + { "no-unused-vars": 1, "no-undef": 1 }, + ); + }); + + it("27", () => { + verifyAndAssertMessages( + ` + import type Foo from 'foo'; + import type Foo2 from 'foo'; + var x : Foo | Foo2 = 4; x; + `, + { "no-unused-vars": 1, "no-undef": 1 }, + ); + }); + + it("28", () => { + verifyAndAssertMessages( + ` + import type Foo from 'foo'; + import type Foo2 from 'foo'; + var x : () => Foo | () => Foo2; x; + `, + { "no-unused-vars": 1, "no-undef": 1 }, + ); + }); + + it("29", () => { + verifyAndAssertMessages( + ` + import type Foo from 'foo'; + import type Foo2 from 'foo'; + var x: typeof Foo | number = Foo2; x; + `, + { "no-unused-vars": 1, "no-undef": 1 }, + ); + }); + + it("30", () => { + verifyAndAssertMessages( + ` + import type Foo from 'foo'; + var {x}: {x: Foo; } = { x: 'hello' }; x; + `, + { "no-unused-vars": 1, "no-undef": 1 }, + ); + }); + + it("31", () => { + verifyAndAssertMessages( + ` + import type Foo from 'foo'; + var [x]: Array = [ 'hello' ]; x; + `, + { "no-unused-vars": 1, "no-undef": 1 }, + ); + }); + + it("32", () => { + verifyAndAssertMessages( + ` + import type Foo from 'foo'; + export default function({x}: { x: Foo; }) { x; } + `, + { "no-unused-vars": 1, "no-undef": 1 }, + ); + }); + + it("33", () => { + verifyAndAssertMessages( + ` + import type Foo from 'foo'; + function foo([x]: Array) { x; } foo(); + `, + { "no-unused-vars": 1, "no-undef": 1 }, + ); + }); + + it("34", () => { + verifyAndAssertMessages( + ` + import type Foo from 'foo'; + import type Foo2 from 'foo'; + var a: Map >; a; + `, + { "no-unused-vars": 1, "no-undef": 1 }, + ); + }); + + it("35", () => { + verifyAndAssertMessages( + ` + import type Foo from 'foo'; + var a: ?Promise[]; a; + `, + { "no-unused-vars": 1, "no-undef": 1 }, + ); + }); + + it("36", () => { + verifyAndAssertMessages( + ` + import type Foo from 'foo'; + import type Foo2 from 'foo'; + var a:(...rest:Array) => Foo2; a; + `, + { "no-unused-vars": 1, "no-undef": 1 }, + ); + }); + + it("37", () => { + verifyAndAssertMessages( + ` + import type Foo from 'foo'; + import type Foo2 from 'foo'; + import type Foo3 from 'foo'; + import type Foo4 from 'foo'; + var a: (x: Foo2, ...y:Foo3[]) => Foo4; a; + `, + { "no-unused-vars": 1, "no-undef": 1 }, + ); + }); + + it("38", () => { + verifyAndAssertMessages( + ` + import type {foo, bar} from 'baz'; + foo; bar; + `, + { "no-unused-vars": 1, "no-undef": 1 }, + ); + }); + + it("39", () => { + verifyAndAssertMessages( + ` + import type {foo as bar} from 'baz'; + bar; + `, + { "no-unused-vars": 1, "no-undef": 1 }, + ); + }); + + it("40", () => { + verifyAndAssertMessages( + ` + import type from 'foo'; + type; + `, + { "no-unused-vars": 1, "no-undef": 1 }, + ); + }); + + it("41", () => { + verifyAndAssertMessages( + ` + import type, {foo} from 'bar'; + type; foo; + `, + { "no-unused-vars": 1, "no-undef": 1 }, + ); + }); + + it("43", () => { + verifyAndAssertMessages( + ` + import type Foo from 'foo'; + var a: Foo[]; a; + `, + { "no-unused-vars": 1, "no-undef": 1 }, + ); + }); + + it("44", () => { + verifyAndAssertMessages( + ` + import type Foo from 'foo'; + var a: ?Foo[]; a; + `, + { "no-unused-vars": 1, "no-undef": 1 }, + ); + }); + + it("45", () => { + verifyAndAssertMessages( + ` + import type Foo from 'foo'; + var a: (?Foo)[]; a; + `, + { "no-unused-vars": 1, "no-undef": 1 }, + ); + }); + + it("46", () => { + verifyAndAssertMessages( + ` + import type Foo from 'foo'; + var a: () => Foo[]; a; + `, + { "no-unused-vars": 1, "no-undef": 1 }, + ); + }); + + it("47", () => { + verifyAndAssertMessages( + ` + import type Foo from 'foo'; + var a: (() => Foo)[]; a; + `, + { "no-unused-vars": 1, "no-undef": 1 }, + ); + }); + + it("48", () => { + verifyAndAssertMessages( + ` + import type Foo from 'foo'; + var a: typeof Foo[]; a; + `, + { "no-unused-vars": 1, "no-undef": 1 }, + ); + }); + + it("49", () => { + verifyAndAssertMessages( + ` + import type Foo from 'foo'; + import type Foo2 from 'foo'; + import type Foo3 from 'foo'; + var a : [Foo, Foo2,] = [123, 'duck',]; a; + `, + { "no-unused-vars": 1, "no-undef": 1 }, + ); + }); + }); + + it("class usage", () => { + verifyAndAssertMessages("class Lol {} module.exports = Lol;", { + "no-unused-vars": 1, + }); + }); + + it("class definition: gaearon/redux#24", () => { + verifyAndAssertMessages( + ` + export default function root(stores) { + return DecoratedComponent => class ReduxRootDecorator { + a() { DecoratedComponent; stores; } + }; + } + `, + { "no-undef": 1, "no-unused-vars": 1 }, + ); + }); + + it("class properties #71", () => { + verifyAndAssertMessages("class Lol { foo = 'bar'; }", { "no-undef": 1 }); + }); + + it("template strings #31", () => { + verifyAndAssertMessages("console.log(`${a}, b`);", { "comma-spacing": 1 }); + }); + + it("template with destructuring #31", () => { + verifyAndAssertMessages( + ` + module.exports = { + render() { + var {name} = this.props; + return Math.max(null, \`Name: \${name}, Name: \${name}\`); + } + }; + `, + { "comma-spacing": 1 }, + ); + }); + + it("template with arrow returning template #603", () => { + verifyAndAssertMessages( + ` + var a = \`\${() => { + \`\${''}\` + }}\`; + `, + { indent: 1 }, + [], + ); + }); + + describe("decorators #72 (legacy)", () => { + function verifyDecoratorsLegacyAndAssertMessages( + code, + rules, + expectedMessages, + sourceType, + ) { + const overrideConfig = { + parserOptions: { + sourceType, + babelOptions: { + configFile: require.resolve( + "@babel/eslint-shared-fixtures/config/babel.config.decorators-legacy.js", + ), + }, + }, + }; + return verifyAndAssertMessages( + code, + rules, + expectedMessages, + sourceType, + overrideConfig, + ); + } + + it("class declaration", () => { + verifyDecoratorsLegacyAndAssertMessages( + ` + import classDeclaration from 'decorator'; + import decoratorParameter from 'decorator'; + @classDeclaration((parameter) => parameter) + @classDeclaration(decoratorParameter) + @classDeclaration + export class TextareaAutosize {} + `, + { "no-unused-vars": 1 }, + ); + }); + + it("method definition", () => { + verifyDecoratorsLegacyAndAssertMessages( + ` + import classMethodDeclarationA from 'decorator'; + import decoratorParameter from 'decorator'; + export class TextareaAutosize { + @classMethodDeclarationA((parameter) => parameter) + @classMethodDeclarationA(decoratorParameter) + @classMethodDeclarationA + methodDeclaration(e) { + e(); + } + } + `, + { "no-unused-vars": 1 }, + ); + }); + + it("method definition get/set", () => { + verifyDecoratorsLegacyAndAssertMessages( + ` + import classMethodDeclarationA from 'decorator'; + import decoratorParameter from 'decorator'; + export class TextareaAutosize { + @classMethodDeclarationA((parameter) => parameter) + @classMethodDeclarationA(decoratorParameter) + @classMethodDeclarationA + get bar() { } + @classMethodDeclarationA((parameter) => parameter) + @classMethodDeclarationA(decoratorParameter) + @classMethodDeclarationA + set bar(val) { val; } + } + `, + { "no-unused-vars": 1 }, + ); + }); + + it("object property", () => { + verifyDecoratorsLegacyAndAssertMessages( + ` + import classMethodDeclarationA from 'decorator'; + import decoratorParameter from 'decorator'; + var obj = { + @classMethodDeclarationA((parameter) => parameter) + @classMethodDeclarationA(decoratorParameter) + @classMethodDeclarationA + methodDeclaration(e) { + e(); + } + }; + obj; + `, + { "no-unused-vars": 1 }, + ); + }); + + it("object property get/set", () => { + verifyDecoratorsLegacyAndAssertMessages( + ` + import classMethodDeclarationA from 'decorator'; + import decoratorParameter from 'decorator'; + var obj = { + @classMethodDeclarationA((parameter) => parameter) + @classMethodDeclarationA(decoratorParameter) + @classMethodDeclarationA + get bar() { }, + @classMethodDeclarationA((parameter) => parameter) + @classMethodDeclarationA(decoratorParameter) + @classMethodDeclarationA + set bar(val) { val; } + }; + obj; + `, + { "no-unused-vars": 1 }, + ); + }); + }); + + describe("decorators #72", () => { + it("class declaration", () => { + verifyAndAssertMessages( + ` + import classDeclaration from 'decorator'; + import decoratorParameter from 'decorator'; + export + @classDeclaration((parameter) => parameter) + @classDeclaration(decoratorParameter) + @classDeclaration + class TextareaAutosize {} + `, + { "no-unused-vars": 1 }, + ); + }); + + it("method definition", () => { + verifyAndAssertMessages( + ` + import classMethodDeclarationA from 'decorator'; + import decoratorParameter from 'decorator'; + export class TextareaAutosize { + @classMethodDeclarationA((parameter) => parameter) + @classMethodDeclarationA(decoratorParameter) + @classMethodDeclarationA + methodDeclaration(e) { + e(); + } + } + `, + { "no-unused-vars": 1 }, + ); + }); + + it("method definition get/set", () => { + verifyAndAssertMessages( + ` + import classMethodDeclarationA from 'decorator'; + import decoratorParameter from 'decorator'; + export class TextareaAutosize { + @classMethodDeclarationA((parameter) => parameter) + @classMethodDeclarationA(decoratorParameter) + @classMethodDeclarationA + get bar() { } + @classMethodDeclarationA((parameter) => parameter) + @classMethodDeclarationA(decoratorParameter) + @classMethodDeclarationA + set bar(val) { val; } + } + `, + { "no-unused-vars": 1 }, + ); + }); + }); + + it("detects minimal no-unused-vars case #120", () => { + verifyAndAssertMessages("var unused;", { "no-unused-vars": 1 }, [ + "1:5 'unused' is defined but never used. no-unused-vars", + ]); + }); + + // This two tests are disabled, as the feature to visit properties when + // there is a spread/rest operator has been removed as it caused problems + // with other rules #249 + it.skip("visits excluded properties left of spread #95", () => { + verifyAndAssertMessages( + "var originalObject = {}; var {field1, field2, ...clone} = originalObject;", + { "no-unused-vars": 1 }, + ); + }); + + it.skip("visits excluded properties left of spread #210", () => { + verifyAndAssertMessages( + "const props = { yo: 'yo' }; const { ...otherProps } = props;", + { "no-unused-vars": 1 }, + ); + }); + + it("does not mark spread variables false-positive", () => { + verifyAndAssertMessages( + "var originalObject = {}; var {field1, field2, ...clone} = originalObject;", + { "no-undef": 1, "no-redeclare": 1 }, + ); + }); + + it("does not mark spread variables false-positive", () => { + verifyAndAssertMessages( + "const props = { yo: 'yo' }; const { ...otherProps } = props;", + { "no-undef": 1, "no-redeclare": 1 }, + ); + }); + + it("does not mark spread variables as use-before-define #249", () => { + verifyAndAssertMessages( + "var originalObject = {}; var {field1, field2, ...clone} = originalObject;", + { "no-use-before-define": 1 }, + ); + }); + + it("detects no-unused-vars with object destructuring #142", () => { + verifyAndAssertMessages( + "const {Bacona} = require('baconjs')", + { "no-undef": 1, "no-unused-vars": 1 }, + ["1:8 'Bacona' is assigned a value but never used. no-unused-vars"], + ); + }); + + it("don't warn no-unused-vars with spread #142", () => { + verifyAndAssertMessages( + ` + export default function test(data) { + return { + foo: 'bar', + ...data + }; + } + `, + { "no-undef": 1, "no-unused-vars": 1 }, + ); + }); + + it("excludes comment tokens #153", () => { + verifyAndAssertMessages( + ` + var a = [ + 1, + 2, // a trailing comment makes this line fail comma-dangle (always-multiline) + ]; + `, + { "comma-dangle": [2, "always-multiline"] }, + ); + + verifyAndAssertMessages( + ` + switch (a) { + // A comment here makes the above line fail brace-style + case 1: + console.log(a); + } + `, + { "brace-style": 2 }, + ); + }); + + it("ternary and parens #149", () => { + verifyAndAssertMessages("true ? (true) : false;", { "space-infix-ops": 1 }); + }); + + it("line comment space-in-parens #124", () => { + verifyAndAssertMessages( + ` + React.createClass({ + render() { + // return ( + //
+ // ); // <-- this is the line that is reported + } + }); + `, + { "space-in-parens": 1 }, + ); + }); + + it("block comment space-in-parens #124", () => { + verifyAndAssertMessages( + ` + React.createClass({ + render() { + /* + return ( +
+ ); // <-- this is the line that is reported + */ + } + }); + `, + { "space-in-parens": 1 }, + ); + }); + + it("no no-undef error with rest #11", () => { + verifyAndAssertMessages("const [a, ...rest] = ['1', '2', '3']; a; rest;", { + "no-undef": 1, + "no-unused-vars": 1, + }); + }); + + it("async function with space-before-function-paren #168", () => { + verifyAndAssertMessages("it('handles updates', async function() {});", { + "space-before-function-paren": [1, "never"], + }); + }); + + it("default param flow type no-unused-vars #184", () => { + verifyAndAssertMessages( + ` + type ResolveOptionType = { + depth?: number, + identifier?: string + }; + + export default function resolve( + options: ResolveOptionType = {} + ): Object { + options; + } + `, + { "no-unused-vars": 1, "no-undef": 1 }, + ); + }); + + it("no-use-before-define #192", () => { + verifyAndAssertMessages( + ` + console.log(x); + var x = 1; + `, + { "no-use-before-define": 1 }, + ["1:13 'x' was used before it was defined. no-use-before-define"], + ); + }); + + it("jsx and stringliteral #216", () => { + verifyAndAssertMessages("
"); + }); + + it("getter/setter #218", () => { + verifyAndAssertMessages( + ` + class Person { + set a (v) { } + } + `, + { + "space-before-function-paren": 1, + "keyword-spacing": [1, { before: true }], + indent: 1, + }, + ); + }); + + it("getter/setter #220", () => { + verifyAndAssertMessages( + ` + var B = { + get x () { + return this.ecks; + }, + set x (ecks) { + this.ecks = ecks; + } + }; + `, + { "no-dupe-keys": 1 }, + ); + }); + + it("fixes issues with flow types and ObjectPattern", () => { + verifyAndAssertMessages( + ` + import type Foo from 'bar'; + export default class Foobar { + foo({ bar }: Foo) { bar; } + bar({ foo }: Foo) { foo; } + } + `, + { "no-unused-vars": 1, "no-shadow": 1 }, + ); + }); + + it("correctly detects redeclares if in script mode #217", () => { + verifyAndAssertMessages( + ` + var a = 321; + var a = 123; + `, + { "no-redeclare": 1 }, + ["2:5 'a' is already defined. no-redeclare"], + "script", + ); + }); + + it("correctly detects redeclares if in module mode #217", () => { + verifyAndAssertMessages( + ` + var a = 321; + var a = 123; + `, + { "no-redeclare": 1 }, + ["2:5 'a' is already defined. no-redeclare"], + "module", + ); + }); + + it("no-implicit-globals in script: globalReturn is false", () => { + verifyAndAssertMessages( + "var leakedGlobal = 1;", + { "no-implicit-globals": 1 }, + [ + "1:5 Unexpected 'var' declaration in the global scope, wrap in an IIFE for a local variable, assign as global property for a global variable. no-implicit-globals", + ], + "script", + { + env: {}, + parserOptions: { + ecmaVersion: 6, + sourceType: "script", + ecmaFeatures: { globalReturn: false }, + }, + }, + ); + }); + + it("no-implicit-globals in script: globalReturn is true", () => { + verifyAndAssertMessages( + "var leakedGlobal = 1;", + { "no-implicit-globals": 1 }, + [], + "script", + { + env: {}, + parserOptions: { + ecmaVersion: 6, + sourceType: "script", + ecmaFeatures: { globalReturn: true }, + }, + }, + ); + }); + + it("no-implicit-globals in module", () => { + verifyAndAssertMessages( + "var leakedGlobal = 1;", + { "no-implicit-globals": 1 }, + [], + "module", + { + env: {}, + parserOptions: { ecmaVersion: 6, sourceType: "module" }, + }, + ); + }); + + it("no-implicit-globals in default", () => { + verifyAndAssertMessages( + "var leakedGlobal = 1;", + { "no-implicit-globals": 1 }, + [], + undefined, + { + env: {}, + parserOptions: { ecmaVersion: 6 }, + }, + ); + }); + + it("allowImportExportEverywhere option (#327)", () => { + verifyAndAssertMessages( + ` + if (true) { import Foo from 'foo'; } + function foo() { import Bar from 'bar'; } + switch (a) { case 1: import FooBar from 'foobar'; } + `, + {}, + [], + "module", + { + env: {}, + parserOptions: { + ecmaVersion: 6, + sourceType: "module", + allowImportExportEverywhere: true, + }, + }, + ); + }); + + it("with does not crash parsing in script mode (strict off) #171", () => { + verifyAndAssertMessages("with (arguments) { length; }", {}, [], "script"); + }); + + xit("with does crash parsing in module mode (strict on) #171", () => { + verifyAndAssertMessages("with (arguments) { length; }", {}, [ + "1:1 Parsing error: 'with' in strict mode", + ]); + }); + + it("new.target is not reported as undef #235", () => { + verifyAndAssertMessages("function foo () { return new.target }", { + "no-undef": 1, + }); + }); + + it("decorator does not create TypeError #229", () => { + verifyAndAssertMessages( + ` + class A { + @test + f() {} + } + `, + { "no-undef": 1 }, + ["2:4 'test' is not defined. no-undef"], + ); + }); + + it("Flow definition does not trigger warnings #223", () => { + verifyAndAssertMessages( + ` + import { Map as $Map } from 'immutable'; + function myFunction($state: $Map, { a, b, c } : { a: ?Object, b: ?Object, c: $Map }) {} + `, + { "no-dupe-args": 1, "no-redeclare": 1, "no-shadow": 1 }, + ); + }); + + it("newline-before-return with comments #289", () => { + verifyAndAssertMessages( + ` + function a() { + if (b) { + /* eslint-disable no-console */ + console.log('test'); + /* eslint-enable no-console */ + } + + return hasGlobal; + } + `, + { "newline-before-return": 1 }, + ); + }); + + it("spaced-comment with shebang #163", () => { + verifyAndAssertMessages( + ` + #!/usr/bin/env babel-node + import {spawn} from 'foobar'; + `, + { "spaced-comment": 1 }, + ); + }); + + describe("Class Property Declarations", () => { + it("no-redeclare false positive 1", () => { + verifyAndAssertMessages( + ` + class Group { + static propTypes = {}; + } + class TypicalForm { + static propTypes = {}; + } + `, + { "no-redeclare": 1 }, + ); + }); + + it("no-redeclare false positive 2", () => { + verifyAndAssertMessages( + ` + function validate() {} + class MyComponent { + static validate = validate; + } + `, + { "no-redeclare": 1 }, + ); + }); + + it("check references", () => { + verifyAndAssertMessages( + ` + var a; + class A { + prop1; + prop2 = a; + prop3 = b; + } + new A + `, + { "no-undef": 1, "no-unused-vars": 1, "no-redeclare": 1 }, + ["5:11 'b' is not defined. no-undef"], + ); + }); + }); + + it("dynamic import support", () => { + verifyAndAssertMessages("import('test-module').then(() => {})"); + }); + + it("regex with es6 unicodeCodePointEscapes", () => { + verifyAndAssertMessages( + "string.replace(/[\u{0000A0}-\u{10FFFF}<>&]/gmiu, (char) => `&#x${char.codePointAt(0).toString(16)};`);", + ); + }); + + describe("class field declarations", () => { + describe("field declarations", () => { + it("should not be undefined", () => { + verifyAndAssertMessages( + ` + class C { + d = 1; + } + `, + { "no-undef": 1 }, + ); + }); + + it("should not be unused", () => { + verifyAndAssertMessages( + ` + export class C { + d = 1; + } + `, + { "no-unused-vars": 1 }, + ); + }); + }); + + describe("private field declarations", () => { + it("should not be undefined", () => { + verifyAndAssertMessages( + ` + class C { + #d = 1; + } + `, + { "no-undef": 1 }, + ); + }); + + it("should not be unused", () => { + verifyAndAssertMessages( + ` + export class C { + #d = 1; + } + `, + { "no-unused-vars": 1 }, + ); + }); + }); + + describe("private methods", () => { + it("should not be undefined", () => { + verifyAndAssertMessages( + ` + class C { + #d() {}; + } + `, + { "no-undef": 1 }, + ); + }); + + it("should not be unused", () => { + verifyAndAssertMessages( + ` + export class C { + #d() {}; + } + `, + { "no-unused-vars": 1 }, + ); + }); + }); + }); + + describe("optional chaining operator", () => { + it("should not be undefined #595", () => { + verifyAndAssertMessages( + ` + const foo = {}; + foo?.bar; + `, + { "no-undef": 1 }, + ); + }); + }); + + it("flow types on class method should be visited correctly", () => { + verifyAndAssertMessages( + ` + import type NodeType from 'foo'; + class NodeUtils { + finishNodeAt(node: T): T { return node; } + } + + new NodeUtils(); + `, + { "no-unused-vars": 1 }, + ); + }); + + it("works with dynamicImport", () => { + verifyAndAssertMessages( + ` + import('a'); + `, + ); + }); + + it("works with numericSeparator", () => { + verifyAndAssertMessages( + ` + 1_000 + `, + ); + }); + + it("works with optionalChaining", () => { + verifyAndAssertMessages( + ` + a?.b + `, + ); + }); + + it("works with import.meta", () => { + verifyAndAssertMessages( + ` + import.meta + `, + ); + }); + + it("works with classPrivateProperties", () => { + verifyAndAssertMessages( + ` + class A { #a = 1; } + `, + ); + }); + + it("works with classPrivateMethods", () => { + verifyAndAssertMessages( + ` + class A { #a(b, c) {} } + `, + ); + }); + + it("works with arrow function classPrivateProperties", () => { + verifyAndAssertMessages( + ` + class A { #a = (a, b) => {}; } + `, + ); + }); + + it("works with optionalCatchBinding", () => { + verifyAndAssertMessages( + ` + try {} catch {} + try {} catch {} finally {} + `, + ); + }); + + it("exportDefaultFrom", () => { + verifyAndAssertMessages( + ` + export v from "mod" + `, + ); + }); + + it("exportNamespaceFrom", () => { + verifyAndAssertMessages( + ` + export * as ns from "mod" + `, + ); + }); + + it("ignore eval in scope analysis", () => { + verifyAndAssertMessages( + ` + const a = 1; + console.log(a); + eval(''); + `, + { "no-unused-vars": 1, "no-undef": 1 }, + ); + }); +}); diff --git a/eslint/babel-eslint-plugin-development/.npmignore b/eslint/babel-eslint-plugin-development/.npmignore new file mode 100644 index 000000000000..c3aafe7a7721 --- /dev/null +++ b/eslint/babel-eslint-plugin-development/.npmignore @@ -0,0 +1,4 @@ +src +test +.* +*.log \ No newline at end of file diff --git a/eslint/babel-eslint-plugin-development/README.md b/eslint/babel-eslint-plugin-development/README.md new file mode 100644 index 000000000000..12cc354b7470 --- /dev/null +++ b/eslint/babel-eslint-plugin-development/README.md @@ -0,0 +1,38 @@ +# @babel/eslint-plugin-development + +A set of eslint rules to enforce best practices in the development of Babel plugins. + +## Installation + +You'll first need to install [ESLint](http://eslint.org): + +``` +$ npm install --save-dev eslint +``` + +Next, install `@babel/eslint-plugin-development`: + +``` +$ npm install --save-dev @babel/eslint-plugin-development +``` + +Then, load the plugin in your `.eslintrc` configuration file. You can omit the `eslint-plugin-` prefix: + +```json +{ + "plugins": ["@babel/development"] +} +``` + +## Supported Rules + +> Note: Rules marked with :wrench: are autofixable. + +* `@babel/development/no-deprecated-clone` (:wrench:): Disallows using the deprecated + `t.clone(node)` and `t.cloneDeep(node)` methods from `@babel/types`. Those + calls are replaced with `t.cloneNode(node)` when using `eslint --fix`. +* `@babel/development/no-undefined-identifier`: Disallows using + `t.identifier("undefined")` to create a node which represents an `undefined` + value, since it might cause problem if `undefined` is redeclared. +* `@babel/development/plugin-name`: Requires plugins to have a `name` property, which + can be useful for debugging purposes. diff --git a/eslint/babel-eslint-plugin-development/package.json b/eslint/babel-eslint-plugin-development/package.json new file mode 100644 index 000000000000..609022429995 --- /dev/null +++ b/eslint/babel-eslint-plugin-development/package.json @@ -0,0 +1,36 @@ +{ + "name": "@babel/eslint-plugin-development", + "version": "0.0.0", + "description": "ESLint rules that enforce best practices in the development of Babel plugins.", + "private": true, + "keywords": [ + "eslint", + "eslintplugin", + "eslint-plugin" + ], + "author": { + "name": "Nicolò Ribaudo", + "email": "nicolo.ribaudo@gmail.com", + "url": "https://github.com/nicolo-ribaudo" + }, + "main": "lib/index.js", + "devDependencies": { + "eslint": "^5.9.0" + }, + "engines": { + "node": ">=10.9" + }, + "publishConfig": { + "access": "public" + }, + "license": "MIT", + "repository": { + "type": "git", + "url": "https://github.com/babel/babel.git", + "directory": "eslint/babel-eslint-plugin-development" + }, + "bugs": { + "url": "https://github.com/babel/babel/issues" + }, + "homepage": "https://github.com/babel/babel/tree/master/eslint/babel-eslint-plugin-development" +} diff --git a/eslint/babel-eslint-plugin-development/src/index.js b/eslint/babel-eslint-plugin-development/src/index.js new file mode 100644 index 000000000000..ae6662710684 --- /dev/null +++ b/eslint/babel-eslint-plugin-development/src/index.js @@ -0,0 +1,11 @@ +import noDeprecatedClone from "./rules/no-deprecated-clone"; +import noUndefinedIdentifier from "./rules/no-undefined-identifier"; +import pluginName from "./rules/plugin-name"; + +export default { + rules: { + "no-deprecated-clone": noDeprecatedClone, + "no-undefined-identifier": noUndefinedIdentifier, + "plugin-name": pluginName, + }, +}; diff --git a/eslint/babel-eslint-plugin-development/src/rules/no-deprecated-clone.js b/eslint/babel-eslint-plugin-development/src/rules/no-deprecated-clone.js new file mode 100644 index 000000000000..dddc5eb3b729 --- /dev/null +++ b/eslint/babel-eslint-plugin-development/src/rules/no-deprecated-clone.js @@ -0,0 +1,39 @@ +import getReferenceOrigin from "../utils/get-reference-origin"; +import isFromBabelTypes from "../utils/is-from-babel-types"; + +export default { + meta: { + schema: [], + fixable: "code", + }, + create(context) { + return { + CallExpression(node) { + const { callee } = node; + const scope = context.getScope(); + + const origin = getReferenceOrigin(callee, scope); + if (!origin) return; + + const { name } = origin; + if ( + (name === "clone" || name === "cloneDeep") && + isFromBabelTypes(origin, scope) + ) { + const isMemberExpression = callee.type === "MemberExpression"; + const id = isMemberExpression ? callee.property : callee; + + context.report({ + node: id, + message: `t.${name}() is deprecated. Use t.cloneNode() instead.`, + fix(fixer) { + if (isMemberExpression) { + return fixer.replaceText(id, "cloneNode"); + } + }, + }); + } + }, + }; + }, +}; diff --git a/eslint/babel-eslint-plugin-development/src/rules/no-undefined-identifier.js b/eslint/babel-eslint-plugin-development/src/rules/no-undefined-identifier.js new file mode 100644 index 000000000000..33e154be8979 --- /dev/null +++ b/eslint/babel-eslint-plugin-development/src/rules/no-undefined-identifier.js @@ -0,0 +1,39 @@ +import getReferenceOrigin from "../utils/get-reference-origin"; +import isFromBabelTypes from "../utils/is-from-babel-types"; + +function firstArgumentIsUndefinedString(argumentsArray) { + return ( + argumentsArray.length > 0 && + argumentsArray[0].type === "Literal" && + argumentsArray[0].value === "undefined" + ); +} + +export default { + meta: { + schema: [], + }, + create(context) { + return { + CallExpression(node) { + const { callee } = node; + const scope = context.getScope(); + + const origin = getReferenceOrigin(callee, scope); + if (!origin) return; + + const { name } = origin; + if ( + (name === "identifier" || name === "Identifier") && + firstArgumentIsUndefinedString(node.arguments) && + isFromBabelTypes(origin, scope) + ) { + context.report( + node, + "Use path.scope.buildUndefinedNode() to create an undefined identifier directly.", + ); + } + }, + }; + }, +}; diff --git a/eslint/babel-eslint-plugin-development/src/rules/plugin-name.js b/eslint/babel-eslint-plugin-development/src/rules/plugin-name.js new file mode 100644 index 000000000000..df14476cd43b --- /dev/null +++ b/eslint/babel-eslint-plugin-development/src/rules/plugin-name.js @@ -0,0 +1,50 @@ +import isBabelPluginFactory from "../utils/is-babel-plugin-factory"; + +function getReturnValue(node) { + const { body } = node; + + if (body.type === "BlockStatement") { + const returnNode = body.body.find(n => n.type === "ReturnStatement"); + return returnNode && returnNode.argument; + } + + // Arrow functions with implicit return + return body; +} + +export default { + meta: { + schema: [], + }, + create(context /*: Context */) { + let pluginFound = false; + + return { + FunctionDeclaration: functionVisitor, + FunctionExpression: functionVisitor, + ArrowFunctionExpression: functionVisitor, + + "Program:exit"(node) { + if (!pluginFound) { + context.report(node, "This file does not export a Babel plugin."); + } + }, + }; + + function functionVisitor(node) { + if (!isBabelPluginFactory(node, context.getScope())) return; + + const returnValue = getReturnValue(node); + if (!returnValue || returnValue.type !== "ObjectExpression") return; + + pluginFound = true; + + if (!returnValue.properties.some(p => p.key.name === "name")) { + context.report( + returnValue, + "This Babel plugin doesn't have a 'name' property.", + ); + } + } + }, +}; diff --git a/eslint/babel-eslint-plugin-development/src/utils/get-export-name.js b/eslint/babel-eslint-plugin-development/src/utils/get-export-name.js new file mode 100644 index 000000000000..2d75e3e46a4d --- /dev/null +++ b/eslint/babel-eslint-plugin-development/src/utils/get-export-name.js @@ -0,0 +1,22 @@ +export default function getExportName(node) { + const { parent } = node; + + if (parent.type === "ExportDefaultDeclaration") { + return "default"; + } + + if (parent.type === "ExportNamedDeclaration") { + return node.id.name; + } + + if ( + parent.type === "AssignmentExpression" && + parent.left.type === "MemberExpression" && + parent.left.object.type === "Identifier" && + parent.left.object.name === "module" && + parent.left.property.type === "Identifier" && + parent.left.property.name === "exports" + ) { + return "module.exports"; + } +} diff --git a/eslint/babel-eslint-plugin-development/src/utils/get-reference-origin.js b/eslint/babel-eslint-plugin-development/src/utils/get-reference-origin.js new file mode 100644 index 000000000000..25fd7b0a541f --- /dev/null +++ b/eslint/babel-eslint-plugin-development/src/utils/get-reference-origin.js @@ -0,0 +1,141 @@ +/*:: +type ReferenceOriginImport = { kind: "import", source: string, name: string }; +type ReferenceOriginParam = { + kind: "param", + index: number, + functionNode: Node, +}; + +type ReferenceOrigin = + | ReferenceOriginImport + | ReferenceOriginParam + | { kind: "import *", source: string } + | { + kind: "property", + base: ReferenceOriginImport | ReferenceOriginParam, + path: string, + name: string, + }; +*/ + +// Given a node and a context, returns a description of where its value comes +// from. +// It resolves imports, parameters of exported functions and property accesses. +// See the ReferenceOrigin type for more informations. +export default function getReferenceOrigin( + node, + scope, +) /*: ?ReferenceOrigin */ { + if (node.type === "Identifier") { + const variable = getVariableDefinition(node.name, scope); + if (!variable) return null; + + const definition = variable.definition; + const defNode = definition.node; + + if (definition.type === "ImportBinding") { + if (defNode.type === "ImportSpecifier") { + return { + kind: "import", + source: definition.parent.source.value, + name: defNode.imported.name, + }; + } + if (defNode.type === "ImportNamespaceSpecifier") { + return { + kind: "import *", + source: definition.parent.source.value, + }; + } + } + + if (definition.type === "Variable" && defNode.init) { + const origin = getReferenceOrigin(defNode.init, variable.scope); + return origin && patternToProperty(definition.name, origin); + } + + if (definition.type === "Parameter") { + return patternToProperty(definition.name, { + kind: "param", + index: definition.index, + functionNode: definition.node, + }); + } + } + + if (node.type === "MemberExpression" && !node.computed) { + const origin = getReferenceOrigin(node.object, scope); + return origin && addProperty(origin, node.property.name); + } + + return null; +} + +function getVariableDefinition(name, scope) { + let currentScope = scope; + do { + const variable = currentScope.set.get(name); + if (variable && variable.defs[0]) { + return { scope: currentScope, definition: variable.defs[0] }; + } + } while ((currentScope = currentScope.upper)); +} + +function patternToProperty(id, base) { + const path = getPatternPath(id); + return path && path.reduce(addProperty, base); +} + +// Adds a property to a given origin. If it was a namespace import it becomes +// a named import, so that `import * as x from "foo"; x.bar` and +// `import { bar } from "foo"` have the same origin. +function addProperty(origin, name) { + if (origin.kind === "import *") { + return { + kind: "import", + source: origin.source, + name, + }; + } + if (origin.kind === "property") { + return { + kind: "property", + base: origin.base, + path: origin.path + "." + name, + name, + }; + } + return { + kind: "property", + base: origin, + path: name, + name, + }; +} + +// if "node" is c of { a: { b: c } }, the result is ["a","b"] +function getPatternPath(node) { + let current = node; + const path = []; + + // Unshift keys to path while going up + do { + const property = current.parent; + if ( + property.type === "ArrayPattern" || + property.type === "AssignmentPattern" || + property.computed + ) { + // These nodes are not supported. + return null; + } + if (property.type === "Property") { + path.unshift(property.key.name); + } else { + // The destructuring pattern is finished + break; + } + } while ((current = current.parent.parent)); + + return path; +} diff --git a/eslint/babel-eslint-plugin-development/src/utils/is-babel-plugin-factory.js b/eslint/babel-eslint-plugin-development/src/utils/is-babel-plugin-factory.js new file mode 100644 index 000000000000..19d889bffe21 --- /dev/null +++ b/eslint/babel-eslint-plugin-development/src/utils/is-babel-plugin-factory.js @@ -0,0 +1,24 @@ +import getReferenceOrigin from "./get-reference-origin"; +import getExportName from "./get-export-name"; + +export default function isBabelPluginFactory(node, scope) { + const { parent } = node; + + if (parent.type === "CallExpression") { + const calleeOrigin = getReferenceOrigin(parent.callee, scope); + + // Using "declare" from "@babel/helper-plugin-utils" + return !!( + calleeOrigin && + calleeOrigin.kind === "import" && + calleeOrigin.name === "declare" && + calleeOrigin.source === "@babel/helper-plugin-utils" + ); + } + + const exportName = getExportName(node); + + // export default function ({ types: t }) {} + // module.exports = function ({ types: t }) {} + return exportName === "default" || exportName === "module.exports"; +} diff --git a/eslint/babel-eslint-plugin-development/src/utils/is-from-babel-types.js b/eslint/babel-eslint-plugin-development/src/utils/is-from-babel-types.js new file mode 100644 index 000000000000..4a7a24bca040 --- /dev/null +++ b/eslint/babel-eslint-plugin-development/src/utils/is-from-babel-types.js @@ -0,0 +1,33 @@ +import isBabelPluginFactory from "./is-babel-plugin-factory"; + +// Check if a ReferenceOrigin (returned by ./get-reference-origin.js) +// is a reference to a @babel/types export. +export default function isFromBabelTypes( + origin /*: ReferenceOrigin */, + scope /*: Scope */, +) { + if (origin.kind === "import" && origin.source === "@babel/types") { + // imported from @babel/types + return true; + } + + if ( + origin.kind === "property" && + origin.base.kind === "import" && + origin.base.name === "types" && + origin.base.source === "@babel/core" + ) { + // imported from @babel/core + return true; + } + + if ( + origin.kind === "property" && + origin.base.kind === "param" && + origin.base.index === 0 + ) { + return isBabelPluginFactory(origin.base.functionNode, scope); + } + + return false; +} diff --git a/eslint/babel-eslint-plugin-development/test/rules/no-deprecated-clone.js b/eslint/babel-eslint-plugin-development/test/rules/no-deprecated-clone.js new file mode 100644 index 000000000000..9905bc170f0c --- /dev/null +++ b/eslint/babel-eslint-plugin-development/test/rules/no-deprecated-clone.js @@ -0,0 +1,136 @@ +import rule from "../../src/rules/no-deprecated-clone"; +import { RuleTester } from "eslint"; + +const cloneError = "t.clone() is deprecated. Use t.cloneNode() instead."; +const cloneDeepError = + "t.cloneDeep() is deprecated. Use t.cloneNode() instead."; + +const ruleTester = new RuleTester({ + parserOptions: { sourceType: "module" }, +}); + +ruleTester.run("no-deprecated-clone", rule, { + valid: [ + `_.clone(obj)`, + `_.cloneDeep(obj)`, + `import * as t from "lib"; t.clone();`, + `import * as t from "lib"; t.cloneDeep();`, + `function f(_) { _.types.clone(); }`, + `function f(_) { _.types.cloneDeep(); }`, + `import * as t from "@babel/types"; t.cloneNode();`, + ], + invalid: [ + { + code: `import { clone } from "@babel/types"; clone();`, + errors: [cloneError], + }, + { + code: `import { cloneDeep } from "@babel/types"; cloneDeep();`, + errors: [cloneDeepError], + }, + { + code: `import { clone } from "@babel/types"; var clone2 = clone; clone2();`, + errors: [cloneError], + }, + { + code: `import { cloneDeep } from "@babel/types"; var cloneDeep2 = cloneDeep; cloneDeep2();`, + errors: [cloneDeepError], + }, + { + code: `import * as t from "@babel/types"; t.clone();`, + errors: [cloneError], + }, + { + code: `import * as t from "@babel/types"; t.cloneDeep();`, + errors: [cloneDeepError], + }, + { + code: `import * as t from "@babel/types"; var { clone } = t; clone();`, + errors: [cloneError], + }, + { + code: `import * as t from "@babel/types"; var { cloneDeep } = t; cloneDeep();`, + errors: [cloneDeepError], + }, + { + code: `import { clone as c } from "@babel/types"; c();`, + errors: [cloneError], + }, + { + code: `import { cloneDeep as cD } from "@babel/types"; cD();`, + errors: [cloneDeepError], + }, + { + code: `import * as babel from "@babel/core"; babel.types.clone();`, + errors: [cloneError], + }, + { + code: `import * as babel from "@babel/core"; babel.types.cloneDeep();`, + errors: [cloneDeepError], + }, + { + code: `import { types } from "@babel/core"; types.clone();`, + errors: [cloneError], + }, + { + code: `import { types } from "@babel/core"; types.cloneDeep();`, + errors: [cloneDeepError], + }, + { + code: `import { types as t } from "@babel/core"; t.clone();`, + errors: [cloneError], + }, + { + code: `import { types as t } from "@babel/core"; t.cloneDeep();`, + errors: [cloneDeepError], + }, + { + code: `export default function plugin(babel) { babel.types.clone() }`, + errors: [cloneError], + }, + { + code: `export default function plugin(babel) { babel.types.cloneDeep() }`, + errors: [cloneDeepError], + }, + { + code: `export default function plugin({ types }) { types.clone() }`, + errors: [cloneError], + }, + { + code: `export default function plugin({ types }) { types.cloneDeep() }`, + errors: [cloneDeepError], + }, + { + code: `export default function plugin({ types: t }) { t.clone() }`, + errors: [cloneError], + }, + { + code: `export default function plugin({ types: t }) { t.cloneDeep() }`, + errors: [cloneDeepError], + }, + { + code: `export default ({ types }) => { types.clone() }`, + errors: [cloneError], + }, + { + code: `export default ({ types }) => { types.cloneDeep() }`, + errors: [cloneDeepError], + }, + { + code: `module.exports = function plugin({ types }) { types.clone() }`, + errors: [cloneError], + }, + { + code: `module.exports = function plugin({ types }) { types.cloneDeep() }`, + errors: [cloneDeepError], + }, + { + code: `import { declare } from "@babel/helper-plugin-utils"; declare(({ types }) => { types.clone() });`, + errors: [cloneError], + }, + { + code: `import { declare } from "@babel/helper-plugin-utils"; declare(({ types }) => { types.cloneDeep() });`, + errors: [cloneDeepError], + }, + ], +}); diff --git a/eslint/babel-eslint-plugin-development/test/rules/no-undefined-identifier.js b/eslint/babel-eslint-plugin-development/test/rules/no-undefined-identifier.js new file mode 100644 index 000000000000..d6d8c6b28b6b --- /dev/null +++ b/eslint/babel-eslint-plugin-development/test/rules/no-undefined-identifier.js @@ -0,0 +1,78 @@ +import rule from "../../src/rules/no-undefined-identifier"; +import { RuleTester } from "eslint"; + +const error = + "Use path.scope.buildUndefinedNode() to create an undefined identifier directly."; + +const ruleTester = new RuleTester({ + parserOptions: { sourceType: "module" }, +}); + +ruleTester.run("no-undefined-identifier", rule, { + valid: [ + `_.identifier("undefined")`, + `_.Identifier("undefined")`, + `import * as t from "lib"; t.identifier("undefined");`, + `function f(_) { _.types.identifier("undefined"); }`, + `import * as t from "@babel/types"; t.identifier("not_undefined");`, + `path.scope.buildUndefinedNode();`, + ], + invalid: [ + { + code: `import { identifier } from "@babel/types"; identifier("undefined");`, + errors: [error], + }, + { + code: `import { Identifier } from "@babel/types"; Identifier("undefined");`, + errors: [error], + }, + { + code: `import * as t from "@babel/types"; t.identifier("undefined");`, + errors: [error], + }, + { + code: `import * as t from "@babel/types"; var { identifier } = t; identifier("undefined");`, + errors: [error], + }, + { + code: `import { identifier as id } from "@babel/types"; id("undefined");`, + errors: [error], + }, + { + code: `import * as babel from "@babel/core"; babel.types.identifier("undefined");`, + errors: [error], + }, + { + code: `import { types } from "@babel/core"; types.identifier("undefined");`, + errors: [error], + }, + { + code: `import { types as t } from "@babel/core"; t.identifier("undefined");`, + errors: [error], + }, + { + code: `export default function plugin(babel) { babel.types.identifier("undefined") }`, + errors: [error], + }, + { + code: `export default function plugin({ types }) { types.identifier("undefined") }`, + errors: [error], + }, + { + code: `export default function plugin({ types: t }) { t.identifier("undefined") }`, + errors: [error], + }, + { + code: `export default ({ types }) => { types.identifier("undefined") }`, + errors: [error], + }, + { + code: `module.exports = function plugin({ types }) { types.identifier("undefined") }`, + errors: [error], + }, + { + code: `import { declare } from "@babel/helper-plugin-utils"; declare(({ types }) => { types.identifier("undefined") });`, + errors: [error], + }, + ], +}); diff --git a/eslint/babel-eslint-plugin-development/test/rules/plugin-name.js b/eslint/babel-eslint-plugin-development/test/rules/plugin-name.js new file mode 100644 index 000000000000..d39924efe752 --- /dev/null +++ b/eslint/babel-eslint-plugin-development/test/rules/plugin-name.js @@ -0,0 +1,52 @@ +import rule from "../../src/rules/plugin-name"; +import { RuleTester } from "eslint"; + +const missingPluginError = "This file does not export a Babel plugin."; +const missingNameError = "This Babel plugin doesn't have a 'name' property."; + +const ruleTester = new RuleTester({ + parserOptions: { sourceType: "module" }, +}); + +ruleTester.run("plugin-name", rule, { + valid: [ + `export default function () { return { name: "test-plugin" } }`, + `import { declare } from "@babel/helper-plugin-utils"; declare(() => { return { name: "test-plugin" } })`, + `import { declare } from "@babel/helper-plugin-utils"; declare(() => ({ name: "test-plugin" }))`, + `module.exports = function () { return { name: "foo" }; }`, + ], + invalid: [ + { + code: `function fn() { return { name: "foo" } }`, + errors: [missingPluginError], + }, + { + code: `export function fn() { return { name: "foo" } }`, + errors: [missingPluginError], + }, + { + code: `(function fn() { return { name: "foo" } })`, + errors: [missingPluginError], + }, + { + code: `() => { return { name: "foo" } }`, + errors: [missingPluginError], + }, + { + code: `export default function fn() {}`, + errors: [missingPluginError], + }, + { + code: `export default function fn() { return {} }`, + errors: [missingNameError], + }, + { + code: `import { declare } from "@babel/helper-plugin-utils"; declare(() => ({}))`, + errors: [missingNameError], + }, + { + code: `module.exports = function () { return {} }`, + errors: [missingNameError], + }, + ], +}); diff --git a/eslint/babel-eslint-plugin/.npmignore b/eslint/babel-eslint-plugin/.npmignore new file mode 100644 index 000000000000..ad69326ce8c2 --- /dev/null +++ b/eslint/babel-eslint-plugin/.npmignore @@ -0,0 +1,4 @@ +src +test +.* +*.log diff --git a/eslint/babel-eslint-plugin/LICENSE b/eslint/babel-eslint-plugin/LICENSE new file mode 100644 index 000000000000..3d0e2f3067b8 --- /dev/null +++ b/eslint/babel-eslint-plugin/LICENSE @@ -0,0 +1,23 @@ +Copyright (c) 2014-2015 Jason Quense +Original work by respective rule authors; copywrites noted in files. + +MIT License + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/eslint/babel-eslint-plugin/README.md b/eslint/babel-eslint-plugin/README.md new file mode 100644 index 000000000000..5577c01344c0 --- /dev/null +++ b/eslint/babel-eslint-plugin/README.md @@ -0,0 +1,47 @@ +# @babel/eslint-plugin + +Companion rules for `@babel/eslint-parser`. `@babel/eslint-parser` does a great job at adapting `eslint` +for use with Babel, but it can't change the built-in rules to support experimental features. +`@babel/eslint-plugin` re-implements problematic rules so they do not give false positives or negatives. + +> Requires Node 10.9 or greater + +### Install + +```sh +npm install @babel/eslint-plugin --save-dev +``` + +Load the plugin in your `.eslintrc.json` file: + +```json +{ + "plugins": ["@babel/eslint-plugin"] +} +``` + +Finally enable all the rules you would like to use (remember to disable the +original ones as well!). + +```json +{ + "rules": { + "babel/new-cap": "error", + "babel/no-invalid-this": "error", + "babel/no-unused-expressions": "error", + "babel/object-curly-spacing": "error", + "babel/semi": "error", + } +} +``` +### Rules + +Each rule corresponds to a core `eslint` rule and has the same options. + +🛠: means it's autofixable with `--fix`. + +- `babel/new-cap`: handles decorators (`@Decorator`) +- `babel/no-invalid-this`: handles class fields and private class methods (`class A { a = this.b; }`) +- `babel/no-unused-expressions`: handles `do` expressions +- `babel/object-curly-spacing`: handles `export * as x from "mod";` (🛠) +- `babel/semi`: Handles class properties (🛠) diff --git a/eslint/babel-eslint-plugin/package.json b/eslint/babel-eslint-plugin/package.json new file mode 100644 index 000000000000..f259174f472b --- /dev/null +++ b/eslint/babel-eslint-plugin/package.json @@ -0,0 +1,41 @@ +{ + "name": "@babel/eslint-plugin", + "version": "0.0.0", + "description": "Companion rules for @babel/eslint-parser", + "main": "lib/index.js", + "repository": { + "type": "git", + "url": "git+https://github.com/babel/babel.git", + "directory": "eslint/babel-eslint-plugin" + }, + "keywords": [ + "babel", + "eslint", + "eslintplugin", + "eslint-plugin", + "babel-eslint" + ], + "author": "Jason Quense @monasticpanic", + "license": "MIT", + "private": true, + "engines": { + "node": ">=10.9" + }, + "bugs": { + "url": "https://github.com/babel/babel/issues" + }, + "homepage": "https://github.com/babel/babel/tree/master/eslint/babel-eslint-plugin", + "peerDependencies": { + "@babel/eslint-parser": "0.0.0", + "eslint": ">=6.0.0" + }, + "dependencies": { + "eslint-rule-composer": "^0.3.0" + }, + "devDependencies": { + "@babel/eslint-shared-fixtures": "*", + "@babel/eslint-parser": "*", + "eslint": "^6.0.0", + "lodash.clonedeep": "^4.5.0" + } +} diff --git a/eslint/babel-eslint-plugin/src/index.js b/eslint/babel-eslint-plugin/src/index.js new file mode 100644 index 000000000000..96fd40caf70e --- /dev/null +++ b/eslint/babel-eslint-plugin/src/index.js @@ -0,0 +1,22 @@ +import newCap from "./rules/new-cap"; +import noInvalidThis from "./rules/no-invalid-this"; +import noUnusedExpressions from "./rules/no-unused-expressions"; +import objectCurlySpacing from "./rules/object-curly-spacing"; +import semi from "./rules/semi"; + +module.exports = { + rules: { + "new-cap": newCap, + "no-invalid-this": noInvalidThis, + "no-unused-expressions": noUnusedExpressions, + "object-curly-spacing": objectCurlySpacing, + semi, + }, + rulesConfig: { + "new-cap": "off", + "no-invalid-this": "off", + "no-unused-expressions": "off", + "object-curly-spacing": "off", + semi: "off", + }, +}; diff --git a/eslint/babel-eslint-plugin/src/rules/new-cap.js b/eslint/babel-eslint-plugin/src/rules/new-cap.js new file mode 100644 index 000000000000..1fddf1a43b5a --- /dev/null +++ b/eslint/babel-eslint-plugin/src/rules/new-cap.js @@ -0,0 +1,18 @@ +import ruleComposer from "eslint-rule-composer"; +import eslint from "eslint"; + +const rule = new eslint.Linter().getRules().get("new-cap"); + +/** + * Returns whether a node is under a decorator or not. + * @param {ASTNode} node CallExpression node + * @returns {Boolean} Returns true if the node is under a decorator. + */ +function isDecorator(node) { + return node.parent.type === "Decorator"; +} + +export default ruleComposer.filterReports( + rule, + problem => !isDecorator(problem.node), +); diff --git a/eslint/babel-eslint-plugin/src/rules/no-invalid-this.js b/eslint/babel-eslint-plugin/src/rules/no-invalid-this.js new file mode 100644 index 000000000000..4c6434235c2a --- /dev/null +++ b/eslint/babel-eslint-plugin/src/rules/no-invalid-this.js @@ -0,0 +1,20 @@ +import ruleComposer from "eslint-rule-composer"; +import eslint from "eslint"; + +const noInvalidThisRule = new eslint.Linter().getRules().get("no-invalid-this"); + +export default ruleComposer.filterReports(noInvalidThisRule, problem => { + let inClassProperty = false; + let node = problem.node; + + while (node) { + if (node.type === "ClassProperty" || node.type === "ClassPrivateProperty") { + inClassProperty = true; + return; + } + + node = node.parent; + } + + return !inClassProperty; +}); diff --git a/eslint/babel-eslint-plugin/src/rules/no-unused-expressions.js b/eslint/babel-eslint-plugin/src/rules/no-unused-expressions.js new file mode 100644 index 000000000000..a313b0743245 --- /dev/null +++ b/eslint/babel-eslint-plugin/src/rules/no-unused-expressions.js @@ -0,0 +1,64 @@ +import ruleComposer from "eslint-rule-composer"; +import eslint from "eslint"; + +const rule = new eslint.Linter().getRules().get("no-unused-expressions"); + +/** + * @param {ASTNode} node - any node + * @returns {boolean} whether the given node is either an IfStatement or an + * ExpressionStatement and is the last node in the body of a BlockStatement + */ +function isFinalStatementInBlockStatement(node) { + const parent = node.parent; + return ( + /^(?:If|Expression)Statement$/.test(node.type) && + parent.type === "BlockStatement" && + parent.body[parent.body.length - 1] === node + ); +} + +/** + * @param {ASTNode} node - any node + * @returns {boolean} whether the given node represents an unbroken chain of + * tail ExpressionStatements and IfStatements within a DoExpression + * https://github.com/tc39/proposal-do-expressions + */ +function isInDoStatement(node) { + if (!node) return false; + + if (node.type === "DoExpression") return true; + + // this is an `else if` + if ( + node.type === "IfStatement" && + node.parent && + node.parent.type === "IfStatement" + ) { + return isInDoStatement(node.parent); + } + + if (isFinalStatementInBlockStatement(node)) { + return isInDoStatement(node.parent.parent); + } + + return false; +} + +/** + * @param {ASTNode} node - any node + * @returns {boolean} whether the given node is an optional call expression, + * https://github.com/tc39/proposal-optional-chaining + */ +function isOptionalCallExpression(node) { + return ( + !!node && + node.type === "ExpressionStatement" && + node.expression.type === "OptionalCallExpression" + ); +} + +export default ruleComposer.filterReports( + rule, + problem => + !isInDoStatement(problem.node) && !isOptionalCallExpression(problem.node), +); diff --git a/eslint/babel-eslint-plugin/src/rules/object-curly-spacing.js b/eslint/babel-eslint-plugin/src/rules/object-curly-spacing.js new file mode 100644 index 000000000000..210f7a9fe5fa --- /dev/null +++ b/eslint/babel-eslint-plugin/src/rules/object-curly-spacing.js @@ -0,0 +1,20 @@ +import ruleComposer from "eslint-rule-composer"; +import eslint from "eslint"; + +const rule = new eslint.Linter().getRules().get("object-curly-spacing"); + +export default ruleComposer.filterReports(rule, problem => { + const node = problem.node; + + // Allow exportDefaultFrom syntax: + // export x from '...'; + if ( + node.type === "ExportNamedDeclaration" && + node.specifiers.length === 1 && + node.specifiers[0].type === "ExportDefaultSpecifier" + ) { + return false; + } + + return true; +}); diff --git a/eslint/babel-eslint-plugin/src/rules/semi.js b/eslint/babel-eslint-plugin/src/rules/semi.js new file mode 100644 index 000000000000..f8cc783ac64a --- /dev/null +++ b/eslint/babel-eslint-plugin/src/rules/semi.js @@ -0,0 +1,105 @@ +import ruleComposer from "eslint-rule-composer"; +import eslint from "eslint"; + +const OPT_OUT_PATTERN = /^[-[(/+`]/; // One of [(/+-` + +const rule = new eslint.Linter().getRules().get("semi"); + +function isSemicolon(token) { + return token.type === "Punctuator" && token.value === ";"; +} + +function isUnnecessarySemicolon(context, lastToken) { + if (!isSemicolon(lastToken)) { + return false; + } + + const nextToken = context.getSourceCode().getTokenAfter(lastToken); + + if (!nextToken) { + return true; + } + + const lastTokenLine = lastToken.loc.end.line; + const nextTokenLine = nextToken.loc.start.line; + const isOptOutToken = + OPT_OUT_PATTERN.test(nextToken.value) && + nextToken.value !== "++" && + nextToken.value !== "--"; + const isDivider = nextToken.value === "}" || nextToken.value === ";"; + + return (lastTokenLine !== nextTokenLine && !isOptOutToken) || isDivider; +} + +function isOneLinerBlock(context, node) { + const nextToken = context.getSourceCode().getTokenAfter(node); + + if (!nextToken || nextToken.value !== "}") { + return false; + } + + const parent = node.parent; + + return ( + parent && + parent.type === "BlockStatement" && + parent.loc.start.line === parent.loc.end.line + ); +} + +function report(context, node, missing) { + const lastToken = context.getSourceCode().getLastToken(node); + + let message, + fix, + loc = lastToken.loc; + + if (!missing) { + message = "Missing semicolon."; + loc = loc.end; + fix = function(fixer) { + return fixer.insertTextAfter(lastToken, ";"); + }; + } else { + message = "Extra semicolon."; + loc = loc.start; + fix = function(fixer) { + return fixer.remove(lastToken); + }; + } + + context.report({ + node, + loc, + message, + fix, + }); +} + +export default ruleComposer.joinReports([ + rule, + context => ({ + ClassProperty(node) { + const options = context.options[1]; + const exceptOneLine = options && options.omitLastInOneLineBlock === true; + const sourceCode = context.getSourceCode(); + const lastToken = sourceCode.getLastToken(node); + + if (context.options[0] === "never") { + if (isUnnecessarySemicolon(context, lastToken)) { + report(context, node, true); + } + } else { + if (!isSemicolon(lastToken)) { + if (!exceptOneLine || !isOneLinerBlock(context, node)) { + report(context, node); + } + } else { + if (exceptOneLine && isOneLinerBlock(context, node)) { + report(context, node, true); + } + } + } + }, + }), +]); diff --git a/eslint/babel-eslint-plugin/test/helpers/RuleTester.js b/eslint/babel-eslint-plugin/test/helpers/RuleTester.js new file mode 100644 index 000000000000..47166bd51185 --- /dev/null +++ b/eslint/babel-eslint-plugin/test/helpers/RuleTester.js @@ -0,0 +1,14 @@ +import { RuleTester } from "eslint"; + +RuleTester.setDefaultConfig({ + parser: require.resolve("@babel/eslint-parser"), + parserOptions: { + babelOptions: { + configFile: require.resolve( + "@babel/eslint-shared-fixtures/config/babel.config.js", + ), + }, + }, +}); + +export default RuleTester; diff --git a/eslint/babel-eslint-plugin/test/rules/new-cap.js b/eslint/babel-eslint-plugin/test/rules/new-cap.js new file mode 100644 index 000000000000..d5e44984152e --- /dev/null +++ b/eslint/babel-eslint-plugin/test/rules/new-cap.js @@ -0,0 +1,12 @@ +import rule from "../../src/rules/new-cap"; +import RuleTester from "../helpers/RuleTester"; + +const ruleTester = new RuleTester(); +ruleTester.run("@babel/new-cap", rule, { + valid: [ + { + code: "@MyDecorator(123) class MyClass{}", + }, + ], + invalid: [], +}); diff --git a/eslint/babel-eslint-plugin/test/rules/no-invalid-this.js b/eslint/babel-eslint-plugin/test/rules/no-invalid-this.js new file mode 100644 index 000000000000..0f8b12a5159b --- /dev/null +++ b/eslint/babel-eslint-plugin/test/rules/no-invalid-this.js @@ -0,0 +1,121 @@ +import cloneDeep from "lodash.clonedeep"; +import rule from "../../src/rules/no-invalid-this"; +import RuleTester from "../helpers/RuleTester"; + +/** + * A constant value for non strict mode environment. + * @returns {void} + */ +function NORMAL(pattern) { + pattern.parserOptions.sourceType = "script"; +} + +/** + * A constant value for strict mode environment. + * This modifies pattern object to make strict mode. + * @param {Object} pattern - A pattern object to modify. + * @returns {void} + */ +function USE_STRICT(pattern) { + pattern.code = '"use strict"; ' + pattern.code; +} + +/** + * A constant value for implied strict mode. + * This modifies pattern object to impose strict mode. + * @param {Object} pattern - A pattern object to modify. + * @returns {void} + */ +function IMPLIED_STRICT(pattern) { + pattern.code = "/* implied strict mode */ " + pattern.code; + pattern.parserOptions.ecmaFeatures = pattern.parserOptions.ecmaFeatures || {}; + pattern.parserOptions.ecmaFeatures.impliedStrict = true; +} + +/** + * A constant value for modules environment. + * This modifies pattern object to make modules. + * @param {Object} pattern - A pattern object to modify. + * @returns {void} + */ +function MODULES(pattern) { + pattern.code = "/* modules */ " + pattern.code; +} + +/** + * Extracts patterns each condition for a specified type. The type is `valid` or `invalid`. + * @param {Object[]} patterns - Original patterns. + * @param {string} type - One of `"valid"` or `"invalid"`. + * @returns {Object[]} Test patterns. + */ +function extractPatterns(patterns, type) { + // Clone and apply the pattern environment. + const patternsList = patterns.map(function(pattern) { + return pattern[type].map(function(applyCondition) { + const thisPattern = cloneDeep(pattern); + + applyCondition(thisPattern); + + if (type === "valid") { + thisPattern.errors = []; + } else { + thisPattern.code += " /* should error */"; + } + + delete thisPattern.invalid; + delete thisPattern.valid; + + return thisPattern; + }); + }); + + // Flatten. + return Array.prototype.concat.apply([], patternsList); +} + +//------------------------------------------------------------------------------ +// Tests +//------------------------------------------------------------------------------ + +const errors = [ + { message: "Unexpected 'this'.", type: "ThisExpression" }, + { message: "Unexpected 'this'.", type: "ThisExpression" }, +]; + +const patterns = [ + // Class private fields + { + code: "class A {a = this.b;};", + parserOptions: { ecmaVersion: 6 }, + valid: [NORMAL, USE_STRICT, IMPLIED_STRICT, MODULES], + invalid: [], + }, + + { + code: "class A {a = () => {return this.b;};};", + parserOptions: { ecmaVersion: 6 }, + valid: [NORMAL, USE_STRICT, IMPLIED_STRICT, MODULES], + invalid: [], + }, + + // Class Private methods + { + code: "class A {#a = this.b;};", + parserOptions: { ecmaVersion: 6 }, + valid: [NORMAL, USE_STRICT, IMPLIED_STRICT, MODULES], + invalid: [], + }, + + { + code: "class A {#a = () => {return this.b;};};", + parserOptions: { ecmaVersion: 6 }, + valid: [NORMAL, USE_STRICT, IMPLIED_STRICT, MODULES], + invalid: [], + }, +]; + +const ruleTester = new RuleTester(); +ruleTester.run("@babel/no-invalid-this", rule, { + valid: extractPatterns(patterns, "valid"), + invalid: extractPatterns(patterns, "invalid"), +}); diff --git a/eslint/babel-eslint-plugin/test/rules/no-unused-expressions.js b/eslint/babel-eslint-plugin/test/rules/no-unused-expressions.js new file mode 100644 index 000000000000..991bf6fa80b4 --- /dev/null +++ b/eslint/babel-eslint-plugin/test/rules/no-unused-expressions.js @@ -0,0 +1,37 @@ +import rule from "../../src/rules/no-unused-expressions"; +import RuleTester from "../helpers/RuleTester"; + +const ruleTester = new RuleTester(); +ruleTester.run("@babel/no-unused-expressions", rule, { + valid: [ + "let a = do { if (foo) { foo.bar; } }", + "let a = do { foo; }", + "let a = do { let b = 2; foo; }", + "let a = do { (foo + 1); }", + "let a = do { if (foo) { if (foo.bar) { foo.bar; } } }", + "let a = do { if (foo) { if (foo.bar) { foo.bar; } else if (foo.baz) { foo.baz; } } }", + "foo.bar?.();", + ], + invalid: [ + { + code: "let a = do { foo; let b = 2; }", + errors: [ + { + message: + "Expected an assignment or function call and instead saw an expression.", + type: "ExpressionStatement", + }, + ], + }, + { + code: "let a = do { if (foo) { foo.bar } else { a; bar.foo } }", + errors: [ + { + message: + "Expected an assignment or function call and instead saw an expression.", + type: "ExpressionStatement", + }, + ], + }, + ], +}); diff --git a/eslint/babel-eslint-plugin/test/rules/object-curly-spacing.js b/eslint/babel-eslint-plugin/test/rules/object-curly-spacing.js new file mode 100644 index 000000000000..8a08a09516c7 --- /dev/null +++ b/eslint/babel-eslint-plugin/test/rules/object-curly-spacing.js @@ -0,0 +1,13 @@ +import rule from "../../src/rules/object-curly-spacing"; +import RuleTester from "../helpers/RuleTester"; + +const ruleTester = new RuleTester(); +ruleTester.run("@babel/object-curly-spacing", rule, { + valid: [ + { + code: 'export x from "mod";', + }, + ], + + invalid: [], +}); diff --git a/eslint/babel-eslint-plugin/test/rules/semi.js b/eslint/babel-eslint-plugin/test/rules/semi.js new file mode 100644 index 000000000000..d7a757b62616 --- /dev/null +++ b/eslint/babel-eslint-plugin/test/rules/semi.js @@ -0,0 +1,52 @@ +import rule from "../../src/rules/semi"; +import RuleTester from "../helpers/RuleTester"; + +const ruleTester = new RuleTester(); + +ruleTester.run("semi", rule, { + valid: [ + "class Foo { bar = 'example'; }", + "class Foo { static bar = 'example'; }", + { + code: "class Foo { bar = () => {}; }", + options: ["always", { omitLastInOneLineBlock: true }], + }, + + // never + { code: "class Foo { bar = 'example' }", options: ["never"] }, + { code: "class Foo { static bar = 'example' }", options: ["never"] }, + { code: "class Foo { bar = () => {} }", options: ["never"] }, + ], + invalid: [ + { + code: "class Foo { bar = 'example' }", + errors: [{ message: "Missing semicolon." }], + }, + { + code: "class Foo { static bar = 'example' }", + errors: [{ message: "Missing semicolon." }], + }, + { + code: "class Foo { bar = () => {} }", + options: ["always", { omitLastInOneLineBlock: true }], + errors: [{ message: "Missing semicolon." }], + }, + + // "never" + { + code: "class Foo { bar = 'example'; }", + options: ["never"], + errors: [{ message: "Extra semicolon." }], + }, + { + code: "class Foo { static bar = 'example'; }", + options: ["never"], + errors: [{ message: "Extra semicolon." }], + }, + { + code: "class Foo { bar = () => {}; }", + options: ["never"], + errors: [{ message: "Extra semicolon." }], + }, + ], +}); diff --git a/eslint/babel-eslint-shared-fixtures/config/babel.config.decorators-legacy.js b/eslint/babel-eslint-shared-fixtures/config/babel.config.decorators-legacy.js new file mode 100644 index 000000000000..dbad846412e6 --- /dev/null +++ b/eslint/babel-eslint-shared-fixtures/config/babel.config.decorators-legacy.js @@ -0,0 +1,6 @@ +"use strict"; + +module.exports = { + presets: [["@babel/preset-env", { forceAllTransforms: true }]], + plugins: [["@babel/plugin-proposal-decorators", { legacy: true }]], +}; diff --git a/eslint/babel-eslint-shared-fixtures/config/babel.config.js b/eslint/babel-eslint-shared-fixtures/config/babel.config.js new file mode 100644 index 000000000000..202b888fe7b1 --- /dev/null +++ b/eslint/babel-eslint-shared-fixtures/config/babel.config.js @@ -0,0 +1,24 @@ +"use strict"; + +module.exports = { + presets: [ + ["@babel/preset-env", { forceAllTransforms: true }], + ["@babel/preset-flow", { all: true }], + "@babel/preset-react", + ], + plugins: [ + "@babel/plugin-syntax-dynamic-import", + "@babel/plugin-syntax-import-meta", + "@babel/plugin-syntax-export-default-from", + "@babel/plugin-proposal-class-properties", + "@babel/plugin-proposal-nullish-coalescing-operator", + "@babel/plugin-proposal-optional-chaining", + "@babel/plugin-syntax-numeric-separator", + "@babel/plugin-syntax-export-namespace-from", + ["@babel/plugin-proposal-decorators", { decoratorsBeforeExport: false }], + ["@babel/plugin-proposal-pipeline-operator", { proposal: "minimal" }], + "@babel/plugin-syntax-bigint", + "@babel/plugin-proposal-private-methods", + "@babel/plugin-proposal-do-expressions", + ], +}; diff --git a/eslint/babel-eslint-shared-fixtures/package.json b/eslint/babel-eslint-shared-fixtures/package.json new file mode 100644 index 000000000000..96bbb96dde67 --- /dev/null +++ b/eslint/babel-eslint-shared-fixtures/package.json @@ -0,0 +1,25 @@ +{ + "name": "@babel/eslint-shared-fixtures", + "version": "0.0.0", + "description": "Shared fixtures for testing @babel/eslint-* packages", + "license": "MIT", + "private": true, + "dependencies": { + "@babel/plugin-proposal-class-properties": "^7.1.0", + "@babel/plugin-proposal-decorators": "^7.1.2", + "@babel/plugin-proposal-do-expressions": "^7.7.4", + "@babel/plugin-proposal-nullish-coalescing-operator": "^7.0.0", + "@babel/plugin-proposal-optional-chaining": "^7.0.0", + "@babel/plugin-proposal-pipeline-operator": "^7.0.0", + "@babel/plugin-proposal-private-methods": "^7.7.4", + "@babel/plugin-syntax-bigint": "^7.7.4", + "@babel/plugin-syntax-dynamic-import": "^7.0.0", + "@babel/plugin-syntax-export-default-from": "^7.0.0", + "@babel/plugin-syntax-export-namespace-from": "^7.0.0", + "@babel/plugin-syntax-import-meta": "^7.0.0", + "@babel/plugin-syntax-numeric-separator": "^7.0.0", + "@babel/preset-env": "^7.1.5", + "@babel/preset-flow": "^7.0.0", + "@babel/preset-react": "^7.0.0" + } +} diff --git a/jest.config.js b/jest.config.js new file mode 100644 index 000000000000..667ea5395c29 --- /dev/null +++ b/jest.config.js @@ -0,0 +1,68 @@ +// These packages undet the @babel namespace aren't in this monorepo. +const externalBabelPackages = [ + "plugin-syntax-async-generators", + "plugin-syntax-bigint", + "plugin-syntax-dynamic-import", + "plugin-syntax-json-strings", + "plugin-syntax-nullish-coalescing-operator", + "plugin-syntax-object-rest-spread", + "plugin-syntax-optional-catch-binding", + "plugin-syntax-optional-chaining", +]; + +// prettier-ignore +const monorepoPackagePattern = + `^@babel/(?!eslint-)(?!${externalBabelPackages.join("|")})([a-zA-Z0-9_-]+)$`; + +module.exports = { + collectCoverageFrom: [ + "packages/*/src/**/*.mjs", + "packages/*/src/**/*.js", + "codemods/*/src/**/*.mjs", + "codemods/*/src/**/*.js", + "eslint/*/src/**/*.mjs", + "eslint/*/src/**/*.js", + ], + // The eslint/* packages use ESLint v6, which has dropped support for Node v6. + // TODO: Remove this process.version check in Babel 8. + testRegex: `./(packages|codemods${ + /^v6./u.test(process.version) ? "" : "|eslint" + })/[^/]+/test/.+\\.m?js$`, + testPathIgnorePatterns: [ + "/node_modules/", + "/test/fixtures/", + "/test/debug-fixtures/", + "/babel-parser/test/expressions/", + "/test/tmp/", + "/test/__data__/", + "/test/helpers/", + "/test/warning\\.js", + "/build/", + "_browser\\.js", + ], + testEnvironment: "node", + setupFilesAfterEnv: ["/test/testSetupFile.js"], + transformIgnorePatterns: [ + "/node_modules/", + "/packages/babel-standalone/babel(\\.min)?\\.js", + "/packages/babel-preset-env-standalone/babel-preset-env(\\.min)?\\.js", + "/test/(fixtures|tmp|__data__)/", + "/(packages|codemods|eslint)/[^/]+/lib/", + ], + coveragePathIgnorePatterns: [ + "/node_modules/", + "/packages/babel-standalone/babel(\\.min)?\\.js", + "/packages/babel-preset-env-standalone/babel-preset-env(\\.min)?\\.js", + "/test/(fixtures|tmp|__data__)/", + ], + modulePathIgnorePatterns: [ + "/test/fixtures/", + "/test/tmp/", + "/test/__data__/", + "/build/", + ], + moduleNameMapper: { + [monorepoPackagePattern]: "/packages/babel-$1/", + "^@babel/eslint-([a-zA-Z0-9_-]+)$": "/eslint/babel-eslint-$1/", + }, +}; diff --git a/lerna.json b/lerna.json index 10d091d9337f..b4692f70a257 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "7.5.5", + "version": "7.8.3", "changelog": { "repo": "babel/babel", "cacheDir": ".changelog", @@ -11,7 +11,8 @@ "PR: Polish :nail_care:": ":nail_care: Polish", "PR: Docs :memo:": ":memo: Documentation", "PR: Internal :house:": ":house: Internal", - "PR: Performance :running_woman:": ":running_woman: Performance" + "PR: Performance :running_woman:": ":running_woman: Performance", + "PR: Revert :leftwards_arrow_with_hook:": ":leftwards_arrow_with_hook: Revert" } }, "command": { @@ -20,14 +21,18 @@ "*.md", "*.txt", "test/**", + "**/test/**", "codemods/**", "# We ignore every JSON file, except for built-in-modules, built-ins and plugins defined in babel-preset-env/data.", - "@(!(built-in-modules|built-ins|plugins|package)).json" + "@(!(built-in-modules|built-ins|plugins|package)).json", + "# Until the ESLint packages version are aligned with Babel's, we ignore them", + "eslint/**" ] } }, "packages": [ "codemods/*", + "eslint/*", "packages/*" ], "npmClient": "yarn", diff --git a/lib/third-party-libs.js.flow b/lib/third-party-libs.js.flow index 884b1e68bbfb..b41fbe725b4e 100644 --- a/lib/third-party-libs.js.flow +++ b/lib/third-party-libs.js.flow @@ -4,6 +4,7 @@ declare module "resolve" { declare export default { + (string, {| basedir: string |}, (err: ?Error, res: string) => void): void; sync: (string, {| basedir: string |}) => string; }; } @@ -178,10 +179,10 @@ declare module "convert-source-map" { SourceMap: SourceMap, Converter: Converter, fromObject(obj: SourceMap | SourceMapGenerator): Converter, - fromJSON(str: string): Converter, + fromJSON(str: string | Buffer): Converter, fromBase64(str: string): Converter, fromComment(str: string): Converter, - fromMapFileComment(str: string): Converter, + fromMapFileComment(str: string, dir: string): Converter, fromSource(str: string): Converter, fromMapFileSource(str: string, dir: string): Converter, removeComments(str: string): string, @@ -190,12 +191,6 @@ declare module "convert-source-map" { }; } -declare module "js-levenshtein" { - declare module.exports: { - (string, string): number, - }; -} - declare module "core-js-compat/data" { declare type Target = "node" | "chrome" | "opera" | "edge" | "firefox" | "safari" | "ie" | "ios" | "android" | "electron" | "samsung"; diff --git a/package.json b/package.json index bd04e0638455..235975a0ac67 100644 --- a/package.json +++ b/package.json @@ -3,42 +3,49 @@ "private": true, "license": "MIT", "scripts": { + "bootstrap": "make bootstrap", "build": "make build", "fix": "make fix", "lint": "make lint", "test": "make test" }, "devDependencies": { - "@babel/cli": "^7.4.4", - "@babel/core": "^7.4.5", + "@babel/cli": "^7.7.0", + "@babel/core": "^7.7.2", "@babel/eslint-plugin-development": "^1.0.1", - "@babel/plugin-proposal-class-properties": "^7.4.4", - "@babel/plugin-proposal-export-namespace-from": "^7.2.0", + "@babel/plugin-proposal-class-properties": "^7.7.0", + "@babel/plugin-proposal-export-namespace-from": "^7.5.2", + "@babel/plugin-proposal-nullish-coalescing-operator": "^7.4.4", "@babel/plugin-proposal-numeric-separator": "^7.2.0", - "@babel/plugin-transform-modules-commonjs": "^7.4.4", - "@babel/plugin-transform-runtime": "^7.4.4", - "@babel/preset-env": "^7.4.5", + "@babel/plugin-proposal-object-rest-spread": "^7.7.4", + "@babel/plugin-proposal-optional-chaining": "^7.6.0", + "@babel/plugin-transform-flow-strip-types": "^7.7.4", + "@babel/plugin-transform-for-of": "^7.7.4", + "@babel/plugin-transform-modules-commonjs": "^7.7.0", + "@babel/plugin-transform-runtime": "^7.6.2", + "@babel/preset-env": "^7.7.1", "@babel/preset-flow": "^7.0.0", - "@babel/register": "^7.4.4", - "@babel/runtime": "^7.4.5", - "babel-eslint": "^11.0.0-beta.0", - "babel-jest": "^24.8.0", - "babel-loader": "^8.0.6", + "@babel/register": "^7.7.0", + "@babel/runtime": "^7.7.2", + "@rollup/plugin-alias": "^2.2.0", + "@rollup/plugin-json": "^4.0.0", + "babel-eslint": "^11.0.0-beta.2", + "babel-jest": "^24.9.0", "babel-plugin-transform-charcodes": "^0.2.0", "browserify": "^16.2.3", "bundle-collapser": "^1.2.1", "chalk": "^2.4.2", "charcodes": "^0.2.0", "derequire": "^2.0.2", - "duplicate-package-checker-webpack-plugin": "^2.1.0", "enhanced-resolve": "^3.0.0", - "eslint": "^5.16.0", + "eslint": "^6.0.1", "eslint-config-babel": "^9.0.0", + "eslint-import-resolver-node": "^0.3.2", "eslint-plugin-flowtype": "^3.8.2", "eslint-plugin-import": "^2.17.2", "eslint-plugin-prettier": "^3.1.0", "fancy-log": "^1.3.3", - "flow-bin": "^0.94.0", + "flow-bin": "^0.108.0", "graceful-fs": "^4.1.15", "gulp": "^4.0.2", "gulp-babel": "^8.0.0", @@ -46,35 +53,35 @@ "gulp-newer": "^1.0.0", "gulp-plumber": "^1.2.1", "gulp-rename": "^1.4.0", - "gulp-uglify": "^3.0.2", "gulp-watch": "^5.0.1", - "husky": "^2.3.0", - "jest": "^24.8.0", - "lerna": "^3.14.2", + "husky": "^3.0.0", + "jest": "^24.9.0", + "lerna": "^3.19.0", "lerna-changelog": "^0.5.0", - "lint-staged": "^8.1.7", + "lint-staged": "^9.2.0", "lodash": "^4.17.13", - "merge-stream": "^1.0.1", + "mergeiterator": "^1.2.5", "output-file-sync": "^2.0.0", - "prettier": "^1.17.1", + "prettier": "^1.19.1", "pump": "^3.0.0", "rimraf": "^2.6.3", - "rollup": "^1.12.0", + "rollup": "^1.27.5", "rollup-plugin-babel": "^4.0.0", + "rollup-plugin-commonjs": "^10.1.0", + "rollup-plugin-node-builtins": "^2.1.2", + "rollup-plugin-node-globals": "^1.4.0", "rollup-plugin-node-resolve": "^5.0.0", "rollup-plugin-replace": "^2.2.0", - "test262-stream": "^1.2.0", + "rollup-plugin-terser": "^5.1.2", + "test262-stream": "^1.3.0", "through2": "^2.0.0", - "warnings-to-errors-webpack-plugin": "^2.0.0", - "webpack": "^3.4.1", - "webpack-dependency-suite": "^2.4.4", - "webpack-stream": "^4.0.0" + "typescript": "^3.6.3" }, "resolutions": { - "@lerna/**/@lerna/collect-updates": "https://github.com/babel/lerna.git#babel-collect-updates" + "@lerna/collect-updates": "https://github.com/babel/lerna.git#babel-collect-updates" }, "engines": { - "node": ">= 6.9.0 < 13.0.0", + "node": ">= 6.9.0 < 14.0.0", "npm": ">= 3.x <= 6.x", "yarn": ">=0.27.5 || >=1.0.0-20170811" }, @@ -87,53 +94,5 @@ "hooks": { "pre-commit": "lint-staged" } - }, - "jest": { - "collectCoverageFrom": [ - "packages/*/src/**/*.mjs", - "packages/*/src/**/*.js", - "codemods/*/src/**/*.mjs", - "codemods/*/src/**/*.js" - ], - "testRegex": "./(packages|codemods)/[^/]+/test/.+\\.m?js$", - "testPathIgnorePatterns": [ - "/node_modules/", - "/test/fixtures/", - "/test/debug-fixtures/", - "/babel-parser/test/expressions/", - "/test/tmp/", - "/test/__data__/", - "/test/helpers/", - "/test/warning\\.js", - "/build/", - "_browser\\.js" - ], - "testEnvironment": "node", - "setupFilesAfterEnv": [ - "/test/testSetupFile.js" - ], - "transformIgnorePatterns": [ - "/node_modules/", - "/packages/babel-standalone/babel(\\.min)?\\.js", - "/packages/babel-preset-env-standalone/babel-preset-env(\\.min)?\\.js", - "/test/(fixtures|tmp|__data__)/", - "/(packages|codemods)/[^/]+/lib/" - ], - "coveragePathIgnorePatterns": [ - "/node_modules/", - "/packages/babel-standalone/babel(\\.min)?\\.js", - "/packages/babel-preset-env-standalone/babel-preset-env(\\.min)?\\.js", - "/test/(fixtures|tmp|__data__)/" - ], - "modulePathIgnorePatterns": [ - "/test/fixtures/", - "/test/tmp/", - "/test/__data__/", - "/build/" - ], - "moduleNameMapper": { - "^@babel/([a-zA-Z0-9_-]+)$": "/packages/babel-$1/" - } - }, - "dependencies": {} + } } diff --git a/packages/babel-cli/package.json b/packages/babel-cli/package.json index 0b4bd8731363..371e106e9726 100644 --- a/packages/babel-cli/package.json +++ b/packages/babel-cli/package.json @@ -1,6 +1,6 @@ { "name": "@babel/cli", - "version": "7.5.5", + "version": "7.8.3", "description": "Babel command line.", "author": "Sebastian McKenzie ", "homepage": "https://babeljs.io/", @@ -19,25 +19,25 @@ "compiler" ], "dependencies": { - "commander": "^2.8.1", + "commander": "^4.0.1", "convert-source-map": "^1.1.0", "fs-readdir-recursive": "^1.1.0", "glob": "^7.0.0", "lodash": "^4.17.13", - "mkdirp": "^0.5.1", - "output-file-sync": "^2.0.0", + "make-dir": "^2.1.0", "slash": "^2.0.0", "source-map": "^0.5.0" }, "optionalDependencies": { - "chokidar": "^2.0.4" + "chokidar": "^2.1.8" }, "peerDependencies": { "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.5.5", - "@babel/helper-fixtures": "^7.5.5" + "@babel/core": "^7.8.3", + "@babel/helper-fixtures": "^7.8.3", + "rimraf": "^3.0.0" }, "bin": { "babel": "./bin/babel.js", diff --git a/packages/babel-cli/src/babel/dir.js b/packages/babel-cli/src/babel/dir.js index 32136b78f02a..9b199b98a4e2 100644 --- a/packages/babel-cli/src/babel/dir.js +++ b/packages/babel-cli/src/babel/dir.js @@ -1,8 +1,7 @@ // @flow import defaults from "lodash/defaults"; -import outputFileSync from "output-file-sync"; -import { sync as mkdirpSync } from "mkdirp"; +import { sync as makeDirSync } from "make-dir"; import slash from "slash"; import path from "path"; import fs from "fs"; @@ -10,21 +9,40 @@ import fs from "fs"; import * as util from "./util"; import { type CmdOptions } from "./options"; +const FILE_TYPE = Object.freeze({ + NON_COMPILABLE: "NON_COMPILABLE", + COMPILED: "COMPILED", + IGNORED: "IGNORED", + ERR_COMPILATION: "ERR_COMPILATION", +}); + +function outputFileSync(filePath: string, data: string | Buffer): void { + makeDirSync(path.dirname(filePath)); + fs.writeFileSync(filePath, data); +} + export default async function({ cliOptions, babelOptions, }: CmdOptions): Promise { const filenames = cliOptions.filenames; - async function write(src: string, base: string): Promise { + async function write( + src: string, + base: string, + ): Promise<$Keys> { let relative = path.relative(base, src); if (!util.isCompilableExtension(relative, cliOptions.extensions)) { - return false; + return FILE_TYPE.NON_COMPILABLE; } - // remove extension and then append back on .js - relative = util.adjustRelative(relative, cliOptions.keepFileExtension); + relative = util.withExtension( + relative, + cliOptions.keepFileExtension + ? path.extname(relative) + : cliOptions.outFileExtension, + ); const dest = getDest(relative, base); @@ -39,7 +57,7 @@ export default async function({ ), ); - if (!res) return false; + if (!res) return FILE_TYPE.IGNORED; // we've requested explicit sourcemaps to be written to disk if ( @@ -60,11 +78,11 @@ export default async function({ console.log(src + " -> " + dest); } - return true; + return FILE_TYPE.COMPILED; } catch (err) { if (cliOptions.watch) { console.error(err); - return false; + return FILE_TYPE.ERR_COMPILATION; } throw err; @@ -81,13 +99,16 @@ export default async function({ async function handleFile(src: string, base: string): Promise { const written = await write(src, base); - if (!written && cliOptions.copyFiles) { + if ( + (cliOptions.copyFiles && written === FILE_TYPE.NON_COMPILABLE) || + (cliOptions.copyIgnored && written === FILE_TYPE.IGNORED) + ) { const filename = path.relative(base, src); const dest = getDest(filename, base); outputFileSync(dest, fs.readFileSync(src)); util.chmod(src, dest); } - return written; + return written === FILE_TYPE.COMPILED; } async function handle(filenameOrDir: string): Promise { @@ -122,24 +143,26 @@ export default async function({ util.deleteDir(cliOptions.outDir); } - mkdirpSync(cliOptions.outDir); + makeDirSync(cliOptions.outDir); let compiledFiles = 0; for (const filename of cliOptions.filenames) { compiledFiles += await handle(filename); } - console.log( - `Successfully compiled ${compiledFiles} ${ - compiledFiles !== 1 ? "files" : "file" - } with Babel.`, - ); + if (!cliOptions.quiet) { + console.log( + `Successfully compiled ${compiledFiles} ${ + compiledFiles !== 1 ? "files" : "file" + } with Babel.`, + ); + } } if (cliOptions.watch) { const chokidar = util.requireChokidar(); - filenames.forEach(function(filenameOrDir) { + filenames.forEach(function(filenameOrDir: string): void { const watcher = chokidar.watch(filenameOrDir, { persistent: true, ignoreInitial: true, @@ -149,8 +172,8 @@ export default async function({ }, }); - ["add", "change"].forEach(function(type) { - watcher.on(type, function(filename) { + ["add", "change"].forEach(function(type: string): void { + watcher.on(type, function(filename: string): void { handleFile( filename, filename === filenameOrDir diff --git a/packages/babel-cli/src/babel/file.js b/packages/babel-cli/src/babel/file.js index 14cf4c562971..c1c60ff91615 100644 --- a/packages/babel-cli/src/babel/file.js +++ b/packages/babel-cli/src/babel/file.js @@ -4,6 +4,7 @@ import convertSourceMap from "convert-source-map"; import defaults from "lodash/defaults"; import sourceMap from "source-map"; import slash from "slash"; +import { sync as makeDirSync } from "make-dir"; import path from "path"; import fs from "fs"; @@ -89,6 +90,8 @@ export default async function({ const result = buildResult(fileResults); if (cliOptions.outFile) { + makeDirSync(path.dirname(cliOptions.outFile)); + // we've requested for a sourcemap to be written to disk if (babelOptions.sourceMaps && babelOptions.sourceMaps !== "inline") { const mapLoc = cliOptions.outFile + ".map"; @@ -103,24 +106,22 @@ export default async function({ } function readStdin(): Promise { - return new Promise( - (resolve: Function, reject: Function): void => { - let code = ""; + return new Promise((resolve: Function, reject: Function): void => { + let code = ""; - process.stdin.setEncoding("utf8"); + process.stdin.setEncoding("utf8"); - process.stdin.on("readable", function() { - const chunk = process.stdin.read(); - // $FlowIgnore - if (chunk !== null) code += chunk; - }); + process.stdin.on("readable", function() { + const chunk = process.stdin.read(); + // $FlowIgnore + if (chunk !== null) code += chunk; + }); - process.stdin.on("end", function() { - resolve(code); - }); - process.stdin.on("error", reject); - }, - ); + process.stdin.on("end", function() { + resolve(code); + }); + process.stdin.on("error", reject); + }); } async function stdin(): Promise { @@ -215,6 +216,7 @@ export default async function({ const chokidar = util.requireChokidar(); chokidar .watch(filenames, { + disableGlobbing: true, persistent: true, ignoreInitial: true, awaitWriteFinish: { @@ -222,8 +224,11 @@ export default async function({ pollInterval: 10, }, }) - .on("all", function(type: string, filename: string) { - if (!util.isCompilableExtension(filename, cliOptions.extensions)) { + .on("all", function(type: string, filename: string): void { + if ( + !util.isCompilableExtension(filename, cliOptions.extensions) && + !filenames.includes(filename) + ) { return; } diff --git a/packages/babel-cli/src/babel/index.js b/packages/babel-cli/src/babel/index.js index f3194576072a..a740bcdedadf 100755 --- a/packages/babel-cli/src/babel/index.js +++ b/packages/babel-cli/src/babel/index.js @@ -6,8 +6,12 @@ import fileCommand from "./file"; const opts = parseArgv(process.argv); -const fn = opts.cliOptions.outDir ? dirCommand : fileCommand; -fn(opts).catch(err => { - console.error(err); - process.exit(1); -}); +if (opts) { + const fn = opts.cliOptions.outDir ? dirCommand : fileCommand; + fn(opts).catch(err => { + console.error(err); + process.exitCode = 1; + }); +} else { + process.exitCode = 2; +} diff --git a/packages/babel-cli/src/babel/options.js b/packages/babel-cli/src/babel/options.js index 19ae7bfce878..6e4dfeaed2d4 100644 --- a/packages/babel-cli/src/babel/options.js +++ b/packages/babel-cli/src/babel/options.js @@ -12,19 +12,19 @@ import pkg from "../../package.json"; // Standard Babel input configs. commander.option( "-f, --filename [filename]", - "filename to use when reading from stdin - this will be used in source-maps, errors etc", + "The filename to use when reading from stdin. This will be used in source-maps, errors etc.", ); commander.option( "--presets [list]", - "comma-separated list of preset names", + "A comma-separated list of preset names.", collect, ); commander.option( "--plugins [list]", - "comma-separated list of plugin names", + "A comma-separated list of plugin names.", collect, ); -commander.option("--config-file [path]", "Path to a .babelrc file to use"); +commander.option("--config-file [path]", "Path to a .babelrc file to use."); commander.option( "--env-name [name]", "The name of the 'env' to use when loading configs and plugins. " + @@ -40,97 +40,101 @@ commander.option( commander.option("--source-type [script|module]", ""); commander.option( "--no-babelrc", - "Whether or not to look up .babelrc and .babelignore files", + "Whether or not to look up .babelrc and .babelignore files.", ); commander.option( "--ignore [list]", - "list of glob paths to **not** compile", + "List of glob paths to **not** compile.", collect, ); commander.option( "--only [list]", - "list of glob paths to **only** compile", + "List of glob paths to **only** compile.", collect, ); // Misc babel config. commander.option( "--no-highlight-code", - "enable/disable ANSI syntax highlighting of code frames (on by default)", + "Enable or disable ANSI syntax highlighting of code frames. (on by default)", ); // General output formatting. commander.option( "--no-comments", - "write comments to generated output (true by default)", + "Write comments to generated output. (true by default)", ); commander.option( "--retain-lines", - "retain line numbers - will result in really ugly code", + "Retain line numbers. This will result in really ugly code.", ); commander.option( "--compact [true|false|auto]", - "do not include superfluous whitespace characters and line terminators", + "Do not include superfluous whitespace characters and line terminators.", booleanify, ); -commander.option("--minified", "save as much bytes when printing [true|false]"); +commander.option( + "--minified", + "Save as many bytes when printing. (false by default)", +); commander.option( "--auxiliary-comment-before [string]", - "print a comment before any injected non-user code", + "Print a comment before any injected non-user code.", ); commander.option( "--auxiliary-comment-after [string]", - "print a comment after any injected non-user code", + "Print a comment after any injected non-user code.", ); // General source map formatting. commander.option("-s, --source-maps [true|false|inline|both]", "", booleanify); commander.option( "--source-map-target [string]", - "set `file` on returned source map", + "Set `file` on returned source map.", ); commander.option( "--source-file-name [string]", - "set `sources[0]` on returned source map", + "Set `sources[0]` on returned source map.", ); commander.option( "--source-root [filename]", - "the root from which all sources are relative", + "The root from which all sources are relative.", ); // Config params for certain module output formats. commander.option( "--module-root [filename]", - "optional prefix for the AMD module formatter that will be prepend to the filename on module definitions", + // eslint-disable-next-line max-len + "Optional prefix for the AMD module formatter that will be prepended to the filename on module definitions.", ); -commander.option("-M, --module-ids", "insert an explicit id for modules"); +commander.option("-M, --module-ids", "Insert an explicit id for modules."); commander.option( "--module-id [string]", - "specify a custom name for module ids", + "Specify a custom name for module ids.", ); // "babel" command specific arguments that are not passed to @babel/core. commander.option( "-x, --extensions [extensions]", - "List of extensions to compile when a directory has been input [.es6,.js,.es,.jsx,.mjs]", + "List of extensions to compile when a directory has been the input. [.es6,.js,.es,.jsx,.mjs]", collect, ); commander.option( "--keep-file-extension", - "Preserve the file extensions of the input files", + "Preserve the file extensions of the input files.", ); -commander.option("-w, --watch", "Recompile files on changes"); +commander.option("-w, --watch", "Recompile files on changes."); commander.option( "--skip-initial-build", - "Do not compile files before watching", + "Do not compile files before watching.", ); commander.option( "-o, --out-file [out]", - "Compile all input files into a single file", + "Compile all input files into a single file.", ); commander.option( "-d, --out-dir [out]", - "Compile an input directory of modules into an output directory", + "Compile an input directory of modules into an output directory.", ); commander.option( "--relative", @@ -138,27 +142,47 @@ commander.option( ); commander.option( "-D, --copy-files", - "When compiling a directory copy over non-compilable files", + "When compiling a directory copy over non-compilable files.", ); commander.option( "--include-dotfiles", - "Include dotfiles when compiling and copying non-compilable files", + "Include dotfiles when compiling and copying non-compilable files.", +); +commander.option( + "--verbose", + "Log everything. This option conflicts with --quiet", +); +commander.option( + "--quiet", + "Don't log anything. This option conflicts with --verbose", ); -commander.option("--verbose", "Log everything"); commander.option( "--delete-dir-on-start", - "Delete the out directory before compilation", + "Delete the out directory before compilation.", +); +commander.option( + "--out-file-extension [string]", + "Use a specific extension for the output files", +); + +commander.option( + "--copy-ignored", + "Include ignored files when copying non-compilable files.", ); commander.version(pkg.version + " (@babel/core " + version + ")"); commander.usage("[options] "); +// register an empty action handler so that commander.js can throw on +// unknown options _after_ args +// see https://github.com/tj/commander.js/issues/561#issuecomment-522209408 +commander.action(() => {}); export type CmdOptions = { babelOptions: Object, cliOptions: Object, }; -export default function parseArgv(args: Array): CmdOptions { +export default function parseArgv(args: Array): CmdOptions | null { // commander.parse(args); @@ -207,6 +231,10 @@ export default function parseArgv(args: Array): CmdOptions { errors.push("--delete-dir-on-start requires --out-dir"); } + if (commander.verbose && commander.quiet) { + errors.push("--verbose and --quiet cannot be used together"); + } + if ( !commander.outDir && filenames.length === 0 && @@ -218,12 +246,18 @@ export default function parseArgv(args: Array): CmdOptions { ); } + if (commander.keepFileExtension && commander.outFileExtension) { + errors.push( + "--out-file-extension cannot be used with --keep-file-extension", + ); + } + if (errors.length) { console.error("babel:"); errors.forEach(function(e) { console.error(" " + e); }); - process.exit(2); + return null; } const opts = commander.opts(); @@ -274,6 +308,7 @@ export default function parseArgv(args: Array): CmdOptions { filenames, extensions: opts.extensions, keepFileExtension: opts.keepFileExtension, + outFileExtension: opts.outFileExtension, watch: opts.watch, skipInitialBuild: opts.skipInitialBuild, outFile: opts.outFile, @@ -282,8 +317,10 @@ export default function parseArgv(args: Array): CmdOptions { copyFiles: opts.copyFiles, includeDotfiles: opts.includeDotfiles, verbose: opts.verbose, + quiet: opts.quiet, deleteDirOnStart: opts.deleteDirOnStart, sourceMapTarget: opts.sourceMapTarget, + copyIgnored: opts.copyIgnored, }, }; } @@ -300,7 +337,10 @@ function booleanify(val: any): boolean | any { return val; } -function collect(value, previousValue): Array { +function collect( + value: string | any, + previousValue: Array, +): Array { // If the user passed the option with no value, like "babel file.js --presets", do nothing. if (typeof value !== "string") return previousValue; diff --git a/packages/babel-cli/src/babel/util.js b/packages/babel-cli/src/babel/util.js index daacba53f0d2..3cdfe4927982 100644 --- a/packages/babel-cli/src/babel/util.js +++ b/packages/babel-cli/src/babel/util.js @@ -112,7 +112,7 @@ export function deleteDir(path: string): void { process.on("uncaughtException", function(err) { console.error(err); - process.exit(1); + process.exitCode = 1; }); export function requireChokidar(): Object { @@ -127,12 +127,7 @@ export function requireChokidar(): Object { } } -export function adjustRelative( - relative: string, - keepFileExtension: boolean, -): string { - if (keepFileExtension) { - return relative; - } - return relative.replace(/\.(\w*?)$/, "") + ".js"; +export function withExtension(filename: string, ext: string = ".js") { + const newBasename = path.basename(filename, path.extname(filename)) + ext; + return path.join(path.dirname(filename), newBasename); } diff --git a/packages/babel-cli/test/fixtures/babel/--copy-files --include-dotfiles with ignore in babelrc/.babelrc b/packages/babel-cli/test/fixtures/babel/--copy-files --include-dotfiles with ignore in babelrc/.babelrc new file mode 100644 index 000000000000..b1fb07ff865b --- /dev/null +++ b/packages/babel-cli/test/fixtures/babel/--copy-files --include-dotfiles with ignore in babelrc/.babelrc @@ -0,0 +1,3 @@ +{ + "ignore": ["src/foo"] +} diff --git a/packages/babel-cli/test/fixtures/babel/--copy-files --include-dotfiles with ignore in babelrc/in-files/src/.foorc b/packages/babel-cli/test/fixtures/babel/--copy-files --include-dotfiles with ignore in babelrc/in-files/src/.foorc new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/packages/babel-cli/test/fixtures/babel/--copy-files --include-dotfiles with ignore in babelrc/in-files/src/README.md b/packages/babel-cli/test/fixtures/babel/--copy-files --include-dotfiles with ignore in babelrc/in-files/src/README.md new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/packages/babel-cli/test/fixtures/babel/--copy-files --include-dotfiles with ignore/out-files/lib/foo/.foo.js b/packages/babel-cli/test/fixtures/babel/--copy-files --include-dotfiles with ignore in babelrc/in-files/src/foo/.foo.js similarity index 100% rename from packages/babel-cli/test/fixtures/babel/--copy-files --include-dotfiles with ignore/out-files/lib/foo/.foo.js rename to packages/babel-cli/test/fixtures/babel/--copy-files --include-dotfiles with ignore in babelrc/in-files/src/foo/.foo.js diff --git a/packages/babel-cli/test/fixtures/babel/--copy-files --include-dotfiles with ignore/out-files/lib/foo/index.js b/packages/babel-cli/test/fixtures/babel/--copy-files --include-dotfiles with ignore in babelrc/in-files/src/foo/index.js similarity index 100% rename from packages/babel-cli/test/fixtures/babel/--copy-files --include-dotfiles with ignore/out-files/lib/foo/index.js rename to packages/babel-cli/test/fixtures/babel/--copy-files --include-dotfiles with ignore in babelrc/in-files/src/foo/index.js diff --git a/packages/babel-cli/test/fixtures/babel/--copy-files --include-dotfiles with only/out-files/lib/index.js b/packages/babel-cli/test/fixtures/babel/--copy-files --include-dotfiles with ignore in babelrc/in-files/src/index.js similarity index 100% rename from packages/babel-cli/test/fixtures/babel/--copy-files --include-dotfiles with only/out-files/lib/index.js rename to packages/babel-cli/test/fixtures/babel/--copy-files --include-dotfiles with ignore in babelrc/in-files/src/index.js diff --git a/packages/babel-cli/test/fixtures/babel/--copy-files --include-dotfiles with ignore in babelrc/options.json b/packages/babel-cli/test/fixtures/babel/--copy-files --include-dotfiles with ignore in babelrc/options.json new file mode 100644 index 000000000000..bb94e945f80e --- /dev/null +++ b/packages/babel-cli/test/fixtures/babel/--copy-files --include-dotfiles with ignore in babelrc/options.json @@ -0,0 +1,10 @@ +{ + "args": [ + "src", + "--out-dir", + "lib", + "--copy-files", + "--include-dotfiles", + "--verbose" + ] +} diff --git a/packages/babel-cli/test/fixtures/babel/--copy-files --include-dotfiles with ignore in babelrc/out-files/lib/.foorc b/packages/babel-cli/test/fixtures/babel/--copy-files --include-dotfiles with ignore in babelrc/out-files/lib/.foorc new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/packages/babel-cli/test/fixtures/babel/--copy-files --include-dotfiles with ignore in babelrc/out-files/lib/README.md b/packages/babel-cli/test/fixtures/babel/--copy-files --include-dotfiles with ignore in babelrc/out-files/lib/README.md new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/packages/babel-cli/test/fixtures/babel/--copy-files --include-dotfiles with ignore in babelrc/out-files/lib/index.js b/packages/babel-cli/test/fixtures/babel/--copy-files --include-dotfiles with ignore in babelrc/out-files/lib/index.js new file mode 100644 index 000000000000..1073b618d0dd --- /dev/null +++ b/packages/babel-cli/test/fixtures/babel/--copy-files --include-dotfiles with ignore in babelrc/out-files/lib/index.js @@ -0,0 +1,3 @@ +"use strict"; + +index; diff --git a/packages/babel-cli/test/fixtures/babel/--copy-files --include-dotfiles with ignore in babelrc/stdout.txt b/packages/babel-cli/test/fixtures/babel/--copy-files --include-dotfiles with ignore in babelrc/stdout.txt new file mode 100644 index 000000000000..84a430432e47 --- /dev/null +++ b/packages/babel-cli/test/fixtures/babel/--copy-files --include-dotfiles with ignore in babelrc/stdout.txt @@ -0,0 +1,2 @@ +src/index.js -> lib/index.js +Successfully compiled 1 file with Babel. diff --git a/packages/babel-cli/test/fixtures/babel/--copy-files with ignore and copyIgnored in babelignore/.babelignore b/packages/babel-cli/test/fixtures/babel/--copy-files with ignore and copyIgnored in babelignore/.babelignore new file mode 100644 index 000000000000..8b4ba6ce4d35 --- /dev/null +++ b/packages/babel-cli/test/fixtures/babel/--copy-files with ignore and copyIgnored in babelignore/.babelignore @@ -0,0 +1 @@ +src/foo diff --git a/packages/babel-cli/test/fixtures/babel/--copy-files with ignore and copyIgnored in babelignore/in-files/src/.foorc b/packages/babel-cli/test/fixtures/babel/--copy-files with ignore and copyIgnored in babelignore/in-files/src/.foorc new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/packages/babel-cli/test/fixtures/babel/--copy-files with ignore and copyIgnored in babelignore/in-files/src/README.md b/packages/babel-cli/test/fixtures/babel/--copy-files with ignore and copyIgnored in babelignore/in-files/src/README.md new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/packages/babel-cli/test/fixtures/babel/--copy-files with ignore/out-files/lib/foo/bar.js b/packages/babel-cli/test/fixtures/babel/--copy-files with ignore and copyIgnored in babelignore/in-files/src/foo/bar.js similarity index 100% rename from packages/babel-cli/test/fixtures/babel/--copy-files with ignore/out-files/lib/foo/bar.js rename to packages/babel-cli/test/fixtures/babel/--copy-files with ignore and copyIgnored in babelignore/in-files/src/foo/bar.js diff --git a/packages/babel-cli/test/fixtures/babel/--copy-files with only/out-files/lib/index.js b/packages/babel-cli/test/fixtures/babel/--copy-files with ignore and copyIgnored in babelignore/in-files/src/index.js similarity index 100% rename from packages/babel-cli/test/fixtures/babel/--copy-files with only/out-files/lib/index.js rename to packages/babel-cli/test/fixtures/babel/--copy-files with ignore and copyIgnored in babelignore/in-files/src/index.js diff --git a/packages/babel-cli/test/fixtures/babel/--copy-files with ignore and copyIgnored in babelignore/options.json b/packages/babel-cli/test/fixtures/babel/--copy-files with ignore and copyIgnored in babelignore/options.json new file mode 100644 index 000000000000..d16d70e6ffec --- /dev/null +++ b/packages/babel-cli/test/fixtures/babel/--copy-files with ignore and copyIgnored in babelignore/options.json @@ -0,0 +1,10 @@ +{ + "args": [ + "src", + "--out-dir", + "lib", + "--copy-files", + "--copy-ignored", + "--verbose" + ] +} diff --git a/packages/babel-cli/test/fixtures/babel/--copy-files with ignore and copyIgnored in babelignore/out-files/lib/README.md b/packages/babel-cli/test/fixtures/babel/--copy-files with ignore and copyIgnored in babelignore/out-files/lib/README.md new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/packages/babel-cli/test/fixtures/babel/--copy-files with ignore and copyIgnored in babelignore/out-files/lib/foo/bar.js b/packages/babel-cli/test/fixtures/babel/--copy-files with ignore and copyIgnored in babelignore/out-files/lib/foo/bar.js new file mode 100644 index 000000000000..e46160df1c7a --- /dev/null +++ b/packages/babel-cli/test/fixtures/babel/--copy-files with ignore and copyIgnored in babelignore/out-files/lib/foo/bar.js @@ -0,0 +1 @@ +bar; diff --git a/packages/babel-cli/test/fixtures/babel/--copy-files with ignore and copyIgnored in babelignore/out-files/lib/index.js b/packages/babel-cli/test/fixtures/babel/--copy-files with ignore and copyIgnored in babelignore/out-files/lib/index.js new file mode 100644 index 000000000000..1073b618d0dd --- /dev/null +++ b/packages/babel-cli/test/fixtures/babel/--copy-files with ignore and copyIgnored in babelignore/out-files/lib/index.js @@ -0,0 +1,3 @@ +"use strict"; + +index; diff --git a/packages/babel-cli/test/fixtures/babel/--copy-files with ignore and copyIgnored in babelignore/stdout.txt b/packages/babel-cli/test/fixtures/babel/--copy-files with ignore and copyIgnored in babelignore/stdout.txt new file mode 100644 index 000000000000..84a430432e47 --- /dev/null +++ b/packages/babel-cli/test/fixtures/babel/--copy-files with ignore and copyIgnored in babelignore/stdout.txt @@ -0,0 +1,2 @@ +src/index.js -> lib/index.js +Successfully compiled 1 file with Babel. diff --git a/packages/babel-cli/test/fixtures/babel/--copy-files with ignore and copyIgnored in babelrc/.babelrc b/packages/babel-cli/test/fixtures/babel/--copy-files with ignore and copyIgnored in babelrc/.babelrc new file mode 100644 index 000000000000..b1fb07ff865b --- /dev/null +++ b/packages/babel-cli/test/fixtures/babel/--copy-files with ignore and copyIgnored in babelrc/.babelrc @@ -0,0 +1,3 @@ +{ + "ignore": ["src/foo"] +} diff --git a/packages/babel-cli/test/fixtures/babel/--copy-files with ignore and copyIgnored in babelrc/in-files/src/.foorc b/packages/babel-cli/test/fixtures/babel/--copy-files with ignore and copyIgnored in babelrc/in-files/src/.foorc new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/packages/babel-cli/test/fixtures/babel/--copy-files with ignore and copyIgnored in babelrc/in-files/src/README.md b/packages/babel-cli/test/fixtures/babel/--copy-files with ignore and copyIgnored in babelrc/in-files/src/README.md new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/packages/babel-cli/test/fixtures/babel/--copy-files with ignore and copyIgnored in babelrc/in-files/src/foo/bar.js b/packages/babel-cli/test/fixtures/babel/--copy-files with ignore and copyIgnored in babelrc/in-files/src/foo/bar.js new file mode 100644 index 000000000000..e46160df1c7a --- /dev/null +++ b/packages/babel-cli/test/fixtures/babel/--copy-files with ignore and copyIgnored in babelrc/in-files/src/foo/bar.js @@ -0,0 +1 @@ +bar; diff --git a/packages/babel-cli/test/fixtures/babel/--copy-files with ignore and copyIgnored in babelrc/in-files/src/index.js b/packages/babel-cli/test/fixtures/babel/--copy-files with ignore and copyIgnored in babelrc/in-files/src/index.js new file mode 100644 index 000000000000..c6788558edcb --- /dev/null +++ b/packages/babel-cli/test/fixtures/babel/--copy-files with ignore and copyIgnored in babelrc/in-files/src/index.js @@ -0,0 +1 @@ +index; diff --git a/packages/babel-cli/test/fixtures/babel/--copy-files with ignore and copyIgnored in babelrc/options.json b/packages/babel-cli/test/fixtures/babel/--copy-files with ignore and copyIgnored in babelrc/options.json new file mode 100644 index 000000000000..d16d70e6ffec --- /dev/null +++ b/packages/babel-cli/test/fixtures/babel/--copy-files with ignore and copyIgnored in babelrc/options.json @@ -0,0 +1,10 @@ +{ + "args": [ + "src", + "--out-dir", + "lib", + "--copy-files", + "--copy-ignored", + "--verbose" + ] +} diff --git a/packages/babel-cli/test/fixtures/babel/--copy-files with ignore and copyIgnored in babelrc/out-files/lib/README.md b/packages/babel-cli/test/fixtures/babel/--copy-files with ignore and copyIgnored in babelrc/out-files/lib/README.md new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/packages/babel-cli/test/fixtures/babel/--copy-files with ignore and copyIgnored in babelrc/out-files/lib/foo/bar.js b/packages/babel-cli/test/fixtures/babel/--copy-files with ignore and copyIgnored in babelrc/out-files/lib/foo/bar.js new file mode 100644 index 000000000000..e46160df1c7a --- /dev/null +++ b/packages/babel-cli/test/fixtures/babel/--copy-files with ignore and copyIgnored in babelrc/out-files/lib/foo/bar.js @@ -0,0 +1 @@ +bar; diff --git a/packages/babel-cli/test/fixtures/babel/--copy-files with ignore and copyIgnored in babelrc/out-files/lib/index.js b/packages/babel-cli/test/fixtures/babel/--copy-files with ignore and copyIgnored in babelrc/out-files/lib/index.js new file mode 100644 index 000000000000..1073b618d0dd --- /dev/null +++ b/packages/babel-cli/test/fixtures/babel/--copy-files with ignore and copyIgnored in babelrc/out-files/lib/index.js @@ -0,0 +1,3 @@ +"use strict"; + +index; diff --git a/packages/babel-cli/test/fixtures/babel/--copy-files with ignore and copyIgnored in babelrc/stdout.txt b/packages/babel-cli/test/fixtures/babel/--copy-files with ignore and copyIgnored in babelrc/stdout.txt new file mode 100644 index 000000000000..84a430432e47 --- /dev/null +++ b/packages/babel-cli/test/fixtures/babel/--copy-files with ignore and copyIgnored in babelrc/stdout.txt @@ -0,0 +1,2 @@ +src/index.js -> lib/index.js +Successfully compiled 1 file with Babel. diff --git a/packages/babel-cli/test/fixtures/babel/--copy-files with ignore in babelignore/.babelignore b/packages/babel-cli/test/fixtures/babel/--copy-files with ignore in babelignore/.babelignore new file mode 100644 index 000000000000..8b4ba6ce4d35 --- /dev/null +++ b/packages/babel-cli/test/fixtures/babel/--copy-files with ignore in babelignore/.babelignore @@ -0,0 +1 @@ +src/foo diff --git a/packages/babel-cli/test/fixtures/babel/--copy-files with ignore in babelignore/in-files/src/.foorc b/packages/babel-cli/test/fixtures/babel/--copy-files with ignore in babelignore/in-files/src/.foorc new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/packages/babel-cli/test/fixtures/babel/--copy-files with ignore in babelignore/in-files/src/README.md b/packages/babel-cli/test/fixtures/babel/--copy-files with ignore in babelignore/in-files/src/README.md new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/packages/babel-cli/test/fixtures/babel/--copy-files with ignore in babelignore/in-files/src/foo/bar.js b/packages/babel-cli/test/fixtures/babel/--copy-files with ignore in babelignore/in-files/src/foo/bar.js new file mode 100644 index 000000000000..e46160df1c7a --- /dev/null +++ b/packages/babel-cli/test/fixtures/babel/--copy-files with ignore in babelignore/in-files/src/foo/bar.js @@ -0,0 +1 @@ +bar; diff --git a/packages/babel-cli/test/fixtures/babel/--copy-files with ignore in babelignore/in-files/src/index.js b/packages/babel-cli/test/fixtures/babel/--copy-files with ignore in babelignore/in-files/src/index.js new file mode 100644 index 000000000000..c6788558edcb --- /dev/null +++ b/packages/babel-cli/test/fixtures/babel/--copy-files with ignore in babelignore/in-files/src/index.js @@ -0,0 +1 @@ +index; diff --git a/packages/babel-cli/test/fixtures/babel/--copy-files with ignore in babelignore/options.json b/packages/babel-cli/test/fixtures/babel/--copy-files with ignore in babelignore/options.json new file mode 100644 index 000000000000..39e3d0dc2606 --- /dev/null +++ b/packages/babel-cli/test/fixtures/babel/--copy-files with ignore in babelignore/options.json @@ -0,0 +1,9 @@ +{ + "args": [ + "src", + "--out-dir", + "lib", + "--copy-files", + "--verbose" + ] +} diff --git a/packages/babel-cli/test/fixtures/babel/--copy-files with ignore in babelignore/out-files/lib/README.md b/packages/babel-cli/test/fixtures/babel/--copy-files with ignore in babelignore/out-files/lib/README.md new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/packages/babel-cli/test/fixtures/babel/--copy-files with ignore in babelignore/out-files/lib/index.js b/packages/babel-cli/test/fixtures/babel/--copy-files with ignore in babelignore/out-files/lib/index.js new file mode 100644 index 000000000000..1073b618d0dd --- /dev/null +++ b/packages/babel-cli/test/fixtures/babel/--copy-files with ignore in babelignore/out-files/lib/index.js @@ -0,0 +1,3 @@ +"use strict"; + +index; diff --git a/packages/babel-cli/test/fixtures/babel/--copy-files with ignore in babelignore/stdout.txt b/packages/babel-cli/test/fixtures/babel/--copy-files with ignore in babelignore/stdout.txt new file mode 100644 index 000000000000..84a430432e47 --- /dev/null +++ b/packages/babel-cli/test/fixtures/babel/--copy-files with ignore in babelignore/stdout.txt @@ -0,0 +1,2 @@ +src/index.js -> lib/index.js +Successfully compiled 1 file with Babel. diff --git a/packages/babel-cli/test/fixtures/babel/--copy-files with ignore in babelrc/.babelrc b/packages/babel-cli/test/fixtures/babel/--copy-files with ignore in babelrc/.babelrc new file mode 100644 index 000000000000..b1fb07ff865b --- /dev/null +++ b/packages/babel-cli/test/fixtures/babel/--copy-files with ignore in babelrc/.babelrc @@ -0,0 +1,3 @@ +{ + "ignore": ["src/foo"] +} diff --git a/packages/babel-cli/test/fixtures/babel/--copy-files with ignore in babelrc/in-files/src/.foorc b/packages/babel-cli/test/fixtures/babel/--copy-files with ignore in babelrc/in-files/src/.foorc new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/packages/babel-cli/test/fixtures/babel/--copy-files with ignore in babelrc/in-files/src/README.md b/packages/babel-cli/test/fixtures/babel/--copy-files with ignore in babelrc/in-files/src/README.md new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/packages/babel-cli/test/fixtures/babel/--copy-files with ignore in babelrc/in-files/src/foo/bar.js b/packages/babel-cli/test/fixtures/babel/--copy-files with ignore in babelrc/in-files/src/foo/bar.js new file mode 100644 index 000000000000..e46160df1c7a --- /dev/null +++ b/packages/babel-cli/test/fixtures/babel/--copy-files with ignore in babelrc/in-files/src/foo/bar.js @@ -0,0 +1 @@ +bar; diff --git a/packages/babel-cli/test/fixtures/babel/--copy-files with ignore in babelrc/in-files/src/index.js b/packages/babel-cli/test/fixtures/babel/--copy-files with ignore in babelrc/in-files/src/index.js new file mode 100644 index 000000000000..c6788558edcb --- /dev/null +++ b/packages/babel-cli/test/fixtures/babel/--copy-files with ignore in babelrc/in-files/src/index.js @@ -0,0 +1 @@ +index; diff --git a/packages/babel-cli/test/fixtures/babel/--copy-files with ignore in babelrc/options.json b/packages/babel-cli/test/fixtures/babel/--copy-files with ignore in babelrc/options.json new file mode 100644 index 000000000000..39e3d0dc2606 --- /dev/null +++ b/packages/babel-cli/test/fixtures/babel/--copy-files with ignore in babelrc/options.json @@ -0,0 +1,9 @@ +{ + "args": [ + "src", + "--out-dir", + "lib", + "--copy-files", + "--verbose" + ] +} diff --git a/packages/babel-cli/test/fixtures/babel/--copy-files with ignore in babelrc/out-files/lib/README.md b/packages/babel-cli/test/fixtures/babel/--copy-files with ignore in babelrc/out-files/lib/README.md new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/packages/babel-cli/test/fixtures/babel/--copy-files with ignore in babelrc/out-files/lib/index.js b/packages/babel-cli/test/fixtures/babel/--copy-files with ignore in babelrc/out-files/lib/index.js new file mode 100644 index 000000000000..1073b618d0dd --- /dev/null +++ b/packages/babel-cli/test/fixtures/babel/--copy-files with ignore in babelrc/out-files/lib/index.js @@ -0,0 +1,3 @@ +"use strict"; + +index; diff --git a/packages/babel-cli/test/fixtures/babel/--copy-files with ignore in babelrc/stdout.txt b/packages/babel-cli/test/fixtures/babel/--copy-files with ignore in babelrc/stdout.txt new file mode 100644 index 000000000000..84a430432e47 --- /dev/null +++ b/packages/babel-cli/test/fixtures/babel/--copy-files with ignore in babelrc/stdout.txt @@ -0,0 +1,2 @@ +src/index.js -> lib/index.js +Successfully compiled 1 file with Babel. diff --git a/packages/babel-cli/test/fixtures/babel/--copy-files with ignore with copyIgnored/in-files/src/.foorc b/packages/babel-cli/test/fixtures/babel/--copy-files with ignore with copyIgnored/in-files/src/.foorc new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/packages/babel-cli/test/fixtures/babel/--copy-files with ignore with copyIgnored/in-files/src/README.md b/packages/babel-cli/test/fixtures/babel/--copy-files with ignore with copyIgnored/in-files/src/README.md new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/packages/babel-cli/test/fixtures/babel/--copy-files with ignore with copyIgnored/in-files/src/foo/bar.js b/packages/babel-cli/test/fixtures/babel/--copy-files with ignore with copyIgnored/in-files/src/foo/bar.js new file mode 100644 index 000000000000..e46160df1c7a --- /dev/null +++ b/packages/babel-cli/test/fixtures/babel/--copy-files with ignore with copyIgnored/in-files/src/foo/bar.js @@ -0,0 +1 @@ +bar; diff --git a/packages/babel-cli/test/fixtures/babel/--copy-files with ignore with copyIgnored/in-files/src/index.js b/packages/babel-cli/test/fixtures/babel/--copy-files with ignore with copyIgnored/in-files/src/index.js new file mode 100644 index 000000000000..c6788558edcb --- /dev/null +++ b/packages/babel-cli/test/fixtures/babel/--copy-files with ignore with copyIgnored/in-files/src/index.js @@ -0,0 +1 @@ +index; diff --git a/packages/babel-cli/test/fixtures/babel/--copy-files with ignore with copyIgnored/options.json b/packages/babel-cli/test/fixtures/babel/--copy-files with ignore with copyIgnored/options.json new file mode 100644 index 000000000000..f49a79c08fe5 --- /dev/null +++ b/packages/babel-cli/test/fixtures/babel/--copy-files with ignore with copyIgnored/options.json @@ -0,0 +1,12 @@ +{ + "args": [ + "src", + "--out-dir", + "lib", + "--copy-files", + "--ignore", + "src/foo", + "--copy-ignored", + "--verbose" + ] +} diff --git a/packages/babel-cli/test/fixtures/babel/--copy-files with ignore with copyIgnored/out-files/lib/README.md b/packages/babel-cli/test/fixtures/babel/--copy-files with ignore with copyIgnored/out-files/lib/README.md new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/packages/babel-cli/test/fixtures/babel/--copy-files with ignore with copyIgnored/out-files/lib/foo/bar.js b/packages/babel-cli/test/fixtures/babel/--copy-files with ignore with copyIgnored/out-files/lib/foo/bar.js new file mode 100644 index 000000000000..e46160df1c7a --- /dev/null +++ b/packages/babel-cli/test/fixtures/babel/--copy-files with ignore with copyIgnored/out-files/lib/foo/bar.js @@ -0,0 +1 @@ +bar; diff --git a/packages/babel-cli/test/fixtures/babel/--copy-files with ignore with copyIgnored/out-files/lib/index.js b/packages/babel-cli/test/fixtures/babel/--copy-files with ignore with copyIgnored/out-files/lib/index.js new file mode 100644 index 000000000000..cb5e86b12ef3 --- /dev/null +++ b/packages/babel-cli/test/fixtures/babel/--copy-files with ignore with copyIgnored/out-files/lib/index.js @@ -0,0 +1,3 @@ +"use strict"; + +index; \ No newline at end of file diff --git a/packages/babel-cli/test/fixtures/babel/--copy-files with ignore with copyIgnored/stdout.txt b/packages/babel-cli/test/fixtures/babel/--copy-files with ignore with copyIgnored/stdout.txt new file mode 100644 index 000000000000..84a430432e47 --- /dev/null +++ b/packages/babel-cli/test/fixtures/babel/--copy-files with ignore with copyIgnored/stdout.txt @@ -0,0 +1,2 @@ +src/index.js -> lib/index.js +Successfully compiled 1 file with Babel. diff --git a/packages/babel-cli/test/fixtures/babel/--copy-files with only copy copyIgnored/in-files/src/.foorc b/packages/babel-cli/test/fixtures/babel/--copy-files with only copy copyIgnored/in-files/src/.foorc new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/packages/babel-cli/test/fixtures/babel/--copy-files with only copy copyIgnored/in-files/src/README.md b/packages/babel-cli/test/fixtures/babel/--copy-files with only copy copyIgnored/in-files/src/README.md new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/packages/babel-cli/test/fixtures/babel/--copy-files with only copy copyIgnored/in-files/src/foo/bar.js b/packages/babel-cli/test/fixtures/babel/--copy-files with only copy copyIgnored/in-files/src/foo/bar.js new file mode 100644 index 000000000000..e46160df1c7a --- /dev/null +++ b/packages/babel-cli/test/fixtures/babel/--copy-files with only copy copyIgnored/in-files/src/foo/bar.js @@ -0,0 +1 @@ +bar; diff --git a/packages/babel-cli/test/fixtures/babel/--copy-files with only copy copyIgnored/in-files/src/index.js b/packages/babel-cli/test/fixtures/babel/--copy-files with only copy copyIgnored/in-files/src/index.js new file mode 100644 index 000000000000..c6788558edcb --- /dev/null +++ b/packages/babel-cli/test/fixtures/babel/--copy-files with only copy copyIgnored/in-files/src/index.js @@ -0,0 +1 @@ +index; diff --git a/packages/babel-cli/test/fixtures/babel/--copy-files with only copy copyIgnored/options.json b/packages/babel-cli/test/fixtures/babel/--copy-files with only copy copyIgnored/options.json new file mode 100644 index 000000000000..f3adb3c91b91 --- /dev/null +++ b/packages/babel-cli/test/fixtures/babel/--copy-files with only copy copyIgnored/options.json @@ -0,0 +1,12 @@ +{ + "args": [ + "src", + "--out-dir", + "lib", + "--copy-files", + "--only", + "src/foo/*", + "--copy-ignored", + "--verbose" + ] +} diff --git a/packages/babel-cli/test/fixtures/babel/--copy-files with only copy copyIgnored/out-files/lib/README.md b/packages/babel-cli/test/fixtures/babel/--copy-files with only copy copyIgnored/out-files/lib/README.md new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/packages/babel-cli/test/fixtures/babel/--copy-files with only copy copyIgnored/out-files/lib/foo/bar.js b/packages/babel-cli/test/fixtures/babel/--copy-files with only copy copyIgnored/out-files/lib/foo/bar.js new file mode 100644 index 000000000000..0ed075a19327 --- /dev/null +++ b/packages/babel-cli/test/fixtures/babel/--copy-files with only copy copyIgnored/out-files/lib/foo/bar.js @@ -0,0 +1,3 @@ +"use strict"; + +bar; diff --git a/packages/babel-cli/test/fixtures/babel/--copy-files with only copy copyIgnored/out-files/lib/index.js b/packages/babel-cli/test/fixtures/babel/--copy-files with only copy copyIgnored/out-files/lib/index.js new file mode 100644 index 000000000000..c6788558edcb --- /dev/null +++ b/packages/babel-cli/test/fixtures/babel/--copy-files with only copy copyIgnored/out-files/lib/index.js @@ -0,0 +1 @@ +index; diff --git a/packages/babel-cli/test/fixtures/babel/--copy-files with only copy copyIgnored/stdout.txt b/packages/babel-cli/test/fixtures/babel/--copy-files with only copy copyIgnored/stdout.txt new file mode 100644 index 000000000000..673dafc7483e --- /dev/null +++ b/packages/babel-cli/test/fixtures/babel/--copy-files with only copy copyIgnored/stdout.txt @@ -0,0 +1,2 @@ +src/foo/bar.js -> lib/foo/bar.js +Successfully compiled 1 file with Babel. diff --git a/packages/babel-cli/test/fixtures/babel/--minified/in-files/script.js b/packages/babel-cli/test/fixtures/babel/--minified/in-files/script.js new file mode 100644 index 000000000000..3353ddb752c2 --- /dev/null +++ b/packages/babel-cli/test/fixtures/babel/--minified/in-files/script.js @@ -0,0 +1 @@ +() => 42; diff --git a/packages/babel-cli/test/fixtures/babel/--minified/options.json b/packages/babel-cli/test/fixtures/babel/--minified/options.json new file mode 100644 index 000000000000..2df8c827b826 --- /dev/null +++ b/packages/babel-cli/test/fixtures/babel/--minified/options.json @@ -0,0 +1,3 @@ +{ + "args": ["--out-file", "script2.js", "--no-comments", "--minified", "script.js"] +} diff --git a/packages/babel-cli/test/fixtures/babel/--minified/out-files/script2.js b/packages/babel-cli/test/fixtures/babel/--minified/out-files/script2.js new file mode 100644 index 000000000000..b9260cd4afe8 --- /dev/null +++ b/packages/babel-cli/test/fixtures/babel/--minified/out-files/script2.js @@ -0,0 +1 @@ +"use strict";(function(){return 42}); diff --git a/packages/babel-cli/test/fixtures/babel/dir --out-dir --out-file-extension/in-files/src/bar.mjs b/packages/babel-cli/test/fixtures/babel/dir --out-dir --out-file-extension/in-files/src/bar.mjs new file mode 100644 index 000000000000..7c1178b8d64f --- /dev/null +++ b/packages/babel-cli/test/fixtures/babel/dir --out-dir --out-file-extension/in-files/src/bar.mjs @@ -0,0 +1 @@ +arr.map(x => x / DIVIDER); diff --git a/packages/babel-cli/test/fixtures/babel/dir --out-dir --out-file-extension/in-files/src/foo.jsx b/packages/babel-cli/test/fixtures/babel/dir --out-dir --out-file-extension/in-files/src/foo.jsx new file mode 100644 index 000000000000..4bc9539528d4 --- /dev/null +++ b/packages/babel-cli/test/fixtures/babel/dir --out-dir --out-file-extension/in-files/src/foo.jsx @@ -0,0 +1 @@ +arr.map(x => x * MULTIPLIER); diff --git a/packages/babel-cli/test/fixtures/babel/dir --out-dir --out-file-extension/options.json b/packages/babel-cli/test/fixtures/babel/dir --out-dir --out-file-extension/options.json new file mode 100644 index 000000000000..5150f4941a1f --- /dev/null +++ b/packages/babel-cli/test/fixtures/babel/dir --out-dir --out-file-extension/options.json @@ -0,0 +1,12 @@ +{ + "args": [ + "src", + "--out-dir", + "lib", + "--out-file-extension", + ".mjs", + "--extensions", + ".jsx,.mjs", + "--verbose" + ] +} diff --git a/packages/babel-cli/test/fixtures/babel/dir --out-dir --out-file-extension/out-files/lib/bar.mjs b/packages/babel-cli/test/fixtures/babel/dir --out-dir --out-file-extension/out-files/lib/bar.mjs new file mode 100644 index 000000000000..5d02843681e4 --- /dev/null +++ b/packages/babel-cli/test/fixtures/babel/dir --out-dir --out-file-extension/out-files/lib/bar.mjs @@ -0,0 +1,5 @@ +"use strict"; + +arr.map(function (x) { + return x / DIVIDER; +}); diff --git a/packages/babel-cli/test/fixtures/babel/dir --out-dir --out-file-extension/out-files/lib/foo.mjs b/packages/babel-cli/test/fixtures/babel/dir --out-dir --out-file-extension/out-files/lib/foo.mjs new file mode 100644 index 000000000000..ae4557e57bc3 --- /dev/null +++ b/packages/babel-cli/test/fixtures/babel/dir --out-dir --out-file-extension/out-files/lib/foo.mjs @@ -0,0 +1,5 @@ +"use strict"; + +arr.map(function (x) { + return x * MULTIPLIER; +}); diff --git a/packages/babel-cli/test/fixtures/babel/dir --out-dir --out-file-extension/stdout.txt b/packages/babel-cli/test/fixtures/babel/dir --out-dir --out-file-extension/stdout.txt new file mode 100644 index 000000000000..24ba955afb2b --- /dev/null +++ b/packages/babel-cli/test/fixtures/babel/dir --out-dir --out-file-extension/stdout.txt @@ -0,0 +1,3 @@ +src/bar.mjs -> lib/bar.mjs +src/foo.jsx -> lib/foo.mjs +Successfully compiled 2 files with Babel. diff --git a/packages/babel-cli/test/fixtures/babel/error --keep-file-extension --out-file-extension/options.json b/packages/babel-cli/test/fixtures/babel/error --keep-file-extension --out-file-extension/options.json new file mode 100644 index 000000000000..8ad9743c9dbc --- /dev/null +++ b/packages/babel-cli/test/fixtures/babel/error --keep-file-extension --out-file-extension/options.json @@ -0,0 +1,4 @@ +{ + "args": ["--keep-file-extension", "--out-file-extension", ".mjs"], + "stderrContains": true +} diff --git a/packages/babel-cli/test/fixtures/babel/error --keep-file-extension --out-file-extension/stderr.txt b/packages/babel-cli/test/fixtures/babel/error --keep-file-extension --out-file-extension/stderr.txt new file mode 100644 index 000000000000..acc6f8edb8bb --- /dev/null +++ b/packages/babel-cli/test/fixtures/babel/error --keep-file-extension --out-file-extension/stderr.txt @@ -0,0 +1 @@ +--out-file-extension cannot be used with --keep-file-extension diff --git a/packages/babel-cli/test/fixtures/babel/error incorrect options after args/in-files/script.js b/packages/babel-cli/test/fixtures/babel/error incorrect options after args/in-files/script.js new file mode 100644 index 000000000000..4bc9539528d4 --- /dev/null +++ b/packages/babel-cli/test/fixtures/babel/error incorrect options after args/in-files/script.js @@ -0,0 +1 @@ +arr.map(x => x * MULTIPLIER); diff --git a/packages/babel-cli/test/fixtures/babel/error incorrect options after args/options.json b/packages/babel-cli/test/fixtures/babel/error incorrect options after args/options.json new file mode 100644 index 000000000000..dde64755da06 --- /dev/null +++ b/packages/babel-cli/test/fixtures/babel/error incorrect options after args/options.json @@ -0,0 +1,4 @@ +{ + "args": ["script.js", "--spruce-maps"], + "stderrContains": true +} diff --git a/packages/babel-cli/test/fixtures/babel/error incorrect options after args/stderr.txt b/packages/babel-cli/test/fixtures/babel/error incorrect options after args/stderr.txt new file mode 100644 index 000000000000..294d5ccaeaed --- /dev/null +++ b/packages/babel-cli/test/fixtures/babel/error incorrect options after args/stderr.txt @@ -0,0 +1 @@ +error: unknown option '--spruce-maps' diff --git a/packages/babel-cli/test/fixtures/babel/error incorrect options before args/in-files/script.js b/packages/babel-cli/test/fixtures/babel/error incorrect options before args/in-files/script.js new file mode 100644 index 000000000000..4bc9539528d4 --- /dev/null +++ b/packages/babel-cli/test/fixtures/babel/error incorrect options before args/in-files/script.js @@ -0,0 +1 @@ +arr.map(x => x * MULTIPLIER); diff --git a/packages/babel-cli/test/fixtures/babel/error incorrect options before args/options.json b/packages/babel-cli/test/fixtures/babel/error incorrect options before args/options.json new file mode 100644 index 000000000000..0d7953971726 --- /dev/null +++ b/packages/babel-cli/test/fixtures/babel/error incorrect options before args/options.json @@ -0,0 +1,4 @@ +{ + "args": ["--spruce-maps", "script.js"], + "stderrContains": true +} diff --git a/packages/babel-cli/test/fixtures/babel/error incorrect options before args/stderr.txt b/packages/babel-cli/test/fixtures/babel/error incorrect options before args/stderr.txt new file mode 100644 index 000000000000..294d5ccaeaed --- /dev/null +++ b/packages/babel-cli/test/fixtures/babel/error incorrect options before args/stderr.txt @@ -0,0 +1 @@ +error: unknown option '--spruce-maps' diff --git a/packages/babel-cli/test/fixtures/babel/filename --out-file deep/in-files/script.js b/packages/babel-cli/test/fixtures/babel/filename --out-file deep/in-files/script.js new file mode 100644 index 000000000000..4bc9539528d4 --- /dev/null +++ b/packages/babel-cli/test/fixtures/babel/filename --out-file deep/in-files/script.js @@ -0,0 +1 @@ +arr.map(x => x * MULTIPLIER); diff --git a/packages/babel-cli/test/fixtures/babel/filename --out-file deep/options.json b/packages/babel-cli/test/fixtures/babel/filename --out-file deep/options.json new file mode 100644 index 000000000000..d24719ba4a76 --- /dev/null +++ b/packages/babel-cli/test/fixtures/babel/filename --out-file deep/options.json @@ -0,0 +1,3 @@ +{ + "args": ["script.js", "--out-file", "folder/nested/script.js"] +} diff --git a/packages/babel-cli/test/fixtures/babel/filename --out-file deep/out-files/folder/nested/script.js b/packages/babel-cli/test/fixtures/babel/filename --out-file deep/out-files/folder/nested/script.js new file mode 100644 index 000000000000..ae4557e57bc3 --- /dev/null +++ b/packages/babel-cli/test/fixtures/babel/filename --out-file deep/out-files/folder/nested/script.js @@ -0,0 +1,5 @@ +"use strict"; + +arr.map(function (x) { + return x * MULTIPLIER; +}); diff --git a/packages/babel-cli/test/fixtures/babel/stdin --filename windows/options.json b/packages/babel-cli/test/fixtures/babel/stdin --filename windows/options.json new file mode 100644 index 000000000000..0c847447d595 --- /dev/null +++ b/packages/babel-cli/test/fixtures/babel/stdin --filename windows/options.json @@ -0,0 +1,5 @@ +{ + "args": ["--filename", "test.js"], + "stderrContains": true, + "os": ["win32"] +} diff --git a/packages/babel-cli/test/fixtures/babel/stdin --filename windows/stderr.txt b/packages/babel-cli/test/fixtures/babel/stdin --filename windows/stderr.txt new file mode 100644 index 000000000000..1ca69db1084e --- /dev/null +++ b/packages/babel-cli/test/fixtures/babel/stdin --filename windows/stderr.txt @@ -0,0 +1 @@ +SyntaxError: \test.js: Unexpected token, expected ";" (2:10) diff --git a/packages/babel-cli/test/fixtures/babel/stdin --filename windows/stdin.txt b/packages/babel-cli/test/fixtures/babel/stdin --filename windows/stdin.txt new file mode 100644 index 000000000000..1d931c7e8559 --- /dev/null +++ b/packages/babel-cli/test/fixtures/babel/stdin --filename windows/stdin.txt @@ -0,0 +1,3 @@ +arr.map(function () { + return $]!; +}); diff --git a/packages/babel-cli/test/fixtures/babel/stdin --filename/options.json b/packages/babel-cli/test/fixtures/babel/stdin --filename/options.json index 4274d9a29614..724c35ed8520 100644 --- a/packages/babel-cli/test/fixtures/babel/stdin --filename/options.json +++ b/packages/babel-cli/test/fixtures/babel/stdin --filename/options.json @@ -1,4 +1,5 @@ { "args": ["--filename", "test.js"], - "stderrContains": true + "stderrContains": true, + "os": ["linux", "darwin"] } diff --git a/packages/babel-cli/test/index.js b/packages/babel-cli/test/index.js index 64f64273319c..e7ee2cbb6f40 100644 --- a/packages/babel-cli/test/index.js +++ b/packages/babel-cli/test/index.js @@ -1,7 +1,7 @@ const readdir = require("fs-readdir-recursive"); const helper = require("@babel/helper-fixtures"); const rimraf = require("rimraf"); -const outputFileSync = require("output-file-sync"); +const { sync: makeDirSync } = require("make-dir"); const child = require("child_process"); const merge = require("lodash/merge"); const path = require("path"); @@ -14,6 +14,11 @@ const fileFilter = function(x) { return x !== ".DS_Store"; }; +const outputFileSync = function(filePath, data) { + makeDirSync(path.dirname(filePath)); + fs.writeFileSync(filePath, data); +}; + const presetLocs = [path.join(__dirname, "../../babel-preset-react")]; const pluginLocs = [ @@ -92,7 +97,8 @@ const assertTest = function(stdout, stderr, opts, cwd) { if ( // saveInFiles always creates an empty .babelrc, so lets exclude for now filename !== ".babelrc" && - !opts.inFiles.hasOwnProperty(filename) + filename !== ".babelignore" && + !Object.prototype.hasOwnProperty.call(opts.inFiles, filename) ) { const expected = opts.outFiles[filename]; const actual = actualFiles[filename]; @@ -115,13 +121,6 @@ const buildTest = function(binName, testName, opts) { const binLoc = path.join(__dirname, "../lib", binName); return function(callback) { - const dir = process.cwd(); - - process.chdir(__dirname); - if (fs.existsSync(tmpLoc)) rimraf.sync(tmpLoc); - fs.mkdirSync(tmpLoc); - process.chdir(tmpLoc); - saveInFiles(opts.inFiles); let args = [binLoc]; @@ -159,7 +158,6 @@ const buildTest = function(binName, testName, opts) { args.map(arg => `"${arg}"`).join(" ") + ": " + err.message; } - process.chdir(dir); callback(err); }); @@ -175,6 +173,26 @@ fs.readdirSync(fixtureLoc).forEach(function(binName) { const suiteLoc = path.join(fixtureLoc, binName); describe("bin/" + binName, function() { + let cwd; + + beforeEach(() => { + cwd = process.cwd(); + + if (fs.existsSync(tmpLoc)) { + for (const child of fs.readdirSync(tmpLoc)) { + rimraf.sync(path.join(tmpLoc, child)); + } + } else { + fs.mkdirSync(tmpLoc); + } + + process.chdir(tmpLoc); + }); + + afterEach(() => { + process.chdir(cwd); + }); + fs.readdirSync(suiteLoc).forEach(function(testName) { if (testName.startsWith(".")) return; @@ -185,7 +203,29 @@ fs.readdirSync(fixtureLoc).forEach(function(binName) { }; const optionsLoc = path.join(testLoc, "options.json"); - if (fs.existsSync(optionsLoc)) merge(opts, require(optionsLoc)); + if (fs.existsSync(optionsLoc)) { + const taskOpts = require(optionsLoc); + if (taskOpts.os) { + let os = taskOpts.os; + + if (!Array.isArray(os) && typeof os !== "string") { + throw new Error( + `'os' should be either string or string array: ${taskOpts.os}`, + ); + } + + if (typeof os === "string") { + os = [os]; + } + + if (!os.includes(process.platform)) { + return; + } + + delete taskOpts.os; + } + merge(opts, taskOpts); + } ["stdout", "stdin", "stderr"].forEach(function(key) { const loc = path.join(testLoc, key + ".txt"); @@ -200,12 +240,18 @@ fs.readdirSync(fixtureLoc).forEach(function(binName) { opts.inFiles = readDir(path.join(testLoc, "in-files"), fileFilter); const babelrcLoc = path.join(testLoc, ".babelrc"); + const babelIgnoreLoc = path.join(testLoc, ".babelignore"); if (fs.existsSync(babelrcLoc)) { // copy .babelrc file to tmp directory opts.inFiles[".babelrc"] = helper.readFile(babelrcLoc); + opts.inFiles[".babelignore"] = helper.readFile(babelIgnoreLoc); + } + if (fs.existsSync(babelIgnoreLoc)) { + // copy .babelignore file to tmp directory + opts.inFiles[".babelignore"] = helper.readFile(babelIgnoreLoc); } - it(testName, buildTest(binName, testName, opts)); + it(testName, buildTest(binName, testName, opts), 20000); }); }); }); diff --git a/packages/babel-code-frame/package.json b/packages/babel-code-frame/package.json index 0b753eb11230..e5ba6996a98a 100644 --- a/packages/babel-code-frame/package.json +++ b/packages/babel-code-frame/package.json @@ -1,6 +1,6 @@ { "name": "@babel/code-frame", - "version": "7.5.5", + "version": "7.8.3", "description": "Generate errors that contain a code frame that point to source locations.", "author": "Sebastian McKenzie ", "homepage": "https://babeljs.io/", @@ -11,7 +11,7 @@ "repository": "https://github.com/babel/babel/tree/master/packages/babel-code-frame", "main": "lib/index.js", "dependencies": { - "@babel/highlight": "^7.0.0" + "@babel/highlight": "^7.8.3" }, "devDependencies": { "chalk": "^2.0.0", diff --git a/packages/babel-compat-data/.npmignore b/packages/babel-compat-data/.npmignore new file mode 100644 index 000000000000..57e1671459aa --- /dev/null +++ b/packages/babel-compat-data/.npmignore @@ -0,0 +1,4 @@ +scripts +src +test +*.log diff --git a/packages/babel-compat-data/corejs2-built-ins.js b/packages/babel-compat-data/corejs2-built-ins.js new file mode 100644 index 000000000000..ccbe72f0d58b --- /dev/null +++ b/packages/babel-compat-data/corejs2-built-ins.js @@ -0,0 +1,4 @@ +// Node < 13.3 doesn't support export maps in package.json. +// Use this proxy file as a fallback. + +module.exports = require("./data/corejs2-built-ins.json"); diff --git a/packages/babel-preset-env/data/built-in-modules.json b/packages/babel-compat-data/data/built-in-modules.json similarity index 100% rename from packages/babel-preset-env/data/built-in-modules.json rename to packages/babel-compat-data/data/built-in-modules.json diff --git a/packages/babel-preset-env/data/corejs2-built-ins.json b/packages/babel-compat-data/data/corejs2-built-ins.json similarity index 99% rename from packages/babel-preset-env/data/corejs2-built-ins.json rename to packages/babel-compat-data/data/corejs2-built-ins.json index 2079f1c3d74a..5c81e27f27f5 100644 --- a/packages/babel-preset-env/data/corejs2-built-ins.json +++ b/packages/babel-compat-data/data/corejs2-built-ins.json @@ -77,6 +77,7 @@ "safari": "12", "node": "11", "ios": "12", + "samsung": "10.2", "opera": "56", "electron": "4" }, @@ -1496,6 +1497,7 @@ "safari": "12", "node": "10", "ios": "12", + "samsung": "9.2", "opera": "53", "electron": "3.1" }, @@ -1505,6 +1507,7 @@ "safari": "12", "node": "10", "ios": "12", + "samsung": "9.2", "opera": "53", "electron": "3.1" }, diff --git a/packages/babel-compat-data/data/native-modules.json b/packages/babel-compat-data/data/native-modules.json new file mode 100644 index 000000000000..7e33f27eb290 --- /dev/null +++ b/packages/babel-compat-data/data/native-modules.json @@ -0,0 +1,12 @@ +{ + "es6.module": { + "edge": "16", + "firefox": "60", + "chrome": "61", + "safari": "10.1", + "opera": "48", + "ios_saf": "10.3", + "and_chr": "74", + "and_ff": "66" + } +} diff --git a/packages/babel-compat-data/data/overlapping-plugins.json b/packages/babel-compat-data/data/overlapping-plugins.json new file mode 100644 index 000000000000..2cd7597e6081 --- /dev/null +++ b/packages/babel-compat-data/data/overlapping-plugins.json @@ -0,0 +1,3 @@ +{ + "transform-regenerator": [] +} \ No newline at end of file diff --git a/packages/babel-preset-env/data/plugins.json b/packages/babel-compat-data/data/plugins.json similarity index 95% rename from packages/babel-preset-env/data/plugins.json rename to packages/babel-compat-data/data/plugins.json index 382a51399431..cc4902eaa9c0 100644 --- a/packages/babel-preset-env/data/plugins.json +++ b/packages/babel-compat-data/data/plugins.json @@ -3,7 +3,9 @@ "chrome": "41", "edge": "13", "firefox": "34", + "safari": "13", "node": "4", + "ios": "13", "samsung": "3.4", "opera": "28", "electron": "0.24" @@ -273,6 +275,7 @@ "safari": "11.1", "node": "10", "ios": "11.3", + "samsung": "9.2", "opera": "51", "electron": "3.1" }, @@ -282,6 +285,7 @@ "safari": "12", "node": "10", "ios": "12", + "samsung": "9.2", "opera": "53", "electron": "3.1" }, @@ -291,14 +295,20 @@ "safari": "11.1", "node": "10", "ios": "11.3", + "samsung": "9.2", "opera": "53", "electron": "3.1" }, + "proposal-optional-chaining": { + "chrome": "80", + "opera": "67" + }, "transform-named-capturing-groups-regex": { "chrome": "64", "safari": "11.1", "node": "10", "ios": "11.3", + "samsung": "9.2", "opera": "51", "electron": "3.1" }, @@ -343,5 +353,10 @@ "phantom": "2", "samsung": "2.1", "electron": "0.2" + }, + "proposal-nullish-coalescing-operator": { + "chrome": "80", + "firefox": "72", + "opera": "67" } } diff --git a/packages/babel-compat-data/native-modules.js b/packages/babel-compat-data/native-modules.js new file mode 100644 index 000000000000..efa3031c0a53 --- /dev/null +++ b/packages/babel-compat-data/native-modules.js @@ -0,0 +1,4 @@ +// Node < 13.3 doesn't support export maps in package.json. +// Use this proxy file as a fallback. + +module.exports = require("./data/native-modules.json"); diff --git a/packages/babel-compat-data/overlapping-plugins.js b/packages/babel-compat-data/overlapping-plugins.js new file mode 100644 index 000000000000..9f7d8efde56f --- /dev/null +++ b/packages/babel-compat-data/overlapping-plugins.js @@ -0,0 +1,4 @@ +// Node < 13.3 doesn't support export maps in package.json. +// Use this proxy file as a fallback. + +module.exports = require("./data/overlapping-plugins.json"); diff --git a/packages/babel-compat-data/package.json b/packages/babel-compat-data/package.json new file mode 100644 index 000000000000..824d84bca145 --- /dev/null +++ b/packages/babel-compat-data/package.json @@ -0,0 +1,36 @@ +{ + "name": "@babel/compat-data", + "version": "7.8.1", + "author": "The Babel Team (https://babeljs.io/team)", + "license": "MIT", + "description": "", + "repository": "https://github.com/babel/babel/tree/master/packages/babel-compat-data", + "publishConfig": { + "access": "public" + }, + "exports": { + "./plugins": "./data/plugins.json", + "./native-modules": "./data/native-modules.json", + "./corejs2-built-ins": "./data/corejs2-built-ins.json", + "./overlapping-plugins": "./data/overlapping-plugins.json" + }, + "scripts": { + "build-data": "./scripts/download-compat-table.sh; node ./scripts/build-data.js; node ./scripts/build-modules-support.js; node ./scripts/build-overlapping-plugins.js" + }, + "keywords": [ + "babel", + "compat-table", + "compat-data" + ], + "dependencies": { + "browserslist": "^4.8.2", + "invariant": "^2.2.4", + "semver": "^5.5.0" + }, + "devDependencies": { + "@babel/helper-compilation-targets": "^7.8.1", + "caniuse-db": "1.0.30000969", + "electron-to-chromium": "1.3.113", + "lodash": "^4.17.15" + } +} diff --git a/packages/babel-compat-data/plugins.js b/packages/babel-compat-data/plugins.js new file mode 100644 index 000000000000..74a9d60f2310 --- /dev/null +++ b/packages/babel-compat-data/plugins.js @@ -0,0 +1,4 @@ +// Node < 13.3 doesn't support export maps in package.json. +// Use this proxy file as a fallback. + +module.exports = require("./data/plugins.json"); diff --git a/packages/babel-preset-env/scripts/build-data.js b/packages/babel-compat-data/scripts/build-data.js similarity index 97% rename from packages/babel-preset-env/scripts/build-data.js rename to packages/babel-compat-data/scripts/build-data.js index d4502ddaa91f..b4ac76c25c4e 100644 --- a/packages/babel-preset-env/scripts/build-data.js +++ b/packages/babel-compat-data/scripts/build-data.js @@ -7,7 +7,7 @@ const flattenDeep = require("lodash/flattenDeep"); const isEqual = require("lodash/isEqual"); const mapValues = require("lodash/mapValues"); const pickBy = require("lodash/pickBy"); -const unreleasedLabels = require("../data/unreleased-labels"); +const { unreleasedLabels } = require("babel/helper-compilation-targets"); const electronToChromiumVersions = require("electron-to-chromium").versions; const electronToChromiumKeys = Object.keys( @@ -46,7 +46,7 @@ const renameTests = (tests, getName, category) => // environments (node4 and chrome45), as well as familial relationships (edge // and ie11) can be handled properly. -const envs = require("compat-table/environments"); +const envs = require("../build/compat-table/environments"); const byTestSuite = suite => browser => { return Array.isArray(browser.test_suites) @@ -56,7 +56,7 @@ const byTestSuite = suite => browser => { const compatSources = ["es5", "es6", "es2016plus", "esnext"].reduce( (result, source) => { - const data = require(`compat-table/data-${source}`); + const data = require(`../build/compat-table/data-${source}`); data.browsers = pickBy(envs, byTestSuite(source)); result.push(data); return result; @@ -293,7 +293,7 @@ const generateData = (environments, features) => { ["plugin", "corejs2-built-in"].forEach(target => { const newData = generateData( environments, - require(`../data/${target}-features`) + require(`./data/${target}-features`) ); const dataPath = path.join(__dirname, `../data/${target}s.json`); diff --git a/packages/babel-preset-env/scripts/build-modules-support.js b/packages/babel-compat-data/scripts/build-modules-support.js similarity index 100% rename from packages/babel-preset-env/scripts/build-modules-support.js rename to packages/babel-compat-data/scripts/build-modules-support.js diff --git a/packages/babel-compat-data/scripts/build-overlapping-plugins.js b/packages/babel-compat-data/scripts/build-overlapping-plugins.js new file mode 100644 index 000000000000..24e34cfeb92e --- /dev/null +++ b/packages/babel-compat-data/scripts/build-overlapping-plugins.js @@ -0,0 +1,15 @@ +"use strict"; + +const fs = require("fs"); +const overlappingPlugins = require("./data/overlapping-plugins"); + +fs.writeFileSync( + __dirname + "/../data/overlapping-plugins.json", + JSON.stringify(overlappingPlugins, replacer, 2) +); + +function replacer(key, val) { + if (val instanceof Set) return Array.from(val); + if (val instanceof Map) return Object.fromEntries(val); + return val; +} diff --git a/packages/babel-preset-env/data/corejs2-built-in-features.js b/packages/babel-compat-data/scripts/data/corejs2-built-in-features.js similarity index 80% rename from packages/babel-preset-env/data/corejs2-built-in-features.js rename to packages/babel-compat-data/scripts/data/corejs2-built-in-features.js index f18244b4c9ad..2beb9bbed4c8 100644 --- a/packages/babel-preset-env/data/corejs2-built-in-features.js +++ b/packages/babel-compat-data/scripts/data/corejs2-built-in-features.js @@ -26,7 +26,7 @@ const typedArrayMethods = [ "typed arrays / %TypedArray%[Symbol.species]", ]; -const es = { +module.exports = { // compat-table missing babel6 mapping // "es6.array.concat": { // features: [ @@ -34,7 +34,8 @@ const es = { // "well-known symbols / Symbol.species, Array.prototype.concat", // ] // }, - "es6.array.copy-within": "Array.prototype methods / Array.prototype.copyWithin", + "es6.array.copy-within": + "Array.prototype methods / Array.prototype.copyWithin", "es6.array.every": "Array methods / Array.prototype.every", "es6.array.fill": "Array.prototype methods / Array.prototype.fill", "es6.array.filter": { @@ -46,7 +47,8 @@ const es = { }, "es6.array.find": "Array.prototype methods / Array.prototype.find", "es6.array.find-index": "Array.prototype methods / Array.prototype.findIndex", - "es7.array.flat-map": "Array.prototype.{flat, flatMap} / Array.prototype.flatMap", + "es7.array.flat-map": + "Array.prototype.{flat, flatMap} / Array.prototype.flatMap", "es6.array.for-each": "Array methods / Array.prototype.forEach", "es6.array.from": "Array static methods / Array.from", "es7.array.includes": "Array.prototype.includes", @@ -90,12 +92,36 @@ const es = { "es6.function.has-instance": "well-known symbols / Symbol.hasInstance", "es6.function.name": { features: [ - "function \"name\" property / function statements", - "function \"name\" property / function expressions", + 'function "name" property / function statements', + 'function "name" property / function expressions', ], }, - "es6.map": "Map", + // This is explicit to prevent Map-related proposals (like + // Map.prototype.upsert) from being included + "es6.map": { + features: [ + "Map / basic functionality", + "Map / constructor arguments", + "Map / constructor requires new", + "Map / constructor accepts null", + "Map / constructor invokes set", + "Map / iterator closing", + "Map / Map.prototype.add returns this", + "Map / -0 key converts to +0", + "Map / Map.prototype.size", + "Map / Map.prototype.delete", + "Map / Map.prototype.clear", + "Map / Map.prototype.forEach", + "Map / Map.prototype.keys", + "Map / Map.prototype.values", + "Map / Map.prototype.entries", + "Map / Map.prototype[Symbol.iterator]", + "Map / Map.prototype isn't an instance", + "Map / Map iterator prototype chain", + "Map / Map[Symbol.species]", + ], + }, "es6.math.acosh": "Math methods / Math.acosh", "es6.math.asinh": "Math methods / Math.asinh", @@ -150,13 +176,19 @@ const es = { ], }, "es6.object.define-property": "Object static methods / Object.defineProperty", - "es6.object.define-properties": "Object static methods / Object.defineProperties", + "es6.object.define-properties": + "Object static methods / Object.defineProperties", "es7.object.entries": "Object static methods / Object.entries", - "es6.object.freeze": "Object static methods accept primitives / Object.freeze", - "es6.object.get-own-property-descriptor": "Object static methods accept primitives / Object.getOwnPropertyDescriptor", - "es7.object.get-own-property-descriptors": "Object static methods / Object.getOwnPropertyDescriptors", - "es6.object.get-own-property-names": "Object static methods accept primitives / Object.getOwnPropertyNames", - "es6.object.get-prototype-of": "Object static methods accept primitives / Object.getPrototypeOf", + "es6.object.freeze": + "Object static methods accept primitives / Object.freeze", + "es6.object.get-own-property-descriptor": + "Object static methods accept primitives / Object.getOwnPropertyDescriptor", + "es7.object.get-own-property-descriptors": + "Object static methods / Object.getOwnPropertyDescriptors", + "es6.object.get-own-property-names": + "Object static methods accept primitives / Object.getOwnPropertyNames", + "es6.object.get-prototype-of": + "Object static methods accept primitives / Object.getPrototypeOf", "es7.object.lookup-getter": { features: [ "Object.prototype getter/setter methods / __lookupGetter__", @@ -175,15 +207,20 @@ const es = { "Object.prototype getter/setter methods / __lookupSetter__, data properties can shadow accessors", ], }, - "es6.object.prevent-extensions": "Object static methods accept primitives / Object.preventExtensions", + "es6.object.prevent-extensions": + "Object static methods accept primitives / Object.preventExtensions", "es6.object.to-string": "well-known symbols / Symbol.toStringTag", "es6.object.is": "Object static methods / Object.is", - "es6.object.is-frozen": "Object static methods accept primitives / Object.isFrozen", - "es6.object.is-sealed": "Object static methods accept primitives / Object.isSealed", - "es6.object.is-extensible": "Object static methods accept primitives / Object.isExtensible", + "es6.object.is-frozen": + "Object static methods accept primitives / Object.isFrozen", + "es6.object.is-sealed": + "Object static methods accept primitives / Object.isSealed", + "es6.object.is-extensible": + "Object static methods accept primitives / Object.isExtensible", "es6.object.keys": "Object static methods accept primitives / Object.keys", "es6.object.seal": "Object static methods accept primitives / Object.seal", - "es6.object.set-prototype-of": "Object static methods / Object.setPrototypeOf", + "es6.object.set-prototype-of": + "Object static methods / Object.setPrototypeOf", "es7.object.values": "Object static methods / Object.values", "es6.promise": { @@ -200,7 +237,8 @@ const es = { "es6.reflect.define-property": "Reflect / Reflect.defineProperty", "es6.reflect.delete-property": "Reflect / Reflect.deleteProperty", "es6.reflect.get": "Reflect / Reflect.get", - "es6.reflect.get-own-property-descriptor": "Reflect / Reflect.getOwnPropertyDescriptor", + "es6.reflect.get-own-property-descriptor": + "Reflect / Reflect.getOwnPropertyDescriptor", "es6.reflect.get-prototype-of": "Reflect / Reflect.getPrototypeOf", "es6.reflect.has": "Reflect / Reflect.has", "es6.reflect.is-extensible": "Reflect / Reflect.isExtensible", @@ -216,11 +254,16 @@ const es = { ], }, "es6.regexp.flags": "RegExp.prototype properties / RegExp.prototype.flags", - "es6.regexp.match": "RegExp.prototype properties / RegExp.prototype[Symbol.match]", - "es6.regexp.replace": "RegExp.prototype properties / RegExp.prototype[Symbol.replace]", - "es6.regexp.split": "RegExp.prototype properties / RegExp.prototype[Symbol.split]", - "es6.regexp.search": "RegExp.prototype properties / RegExp.prototype[Symbol.search]", - "es6.regexp.to-string": "miscellaneous / RegExp.prototype.toString generic and uses \"flags\" property", + "es6.regexp.match": + "RegExp.prototype properties / RegExp.prototype[Symbol.match]", + "es6.regexp.replace": + "RegExp.prototype properties / RegExp.prototype[Symbol.replace]", + "es6.regexp.split": + "RegExp.prototype properties / RegExp.prototype[Symbol.split]", + "es6.regexp.search": + "RegExp.prototype properties / RegExp.prototype[Symbol.search]", + "es6.regexp.to-string": + 'miscellaneous / RegExp.prototype.toString generic and uses "flags" property', // This is explicit due to prevent the stage-1 Set proposals under the // category "Set methods" from being included. @@ -271,15 +314,18 @@ const es = { "es6.string.big": "String.prototype HTML methods", "es6.string.blink": "String.prototype HTML methods", "es6.string.bold": "String.prototype HTML methods", - "es6.string.code-point-at": "String.prototype methods / String.prototype.codePointAt", - "es6.string.ends-with": "String.prototype methods / String.prototype.endsWith", + "es6.string.code-point-at": + "String.prototype methods / String.prototype.codePointAt", + "es6.string.ends-with": + "String.prototype methods / String.prototype.endsWith", "es6.string.fixed": "String.prototype HTML methods", "es6.string.fontcolor": "String.prototype HTML methods", "es6.string.fontsize": "String.prototype HTML methods", "es6.string.from-code-point": "String static methods / String.fromCodePoint", "es6.string.includes": "String.prototype methods / String.prototype.includes", "es6.string.italics": "String.prototype HTML methods", - "es6.string.iterator": "String.prototype methods / String.prototype[Symbol.iterator]", + "es6.string.iterator": + "String.prototype methods / String.prototype[Symbol.iterator]", "es6.string.link": "String.prototype HTML methods", // "String.prototype methods / String.prototype.normalize" not implemented "es7.string.pad-start": "String padding / String.prototype.padStart", @@ -287,7 +333,8 @@ const es = { "es6.string.raw": "String static methods / String.raw", "es6.string.repeat": "String.prototype methods / String.prototype.repeat", "es6.string.small": "String.prototype HTML methods", - "es6.string.starts-with": "String.prototype methods / String.prototype.startsWith", + "es6.string.starts-with": + "String.prototype methods / String.prototype.startsWith", "es6.string.strike": "String.prototype HTML methods", "es6.string.sub": "String.prototype HTML methods", "es6.string.sup": "String.prototype HTML methods", @@ -329,7 +376,3 @@ const es = { "es6.weak-set": "WeakSet", }; - -const proposals = require("./shipped-proposals").builtIns; - -module.exports = Object.assign({}, es, proposals); diff --git a/packages/babel-compat-data/scripts/data/overlapping-plugins.js b/packages/babel-compat-data/scripts/data/overlapping-plugins.js new file mode 100644 index 000000000000..56cb8d896d6f --- /dev/null +++ b/packages/babel-compat-data/scripts/data/overlapping-plugins.js @@ -0,0 +1,16 @@ +"use strict"; + +module.exports = new Map(); + +// async -> regenerator is better than async -> generator -> regenerator +ifIncluded("transform-regenerator") + // Temporarly disabled: https://github.com/babel/babel/issues/10678 + // .isUnnecessary("transform-async-to-generator"); + +function ifIncluded(name) { + const set = new Set(); + module.exports.set(name, set); + return { + isUnnecessary(name) { set.add(name); return this; }, + }; +} diff --git a/packages/babel-preset-env/data/plugin-features.js b/packages/babel-compat-data/scripts/data/plugin-features.js similarity index 85% rename from packages/babel-preset-env/data/plugin-features.js rename to packages/babel-compat-data/scripts/data/plugin-features.js index 3a84be381683..e0f20c7d1acf 100644 --- a/packages/babel-preset-env/data/plugin-features.js +++ b/packages/babel-compat-data/scripts/data/plugin-features.js @@ -1,42 +1,36 @@ -const es = { - "transform-template-literals": { - features: ["template literals"], - }, - "transform-literals": { - features: ["Unicode code point escapes"], - }, - "transform-function-name": { - features: ['function "name" property'], - }, +/* eslint sort-keys: "error" */ + +module.exports = { + "proposal-async-generator-functions": "Asynchronous Iterators", + "proposal-json-strings": "JSON superset", + "proposal-nullish-coalescing-operator": "nullish coalescing operator (??)", + "proposal-object-rest-spread": "object rest/spread properties", + "proposal-optional-catch-binding": "optional catch binding", + "proposal-optional-chaining": "optional chaining operator (?.)", + "proposal-unicode-property-regex": "RegExp Unicode Property Escapes", + "transform-arrow-functions": { features: ["arrow functions"], }, + + "transform-async-to-generator": { + features: ["async functions"], + }, + "transform-block-scoped-functions": { features: ["block-level function declaration"], }, + "transform-block-scoping": { + features: ["const", "let"], + }, "transform-classes": { features: ["class", "super"], }, - "transform-object-super": { - features: ["super"], - }, - "transform-shorthand-properties": { - features: ["object literal extensions / shorthand properties"], - }, - "transform-duplicate-keys": { - features: ["miscellaneous / duplicate property names in strict mode"], - }, "transform-computed-properties": { features: ["object literal extensions / computed properties"], }, - "transform-for-of": { - features: ["for..of loops"], - }, - "transform-sticky-regex": { - features: [ - 'RegExp "y" and "u" flags / "y" flag, lastIndex', - 'RegExp "y" and "u" flags / "y" flag', - ], + "transform-destructuring": { + features: ["destructuring, assignment", "destructuring, declarations"], }, // We want to apply this prior to unicode regex so that "." and "u" @@ -45,17 +39,29 @@ const es = { // Ref: https://github.com/babel/babel/pull/7065#issuecomment-395959112 "transform-dotall-regex": "s (dotAll) flag for regular expressions", - "transform-unicode-regex": { - features: [ - 'RegExp "y" and "u" flags / "u" flag, case folding', - 'RegExp "y" and "u" flags / "u" flag, Unicode code point escapes', - 'RegExp "y" and "u" flags / "u" flag, non-BMP Unicode characters', - 'RegExp "y" and "u" flags / "u" flag', - ], + "transform-duplicate-keys": { + features: ["miscellaneous / duplicate property names in strict mode"], }, - - "transform-spread": { - features: "spread syntax for iterable objects", + "transform-exponentiation-operator": { + features: ["exponentiation (**) operator"], + }, + "transform-for-of": { + features: ["for..of loops"], + }, + "transform-function-name": { + features: ['function "name" property'], + }, + "transform-literals": { + features: ["Unicode code point escapes"], + }, + "transform-member-expression-literals": + "Object/array literal extensions / Reserved words as property names", + "transform-named-capturing-groups-regex": "RegExp named capture groups", + "transform-new-target": { + features: ["new.target"], + }, + "transform-object-super": { + features: ["super"], }, "transform-parameters": { features: [ @@ -64,45 +70,36 @@ const es = { "destructuring, parameters / defaults, arrow function", ], }, - "transform-destructuring": { + "transform-property-literals": + "Object/array literal extensions / Reserved words as property names", + "transform-regenerator": { + features: ["generators"], + }, + "transform-reserved-words": "Miscellaneous / Unreserved words", + "transform-shorthand-properties": { + features: ["object literal extensions / shorthand properties"], + }, + "transform-spread": { + features: "spread syntax for iterable objects", + }, + "transform-sticky-regex": { features: [ - "destructuring, assignment", - "destructuring, declarations", + 'RegExp "y" and "u" flags / "y" flag, lastIndex', + 'RegExp "y" and "u" flags / "y" flag', ], }, - "transform-block-scoping": { - features: ["const", "let"], + "transform-template-literals": { + features: ["template literals"], }, "transform-typeof-symbol": { features: ["Symbol / typeof support"], }, - "transform-new-target": { - features: ["new.target"], - }, - "transform-regenerator": { - features: ["generators"], - }, - - "transform-exponentiation-operator": { - features: ["exponentiation (**) operator"], - }, - - "transform-async-to-generator": { - features: ["async functions"], + "transform-unicode-regex": { + features: [ + 'RegExp "y" and "u" flags / "u" flag, case folding', + 'RegExp "y" and "u" flags / "u" flag, Unicode code point escapes', + 'RegExp "y" and "u" flags / "u" flag, non-BMP Unicode characters', + 'RegExp "y" and "u" flags / "u" flag', + ], }, - - "proposal-async-generator-functions": "Asynchronous Iterators", - "proposal-object-rest-spread": "object rest/spread properties", - "proposal-unicode-property-regex": "RegExp Unicode Property Escapes", - - "proposal-json-strings": "JSON superset", - "proposal-optional-catch-binding": "optional catch binding", - "transform-named-capturing-groups-regex": "RegExp named capture groups", - "transform-member-expression-literals": "Object/array literal extensions / Reserved words as property names", - "transform-property-literals": "Object/array literal extensions / Reserved words as property names", - "transform-reserved-words": "Miscellaneous / Unreserved words", }; - -const proposals = require("./shipped-proposals").features; - -module.exports = Object.assign({}, es, proposals); diff --git a/packages/babel-compat-data/scripts/download-compat-table.sh b/packages/babel-compat-data/scripts/download-compat-table.sh new file mode 100755 index 000000000000..fd67e9d6d3ff --- /dev/null +++ b/packages/babel-compat-data/scripts/download-compat-table.sh @@ -0,0 +1,8 @@ +#!/bin/bash +set -e + +COMPAT_TABLE_COMMIT=4195aca631ad904cb0efeb62a9c2d8c8511706f8 +rm -rf build/compat-table +mkdir -p build +git clone --branch=gh-pages --single-branch --shallow-since=2019-11-14 https://github.com/kangax/compat-table.git build/compat-table +cd build/compat-table && git checkout -qf $COMPAT_TABLE_COMMIT diff --git a/packages/babel-core/package.json b/packages/babel-core/package.json index 56efb4a95fc5..01c55c538843 100644 --- a/packages/babel-core/package.json +++ b/packages/babel-core/package.json @@ -1,6 +1,6 @@ { "name": "@babel/core", - "version": "7.5.5", + "version": "7.8.3", "description": "Babel compiler core.", "main": "lib/index.js", "author": "Sebastian McKenzie ", @@ -28,20 +28,27 @@ "engines": { "node": ">=6.9.0" }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/babel" + }, "browser": { "./lib/config/files/index.js": "./lib/config/files/index-browser.js", - "./lib/transform-file.js": "./lib/transform-file-browser.js" + "./lib/transform-file.js": "./lib/transform-file-browser.js", + "./src/config/files/index.js": "./src/config/files/index-browser.js", + "./src/transform-file.js": "./src/transform-file-browser.js" }, "dependencies": { - "@babel/code-frame": "^7.5.5", - "@babel/generator": "^7.5.5", - "@babel/helpers": "^7.5.5", - "@babel/parser": "^7.5.5", - "@babel/template": "^7.4.4", - "@babel/traverse": "^7.5.5", - "@babel/types": "^7.5.5", - "convert-source-map": "^1.1.0", + "@babel/code-frame": "^7.8.3", + "@babel/generator": "^7.8.3", + "@babel/helpers": "^7.8.3", + "@babel/parser": "^7.8.3", + "@babel/template": "^7.8.3", + "@babel/traverse": "^7.8.3", + "@babel/types": "^7.8.3", + "convert-source-map": "^1.7.0", "debug": "^4.1.0", + "gensync": "^1.0.0-beta.1", "json5": "^2.1.0", "lodash": "^4.17.13", "resolve": "^1.3.2", @@ -49,7 +56,6 @@ "source-map": "^0.5.0" }, "devDependencies": { - "@babel/helper-transform-fixture-test-runner": "^7.5.5", - "@babel/register": "^7.5.5" + "@babel/helper-transform-fixture-test-runner": "^7.8.3" } } diff --git a/packages/babel-core/src/config/caching.js b/packages/babel-core/src/config/caching.js index 5b915e7f7767..fcad6e8fccbe 100644 --- a/packages/babel-core/src/config/caching.js +++ b/packages/babel-core/src/config/caching.js @@ -1,5 +1,17 @@ // @flow +import gensync, { type Handler } from "gensync"; +import { + maybeAsync, + isAsync, + onFirstPause, + waitFor, + isThenable, +} from "../gensync-utils/async"; +import { isIterableIterator } from "./util"; + +export type { CacheConfigurator }; + export type SimpleCacheConfigurator = SimpleCacheConfiguratorFn & SimpleCacheConfiguratorObj; @@ -14,91 +26,223 @@ type SimpleCacheConfiguratorObj = { invalidate: (handler: () => T) => T, }; -type CacheEntry = Array<{ +export type CacheEntry = Array<{ value: ResultT, - valid: SideChannel => boolean, + valid: SideChannel => Handler, }>; -export type { CacheConfigurator }; +const synchronize = ( + gen: (...ArgsT) => Handler, + // $FlowIssue https://github.com/facebook/flow/issues/7279 +): ((...args: ArgsT) => ResultT) => { + return gensync(gen).sync; +}; -/** - * Given a function with a single argument, cache its results based on its argument and how it - * configures its caching behavior. Cached values are stored strongly. - */ -export function makeStrongCache( +// eslint-disable-next-line require-yield, no-unused-vars +function* genTrue(data: any) { + return true; +} + +export function makeWeakCache( + handler: (ArgT, CacheConfigurator) => Handler | ResultT, +): (ArgT, SideChannel) => Handler { + return makeCachedFunction(WeakMap, handler); +} + +export function makeWeakCacheSync( handler: (ArgT, CacheConfigurator) => ResultT, ): (ArgT, SideChannel) => ResultT { - return makeCachedFunction(new Map(), handler); + return synchronize<[ArgT, SideChannel], ResultT>( + makeWeakCache(handler), + ); } -/** - * Given a function with a single argument, cache its results based on its argument and how it - * configures its caching behavior. Cached values are stored weakly and the function argument must be - * an object type. - */ -export function makeWeakCache< - ArgT: {} | Array<*> | $ReadOnlyArray<*>, - ResultT, - SideChannel, ->( +export function makeStrongCache( + handler: (ArgT, CacheConfigurator) => Handler | ResultT, +): (ArgT, SideChannel) => Handler { + return makeCachedFunction(Map, handler); +} + +export function makeStrongCacheSync( handler: (ArgT, CacheConfigurator) => ResultT, ): (ArgT, SideChannel) => ResultT { - return makeCachedFunction(new WeakMap(), handler); + return synchronize<[ArgT, SideChannel], ResultT>( + makeStrongCache(handler), + ); +} + +/* NOTE: Part of the logic explained in this comment is explained in the + * getCachedValueOrWait and setupAsyncLocks functions. + * + * > There are only two hard things in Computer Science: cache invalidation and naming things. + * > -- Phil Karlton + * + * I don't know if Phil was also thinking about handling a cache whose invalidation function is + * defined asynchronously is considered, but it is REALLY hard to do correctly. + * + * The implemented logic (only when gensync is run asynchronously) is the following: + * 1. If there is a valid cache associated to the current "arg" parameter, + * a. RETURN the cached value + * 3. If there is a FinishLock associated to the current "arg" parameter representing a valid cache, + * a. Wait for that lock to be released + * b. RETURN the value associated with that lock + * 5. Start executing the function to be cached + * a. If it pauses on a promise, then + * i. Let FinishLock be a new lock + * ii. Store FinishLock as associated to the current "arg" parameter + * iii. Wait for the function to finish executing + * iv. Release FinishLock + * v. Send the function result to anyone waiting on FinishLock + * 6. Store the result in the cache + * 7. RETURN the result + */ +function makeCachedFunction( + CallCache: Class, + handler: (ArgT, CacheConfigurator) => Handler | ResultT, +): (ArgT, SideChannel) => Handler { + const callCacheSync = new CallCache(); + const callCacheAsync = new CallCache(); + const futureCache = new CallCache(); + + return function* cachedFunction(arg: ArgT, data: SideChannel) { + const asyncContext = yield* isAsync(); + const callCache = asyncContext ? callCacheAsync : callCacheSync; + + const cached = yield* getCachedValueOrWait( + asyncContext, + callCache, + futureCache, + arg, + data, + ); + if (cached.valid) return cached.value; + + const cache = new CacheConfigurator(data); + + const handlerResult = handler(arg, cache); + + let finishLock: ?Lock; + let value: ResultT; + + if (isIterableIterator(handlerResult)) { + // Flow refines handlerResult to Generator + const gen = (handlerResult: Generator<*, ResultT, *>); + + value = yield* onFirstPause(gen, () => { + finishLock = setupAsyncLocks(cache, futureCache, arg); + }); + } else { + // $FlowIgnore doesn't refine handlerResult to ResultT + value = (handlerResult: ResultT); + } + + updateFunctionCache(callCache, cache, arg, value); + + if (finishLock) { + futureCache.delete(arg); + finishLock.release(value); + } + + return value; + }; } type CacheMap = | Map> | WeakMap>; -function makeCachedFunction< +function* getCachedValue< ArgT, ResultT, SideChannel, // $FlowIssue https://github.com/facebook/flow/issues/4528 Cache: CacheMap, >( - callCache: Cache, - handler: (ArgT, CacheConfigurator) => ResultT, -): (ArgT, SideChannel) => ResultT { - return function cachedFunction(arg, data) { - let cachedValue: CacheEntry | void = callCache.get( - arg, - ); - - if (cachedValue) { - for (const { value, valid } of cachedValue) { - if (valid(data)) return value; - } + cache: Cache, + arg: ArgT, + data: SideChannel, +): Handler<{ valid: true, value: ResultT } | { valid: false, value: null }> { + const cachedValue: CacheEntry | void = cache.get(arg); + + if (cachedValue) { + for (const { value, valid } of cachedValue) { + if (yield* valid(data)) return { valid: true, value }; } + } - const cache = new CacheConfigurator(data); + return { valid: false, value: null }; +} + +function* getCachedValueOrWait( + asyncContext: boolean, + callCache: CacheMap, + futureCache: CacheMap, SideChannel>, + arg: ArgT, + data: SideChannel, +): Handler<{ valid: true, value: ResultT } | { valid: false, value: null }> { + const cached = yield* getCachedValue(callCache, arg, data); + if (cached.valid) { + return cached; + } - const value = handler(arg, cache); - - if (!cache.configured()) cache.forever(); - - cache.deactivate(); - - switch (cache.mode()) { - case "forever": - cachedValue = [{ value, valid: () => true }]; - callCache.set(arg, cachedValue); - break; - case "invalidate": - cachedValue = [{ value, valid: cache.validator() }]; - callCache.set(arg, cachedValue); - break; - case "valid": - if (cachedValue) { - cachedValue.push({ value, valid: cache.validator() }); - } else { - cachedValue = [{ value, valid: cache.validator() }]; - callCache.set(arg, cachedValue); - } + if (asyncContext) { + const cached = yield* getCachedValue(futureCache, arg, data); + if (cached.valid) { + const value = yield* waitFor(cached.value.promise); + return { valid: true, value }; } + } - return value; - }; + return { valid: false, value: null }; +} + +function setupAsyncLocks( + config: CacheConfigurator, + futureCache: CacheMap, SideChannel>, + arg: ArgT, +): Lock { + const finishLock = new Lock(); + + updateFunctionCache(futureCache, config, arg, finishLock); + + return finishLock; +} + +function updateFunctionCache< + ArgT, + ResultT, + SideChannel, + // $FlowIssue https://github.com/facebook/flow/issues/4528 + Cache: CacheMap, +>( + cache: Cache, + config: CacheConfigurator, + arg: ArgT, + value: ResultT, +) { + if (!config.configured()) config.forever(); + + let cachedValue: CacheEntry | void = cache.get(arg); + + config.deactivate(); + + switch (config.mode()) { + case "forever": + cachedValue = [{ value, valid: genTrue }]; + cache.set(arg, cachedValue); + break; + case "invalidate": + cachedValue = [{ value, valid: config.validator() }]; + cache.set(arg, cachedValue); + break; + case "valid": + if (cachedValue) { + cachedValue.push({ value, valid: config.validator() }); + } else { + cachedValue = [{ value, valid: config.validator() }]; + cache.set(arg, cachedValue); + } + } } class CacheConfigurator { @@ -109,7 +253,7 @@ class CacheConfigurator { _configured: boolean = false; - _pairs: Array<[mixed, (SideChannel) => mixed]> = []; + _pairs: Array<[mixed, (SideChannel) => Handler]> = []; _data: SideChannel; @@ -162,30 +306,36 @@ class CacheConfigurator { this._configured = true; const key = handler(this._data); - this._pairs.push([key, handler]); + + const fn = maybeAsync( + handler, + `You appear to be using an async cache handler, but Babel has been called synchronously`, + ); + + if (isThenable(key)) { + return key.then(key => { + this._pairs.push([key, fn]); + return key; + }); + } + + this._pairs.push([key, fn]); return key; } invalidate(handler: SideChannel => T): T { - if (!this._active) { - throw new Error("Cannot change caching after evaluation has completed."); - } - if (this._never || this._forever) { - throw new Error( - "Caching has already been configured with .never or .forever()", - ); - } this._invalidate = true; - this._configured = true; - - const key = handler(this._data); - this._pairs.push([key, handler]); - return key; + return this.using(handler); } - validator(): SideChannel => boolean { + validator(): SideChannel => Handler { const pairs = this._pairs; - return (data: SideChannel) => pairs.every(([key, fn]) => key === fn(data)); + return function*(data: SideChannel) { + for (const [key, fn] of pairs) { + if (key !== (yield* fn(data))) return false; + } + return true; + }; } deactivate() { @@ -219,8 +369,18 @@ function makeSimpleConfigurator( // Types are limited here so that in the future these values can be used // as part of Babel's caching logic. -type SimpleType = string | boolean | number | null | void; +type SimpleType = string | boolean | number | null | void | Promise; export function assertSimpleType(value: mixed): SimpleType { + if (isThenable(value)) { + throw new Error( + `You appear to be using an async cache handler, ` + + `which your current version of Babel does not support. ` + + `We may add support for this in the future, ` + + `but if you're on the most recent version of @babel/core and still ` + + `seeing this error, then you'll need to synchronously handle your caching logic.`, + ); + } + if ( value != null && typeof value !== "string" && @@ -233,3 +393,20 @@ export function assertSimpleType(value: mixed): SimpleType { } return value; } + +class Lock { + released: boolean = false; + promise: Promise; + _resolve: (value: T) => void; + + constructor() { + this.promise = new Promise(resolve => { + this._resolve = resolve; + }); + } + + release(value: T) { + this.released = true; + this._resolve(value); + } +} diff --git a/packages/babel-core/src/config/config-chain.js b/packages/babel-core/src/config/config-chain.js index 3bbedcdff1a9..1af3f35d2371 100644 --- a/packages/babel-core/src/config/config-chain.js +++ b/packages/babel-core/src/config/config-chain.js @@ -2,6 +2,7 @@ import path from "path"; import buildDebug from "debug"; +import type { Handler } from "gensync"; import { validate, type ValidatedOptions, @@ -24,7 +25,7 @@ import { type FilePackageData, } from "./files"; -import { makeWeakCache, makeStrongCache } from "./caching"; +import { makeWeakCacheSync, makeStrongCacheSync } from "./caching"; import { createCachedDescriptors, @@ -57,11 +58,11 @@ export type ConfigContext = { /** * Build a config chain for a given preset. */ -export function buildPresetChain( +export function* buildPresetChain( arg: PresetInstance, context: *, -): ConfigChain | null { - const chain = buildPresetChainWalker(arg, context); +): Handler { + const chain = yield* buildPresetChainWalker(arg, context); if (!chain) return null; return { @@ -82,11 +83,11 @@ export const buildPresetChainWalker: ( overridesEnv: (preset, index, envName) => loadPresetOverridesEnvDescriptors(preset)(index)(envName), }); -const loadPresetDescriptors = makeWeakCache((preset: PresetInstance) => +const loadPresetDescriptors = makeWeakCacheSync((preset: PresetInstance) => buildRootDescriptors(preset, preset.alias, createUncachedDescriptors), ); -const loadPresetEnvDescriptors = makeWeakCache((preset: PresetInstance) => - makeStrongCache((envName: string) => +const loadPresetEnvDescriptors = makeWeakCacheSync((preset: PresetInstance) => + makeStrongCacheSync((envName: string) => buildEnvDescriptors( preset, preset.alias, @@ -95,20 +96,21 @@ const loadPresetEnvDescriptors = makeWeakCache((preset: PresetInstance) => ), ), ); -const loadPresetOverridesDescriptors = makeWeakCache((preset: PresetInstance) => - makeStrongCache((index: number) => - buildOverrideDescriptors( - preset, - preset.alias, - createUncachedDescriptors, - index, +const loadPresetOverridesDescriptors = makeWeakCacheSync( + (preset: PresetInstance) => + makeStrongCacheSync((index: number) => + buildOverrideDescriptors( + preset, + preset.alias, + createUncachedDescriptors, + index, + ), ), - ), ); -const loadPresetOverridesEnvDescriptors = makeWeakCache( +const loadPresetOverridesEnvDescriptors = makeWeakCacheSync( (preset: PresetInstance) => - makeStrongCache((index: number) => - makeStrongCache((envName: string) => + makeStrongCacheSync((index: number) => + makeStrongCacheSync((envName: string) => buildOverrideEnvDescriptors( preset, preset.alias, @@ -129,11 +131,11 @@ export type RootConfigChain = ConfigChain & { /** * Build a config chain for Babel's full root configuration. */ -export function buildRootChain( +export function* buildRootChain( opts: ValidatedOptions, context: ConfigContext, -): RootConfigChain | null { - const programmaticChain = loadProgrammaticChain( +): Handler { + const programmaticChain = yield* loadProgrammaticChain( { options: opts, dirname: context.cwd, @@ -144,14 +146,18 @@ export function buildRootChain( let configFile; if (typeof opts.configFile === "string") { - configFile = loadConfig( + configFile = yield* loadConfig( opts.configFile, context.cwd, context.envName, context.caller, ); } else if (opts.configFile !== false) { - configFile = findRootConfig(context.root, context.envName, context.caller); + configFile = yield* findRootConfig( + context.root, + context.envName, + context.caller, + ); } let { babelrc, babelrcRoots } = opts; @@ -160,7 +166,7 @@ export function buildRootChain( const configFileChain = emptyChain(); if (configFile) { const validatedFile = validateConfigFile(configFile); - const result = loadFileChain(validatedFile, context); + const result = yield* loadFileChain(validatedFile, context); if (!result) return null; // Allow config files to toggle `.babelrc` resolution on and off and @@ -178,7 +184,7 @@ export function buildRootChain( const pkgData = typeof context.filename === "string" - ? findPackageData(context.filename) + ? yield* findPackageData(context.filename) : null; let ignoreFile, babelrcFile; @@ -189,7 +195,7 @@ export function buildRootChain( pkgData && babelrcLoadEnabled(context, pkgData, babelrcRoots, babelrcRootsDirectory) ) { - ({ ignore: ignoreFile, config: babelrcFile } = findRelativeConfig( + ({ ignore: ignoreFile, config: babelrcFile } = yield* findRelativeConfig( pkgData, context.envName, context.caller, @@ -203,7 +209,10 @@ export function buildRootChain( } if (babelrcFile) { - const result = loadFileChain(validateBabelrcFile(babelrcFile), context); + const result = yield* loadFileChain( + validateBabelrcFile(babelrcFile), + context, + ); if (!result) return null; mergeChain(fileChain, result); @@ -268,7 +277,7 @@ function babelrcLoadEnabled( }); } -const validateConfigFile = makeWeakCache( +const validateConfigFile = makeWeakCacheSync( (file: ConfigFile): ValidatedFile => ({ filepath: file.filepath, dirname: file.dirname, @@ -276,7 +285,7 @@ const validateConfigFile = makeWeakCache( }), ); -const validateBabelrcFile = makeWeakCache( +const validateBabelrcFile = makeWeakCacheSync( (file: ConfigFile): ValidatedFile => ({ filepath: file.filepath, dirname: file.dirname, @@ -284,7 +293,7 @@ const validateBabelrcFile = makeWeakCache( }), ); -const validateExtendFile = makeWeakCache( +const validateExtendFile = makeWeakCacheSync( (file: ConfigFile): ValidatedFile => ({ filepath: file.filepath, dirname: file.dirname, @@ -321,11 +330,11 @@ const loadFileChain = makeChainWalker({ overridesEnv: (file, index, envName) => loadFileOverridesEnvDescriptors(file)(index)(envName), }); -const loadFileDescriptors = makeWeakCache((file: ValidatedFile) => +const loadFileDescriptors = makeWeakCacheSync((file: ValidatedFile) => buildRootDescriptors(file, file.filepath, createUncachedDescriptors), ); -const loadFileEnvDescriptors = makeWeakCache((file: ValidatedFile) => - makeStrongCache((envName: string) => +const loadFileEnvDescriptors = makeWeakCacheSync((file: ValidatedFile) => + makeStrongCacheSync((envName: string) => buildEnvDescriptors( file, file.filepath, @@ -334,8 +343,8 @@ const loadFileEnvDescriptors = makeWeakCache((file: ValidatedFile) => ), ), ); -const loadFileOverridesDescriptors = makeWeakCache((file: ValidatedFile) => - makeStrongCache((index: number) => +const loadFileOverridesDescriptors = makeWeakCacheSync((file: ValidatedFile) => + makeStrongCacheSync((index: number) => buildOverrideDescriptors( file, file.filepath, @@ -344,18 +353,19 @@ const loadFileOverridesDescriptors = makeWeakCache((file: ValidatedFile) => ), ), ); -const loadFileOverridesEnvDescriptors = makeWeakCache((file: ValidatedFile) => - makeStrongCache((index: number) => - makeStrongCache((envName: string) => - buildOverrideEnvDescriptors( - file, - file.filepath, - createUncachedDescriptors, - index, - envName, +const loadFileOverridesEnvDescriptors = makeWeakCacheSync( + (file: ValidatedFile) => + makeStrongCacheSync((index: number) => + makeStrongCacheSync((envName: string) => + buildOverrideEnvDescriptors( + file, + file.filepath, + createUncachedDescriptors, + index, + envName, + ), ), ), - ), ); function buildRootDescriptors({ dirname, options }, alias, descriptors) { @@ -414,8 +424,12 @@ function makeChainWalker({ env: (ArgT, string) => OptionsAndDescriptors | null, overrides: (ArgT, number) => OptionsAndDescriptors, overridesEnv: (ArgT, number, string) => OptionsAndDescriptors | null, -}): (ArgT, ConfigContext, Set | void) => ConfigChain | null { - return (input, context, files = new Set()) => { +}): ( + ArgT, + ConfigContext, + Set | void, +) => Handler { + return function*(input, context, files = new Set()) { const { dirname } = input; const flattenedConfigs = []; @@ -459,7 +473,9 @@ function makeChainWalker({ const chain = emptyChain(); for (const op of flattenedConfigs) { - if (!mergeExtendsChain(chain, op.options, dirname, context, files)) { + if ( + !(yield* mergeExtendsChain(chain, op.options, dirname, context, files)) + ) { return null; } @@ -469,16 +485,16 @@ function makeChainWalker({ }; } -function mergeExtendsChain( +function* mergeExtendsChain( chain: ConfigChain, opts: ValidatedOptions, dirname: string, context: ConfigContext, files: Set, -): boolean { +): Handler { if (opts.extends === undefined) return true; - const file = loadConfig( + const file = yield* loadConfig( opts.extends, dirname, context.envName, @@ -494,7 +510,11 @@ function mergeExtendsChain( } files.add(file); - const fileChain = loadFileChain(validateExtendFile(file), context, files); + const fileChain = yield* loadFileChain( + validateExtendFile(file), + context, + files, + ); files.delete(file); if (!fileChain) return false; @@ -549,7 +569,7 @@ function normalizeOptions(opts: ValidatedOptions): ValidatedOptions { // "sourceMap" is just aliased to sourceMap, so copy it over as // we merge the options together. - if (options.hasOwnProperty("sourceMap")) { + if (Object.prototype.hasOwnProperty.call(options, "sourceMap")) { options.sourceMaps = options.sourceMap; delete options.sourceMap; } diff --git a/packages/babel-core/src/config/config-descriptors.js b/packages/babel-core/src/config/config-descriptors.js index e17cca93c680..fa60d47d7139 100644 --- a/packages/babel-core/src/config/config-descriptors.js +++ b/packages/babel-core/src/config/config-descriptors.js @@ -5,8 +5,8 @@ import { loadPlugin, loadPreset } from "./files"; import { getItemDescriptor } from "./item"; import { - makeWeakCache, - makeStrongCache, + makeWeakCacheSync, + makeStrongCacheSync, type CacheConfigurator, } from "./caching"; @@ -130,11 +130,11 @@ export function createUncachedDescriptors( } const PRESET_DESCRIPTOR_CACHE = new WeakMap(); -const createCachedPresetDescriptors = makeWeakCache( +const createCachedPresetDescriptors = makeWeakCacheSync( (items: PluginList, cache: CacheConfigurator) => { const dirname = cache.using(dir => dir); - return makeStrongCache((alias: string) => - makeStrongCache((passPerPreset: boolean) => + return makeStrongCacheSync((alias: string) => + makeStrongCacheSync((passPerPreset: boolean) => createPresetDescriptors(items, dirname, alias, passPerPreset).map( // Items are cached using the overall preset array identity when // possibly, but individual descriptors are also cached if a match @@ -147,10 +147,10 @@ const createCachedPresetDescriptors = makeWeakCache( ); const PLUGIN_DESCRIPTOR_CACHE = new WeakMap(); -const createCachedPluginDescriptors = makeWeakCache( +const createCachedPluginDescriptors = makeWeakCacheSync( (items: PluginList, cache: CacheConfigurator) => { const dirname = cache.using(dir => dir); - return makeStrongCache((alias: string) => + return makeStrongCacheSync((alias: string) => createPluginDescriptors(items, dirname, alias).map( // Items are cached using the overall plugin array identity when // possibly, but individual descriptors are also cached if a match @@ -345,6 +345,7 @@ function assertNoDuplicates(items: Array): void { } if (nameMap.has(item.name)) { + const conflicts = items.filter(i => i.value === item.value); throw new Error( [ `Duplicate plugin/preset detected.`, @@ -355,6 +356,9 @@ function assertNoDuplicates(items: Array): void { ` ['some-plugin', {}],`, ` ['some-plugin', {}, 'some unique name'],`, ` ]`, + ``, + `Duplicates detected are:`, + `${JSON.stringify(conflicts, null, 2)}`, ].join("\n"), ); } diff --git a/packages/babel-core/src/config/files/configuration.js b/packages/babel-core/src/config/files/configuration.js index ab3353f6fde3..611cd49223e2 100644 --- a/packages/babel-core/src/config/files/configuration.js +++ b/packages/babel-core/src/config/files/configuration.js @@ -2,33 +2,48 @@ import buildDebug from "debug"; import path from "path"; -import fs from "fs"; import json5 from "json5"; -import resolve from "resolve"; +import gensync, { type Handler } from "gensync"; import { makeStrongCache, - makeWeakCache, + makeWeakCacheSync, type CacheConfigurator, } from "../caching"; import makeAPI, { type PluginAPI } from "../helpers/config-api"; import { makeStaticFileCache } from "./utils"; +import loadCjsOrMjsDefault from "./module-types"; import pathPatternToRegex from "../pattern-to-regex"; import type { FilePackageData, RelativeConfig, ConfigFile } from "./types"; import type { CallerMetadata } from "../validation/options"; +import * as fs from "../../gensync-utils/fs"; +import resolve from "../../gensync-utils/resolve"; + const debug = buildDebug("babel:config:loading:files:configuration"); -const BABEL_CONFIG_JS_FILENAME = "babel.config.js"; +export const ROOT_CONFIG_FILENAMES = [ + "babel.config.js", + "babel.config.cjs", + "babel.config.mjs", + "babel.config.json", +]; +const RELATIVE_CONFIG_FILENAMES = [ + ".babelrc", + ".babelrc.js", + ".babelrc.cjs", + ".babelrc.mjs", + ".babelrc.json", +]; -const BABELRC_FILENAME = ".babelrc"; -const BABELRC_JS_FILENAME = ".babelrc.js"; const BABELIGNORE_FILENAME = ".babelignore"; -export function findConfigUpwards(rootDir: string): string | null { +export function* findConfigUpwards(rootDir: string): Handler { let dirname = rootDir; while (true) { - if (fs.existsSync(path.join(dirname, BABEL_CONFIG_JS_FILENAME))) { - return dirname; + for (const filename of ROOT_CONFIG_FILENAMES) { + if (yield* fs.exists(path.join(dirname, filename))) { + return dirname; + } } const nextDir = path.dirname(dirname); @@ -39,11 +54,11 @@ export function findConfigUpwards(rootDir: string): string | null { return null; } -export function findRelativeConfig( +export function* findRelativeConfig( packageData: FilePackageData, envName: string, caller: CallerMetadata | void, -): RelativeConfig { +): Handler { let config = null; let ignore = null; @@ -51,50 +66,20 @@ export function findRelativeConfig( for (const loc of packageData.directories) { if (!config) { - config = [BABELRC_FILENAME, BABELRC_JS_FILENAME].reduce( - (previousConfig: ConfigFile | null, name) => { - const filepath = path.join(loc, name); - const config = readConfig(filepath, envName, caller); - - if (config && previousConfig) { - throw new Error( - `Multiple configuration files found. Please remove one:\n` + - ` - ${path.basename(previousConfig.filepath)}\n` + - ` - ${name}\n` + - `from ${loc}`, - ); - } - - return config || previousConfig; - }, - null, - ); - - const pkgConfig = + config = yield* loadOneConfig( + RELATIVE_CONFIG_FILENAMES, + loc, + envName, + caller, packageData.pkg && packageData.pkg.dirname === loc ? packageToBabelConfig(packageData.pkg) - : null; - - if (pkgConfig) { - if (config) { - throw new Error( - `Multiple configuration files found. Please remove one:\n` + - ` - ${path.basename(pkgConfig.filepath)}#babel\n` + - ` - ${path.basename(config.filepath)}\n` + - `from ${loc}`, - ); - } - config = pkgConfig; - } - - if (config) { - debug("Found configuration %o from %o.", config.filepath, dirname); - } + : null, + ); } if (!ignore) { const ignoreLoc = path.join(loc, BABELIGNORE_FILENAME); - ignore = readIgnoreConfig(ignoreLoc); + ignore = yield* readIgnoreConfig(ignoreLoc); if (ignore) { debug("Found ignore %o from %o.", ignore.filepath, dirname); @@ -109,25 +94,50 @@ export function findRootConfig( dirname: string, envName: string, caller: CallerMetadata | void, -): ConfigFile | null { - const filepath = path.resolve(dirname, BABEL_CONFIG_JS_FILENAME); +): Handler { + return loadOneConfig(ROOT_CONFIG_FILENAMES, dirname, envName, caller); +} - const conf = readConfig(filepath, envName, caller); - if (conf) { - debug("Found root config %o in %o.", BABEL_CONFIG_JS_FILENAME, dirname); +function* loadOneConfig( + names: string[], + dirname: string, + envName: string, + caller: CallerMetadata | void, + previousConfig?: ConfigFile | null = null, +): Handler { + const configs = yield* gensync.all( + names.map(filename => + readConfig(path.join(dirname, filename), envName, caller), + ), + ); + const config = configs.reduce((previousConfig: ConfigFile | null, config) => { + if (config && previousConfig) { + throw new Error( + `Multiple configuration files found. Please remove one:\n` + + ` - ${path.basename(previousConfig.filepath)}\n` + + ` - ${config.filepath}\n` + + `from ${dirname}`, + ); + } + + return config || previousConfig; + }, previousConfig); + + if (config) { + debug("Found configuration %o from %o.", config.filepath, dirname); } - return conf; + return config; } -export function loadConfig( +export function* loadConfig( name: string, dirname: string, envName: string, caller: CallerMetadata | void, -): ConfigFile { - const filepath = resolve.sync(name, { basedir: dirname }); +): Handler { + const filepath = yield* resolve(name, { basedir: dirname }); - const conf = readConfig(filepath, envName, caller); + const conf = yield* readConfig(filepath, envName, caller); if (!conf) { throw new Error(`Config file ${filepath} contains no configuration data`); } @@ -140,89 +150,90 @@ export function loadConfig( * Read the given config file, returning the result. Returns null if no config was found, but will * throw if there are parsing errors while loading a config. */ -function readConfig(filepath, envName, caller): ConfigFile | null { - return path.extname(filepath) === ".js" +function readConfig(filepath, envName, caller) { + const ext = path.extname(filepath); + return ext === ".js" || ext === ".cjs" || ext === ".mjs" ? readConfigJS(filepath, { envName, caller }) : readConfigJSON5(filepath); } const LOADING_CONFIGS = new Set(); -const readConfigJS = makeStrongCache( - ( - filepath: string, - cache: CacheConfigurator<{ - envName: string, - caller: CallerMetadata | void, - }>, - ) => { - if (!fs.existsSync(filepath)) { - cache.forever(); - return null; - } +const readConfigJS = makeStrongCache(function* readConfigJS( + filepath: string, + cache: CacheConfigurator<{ + envName: string, + caller: CallerMetadata | void, + }>, +): Handler { + if (!fs.exists.sync(filepath)) { + cache.forever(); + return null; + } - // The `require()` call below can make this code reentrant if a require hook like @babel/register has been - // loaded into the system. That would cause Babel to attempt to compile the `.babelrc.js` file as it loads - // below. To cover this case, we auto-ignore re-entrant config processing. - if (LOADING_CONFIGS.has(filepath)) { - cache.never(); - - debug("Auto-ignoring usage of config %o.", filepath); - return { - filepath, - dirname: path.dirname(filepath), - options: {}, - }; - } + // The `require()` call below can make this code reentrant if a require hook like @babel/register has been + // loaded into the system. That would cause Babel to attempt to compile the `.babelrc.js` file as it loads + // below. To cover this case, we auto-ignore re-entrant config processing. + if (LOADING_CONFIGS.has(filepath)) { + cache.never(); - let options; - try { - LOADING_CONFIGS.add(filepath); - - // $FlowIssue - const configModule = (require(filepath): mixed); - options = - configModule && configModule.__esModule - ? configModule.default || undefined - : configModule; - } catch (err) { - err.message = `${filepath}: Error while loading config - ${err.message}`; - throw err; - } finally { - LOADING_CONFIGS.delete(filepath); - } + debug("Auto-ignoring usage of config %o.", filepath); + return { + filepath, + dirname: path.dirname(filepath), + options: {}, + }; + } - if (typeof options === "function") { - options = ((options: any): (api: PluginAPI) => {})(makeAPI(cache)); + let options: mixed; + try { + LOADING_CONFIGS.add(filepath); + options = (yield* loadCjsOrMjsDefault( + filepath, + "You appear to be using a native ECMAScript module configuration " + + "file, which is only supported when running Babel asynchronously.", + ): mixed); + } catch (err) { + err.message = `${filepath}: Error while loading config - ${err.message}`; + throw err; + } finally { + LOADING_CONFIGS.delete(filepath); + } - if (!cache.configured()) throwConfigError(); - } + let assertCache = false; + if (typeof options === "function") { + yield* []; // if we want to make it possible to use async configs + options = ((options: any): (api: PluginAPI) => {})(makeAPI(cache)); - if (!options || typeof options !== "object" || Array.isArray(options)) { - throw new Error( - `${filepath}: Configuration should be an exported JavaScript object.`, - ); - } + assertCache = true; + } - if (typeof options.then === "function") { - throw new Error( - `You appear to be using an async configuration, ` + - `which your current version of Babel does not support. ` + - `We may add support for this in the future, ` + - `but if you're on the most recent version of @babel/core and still ` + - `seeing this error, then you'll need to synchronously return your config.`, - ); - } + if (!options || typeof options !== "object" || Array.isArray(options)) { + throw new Error( + `${filepath}: Configuration should be an exported JavaScript object.`, + ); + } - return { - filepath, - dirname: path.dirname(filepath), - options, - }; - }, -); + if (typeof options.then === "function") { + throw new Error( + `You appear to be using an async configuration, ` + + `which your current version of Babel does not support. ` + + `We may add support for this in the future, ` + + `but if you're on the most recent version of @babel/core and still ` + + `seeing this error, then you'll need to synchronously return your config.`, + ); + } + + if (assertCache && !cache.configured()) throwConfigError(); + + return { + filepath, + dirname: path.dirname(filepath), + options, + }; +}); -const packageToBabelConfig = makeWeakCache( +const packageToBabelConfig = makeWeakCacheSync( (file: ConfigFile): ConfigFile | null => { const babel = file.options[("babel": string)]; diff --git a/packages/babel-core/src/config/files/import.js b/packages/babel-core/src/config/files/import.js new file mode 100644 index 000000000000..e16bc29752a9 --- /dev/null +++ b/packages/babel-core/src/config/files/import.js @@ -0,0 +1,7 @@ +// We keep this in a seprate file so that in older node versions, where +// import() isn't supported, we can try/catch around the require() call +// when loading this file. + +export default function import_(filepath: string) { + return import(filepath); +} diff --git a/packages/babel-core/src/config/files/index-browser.js b/packages/babel-core/src/config/files/index-browser.js index 1d2adccaa811..8e3a8cf26ce2 100644 --- a/packages/babel-core/src/config/files/index-browser.js +++ b/packages/babel-core/src/config/files/index-browser.js @@ -1,5 +1,7 @@ // @flow +import type { Handler } from "gensync"; + import type { ConfigFile, IgnoreFile, @@ -11,13 +13,15 @@ import type { CallerMetadata } from "../validation/options"; export type { ConfigFile, IgnoreFile, RelativeConfig, FilePackageData }; -export function findConfigUpwards( +// eslint-disable-next-line require-yield +export function* findConfigUpwards( rootDir: string, // eslint-disable-line no-unused-vars -): string | null { +): Handler { return null; } -export function findPackageData(filepath: string): FilePackageData { +// eslint-disable-next-line require-yield +export function* findPackageData(filepath: string): Handler { return { filepath, directories: [], @@ -26,31 +30,36 @@ export function findPackageData(filepath: string): FilePackageData { }; } -export function findRelativeConfig( +// eslint-disable-next-line require-yield +export function* findRelativeConfig( pkgData: FilePackageData, // eslint-disable-line no-unused-vars envName: string, // eslint-disable-line no-unused-vars caller: CallerMetadata | void, // eslint-disable-line no-unused-vars -): RelativeConfig { +): Handler { return { pkg: null, config: null, ignore: null }; } -export function findRootConfig( +// eslint-disable-next-line require-yield +export function* findRootConfig( dirname: string, // eslint-disable-line no-unused-vars envName: string, // eslint-disable-line no-unused-vars caller: CallerMetadata | void, // eslint-disable-line no-unused-vars -): ConfigFile | null { +): Handler { return null; } -export function loadConfig( +// eslint-disable-next-line require-yield +export function* loadConfig( name: string, dirname: string, envName: string, // eslint-disable-line no-unused-vars caller: CallerMetadata | void, // eslint-disable-line no-unused-vars -): ConfigFile { +): Handler { throw new Error(`Cannot load ${name} relative to ${dirname} in a browser`); } +export const ROOT_CONFIG_FILENAMES = []; + // eslint-disable-next-line no-unused-vars export function resolvePlugin(name: string, dirname: string): string | null { return null; diff --git a/packages/babel-core/src/config/files/index.js b/packages/babel-core/src/config/files/index.js index 3c74f2d4eebb..464ef66253f4 100644 --- a/packages/babel-core/src/config/files/index.js +++ b/packages/babel-core/src/config/files/index.js @@ -14,6 +14,7 @@ export { findRelativeConfig, findRootConfig, loadConfig, + ROOT_CONFIG_FILENAMES, } from "./configuration"; export type { ConfigFile, diff --git a/packages/babel-core/src/config/files/module-types.js b/packages/babel-core/src/config/files/module-types.js new file mode 100644 index 000000000000..f90fb40b516d --- /dev/null +++ b/packages/babel-core/src/config/files/module-types.js @@ -0,0 +1,59 @@ +import { isAsync, waitFor } from "../../gensync-utils/async"; +import type { Handler } from "gensync"; +import path from "path"; + +let import_; +try { + // Node < 13.3 doesn't support import() syntax. + import_ = require("./import").default; +} catch {} + +export default function* loadCjsOrMjsDefault( + filepath: string, + asyncError: string, +): Handler { + switch (guessJSModuleType(filepath)) { + case "cjs": + return loadCjsDefault(filepath); + case "unknown": + try { + return loadCjsDefault(filepath); + } catch (e) { + if (e.code !== "ERR_REQUIRE_ESM") throw e; + } + case "mjs": + if (yield* isAsync()) { + return yield* waitFor(loadMjsDefault(filepath)); + } + throw new Error(asyncError); + } +} + +function guessJSModuleType(filename: string): "cjs" | "mjs" | "unknown" { + switch (path.extname(filename)) { + case ".cjs": + return "cjs"; + case ".mjs": + return "mjs"; + default: + return "unknown"; + } +} + +function loadCjsDefault(filepath: string) { + const module = (require(filepath): mixed); + // TODO (Babel 8): Remove "undefined" fallback + return module?.__esModule ? module.default || undefined : module; +} + +async function loadMjsDefault(filepath: string) { + if (!import_) { + throw new Error( + "Internal error: Native ECMAScript modules aren't supported" + + " by this platform.\n", + ); + } + + const module = await import_(filepath); + return module.default; +} diff --git a/packages/babel-core/src/config/files/package.js b/packages/babel-core/src/config/files/package.js index 8e370a472d56..278ddfb852f5 100644 --- a/packages/babel-core/src/config/files/package.js +++ b/packages/babel-core/src/config/files/package.js @@ -1,6 +1,7 @@ // @flow import path from "path"; +import type { Handler } from "gensync"; import { makeStaticFileCache } from "./utils"; import type { ConfigFile, FilePackageData } from "./types"; @@ -12,7 +13,7 @@ const PACKAGE_FILENAME = "package.json"; * of Babel's config requires general package information to decide when to * search for .babelrc files */ -export function findPackageData(filepath: string): FilePackageData { +export function* findPackageData(filepath: string): Handler { let pkg = null; const directories = []; let isPackage = true; @@ -21,7 +22,7 @@ export function findPackageData(filepath: string): FilePackageData { while (!pkg && path.basename(dirname) !== "node_modules") { directories.push(dirname); - pkg = readConfigPackage(path.join(dirname, PACKAGE_FILENAME)); + pkg = yield* readConfigPackage(path.join(dirname, PACKAGE_FILENAME)); const nextLoc = path.dirname(dirname); if (dirname === nextLoc) { diff --git a/packages/babel-core/src/config/files/utils.js b/packages/babel-core/src/config/files/utils.js index db202259d5e8..61c3b24a7a4a 100644 --- a/packages/babel-core/src/config/files/utils.js +++ b/packages/babel-core/src/config/files/utils.js @@ -1,24 +1,32 @@ // @flow -import fs from "fs"; -import { makeStrongCache } from "../caching"; +import type { Gensync, Handler } from "gensync"; + +import { makeStrongCache, type CacheConfigurator } from "../caching"; +import * as fs from "../../gensync-utils/fs"; +import nodeFs from "fs"; export function makeStaticFileCache( fn: (string, string) => T, -): string => T | null { - return makeStrongCache((filepath, cache) => { - if (cache.invalidate(() => fileMtime(filepath)) === null) { +): Gensync<[string], T | null> { + return (makeStrongCache(function*( + filepath: string, + cache: CacheConfigurator, + ): Handler { + const cached = cache.invalidate(() => fileMtime(filepath)); + + if (cached === null) { cache.forever(); return null; } - return fn(filepath, fs.readFileSync(filepath, "utf8")); - }); + return fn(filepath, yield* fs.readFile(filepath, "utf8")); + }): Gensync); } function fileMtime(filepath: string): number | null { try { - return +fs.statSync(filepath).mtime; + return +nodeFs.statSync(filepath).mtime; } catch (e) { if (e.code !== "ENOENT" && e.code !== "ENOTDIR") throw e; } diff --git a/packages/babel-core/src/config/full.js b/packages/babel-core/src/config/full.js index 88c65ff882be..ab24a1936b87 100644 --- a/packages/babel-core/src/config/full.js +++ b/packages/babel-core/src/config/full.js @@ -1,5 +1,8 @@ // @flow +import gensync, { type Handler } from "gensync"; +import { forwardAsync } from "../gensync-utils/async"; + import { mergeOptions } from "./util"; import * as context from "../index"; import Plugin from "./plugin"; @@ -12,12 +15,17 @@ import { } from "./config-chain"; import type { UnloadedDescriptor } from "./config-descriptors"; import traverse from "@babel/traverse"; -import { makeWeakCache, type CacheConfigurator } from "./caching"; +import { + makeWeakCache, + makeWeakCacheSync, + type CacheConfigurator, +} from "./caching"; import { validate, type CallerMetadata } from "./validation/options"; import { validatePluginObject } from "./validation/plugins"; import makeAPI from "./helpers/config-api"; import loadPrivatePartialConfig from "./partial"; +import type { ValidatedOptions } from "./validation/options"; type LoadedDescriptor = { value: {}, @@ -44,10 +52,10 @@ type SimpleContext = { caller: CallerMetadata | void, }; -export default function loadFullConfig( +export default gensync<[any], ResolvedConfig | null>(function* loadFullConfig( inputOpts: mixed, -): ResolvedConfig | null { - const result = loadPrivatePartialConfig(inputOpts); +): Handler { + const result = yield* loadPrivatePartialConfig(inputOpts); if (!result) { return null; } @@ -62,28 +70,29 @@ export default function loadFullConfig( throw new Error("Assertion failure - plugins and presets exist"); } - const ignored = (function recurseDescriptors( + const ignored = yield* (function* recurseDescriptors( config: { plugins: Array, presets: Array, }, pass: Array, ) { - const plugins = config.plugins.reduce((acc, descriptor) => { + const plugins = []; + for (const descriptor of config.plugins) { if (descriptor.options !== false) { - acc.push(loadPluginDescriptor(descriptor, context)); + plugins.push(yield* loadPluginDescriptor(descriptor, context)); } - return acc; - }, []); - const presets = config.presets.reduce((acc, descriptor) => { + } + + const presets = []; + for (const descriptor of config.presets) { if (descriptor.options !== false) { - acc.push({ - preset: loadPresetDescriptor(descriptor, context), + presets.push({ + preset: yield* loadPresetDescriptor(descriptor, context), pass: descriptor.ownPass ? [] : pass, }); } - return acc; - }, []); + } // resolve presets if (presets.length > 0) { @@ -98,7 +107,7 @@ export default function loadFullConfig( for (const { preset, pass } of presets) { if (!preset) return true; - const ignored = recurseDescriptors( + const ignored = yield* recurseDescriptors( { plugins: preset.plugins, presets: preset.presets, @@ -164,61 +173,61 @@ export default function loadFullConfig( options: opts, passes: passes, }; -} +}); /** * Load a generic plugin/preset from the given descriptor loaded from the config object. */ -const loadDescriptor = makeWeakCache( - ( - { value, options, dirname, alias }: UnloadedDescriptor, - cache: CacheConfigurator, - ): LoadedDescriptor => { - // Disabled presets should already have been filtered out - if (options === false) throw new Error("Assertion failure"); - - options = options || {}; - - let item = value; - if (typeof value === "function") { - const api = { - ...context, - ...makeAPI(cache), - }; - try { - item = value(api, options, dirname); - } catch (e) { - if (alias) { - e.message += ` (While processing: ${JSON.stringify(alias)})`; - } - throw e; +const loadDescriptor = makeWeakCache(function*( + { value, options, dirname, alias }: UnloadedDescriptor, + cache: CacheConfigurator, +): Handler { + // Disabled presets should already have been filtered out + if (options === false) throw new Error("Assertion failure"); + + options = options || {}; + + let item = value; + if (typeof value === "function") { + const api = { + ...context, + ...makeAPI(cache), + }; + try { + item = value(api, options, dirname); + } catch (e) { + if (alias) { + e.message += ` (While processing: ${JSON.stringify(alias)})`; } + throw e; } + } - if (!item || typeof item !== "object") { - throw new Error("Plugin/Preset did not return an object."); - } + if (!item || typeof item !== "object") { + throw new Error("Plugin/Preset did not return an object."); + } - if (typeof item.then === "function") { - throw new Error( - `You appear to be using an async plugin, ` + - `which your current version of Babel does not support. ` + - `If you're using a published plugin, ` + - `you may need to upgrade your @babel/core version.`, - ); - } + if (typeof item.then === "function") { + yield* []; // if we want to support async plugins - return { value: item, options, dirname, alias }; - }, -); + throw new Error( + `You appear to be using an async plugin, ` + + `which your current version of Babel does not support. ` + + `If you're using a published plugin, ` + + `you may need to upgrade your @babel/core version.`, + ); + } + + return { value: item, options, dirname, alias }; +}); /** * Instantiate a plugin for the given descriptor, returning the plugin/options pair. */ -function loadPluginDescriptor( +function* loadPluginDescriptor( descriptor: UnloadedDescriptor, context: SimpleContext, -): Plugin { +): Handler { if (descriptor.value instanceof Plugin) { if (descriptor.options) { throw new Error( @@ -229,69 +238,105 @@ function loadPluginDescriptor( return descriptor.value; } - return instantiatePlugin(loadDescriptor(descriptor, context), context); + return yield* instantiatePlugin( + yield* loadDescriptor(descriptor, context), + context, + ); } -const instantiatePlugin = makeWeakCache( - ( - { value, options, dirname, alias }: LoadedDescriptor, - cache: CacheConfigurator, - ): Plugin => { - const pluginObj = validatePluginObject(value); +const instantiatePlugin = makeWeakCache(function*( + { value, options, dirname, alias }: LoadedDescriptor, + cache: CacheConfigurator, +): Handler { + const pluginObj = validatePluginObject(value); - const plugin = { - ...pluginObj, - }; - if (plugin.visitor) { - plugin.visitor = traverse.explode({ - ...plugin.visitor, - }); - } + const plugin = { + ...pluginObj, + }; + if (plugin.visitor) { + plugin.visitor = traverse.explode({ + ...plugin.visitor, + }); + } - if (plugin.inherits) { - const inheritsDescriptor = { - name: undefined, - alias: `${alias}$inherits`, - value: plugin.inherits, - options, - dirname, - }; + if (plugin.inherits) { + const inheritsDescriptor = { + name: undefined, + alias: `${alias}$inherits`, + value: plugin.inherits, + options, + dirname, + }; + const inherits = yield* forwardAsync(loadPluginDescriptor, run => { // If the inherited plugin changes, reinstantiate this plugin. - const inherits = cache.invalidate(data => - loadPluginDescriptor(inheritsDescriptor, data), - ); + return cache.invalidate(data => run(inheritsDescriptor, data)); + }); + + plugin.pre = chain(inherits.pre, plugin.pre); + plugin.post = chain(inherits.post, plugin.post); + plugin.manipulateOptions = chain( + inherits.manipulateOptions, + plugin.manipulateOptions, + ); + plugin.visitor = traverse.visitors.merge([ + inherits.visitor || {}, + plugin.visitor || {}, + ]); + } + + return new Plugin(plugin, options, alias); +}); + +const validateIfOptionNeedsFilename = ( + options: ValidatedOptions, + descriptor: UnloadedDescriptor, +): void => { + if (options.test || options.include || options.exclude) { + const formattedPresetName = descriptor.name + ? `"${descriptor.name}"` + : "/* your preset */"; + throw new Error( + [ + `Preset ${formattedPresetName} requires a filename to be set when babel is called directly,`, + `\`\`\``, + `babel.transform(code, { filename: 'file.ts', presets: [${formattedPresetName}] });`, + `\`\`\``, + `See https://babeljs.io/docs/en/options#filename for more information.`, + ].join("\n"), + ); + } +}; - plugin.pre = chain(inherits.pre, plugin.pre); - plugin.post = chain(inherits.post, plugin.post); - plugin.manipulateOptions = chain( - inherits.manipulateOptions, - plugin.manipulateOptions, +const validatePreset = ( + preset: PresetInstance, + context: ConfigContext, + descriptor: UnloadedDescriptor, +): void => { + if (!context.filename) { + const { options } = preset; + validateIfOptionNeedsFilename(options, descriptor); + if (options.overrides) { + options.overrides.forEach(overrideOptions => + validateIfOptionNeedsFilename(overrideOptions, descriptor), ); - plugin.visitor = traverse.visitors.merge([ - inherits.visitor || {}, - plugin.visitor || {}, - ]); } - - return new Plugin(plugin, options, alias); - }, -); + } +}; /** * Generate a config object that will act as the root of a new nested config. */ -const loadPresetDescriptor = ( +function* loadPresetDescriptor( descriptor: UnloadedDescriptor, context: ConfigContext, -): ConfigChain | null => { - return buildPresetChain( - instantiatePreset(loadDescriptor(descriptor, context)), - context, - ); -}; +): Handler { + const preset = instantiatePreset(yield* loadDescriptor(descriptor, context)); + validatePreset(preset, context, descriptor); + return yield* buildPresetChain(preset, context); +} -const instantiatePreset = makeWeakCache( +const instantiatePreset = makeWeakCacheSync( ({ value, dirname, alias }: LoadedDescriptor): PresetInstance => { return { options: validate("preset", value), diff --git a/packages/babel-core/src/config/index.js b/packages/babel-core/src/config/index.js index 51016d34c757..11888a48ec7c 100644 --- a/packages/babel-core/src/config/index.js +++ b/packages/babel-core/src/config/index.js @@ -1,6 +1,7 @@ // @flow -import loadFullConfig from "./full"; +import gensync from "gensync"; + export type { ResolvedConfig, InputOptions, @@ -8,12 +9,29 @@ export type { Plugin, } from "./full"; +import loadFullConfig from "./full"; +import { loadPartialConfig as loadPartialConfigRunner } from "./partial"; + export { loadFullConfig as default }; -export { loadPartialConfig } from "./partial"; export type { PartialConfig } from "./partial"; -export function loadOptions(opts: {}): Object | null { - const config = loadFullConfig(opts); - +const loadOptionsRunner = gensync<[mixed], Object | null>(function*(opts) { + const config = yield* loadFullConfig(opts); return config ? config.options : null; -} +}); + +const maybeErrback = runner => (opts: mixed, callback: Function) => { + if (callback === undefined && typeof opts === "function") { + callback = opts; + opts = undefined; + } + return callback ? runner.errback(opts, callback) : runner.sync(opts); +}; + +export const loadPartialConfig = maybeErrback(loadPartialConfigRunner); +export const loadPartialConfigSync = loadPartialConfigRunner.sync; +export const loadPartialConfigAsync = loadPartialConfigRunner.async; + +export const loadOptions = maybeErrback(loadOptionsRunner); +export const loadOptionsSync = loadOptionsRunner.sync; +export const loadOptionsAsync = loadOptionsRunner.async; diff --git a/packages/babel-core/src/config/partial.js b/packages/babel-core/src/config/partial.js index 9f5f85ed4edc..615f3dc08b73 100644 --- a/packages/babel-core/src/config/partial.js +++ b/packages/babel-core/src/config/partial.js @@ -1,6 +1,7 @@ // @flow import path from "path"; +import gensync, { type Handler } from "gensync"; import Plugin from "./plugin"; import { mergeOptions } from "./util"; import { createItemFromDescriptor } from "./item"; @@ -12,26 +13,36 @@ import { type RootMode, } from "./validation/options"; -import { findConfigUpwards, type ConfigFile, type IgnoreFile } from "./files"; - -function resolveRootMode(rootDir: string, rootMode: RootMode): string { +import { + findConfigUpwards, + ROOT_CONFIG_FILENAMES, + type ConfigFile, + type IgnoreFile, +} from "./files"; + +function* resolveRootMode( + rootDir: string, + rootMode: RootMode, +): Handler { switch (rootMode) { case "root": return rootDir; case "upward-optional": { - const upwardRootDir = findConfigUpwards(rootDir); + const upwardRootDir = yield* findConfigUpwards(rootDir); return upwardRootDir === null ? rootDir : upwardRootDir; } case "upward": { - const upwardRootDir = findConfigUpwards(rootDir); + const upwardRootDir = yield* findConfigUpwards(rootDir); if (upwardRootDir !== null) return upwardRootDir; throw Object.assign( (new Error( `Babel was run with rootMode:"upward" but a root could not ` + - `be found when searching upward from "${rootDir}"`, + `be found when searching upward from "${rootDir}".\n` + + `One of the following config files must be in the directory tree: ` + + `"${ROOT_CONFIG_FILENAMES.join(", ")}".`, ): any), { code: "BABEL_ROOT_NOT_FOUND", @@ -40,19 +51,21 @@ function resolveRootMode(rootDir: string, rootMode: RootMode): string { ); } default: - throw new Error(`Assertion failure - unknown rootMode value`); + throw new Error(`Assertion failure - unknown rootMode value.`); } } -export default function loadPrivatePartialConfig( - inputOpts: mixed, -): { +type PrivPartialConfig = { options: ValidatedOptions, context: ConfigContext, ignore: IgnoreFile | void, babelrc: ConfigFile | void, config: ConfigFile | void, -} | null { +}; + +export default function* loadPrivatePartialConfig( + inputOpts: mixed, +): Handler { if ( inputOpts != null && (typeof inputOpts !== "object" || Array.isArray(inputOpts)) @@ -70,7 +83,7 @@ export default function loadPrivatePartialConfig( caller, } = args; const absoluteCwd = path.resolve(cwd); - const absoluteRootDir = resolveRootMode( + const absoluteRootDir = yield* resolveRootMode( path.resolve(absoluteCwd, rootDir), rootMode, ); @@ -86,7 +99,7 @@ export default function loadPrivatePartialConfig( caller, }; - const configChain = buildRootChain(args, context); + const configChain = yield* buildRootChain(args, context); if (!configChain) return null; const options = {}; @@ -122,8 +135,10 @@ export default function loadPrivatePartialConfig( }; } -export function loadPartialConfig(inputOpts: mixed): PartialConfig | null { - const result = loadPrivatePartialConfig(inputOpts); +export const loadPartialConfig = gensync<[any], PartialConfig | null>(function*( + inputOpts: mixed, +): Handler { + const result: ?PrivPartialConfig = yield* loadPrivatePartialConfig(inputOpts); if (!result) return null; const { options, babelrc, ignore, config } = result; @@ -143,7 +158,7 @@ export function loadPartialConfig(inputOpts: mixed): PartialConfig | null { ignore ? ignore.filepath : undefined, config ? config.filepath : undefined, ); -} +}); export type { PartialConfig }; diff --git a/packages/babel-core/src/config/util.js b/packages/babel-core/src/config/util.js index f64975216db3..b9d3af143dd3 100644 --- a/packages/babel-core/src/config/util.js +++ b/packages/babel-core/src/config/util.js @@ -28,3 +28,14 @@ function mergeDefaultFields(target: T, source: T) { if (val !== undefined) target[k] = (val: any); } } + +export function isIterableIterator(value: mixed): boolean %checks { + return ( + /*:: value instanceof Generator && */ + // /*:: "@@iterator" in value && */ + !!value && + typeof value.next === "function" && + // $FlowIgnore + typeof value[Symbol.iterator] === "function" + ); +} diff --git a/packages/babel-core/src/config/validation/option-assertions.js b/packages/babel-core/src/config/validation/option-assertions.js index 87244b4f16b3..a279a72781a0 100644 --- a/packages/babel-core/src/config/validation/option-assertions.js +++ b/packages/babel-core/src/config/validation/option-assertions.js @@ -278,7 +278,7 @@ export function assertConfigFileSearch( ) { throw new Error( `${msg(loc)} must be a undefined, a boolean, a string, ` + - `got ${JSON.stringify(value)}`, + `got ${JSON.stringify((value: any))}`, ); } @@ -302,7 +302,7 @@ export function assertBabelrcSearch( } else if (!checkValidTest(value)) { throw new Error( `${msg(loc)} must be a undefined, a boolean, a string/Function/RegExp ` + - `or an array of those, got ${JSON.stringify(value)}`, + `or an array of those, got ${JSON.stringify((value: any))}`, ); } return (value: any); diff --git a/packages/babel-core/src/config/validation/options.js b/packages/babel-core/src/config/validation/options.js index 3ee072ae344f..02c51649a4cb 100644 --- a/packages/babel-core/src/config/validation/options.js +++ b/packages/babel-core/src/config/validation/options.js @@ -272,7 +272,8 @@ export type OptionsSource = | "configfile" | "babelrcfile" | "extendsfile" - | "preset"; + | "preset" + | "plugin"; type RootPath = $ReadOnly<{ type: "root", diff --git a/packages/babel-core/src/config/validation/plugins.js b/packages/babel-core/src/config/validation/plugins.js index 7800de965e31..ea1fc514306d 100644 --- a/packages/babel-core/src/config/validation/plugins.js +++ b/packages/babel-core/src/config/validation/plugins.js @@ -84,10 +84,19 @@ export type PluginObject = { }; export function validatePluginObject(obj: {}): PluginObject { + const rootPath: RootPath = { + type: "root", + source: "plugin", + }; Object.keys(obj).forEach(key => { const validator = VALIDATORS[key]; + const optLoc = { + type: "option", + name: key, + parent: rootPath, + }; - if (validator) validator(key, obj[key]); + if (validator) validator(optLoc, obj[key]); else throw new Error(`.${key} is not a valid Plugin property`); }); diff --git a/packages/babel-core/src/gensync-utils/async.js b/packages/babel-core/src/gensync-utils/async.js new file mode 100644 index 000000000000..84edcc394135 --- /dev/null +++ b/packages/babel-core/src/gensync-utils/async.js @@ -0,0 +1,110 @@ +// @flow + +import gensync, { type Gensync, type Handler } from "gensync"; + +type MaybePromise = T | Promise; + +const id = x => x; + +const runGenerator = gensync(function*(item) { + return yield* item; +}); + +// This Gensync returns true if the current execution contect is +// asynchronous, otherwise it returns false. +export const isAsync = gensync<[], boolean>({ + sync: () => false, + errback: cb => cb(null, true), +}); + +// This function wraps any functions (which could be either synchronous or +// asynchronous) with a Gensync. If the wrapped function returns a promise +// but the current execution context is synchronous, it will throw the +// provided error. +// This is used to handle user-provided functions which could be asynchronous. +export function maybeAsync( + fn: (...args: Args) => T, + message: string, +): Gensync { + return gensync({ + sync(...args) { + const result = fn.apply(this, args); + if (isThenable(result)) throw new Error(message); + return result; + }, + async(...args) { + return Promise.resolve(fn.apply(this, args)); + }, + }); +} + +const withKind = (gensync<[any], any>({ + sync: cb => cb("sync"), + async: cb => cb("async"), +}): (cb: (kind: "sync" | "async") => MaybePromise) => Handler); + +// This function wraps a generator (or a Gensync) into another function which, +// when called, will run the provided generator in a sync or async way, depending +// on the execution context where this forwardAsync function is called. +// This is useful, for example, when passing a callback to a function which isn't +// aware of gensync, but it only knows about synchronous and asynchronous functions. +// An example is cache.using, which being exposed to the user must be as simple as +// possible: +// yield* forwardAsync(gensyncFn, wrappedFn => +// cache.using(x => { +// // Here we don't know about gensync. wrappedFn is a +// // normal sync or async function +// return wrappedFn(x); +// }) +// ) +export function forwardAsync( + action: (...args: ActionArgs) => Handler, + cb: ( + adapted: (...args: ActionArgs) => MaybePromise, + ) => MaybePromise, +): Handler { + const g = gensync(action); + return withKind(kind => { + const adapted = g[kind]; + return cb(adapted); + }); +} + +// If the given generator is executed asynchronously, the first time that it +// is paused (i.e. When it yields a gensync generator which can't be run +// synchronously), call the "firstPause" callback. +export const onFirstPause = (gensync<[any, any], any>({ + name: "onFirstPause", + arity: 2, + sync: function(item) { + return runGenerator.sync(item); + }, + errback: function(item, firstPause, cb) { + let completed = false; + + runGenerator.errback(item, (err, value) => { + completed = true; + cb(err, value); + }); + + if (!completed) { + firstPause(); + } + }, +}): (gen: Generator<*, T, *>, cb: Function) => Handler); + +// Wait for the given promise to be resolved +export const waitFor = (gensync<[any], any>({ + sync: id, + async: id, +}): (p: T | Promise) => Handler); + +export function isThenable(val: mixed): boolean %checks { + return ( + /*:: val instanceof Promise && */ + !!val && + (typeof val === "object" || typeof val === "function") && + !!val.then && + typeof val.then === "function" + ); +} diff --git a/packages/babel-core/src/gensync-utils/fs.js b/packages/babel-core/src/gensync-utils/fs.js new file mode 100644 index 000000000000..6b8f60c7b145 --- /dev/null +++ b/packages/babel-core/src/gensync-utils/fs.js @@ -0,0 +1,21 @@ +// @flow + +import fs from "fs"; +import gensync from "gensync"; + +export const readFile = gensync<[string, "utf8"], string>({ + sync: fs.readFileSync, + errback: fs.readFile, +}); + +export const exists = gensync<[string], boolean>({ + sync(path) { + try { + fs.accessSync(path); + return true; + } catch { + return false; + } + }, + errback: (path, cb) => fs.access(path, undefined, err => cb(null, !err)), +}); diff --git a/packages/babel-core/src/gensync-utils/resolve.js b/packages/babel-core/src/gensync-utils/resolve.js new file mode 100644 index 000000000000..d16f6e7c4b2c --- /dev/null +++ b/packages/babel-core/src/gensync-utils/resolve.js @@ -0,0 +1,9 @@ +// @flow + +import resolve from "resolve"; +import gensync from "gensync"; + +export default gensync<[string, {| basedir: string |}], string>({ + sync: resolve.sync, + errback: resolve, +}); diff --git a/packages/babel-core/src/index.js b/packages/babel-core/src/index.js index e7ae7c0edfc6..23d023b5cabd 100644 --- a/packages/babel-core/src/index.js +++ b/packages/babel-core/src/index.js @@ -1,9 +1,7 @@ // @flow export { default as File } from "./transformation/file/file"; -export { - default as buildExternalHelpers, -} from "./tools/build-external-helpers"; +export { default as buildExternalHelpers } from "./tools/build-external-helpers"; export { resolvePlugin, resolvePreset } from "./config/files"; export { version } from "../package.json"; @@ -17,7 +15,14 @@ export { default as template } from "@babel/template"; export { createConfigItem } from "./config/item"; -export { loadPartialConfig, loadOptions } from "./config"; +export { + loadPartialConfig, + loadPartialConfigSync, + loadPartialConfigAsync, + loadOptions, + loadOptionsSync, + loadOptionsAsync, +} from "./config"; export { transform, transformSync, transformAsync } from "./transform"; export { diff --git a/packages/babel-core/src/parse.js b/packages/babel-core/src/parse.js index b3397a1a2e23..3609df763530 100644 --- a/packages/babel-core/src/parse.js +++ b/packages/babel-core/src/parse.js @@ -1,14 +1,13 @@ // @flow +import gensync from "gensync"; + import loadConfig, { type InputOptions } from "./config"; -import normalizeFile from "./transformation/normalize-file"; +import parser from "./parser"; +import type { ParseResult } from "./parser"; import normalizeOptions from "./transformation/normalize-opts"; -type AstRoot = BabelNodeFile | BabelNodeProgram; - -export type ParseResult = AstRoot; - -export type FileParseCallback = { +type FileParseCallback = { (Error, null): any, (null, ParseResult | null): any, }; @@ -22,6 +21,18 @@ type Parse = { (code: string, opts: ?InputOptions): ParseResult | null, }; +const parseRunner = gensync<[string, ?InputOptions], ParseResult | null>( + function* parse(code, opts) { + const config = yield* loadConfig(opts); + + if (config === null) { + return null; + } + + return yield* parser(config.passes, normalizeOptions(config), code); + }, +); + export const parse: Parse = (function parse(code, opts, callback) { if (typeof opts === "function") { callback = opts; @@ -30,55 +41,10 @@ export const parse: Parse = (function parse(code, opts, callback) { // For backward-compat with Babel 7's early betas, we allow sync parsing when // no callback is given. Will be dropped in some future Babel major version. - if (callback === undefined) return parseSync(code, opts); - - const config = loadConfig(opts); - - if (config === null) { - return null; - } - - // Reassign to keep Flowtype happy. - const cb = callback; - - // Just delaying the transform one tick for now to simulate async behavior - // but more async logic may land here eventually. - process.nextTick(() => { - let ast = null; - try { - const cfg = loadConfig(opts); - if (cfg === null) return cb(null, null); - - ast = normalizeFile(cfg.passes, normalizeOptions(cfg), code).ast; - } catch (err) { - return cb(err); - } + if (callback === undefined) return parseRunner.sync(code, opts); - cb(null, ast); - }); + parseRunner.errback(code, opts, callback); }: Function); -export function parseSync( - code: string, - opts?: InputOptions, -): ParseResult | null { - const config = loadConfig(opts); - - if (config === null) { - return null; - } - - return normalizeFile(config.passes, normalizeOptions(config), code).ast; -} - -export function parseAsync( - code: string, - opts?: InputOptions, -): Promise { - return new Promise((res, rej) => { - parse(code, opts, (err, result) => { - if (err == null) res(result); - else rej(err); - }); - }); -} +export const parseSync = parseRunner.sync; +export const parseAsync = parseRunner.async; diff --git a/packages/babel-core/src/parser/index.js b/packages/babel-core/src/parser/index.js new file mode 100644 index 000000000000..3ddf5ca4b64d --- /dev/null +++ b/packages/babel-core/src/parser/index.js @@ -0,0 +1,76 @@ +import type { Handler } from "gensync"; +import { parse } from "@babel/parser"; +import { codeFrameColumns } from "@babel/code-frame"; +import generateMissingPluginMessage from "./util/missing-plugin-helper"; + +type AstRoot = BabelNodeFile | BabelNodeProgram; + +export type ParseResult = AstRoot; + +export default function* parser( + pluginPasses: PluginPasses, + { parserOpts, highlightCode = true, filename = "unknown" }: Object, + code: string, +): Handler { + try { + const results = []; + for (const plugins of pluginPasses) { + for (const plugin of plugins) { + const { parserOverride } = plugin; + if (parserOverride) { + const ast = parserOverride(code, parserOpts, parse); + + if (ast !== undefined) results.push(ast); + } + } + } + + if (results.length === 0) { + return parse(code, parserOpts); + } else if (results.length === 1) { + yield* []; // If we want to allow async parsers + if (typeof results[0].then === "function") { + throw new Error( + `You appear to be using an async parser plugin, ` + + `which your current version of Babel does not support. ` + + `If you're using a published plugin, you may need to upgrade ` + + `your @babel/core version.`, + ); + } + return results[0]; + } + throw new Error("More than one plugin attempted to override parsing."); + } catch (err) { + if (err.code === "BABEL_PARSER_SOURCETYPE_MODULE_REQUIRED") { + err.message += + "\nConsider renaming the file to '.mjs', or setting sourceType:module " + + "or sourceType:unambiguous in your Babel config for this file."; + // err.code will be changed to BABEL_PARSE_ERROR later. + } + + const { loc, missingPlugin } = err; + if (loc) { + const codeFrame = codeFrameColumns( + code, + { + start: { + line: loc.line, + column: loc.column + 1, + }, + }, + { + highlightCode, + }, + ); + if (missingPlugin) { + err.message = + `${filename}: ` + + generateMissingPluginMessage(missingPlugin[0], loc, codeFrame); + } else { + err.message = `${filename}: ${err.message}\n\n` + codeFrame; + } + err.code = "BABEL_PARSE_ERROR"; + } + throw err; + } +} diff --git a/packages/babel-core/src/transformation/util/missing-plugin-helper.js b/packages/babel-core/src/parser/util/missing-plugin-helper.js similarity index 100% rename from packages/babel-core/src/transformation/util/missing-plugin-helper.js rename to packages/babel-core/src/parser/util/missing-plugin-helper.js index b0642c50c3cf..2560f3ea94bc 100644 --- a/packages/babel-core/src/transformation/util/missing-plugin-helper.js +++ b/packages/babel-core/src/parser/util/missing-plugin-helper.js @@ -113,16 +113,6 @@ const pluginNameMap = { url: "https://git.io/vAlRe", }, }, - nullishCoalescingOperator: { - syntax: { - name: "@babel/plugin-syntax-nullish-coalescing-operator", - url: "https://git.io/vb4yx", - }, - transform: { - name: "@babel/plugin-proposal-nullish-coalescing-operator", - url: "https://git.io/vb4Se", - }, - }, numericSeparator: { syntax: { name: "@babel/plugin-syntax-numeric-separator", @@ -188,6 +178,16 @@ const pluginNameMap = { url: "https://git.io/vb4yp", }, }, + nullishCoalescingOperator: { + syntax: { + name: "@babel/plugin-syntax-nullish-coalescing-operator", + url: "https://git.io/vb4yx", + }, + transform: { + name: "@babel/plugin-proposal-nullish-coalescing-operator", + url: "https://git.io/vb4Se", + }, + }, objectRestSpread: { syntax: { name: "@babel/plugin-syntax-object-rest-spread", diff --git a/packages/babel-core/src/transform-ast.js b/packages/babel-core/src/transform-ast.js index 101177dcece9..9a40bda90d3a 100644 --- a/packages/babel-core/src/transform-ast.js +++ b/packages/babel-core/src/transform-ast.js @@ -1,9 +1,10 @@ // @flow -import loadConfig, { type InputOptions } from "./config"; +import gensync from "gensync"; + +import loadConfig, { type InputOptions, type ResolvedConfig } from "./config"; import { - runSync, - runAsync, + run, type FileResult, type FileResultCallback, } from "./transformation"; @@ -24,6 +25,18 @@ type TransformFromAst = { (ast: AstRoot, code: string, opts: ?InputOptions): FileResult | null, }; +const transformFromAstRunner = gensync< + [AstRoot, string, ?InputOptions], + FileResult | null, +>(function*(ast, code, opts) { + const config: ResolvedConfig | null = yield* loadConfig(opts); + if (config === null) return null; + + if (!ast) throw new Error("No AST given"); + + return yield* run(config, code, ast); +}); + export const transformFromAst: TransformFromAst = (function transformFromAst( ast, code, @@ -37,50 +50,12 @@ export const transformFromAst: TransformFromAst = (function transformFromAst( // For backward-compat with Babel 6, we allow sync transformation when // no callback is given. Will be dropped in some future Babel major version. - if (callback === undefined) return transformFromAstSync(ast, code, opts); - - // Reassign to keep Flowtype happy. - const cb = callback; - - // Just delaying the transform one tick for now to simulate async behavior - // but more async logic may land here eventually. - process.nextTick(() => { - let cfg; - try { - cfg = loadConfig(opts); - if (cfg === null) return cb(null, null); - } catch (err) { - return cb(err); - } - - if (!ast) return cb(new Error("No AST given")); + if (callback === undefined) { + return transformFromAstRunner.sync(ast, code, opts); + } - runAsync(cfg, code, ast, cb); - }); + transformFromAstRunner.errback(ast, code, opts, callback); }: Function); -export function transformFromAstSync( - ast: AstRoot, - code: string, - opts: ?InputOptions, -): FileResult | null { - const config = loadConfig(opts); - if (config === null) return null; - - if (!ast) throw new Error("No AST given"); - - return runSync(config, code, ast); -} - -export function transformFromAstAsync( - ast: AstRoot, - code: string, - opts: ?InputOptions, -): Promise { - return new Promise((res, rej) => { - transformFromAst(ast, code, opts, (err, result) => { - if (err == null) res(result); - else rej(err); - }); - }); -} +export const transformFromAstSync = transformFromAstRunner.sync; +export const transformFromAstAsync = transformFromAstRunner.async; diff --git a/packages/babel-core/src/transform-file.js b/packages/babel-core/src/transform-file.js index d3c9ab640fc3..9d2c3e6ae406 100644 --- a/packages/babel-core/src/transform-file.js +++ b/packages/babel-core/src/transform-file.js @@ -1,13 +1,14 @@ // @flow -import fs from "fs"; -import loadConfig, { type InputOptions } from "./config"; +import gensync from "gensync"; + +import loadConfig, { type InputOptions, type ResolvedConfig } from "./config"; import { - runSync, - runAsync, + run, type FileResult, type FileResultCallback, } from "./transformation"; +import * as fs from "./gensync-utils/fs"; import typeof * as transformFileBrowserType from "./transform-file-browser"; import typeof * as transformFileType from "./transform-file"; @@ -22,74 +23,26 @@ type TransformFile = { (filename: string, opts: ?InputOptions, callback: FileResultCallback): void, }; -export const transformFile: TransformFile = (function transformFile( - filename, - opts, - callback, -) { - let options; - if (typeof opts === "function") { - callback = opts; - opts = undefined; - } - - if (opts == null) { - options = { filename }; - } else if (opts && typeof opts === "object") { - options = { - ...opts, - filename, - }; - } - - process.nextTick(() => { - let cfg; - try { - cfg = loadConfig(options); - if (cfg === null) return callback(null, null); - } catch (err) { - return callback(err); +const transformFileRunner = gensync<[string, ?InputOptions], FileResult | null>( + function*(filename, opts) { + let options; + if (opts == null) { + options = { filename }; + } else if (opts && typeof opts === "object") { + options = { + ...opts, + filename, + }; } - // Reassignment to keep Flow happy. - const config = cfg; - - fs.readFile(filename, "utf8", function(err, code: string) { - if (err) return callback(err, null); - - runAsync(config, code, null, callback); - }); - }); -}: Function); - -export function transformFileSync( - filename: string, - opts: ?InputOptions, -): FileResult | null { - let options; - if (opts == null) { - options = { filename }; - } else if (opts && typeof opts === "object") { - options = { - ...opts, - filename, - }; - } - - const config = loadConfig(options); - if (config === null) return null; + const config: ResolvedConfig | null = yield* loadConfig(options); + if (config === null) return null; - return runSync(config, fs.readFileSync(filename, "utf8")); -} + const code = yield* fs.readFile(filename, "utf8"); + return yield* run(config, code); + }, +); -export function transformFileAsync( - filename: string, - opts: ?InputOptions, -): Promise { - return new Promise((res, rej) => { - transformFile(filename, opts, (err, result) => { - if (err == null) res(result); - else rej(err); - }); - }); -} +export const transformFile: TransformFile = transformFileRunner.errback; +export const transformFileSync = transformFileRunner.sync; +export const transformFileAsync = transformFileRunner.async; diff --git a/packages/babel-core/src/transform.js b/packages/babel-core/src/transform.js index 4a2f0e5c1691..0ace438c29fa 100644 --- a/packages/babel-core/src/transform.js +++ b/packages/babel-core/src/transform.js @@ -1,8 +1,10 @@ // @flow -import loadConfig, { type InputOptions } from "./config"; + +import gensync from "gensync"; + +import loadConfig, { type InputOptions, type ResolvedConfig } from "./config"; import { - runSync, - runAsync, + run, type FileResult, type FileResultCallback, } from "./transformation"; @@ -16,6 +18,15 @@ type Transform = { (code: string, opts: ?InputOptions): FileResult | null, }; +const transformRunner = gensync<[string, ?InputOptions], FileResult | null>( + function* transform(code, opts) { + const config: ResolvedConfig | null = yield* loadConfig(opts); + if (config === null) return null; + + return yield* run(config, code); + }, +); + export const transform: Transform = (function transform(code, opts, callback) { if (typeof opts === "function") { callback = opts; @@ -24,44 +35,10 @@ export const transform: Transform = (function transform(code, opts, callback) { // For backward-compat with Babel 6, we allow sync transformation when // no callback is given. Will be dropped in some future Babel major version. - if (callback === undefined) return transformSync(code, opts); + if (callback === undefined) return transformRunner.sync(code, opts); - // Reassign to keep Flowtype happy. - const cb = callback; - - // Just delaying the transform one tick for now to simulate async behavior - // but more async logic may land here eventually. - process.nextTick(() => { - let cfg; - try { - cfg = loadConfig(opts); - if (cfg === null) return cb(null, null); - } catch (err) { - return cb(err); - } - - runAsync(cfg, code, null, cb); - }); + transformRunner.errback(code, opts, callback); }: Function); -export function transformSync( - code: string, - opts: ?InputOptions, -): FileResult | null { - const config = loadConfig(opts); - if (config === null) return null; - - return runSync(config, code); -} - -export function transformAsync( - code: string, - opts: ?InputOptions, -): Promise { - return new Promise((res, rej) => { - transform(code, opts, (err, result) => { - if (err == null) res(result); - else rej(err); - }); - }); -} +export const transformSync = transformRunner.sync; +export const transformAsync = transformRunner.async; diff --git a/packages/babel-core/src/transformation/block-hoist-plugin.js b/packages/babel-core/src/transformation/block-hoist-plugin.js index 8e8fe69699f0..49ecf5a18556 100644 --- a/packages/babel-core/src/transformation/block-hoist-plugin.js +++ b/packages/babel-core/src/transformation/block-hoist-plugin.js @@ -11,7 +11,7 @@ export default function loadBlockHoistPlugin(): Plugin { // Lazy-init the internal plugin to remove the init-time circular // dependency between plugins being passed @babel/core's export object, // which loads this file, and this 'loadConfig' loading plugins. - const config = loadConfig({ + const config = loadConfig.sync({ babelrc: false, configFile: false, plugins: [blockHoistPlugin], diff --git a/packages/babel-core/src/transformation/file/file.js b/packages/babel-core/src/transformation/file/file.js index a0a9f65bcdf4..ed86452c64ff 100644 --- a/packages/babel-core/src/transformation/file/file.js +++ b/packages/babel-core/src/transformation/file/file.js @@ -19,6 +19,17 @@ const errorVisitor = { }, }; +export type NodeLocation = { + loc?: { + end?: { line: number, column: number }, + start: { line: number, column: number }, + }, + _loc?: { + end?: { line: number, column: number }, + start: { line: number, column: number }, + }, +}; + export default class File { _map: Map = new Map(); opts: Object; @@ -250,17 +261,12 @@ export default class File { } buildCodeFrameError( - node: ?{ - loc?: { start: { line: number, column: number } }, - _loc?: { start: { line: number, column: number } }, - }, + node: ?NodeLocation, msg: string, Error: typeof Error = SyntaxError, ): Error { let loc = node && (node.loc || node._loc); - msg = `${this.opts.filename}: ${msg}`; - if (!loc && node) { const state = { loc: null, @@ -287,6 +293,13 @@ export default class File { line: loc.start.line, column: loc.start.column + 1, }, + end: + loc.end && loc.start.line === loc.end.line + ? { + line: loc.end.line, + column: loc.end.column + 1, + } + : undefined, }, { highlightCode }, ); diff --git a/packages/babel-core/src/transformation/file/generate.js b/packages/babel-core/src/transformation/file/generate.js index e124c16fc4c6..b07851fe9cba 100644 --- a/packages/babel-core/src/transformation/file/generate.js +++ b/packages/babel-core/src/transformation/file/generate.js @@ -1,7 +1,7 @@ // @flow import type { PluginPasses } from "../../config"; -import convertSourceMap, { type SourceMap } from "convert-source-map"; +import convertSourceMap, { typeof SourceMap } from "convert-source-map"; import generate from "@babel/generator"; import type File from "./file"; @@ -41,7 +41,7 @@ export default function generateCode( if (typeof result.then === "function") { throw new Error( - `You appear to be using an async parser plugin, ` + + `You appear to be using an async codegen plugin, ` + `which your current version of Babel does not support. ` + `If you're using a published plugin, ` + `you may need to upgrade your @babel/core version.`, diff --git a/packages/babel-core/src/transformation/file/merge-map.js b/packages/babel-core/src/transformation/file/merge-map.js index ff2e65b042b8..911867d96890 100644 --- a/packages/babel-core/src/transformation/file/merge-map.js +++ b/packages/babel-core/src/transformation/file/merge-map.js @@ -1,6 +1,6 @@ // @flow -import type { SourceMap } from "convert-source-map"; +import typeof { SourceMap } from "convert-source-map"; import sourceMap from "source-map"; export default function mergeSourceMap( diff --git a/packages/babel-core/src/transformation/index.js b/packages/babel-core/src/transformation/index.js index a03c4db0cf2a..970549f9d94e 100644 --- a/packages/babel-core/src/transformation/index.js +++ b/packages/babel-core/src/transformation/index.js @@ -1,6 +1,7 @@ // @flow import traverse from "@babel/traverse"; -import type { SourceMap } from "convert-source-map"; +import typeof { SourceMap } from "convert-source-map"; +import type { Handler } from "gensync"; import type { ResolvedConfig, PluginPasses } from "../config"; @@ -25,41 +26,41 @@ export type FileResult = { map: SourceMap | null, }; -export function runAsync( +export function* run( config: ResolvedConfig, code: string, ast: ?(BabelNodeFile | BabelNodeProgram), - callback: Function, -) { - let result; - try { - result = runSync(config, code, ast); - } catch (err) { - return callback(err); - } - - // We don't actually care about calling this synchronously here because it is - // already running within a .nextTick handler from the transform calls above. - return callback(null, result); -} - -export function runSync( - config: ResolvedConfig, - code: string, - ast: ?(BabelNodeFile | BabelNodeProgram), -): FileResult { - const file = normalizeFile( +): Handler { + const file = yield* normalizeFile( config.passes, normalizeOptions(config), code, ast, ); - transformFile(file, config.passes); - const opts = file.opts; - const { outputCode, outputMap } = - opts.code !== false ? generateCode(config.passes, file) : {}; + try { + yield* transformFile(file, config.passes); + } catch (e) { + e.message = `${opts.filename ?? "unknown"}: ${e.message}`; + if (!e.code) { + e.code = "BABEL_TRANSFORM_ERROR"; + } + throw e; + } + + let outputCode, outputMap; + try { + if (opts.code !== false) { + ({ outputCode, outputMap } = generateCode(config.passes, file)); + } + } catch (e) { + e.message = `${opts.filename ?? "unknown"}: ${e.message}`; + if (!e.code) { + e.code = "BABEL_GENERATE_ERROR"; + } + throw e; + } return { metadata: file.metadata, @@ -71,7 +72,7 @@ export function runSync( }; } -function transformFile(file: File, pluginPasses: PluginPasses): void { +function* transformFile(file: File, pluginPasses: PluginPasses): Handler { for (const pluginPairs of pluginPasses) { const passPairs = []; const passes = []; @@ -90,6 +91,7 @@ function transformFile(file: File, pluginPasses: PluginPasses): void { if (fn) { const result = fn.call(pass, file); + yield* []; if (isThenable(result)) { throw new Error( `You appear to be using an plugin with an async .pre, ` + @@ -114,6 +116,7 @@ function transformFile(file: File, pluginPasses: PluginPasses): void { if (fn) { const result = fn.call(pass, file); + yield* []; if (isThenable(result)) { throw new Error( `You appear to be using an plugin with an async .post, ` + diff --git a/packages/babel-core/src/transformation/normalize-file.js b/packages/babel-core/src/transformation/normalize-file.js index 1df42ad763b2..69afea4f9fd6 100644 --- a/packages/babel-core/src/transformation/normalize-file.js +++ b/packages/babel-core/src/transformation/normalize-file.js @@ -1,17 +1,18 @@ // @flow +import fs from "fs"; import path from "path"; import buildDebug from "debug"; import cloneDeep from "lodash/cloneDeep"; +import type { Handler } from "gensync"; import * as t from "@babel/types"; import type { PluginPasses } from "../config"; import convertSourceMap, { typeof Converter } from "convert-source-map"; -import { parse } from "@babel/parser"; -import { codeFrameColumns } from "@babel/code-frame"; import File from "./file/file"; -import generateMissingPluginMessage from "./util/missing-plugin-helper"; +import parser from "../parser"; const debug = buildDebug("babel:transform:file"); +const LARGE_INPUT_SOURCEMAP_THRESHOLD = 1_000_000; export type NormalizedFile = { code: string, @@ -19,14 +20,25 @@ export type NormalizedFile = { inputMap: Converter | null, }; -export default function normalizeFile( +export default function* normalizeFile( pluginPasses: PluginPasses, options: Object, code: string, ast: ?(BabelNodeFile | BabelNodeProgram), -): File { +): Handler { code = `${code || ""}`; + if (ast) { + if (ast.type === "Program") { + ast = t.file(ast, [], []); + } else if (ast.type !== "File") { + throw new Error("AST root must be a Program or File node"); + } + ast = cloneDeep(ast); + } else { + ast = yield* parser(pluginPasses, options, code); + } + let inputMap = null; if (options.inputSourceMap !== false) { // If an explicit object is passed in, it overrides the processing of @@ -36,54 +48,41 @@ export default function normalizeFile( } if (!inputMap) { - try { - inputMap = convertSourceMap.fromSource(code); - - if (inputMap) { - code = convertSourceMap.removeComments(code); + const lastComment = extractComments(INLINE_SOURCEMAP_REGEX, ast); + if (lastComment) { + try { + inputMap = convertSourceMap.fromComment(lastComment); + } catch (err) { + debug("discarding unknown inline input sourcemap", err); } - } catch (err) { - debug("discarding unknown inline input sourcemap", err); - code = convertSourceMap.removeComments(code); } } if (!inputMap) { - if (typeof options.filename === "string") { + const lastComment = extractComments(EXTERNAL_SOURCEMAP_REGEX, ast); + if (typeof options.filename === "string" && lastComment) { try { - inputMap = convertSourceMap.fromMapFileSource( - code, - path.dirname(options.filename), + // when `lastComment` is non-null, EXTERNAL_SOURCEMAP_REGEX must have matches + const match: [string, string] = (EXTERNAL_SOURCEMAP_REGEX.exec( + lastComment, + ): any); + const inputMapContent: Buffer = fs.readFileSync( + path.resolve(path.dirname(options.filename), match[1]), ); - - if (inputMap) { - code = convertSourceMap.removeMapFileComments(code); + if (inputMapContent.length > LARGE_INPUT_SOURCEMAP_THRESHOLD) { + debug("skip merging input map > 1 MB"); + } else { + inputMap = convertSourceMap.fromJSON(inputMapContent); } } catch (err) { debug("discarding unknown file input sourcemap", err); - code = convertSourceMap.removeMapFileComments(code); } - } else { + } else if (lastComment) { debug("discarding un-loadable file input sourcemap"); - code = convertSourceMap.removeMapFileComments(code); } } } - if (ast) { - if (ast.type === "Program") { - ast = t.file(ast, [], []); - } else if (ast.type !== "File") { - throw new Error("AST root must be a Program or File node"); - } - ast = cloneDeep(ast); - } else { - // The parser's AST types aren't fully compatible with the types generated - // by the logic in babel-types. - // $FlowFixMe - ast = parser(pluginPasses, options, code); - } - return new File(options, { code, ast, @@ -91,68 +90,47 @@ export default function normalizeFile( }); } -function parser( - pluginPasses: PluginPasses, - { parserOpts, highlightCode = true, filename = "unknown" }: Object, - code: string, -) { - try { - const results = []; - for (const plugins of pluginPasses) { - for (const plugin of plugins) { - const { parserOverride } = plugin; - if (parserOverride) { - const ast = parserOverride(code, parserOpts, parse); - - if (ast !== undefined) results.push(ast); - } - } - } +// These regexps are copied from the convert-source-map package, +// but without // or /* at the beginning of the comment. - if (results.length === 0) { - return parse(code, parserOpts); - } else if (results.length === 1) { - if (typeof results[0].then === "function") { - throw new Error( - `You appear to be using an async codegen plugin, ` + - `which your current version of Babel does not support. ` + - `If you're using a published plugin, you may need to upgrade ` + - `your @babel/core version.`, - ); - } - return results[0]; - } - throw new Error("More than one plugin attempted to override parsing."); - } catch (err) { - if (err.code === "BABEL_PARSER_SOURCETYPE_MODULE_REQUIRED") { - err.message += - "\nConsider renaming the file to '.mjs', or setting sourceType:module " + - "or sourceType:unambiguous in your Babel config for this file."; - } +// eslint-disable-next-line max-len +const INLINE_SOURCEMAP_REGEX = /^[@#]\s+sourceMappingURL=data:(?:application|text)\/json;(?:charset[:=]\S+?;)?base64,(?:.*)$/; +const EXTERNAL_SOURCEMAP_REGEX = /^[@#][ \t]+sourceMappingURL=([^\s'"`]+)[ \t]*$/; - const { loc, missingPlugin } = err; - if (loc) { - const codeFrame = codeFrameColumns( - code, - { - start: { - line: loc.line, - column: loc.column + 1, - }, - }, - { - highlightCode, - }, - ); - if (missingPlugin) { - err.message = - `${filename}: ` + - generateMissingPluginMessage(missingPlugin[0], loc, codeFrame); - } else { - err.message = `${filename}: ${err.message}\n\n` + codeFrame; +function extractCommentsFromList(regex, comments, lastComment) { + if (comments) { + comments = comments.filter(({ value }) => { + if (regex.test(value)) { + lastComment = value; + return false; } - err.code = "BABEL_PARSE_ERROR"; - } - throw err; + return true; + }); } + return [comments, lastComment]; +} + +function extractComments(regex, ast) { + let lastComment = null; + t.traverseFast(ast, node => { + // $FlowIgnore destructuring with expressions is not supported + [node.leadingComments, lastComment] = extractCommentsFromList( + regex, + node.leadingComments, + lastComment, + ); + // $FlowIgnore destructuring with expressions is not supported + [node.innerComments, lastComment] = extractCommentsFromList( + regex, + node.innerComments, + lastComment, + ); + // $FlowIgnore destructuring with expressions is not supported + [node.trailingComments, lastComment] = extractCommentsFromList( + regex, + node.trailingComments, + lastComment, + ); + }); + return lastComment; } diff --git a/packages/babel-core/src/transformation/plugin-pass.js b/packages/babel-core/src/transformation/plugin-pass.js index 6e62c42bc786..e11f97804745 100644 --- a/packages/babel-core/src/transformation/plugin-pass.js +++ b/packages/babel-core/src/transformation/plugin-pass.js @@ -1,6 +1,7 @@ // @flow import type File from "./file/file"; +import type NodeLocation from "./file/file"; export default class PluginPass { _map: Map = new Map(); @@ -47,14 +48,7 @@ export default class PluginPass { return this.file.getModuleName(); } - buildCodeFrameError( - node: ?{ - loc?: { start: { line: number, column: number } }, - _loc?: { start: { line: number, column: number } }, - }, - msg: string, - Error?: typeof Error, - ) { + buildCodeFrameError(node: ?NodeLocation, msg: string, Error?: typeof Error) { return this.file.buildCodeFrameError(node, msg, Error); } } diff --git a/packages/babel-core/test/api.js b/packages/babel-core/test/api.js index 9f2f955f1d7e..5ce9a364c36f 100644 --- a/packages/babel-core/test/api.js +++ b/packages/babel-core/test/api.js @@ -760,11 +760,11 @@ describe("api", function() { options, function(err) { expect(err.message).toMatch( - "Support for the experimental syntax 'dynamicImport' isn't currently enabled (1:9)", + "Support for the experimental syntax 'pipelineOperator' isn't currently enabled (1:3):", ); expect(err.message).toMatch( - "Add @babel/plugin-syntax-dynamic-import (https://git.io/vb4Sv) to the " + - "'plugins' section of your Babel config to enable parsing.", + "Add @babel/plugin-proposal-pipeline-operator (https://git.io/vb4SU) to the " + + "'plugins' section of your Babel config to enable transformation.", ); done(); }, diff --git a/packages/babel-core/test/async.js b/packages/babel-core/test/async.js new file mode 100644 index 000000000000..3d834c9e637d --- /dev/null +++ b/packages/babel-core/test/async.js @@ -0,0 +1,214 @@ +import path from "path"; +import * as babel from ".."; + +const nodeGte8 = (...args) => { + // "minNodeVersion": "8.0.0" <-- For Ctrl+F when dropping node 6 + const testFn = process.version.slice(0, 3) === "v6." ? it.skip : it; + testFn(...args); +}; + +describe("asynchronicity", () => { + const base = path.join(__dirname, "fixtures", "async"); + let cwd; + + beforeEach(function() { + cwd = process.cwd(); + process.chdir(base); + }); + + afterEach(function() { + process.chdir(cwd); + }); + + describe("config file", () => { + describe("async function", () => { + nodeGte8("called synchronously", () => { + process.chdir("config-file-async-function"); + + expect(() => + babel.transformSync(""), + ).toThrowErrorMatchingInlineSnapshot( + `"You appear to be using an async configuration, which your current version of Babel does` + + ` not support. We may add support for this in the future, but if you're on the most recent` + + ` version of @babel/core and still seeing this error, then you'll need to synchronously` + + ` return your config."`, + ); + }); + + nodeGte8("called asynchronously", async () => { + process.chdir("config-file-async-function"); + + await expect( + babel.transformAsync(""), + ).rejects.toThrowErrorMatchingInlineSnapshot( + `"You appear to be using an async configuration, which your current version of Babel does` + + ` not support. We may add support for this in the future, but if you're on the most recent` + + ` version of @babel/core and still seeing this error, then you'll need to synchronously` + + ` return your config."`, + ); + }); + }); + + describe("promise", () => { + it("called synchronously", () => { + process.chdir("config-file-promise"); + + expect(() => + babel.transformSync(""), + ).toThrowErrorMatchingInlineSnapshot( + `"You appear to be using an async configuration, which your current version of Babel does` + + ` not support. We may add support for this in the future, but if you're on the most recent` + + ` version of @babel/core and still seeing this error, then you'll need to synchronously` + + ` return your config."`, + ); + }); + + it("called asynchronously", async () => { + process.chdir("config-file-promise"); + + await expect( + babel.transformAsync(""), + ).rejects.toThrowErrorMatchingInlineSnapshot( + `"You appear to be using an async configuration, which your current version of Babel does` + + ` not support. We may add support for this in the future, but if you're on the most recent` + + ` version of @babel/core and still seeing this error, then you'll need to synchronously` + + ` return your config."`, + ); + }); + }); + + describe("cache.using", () => { + nodeGte8("called synchronously", () => { + process.chdir("config-cache"); + + expect(() => + babel.transformSync(""), + ).toThrowErrorMatchingInlineSnapshot( + `"You appear to be using an async cache handler, which your current version of Babel does` + + ` not support. We may add support for this in the future, but if you're on the most recent` + + ` version of @babel/core and still seeing this error, then you'll need to synchronously` + + ` handle your caching logic."`, + ); + }); + + nodeGte8("called asynchronously", async () => { + process.chdir("config-cache"); + + await expect( + babel.transformAsync(""), + ).rejects.toThrowErrorMatchingInlineSnapshot( + `"You appear to be using an async cache handler, which your current version of Babel does` + + ` not support. We may add support for this in the future, but if you're on the most recent` + + ` version of @babel/core and still seeing this error, then you'll need to synchronously` + + ` handle your caching logic."`, + ); + }); + }); + }); + + describe("plugin", () => { + describe("factory function", () => { + nodeGte8("called synchronously", () => { + process.chdir("plugin"); + + expect(() => + babel.transformSync(""), + ).toThrowErrorMatchingInlineSnapshot( + `"[BABEL] unknown: You appear to be using an async plugin, which your current version of Babel` + + ` does not support. If you're using a published plugin, you may need to upgrade your` + + ` @babel/core version."`, + ); + }); + + nodeGte8("called asynchronously", async () => { + process.chdir("plugin"); + + await expect( + babel.transformAsync(""), + ).rejects.toThrowErrorMatchingInlineSnapshot( + `"[BABEL] unknown: You appear to be using an async plugin, which your current version of Babel` + + ` does not support. If you're using a published plugin, you may need to upgrade your` + + ` @babel/core version."`, + ); + }); + }); + + describe(".pre", () => { + nodeGte8("called synchronously", () => { + process.chdir("plugin-pre"); + + expect(() => + babel.transformSync(""), + ).toThrowErrorMatchingInlineSnapshot( + `"unknown: You appear to be using an plugin with an async .pre, which your current version` + + ` of Babel does not support. If you're using a published plugin, you may need to upgrade your` + + ` @babel/core version."`, + ); + }); + + nodeGte8("called asynchronously", async () => { + process.chdir("plugin-pre"); + + await expect( + babel.transformAsync(""), + ).rejects.toThrowErrorMatchingInlineSnapshot( + `"unknown: You appear to be using an plugin with an async .pre, which your current version` + + ` of Babel does not support. If you're using a published plugin, you may need to upgrade your` + + ` @babel/core version."`, + ); + }); + }); + + describe(".post", () => { + nodeGte8("called synchronously", () => { + process.chdir("plugin-post"); + + expect(() => + babel.transformSync(""), + ).toThrowErrorMatchingInlineSnapshot( + `"unknown: You appear to be using an plugin with an async .post, which your current version` + + ` of Babel does not support. If you're using a published plugin, you may need to upgrade your` + + ` @babel/core version."`, + ); + }); + + nodeGte8("called asynchronously", async () => { + process.chdir("plugin-post"); + + await expect( + babel.transformAsync(""), + ).rejects.toThrowErrorMatchingInlineSnapshot( + `"unknown: You appear to be using an plugin with an async .post, which your current version` + + ` of Babel does not support. If you're using a published plugin, you may need to upgrade your` + + ` @babel/core version."`, + ); + }); + }); + + describe("inherits", () => { + nodeGte8("called synchronously", () => { + process.chdir("plugin-inherits"); + + expect(() => + babel.transformSync(""), + ).toThrowErrorMatchingInlineSnapshot( + `"[BABEL] unknown: You appear to be using an async plugin, which your current version of Babel` + + ` does not support. If you're using a published plugin, you may need to upgrade your` + + ` @babel/core version."`, + ); + }); + + nodeGte8("called asynchronously", async () => { + process.chdir("plugin-inherits"); + + await expect( + babel.transformAsync(""), + ).rejects.toThrowErrorMatchingInlineSnapshot( + `"[BABEL] unknown: You appear to be using an async plugin, which your current version of Babel` + + ` does not support. If you're using a published plugin, you may need to upgrade your` + + ` @babel/core version."`, + ); + }); + }); + }); +}); diff --git a/packages/babel-core/test/caching-api.js b/packages/babel-core/test/caching-api.js index 0318759fe861..f8d442c150b4 100644 --- a/packages/babel-core/test/caching-api.js +++ b/packages/babel-core/test/caching-api.js @@ -1,10 +1,12 @@ -import { makeStrongCache } from "../lib/config/caching"; +import gensync from "gensync"; +import { makeStrongCacheSync, makeStrongCache } from "../lib/config/caching"; +import { waitFor } from "../lib/gensync-utils/async"; describe("caching API", () => { it("should allow permacaching with .forever()", () => { let count = 0; - const fn = makeStrongCache((arg, cache) => { + const fn = makeStrongCacheSync((arg, cache) => { cache.forever(); return { arg, count: count++ }; }); @@ -21,7 +23,7 @@ describe("caching API", () => { it("should allow disabling caching with .never()", () => { let count = 0; - const fn = makeStrongCache((arg, cache) => { + const fn = makeStrongCacheSync((arg, cache) => { cache.never(); return { arg, count: count++ }; }); @@ -41,7 +43,7 @@ describe("caching API", () => { let count = 0; let other = "default"; - const fn = makeStrongCache((arg, cache) => { + const fn = makeStrongCacheSync((arg, cache) => { const val = cache.using(() => other); return { arg, val, count: count++ }; @@ -82,7 +84,7 @@ describe("caching API", () => { let count = 0; let other = "default"; - const fn = makeStrongCache((arg, cache) => { + const fn = makeStrongCacheSync((arg, cache) => { const val = cache.invalidate(() => other); return { arg, val, count: count++ }; @@ -124,7 +126,7 @@ describe("caching API", () => { let other = "default"; let another = "another"; - const fn = makeStrongCache((arg, cache) => { + const fn = makeStrongCacheSync((arg, cache) => { const val = cache.using(() => other); const val2 = cache.invalidate(() => another); @@ -223,7 +225,7 @@ describe("caching API", () => { it("should auto-permacache by default", () => { let count = 0; - const fn = makeStrongCache(arg => ({ arg, count: count++ })); + const fn = makeStrongCacheSync(arg => ({ arg, count: count++ })); expect(fn("one")).toEqual({ arg: "one", count: 0 }); expect(fn("one")).toBe(fn("one")); @@ -235,7 +237,7 @@ describe("caching API", () => { }); it("should throw if you set permacaching and use .using", () => { - const fn = makeStrongCache((arg, cache) => { + const fn = makeStrongCacheSync((arg, cache) => { cache.forever(); cache.using(() => null); @@ -245,7 +247,7 @@ describe("caching API", () => { }); it("should throw if you set permacaching and use .invalidate", () => { - const fn = makeStrongCache((arg, cache) => { + const fn = makeStrongCacheSync((arg, cache) => { cache.forever(); cache.invalidate(() => null); @@ -255,7 +257,7 @@ describe("caching API", () => { }); it("should throw if you set permacaching and use .never", () => { - const fn = makeStrongCache((arg, cache) => { + const fn = makeStrongCacheSync((arg, cache) => { cache.forever(); cache.never(); @@ -265,7 +267,7 @@ describe("caching API", () => { }); it("should throw if you set no caching and use .using", () => { - const fn = makeStrongCache((arg, cache) => { + const fn = makeStrongCacheSync((arg, cache) => { cache.never(); cache.using(() => null); @@ -275,7 +277,7 @@ describe("caching API", () => { }); it("should throw if you set no caching and use .invalidate", () => { - const fn = makeStrongCache((arg, cache) => { + const fn = makeStrongCacheSync((arg, cache) => { cache.never(); cache.invalidate(() => null); @@ -285,7 +287,7 @@ describe("caching API", () => { }); it("should throw if you set no caching and use .never", () => { - const fn = makeStrongCache((arg, cache) => { + const fn = makeStrongCacheSync((arg, cache) => { cache.never(); cache.using(() => null); @@ -295,7 +297,7 @@ describe("caching API", () => { }); it("should throw if you configure .forever after exiting", () => { - const fn = makeStrongCache((arg, cache) => cache); + const fn = makeStrongCacheSync((arg, cache) => cache); expect(() => fn().forever()).toThrow( /Cannot change caching after evaluation/, @@ -303,7 +305,7 @@ describe("caching API", () => { }); it("should throw if you configure .never after exiting", () => { - const fn = makeStrongCache((arg, cache) => cache); + const fn = makeStrongCacheSync((arg, cache) => cache); expect(() => fn().never()).toThrow( /Cannot change caching after evaluation/, @@ -311,7 +313,7 @@ describe("caching API", () => { }); it("should throw if you configure .using after exiting", () => { - const fn = makeStrongCache((arg, cache) => cache); + const fn = makeStrongCacheSync((arg, cache) => cache); expect(() => fn().using(() => null)).toThrow( /Cannot change caching after evaluation/, @@ -319,7 +321,7 @@ describe("caching API", () => { }); it("should throw if you configure .invalidate after exiting", () => { - const fn = makeStrongCache((arg, cache) => cache); + const fn = makeStrongCacheSync((arg, cache) => cache); expect(() => fn().invalidate(() => null)).toThrow( /Cannot change caching after evaluation/, @@ -330,7 +332,7 @@ describe("caching API", () => { it("should allow permacaching with cache(true)", () => { let count = 0; - const fn = makeStrongCache((arg, cache) => { + const fn = makeStrongCacheSync((arg, cache) => { cache = cache.simple(); cache(true); @@ -349,7 +351,7 @@ describe("caching API", () => { it("should allow disabling caching with cache(false)", () => { let count = 0; - const fn = makeStrongCache((arg, cache) => { + const fn = makeStrongCacheSync((arg, cache) => { cache = cache.simple(); cache(false); @@ -371,7 +373,7 @@ describe("caching API", () => { let count = 0; let other = "default"; - const fn = makeStrongCache((arg, cache) => { + const fn = makeStrongCacheSync((arg, cache) => { cache = cache.simple(); const val = cache(() => other); @@ -410,4 +412,60 @@ describe("caching API", () => { expect(fn("two")).toBe(fn("two")); }); }); + + describe("async", () => { + const wait = gensync({ + sync: () => {}, + errback: (t, cb) => setTimeout(cb, t), + }); + + it("should throw if the cache is configured asynchronously", async () => { + const fn = gensync( + makeStrongCache(function*(arg, cache) { + yield* wait(1000); + cache.never(); + return { arg }; + }), + ).async; + + await expect(fn("bar")).rejects.toThrowErrorMatchingInlineSnapshot( + `"Cannot change caching after evaluation has completed."`, + ); + }); + + it("should allow asynchronous cache invalidation functions", async () => { + const fn = gensync( + makeStrongCache(function*(arg, cache) { + yield* waitFor( + cache.using(async () => { + await wait.async(50); + return "x"; + }), + ); + return { arg }; + }), + ).async; + + const [res1, res2] = await Promise.all([fn("foo"), fn("foo")]); + + expect(res1).toBe(res2); + }); + + it("should allow synchronous yield before cache configuration", async () => { + const fn = gensync( + makeStrongCache(function*(arg, cache) { + yield* gensync({ + sync: () => 2, + errback: cb => cb(null, 2), + })(); + cache.forever(); + return { arg }; + }), + ).async; + + const [res1, res2] = await Promise.all([fn("foo"), fn("foo")]); + + expect(res1).toBe(res2); + }); + }); }); diff --git a/packages/babel-core/test/config-chain.js b/packages/babel-core/test/config-chain.js index 849da38cfc02..aef0ba90cb3c 100644 --- a/packages/babel-core/test/config-chain.js +++ b/packages/babel-core/test/config-chain.js @@ -1,16 +1,72 @@ import fs from "fs"; +import os from "os"; import path from "path"; -import { loadOptions as loadOptionsOrig } from "../lib"; +import escapeRegExp from "lodash/escapeRegExp"; +import * as babel from "../lib"; + +// TODO: In Babel 8, we can directly uses fs.promises which is supported by +// node 8+ +const pfs = + fs.promises ?? + new Proxy(fs, { + get(target, name) { + if (name === "copyFile") { + // fs.copyFile is only supported since node 8.5 + // https://stackoverflow.com/a/30405105/2359289 + return function copyFile(source, target) { + const rd = fs.createReadStream(source); + const wr = fs.createWriteStream(target); + return new Promise(function(resolve, reject) { + rd.on("error", reject); + wr.on("error", reject); + wr.on("finish", resolve); + rd.pipe(wr); + }).catch(function(error) { + rd.destroy(); + wr.end(); + throw error; + }); + }; + } + + return (...args) => + new Promise((resolve, reject) => + target[name](...args, (error, result) => { + if (error) reject(error); + else resolve(result); + }), + ); + }, + }); function fixture(...args) { return path.join(__dirname, "fixtures", "config", ...args); } function loadOptions(opts) { - return loadOptionsOrig({ - cwd: __dirname, - ...opts, - }); + return babel.loadOptions({ cwd: __dirname, ...opts }); +} + +function loadOptionsAsync(opts) { + return babel.loadOptionsAsync({ cwd: __dirname, ...opts }); +} + +function pairs(items) { + const pairs = []; + for (let i = 0; i < items.length - 1; i++) { + for (let j = i + 1; j < items.length; j++) { + pairs.push([items[i], items[j]]); + } + } + return pairs; +} + +async function getTemp(name) { + const cwd = await pfs.mkdtemp(os.tmpdir() + path.sep + name); + const tmp = name => path.join(cwd, name); + const config = name => + pfs.copyFile(fixture("config-files-templates", name), tmp(name)); + return { cwd, tmp, config }; } describe("buildConfigChain", function() { @@ -33,7 +89,7 @@ describe("buildConfigChain", function() { cwd: fixture("nonexistant-fake"), filename: fixture("nonexistant-fake", "src.js"), babelrc: false, - test: new RegExp(fixture("nonexistant-fake")), + test: new RegExp(escapeRegExp(fixture("nonexistant-fake"))), comments: true, }); @@ -69,7 +125,7 @@ describe("buildConfigChain", function() { cwd: fixture("nonexistant-fake"), filename: fixture("nonexistant-fake", "src.js"), babelrc: false, - test: new RegExp(fixture("nonexistant-unknown")), + test: new RegExp(escapeRegExp(fixture("nonexistant-unknown"))), comments: true, }); @@ -107,7 +163,7 @@ describe("buildConfigChain", function() { cwd: fixture("nonexistant-fake"), filename: fixture("nonexistant-fake", "src.js"), babelrc: false, - test: [new RegExp(fixture("nonexistant-fake"))], + test: [new RegExp(escapeRegExp(fixture("nonexistant-fake")))], comments: true, }); @@ -143,7 +199,7 @@ describe("buildConfigChain", function() { cwd: fixture("nonexistant-fake"), filename: fixture("nonexistant-fake", "src.js"), babelrc: false, - test: [new RegExp(fixture("nonexistant-unknown"))], + test: [new RegExp(escapeRegExp(fixture("nonexistant-unknown")))], comments: true, }); @@ -183,7 +239,7 @@ describe("buildConfigChain", function() { cwd: fixture("nonexistant-fake"), filename: fixture("nonexistant-fake", "src.js"), babelrc: false, - include: new RegExp(fixture("nonexistant-fake")), + include: new RegExp(escapeRegExp(fixture("nonexistant-fake"))), comments: true, }); @@ -219,7 +275,7 @@ describe("buildConfigChain", function() { cwd: fixture("nonexistant-fake"), filename: fixture("nonexistant-fake", "src.js"), babelrc: false, - include: new RegExp(fixture("nonexistant-unknown")), + include: new RegExp(escapeRegExp(fixture("nonexistant-unknown"))), comments: true, }); @@ -257,7 +313,7 @@ describe("buildConfigChain", function() { cwd: fixture("nonexistant-fake"), filename: fixture("nonexistant-fake", "src.js"), babelrc: false, - include: [new RegExp(fixture("nonexistant-fake"))], + include: [new RegExp(escapeRegExp(fixture("nonexistant-fake")))], comments: true, }); @@ -293,7 +349,7 @@ describe("buildConfigChain", function() { cwd: fixture("nonexistant-fake"), filename: fixture("nonexistant-fake", "src.js"), babelrc: false, - include: [new RegExp(fixture("nonexistant-unknown"))], + include: [new RegExp(escapeRegExp(fixture("nonexistant-unknown")))], comments: true, }); @@ -333,7 +389,7 @@ describe("buildConfigChain", function() { cwd: fixture("nonexistant-fake"), filename: fixture("nonexistant-fake", "src.js"), babelrc: false, - exclude: new RegExp(fixture("nonexistant-fake")), + exclude: new RegExp(escapeRegExp(fixture("nonexistant-fake"))), comments: true, }); @@ -369,7 +425,7 @@ describe("buildConfigChain", function() { cwd: fixture("nonexistant-fake"), filename: fixture("nonexistant-fake", "src.js"), babelrc: false, - exclude: new RegExp(fixture("nonexistant-unknown")), + exclude: new RegExp(escapeRegExp(fixture("nonexistant-unknown"))), comments: true, }); @@ -407,7 +463,7 @@ describe("buildConfigChain", function() { cwd: fixture("nonexistant-fake"), filename: fixture("nonexistant-fake", "src.js"), babelrc: false, - exclude: [new RegExp(fixture("nonexistant-fake"))], + exclude: [new RegExp(escapeRegExp(fixture("nonexistant-fake")))], comments: true, }); @@ -443,7 +499,7 @@ describe("buildConfigChain", function() { cwd: fixture("nonexistant-fake"), filename: fixture("nonexistant-fake", "src.js"), babelrc: false, - exclude: [new RegExp(fixture("nonexistant-unknown"))], + exclude: [new RegExp(escapeRegExp(fixture("nonexistant-unknown")))], comments: true, }); @@ -943,111 +999,250 @@ describe("buildConfigChain", function() { } }); - it("should load .babelrc", () => { - const filename = fixture("config-files", "babelrc", "src.js"); + describe("root", () => { + test.each(["babel.config.json", "babel.config.js", "babel.config.cjs"])( + "should load %s synchronously", + async name => { + const { cwd, tmp, config } = await getTemp( + `babel-test-load-config-sync-${name}`, + ); + const filename = tmp("src.js"); + + await config(name); + + expect(loadOptions({ filename, cwd })).toEqual({ + ...getDefaults(), + filename, + cwd, + root: cwd, + comments: true, + }); + }, + ); + + test("should not load babel.config.mjs synchronously", async () => { + const { cwd, tmp, config } = await getTemp( + "babel-test-load-config-sync-babel.config.mjs", + ); + const filename = tmp("src.js"); - expect( - loadOptions({ + await config("babel.config.mjs"); + + expect(() => loadOptions({ filename, cwd })).toThrow( + /is only supported when running Babel asynchronously/, + ); + }); + + test.each([ + "babel.config.json", + "babel.config.js", + "babel.config.cjs", + "babel.config.mjs", + ])("should load %s asynchronously", async name => { + const { cwd, tmp, config } = await getTemp( + `babel-test-load-config-async-${name}`, + ); + const filename = tmp("src.js"); + + // We can't transpile import() while publishing, and it isn't supported + // by jest. + if (process.env.IS_PUBLISH && name === "babel.config.mjs") return; + + await config(name); + + expect(await loadOptionsAsync({ filename, cwd })).toEqual({ + ...getDefaults(), filename, - cwd: path.dirname(filename), - }), - ).toEqual({ - ...getDefaults(), - filename: filename, - cwd: path.dirname(filename), - root: path.dirname(filename), - comments: true, + cwd, + root: cwd, + comments: true, + }); }); - }); - it("should load .babelrc.js", () => { - const filename = fixture("config-files", "babelrc-js", "src.js"); + test.each( + pairs([ + "babel.config.json", + "babel.config.js", + "babel.config.cjs", + "babel.config.mjs", + ]), + )("should throw if both %s and %s are used", async (name1, name2) => { + const { cwd, tmp, config } = await getTemp( + `babel-test-dup-config-${name1}-${name2}`, + ); + + // We can't transpile import() while publishing, and it isn't supported + // by jest. + if ( + process.env.IS_PUBLISH && + (name1 === "babel.config.mjs" || name2 === "babel.config.mjs") + ) { + return; + } - expect(loadOptions({ filename, cwd: path.dirname(filename) })).toEqual({ - ...getDefaults(), - filename: filename, - cwd: path.dirname(filename), - root: path.dirname(filename), - comments: true, + await Promise.all([config(name1), config(name2)]); + + await expect( + loadOptionsAsync({ filename: tmp("src.js"), cwd }), + ).rejects.toThrow(/Multiple configuration files found/); }); }); - it("should load package.json#babel", () => { - const filename = fixture("config-files", "pkg", "src.js"); + describe("relative", () => { + test.each([ + "package.json", + ".babelrc", + ".babelrc.js", + ".babelrc.cjs", + ".babelrc.json", + ])("should load %s synchronously", async name => { + const { cwd, tmp, config } = await getTemp( + `babel-test-load-config-${name}`, + ); + const filename = tmp("src.js"); - expect(loadOptions({ filename, cwd: path.dirname(filename) })).toEqual({ - ...getDefaults(), - filename: filename, - cwd: path.dirname(filename), - root: path.dirname(filename), - comments: true, + await config(name); + + expect(loadOptions({ filename, cwd })).toEqual({ + ...getDefaults(), + filename, + cwd, + root: cwd, + comments: true, + }); }); - }); - it("should load .babelignore", () => { - const filename = fixture("config-files", "babelignore", "src.js"); + test("should not load .babelrc.mjs synchronously", async () => { + const { cwd, tmp, config } = await getTemp( + "babel-test-load-config-sync-.babelrc.mjs", + ); + const filename = tmp("src.js"); - expect(loadOptions({ filename, cwd: path.dirname(filename) })).toBeNull(); - }); + await config(".babelrc.mjs"); - it("should throw if there are both .babelrc and .babelrc.js", () => { - const filename = fixture("config-files", "both-babelrc", "src.js"); + expect(() => loadOptions({ filename, cwd })).toThrow( + /is only supported when running Babel asynchronously/, + ); + }); - expect(() => - loadOptions({ filename, cwd: path.dirname(filename) }), - ).toThrow(/Multiple configuration files found/); - }); + test.each([ + "package.json", + ".babelrc", + ".babelrc.js", + ".babelrc.cjs", + ".babelrc.mjs", + ])("should load %s asynchronously", async name => { + const { cwd, tmp, config } = await getTemp( + `babel-test-load-config-${name}`, + ); + const filename = tmp("src.js"); - it("should throw if there are both .babelrc and package.json", () => { - const filename = fixture("config-files", "pkg-babelrc", "src.js"); + // We can't transpile import() while publishing, and it isn't supported + // by jest. + if (process.env.IS_PUBLISH && name === ".babelrc.mjs") return; - expect(() => - loadOptions({ filename, cwd: path.dirname(filename) }), - ).toThrow(/Multiple configuration files found/); - }); + await config(name); - it("should throw if there are both .babelrc.js and package.json", () => { - const filename = fixture("config-files", "pkg-babelrc-js", "src.js"); + expect(await loadOptionsAsync({ filename, cwd })).toEqual({ + ...getDefaults(), + filename, + cwd, + root: cwd, + comments: true, + }); + }); - expect(() => - loadOptions({ filename, cwd: path.dirname(filename) }), - ).toThrow(/Multiple configuration files found/); - }); + it("should load .babelignore", () => { + const filename = fixture("config-files", "babelignore", "src.js"); - it("should ignore package.json without a 'babel' property", () => { - const filename = fixture("config-files", "pkg-ignored", "src.js"); + expect( + loadOptions({ filename, cwd: path.dirname(filename) }), + ).toBeNull(); + }); - expect(loadOptions({ filename, cwd: path.dirname(filename) })).toEqual({ - ...getDefaults(), - filename: filename, - cwd: path.dirname(filename), - root: path.dirname(filename), - comments: true, + test.each( + pairs([ + "package.json", + ".babelrc", + ".babelrc.js", + ".babelrc.cjs", + ".babelrc.mjs", + ".babelrc.json", + ]), + )("should throw if both %s and %s are used", async (name1, name2) => { + const { cwd, tmp, config } = await getTemp( + `babel-test-dup-config-${name1}-${name2}`, + ); + + // We can't transpile import() while publishing, and it isn't supported + // by jest. + if ( + process.env.IS_PUBLISH && + (name1 === ".babelrc.mjs" || name2 === ".babelrc.mjs") + ) { + return; + } + + await Promise.all([config(name1), config(name2)]); + + await expect( + loadOptionsAsync({ filename: tmp("src.js"), cwd }), + ).rejects.toThrow(/Multiple configuration files found/); }); - }); - it("should show helpful errors for .babelrc", () => { - const filename = fixture("config-files", "babelrc-error", "src.js"); + it("should ignore package.json without a 'babel' property", () => { + const filename = fixture("config-files", "pkg-ignored", "src.js"); - expect(() => - loadOptions({ filename, cwd: path.dirname(filename) }), - ).toThrow(/Error while parsing config - /); - }); + expect(loadOptions({ filename, cwd: path.dirname(filename) })).toEqual({ + ...getDefaults(), + filename: filename, + cwd: path.dirname(filename), + root: path.dirname(filename), + comments: true, + }); + }); - it("should show helpful errors for .babelrc.js", () => { - const filename = fixture("config-files", "babelrc-js-error", "src.js"); + test.each` + config | dir | error + ${".babelrc"} | ${"babelrc-error"} | ${/Error while parsing config - /} + ${".babelrc.json"} | ${"babelrc-json-error"} | ${/Error while parsing config - /} + ${".babelrc.js"} | ${"babelrc-js-error"} | ${/Babelrc threw an error/} + ${".babelrc.cjs"} | ${"babelrc-cjs-error"} | ${/Babelrc threw an error/} + ${".babelrc.mjs"} | ${"babelrc-mjs-error"} | ${/Babelrc threw an error/} + ${"package.json"} | ${"pkg-error"} | ${/Error while parsing JSON - /} + `("should show helpful errors for $config", async ({ dir, error }) => { + const filename = fixture("config-files", dir, "src.js"); - expect(() => - loadOptions({ filename, cwd: path.dirname(filename) }), - ).toThrow(/Babelrc threw an error/); + // We can't transpile import() while publishing, and it isn't supported + // by jest. + if (process.env.IS_PUBLISH && dir === "babelrc-mjs-error") return; + + await expect( + loadOptionsAsync({ filename, cwd: path.dirname(filename) }), + ).rejects.toThrow(error); + }); }); - it("should show helpful errors for package.json", () => { - const filename = fixture("config-files", "pkg-error", "src.js"); + it("should throw when `test` presents but `filename` is not passed", () => { + expect(() => loadOptions({ test: /\.ts$/, plugins: [] })).toThrow( + /Configuration contains string\/RegExp pattern/, + ); + }); - expect(() => - loadOptions({ filename, cwd: path.dirname(filename) }), - ).toThrow(/Error while parsing JSON - /); + it("should throw when `preset` requires `filename` but it was not passed", () => { + expect(() => { + loadOptions({ + presets: [require("./fixtures/config-loading/preset4")], + }); + }).toThrow(/Preset \/\* your preset \*\/ requires a filename/); + }); + + it("should throw when `preset.overrides` requires `filename` but it was not passed", () => { + expect(() => { + loadOptions({ + presets: [require("./fixtures/config-loading/preset5")], + }); + }).toThrow(/Preset \/\* your preset \*\/ requires a filename/); }); }); }); diff --git a/packages/babel-core/test/config-loading.js b/packages/babel-core/test/config-loading.js index b31eac8ed2d9..4f61315404e4 100644 --- a/packages/babel-core/test/config-loading.js +++ b/packages/babel-core/test/config-loading.js @@ -1,6 +1,8 @@ -import loadConfig, { loadPartialConfig } from "../lib/config"; +import loadConfigRunner, { loadPartialConfig } from "../lib/config"; import path from "path"; +const loadConfig = loadConfigRunner.sync; + describe("@babel/core config loading", () => { const FILEPATH = path.join( __dirname, @@ -322,6 +324,21 @@ describe("@babel/core config loading", () => { } } }); + + it("should thrown when plugin is not valid", () => { + const fooPlugin = { + inherits: "inhertis-should-not-be-string", + }; + const opts = { + cwd: path.dirname(FILEPATH), + filename: FILEPATH, + plugins: [fooPlugin], + }; + + expect(() => loadConfig(opts)).toThrow( + /\.inherits must be a function, or undefined/, + ); + }); }); describe("caller metadata", () => { diff --git a/packages/babel-core/test/fixtures/api/parsing-errors/only-syntax/file.js b/packages/babel-core/test/fixtures/api/parsing-errors/only-syntax/file.js index 55194f0636b3..c6c1a3ba7cd2 100644 --- a/packages/babel-core/test/fixtures/api/parsing-errors/only-syntax/file.js +++ b/packages/babel-core/test/fixtures/api/parsing-errors/only-syntax/file.js @@ -1 +1 @@ -var $ = import("jquery"); \ No newline at end of file +a |> b \ No newline at end of file diff --git a/packages/babel-core/test/fixtures/async/config-cache/babel.config.js b/packages/babel-core/test/fixtures/async/config-cache/babel.config.js new file mode 100644 index 000000000000..f17724435869 --- /dev/null +++ b/packages/babel-core/test/fixtures/async/config-cache/babel.config.js @@ -0,0 +1,12 @@ +const wait = t => new Promise(r => setTimeout(r, t)); + +module.exports = function(api) { + api.cache.using(async () => { + await wait(50); + return 2; + }) + + return { + plugins: ["./plugin"], + }; +}; diff --git a/packages/babel-core/test/fixtures/async/config-cache/plugin.js b/packages/babel-core/test/fixtures/async/config-cache/plugin.js new file mode 100644 index 000000000000..f3164a2364f9 --- /dev/null +++ b/packages/babel-core/test/fixtures/async/config-cache/plugin.js @@ -0,0 +1,9 @@ +module.exports = function plugin({ types: t }) { + return { + visitor: { + Program(path) { + path.pushContainer("body", t.stringLiteral("success")); + }, + }, + }; +}; diff --git a/packages/babel-core/test/fixtures/async/config-file-async-function/babel.config.js b/packages/babel-core/test/fixtures/async/config-file-async-function/babel.config.js new file mode 100644 index 000000000000..14e85e8e700f --- /dev/null +++ b/packages/babel-core/test/fixtures/async/config-file-async-function/babel.config.js @@ -0,0 +1,11 @@ +const wait = t => new Promise(r => setTimeout(r, t)); + +module.exports = async function(api) { + await wait(50); + + api.cache.never(); + + return { + plugins: ["./plugin"], + }; +}; diff --git a/packages/babel-core/test/fixtures/async/config-file-async-function/plugin.js b/packages/babel-core/test/fixtures/async/config-file-async-function/plugin.js new file mode 100644 index 000000000000..f3164a2364f9 --- /dev/null +++ b/packages/babel-core/test/fixtures/async/config-file-async-function/plugin.js @@ -0,0 +1,9 @@ +module.exports = function plugin({ types: t }) { + return { + visitor: { + Program(path) { + path.pushContainer("body", t.stringLiteral("success")); + }, + }, + }; +}; diff --git a/packages/babel-core/test/fixtures/async/config-file-promise/babel.config.js b/packages/babel-core/test/fixtures/async/config-file-promise/babel.config.js new file mode 100644 index 000000000000..dffa9f6fdbe1 --- /dev/null +++ b/packages/babel-core/test/fixtures/async/config-file-promise/babel.config.js @@ -0,0 +1,5 @@ +const wait = t => new Promise(r => setTimeout(r, t)); + +module.exports = wait(50).then(() => ({ + plugins: ["./plugin"], +})); diff --git a/packages/babel-core/test/fixtures/async/config-file-promise/plugin.js b/packages/babel-core/test/fixtures/async/config-file-promise/plugin.js new file mode 100644 index 000000000000..f3164a2364f9 --- /dev/null +++ b/packages/babel-core/test/fixtures/async/config-file-promise/plugin.js @@ -0,0 +1,9 @@ +module.exports = function plugin({ types: t }) { + return { + visitor: { + Program(path) { + path.pushContainer("body", t.stringLiteral("success")); + }, + }, + }; +}; diff --git a/packages/babel-core/test/fixtures/async/plugin-inherits/babel.config.js b/packages/babel-core/test/fixtures/async/plugin-inherits/babel.config.js new file mode 100644 index 000000000000..8b5df0db23c0 --- /dev/null +++ b/packages/babel-core/test/fixtures/async/plugin-inherits/babel.config.js @@ -0,0 +1,3 @@ +module.exports = { + plugins: ["./plugin"], +}; diff --git a/packages/babel-core/test/fixtures/async/plugin-inherits/plugin.js b/packages/babel-core/test/fixtures/async/plugin-inherits/plugin.js new file mode 100644 index 000000000000..6f7f0b197f46 --- /dev/null +++ b/packages/babel-core/test/fixtures/async/plugin-inherits/plugin.js @@ -0,0 +1,10 @@ +module.exports = function plugin({ types: t }) { + return { + inherits: require("./plugin2"), + visitor: { + Program(path) { + path.pushContainer("body", t.stringLiteral("success")); + }, + }, + }; +}; diff --git a/packages/babel-core/test/fixtures/async/plugin-inherits/plugin2.js b/packages/babel-core/test/fixtures/async/plugin-inherits/plugin2.js new file mode 100644 index 000000000000..f881463f9814 --- /dev/null +++ b/packages/babel-core/test/fixtures/async/plugin-inherits/plugin2.js @@ -0,0 +1,13 @@ +const wait = t => new Promise(r => setTimeout(r, t)); + +module.exports = async function plugin({ types: t }) { + await wait(50); + + return { + visitor: { + Program(path) { + path.pushContainer("body", t.stringLiteral("success 2")); + }, + }, + }; +}; diff --git a/packages/babel-core/test/fixtures/async/plugin-post/babel.config.js b/packages/babel-core/test/fixtures/async/plugin-post/babel.config.js new file mode 100644 index 000000000000..8b5df0db23c0 --- /dev/null +++ b/packages/babel-core/test/fixtures/async/plugin-post/babel.config.js @@ -0,0 +1,3 @@ +module.exports = { + plugins: ["./plugin"], +}; diff --git a/packages/babel-core/test/fixtures/async/plugin-post/plugin.js b/packages/babel-core/test/fixtures/async/plugin-post/plugin.js new file mode 100644 index 000000000000..8ceebfd644d4 --- /dev/null +++ b/packages/babel-core/test/fixtures/async/plugin-post/plugin.js @@ -0,0 +1,15 @@ +const wait = t => new Promise(r => setTimeout(r, t)); + +module.exports = function plugin({ types: t }) { + return { + async post() { + await wait(50); + }, + + visitor: { + Program(path) { + path.pushContainer("body", t.stringLiteral("success")); + }, + }, + }; +}; diff --git a/packages/babel-core/test/fixtures/async/plugin-pre/babel.config.js b/packages/babel-core/test/fixtures/async/plugin-pre/babel.config.js new file mode 100644 index 000000000000..8b5df0db23c0 --- /dev/null +++ b/packages/babel-core/test/fixtures/async/plugin-pre/babel.config.js @@ -0,0 +1,3 @@ +module.exports = { + plugins: ["./plugin"], +}; diff --git a/packages/babel-core/test/fixtures/async/plugin-pre/plugin.js b/packages/babel-core/test/fixtures/async/plugin-pre/plugin.js new file mode 100644 index 000000000000..d354a0a60fb7 --- /dev/null +++ b/packages/babel-core/test/fixtures/async/plugin-pre/plugin.js @@ -0,0 +1,15 @@ +const wait = t => new Promise(r => setTimeout(r, t)); + +module.exports = function plugin({ types: t }) { + return { + async pre() { + await wait(50); + }, + + visitor: { + Program(path) { + path.pushContainer("body", t.stringLiteral("success")); + }, + }, + }; +}; diff --git a/packages/babel-core/test/fixtures/async/plugin/babel.config.js b/packages/babel-core/test/fixtures/async/plugin/babel.config.js new file mode 100644 index 000000000000..8b5df0db23c0 --- /dev/null +++ b/packages/babel-core/test/fixtures/async/plugin/babel.config.js @@ -0,0 +1,3 @@ +module.exports = { + plugins: ["./plugin"], +}; diff --git a/packages/babel-core/test/fixtures/async/plugin/plugin.js b/packages/babel-core/test/fixtures/async/plugin/plugin.js new file mode 100644 index 000000000000..9777dd80ae42 --- /dev/null +++ b/packages/babel-core/test/fixtures/async/plugin/plugin.js @@ -0,0 +1,13 @@ +const wait = t => new Promise(r => setTimeout(r, t)); + +module.exports = async function plugin({ types: t }) { + await wait(50); + + return { + visitor: { + Program(path) { + path.pushContainer("body", t.stringLiteral("success")); + }, + }, + }; +}; diff --git a/packages/babel-core/test/fixtures/config-loading/preset4.js b/packages/babel-core/test/fixtures/config-loading/preset4.js new file mode 100644 index 000000000000..1698ff05edd1 --- /dev/null +++ b/packages/babel-core/test/fixtures/config-loading/preset4.js @@ -0,0 +1,6 @@ +module.exports = function() { + return { + test: /\.ts$/, + plugins: [] + } +}; diff --git a/packages/babel-core/test/fixtures/config-loading/preset5.js b/packages/babel-core/test/fixtures/config-loading/preset5.js new file mode 100644 index 000000000000..65ecb47f93c8 --- /dev/null +++ b/packages/babel-core/test/fixtures/config-loading/preset5.js @@ -0,0 +1,8 @@ +module.exports = function() { + return { + overrides: [{ + test: /\.ts$/, + plugins: [] + }] + } +}; diff --git a/packages/babel-core/test/fixtures/config/config-files-templates/.babelrc b/packages/babel-core/test/fixtures/config/config-files-templates/.babelrc new file mode 100644 index 000000000000..b445e5d66381 --- /dev/null +++ b/packages/babel-core/test/fixtures/config/config-files-templates/.babelrc @@ -0,0 +1,3 @@ +{ + "comments": true +} diff --git a/packages/babel-core/test/fixtures/config/config-files-templates/.babelrc.cjs b/packages/babel-core/test/fixtures/config/config-files-templates/.babelrc.cjs new file mode 100644 index 000000000000..409f4a98ac90 --- /dev/null +++ b/packages/babel-core/test/fixtures/config/config-files-templates/.babelrc.cjs @@ -0,0 +1,3 @@ +module.exports = { + comments: true +}; diff --git a/packages/babel-core/test/fixtures/config/config-files-templates/.babelrc.js b/packages/babel-core/test/fixtures/config/config-files-templates/.babelrc.js new file mode 100644 index 000000000000..409f4a98ac90 --- /dev/null +++ b/packages/babel-core/test/fixtures/config/config-files-templates/.babelrc.js @@ -0,0 +1,3 @@ +module.exports = { + comments: true +}; diff --git a/packages/babel-core/test/fixtures/config/config-files-templates/.babelrc.json b/packages/babel-core/test/fixtures/config/config-files-templates/.babelrc.json new file mode 100644 index 000000000000..b445e5d66381 --- /dev/null +++ b/packages/babel-core/test/fixtures/config/config-files-templates/.babelrc.json @@ -0,0 +1,3 @@ +{ + "comments": true +} diff --git a/packages/babel-core/test/fixtures/config/config-files-templates/.babelrc.mjs b/packages/babel-core/test/fixtures/config/config-files-templates/.babelrc.mjs new file mode 100644 index 000000000000..7fc8bbfea752 --- /dev/null +++ b/packages/babel-core/test/fixtures/config/config-files-templates/.babelrc.mjs @@ -0,0 +1,8 @@ +// Until Jest supports native mjs, we must simulate it 🤷 + +module.exports = new Promise(resolve => resolve({ + default: { + comments: true + } +})); +module.exports.__esModule = true; diff --git a/packages/babel-core/test/fixtures/config/config-files-templates/babel.config.cjs b/packages/babel-core/test/fixtures/config/config-files-templates/babel.config.cjs new file mode 100644 index 000000000000..409f4a98ac90 --- /dev/null +++ b/packages/babel-core/test/fixtures/config/config-files-templates/babel.config.cjs @@ -0,0 +1,3 @@ +module.exports = { + comments: true +}; diff --git a/packages/babel-core/test/fixtures/config/config-files-templates/babel.config.js b/packages/babel-core/test/fixtures/config/config-files-templates/babel.config.js new file mode 100644 index 000000000000..409f4a98ac90 --- /dev/null +++ b/packages/babel-core/test/fixtures/config/config-files-templates/babel.config.js @@ -0,0 +1,3 @@ +module.exports = { + comments: true +}; diff --git a/packages/babel-core/test/fixtures/config/config-files-templates/babel.config.json b/packages/babel-core/test/fixtures/config/config-files-templates/babel.config.json new file mode 100644 index 000000000000..4b7be6033f68 --- /dev/null +++ b/packages/babel-core/test/fixtures/config/config-files-templates/babel.config.json @@ -0,0 +1,3 @@ +{ + "comments": true +} \ No newline at end of file diff --git a/packages/babel-core/test/fixtures/config/config-files-templates/babel.config.mjs b/packages/babel-core/test/fixtures/config/config-files-templates/babel.config.mjs new file mode 100644 index 000000000000..7fc8bbfea752 --- /dev/null +++ b/packages/babel-core/test/fixtures/config/config-files-templates/babel.config.mjs @@ -0,0 +1,8 @@ +// Until Jest supports native mjs, we must simulate it 🤷 + +module.exports = new Promise(resolve => resolve({ + default: { + comments: true + } +})); +module.exports.__esModule = true; diff --git a/packages/babel-core/test/fixtures/config/config-files/pkg/package.json b/packages/babel-core/test/fixtures/config/config-files-templates/package.json similarity index 100% rename from packages/babel-core/test/fixtures/config/config-files/pkg/package.json rename to packages/babel-core/test/fixtures/config/config-files-templates/package.json diff --git a/packages/babel-core/test/fixtures/config/config-files/babelrc-cjs-error/.babelrc.cjs b/packages/babel-core/test/fixtures/config/config-files/babelrc-cjs-error/.babelrc.cjs new file mode 100644 index 000000000000..accbe7c461f1 --- /dev/null +++ b/packages/babel-core/test/fixtures/config/config-files/babelrc-cjs-error/.babelrc.cjs @@ -0,0 +1,3 @@ +module.exports = function() { + throw new Error("Babelrc threw an error"); +}; diff --git a/packages/babel-core/test/fixtures/config/config-files/babelrc-js/.babelrc.js b/packages/babel-core/test/fixtures/config/config-files/babelrc-js/.babelrc.js deleted file mode 100644 index 37622f0ad309..000000000000 --- a/packages/babel-core/test/fixtures/config/config-files/babelrc-js/.babelrc.js +++ /dev/null @@ -1,3 +0,0 @@ -module.exports = { - comments: true, -}; diff --git a/packages/babel-core/test/fixtures/config/config-files/babelrc-json-error/.babelrc b/packages/babel-core/test/fixtures/config/config-files/babelrc-json-error/.babelrc new file mode 100644 index 000000000000..1d936d04a4e4 --- /dev/null +++ b/packages/babel-core/test/fixtures/config/config-files/babelrc-json-error/.babelrc @@ -0,0 +1 @@ +{45 diff --git a/packages/babel-core/test/fixtures/config/config-files/babelrc-mjs-error/.babelrc.mjs b/packages/babel-core/test/fixtures/config/config-files/babelrc-mjs-error/.babelrc.mjs new file mode 100644 index 000000000000..5a4fdd06a352 --- /dev/null +++ b/packages/babel-core/test/fixtures/config/config-files/babelrc-mjs-error/.babelrc.mjs @@ -0,0 +1,8 @@ +// Until Jest supports native mjs, we must simulate it 🤷 + +module.exports = new Promise(resolve => resolve({ + default: function () { + throw new Error("Babelrc threw an error"); + } +})); +module.exports.__esModule = true; diff --git a/packages/babel-core/test/fixtures/config/config-files/babelrc/.babelrc b/packages/babel-core/test/fixtures/config/config-files/babelrc/.babelrc deleted file mode 100644 index 2f6b10872c8d..000000000000 --- a/packages/babel-core/test/fixtures/config/config-files/babelrc/.babelrc +++ /dev/null @@ -1,3 +0,0 @@ -{ - comments: true, -} diff --git a/packages/babel-core/test/fixtures/config/config-files/both-babelrc/.babelrc b/packages/babel-core/test/fixtures/config/config-files/both-babelrc/.babelrc deleted file mode 100644 index 0967ef424bce..000000000000 --- a/packages/babel-core/test/fixtures/config/config-files/both-babelrc/.babelrc +++ /dev/null @@ -1 +0,0 @@ -{} diff --git a/packages/babel-core/test/fixtures/config/config-files/both-babelrc/.babelrc.js b/packages/babel-core/test/fixtures/config/config-files/both-babelrc/.babelrc.js deleted file mode 100644 index f053ebf7976e..000000000000 --- a/packages/babel-core/test/fixtures/config/config-files/both-babelrc/.babelrc.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = {}; diff --git a/packages/babel-core/test/fixtures/config/config-files/pkg-babelrc-js/.babelrc.js b/packages/babel-core/test/fixtures/config/config-files/pkg-babelrc-js/.babelrc.js deleted file mode 100644 index f053ebf7976e..000000000000 --- a/packages/babel-core/test/fixtures/config/config-files/pkg-babelrc-js/.babelrc.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = {}; diff --git a/packages/babel-core/test/fixtures/config/config-files/pkg-babelrc-js/package.json b/packages/babel-core/test/fixtures/config/config-files/pkg-babelrc-js/package.json deleted file mode 100644 index e25be3ecd260..000000000000 --- a/packages/babel-core/test/fixtures/config/config-files/pkg-babelrc-js/package.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "babel": {} -} diff --git a/packages/babel-core/test/fixtures/config/config-files/pkg-babelrc/.babelrc b/packages/babel-core/test/fixtures/config/config-files/pkg-babelrc/.babelrc deleted file mode 100644 index 0967ef424bce..000000000000 --- a/packages/babel-core/test/fixtures/config/config-files/pkg-babelrc/.babelrc +++ /dev/null @@ -1 +0,0 @@ -{} diff --git a/packages/babel-core/test/fixtures/config/config-files/pkg-babelrc/package.json b/packages/babel-core/test/fixtures/config/config-files/pkg-babelrc/package.json deleted file mode 100644 index e25be3ecd260..000000000000 --- a/packages/babel-core/test/fixtures/config/config-files/pkg-babelrc/package.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "babel": {} -} diff --git a/packages/babel-core/test/fixtures/parse/output.json b/packages/babel-core/test/fixtures/parse/output.json index 06fb684869dc..5c48f0e09836 100644 --- a/packages/babel-core/test/fixtures/parse/output.json +++ b/packages/babel-core/test/fixtures/parse/output.json @@ -2,6 +2,7 @@ "type": "File", "start": 0, "end": 91, + "errors": [], "loc": { "start": { "line": 1, diff --git a/packages/babel-core/test/fixtures/plugins/build-code-frame-error/exec.js b/packages/babel-core/test/fixtures/plugins/build-code-frame-error/exec.js index 3462e87a1932..0b56fb9bfb43 100644 --- a/packages/babel-core/test/fixtures/plugins/build-code-frame-error/exec.js +++ b/packages/babel-core/test/fixtures/plugins/build-code-frame-error/exec.js @@ -1,16 +1,18 @@ -var code = "function f() {}"; -transform(code, { - plugins: [ - function() { - return { - visitor: { - FunctionDeclaration: function(path) { - throw path.buildCodeFrameError("someMsg"); +expect(() => { + var code = "function f() {}"; + transform(code, { + plugins: [ + function() { + return { + visitor: { + FunctionDeclaration: function(path) { + throw path.buildCodeFrameError("someMsg"); + }, }, - }, - }; - }, - ], - // hard to assert on ANSI escape codes - highlightCode: false, -}); + }; + }, + ], + // hard to assert on ANSI escape codes + highlightCode: false, + }); +}).toThrow(/^unknown: someMsg\s+> 1 \| function f\(\) {}/); diff --git a/packages/babel-core/test/fixtures/plugins/build-code-frame-error/options.json b/packages/babel-core/test/fixtures/plugins/build-code-frame-error/options.json deleted file mode 100644 index b24f27d786a8..000000000000 --- a/packages/babel-core/test/fixtures/plugins/build-code-frame-error/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "undefined: someMsg\n> 1 | function f() {}" -} diff --git a/packages/babel-core/test/fixtures/plugins/transform-error/exec.js b/packages/babel-core/test/fixtures/plugins/transform-error/exec.js new file mode 100644 index 000000000000..a5d11f514dea --- /dev/null +++ b/packages/babel-core/test/fixtures/plugins/transform-error/exec.js @@ -0,0 +1,15 @@ +var code = "function f() {}"; +transform(code, { + plugins: [ + function() { + return { + visitor: { + FunctionDeclaration: function(path) { + throw new Error("someMsg"); + }, + }, + }; + }, + ], + filename: "/fake/path/example.js" +}); diff --git a/packages/babel-core/test/fixtures/plugins/transform-error/options.json b/packages/babel-core/test/fixtures/plugins/transform-error/options.json new file mode 100644 index 000000000000..056950478dcf --- /dev/null +++ b/packages/babel-core/test/fixtures/plugins/transform-error/options.json @@ -0,0 +1,4 @@ +{ + "throws": "/fake/path/example.js: someMsg", + "os": ["linux", "darwin"] +} diff --git a/packages/babel-core/test/fixtures/transformation/source-maps/comment-inside-string/input.js b/packages/babel-core/test/fixtures/transformation/source-maps/comment-inside-string/input.js new file mode 100644 index 000000000000..b883f5d7b9a4 --- /dev/null +++ b/packages/babel-core/test/fixtures/transformation/source-maps/comment-inside-string/input.js @@ -0,0 +1,8 @@ +// https://github.com/babel/babel/issues/9790 +const comment = `//# sourceMappingURL=${path.basename( + sourceMapFilename +)}` + +// https://github.com/babel/babel/issues/9956 +this.shadowRoot.innerHTML = ``; diff --git a/packages/babel-core/test/fixtures/transformation/source-maps/comment-inside-string/options.json b/packages/babel-core/test/fixtures/transformation/source-maps/comment-inside-string/options.json new file mode 100644 index 000000000000..0e6084f210d8 --- /dev/null +++ b/packages/babel-core/test/fixtures/transformation/source-maps/comment-inside-string/options.json @@ -0,0 +1,3 @@ +{ + "inputSourceMap": true +} diff --git a/packages/babel-core/test/fixtures/transformation/source-maps/comment-inside-string/output.js b/packages/babel-core/test/fixtures/transformation/source-maps/comment-inside-string/output.js new file mode 100644 index 000000000000..9188ec5abc3b --- /dev/null +++ b/packages/babel-core/test/fixtures/transformation/source-maps/comment-inside-string/output.js @@ -0,0 +1,5 @@ +// https://github.com/babel/babel/issues/9790 +const comment = `//# sourceMappingURL=${path.basename(sourceMapFilename)}`; // https://github.com/babel/babel/issues/9956 + +this.shadowRoot.innerHTML = ``; diff --git a/packages/babel-core/test/fixtures/transformation/source-maps/input-source-map-external/input.js b/packages/babel-core/test/fixtures/transformation/source-maps/input-source-map-external/input.js new file mode 100644 index 000000000000..f7250b67d0b4 --- /dev/null +++ b/packages/babel-core/test/fixtures/transformation/source-maps/input-source-map-external/input.js @@ -0,0 +1,5 @@ +var foo = function () { + return 4; +}; + +//# sourceMappingURL=input.js.map diff --git a/packages/babel-core/test/fixtures/transformation/source-maps/input-source-map-external/input.js.map b/packages/babel-core/test/fixtures/transformation/source-maps/input-source-map-external/input.js.map new file mode 100644 index 000000000000..cb88961ebdc0 --- /dev/null +++ b/packages/babel-core/test/fixtures/transformation/source-maps/input-source-map-external/input.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["original.js"],"names":[],"mappings":"AAAA,UAAU,Y;SAAM,C;CAAC","sourcesContent":["var foo = () => 4;"]} diff --git a/packages/babel-core/test/fixtures/transformation/source-maps/input-source-map-external/options.json b/packages/babel-core/test/fixtures/transformation/source-maps/input-source-map-external/options.json new file mode 100644 index 000000000000..0e6084f210d8 --- /dev/null +++ b/packages/babel-core/test/fixtures/transformation/source-maps/input-source-map-external/options.json @@ -0,0 +1,3 @@ +{ + "inputSourceMap": true +} diff --git a/packages/babel-core/test/fixtures/transformation/source-maps/input-source-map-external/output.js b/packages/babel-core/test/fixtures/transformation/source-maps/input-source-map-external/output.js new file mode 100644 index 000000000000..cf3efeceb306 --- /dev/null +++ b/packages/babel-core/test/fixtures/transformation/source-maps/input-source-map-external/output.js @@ -0,0 +1,3 @@ +var foo = function () { + return 4; +}; diff --git a/packages/babel-core/test/fixtures/transformation/source-maps/input-source-map-external/source-map.json b/packages/babel-core/test/fixtures/transformation/source-maps/input-source-map-external/source-map.json new file mode 100644 index 000000000000..63c01db5fede --- /dev/null +++ b/packages/babel-core/test/fixtures/transformation/source-maps/input-source-map-external/source-map.json @@ -0,0 +1,7 @@ +{ + "mappings": "AAAA,IAAA,GAAA,GAAU,Y;SAAM,C;AAAC,CAAjB", + "names": [], + "sources": ["original.js"], + "sourcesContent": ["var foo = () => 4;"], + "version": 3 +} diff --git a/packages/babel-core/test/option-manager.js b/packages/babel-core/test/option-manager.js index 4a6301ab4777..5533d54c46d1 100644 --- a/packages/babel-core/test/option-manager.js +++ b/packages/babel-core/test/option-manager.js @@ -27,14 +27,19 @@ describe("option-manager", () => { return { plugin, calls }; } - it("should throw if a plugin is repeated", () => { - const { calls, plugin } = makePlugin(); + it("should throw if a plugin is repeated, with information about the repeated plugin", () => { + const { calls, plugin } = makePlugin("my-plugin"); expect(() => { loadOptions({ - plugins: [plugin, plugin], + plugins: [ + [plugin, undefined, "my-plugin"], + [plugin, undefined, "my-plugin"], + ], }); - }).toThrow(/Duplicate plugin\/preset detected/); + }).toThrow( + /Duplicate plugin\/preset detected.*Duplicates detected are.*my-plugin.*my-plugin/ms, + ); expect(calls).toEqual([]); }); @@ -54,7 +59,10 @@ describe("option-manager", () => { const { calls: calls2, plugin: plugin2 } = makePlugin(); loadOptions({ - plugins: [[plugin1, { arg: 1 }], [plugin2, { arg: 2 }, "some-name"]], + plugins: [ + [plugin1, { arg: 1 }], + [plugin2, { arg: 2 }, "some-name"], + ], }); expect(calls1).toEqual([{ arg: 1 }]); expect(calls2).toEqual([{ arg: 2 }]); @@ -69,7 +77,10 @@ describe("option-manager", () => { plugins: [[plugin1, { arg: 1 }]], env: { test: { - plugins: [[plugin1, { arg: 3 }], [plugin2, { arg: 2 }]], + plugins: [ + [plugin1, { arg: 3 }], + [plugin2, { arg: 2 }], + ], }, }, }); @@ -93,7 +104,10 @@ describe("option-manager", () => { const { calls: calls2, plugin: preset2 } = makePlugin(); loadOptions({ - presets: [[preset1, { arg: 1 }], [preset2, { arg: 2 }, "some-name"]], + presets: [ + [preset1, { arg: 1 }], + [preset2, { arg: 2 }, "some-name"], + ], }); expect(calls1).toEqual([{ arg: 1 }]); expect(calls2).toEqual([{ arg: 2 }]); @@ -107,7 +121,10 @@ describe("option-manager", () => { presets: [[preset1, { arg: 1 }]], env: { test: { - presets: [[preset1, { arg: 3 }], [preset2, { arg: 2 }]], + presets: [ + [preset1, { arg: 3 }], + [preset2, { arg: 2 }], + ], }, }, }); @@ -125,7 +142,10 @@ describe("option-manager", () => { presets: [[preset1, { arg: 1 }]], env: { test: { - presets: [[preset1, { arg: 3 }], [preset2, { arg: 2 }]], + presets: [ + [preset1, { arg: 3 }], + [preset2, { arg: 2 }], + ], }, }, }); diff --git a/packages/babel-generator/.npmignore b/packages/babel-generator/.npmignore index f9806945836e..f3b1e0392a0b 100644 --- a/packages/babel-generator/.npmignore +++ b/packages/babel-generator/.npmignore @@ -1,3 +1,4 @@ src test +scripts *.log diff --git a/packages/babel-generator/package.json b/packages/babel-generator/package.json index 815171acf262..b21685f11751 100644 --- a/packages/babel-generator/package.json +++ b/packages/babel-generator/package.json @@ -1,6 +1,6 @@ { "name": "@babel/generator", - "version": "7.5.5", + "version": "7.8.3", "description": "Turns an AST into code.", "author": "Sebastian McKenzie ", "homepage": "https://babeljs.io/", @@ -14,14 +14,13 @@ "lib" ], "dependencies": { - "@babel/types": "^7.5.5", + "@babel/types": "^7.8.3", "jsesc": "^2.5.1", "lodash": "^4.17.13", - "source-map": "^0.5.0", - "trim-right": "^1.0.1" + "source-map": "^0.5.0" }, "devDependencies": { - "@babel/helper-fixtures": "^7.5.5", - "@babel/parser": "^7.5.5" + "@babel/helper-fixtures": "^7.8.3", + "@babel/parser": "^7.8.3" } } diff --git a/packages/babel-generator/src/buffer.js b/packages/babel-generator/src/buffer.js index fd64201a921b..d9af9a167a14 100644 --- a/packages/babel-generator/src/buffer.js +++ b/packages/babel-generator/src/buffer.js @@ -1,5 +1,4 @@ import type SourceMap from "./source-map"; -import trimRight from "trim-right"; const SPACES_RE = /^[ \t]+$/; @@ -43,7 +42,7 @@ export default class Buffer { const result = { // Whatever trim is used here should not execute a regex against the // source string since it may be arbitrarily large after all transformations - code: trimRight(this._buf.join("")), + code: this._buf.join("").trimRight(), map: null, rawMappings: map && map.getRawMappings(), }; diff --git a/packages/babel-generator/src/generators/classes.js b/packages/babel-generator/src/generators/classes.js index e8c62339a6d2..1713293369d4 100644 --- a/packages/babel-generator/src/generators/classes.js +++ b/packages/babel-generator/src/generators/classes.js @@ -71,26 +71,8 @@ export function ClassBody(node: Object) { export function ClassProperty(node: Object) { this.printJoin(node.decorators, node); + this.tsPrintClassMemberModifiers(node, /* isField */ true); - if (node.accessibility) { - // TS - this.word(node.accessibility); - this.space(); - } - if (node.static) { - this.word("static"); - this.space(); - } - if (node.abstract) { - // TS - this.word("abstract"); - this.space(); - } - if (node.readonly) { - // TS - this.word("readonly"); - this.space(); - } if (node.computed) { this.token("["); this.print(node.key, node); @@ -148,23 +130,6 @@ export function ClassPrivateMethod(node: Object) { export function _classMethodHead(node) { this.printJoin(node.decorators, node); - - if (node.accessibility) { - // TS - this.word(node.accessibility); - this.space(); - } - - if (node.abstract) { - // TS - this.word("abstract"); - this.space(); - } - - if (node.static) { - this.word("static"); - this.space(); - } - + this.tsPrintClassMemberModifiers(node, /* isField */ false); this._methodHead(node); } diff --git a/packages/babel-generator/src/generators/expressions.js b/packages/babel-generator/src/generators/expressions.js index 4f9a525bd05e..62c3aca83bc0 100644 --- a/packages/babel-generator/src/generators/expressions.js +++ b/packages/babel-generator/src/generators/expressions.js @@ -264,3 +264,8 @@ export function PrivateName(node: Object) { this.token("#"); this.print(node.id, node); } + +export function V8IntrinsicIdentifier(node: Object) { + this.token("%"); + this.word(node.name); +} diff --git a/packages/babel-generator/src/generators/flow.js b/packages/babel-generator/src/generators/flow.js index 225428b00801..9a8441ba827c 100644 --- a/packages/babel-generator/src/generators/flow.js +++ b/packages/babel-generator/src/generators/flow.js @@ -134,6 +134,92 @@ export function DeclareExportAllDeclaration(/*node: Object*/) { ExportAllDeclaration.apply(this, arguments); } +export function EnumDeclaration(node: Object) { + const { id, body } = node; + this.word("enum"); + this.space(); + this.print(id, node); + this.print(body, node); +} + +function enumExplicitType( + context: Object, + name: string, + hasExplicitType: boolean, +) { + if (hasExplicitType) { + context.space(); + context.word("of"); + context.space(); + context.word(name); + } + context.space(); +} + +function enumBody(context: Object, node: Object) { + const { members } = node; + context.token("{"); + context.indent(); + context.newline(); + for (const member of members) { + context.print(member, node); + context.newline(); + } + context.dedent(); + context.token("}"); +} + +export function EnumBooleanBody(node: Object) { + const { explicitType } = node; + enumExplicitType(this, "boolean", explicitType); + enumBody(this, node); +} + +export function EnumNumberBody(node: Object) { + const { explicitType } = node; + enumExplicitType(this, "number", explicitType); + enumBody(this, node); +} + +export function EnumStringBody(node: Object) { + const { explicitType } = node; + enumExplicitType(this, "string", explicitType); + enumBody(this, node); +} + +export function EnumSymbolBody(node: Object) { + enumExplicitType(this, "symbol", true); + enumBody(this, node); +} + +export function EnumDefaultedMember(node: Object) { + const { id } = node; + this.print(id, node); + this.token(","); +} + +function enumInitializedMember(context: Object, node: Object) { + const { id, init } = node; + context.print(id, node); + context.space(); + context.token("="); + context.space(); + context.print(init, node); + context.token(","); +} + +export function EnumBooleanMember(node: Object) { + enumInitializedMember(this, node); +} + +export function EnumNumberMember(node: Object) { + enumInitializedMember(this, node); +} + +export function EnumStringMember(node: Object) { + enumInitializedMember(this, node); +} + function FlowExportDeclaration(node: Object) { if (node.declaration) { const declar = node.declaration; diff --git a/packages/babel-generator/src/generators/types.js b/packages/babel-generator/src/generators/types.js index fdd090dd4113..fbad28e03b30 100644 --- a/packages/babel-generator/src/generators/types.js +++ b/packages/babel-generator/src/generators/types.js @@ -65,9 +65,9 @@ export function ObjectProperty(node: Object) { // shorthand! if ( node.shorthand && - (t.isIdentifier(node.key) && - t.isIdentifier(node.value) && - node.key.name === node.value.name) + t.isIdentifier(node.key) && + t.isIdentifier(node.value) && + node.key.name === node.value.name ) { return; } diff --git a/packages/babel-generator/src/generators/typescript.js b/packages/babel-generator/src/generators/typescript.js index 68d31f3d43f3..39c580d74d2f 100644 --- a/packages/babel-generator/src/generators/typescript.js +++ b/packages/babel-generator/src/generators/typescript.js @@ -129,6 +129,9 @@ export function TSIndexSignature(node) { export function TSAnyKeyword() { this.word("any"); } +export function TSBigIntKeyword() { + this.word("bigint"); +} export function TSUnknownKeyword() { this.word("unknown"); } @@ -194,11 +197,17 @@ export function TSTypeReference(node) { } export function TSTypePredicate(node) { + if (node.asserts) { + this.word("asserts"); + this.space(); + } this.print(node.parameterName); - this.space(); - this.word("is"); - this.space(); - this.print(node.typeAnnotation.typeAnnotation); + if (node.typeAnnotation) { + this.space(); + this.word("is"); + this.space(); + this.print(node.typeAnnotation.typeAnnotation); + } } export function TSTypeQuery(node) { @@ -547,3 +556,26 @@ export function tsPrintSignatureDeclarationBase(node) { this.token(")"); this.print(node.typeAnnotation, node); } + +export function tsPrintClassMemberModifiers(node, isField) { + if (isField && node.declare) { + this.word("declare"); + this.space(); + } + if (node.accessibility) { + this.word(node.accessibility); + this.space(); + } + if (node.static) { + this.word("static"); + this.space(); + } + if (node.abstract) { + this.word("abstract"); + this.space(); + } + if (isField && node.readonly) { + this.word("readonly"); + this.space(); + } +} diff --git a/packages/babel-generator/src/index.js b/packages/babel-generator/src/index.js index 4e7399d4bb47..9d288fb0f3cf 100644 --- a/packages/babel-generator/src/index.js +++ b/packages/babel-generator/src/index.js @@ -70,7 +70,8 @@ function normalizeOptions(code, opts): Format { format.shouldPrintComment || (value => format.comments || - (value.indexOf("@license") >= 0 || value.indexOf("@preserve") >= 0)); + value.indexOf("@license") >= 0 || + value.indexOf("@preserve") >= 0); } if (format.compact === "auto") { diff --git a/packages/babel-generator/src/node/index.js b/packages/babel-generator/src/node/index.js index 394e63b5cbdd..faf700dc681b 100644 --- a/packages/babel-generator/src/node/index.js +++ b/packages/babel-generator/src/node/index.js @@ -97,5 +97,18 @@ export function needsParens(node, parent, printStack) { if (isOrHasCallExpression(node)) return true; } + /* this check is for NullishCoalescing being used with LogicalOperators like && and || + * For example when someone creates an ast programmaticaly like this + * t.logicalExpression( + * "??", + * t.logicalExpression("||", t.identifier("a"), t.identifier("b")), + * t.identifier("c"), + * ); + * In the example above the AST is equivalent to writing a || b ?? c + * This is incorrect because NullishCoalescing when used with LogicalExpressions should have parenthesis + * The correct syntax is (a || b) ?? c, that is why we need parenthesis in this case + */ + if (t.isLogicalExpression(node) && parent.operator === "??") return true; + return find(expandedParens, node, parent, printStack); } diff --git a/packages/babel-generator/src/node/parentheses.js b/packages/babel-generator/src/node/parentheses.js index 8c38fa627239..1222f2d34a84 100644 --- a/packages/babel-generator/src/node/parentheses.js +++ b/packages/babel-generator/src/node/parentheses.js @@ -2,6 +2,7 @@ import * as t from "@babel/types"; const PRECEDENCE = { "||": 0, + "??": 0, "&&": 1, "|": 2, "^": 3, @@ -35,14 +36,22 @@ export function NullableTypeAnnotation(node: Object, parent: Object): boolean { return t.isArrayTypeAnnotation(parent); } -export function FunctionTypeAnnotation(node: Object, parent: Object): boolean { +export function FunctionTypeAnnotation( + node: Object, + parent: Object, + printStack: Array, +): boolean { return ( // (() => A) | (() => B) t.isUnionTypeAnnotation(parent) || // (() => A) & (() => B) t.isIntersectionTypeAnnotation(parent) || // (() => A)[] - t.isArrayTypeAnnotation(parent) + t.isArrayTypeAnnotation(parent) || + // (A: T): (T => T[]) => B => [A, B] + (t.isTypeAnnotation(parent) && + // Check grandparent + t.isArrowFunctionExpression(printStack[printStack.length - 3])) ); } diff --git a/packages/babel-generator/src/source-map.js b/packages/babel-generator/src/source-map.js index d03628a5eb53..9c58d8b8c64b 100644 --- a/packages/babel-generator/src/source-map.js +++ b/packages/babel-generator/src/source-map.js @@ -24,14 +24,20 @@ export default class SourceMap { const code = this._code; if (typeof code === "string") { - map.setSourceContent(this._opts.sourceFileName, code); + map.setSourceContent( + this._opts.sourceFileName.replace(/\\/g, "/"), + code, + ); } else if (typeof code === "object") { Object.keys(code).forEach(sourceFileName => { - map.setSourceContent(sourceFileName, code[sourceFileName]); + map.setSourceContent( + sourceFileName.replace(/\\/g, "/"), + code[sourceFileName], + ); }); } - this._rawMappings.forEach(map.addMapping, map); + this._rawMappings.forEach(mapping => map.addMapping(mapping), map); } return this._cachedMap.toJSON(); @@ -83,7 +89,10 @@ export default class SourceMap { line: generatedLine, column: generatedColumn, }, - source: line == null ? undefined : filename || this._opts.sourceFileName, + source: + line == null + ? undefined + : (filename || this._opts.sourceFileName).replace(/\\/g, "/"), original: line == null ? undefined diff --git a/packages/babel-generator/test/fixtures/comments/create-parenthesized-expressions/options.json b/packages/babel-generator/test/fixtures/comments/create-parenthesized-expressions/options.json index 7c49b91ec9b2..ffc84e30b554 100644 --- a/packages/babel-generator/test/fixtures/comments/create-parenthesized-expressions/options.json +++ b/packages/babel-generator/test/fixtures/comments/create-parenthesized-expressions/options.json @@ -1,3 +1,3 @@ { - "parserOpts": {"createParenthesizedExpressions": true} + "parserOpts": { "createParenthesizedExpressions": true } } diff --git a/packages/babel-generator/test/fixtures/flow/arrow-functions/input.js b/packages/babel-generator/test/fixtures/flow/arrow-functions/input.js index a3d11b136d6b..5719c2dbf087 100644 --- a/packages/babel-generator/test/fixtures/flow/arrow-functions/input.js +++ b/packages/babel-generator/test/fixtures/flow/arrow-functions/input.js @@ -5,3 +5,4 @@ const bar4 = x => {}; const bar5 = (x): string => {}; const bar6 = (x: number) => {}; const bar7 = (x) => {}; +const bar8 = (x: T): (T => T[]) => y => [x, y]; diff --git a/packages/babel-generator/test/fixtures/flow/arrow-functions/output.js b/packages/babel-generator/test/fixtures/flow/arrow-functions/output.js index 8b1f78020541..d132971e4bcf 100644 --- a/packages/babel-generator/test/fixtures/flow/arrow-functions/output.js +++ b/packages/babel-generator/test/fixtures/flow/arrow-functions/output.js @@ -10,4 +10,6 @@ const bar5 = (x): string => {}; const bar6 = (x: number) => {}; -const bar7 = (x) => {}; \ No newline at end of file +const bar7 = (x) => {}; + +const bar8 = (x: T): ((T) => T[]) => y => [x, y]; diff --git a/packages/babel-generator/test/fixtures/flow/declare-statements/input.js b/packages/babel-generator/test/fixtures/flow/declare-statements/input.js index a0874c4d44a4..3a2d2aa6a74e 100644 --- a/packages/babel-generator/test/fixtures/flow/declare-statements/input.js +++ b/packages/babel-generator/test/fixtures/flow/declare-statements/input.js @@ -11,13 +11,13 @@ declare class A { static [ indexer: number]: string } declare class A { static () : number } declare class B { (): number } declare class A mixins B, C {} -declare type A = string +declare type A1 = string declare type T = { [k:string]: U } -declare type B = { +declare type B1 = { fn?: (foo: string) => void, } -declare interface I { foo: string } -declare interface I { foo: T } +declare interface I1 { foo: string } +declare interface I2 { foo: T } declare module.exports: { foo: string } declare opaque type Foo: Bar; declare opaque type ID; diff --git a/packages/babel-generator/test/fixtures/flow/declare-statements/output.js b/packages/babel-generator/test/fixtures/flow/declare-statements/output.js index 7be6ae40cec7..c5f087d49ab0 100644 --- a/packages/babel-generator/test/fixtures/flow/declare-statements/output.js +++ b/packages/babel-generator/test/fixtures/flow/declare-statements/output.js @@ -22,17 +22,17 @@ declare class B { (): number } declare class A mixins B, C {} -declare type A = string; +declare type A1 = string; declare type T = { [k: string]: U }; -declare type B = { +declare type B1 = { fn?: (foo: string) => void }; -declare interface I { +declare interface I1 { foo: string } -declare interface I { +declare interface I2 { foo: T } declare module.exports: { diff --git a/packages/babel-generator/test/fixtures/flow/def-site-variance/input.js b/packages/babel-generator/test/fixtures/flow/def-site-variance/input.js index 9f00e80993d1..0891ba212de5 100644 --- a/packages/babel-generator/test/fixtures/flow/def-site-variance/input.js +++ b/packages/babel-generator/test/fixtures/flow/def-site-variance/input.js @@ -5,10 +5,10 @@ type T2 = { +p: T }; type T3 = { -p: T }; type T4 = { +[k:K]: V }; type T5 = { -[k:K]: V }; -interface I { +p: T } -interface I { -p: T } -interface I { +[k:K]: V } -interface I { -[k:K]: V } +interface I1 { +p: T } +interface I2 { -p: T } +interface I3 { +[k:K]: V } +interface I4 { -[k:K]: V } declare class I { +p: T } declare class I { -p: T } declare class I { +[k:K]: V } diff --git a/packages/babel-generator/test/fixtures/flow/def-site-variance/output.js b/packages/babel-generator/test/fixtures/flow/def-site-variance/output.js index 5c2b69d1a6dd..66dd195d22e1 100644 --- a/packages/babel-generator/test/fixtures/flow/def-site-variance/output.js +++ b/packages/babel-generator/test/fixtures/flow/def-site-variance/output.js @@ -15,16 +15,16 @@ type T4 = { type T5 = { -[k: K]: V }; -interface I { +interface I1 { +p: T } -interface I { +interface I2 { -p: T } -interface I { +interface I3 { +[k: K]: V } -interface I { +interface I4 { -[k: K]: V } declare class I { diff --git a/packages/babel-generator/test/fixtures/flow/enum-declaration/input.js b/packages/babel-generator/test/fixtures/flow/enum-declaration/input.js new file mode 100644 index 000000000000..f59944f78e18 --- /dev/null +++ b/packages/babel-generator/test/fixtures/flow/enum-declaration/input.js @@ -0,0 +1,36 @@ +enum E { + A = true, + B = false, +} +enum E of boolean { + A = true, + B = false, +} +enum E { + A = 1, + B = 2, +} +enum E of number { + A = 1, + B = 2, +} +enum E { + A, + B, +} +enum E of string { + A, + B, +} +enum E { + A = "a", + B = "b", +} +enum E of string { + A = "a", + B = "b", +} +enum E of symbol { + A, + B, +} diff --git a/packages/babel-generator/test/fixtures/flow/enum-declaration/options.json b/packages/babel-generator/test/fixtures/flow/enum-declaration/options.json new file mode 100644 index 000000000000..53fd48c051cb --- /dev/null +++ b/packages/babel-generator/test/fixtures/flow/enum-declaration/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["flow", { "enums": true }]] +} diff --git a/packages/babel-generator/test/fixtures/flow/enum-declaration/output.js b/packages/babel-generator/test/fixtures/flow/enum-declaration/output.js new file mode 100644 index 000000000000..f59944f78e18 --- /dev/null +++ b/packages/babel-generator/test/fixtures/flow/enum-declaration/output.js @@ -0,0 +1,36 @@ +enum E { + A = true, + B = false, +} +enum E of boolean { + A = true, + B = false, +} +enum E { + A = 1, + B = 2, +} +enum E of number { + A = 1, + B = 2, +} +enum E { + A, + B, +} +enum E of string { + A, + B, +} +enum E { + A = "a", + B = "b", +} +enum E of string { + A = "a", + B = "b", +} +enum E of symbol { + A, + B, +} diff --git a/packages/babel-generator/test/fixtures/flow/internal-slot/input.js b/packages/babel-generator/test/fixtures/flow/internal-slot/input.js index b00d3bd76f22..6056da54458a 100644 --- a/packages/babel-generator/test/fixtures/flow/internal-slot/input.js +++ b/packages/babel-generator/test/fixtures/flow/internal-slot/input.js @@ -1,7 +1,7 @@ declare class C { static [[foo]]: T } declare class C { [[foo]]: T } -interface I { [[foo]]: X } -interface I { [[foo]](): X } +interface I1 { [[foo]]: X } +interface I2 { [[foo]](): X } type T1 = { [[foo]]: X } type T2 = { [[foo]](): X } type T3 = { [[foo]]?: X } diff --git a/packages/babel-generator/test/fixtures/flow/internal-slot/output.js b/packages/babel-generator/test/fixtures/flow/internal-slot/output.js index 2a48fb9f186a..3b2b5ece1a23 100644 --- a/packages/babel-generator/test/fixtures/flow/internal-slot/output.js +++ b/packages/babel-generator/test/fixtures/flow/internal-slot/output.js @@ -4,10 +4,10 @@ declare class C { declare class C { [[foo]]: T } -interface I { +interface I1 { [[foo]]: X } -interface I { +interface I2 { [[foo]]() => X } type T1 = { diff --git a/packages/babel-generator/test/fixtures/flow/iterator-inside-interface/input.js b/packages/babel-generator/test/fixtures/flow/iterator-inside-interface/input.js index dab9a962acf7..7e5fb6309d97 100644 --- a/packages/babel-generator/test/fixtures/flow/iterator-inside-interface/input.js +++ b/packages/babel-generator/test/fixtures/flow/iterator-inside-interface/input.js @@ -1,7 +1,7 @@ -interface A { +interface A1 { @@iterator(): Iterator; } -interface A { +interface A2 { @@asyncIterator(): Iterator; } diff --git a/packages/babel-generator/test/fixtures/flow/iterator-inside-interface/output.js b/packages/babel-generator/test/fixtures/flow/iterator-inside-interface/output.js index ef726ab2fc5b..57b22ad84495 100644 --- a/packages/babel-generator/test/fixtures/flow/iterator-inside-interface/output.js +++ b/packages/babel-generator/test/fixtures/flow/iterator-inside-interface/output.js @@ -1,6 +1,6 @@ -interface A { +interface A1 { @@iterator(): Iterator } -interface A { +interface A2 { @@asyncIterator(): Iterator } \ No newline at end of file diff --git a/packages/babel-generator/test/fixtures/misc/V8IntrinsicIdentifier/input.js b/packages/babel-generator/test/fixtures/misc/V8IntrinsicIdentifier/input.js new file mode 100644 index 000000000000..613a26cd98c7 --- /dev/null +++ b/packages/babel-generator/test/fixtures/misc/V8IntrinsicIdentifier/input.js @@ -0,0 +1 @@ +%DebugPrint(foo); diff --git a/packages/babel-generator/test/fixtures/misc/V8IntrinsicIdentifier/options.json b/packages/babel-generator/test/fixtures/misc/V8IntrinsicIdentifier/options.json new file mode 100644 index 000000000000..609458c2c65e --- /dev/null +++ b/packages/babel-generator/test/fixtures/misc/V8IntrinsicIdentifier/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["v8intrinsic"] +} diff --git a/packages/babel-generator/test/fixtures/misc/V8IntrinsicIdentifier/output.js b/packages/babel-generator/test/fixtures/misc/V8IntrinsicIdentifier/output.js new file mode 100644 index 000000000000..613a26cd98c7 --- /dev/null +++ b/packages/babel-generator/test/fixtures/misc/V8IntrinsicIdentifier/output.js @@ -0,0 +1 @@ +%DebugPrint(foo); diff --git a/packages/babel-generator/test/fixtures/parentheses/nullish-coalescing/input.js b/packages/babel-generator/test/fixtures/parentheses/nullish-coalescing/input.js new file mode 100644 index 000000000000..2e5054151af1 --- /dev/null +++ b/packages/babel-generator/test/fixtures/parentheses/nullish-coalescing/input.js @@ -0,0 +1,2 @@ +const foo = 'test' +console.log((foo ?? '') == '') \ No newline at end of file diff --git a/packages/babel-generator/test/fixtures/parentheses/nullish-coalescing/output.js b/packages/babel-generator/test/fixtures/parentheses/nullish-coalescing/output.js new file mode 100644 index 000000000000..767c8f1b02d4 --- /dev/null +++ b/packages/babel-generator/test/fixtures/parentheses/nullish-coalescing/output.js @@ -0,0 +1,2 @@ +const foo = 'test'; +console.log((foo ?? '') == ''); \ No newline at end of file diff --git a/packages/babel-generator/test/fixtures/types/ClassBody-ClassProperty/input.js b/packages/babel-generator/test/fixtures/types/ClassBody-ClassProperty/input.js index 6256942ca5c5..87462c83f603 100644 --- a/packages/babel-generator/test/fixtures/types/ClassBody-ClassProperty/input.js +++ b/packages/babel-generator/test/fixtures/types/ClassBody-ClassProperty/input.js @@ -28,9 +28,9 @@ class Foo { foo = 0; bar = 1; #foo; - #foo = 1; - static #foo; - static #foo = Foo.#foo; + #foo2 = 1; + static #foo3; + static #foo4 = Foo.#foo; } class A1 { diff --git a/packages/babel-generator/test/fixtures/types/ClassBody-ClassProperty/output.js b/packages/babel-generator/test/fixtures/types/ClassBody-ClassProperty/output.js index 905fe31bdbfb..9970811aabad 100644 --- a/packages/babel-generator/test/fixtures/types/ClassBody-ClassProperty/output.js +++ b/packages/babel-generator/test/fixtures/types/ClassBody-ClassProperty/output.js @@ -27,9 +27,9 @@ class Foo { foo = 0; bar = 1; #foo; - #foo = 1; - static #foo; - static #foo = Foo.#foo; + #foo2 = 1; + static #foo3; + static #foo4 = Foo.#foo; } class A1 { @@ -69,4 +69,4 @@ class A6 { class A7 { static get static() {} -} +} \ No newline at end of file diff --git a/packages/babel-generator/test/fixtures/types/ClassBody-MethodDefinition/input.js b/packages/babel-generator/test/fixtures/types/ClassBody-MethodDefinition/input.js index ae3f4b33c003..67ccba8fc28b 100644 --- a/packages/babel-generator/test/fixtures/types/ClassBody-MethodDefinition/input.js +++ b/packages/babel-generator/test/fixtures/types/ClassBody-MethodDefinition/input.js @@ -6,13 +6,13 @@ class Foo { set foo(bar) {} async #foo() {} - #foo() {} - get #foo() {} - set #foo(bar) {} - * #foo() {} - async * #foo() {} - get #bar() {} - set #baz(taz) {} + #foo2() {} + get #foo3() {} + set #foo3(bar) {} + * #foo4() {} + async * #foo5() {} + get #bar6() {} + set #baz6(taz) {} static async foo() {} static foo() {} @@ -23,13 +23,13 @@ class Foo { static * foo() {} static async * foo() {} - static #foo() {} - static async #foo() {} + static #foo7() {} + static async #foo8() {} static ["foo"]() {} - static get #foo() {} - static set #foo(taz) {} - static * #foo() {} - static async * #foo() {} + static get #foo9() {} + static set #foo9(taz) {} + static * #foo10() {} + static async * #foo11() {} get () {} diff --git a/packages/babel-generator/test/fixtures/types/ClassBody-MethodDefinition/output.js b/packages/babel-generator/test/fixtures/types/ClassBody-MethodDefinition/output.js index 24f3e9229c84..7f66930a5422 100644 --- a/packages/babel-generator/test/fixtures/types/ClassBody-MethodDefinition/output.js +++ b/packages/babel-generator/test/fixtures/types/ClassBody-MethodDefinition/output.js @@ -11,19 +11,19 @@ class Foo { async #foo() {} - #foo() {} + #foo2() {} - get #foo() {} + get #foo3() {} - set #foo(bar) {} + set #foo3(bar) {} - *#foo() {} + *#foo4() {} - async *#foo() {} + async *#foo5() {} - get #bar() {} + get #bar6() {} - set #baz(taz) {} + set #baz6(taz) {} static async foo() {} @@ -41,19 +41,19 @@ class Foo { static async *foo() {} - static #foo() {} + static #foo7() {} - static async #foo() {} + static async #foo8() {} static ["foo"]() {} - static get #foo() {} + static get #foo9() {} - static set #foo(taz) {} + static set #foo9(taz) {} - static *#foo() {} + static *#foo10() {} - static async *#foo() {} + static async *#foo11() {} get() {} diff --git a/packages/babel-generator/test/fixtures/types/LogicalExpression/input.js b/packages/babel-generator/test/fixtures/types/LogicalExpression/input.js index 08cae4f71732..3ff8c4d4040e 100644 --- a/packages/babel-generator/test/fixtures/types/LogicalExpression/input.js +++ b/packages/babel-generator/test/fixtures/types/LogicalExpression/input.js @@ -1,4 +1,5 @@ foo ||bar; (x => x)|| bar; (function a(x){return x;})|| 2; -0||(function(){return alpha;}); \ No newline at end of file +0||(function(){return alpha;}); +a ?? (b || c); diff --git a/packages/babel-generator/test/fixtures/types/LogicalExpression/output.js b/packages/babel-generator/test/fixtures/types/LogicalExpression/output.js index a27aa9ac1833..994dc9ec1b59 100644 --- a/packages/babel-generator/test/fixtures/types/LogicalExpression/output.js +++ b/packages/babel-generator/test/fixtures/types/LogicalExpression/output.js @@ -7,4 +7,6 @@ foo || bar; 0 || function () { return alpha; -}; \ No newline at end of file +}; + +a ?? (b || c); diff --git a/packages/babel-generator/test/fixtures/typescript/arrow-function-assertion/input.js b/packages/babel-generator/test/fixtures/typescript/arrow-function-assertion/input.js new file mode 100644 index 000000000000..67e467cda8ed --- /dev/null +++ b/packages/babel-generator/test/fixtures/typescript/arrow-function-assertion/input.js @@ -0,0 +1,2 @@ +(x: any): asserts x => true; +(x: any): asserts x is boolean => true; \ No newline at end of file diff --git a/packages/babel-generator/test/fixtures/typescript/arrow-function-assertion/output.js b/packages/babel-generator/test/fixtures/typescript/arrow-function-assertion/output.js new file mode 100644 index 000000000000..b0befa69dc24 --- /dev/null +++ b/packages/babel-generator/test/fixtures/typescript/arrow-function-assertion/output.js @@ -0,0 +1,3 @@ +(x: any): asserts x => true; + +(x: any): asserts x is boolean => true; \ No newline at end of file diff --git a/packages/babel-generator/test/fixtures/typescript/class-field-declare/input.js b/packages/babel-generator/test/fixtures/typescript/class-field-declare/input.js new file mode 100644 index 000000000000..0e524a92bb8a --- /dev/null +++ b/packages/babel-generator/test/fixtures/typescript/class-field-declare/input.js @@ -0,0 +1,5 @@ +class A { + declare foo; + declare bar: string; + declare readonly bax: number; +} diff --git a/packages/babel-generator/test/fixtures/typescript/class-field-declare/options.json b/packages/babel-generator/test/fixtures/typescript/class-field-declare/options.json new file mode 100644 index 000000000000..9f3a0c2c0ff1 --- /dev/null +++ b/packages/babel-generator/test/fixtures/typescript/class-field-declare/options.json @@ -0,0 +1,4 @@ +{ + "sourceType": "module", + "plugins": ["typescript", "classProperties"] +} diff --git a/packages/babel-generator/test/fixtures/typescript/class-field-declare/output.js b/packages/babel-generator/test/fixtures/typescript/class-field-declare/output.js new file mode 100644 index 000000000000..d1d7b1be56aa --- /dev/null +++ b/packages/babel-generator/test/fixtures/typescript/class-field-declare/output.js @@ -0,0 +1,5 @@ +class A { + declare foo; + declare bar: string; + declare readonly bax: number; +} \ No newline at end of file diff --git a/packages/babel-generator/test/fixtures/typescript/function-assertion/input.js b/packages/babel-generator/test/fixtures/typescript/function-assertion/input.js new file mode 100644 index 000000000000..17db65c5a77f --- /dev/null +++ b/packages/babel-generator/test/fixtures/typescript/function-assertion/input.js @@ -0,0 +1,2 @@ +function f(x: any): asserts x {} +(function(x: any): asserts x is boolean {}) diff --git a/packages/babel-generator/test/fixtures/typescript/function-assertion/output.js b/packages/babel-generator/test/fixtures/typescript/function-assertion/output.js new file mode 100644 index 000000000000..b55c84620cc9 --- /dev/null +++ b/packages/babel-generator/test/fixtures/typescript/function-assertion/output.js @@ -0,0 +1,3 @@ +function f(x: any): asserts x {} + +(function (x: any): asserts x is boolean {}); \ No newline at end of file diff --git a/packages/babel-generator/test/index.js b/packages/babel-generator/test/index.js index 80bee85f9eaf..e247686e2488 100644 --- a/packages/babel-generator/test/index.js +++ b/packages/babel-generator/test/index.js @@ -197,7 +197,7 @@ describe("generation", function() { const id2 = fn.body.body[0].expression; id2.name += "2"; - id2.loc.identiferName = "bar"; + id2.loc.identifierName = "bar"; const generated = generate( ast, @@ -298,6 +298,31 @@ describe("generation", function() { }); describe("programmatic generation", function() { + it("should add parenthesis when NullishCoalescing is used along with ||", function() { + // https://github.com/babel/babel/issues/10260 + const nullishCoalesc = t.logicalExpression( + "??", + t.logicalExpression("||", t.identifier("a"), t.identifier("b")), + t.identifier("c"), + ); + const output = generate(nullishCoalesc).code; + expect(output).toBe(`(a || b) ?? c`); + }); + + it("should add parenthesis when NullishCoalesing is used with &&", function() { + const nullishCoalesc = t.logicalExpression( + "??", + t.identifier("a"), + t.logicalExpression( + "&&", + t.identifier("b"), + t.logicalExpression("&&", t.identifier("c"), t.identifier("d")), + ), + ); + const output = generate(nullishCoalesc).code; + expect(output).toBe(`a ?? (b && c && d)`); + }); + it("numeric member expression", function() { // Should not generate `0.foo` const mem = t.memberExpression( diff --git a/packages/babel-helper-annotate-as-pure/package.json b/packages/babel-helper-annotate-as-pure/package.json index 543b4fbf16ab..657e41d35e5f 100644 --- a/packages/babel-helper-annotate-as-pure/package.json +++ b/packages/babel-helper-annotate-as-pure/package.json @@ -1,6 +1,6 @@ { "name": "@babel/helper-annotate-as-pure", - "version": "7.0.0", + "version": "7.8.3", "description": "Helper function to annotate paths and nodes with #__PURE__ comment", "repository": "https://github.com/babel/babel/tree/master/packages/babel-helper-annotate-as-pure", "license": "MIT", @@ -9,6 +9,6 @@ }, "main": "lib/index.js", "dependencies": { - "@babel/types": "^7.0.0" + "@babel/types": "^7.8.3" } } diff --git a/packages/babel-helper-bindify-decorators/package.json b/packages/babel-helper-bindify-decorators/package.json index c7904cd201ea..005e4d816c36 100644 --- a/packages/babel-helper-bindify-decorators/package.json +++ b/packages/babel-helper-bindify-decorators/package.json @@ -1,6 +1,6 @@ { "name": "@babel/helper-bindify-decorators", - "version": "7.1.0", + "version": "7.8.3", "description": "Helper function to bindify decorators", "repository": "https://github.com/babel/babel/tree/master/packages/babel-helper-bindify-decorators", "license": "MIT", @@ -9,7 +9,7 @@ }, "main": "lib/index.js", "dependencies": { - "@babel/traverse": "^7.1.0", - "@babel/types": "^7.0.0" + "@babel/traverse": "^7.8.3", + "@babel/types": "^7.8.3" } } diff --git a/packages/babel-helper-builder-binary-assignment-operator-visitor/package.json b/packages/babel-helper-builder-binary-assignment-operator-visitor/package.json index 3e292cc12d6f..e22874ab1118 100644 --- a/packages/babel-helper-builder-binary-assignment-operator-visitor/package.json +++ b/packages/babel-helper-builder-binary-assignment-operator-visitor/package.json @@ -1,6 +1,6 @@ { "name": "@babel/helper-builder-binary-assignment-operator-visitor", - "version": "7.1.0", + "version": "7.8.3", "description": "Helper function to build binary assignment operator visitors", "repository": "https://github.com/babel/babel/tree/master/packages/babel-helper-builder-binary-assignment-operator-visitor", "license": "MIT", @@ -9,7 +9,7 @@ }, "main": "lib/index.js", "dependencies": { - "@babel/helper-explode-assignable-expression": "^7.1.0", - "@babel/types": "^7.0.0" + "@babel/helper-explode-assignable-expression": "^7.8.3", + "@babel/types": "^7.8.3" } } diff --git a/packages/babel-helper-builder-react-jsx/package.json b/packages/babel-helper-builder-react-jsx/package.json index 7b13e4b4753a..25007d3fce69 100644 --- a/packages/babel-helper-builder-react-jsx/package.json +++ b/packages/babel-helper-builder-react-jsx/package.json @@ -1,6 +1,6 @@ { "name": "@babel/helper-builder-react-jsx", - "version": "7.3.0", + "version": "7.8.3", "description": "Helper function to build react jsx", "repository": "https://github.com/babel/babel/tree/master/packages/babel-helper-builder-react-jsx", "license": "MIT", @@ -9,7 +9,7 @@ }, "main": "lib/index.js", "dependencies": { - "@babel/types": "^7.3.0", + "@babel/types": "^7.8.3", "esutils": "^2.0.0" } } diff --git a/packages/babel-helper-builder-react-jsx/src/index.js b/packages/babel-helper-builder-react-jsx/src/index.js index 3602ecb8496e..64b136923f45 100644 --- a/packages/babel-helper-builder-react-jsx/src/index.js +++ b/packages/babel-helper-builder-react-jsx/src/index.js @@ -87,13 +87,15 @@ You can turn on the 'throwIfNamespace' flag to bypass this warning.`, function convertAttribute(node) { const value = convertAttributeValue(node.value || t.booleanLiteral(true)); + if (t.isJSXSpreadAttribute(node)) { + return t.spreadElement(node.argument); + } + if (t.isStringLiteral(value) && !t.isJSXExpressionContainer(node.value)) { value.value = value.value.replace(/\n\s+/g, " "); // "raw" JSXText should not be used from a StringLiteral because it needs to be escaped. - if (value.extra && value.extra.raw) { - delete value.extra.raw; - } + delete value.extra?.raw; } if (t.isJSXNamespacedName(node.name)) { @@ -172,6 +174,14 @@ You can turn on the 'throwIfNamespace' flag to bypass this warning.`, let _props = []; const objs = []; + const { useSpread = false } = file.opts; + if (typeof useSpread !== "boolean") { + throw new Error( + "transform-react-jsx currently only accepts a boolean option for " + + "useSpread (defaults to false)", + ); + } + const useBuiltIns = file.opts.useBuiltIns || false; if (typeof useBuiltIns !== "boolean") { throw new Error( @@ -180,6 +190,18 @@ You can turn on the 'throwIfNamespace' flag to bypass this warning.`, ); } + if (useSpread && useBuiltIns) { + throw new Error( + "transform-react-jsx currently only accepts useBuiltIns or useSpread " + + "but not both", + ); + } + + if (useSpread) { + const props = attribs.map(convertAttribute); + return t.objectExpression(props); + } + while (attribs.length) { const prop = attribs.shift(); if (t.isJSXSpreadAttribute(prop)) { diff --git a/packages/babel-helper-call-delegate/package.json b/packages/babel-helper-call-delegate/package.json index 3e7fd81bcf40..d67016d847e0 100644 --- a/packages/babel-helper-call-delegate/package.json +++ b/packages/babel-helper-call-delegate/package.json @@ -1,6 +1,6 @@ { "name": "@babel/helper-call-delegate", - "version": "7.4.4", + "version": "7.8.3", "description": "Helper function to call delegate", "repository": "https://github.com/babel/babel/tree/master/packages/babel-helper-call-delegate", "license": "MIT", @@ -9,8 +9,8 @@ }, "main": "lib/index.js", "dependencies": { - "@babel/helper-hoist-variables": "^7.4.4", - "@babel/traverse": "^7.4.4", - "@babel/types": "^7.4.4" + "@babel/helper-hoist-variables": "^7.8.3", + "@babel/traverse": "^7.8.3", + "@babel/types": "^7.8.3" } } diff --git a/packages/babel-plugin-syntax-async-generators/.npmignore b/packages/babel-helper-compilation-targets/.npmignore similarity index 100% rename from packages/babel-plugin-syntax-async-generators/.npmignore rename to packages/babel-helper-compilation-targets/.npmignore diff --git a/packages/babel-helper-compilation-targets/package.json b/packages/babel-helper-compilation-targets/package.json new file mode 100644 index 000000000000..effdff376a60 --- /dev/null +++ b/packages/babel-helper-compilation-targets/package.json @@ -0,0 +1,33 @@ +{ + "name": "@babel/helper-compilation-targets", + "version": "7.8.3", + "author": "The Babel Team (https://babeljs.io/team)", + "license": "MIT", + "description": "Engine compat data used in @babel/preset-env", + "repository": "https://github.com/babel/babel/tree/master/packages/babel-helper-compilation-targets", + "main": "lib/index.js", + "exports": { + ".": "./lib/index.js" + }, + "publishConfig": { + "access": "public" + }, + "keywords": [ + "babel", + "babel-plugin" + ], + "dependencies": { + "@babel/compat-data": "^7.8.1", + "browserslist": "^4.8.2", + "invariant": "^2.2.4", + "levenary": "^1.1.0", + "semver": "^5.5.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0" + }, + "devDependencies": { + "@babel/core": "^7.8.3", + "@babel/helper-plugin-test-runner": "^7.8.3" + } +} diff --git a/packages/babel-helper-compilation-targets/src/debug.js b/packages/babel-helper-compilation-targets/src/debug.js new file mode 100644 index 000000000000..aec840d2eba2 --- /dev/null +++ b/packages/babel-helper-compilation-targets/src/debug.js @@ -0,0 +1,40 @@ +// @flow + +import semver from "semver"; +import { prettifyVersion } from "./pretty"; +import { + semverify, + isUnreleasedVersion, + getLowestImplementedVersion, +} from "./utils"; +import type { Targets } from "./types"; + +export function getInclusionReasons( + item: string, + targetVersions: Targets, + list: { [key: string]: Targets }, +) { + const minVersions = list[item] || {}; + + return Object.keys(targetVersions).reduce((result, env) => { + const minVersion = getLowestImplementedVersion(minVersions, env); + const targetVersion = targetVersions[env]; + + if (!minVersion) { + result[env] = prettifyVersion(targetVersion); + } else { + const minIsUnreleased = isUnreleasedVersion(minVersion, env); + const targetIsUnreleased = isUnreleasedVersion(targetVersion, env); + + if ( + !targetIsUnreleased && + (minIsUnreleased || + semver.lt(targetVersion.toString(), semverify(minVersion))) + ) { + result[env] = prettifyVersion(targetVersion); + } + } + + return result; + }, {}); +} diff --git a/packages/babel-helper-compilation-targets/src/filter-items.js b/packages/babel-helper-compilation-targets/src/filter-items.js new file mode 100644 index 000000000000..ac8809433bb9 --- /dev/null +++ b/packages/babel-helper-compilation-targets/src/filter-items.js @@ -0,0 +1,111 @@ +// @flow + +import semver from "semver"; + +import pluginsCompatData from "@babel/compat-data/plugins"; + +import type { Targets } from "./types"; +import { + getLowestImplementedVersion, + isUnreleasedVersion, + semverify, +} from "./utils"; + +export function targetsSupported(target: Targets, support: Targets) { + const targetEnvironments = Object.keys(target); + + if (targetEnvironments.length === 0) { + return false; + } + + const unsupportedEnvironments = targetEnvironments.filter(environment => { + const lowestImplementedVersion = getLowestImplementedVersion( + support, + environment, + ); + + // Feature is not implemented in that environment + if (!lowestImplementedVersion) { + return true; + } + + const lowestTargetedVersion = target[environment]; + + // If targets has unreleased value as a lowest version, then don't require a plugin. + if (isUnreleasedVersion(lowestTargetedVersion, environment)) { + return false; + } + + // Include plugin if it is supported in the unreleased environment, which wasn't specified in targets + if (isUnreleasedVersion(lowestImplementedVersion, environment)) { + return true; + } + + if (!semver.valid(lowestTargetedVersion.toString())) { + throw new Error( + `Invalid version passed for target "${environment}": "${lowestTargetedVersion}". ` + + "Versions must be in semver format (major.minor.patch)", + ); + } + + return semver.gt( + semverify(lowestImplementedVersion), + lowestTargetedVersion.toString(), + ); + }); + + return unsupportedEnvironments.length === 0; +} + +export function isRequired( + name: string, + targets: Targets, + { + compatData = pluginsCompatData, + includes, + excludes, + }: { + compatData?: { [feature: string]: Targets }, + includes?: Set, + excludes?: Set, + } = {}, +) { + if (excludes && excludes.has(name)) return false; + if (includes && includes.has(name)) return true; + return !targetsSupported(targets, compatData[name]); +} + +export default function filterItems( + list: { [feature: string]: Targets }, + includes: Set, + excludes: Set, + targets: Targets, + defaultIncludes: Array | null, + defaultExcludes?: Array | null, + pluginSyntaxMap?: Map, +) { + const result = new Set(); + const options = { compatData: list, includes, excludes }; + + for (const item in list) { + if (isRequired(item, targets, options)) { + result.add(item); + } else if (pluginSyntaxMap) { + const shippedProposalsSyntax = pluginSyntaxMap.get(item); + + if (shippedProposalsSyntax) { + result.add(shippedProposalsSyntax); + } + } + } + + if (defaultIncludes) { + defaultIncludes.forEach(item => !excludes.has(item) && result.add(item)); + } + + if (defaultExcludes) { + defaultExcludes.forEach(item => !includes.has(item) && result.delete(item)); + } + + return result; +} diff --git a/packages/babel-helper-compilation-targets/src/index.js b/packages/babel-helper-compilation-targets/src/index.js new file mode 100644 index 000000000000..747eb431211c --- /dev/null +++ b/packages/babel-helper-compilation-targets/src/index.js @@ -0,0 +1,256 @@ +// @flow + +import browserslist from "browserslist"; +import findSuggestion from "levenary"; +import invariant from "invariant"; +import browserModulesData from "@babel/compat-data/native-modules"; + +import { + semverify, + semverMin, + isUnreleasedVersion, + getLowestUnreleased, +} from "./utils"; +import { browserNameMap } from "./targets"; +import { TargetNames } from "./options"; +import type { Targets } from "./types"; + +export type { Targets }; + +export { prettifyTargets } from "./pretty"; +export { getInclusionReasons } from "./debug"; +export { default as filterItems, isRequired } from "./filter-items"; +export { unreleasedLabels } from "./targets"; + +const browserslistDefaults = browserslist.defaults; + +const validBrowserslistTargets = [ + ...Object.keys(browserslist.data), + ...Object.keys(browserslist.aliases), +]; + +function objectToBrowserslist(object: Targets): Array { + return Object.keys(object).reduce((list, targetName) => { + if (validBrowserslistTargets.indexOf(targetName) >= 0) { + const targetVersion = object[targetName]; + return list.concat(`${targetName} ${targetVersion}`); + } + return list; + }, []); +} + +function validateTargetNames(targets: Targets): void { + const validTargets = Object.keys(TargetNames); + for (const target in targets) { + if (!TargetNames[target]) { + throw new Error( + `Invalid Option: '${target}' is not a valid target + Maybe you meant to use '${findSuggestion(target, validTargets)}'?`, + ); + } + } +} + +export function isBrowsersQueryValid( + browsers: string | Array | Targets, +): boolean { + return typeof browsers === "string" || Array.isArray(browsers); +} + +function validateBrowsers(browsers) { + invariant( + typeof browsers === "undefined" || isBrowsersQueryValid(browsers), + `Invalid Option: '${browsers}' is not a valid browserslist query`, + ); + + return browsers; +} + +function mergeBrowsers(fromQuery: Targets, fromTarget: Targets) { + return Object.keys(fromTarget).reduce((queryObj, targKey) => { + if (targKey !== TargetNames.browsers) { + queryObj[targKey] = fromTarget[targKey]; + } + return queryObj; + }, fromQuery); +} + +function getLowestVersions(browsers: Array): Targets { + return browsers.reduce((all: Object, browser: string): Object => { + const [browserName, browserVersion] = browser.split(" "); + const normalizedBrowserName = browserNameMap[browserName]; + + if (!normalizedBrowserName) { + return all; + } + + try { + // Browser version can return as "10.0-10.2" + const splitVersion = browserVersion.split("-")[0].toLowerCase(); + const isSplitUnreleased = isUnreleasedVersion(splitVersion, browserName); + + if (!all[normalizedBrowserName]) { + all[normalizedBrowserName] = isSplitUnreleased + ? splitVersion + : semverify(splitVersion); + return all; + } + + const version = all[normalizedBrowserName]; + const isUnreleased = isUnreleasedVersion(version, browserName); + + if (isUnreleased && isSplitUnreleased) { + all[normalizedBrowserName] = getLowestUnreleased( + version, + splitVersion, + browserName, + ); + } else if (isUnreleased) { + all[normalizedBrowserName] = semverify(splitVersion); + } else if (!isUnreleased && !isSplitUnreleased) { + const parsedBrowserVersion = semverify(splitVersion); + + all[normalizedBrowserName] = semverMin(version, parsedBrowserVersion); + } + } catch (e) {} + + return all; + }, {}); +} + +function outputDecimalWarning(decimalTargets: Array): void { + if (!decimalTargets || !decimalTargets.length) { + return; + } + + console.log("Warning, the following targets are using a decimal version:"); + console.log(""); + decimalTargets.forEach(({ target, value }) => + console.log(` ${target}: ${value}`), + ); + console.log(""); + console.log( + "We recommend using a string for minor/patch versions to avoid numbers like 6.10", + ); + console.log("getting parsed as 6.1, which can lead to unexpected behavior."); + console.log(""); +} + +function semverifyTarget(target, value) { + try { + return semverify(value); + } catch (error) { + throw new Error( + `Invalid Option: '${value}' is not a valid value for 'targets.${target}'.`, + ); + } +} + +const targetParserMap = { + __default(target, value) { + const version = isUnreleasedVersion(value, target) + ? value.toLowerCase() + : semverifyTarget(target, value); + return [target, version]; + }, + + // Parse `node: true` and `node: "current"` to version + node(target, value) { + const parsed = + value === true || value === "current" + ? process.versions.node + : semverifyTarget(target, value); + return [target, parsed]; + }, +}; + +type ParsedResult = { + targets: Targets, + decimalWarnings: Array, +}; + +export default function getTargets( + targets: Object = {}, + options: Object = {}, +): Targets { + const targetOpts: Targets = {}; + + validateTargetNames(targets); + + // `esmodules` as a target indicates the specific set of browsers supporting ES Modules. + // These values OVERRIDE the `browsers` field. + if (targets.esmodules) { + const supportsESModules = browserModulesData["es6.module"]; + targets.browsers = Object.keys(supportsESModules) + .map(browser => `${browser} ${supportsESModules[browser]}`) + .join(", "); + } + + // Parse browsers target via browserslist + const browsersquery = validateBrowsers(targets.browsers); + + const hasTargets = Object.keys(targets).length > 0; + const shouldParseBrowsers = !!targets.browsers; + const shouldSearchForConfig = + !options.ignoreBrowserslistConfig && !hasTargets; + + if (shouldParseBrowsers || shouldSearchForConfig) { + // If no targets are passed, we need to overwrite browserslist's defaults + // so that we enable all transforms (acting like the now deprecated + // preset-latest). + // + // Note, if browserslist resolves the config (ex. package.json), then usage + // of `defaults` in queries will be different since we don't want to break + // the behavior of "no targets is the same as preset-latest". + if (!hasTargets) { + browserslist.defaults = objectToBrowserslist(targets); + } + + const browsers = browserslist(browsersquery, { + path: options.configPath, + mobileToDesktop: true, + }); + + const queryBrowsers = getLowestVersions(browsers); + targets = mergeBrowsers(queryBrowsers, targets); + + // Reset browserslist defaults + browserslist.defaults = browserslistDefaults; + } + + // Parse remaining targets + const parsed = Object.keys(targets) + .filter(value => value !== TargetNames.esmodules) + .sort() + .reduce( + (results: ParsedResult, target: string): ParsedResult => { + if (target !== TargetNames.browsers) { + const value = targets[target]; + + // Warn when specifying minor/patch as a decimal + if (typeof value === "number" && value % 1 !== 0) { + results.decimalWarnings.push({ target, value }); + } + + // Check if we have a target parser? + const parser = targetParserMap[target] || targetParserMap.__default; + const [parsedTarget, parsedValue] = parser(target, value); + + if (parsedValue) { + // Merge (lowest wins) + results.targets[parsedTarget] = parsedValue; + } + } + + return results; + }, + { + targets: targetOpts, + decimalWarnings: [], + }, + ); + + outputDecimalWarning(parsed.decimalWarnings); + + return parsed.targets; +} diff --git a/packages/babel-helper-compilation-targets/src/options.js b/packages/babel-helper-compilation-targets/src/options.js new file mode 100644 index 000000000000..eadc8dbd43c2 --- /dev/null +++ b/packages/babel-helper-compilation-targets/src/options.js @@ -0,0 +1,20 @@ +// @flow + +export const TargetNames = { + esmodules: "esmodules", + node: "node", + browsers: "browsers", + chrome: "chrome", + opera: "opera", + edge: "edge", + firefox: "firefox", + safari: "safari", + ie: "ie", + ios: "ios", + android: "android", + electron: "electron", + samsung: "samsung", + + // deprecated + uglify: "uglify", +}; diff --git a/packages/babel-helper-compilation-targets/src/pretty.js b/packages/babel-helper-compilation-targets/src/pretty.js new file mode 100644 index 000000000000..bc8bdd96c148 --- /dev/null +++ b/packages/babel-helper-compilation-targets/src/pretty.js @@ -0,0 +1,36 @@ +import semver from "semver"; +import { unreleasedLabels } from "./targets"; + +export function prettifyVersion(version: string) { + if (typeof version !== "string") { + return version; + } + + const parts = [semver.major(version)]; + const minor = semver.minor(version); + const patch = semver.patch(version); + + if (minor || patch) { + parts.push(minor); + } + + if (patch) { + parts.push(patch); + } + + return parts.join("."); +} + +export function prettifyTargets(targets: Targets): Targets { + return Object.keys(targets).reduce((results, target) => { + let value = targets[target]; + + const unreleasedLabel = unreleasedLabels[target]; + if (typeof value === "string" && unreleasedLabel !== value) { + value = prettifyVersion(value); + } + + results[target] = value; + return results; + }, {}); +} diff --git a/packages/babel-helper-compilation-targets/src/targets.js b/packages/babel-helper-compilation-targets/src/targets.js new file mode 100644 index 000000000000..401d7904a995 --- /dev/null +++ b/packages/babel-helper-compilation-targets/src/targets.js @@ -0,0 +1,20 @@ +export const unreleasedLabels = { + safari: "tp", +}; + +export const browserNameMap = { + and_chr: "chrome", + and_ff: "firefox", + android: "android", + chrome: "chrome", + edge: "edge", + firefox: "firefox", + ie: "ie", + ie_mob: "ie", + ios_saf: "ios", + node: "node", + op_mob: "opera", + opera: "opera", + safari: "safari", + samsung: "samsung", +}; diff --git a/packages/babel-helper-compilation-targets/src/types.js b/packages/babel-helper-compilation-targets/src/types.js new file mode 100644 index 000000000000..28b4c2b3f34d --- /dev/null +++ b/packages/babel-helper-compilation-targets/src/types.js @@ -0,0 +1,19 @@ +// @flow + +// Targets +export type Target = + | "node" + | "chrome" + | "opera" + | "edge" + | "firefox" + | "safari" + | "ie" + | "ios" + | "android" + | "electron" + | "samsung"; + +export type Targets = { + [target: Target]: string, +}; diff --git a/packages/babel-helper-compilation-targets/src/utils.js b/packages/babel-helper-compilation-targets/src/utils.js new file mode 100644 index 000000000000..31eeae8c8e23 --- /dev/null +++ b/packages/babel-helper-compilation-targets/src/utils.js @@ -0,0 +1,64 @@ +// @flow + +import invariant from "invariant"; +import semver from "semver"; + +import { unreleasedLabels } from "./targets"; +import type { Target, Targets } from "./types"; + +const versionRegExp = /^(\d+|\d+.\d+)$/; + +export function semverMin(first: ?string, second: string): string { + return first && semver.lt(first, second) ? first : second; +} + +// Convert version to a semver value. +// 2.5 -> 2.5.0; 1 -> 1.0.0; +export function semverify(version: number | string): string { + if (typeof version === "string" && semver.valid(version)) { + return version; + } + + invariant( + typeof version === "number" || + (typeof version === "string" && versionRegExp.test(version)), + `'${version}' is not a valid version`, + ); + + const split = version.toString().split("."); + while (split.length < 3) { + split.push("0"); + } + return split.join("."); +} + +export function isUnreleasedVersion( + version: string | number, + env: string, +): boolean { + const unreleasedLabel = unreleasedLabels[env]; + return ( + !!unreleasedLabel && unreleasedLabel === version.toString().toLowerCase() + ); +} + +export function getLowestUnreleased(a: string, b: string, env: string): string { + const unreleasedLabel = unreleasedLabels[env]; + const hasUnreleased = [a, b].some(item => item === unreleasedLabel); + if (hasUnreleased) { + return a === hasUnreleased ? b : a || b; + } + return semverMin(a, b); +} + +export function getLowestImplementedVersion( + plugin: Targets, + environment: Target, +): string { + const result = plugin[environment]; + // When Android support data is absent, use Chrome data as fallback + if (!result && environment === "android") { + return plugin.chrome; + } + return result; +} diff --git a/packages/babel-helper-compilation-targets/test/pretty.spec.js b/packages/babel-helper-compilation-targets/test/pretty.spec.js new file mode 100644 index 000000000000..6164cde8e918 --- /dev/null +++ b/packages/babel-helper-compilation-targets/test/pretty.spec.js @@ -0,0 +1,32 @@ +import { prettifyTargets, prettifyVersion } from "../lib/pretty"; + +describe("pretty", () => { + describe("prettifyVersion", () => { + it("returns", () => { + expect(prettifyVersion(true)).toBe(true); + expect(prettifyVersion("0.16.0")).toBe("0.16"); + expect(prettifyVersion("1.0.0")).toBe("1"); + expect(prettifyVersion("1.1.0")).toBe("1.1"); + expect(prettifyVersion("1.0.2")).toBe("1.0.2"); + expect(prettifyVersion("1.2.3")).toBe("1.2.3"); + }); + }); + + describe("prettifyTargets", () => { + it("returns", () => { + expect(prettifyTargets({})).toEqual({}); + + expect( + prettifyTargets({ + chrome: "54.0.0", + electron: "1.6.0", + node: "0.12.0", + }), + ).toEqual({ + chrome: "54", + electron: "1.6", + node: "0.12", + }); + }); + }); +}); diff --git a/packages/babel-preset-env/test/targets-parser.spec.js b/packages/babel-helper-compilation-targets/test/targets-parser.spec.js similarity index 99% rename from packages/babel-preset-env/test/targets-parser.spec.js rename to packages/babel-helper-compilation-targets/test/targets-parser.spec.js index 7b9f669d2d01..adc0aa647e80 100644 --- a/packages/babel-preset-env/test/targets-parser.spec.js +++ b/packages/babel-helper-compilation-targets/test/targets-parser.spec.js @@ -1,5 +1,5 @@ import browserslist from "browserslist"; -import getTargets from "../lib/targets-parser"; +import getTargets from ".."; describe("getTargets", () => { it("parses", () => { diff --git a/packages/babel-helper-compilation-targets/test/targets-supported.js b/packages/babel-helper-compilation-targets/test/targets-supported.js new file mode 100644 index 000000000000..fd018172ef29 --- /dev/null +++ b/packages/babel-helper-compilation-targets/test/targets-supported.js @@ -0,0 +1,82 @@ +"use strict"; + +const { targetsSupported } = require("../lib/filter-items"); + +describe("targetsSupported", () => { + const MAX_VERSION = `${Number.MAX_SAFE_INTEGER}.0.0`; + + it("returns false if no targets are specified", () => { + expect(targetsSupported({}, {})).toBe(false); + }); + + it("returns false if plugin feature is not implemented in one or more targets", () => { + let targets; + const plugin = { + edge: false, + firefox: 45, + chrome: 49, + }; + + targets = { + chrome: MAX_VERSION, + firefox: MAX_VERSION, + }; + expect(targetsSupported(targets, plugin)).toBe(true); + + targets = { + edge: "12", + }; + expect(targetsSupported(targets, plugin)).toBe(false); + }); + + it("returns true if plugin feature is implemented by lower than target", () => { + const plugin = { + chrome: 49, + }; + const targets = { + chrome: MAX_VERSION, + }; + + expect(targetsSupported(targets, plugin)).toBe(true); + }); + + it("returns true if plugin feature is implemented is equal to target", () => { + const plugin = { + chrome: 49, + }; + const targets = { + chrome: "49.0.0", + }; + expect(targetsSupported(targets, plugin)).toBe(true); + }); + + it("returns false if plugin feature is implemented is greater than target", () => { + const plugin = { + chrome: 50, + }; + const targets = { + chrome: "49.0.0", + }; + expect(targetsSupported(targets, plugin)).toBe(false); + }); + + it("returns when target is a decimal", () => { + const plugin = { + node: 6.9, + }; + const targets = { + node: "6.10.0", + }; + expect(targetsSupported(targets, plugin)).toBe(true); + }); + + it("throws an error if target version is invalid", () => { + const plugin = { + chrome: 50, + }; + const targets = { + chrome: 55, + }; + expect(() => targetsSupported(targets, plugin)).toThrow(); + }); +}); diff --git a/packages/babel-helper-compilation-targets/test/utils.spec.js b/packages/babel-helper-compilation-targets/test/utils.spec.js new file mode 100644 index 000000000000..77068400663d --- /dev/null +++ b/packages/babel-helper-compilation-targets/test/utils.spec.js @@ -0,0 +1,20 @@ +import { semverify } from "../lib/utils"; + +describe("utils", () => { + describe("semverify", () => { + it("returns", () => { + expect(semverify("1")).toBe("1.0.0"); + expect(semverify("1.0")).toBe("1.0.0"); + expect(semverify("1.0.0")).toBe("1.0.0"); + expect(semverify(1)).toBe("1.0.0"); + expect(semverify(1.2)).toBe("1.2.0"); + }); + + it("throws", () => { + const invalidSemver = () => { + semverify("invalid"); + }; + expect(invalidSemver).toThrow(); + }); + }); +}); diff --git a/packages/babel-helper-create-class-features-plugin/package.json b/packages/babel-helper-create-class-features-plugin/package.json index a5c46704a7db..c0fc980303c7 100644 --- a/packages/babel-helper-create-class-features-plugin/package.json +++ b/packages/babel-helper-create-class-features-plugin/package.json @@ -1,6 +1,6 @@ { "name": "@babel/helper-create-class-features-plugin", - "version": "7.5.5", + "version": "7.8.3", "author": "The Babel Team (https://babeljs.io/team)", "license": "MIT", "description": "Compile class public and private fields, private methods and decorators to ES6", @@ -14,18 +14,18 @@ "babel-plugin" ], "dependencies": { - "@babel/helper-function-name": "^7.1.0", - "@babel/helper-member-expression-to-functions": "^7.5.5", - "@babel/helper-optimise-call-expression": "^7.0.0", - "@babel/helper-plugin-utils": "^7.0.0", - "@babel/helper-replace-supers": "^7.5.5", - "@babel/helper-split-export-declaration": "^7.4.4" + "@babel/helper-function-name": "^7.8.3", + "@babel/helper-member-expression-to-functions": "^7.8.3", + "@babel/helper-optimise-call-expression": "^7.8.3", + "@babel/helper-plugin-utils": "^7.8.3", + "@babel/helper-replace-supers": "^7.8.3", + "@babel/helper-split-export-declaration": "^7.8.3" }, "peerDependencies": { "@babel/core": "^7.0.0" }, "devDependencies": { - "@babel/core": "^7.5.5", - "@babel/helper-plugin-test-runner": "^7.0.0" + "@babel/core": "^7.8.3", + "@babel/helper-plugin-test-runner": "^7.8.3" } } diff --git a/packages/babel-helper-create-class-features-plugin/src/features.js b/packages/babel-helper-create-class-features-plugin/src/features.js index fffc0d0014e0..4fc528bff185 100644 --- a/packages/babel-helper-create-class-features-plugin/src/features.js +++ b/packages/babel-helper-create-class-features-plugin/src/features.js @@ -66,12 +66,6 @@ export function verifyUsedFeatures(path, file) { if (!hasFeature(file, FEATURES.privateMethods)) { throw path.buildCodeFrameError("Class private methods are not enabled."); } - - if (path.node.static && path.node.kind !== "method") { - throw path.buildCodeFrameError( - "@babel/plugin-class-features doesn't support class static private accessors yet.", - ); - } } if ( diff --git a/packages/babel-helper-create-class-features-plugin/src/fields.js b/packages/babel-helper-create-class-features-plugin/src/fields.js index c6fb3da40ded..167e894cae33 100644 --- a/packages/babel-helper-create-class-features-plugin/src/fields.js +++ b/packages/babel-helper-create-class-features-plugin/src/fields.js @@ -5,6 +5,8 @@ import ReplaceSupers, { import memberExpressionToFunctions from "@babel/helper-member-expression-to-functions"; import optimiseCall from "@babel/helper-optimise-call-expression"; +import * as ts from "./typescript"; + export function buildPrivateNamesMap(props) { const privateNamesMap = new Map(); for (const prop of props) { @@ -44,6 +46,7 @@ export function buildPrivateNamesNodes(privateNamesMap, loose, state) { // because static fields are directly assigned to a variable in the // buildPrivateStaticFieldInitSpec function. const { id, static: isStatic, method: isMethod, getId, setId } = value; + const isAccessor = getId || setId; if (loose) { initNodes.push( template.statement.ast` @@ -51,7 +54,7 @@ export function buildPrivateNamesNodes(privateNamesMap, loose, state) { `, ); } else if (isMethod && !isStatic) { - if (getId || setId) { + if (isAccessor) { initNodes.push(template.statement.ast`var ${id} = new WeakMap();`); } else { initNodes.push(template.statement.ast`var ${id} = new WeakSet();`); @@ -140,11 +143,13 @@ const privateNameHandlerSpec = { getId, setId, } = privateNamesMap.get(name); + const isAccessor = getId || setId; if (isStatic) { - const helperName = isMethod - ? "classStaticPrivateMethodGet" - : "classStaticPrivateFieldSpecGet"; + const helperName = + isMethod && !isAccessor + ? "classStaticPrivateMethodGet" + : "classStaticPrivateFieldSpecGet"; return t.callExpression(file.addHelper(helperName), [ this.receiver(member), @@ -154,7 +159,7 @@ const privateNameHandlerSpec = { } if (isMethod) { - if (getId || setId) { + if (isAccessor) { return t.callExpression(file.addHelper("classPrivateFieldGet"), [ this.receiver(member), t.cloneNode(id), @@ -180,12 +185,15 @@ const privateNameHandlerSpec = { static: isStatic, method: isMethod, setId, + getId, } = privateNamesMap.get(name); + const isAccessor = getId || setId; if (isStatic) { - const helperName = isMethod - ? "classStaticPrivateMethodSet" - : "classStaticPrivateFieldSpecSet"; + const helperName = + isMethod && !isAccessor + ? "classStaticPrivateMethodSet" + : "classStaticPrivateFieldSpecSet"; return t.callExpression(file.addHelper(helperName), [ this.receiver(member), @@ -300,9 +308,30 @@ function buildPrivateInstanceFieldInitSpec(ref, prop, privateNamesMap) { } function buildPrivateStaticFieldInitSpec(prop, privateNamesMap) { - const { id } = privateNamesMap.get(prop.node.key.id.name); - const value = prop.node.value || prop.scope.buildUndefinedNode(); + const privateName = privateNamesMap.get(prop.node.key.id.name); + const { id, getId, setId, initAdded } = privateName; + const isAccessor = getId || setId; + + if (!prop.isProperty() && (initAdded || !isAccessor)) return; + if (isAccessor) { + privateNamesMap.set(prop.node.key.id.name, { + ...privateName, + initAdded: true, + }); + + return template.statement.ast` + var ${id.name} = { + // configurable is false by default + // enumerable is false by default + // writable is false by default + get: ${getId ? getId.name : prop.scope.buildUndefinedNode()}, + set: ${setId ? setId.name : prop.scope.buildUndefinedNode()} + } + `; + } + + const value = prop.node.value || prop.scope.buildUndefinedNode(); return template.statement.ast` var ${id} = { // configurable is false by default @@ -328,76 +357,44 @@ function buildPrivateMethodInitLoose(ref, prop, privateNamesMap) { }); `; } - - if (getId || setId) { + const isAccessor = getId || setId; + if (isAccessor) { privateNamesMap.set(prop.node.key.id.name, { ...privateName, initAdded: true, }); - if (getId && setId) { - return template.statement.ast` - Object.defineProperty(${ref}, ${id}, { - // configurable is false by default - // enumerable is false by default - // writable is false by default - get: ${getId.name}, - set: ${setId.name} - }); - `; - } else if (getId && !setId) { - return template.statement.ast` - Object.defineProperty(${ref}, ${id}, { - // configurable is false by default - // enumerable is false by default - // writable is false by default - get: ${getId.name} - }); - `; - } else if (!getId && setId) { - return template.statement.ast` - Object.defineProperty(${ref}, ${id}, { - // configurable is false by default - // enumerable is false by default - // writable is false by default - set: ${setId.name} - }); - `; - } + return template.statement.ast` + Object.defineProperty(${ref}, ${id}, { + // configurable is false by default + // enumerable is false by default + // writable is false by default + get: ${getId ? getId.name : prop.scope.buildUndefinedNode()}, + set: ${setId ? setId.name : prop.scope.buildUndefinedNode()} + }); + `; } } function buildPrivateInstanceMethodInitSpec(ref, prop, privateNamesMap) { const privateName = privateNamesMap.get(prop.node.key.id.name); const { id, getId, setId, initAdded } = privateName; + if (initAdded) return; - if (getId || setId) { + const isAccessor = getId || setId; + if (isAccessor) { privateNamesMap.set(prop.node.key.id.name, { ...privateName, initAdded: true, }); - if (getId && setId) { - return template.statement.ast` - ${id}.set(${ref}, { - get: ${getId.name}, - set: ${setId.name} - }); - `; - } else if (getId && !setId) { - return template.statement.ast` - ${id}.set(${ref}, { - get: ${getId.name} - }); - `; - } else if (!getId && setId) { - return template.statement.ast` - ${id}.set(${ref}, { - set: ${setId.name} - }); - `; - } + return template.statement.ast` + ${id}.set(${ref}, { + get: ${getId ? getId.name : prop.scope.buildUndefinedNode()}, + set: ${setId ? setId.name : prop.scope.buildUndefinedNode()} + }); + `; } return template.statement.ast`${id}.add(${ref})`; } @@ -429,7 +426,29 @@ function buildPublicFieldInitSpec(ref, prop, state) { } function buildPrivateStaticMethodInitLoose(ref, prop, state, privateNamesMap) { - const { id, methodId } = privateNamesMap.get(prop.node.key.id.name); + const privateName = privateNamesMap.get(prop.node.key.id.name); + const { id, methodId, getId, setId, initAdded } = privateName; + + if (initAdded) return; + + const isAccessor = getId || setId; + if (isAccessor) { + privateNamesMap.set(prop.node.key.id.name, { + ...privateName, + initAdded: true, + }); + + return template.statement.ast` + Object.defineProperty(${ref}, ${id}, { + // configurable is false by default + // enumerable is false by default + // writable is false by default + get: ${getId ? getId.name : prop.scope.buildUndefinedNode()}, + set: ${setId ? setId.name : prop.scope.buildUndefinedNode()} + }) + `; + } + return template.statement.ast` Object.defineProperty(${ref}, ${id}, { // configurable is false by default @@ -539,6 +558,8 @@ export function buildFieldsInitNodes( let needsClassRef = false; for (const prop of props) { + ts.assertFieldTransformed(prop); + const isStatic = prop.node.static; const isInstance = !isStatic; const isPrivate = prop.isPrivate(); @@ -615,14 +636,14 @@ export function buildFieldsInitNodes( case isStatic && isPrivate && isMethod && !loose: needsClassRef = true; staticNodes.push( + buildPrivateStaticFieldInitSpec(prop, privateNamesMap), + ); + staticNodes.unshift( buildPrivateMethodDeclaration(prop, privateNamesMap, loose), ); break; case isStatic && isPrivate && isMethod && loose: needsClassRef = true; - staticNodes.push( - buildPrivateMethodDeclaration(prop, privateNamesMap, loose), - ); staticNodes.push( buildPrivateStaticMethodInitLoose( t.cloneNode(ref), @@ -631,6 +652,9 @@ export function buildFieldsInitNodes( privateNamesMap, ), ); + staticNodes.unshift( + buildPrivateMethodDeclaration(prop, privateNamesMap, loose), + ); break; case isInstance && isPublic && isField && loose: instanceNodes.push(buildPublicFieldInitLoose(t.thisExpression(), prop)); @@ -646,7 +670,7 @@ export function buildFieldsInitNodes( } return { - staticNodes, + staticNodes: staticNodes.filter(Boolean), instanceNodes: instanceNodes.filter(Boolean), wrapClass(path) { for (const prop of props) { diff --git a/packages/babel-helper-create-class-features-plugin/src/index.js b/packages/babel-helper-create-class-features-plugin/src/index.js index 1ed61a1839c0..57add480d286 100644 --- a/packages/babel-helper-create-class-features-plugin/src/index.js +++ b/packages/babel-helper-create-class-features-plugin/src/index.js @@ -97,7 +97,8 @@ export function createClassFeaturePlugin({ } else { if ( (privateNames.has(name) && - (!privateNames.has(getName) && !privateNames.has(setName))) || + !privateNames.has(getName) && + !privateNames.has(setName)) || (privateNames.has(name) && (privateNames.has(getName) || privateNames.has(setName))) ) { diff --git a/packages/babel-helper-create-class-features-plugin/src/typescript.js b/packages/babel-helper-create-class-features-plugin/src/typescript.js new file mode 100644 index 000000000000..c18f0ea17389 --- /dev/null +++ b/packages/babel-helper-create-class-features-plugin/src/typescript.js @@ -0,0 +1,19 @@ +// @flow + +import type { NodePath } from "@babel/traverse"; + +export function assertFieldTransformed(path: NodePath) { + // TODO (Babel 8): Also check path.node.definite + + if (path.node.declare) { + throw path.buildCodeFrameError( + `TypeScript 'declare' fields must first be transformed by ` + + `@babel/plugin-transform-typescript.\n` + + `If you have already enabled that plugin (or '@babel/preset-typescript'), make sure ` + + `that it runs before any plugin related to additional class features:\n` + + ` - @babel/plugin-proposal-class-properties\n` + + ` - @babel/plugin-proposal-private-methods\n` + + ` - @babel/plugin-proposal-decorators`, + ); + } +} diff --git a/packages/babel-helper-create-class-features-plugin/test/fixtures/plugin-proposal-private-methods/loose-false/options.json b/packages/babel-helper-create-class-features-plugin/test/fixtures/plugin-proposal-private-methods/loose-false/options.json index f85119d087cc..31c874fe9097 100644 --- a/packages/babel-helper-create-class-features-plugin/test/fixtures/plugin-proposal-private-methods/loose-false/options.json +++ b/packages/babel-helper-create-class-features-plugin/test/fixtures/plugin-proposal-private-methods/loose-false/options.json @@ -1,5 +1,3 @@ { - "plugins": [ - ["proposal-private-methods", { "loose": false }] - ] + "plugins": [["proposal-private-methods", { "loose": false }]] } diff --git a/packages/babel-helper-create-class-features-plugin/test/fixtures/plugin-proposal-private-methods/loose-true/options.json b/packages/babel-helper-create-class-features-plugin/test/fixtures/plugin-proposal-private-methods/loose-true/options.json index e0ee1124a93a..0d20a8dcadc8 100644 --- a/packages/babel-helper-create-class-features-plugin/test/fixtures/plugin-proposal-private-methods/loose-true/options.json +++ b/packages/babel-helper-create-class-features-plugin/test/fixtures/plugin-proposal-private-methods/loose-true/options.json @@ -1,5 +1,3 @@ { - "plugins": [ - ["proposal-private-methods", { "loose": true }] - ] + "plugins": [["proposal-private-methods", { "loose": true }]] } diff --git a/packages/babel-plugin-syntax-dynamic-import/.npmignore b/packages/babel-helper-create-regexp-features-plugin/.npmignore similarity index 100% rename from packages/babel-plugin-syntax-dynamic-import/.npmignore rename to packages/babel-helper-create-regexp-features-plugin/.npmignore diff --git a/packages/babel-helper-create-regexp-features-plugin/README.md b/packages/babel-helper-create-regexp-features-plugin/README.md new file mode 100644 index 000000000000..69f661bd987e --- /dev/null +++ b/packages/babel-helper-create-regexp-features-plugin/README.md @@ -0,0 +1,19 @@ +# @babel/helper-create-regexp-features-plugin + +> Compile ESNext Regular Expressions to ES5 + +See our website [@babel/helper-create-regexp-features-plugin](https://babeljs.io/docs/en/next/babel-helper-create-regexp-features-plugin.html) for more information. + +## Install + +Using npm: + +```sh +npm install --save-dev @babel/helper-create-regexp-features-plugin +``` + +or using yarn: + +```sh +yarn add @babel/helper-create-regexp-features-plugin --dev +``` diff --git a/packages/babel-helper-create-regexp-features-plugin/package.json b/packages/babel-helper-create-regexp-features-plugin/package.json new file mode 100644 index 000000000000..a08a20b5ddb3 --- /dev/null +++ b/packages/babel-helper-create-regexp-features-plugin/package.json @@ -0,0 +1,31 @@ +{ + "name": "@babel/helper-create-regexp-features-plugin", + "version": "7.8.3", + "author": "The Babel Team (https://babeljs.io/team)", + "license": "MIT", + "description": "Compile ESNext Regular Expressions to ES5", + "repository": { + "type": "git", + "url": "https://github.com/babel/babel", + "directory": "packages/babel-helper-create-regexp-features-plugin" + }, + "main": "lib/index.js", + "publishConfig": { + "access": "public" + }, + "keywords": [ + "babel", + "babel-plugin" + ], + "dependencies": { + "@babel/helper-regex": "^7.8.3", + "regexpu-core": "^4.6.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0" + }, + "devDependencies": { + "@babel/core": "^7.8.3", + "@babel/helper-plugin-test-runner": "^7.8.3" + } +} diff --git a/packages/babel-helper-create-regexp-features-plugin/src/features.js b/packages/babel-helper-create-regexp-features-plugin/src/features.js new file mode 100644 index 000000000000..8e82b1342e88 --- /dev/null +++ b/packages/babel-helper-create-regexp-features-plugin/src/features.js @@ -0,0 +1,27 @@ +// @flow +export const FEATURES = Object.freeze({ + unicodeFlag: 1 << 0, + dotAllFlag: 1 << 1, + unicodePropertyEscape: 1 << 2, + namedCaptureGroups: 1 << 3, +}); + +// We can't use a symbol because this needs to always be the same, even if +// this package isn't deduped by npm. e.g. +// - node_modules/ +// - @babel/plugin-regexp-features +// - @babel/plugin-proposal-unicode-property-regex +// - node_modules +// - @babel-plugin-regexp-features +export const featuresKey = "@babel/plugin-regexp-features/featuresKey"; +export const runtimeKey = "@babel/plugin-regexp-features/runtimeKey"; + +type FeatureType = $Values; + +export function enableFeature(features: number, feature: FeatureType): number { + return features | feature; +} + +export function hasFeature(features: number, feature: FeatureType) { + return !!(features & feature); +} diff --git a/packages/babel-helper-create-regexp-features-plugin/src/index.js b/packages/babel-helper-create-regexp-features-plugin/src/index.js new file mode 100644 index 000000000000..49554be42ad2 --- /dev/null +++ b/packages/babel-helper-create-regexp-features-plugin/src/index.js @@ -0,0 +1,96 @@ +import rewritePattern from "regexpu-core"; +import { + featuresKey, + FEATURES, + enableFeature, + runtimeKey, + hasFeature, +} from "./features"; +import { generateRegexpuOptions } from "./util"; + +import pkg from "../package.json"; +import { types as t } from "@babel/core"; +import { pullFlag } from "@babel/helper-regex"; + +// Note: Versions are represented as an integer. e.g. 7.1.5 is represented +// as 70000100005. This method is easier than using a semver-parsing +// package, but it breaks if we release x.y.z where x, y or z are +// greater than 99_999. +const version = pkg.version.split(".").reduce((v, x) => v * 1e5 + +x, 0); +const versionKey = "@babel/plugin-regexp-features/version"; + +export function createRegExpFeaturePlugin({ name, feature, options = {} }) { + return { + name, + pre() { + const { file } = this; + const features = file.get(featuresKey) ?? 0; + let newFeatures = enableFeature(features, FEATURES[feature]); + + const { useUnicodeFlag, runtime = true } = options; + if (useUnicodeFlag === false) { + newFeatures = enableFeature(newFeatures, FEATURES.unicodeFlag); + } + if (newFeatures !== features) { + file.set(featuresKey, newFeatures); + } + + if (!runtime) { + file.set(runtimeKey, false); + } + + if (!file.has(versionKey) || file.get(versionKey) < version) { + file.set(versionKey, version); + } + }, + + visitor: { + RegExpLiteral(path) { + const { node } = path; + const { file } = this; + const features = file.get(featuresKey); + const runtime = file.get(runtimeKey) ?? true; + const regexpuOptions = generateRegexpuOptions(node, features); + if (regexpuOptions === null) { + return; + } + const namedCaptureGroups = {}; + if (regexpuOptions.namedGroup) { + regexpuOptions.onNamedGroup = (name, index) => { + namedCaptureGroups[name] = index; + }; + } + node.pattern = rewritePattern(node.pattern, node.flags, regexpuOptions); + + if ( + regexpuOptions.namedGroup && + Object.keys(namedCaptureGroups).length > 0 && + runtime && + !isRegExpTest(path) + ) { + path.replaceWith( + t.callExpression(this.addHelper("wrapRegExp"), [ + node, + t.valueToNode(namedCaptureGroups), + ]), + ); + } + if (hasFeature(features, FEATURES.unicodeFlag)) { + pullFlag(node, "u"); + } + if (hasFeature(features, FEATURES.dotAllFlag)) { + pullFlag(node, "s"); + } + }, + }, + }; +} + +function isRegExpTest(path) { + return ( + path.parentPath.isMemberExpression({ + object: path.node, + computed: false, + }) && path.parentPath.get("property").isIdentifier({ name: "test" }) + ); +} diff --git a/packages/babel-helper-create-regexp-features-plugin/src/util.js b/packages/babel-helper-create-regexp-features-plugin/src/util.js new file mode 100644 index 000000000000..bc6f89dcebce --- /dev/null +++ b/packages/babel-helper-create-regexp-features-plugin/src/util.js @@ -0,0 +1,56 @@ +import { FEATURES, hasFeature } from "./features"; + +export function generateRegexpuOptions(node, features) { + let useUnicodeFlag = false, + dotAllFlag = false, + unicodePropertyEscape = false, + namedGroup = false; + const { flags, pattern } = node; + const flagsIncludesU = flags.includes("u"); + + if (flagsIncludesU) { + if (!hasFeature(features, FEATURES.unicodeFlag)) { + useUnicodeFlag = true; + } + if ( + hasFeature(features, FEATURES.unicodePropertyEscape) && + /\\[pP]{/.test(pattern) + ) { + unicodePropertyEscape = true; + } + } + + if (hasFeature(features, FEATURES.dotAllFlag) && flags.indexOf("s") >= 0) { + dotAllFlag = true; + } + if ( + hasFeature(features, FEATURES.namedCaptureGroups) && + /\(\?<(?![=!])/.test(pattern) + ) { + namedGroup = true; + } + if ( + !namedGroup && + !unicodePropertyEscape && + !dotAllFlag && + (!flagsIncludesU || useUnicodeFlag) + ) { + return null; + } + // Now we have to feed regexpu-core the regex + if (flagsIncludesU && flags.indexOf("s") >= 0) { + // When flags includes u, `config.unicode` will be enabled even if `u` is supported natively. + // In this case we have to enable dotAllFlag, otherwise `rewritePattern(/./su)` will return + // incorrect result + // https://github.com/mathiasbynens/regexpu-core/blob/v4.6.0/rewrite-pattern.js#L191 + dotAllFlag = true; + } + return { + useUnicodeFlag, + onNamedGroup: () => {}, + namedGroup, + unicodePropertyEscape, + dotAllFlag, + lookbehind: true, + }; +} diff --git a/packages/babel-helper-create-regexp-features-plugin/test/fixtures/plugin-proposal-unicode-property-regex/use-unicode-flag-false-not-overwritten/input.mjs b/packages/babel-helper-create-regexp-features-plugin/test/fixtures/plugin-proposal-unicode-property-regex/use-unicode-flag-false-not-overwritten/input.mjs new file mode 100644 index 000000000000..f972b98245a9 --- /dev/null +++ b/packages/babel-helper-create-regexp-features-plugin/test/fixtures/plugin-proposal-unicode-property-regex/use-unicode-flag-false-not-overwritten/input.mjs @@ -0,0 +1 @@ +/\p{Script_Extensions=Wancho}/u diff --git a/packages/babel-helper-create-regexp-features-plugin/test/fixtures/plugin-proposal-unicode-property-regex/use-unicode-flag-false-not-overwritten/options.json b/packages/babel-helper-create-regexp-features-plugin/test/fixtures/plugin-proposal-unicode-property-regex/use-unicode-flag-false-not-overwritten/options.json new file mode 100644 index 000000000000..d1c7bd8740ad --- /dev/null +++ b/packages/babel-helper-create-regexp-features-plugin/test/fixtures/plugin-proposal-unicode-property-regex/use-unicode-flag-false-not-overwritten/options.json @@ -0,0 +1,6 @@ +{ + "plugins": [ + ["proposal-unicode-property-regex", { "useUnicodeFlag": false }, "name 1"], + ["proposal-unicode-property-regex", { "useUnicodeFlag": true }, "name 2"] + ] +} diff --git a/packages/babel-helper-create-regexp-features-plugin/test/fixtures/plugin-proposal-unicode-property-regex/use-unicode-flag-false-not-overwritten/output.mjs b/packages/babel-helper-create-regexp-features-plugin/test/fixtures/plugin-proposal-unicode-property-regex/use-unicode-flag-false-not-overwritten/output.mjs new file mode 100644 index 000000000000..f43a80b8405b --- /dev/null +++ b/packages/babel-helper-create-regexp-features-plugin/test/fixtures/plugin-proposal-unicode-property-regex/use-unicode-flag-false-not-overwritten/output.mjs @@ -0,0 +1 @@ +/(?:\uD838[\uDEC0-\uDEF9\uDEFF])/; diff --git a/packages/babel-helper-create-regexp-features-plugin/test/fixtures/plugin-transform-named-capturing-groups-regex/runtime-false-not-overwritten/input.mjs b/packages/babel-helper-create-regexp-features-plugin/test/fixtures/plugin-transform-named-capturing-groups-regex/runtime-false-not-overwritten/input.mjs new file mode 100644 index 000000000000..3d7f5b1517b5 --- /dev/null +++ b/packages/babel-helper-create-regexp-features-plugin/test/fixtures/plugin-transform-named-capturing-groups-regex/runtime-false-not-overwritten/input.mjs @@ -0,0 +1 @@ +/(?\d{4})/ diff --git a/packages/babel-helper-create-regexp-features-plugin/test/fixtures/plugin-transform-named-capturing-groups-regex/runtime-false-not-overwritten/options.json b/packages/babel-helper-create-regexp-features-plugin/test/fixtures/plugin-transform-named-capturing-groups-regex/runtime-false-not-overwritten/options.json new file mode 100644 index 000000000000..ca279789330b --- /dev/null +++ b/packages/babel-helper-create-regexp-features-plugin/test/fixtures/plugin-transform-named-capturing-groups-regex/runtime-false-not-overwritten/options.json @@ -0,0 +1,6 @@ +{ + "plugins": [ + ["transform-named-capturing-groups-regex", { "runtime": false }, "name 1"], + ["transform-named-capturing-groups-regex", { "runtime": true }, "name 2"] + ] +} diff --git a/packages/babel-helper-create-regexp-features-plugin/test/fixtures/plugin-transform-named-capturing-groups-regex/runtime-false-not-overwritten/output.mjs b/packages/babel-helper-create-regexp-features-plugin/test/fixtures/plugin-transform-named-capturing-groups-regex/runtime-false-not-overwritten/output.mjs new file mode 100644 index 000000000000..f47a50b38088 --- /dev/null +++ b/packages/babel-helper-create-regexp-features-plugin/test/fixtures/plugin-transform-named-capturing-groups-regex/runtime-false-not-overwritten/output.mjs @@ -0,0 +1 @@ +/([0-9]{4})/; diff --git a/packages/babel-helper-create-regexp-features-plugin/test/index.js b/packages/babel-helper-create-regexp-features-plugin/test/index.js new file mode 100644 index 000000000000..1b534b8fc64a --- /dev/null +++ b/packages/babel-helper-create-regexp-features-plugin/test/index.js @@ -0,0 +1,3 @@ +import runner from "@babel/helper-plugin-test-runner"; + +runner(__dirname); diff --git a/packages/babel-helper-define-map/package.json b/packages/babel-helper-define-map/package.json index a51713a7f9f5..55a6db635e79 100644 --- a/packages/babel-helper-define-map/package.json +++ b/packages/babel-helper-define-map/package.json @@ -1,6 +1,6 @@ { "name": "@babel/helper-define-map", - "version": "7.5.5", + "version": "7.8.3", "description": "Helper function to define a map", "repository": "https://github.com/babel/babel/tree/master/packages/babel-helper-define-map", "license": "MIT", @@ -9,8 +9,8 @@ }, "main": "lib/index.js", "dependencies": { - "@babel/helper-function-name": "^7.1.0", - "@babel/types": "^7.5.5", + "@babel/helper-function-name": "^7.8.3", + "@babel/types": "^7.8.3", "lodash": "^4.17.13" } } diff --git a/packages/babel-helper-explode-assignable-expression/package.json b/packages/babel-helper-explode-assignable-expression/package.json index cf91ef586e0a..3333f7a1a3c7 100644 --- a/packages/babel-helper-explode-assignable-expression/package.json +++ b/packages/babel-helper-explode-assignable-expression/package.json @@ -1,6 +1,6 @@ { "name": "@babel/helper-explode-assignable-expression", - "version": "7.1.0", + "version": "7.8.3", "description": "Helper function to explode an assignable expression", "repository": "https://github.com/babel/babel/tree/master/packages/babel-helper-explode-assignable-expression", "license": "MIT", @@ -9,7 +9,7 @@ }, "main": "lib/index.js", "dependencies": { - "@babel/traverse": "^7.1.0", - "@babel/types": "^7.0.0" + "@babel/traverse": "^7.8.3", + "@babel/types": "^7.8.3" } } diff --git a/packages/babel-helper-explode-class/package.json b/packages/babel-helper-explode-class/package.json index ce7b0df4a3fe..024ffc3f5b09 100644 --- a/packages/babel-helper-explode-class/package.json +++ b/packages/babel-helper-explode-class/package.json @@ -1,6 +1,6 @@ { "name": "@babel/helper-explode-class", - "version": "7.1.0", + "version": "7.8.3", "description": "Helper function to explode class", "repository": "https://github.com/babel/babel/tree/master/packages/babel-helper-explode-class", "license": "MIT", @@ -9,8 +9,8 @@ }, "main": "lib/index.js", "dependencies": { - "@babel/helper-bindify-decorators": "^7.1.0", - "@babel/traverse": "^7.1.0", - "@babel/types": "^7.0.0" + "@babel/helper-bindify-decorators": "^7.8.3", + "@babel/traverse": "^7.8.3", + "@babel/types": "^7.8.3" } } diff --git a/packages/babel-helper-fixtures/package.json b/packages/babel-helper-fixtures/package.json index 809a91b81c73..0c27d061a78e 100644 --- a/packages/babel-helper-fixtures/package.json +++ b/packages/babel-helper-fixtures/package.json @@ -1,6 +1,6 @@ { "name": "@babel/helper-fixtures", - "version": "7.5.5", + "version": "7.8.3", "description": "Helper function to support fixtures", "author": "Sebastian McKenzie ", "license": "MIT", @@ -11,7 +11,6 @@ "main": "lib/index.js", "dependencies": { "lodash": "^4.17.13", - "semver": "^5.3.0", - "try-resolve": "^1.0.0" + "semver": "^5.3.0" } } diff --git a/packages/babel-helper-fixtures/src/index.js b/packages/babel-helper-fixtures/src/index.js index 7fc0cf21a3c7..1cc630e3bcfc 100644 --- a/packages/babel-helper-fixtures/src/index.js +++ b/packages/babel-helper-fixtures/src/index.js @@ -1,6 +1,4 @@ import cloneDeep from "lodash/cloneDeep"; -import trimEnd from "lodash/trimEnd"; -import resolve from "try-resolve"; import clone from "lodash/clone"; import extend from "lodash/extend"; import semver from "semver"; @@ -36,6 +34,13 @@ type Suite = { filename: string, }; +function tryResolve(module) { + try { + return require.resolve(module); + } catch (e) { + return null; + } +} function assertDirectory(loc) { if (!fs.statSync(loc).isDirectory()) { throw new Error(`Expected ${loc} to be a directory.`); @@ -77,7 +82,7 @@ export default function get(entryLoc): Array { const suites = []; let rootOpts = {}; - const rootOptsLoc = resolve(entryLoc + "/options"); + const rootOptsLoc = tryResolve(entryLoc + "/options"); if (rootOptsLoc) rootOpts = require(rootOptsLoc); for (const suiteName of fs.readdirSync(entryLoc)) { @@ -93,7 +98,7 @@ export default function get(entryLoc): Array { assertDirectory(suite.filename); suites.push(suite); - const suiteOptsLoc = resolve(suite.filename + "/options"); + const suiteOptsLoc = tryResolve(suite.filename + "/options"); if (suiteOptsLoc) suite.options = require(suiteOptsLoc); for (const taskName of fs.readdirSync(suite.filename)) { @@ -120,6 +125,8 @@ export default function get(entryLoc): Array { const expectLoc = findFile(taskDir + "/output", true /* allowJSON */) || taskDir + "/output.js"; + const stdoutLoc = taskDir + "/stdout.txt"; + const stderrLoc = taskDir + "/stderr.txt"; const actualLocAlias = suiteName + "/" + taskName + "/" + path.basename(actualLoc); @@ -138,7 +145,7 @@ export default function get(entryLoc): Array { const taskOpts = cloneDeep(suite.options); - const taskOptsLoc = resolve(taskDir + "/options"); + const taskOptsLoc = tryResolve(taskDir + "/options"); if (taskOptsLoc) extend(taskOpts, require(taskOptsLoc)); const test = { @@ -146,6 +153,10 @@ export default function get(entryLoc): Array { title: humanize(taskName, true), disabled: taskName[0] === ".", options: taskOpts, + validateLogs: taskOpts.validateLogs, + ignoreOutput: taskOpts.ignoreOutput, + stdout: { loc: stdoutLoc, code: readFile(stdoutLoc) }, + stderr: { loc: stderrLoc, code: readFile(stderrLoc) }, exec: { loc: execLoc, code: readFile(execLoc), @@ -169,9 +180,7 @@ export default function get(entryLoc): Array { if (minimumVersion == null) { throw new Error( - `'minNodeVersion' has invalid semver format: ${ - taskOpts.minNodeVersion - }`, + `'minNodeVersion' has invalid semver format: ${taskOpts.minNodeVersion}`, ); } @@ -183,6 +192,26 @@ export default function get(entryLoc): Array { delete taskOpts.minNodeVersion; } + if (taskOpts.os) { + let os = taskOpts.os; + + if (!Array.isArray(os) && typeof os !== "string") { + throw new Error( + `'os' should be either string or string array: ${taskOpts.os}`, + ); + } + + if (typeof os === "string") { + os = [os]; + } + + if (!os.includes(process.platform)) { + return; + } + + delete taskOpts.os; + } + // traceur checks if (test.exec.code.indexOf("// Async.") >= 0) { @@ -224,6 +253,30 @@ export default function get(entryLoc): Array { ); } } + + if (!test.validateLogs && (test.stdout.code || test.stderr.code)) { + throw new Error( + "stdout.txt and stderr.txt are only allowed when the 'validateLogs' option is enabled: " + + (test.stdout.code ? stdoutLoc : stderrLoc), + ); + } + if (test.options.ignoreOutput) { + if (test.expect.code) { + throw new Error( + "Test cannot ignore its output and also validate it: " + expectLoc, + ); + } + if (!test.validateLogs) { + throw new Error( + "ignoreOutput can only be used when validateLogs is true: " + + taskOptsLoc, + ); + } + } + + // Delete to avoid option validation error + delete test.options.validateLogs; + delete test.options.ignoreOutput; } } @@ -247,7 +300,7 @@ export function multiple(entryLoc, ignore?: Array) { export function readFile(filename) { if (fs.existsSync(filename)) { - let file = trimEnd(fs.readFileSync(filename, "utf8")); + let file = fs.readFileSync(filename, "utf8").trimRight(); file = file.replace(/\r\n/g, "\n"); return file; } else { diff --git a/packages/babel-helper-function-name/package.json b/packages/babel-helper-function-name/package.json index 77670f935a38..8a5c1b7be550 100644 --- a/packages/babel-helper-function-name/package.json +++ b/packages/babel-helper-function-name/package.json @@ -1,6 +1,6 @@ { "name": "@babel/helper-function-name", - "version": "7.1.0", + "version": "7.8.3", "description": "Helper function to change the property 'name' of every function", "repository": "https://github.com/babel/babel/tree/master/packages/babel-helper-function-name", "license": "MIT", @@ -9,8 +9,8 @@ }, "main": "lib/index.js", "dependencies": { - "@babel/helper-get-function-arity": "^7.0.0", - "@babel/template": "^7.1.0", - "@babel/types": "^7.0.0" + "@babel/helper-get-function-arity": "^7.8.3", + "@babel/template": "^7.8.3", + "@babel/types": "^7.8.3" } } diff --git a/packages/babel-helper-get-function-arity/package.json b/packages/babel-helper-get-function-arity/package.json index 1ed46aabd225..9869e945fad5 100644 --- a/packages/babel-helper-get-function-arity/package.json +++ b/packages/babel-helper-get-function-arity/package.json @@ -1,6 +1,6 @@ { "name": "@babel/helper-get-function-arity", - "version": "7.0.0", + "version": "7.8.3", "description": "Helper function to get function arity", "repository": "https://github.com/babel/babel/tree/master/packages/babel-helper-get-function-arity", "license": "MIT", @@ -9,6 +9,6 @@ }, "main": "lib/index.js", "dependencies": { - "@babel/types": "^7.0.0" + "@babel/types": "^7.8.3" } } diff --git a/packages/babel-helper-hoist-variables/package.json b/packages/babel-helper-hoist-variables/package.json index dad2e954ce2f..5b7fe5a0fd3a 100644 --- a/packages/babel-helper-hoist-variables/package.json +++ b/packages/babel-helper-hoist-variables/package.json @@ -1,6 +1,6 @@ { "name": "@babel/helper-hoist-variables", - "version": "7.4.4", + "version": "7.8.3", "description": "Helper function to hoist variables", "repository": "https://github.com/babel/babel/tree/master/packages/babel-helper-hoist-variables", "license": "MIT", @@ -9,6 +9,6 @@ }, "main": "lib/index.js", "dependencies": { - "@babel/types": "^7.4.4" + "@babel/types": "^7.8.3" } } diff --git a/packages/babel-helper-member-expression-to-functions/package.json b/packages/babel-helper-member-expression-to-functions/package.json index 4e94f0cdefaf..5cd723b5fce5 100644 --- a/packages/babel-helper-member-expression-to-functions/package.json +++ b/packages/babel-helper-member-expression-to-functions/package.json @@ -1,6 +1,6 @@ { "name": "@babel/helper-member-expression-to-functions", - "version": "7.5.5", + "version": "7.8.3", "description": "Helper function to replace certain member expressions with function calls", "repository": "https://github.com/babel/babel/tree/master/packages/babel-helper-member-expression-to-functions", "license": "MIT", @@ -10,6 +10,6 @@ "main": "lib/index.js", "author": "Justin Ridgewell ", "dependencies": { - "@babel/types": "^7.5.5" + "@babel/types": "^7.8.3" } } diff --git a/packages/babel-helper-module-imports/package.json b/packages/babel-helper-module-imports/package.json index e740d2f546bb..0e0d0e47e24a 100644 --- a/packages/babel-helper-module-imports/package.json +++ b/packages/babel-helper-module-imports/package.json @@ -1,6 +1,6 @@ { "name": "@babel/helper-module-imports", - "version": "7.0.0", + "version": "7.8.3", "description": "Babel helper functions for inserting module loads", "author": "Logan Smyth ", "homepage": "https://babeljs.io/", @@ -11,9 +11,9 @@ "repository": "https://github.com/babel/babel/tree/master/packages/babel-helper-module-imports", "main": "lib/index.js", "dependencies": { - "@babel/types": "^7.0.0" + "@babel/types": "^7.8.3" }, "devDependencies": { - "@babel/core": "^7.0.0" + "@babel/core": "^7.8.3" } } diff --git a/packages/babel-helper-module-imports/src/import-injector.js b/packages/babel-helper-module-imports/src/import-injector.js index 0e38f9188ab9..59375b6c9cac 100644 --- a/packages/babel-helper-module-imports/src/import-injector.js +++ b/packages/babel-helper-module-imports/src/import-injector.js @@ -417,10 +417,10 @@ export default class ImportInjector { node._blockHoist = blockHoist; }); - const targetPath = this._programPath.get("body").filter(p => { + const targetPath = this._programPath.get("body").find(p => { const val = p.node._blockHoist; return Number.isFinite(val) && val < 4; - })[0]; + }); if (targetPath) { targetPath.insertBefore(statements); diff --git a/packages/babel-helper-module-transforms/package.json b/packages/babel-helper-module-transforms/package.json index 3e4d55182dcf..f1c64d3c8c18 100644 --- a/packages/babel-helper-module-transforms/package.json +++ b/packages/babel-helper-module-transforms/package.json @@ -1,6 +1,6 @@ { "name": "@babel/helper-module-transforms", - "version": "7.5.5", + "version": "7.8.3", "description": "Babel helper functions for implementing ES6 module transformations", "author": "Logan Smyth ", "homepage": "https://babeljs.io/", @@ -11,11 +11,11 @@ "repository": "https://github.com/babel/babel/tree/master/packages/babel-helper-module-transforms", "main": "lib/index.js", "dependencies": { - "@babel/helper-module-imports": "^7.0.0", - "@babel/helper-simple-access": "^7.1.0", - "@babel/helper-split-export-declaration": "^7.4.4", - "@babel/template": "^7.4.4", - "@babel/types": "^7.5.5", + "@babel/helper-module-imports": "^7.8.3", + "@babel/helper-simple-access": "^7.8.3", + "@babel/helper-split-export-declaration": "^7.8.3", + "@babel/template": "^7.8.3", + "@babel/types": "^7.8.3", "lodash": "^4.17.13" } } diff --git a/packages/babel-helper-module-transforms/src/index.js b/packages/babel-helper-module-transforms/src/index.js index 5735ad951e8d..fdc4359614e7 100644 --- a/packages/babel-helper-module-transforms/src/index.js +++ b/packages/babel-helper-module-transforms/src/index.js @@ -12,7 +12,7 @@ import normalizeAndLoadModuleMetadata, { isSideEffectImport, } from "./normalize-and-load-metadata"; -export { hasExports, isSideEffectImport, isModule }; +export { hasExports, isSideEffectImport, isModule, rewriteThis }; /** * Perform all of the generic ES6 module rewriting needed to handle initial diff --git a/packages/babel-helper-module-transforms/src/rewrite-live-references.js b/packages/babel-helper-module-transforms/src/rewrite-live-references.js index 185ba9142220..95f1daadd158 100644 --- a/packages/babel-helper-module-transforms/src/rewrite-live-references.js +++ b/packages/babel-helper-module-transforms/src/rewrite-live-references.js @@ -80,10 +80,7 @@ export default function rewriteLiveReferences( * A visitor to inject export update statements during binding initialization. */ const rewriteBindingInitVisitor = { - ClassProperty(path) { - path.skip(); - }, - Function(path) { + Scope(path) { path.skip(); }, ClassDeclaration(path) { @@ -185,7 +182,9 @@ const rewriteReferencesVisitor = { ref.loc = path.node.loc; if ( - path.parentPath.isCallExpression({ callee: path.node }) && + (path.parentPath.isCallExpression({ callee: path.node }) || + path.parentPath.isOptionalCallExpression({ callee: path.node }) || + path.parentPath.isTaggedTemplateExpression({ tag: path.node })) && t.isMemberExpression(ref) ) { path.replaceWith(t.sequenceExpression([t.numericLiteral(0), ref])); @@ -224,6 +223,10 @@ const rewriteReferencesVisitor = { seen.add(path.node); const left = path.get("left"); + + // No change needed + if (left.isMemberExpression()) return; + if (left.isIdentifier()) { // Simple update-assign foo += 1; export { foo }; // => exports.foo = (foo += 1); @@ -234,9 +237,9 @@ const rewriteReferencesVisitor = { return; } - const exportedNames = exported.get(localName) || []; + const exportedNames = exported.get(localName); const importData = imported.get(localName); - if (exportedNames.length > 0 || importData) { + if (exportedNames?.length > 0 || importData) { assert(path.node.operator === "=", "Path was not simplified"); const assignment = path.node; @@ -259,13 +262,14 @@ const rewriteReferencesVisitor = { ); requeueInParent(path); } - } else if (left.isMemberExpression()) { - // No change needed } else { const ids = left.getOuterBindingIdentifiers(); - const id = Object.keys(ids) - .filter(localName => imported.has(localName)) - .pop(); + const programScopeIds = Object.keys(ids).filter( + localName => + scope.getBinding(localName) === path.scope.getBinding(localName), + ); + const id = programScopeIds.find(localName => imported.has(localName)); + if (id) { path.node.right = t.sequenceExpression([ path.node.right, @@ -276,14 +280,7 @@ const rewriteReferencesVisitor = { // Complex ({a, b, c} = {}); export { a, c }; // => ({a, b, c} = {}), (exports.a = a, exports.c = c); const items = []; - Object.keys(ids).forEach(localName => { - // redeclared in this scope - if ( - scope.getBinding(localName) !== path.scope.getBinding(localName) - ) { - return; - } - + programScopeIds.forEach(localName => { const exportedNames = exported.get(localName) || []; if (exportedNames.length > 0) { items.push( diff --git a/packages/babel-helper-optimise-call-expression/package.json b/packages/babel-helper-optimise-call-expression/package.json index f048cd350075..fbb338e5d292 100644 --- a/packages/babel-helper-optimise-call-expression/package.json +++ b/packages/babel-helper-optimise-call-expression/package.json @@ -1,6 +1,6 @@ { "name": "@babel/helper-optimise-call-expression", - "version": "7.0.0", + "version": "7.8.3", "description": "Helper function to optimise call expression", "repository": "https://github.com/babel/babel/tree/master/packages/babel-helper-optimise-call-expression", "license": "MIT", @@ -9,6 +9,6 @@ }, "main": "lib/index.js", "dependencies": { - "@babel/types": "^7.0.0" + "@babel/types": "^7.8.3" } } diff --git a/packages/babel-helper-plugin-test-runner/package.json b/packages/babel-helper-plugin-test-runner/package.json index 0a1dfe671fad..774c8ca066e5 100644 --- a/packages/babel-helper-plugin-test-runner/package.json +++ b/packages/babel-helper-plugin-test-runner/package.json @@ -1,6 +1,6 @@ { "name": "@babel/helper-plugin-test-runner", - "version": "7.1.0", + "version": "7.8.3", "description": "Helper function to support test runner", "repository": "https://github.com/babel/babel/tree/master/packages/babel-helper-plugin-test-runner", "license": "MIT", @@ -9,6 +9,6 @@ }, "main": "lib/index.js", "dependencies": { - "@babel/helper-transform-fixture-test-runner": "^7.1.0" + "@babel/helper-transform-fixture-test-runner": "^7.8.3" } } diff --git a/packages/babel-helper-plugin-utils/package.json b/packages/babel-helper-plugin-utils/package.json index b35e4dbd1139..7b6f4162040f 100644 --- a/packages/babel-helper-plugin-utils/package.json +++ b/packages/babel-helper-plugin-utils/package.json @@ -1,6 +1,6 @@ { "name": "@babel/helper-plugin-utils", - "version": "7.0.0", + "version": "7.8.3", "description": "General utilities for plugins to use", "author": "Logan Smyth ", "homepage": "https://babeljs.io/", diff --git a/packages/babel-helper-regex/package.json b/packages/babel-helper-regex/package.json index 0fdf8c0aee80..546451b71229 100644 --- a/packages/babel-helper-regex/package.json +++ b/packages/babel-helper-regex/package.json @@ -1,6 +1,6 @@ { "name": "@babel/helper-regex", - "version": "7.5.5", + "version": "7.8.3", "description": "Helper function to check for literal RegEx", "repository": "https://github.com/babel/babel/tree/master/packages/babel-helper-regex", "license": "MIT", diff --git a/packages/babel-helper-remap-async-to-generator/package.json b/packages/babel-helper-remap-async-to-generator/package.json index fb44a863a9c1..b8634e4c55aa 100644 --- a/packages/babel-helper-remap-async-to-generator/package.json +++ b/packages/babel-helper-remap-async-to-generator/package.json @@ -1,6 +1,6 @@ { "name": "@babel/helper-remap-async-to-generator", - "version": "7.1.0", + "version": "7.8.3", "description": "Helper function to remap async functions to generators", "repository": "https://github.com/babel/babel/tree/master/packages/babel-helper-remap-async-to-generator", "license": "MIT", @@ -9,10 +9,10 @@ }, "main": "lib/index.js", "dependencies": { - "@babel/helper-annotate-as-pure": "^7.0.0", - "@babel/helper-wrap-function": "^7.1.0", - "@babel/template": "^7.1.0", - "@babel/traverse": "^7.1.0", - "@babel/types": "^7.0.0" + "@babel/helper-annotate-as-pure": "^7.8.3", + "@babel/helper-wrap-function": "^7.8.3", + "@babel/template": "^7.8.3", + "@babel/traverse": "^7.8.3", + "@babel/types": "^7.8.3" } } diff --git a/packages/babel-helper-replace-supers/package.json b/packages/babel-helper-replace-supers/package.json index a6c6dbc76c2b..3fe660f69d5b 100644 --- a/packages/babel-helper-replace-supers/package.json +++ b/packages/babel-helper-replace-supers/package.json @@ -1,6 +1,6 @@ { "name": "@babel/helper-replace-supers", - "version": "7.5.5", + "version": "7.8.3", "description": "Helper function to replace supers", "repository": "https://github.com/babel/babel/tree/master/packages/babel-helper-replace-supers", "license": "MIT", @@ -9,9 +9,9 @@ }, "main": "lib/index.js", "dependencies": { - "@babel/helper-member-expression-to-functions": "^7.5.5", - "@babel/helper-optimise-call-expression": "^7.0.0", - "@babel/traverse": "^7.5.5", - "@babel/types": "^7.5.5" + "@babel/helper-member-expression-to-functions": "^7.8.3", + "@babel/helper-optimise-call-expression": "^7.8.3", + "@babel/traverse": "^7.8.3", + "@babel/types": "^7.8.3" } } diff --git a/packages/babel-helper-simple-access/package.json b/packages/babel-helper-simple-access/package.json index 51a8abba2b7a..395d72009157 100644 --- a/packages/babel-helper-simple-access/package.json +++ b/packages/babel-helper-simple-access/package.json @@ -1,6 +1,6 @@ { "name": "@babel/helper-simple-access", - "version": "7.1.0", + "version": "7.8.3", "description": "Babel helper for ensuring that access to a given value is performed through simple accesses", "author": "Logan Smyth ", "homepage": "https://babeljs.io/", @@ -11,7 +11,7 @@ "repository": "https://github.com/babel/babel/tree/master/packages/babel-helper-simple-access", "main": "lib/index.js", "dependencies": { - "@babel/template": "^7.1.0", - "@babel/types": "^7.0.0" + "@babel/template": "^7.8.3", + "@babel/types": "^7.8.3" } } diff --git a/packages/babel-helper-split-export-declaration/package.json b/packages/babel-helper-split-export-declaration/package.json index f8510565f9e9..499d3ecc9330 100644 --- a/packages/babel-helper-split-export-declaration/package.json +++ b/packages/babel-helper-split-export-declaration/package.json @@ -1,6 +1,6 @@ { "name": "@babel/helper-split-export-declaration", - "version": "7.4.4", + "version": "7.8.3", "description": "", "repository": "https://github.com/babel/babel/tree/master/packages/babel-helper-split-export-declaration", "license": "MIT", @@ -9,6 +9,6 @@ }, "main": "lib/index.js", "dependencies": { - "@babel/types": "^7.4.4" + "@babel/types": "^7.8.3" } } diff --git a/packages/babel-helper-transform-fixture-test-runner/package.json b/packages/babel-helper-transform-fixture-test-runner/package.json index f1e766baff50..a97a9b3b0ae7 100644 --- a/packages/babel-helper-transform-fixture-test-runner/package.json +++ b/packages/babel-helper-transform-fixture-test-runner/package.json @@ -1,6 +1,6 @@ { "name": "@babel/helper-transform-fixture-test-runner", - "version": "7.5.5", + "version": "7.8.3", "description": "Transform test runner for @babel/helper-fixtures module", "author": "Sebastian McKenzie ", "homepage": "https://babeljs.io/", @@ -11,10 +11,10 @@ "repository": "https://github.com/babel/babel/tree/master/packages/babel-helper-transform-fixture-test-runner", "main": "lib/index.js", "dependencies": { - "@babel/code-frame": "^7.5.5", - "@babel/core": "^7.5.5", - "@babel/helper-fixtures": "^7.5.5", - "@babel/polyfill": "^7.4.4", + "@babel/code-frame": "^7.8.3", + "@babel/core": "^7.8.3", + "@babel/helper-fixtures": "^7.8.3", + "@babel/polyfill": "^7.8.3", "babel-check-duplicated-nodes": "^1.0.0", "jest": "^24.8.0", "jest-diff": "^24.8.0", diff --git a/packages/babel-helper-transform-fixture-test-runner/src/index.js b/packages/babel-helper-transform-fixture-test-runner/src/index.js index a83e8ff1c61b..0ec7c043c16e 100644 --- a/packages/babel-helper-transform-fixture-test-runner/src/index.js +++ b/packages/babel-helper-transform-fixture-test-runner/src/index.js @@ -62,11 +62,12 @@ function runModuleInTestContext(id: string, relativeFilename: string) { const req = id => runModuleInTestContext(id, filename); const src = fs.readFileSync(filename, "utf8"); - const code = `(function (exports, require, module, __filename, __dirname) {${src}\n});`; + const code = `(function (exports, require, module, __filename, __dirname) {\n${src}\n});`; vm.runInContext(code, testContext, { filename, displayErrors: true, + lineOffset: -1, }).call(module.exports, module.exports, req, module, filename, dirname); return module.exports; @@ -94,10 +95,11 @@ export function runCodeInTestContext(code: string, opts: { filename: string }) { // Expose the test options as "opts", but otherwise run the test in a CommonJS-like environment. // Note: This isn't doing .call(module.exports, ...) because some of our tests currently // rely on 'this === global'. - const src = `(function(exports, require, module, __filename, __dirname, opts) {${code}\n});`; + const src = `(function(exports, require, module, __filename, __dirname, opts) {\n${code}\n});`; return vm.runInContext(src, testContext, { filename, displayErrors: true, + lineOffset: -1, })(module.exports, req, module, filename, dirname, opts); } finally { process.chdir(oldCwd); @@ -131,11 +133,17 @@ function wrapPackagesArray(type, names, optionsDir) { } function run(task) { - const actual = task.actual; - const expected = task.expect; - const exec = task.exec; - const opts = task.options; - const optionsDir = task.optionsDir; + const { + actual, + expect: expected, + exec, + options: opts, + optionsDir, + validateLogs, + ignoreOutput, + stdout, + stderr, + } = task; function getOpts(self) { const newOpts = merge( @@ -191,56 +199,67 @@ function run(task) { } } - let actualCode = actual.code; - const expectCode = expected.code; - if (!execCode || actualCode) { - result = babel.transform(actualCode, getOpts(actual)); - const expectedCode = result.code.replace( - escapeRegExp(path.resolve(__dirname, "../../../")), - "", - ); + const inputCode = actual.code; + const expectedCode = expected.code; + if (!execCode || inputCode) { + const actualLogs = { stdout: "", stderr: "" }; + let restoreSpies = null; + if (validateLogs) { + const spy1 = jest.spyOn(console, "log").mockImplementation(msg => { + actualLogs.stdout += `${msg}\n`; + }); + const spy2 = jest.spyOn(console, "warn").mockImplementation(msg => { + actualLogs.stderr += `${msg}\n`; + }); + restoreSpies = () => { + spy1.mockRestore(); + spy2.mockRestore(); + }; + } - checkDuplicatedNodes(babel, result.ast); - if ( - !expected.code && - expectedCode && - !opts.throws && - fs.statSync(path.dirname(expected.loc)).isDirectory() && - !process.env.CI - ) { - const expectedFile = expected.loc.replace( - /\.m?js$/, - result.sourceType === "module" ? ".mjs" : ".js", - ); - - console.log(`New test file created: ${expectedFile}`); - fs.writeFileSync(expectedFile, `${expectedCode}\n`); - - if (expected.loc !== expectedFile) { - try { - fs.unlinkSync(expected.loc); - } catch (e) {} - } - } else { - actualCode = expectedCode.trim(); - try { - expect(actualCode).toEqualFile({ - filename: expected.loc, - code: expectCode, - }); - } catch (e) { - if (!process.env.OVERWRITE) throw e; + result = babel.transform(inputCode, getOpts(actual)); - console.log(`Updated test file: ${expected.loc}`); - fs.writeFileSync(expected.loc, `${expectedCode}\n`); - } + if (restoreSpies) restoreSpies(); - if (actualCode) { - expect(expected.loc).toMatch( - result.sourceType === "module" ? /\.mjs$/ : /\.js$/, + const outputCode = normalizeOutput(result.code); + + checkDuplicatedNodes(babel, result.ast); + if (!ignoreOutput) { + if ( + !expected.code && + outputCode && + !opts.throws && + fs.statSync(path.dirname(expected.loc)).isDirectory() && + !process.env.CI + ) { + const expectedFile = expected.loc.replace( + /\.m?js$/, + result.sourceType === "module" ? ".mjs" : ".js", ); + + console.log(`New test file created: ${expectedFile}`); + fs.writeFileSync(expectedFile, `${outputCode}\n`); + + if (expected.loc !== expectedFile) { + try { + fs.unlinkSync(expected.loc); + } catch (e) {} + } + } else { + validateFile(outputCode, expected.loc, expectedCode); + + if (inputCode) { + expect(expected.loc).toMatch( + result.sourceType === "module" ? /\.mjs$/ : /\.js$/, + ); + } } } + + if (validateLogs) { + validateFile(normalizeOutput(actualLogs.stdout), stdout.loc, stdout.code); + validateFile(normalizeOutput(actualLogs.stderr), stderr.loc, stderr.code); + } } if (task.sourceMap) { @@ -263,6 +282,39 @@ function run(task) { } } +function validateFile(actualCode, expectedLoc, expectedCode) { + try { + expect(actualCode).toEqualFile({ + filename: expectedLoc, + code: expectedCode, + }); + } catch (e) { + if (!process.env.OVERWRITE) throw e; + + console.log(`Updated test file: ${expectedLoc}`); + fs.writeFileSync(expectedLoc, `${actualCode}\n`); + } +} + +function normalizeOutput(code) { + let result = code + .trim() + .replace( + new RegExp(escapeRegExp(path.resolve(__dirname, "../../../")), "g"), + "", + ); + if (process.platform === "win32") { + result = result.replace( + new RegExp( + escapeRegExp(path.resolve(__dirname, "../../../").replace(/\\/g, "/")), + "g", + ), + "", + ); + } + return result; +} + const toEqualFile = () => ({ compare: (actual, { filename, code }) => { const pass = actual === code; diff --git a/packages/babel-helper-transform-fixture-test-runner/test/index.js b/packages/babel-helper-transform-fixture-test-runner/test/index.js index 2ec3d6bb2cce..1d02bf80290f 100644 --- a/packages/babel-helper-transform-fixture-test-runner/test/index.js +++ b/packages/babel-helper-transform-fixture-test-runner/test/index.js @@ -35,4 +35,17 @@ describe("helper-transform-fixture-test-runner", function() { ); } }); + it("should print correct trace position when error is thrown in the first line", () => { + const opts = { + filename: `${__filename}.fake4`, + }; + runCodeInTestContext( + `try { throw new Error() } catch (e) { + opts.stack = e.stack + } + `, + opts, + ); + expect(opts.stack).toContain(opts.filename + ":1:13"); + }); }); diff --git a/packages/babel-helper-wrap-function/package.json b/packages/babel-helper-wrap-function/package.json index d0a3396e76f5..1d2501888a9d 100644 --- a/packages/babel-helper-wrap-function/package.json +++ b/packages/babel-helper-wrap-function/package.json @@ -1,6 +1,6 @@ { "name": "@babel/helper-wrap-function", - "version": "7.2.0", + "version": "7.8.3", "description": "Helper to wrap functions inside a function call.", "repository": "https://github.com/babel/babel/tree/master/packages/babel-helper-wrap-function", "license": "MIT", @@ -9,9 +9,9 @@ }, "main": "lib/index.js", "dependencies": { - "@babel/helper-function-name": "^7.1.0", - "@babel/template": "^7.1.0", - "@babel/traverse": "^7.1.0", - "@babel/types": "^7.2.0" + "@babel/helper-function-name": "^7.8.3", + "@babel/template": "^7.8.3", + "@babel/traverse": "^7.8.3", + "@babel/types": "^7.8.3" } } diff --git a/packages/babel-helpers/package.json b/packages/babel-helpers/package.json index 54db360349b1..623a0f6139db 100644 --- a/packages/babel-helpers/package.json +++ b/packages/babel-helpers/package.json @@ -1,6 +1,6 @@ { "name": "@babel/helpers", - "version": "7.5.5", + "version": "7.8.3", "description": "Collection of helper functions used by Babel transforms.", "author": "Sebastian McKenzie ", "homepage": "https://babeljs.io/", @@ -11,11 +11,11 @@ "repository": "https://github.com/babel/babel/tree/master/packages/babel-helpers", "main": "lib/index.js", "dependencies": { - "@babel/template": "^7.4.4", - "@babel/traverse": "^7.5.5", - "@babel/types": "^7.5.5" + "@babel/template": "^7.8.3", + "@babel/traverse": "^7.8.3", + "@babel/types": "^7.8.3" }, "devDependencies": { - "@babel/helper-plugin-test-runner": "^7.0.0" + "@babel/helper-plugin-test-runner": "^7.8.3" } } diff --git a/packages/babel-helpers/src/helpers.js b/packages/babel-helpers/src/helpers.js index b9eef5095520..9212dfb2c28c 100644 --- a/packages/babel-helpers/src/helpers.js +++ b/packages/babel-helpers/src/helpers.js @@ -47,15 +47,6 @@ helpers.jsx = helper("7.0.0-beta.0")` children: void 0, }; } - if (props && defaultProps) { - for (var propName in defaultProps) { - if (props[propName] === void 0) { - props[propName] = defaultProps[propName]; - } - } - } else if (!props) { - props = defaultProps || {}; - } if (childrenLength === 1) { props.children = children; @@ -67,6 +58,16 @@ helpers.jsx = helper("7.0.0-beta.0")` props.children = childArray; } + if (props && defaultProps) { + for (var propName in defaultProps) { + if (props[propName] === void 0) { + props[propName] = defaultProps[propName]; + } + } + } else if (!props) { + props = defaultProps || {}; + } + return { $$typeof: REACT_ELEMENT_TYPE, type: type, @@ -135,7 +136,7 @@ helpers.AsyncGenerator = helper("7.0.0-beta.0")` Promise.resolve(wrappedAwait ? value.wrapped : value).then( function (arg) { if (wrappedAwait) { - resume("next", arg); + resume(key === "return" ? "return" : "next", arg); return } @@ -237,6 +238,10 @@ helpers.asyncGeneratorDelegate = helper("7.0.0-beta.0")` if (typeof inner.return === "function") { iter.return = function (value) { + if (waiting) { + waiting = false; + return value; + } return pump("return", value); }; } @@ -391,7 +396,7 @@ helpers.objectSpread = helper("7.0.0-beta.0")` export default function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { - var source = (arguments[i] != null) ? arguments[i] : {}; + var source = (arguments[i] != null) ? Object(arguments[i]) : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) { @@ -410,7 +415,7 @@ helpers.objectSpread2 = helper("7.5.0")` import defineProperty from "defineProperty"; // This function is different to "Reflect.ownKeys". The enumerableOnly - // filters on symbol properties only. Returned string properties are always + // filters on symbol properties only. Returned string properties are always // enumerable. It is good to use in objectSpread. function ownKeys(object, enumerableOnly) { @@ -429,13 +434,13 @@ helpers.objectSpread2 = helper("7.5.0")` for (var i = 1; i < arguments.length; i++) { var source = (arguments[i] != null) ? arguments[i] : {}; if (i % 2) { - ownKeys(source, true).forEach(function (key) { + ownKeys(Object(source), true).forEach(function (key) { defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { - ownKeys(source).forEach(function (key) { + ownKeys(Object(source)).forEach(function (key) { Object.defineProperty( target, key, @@ -606,28 +611,47 @@ helpers.interopRequireDefault = helper("7.0.0-beta.0")` `; helpers.interopRequireWildcard = helper("7.0.0-beta.0")` + function _getRequireWildcardCache() { + if (typeof WeakMap !== "function") return null; + + var cache = new WeakMap(); + _getRequireWildcardCache = function () { return cache; }; + return cache; + } + export default function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; - } else { - var newObj = {}; - if (obj != null) { - for (var key in obj) { - if (Object.prototype.hasOwnProperty.call(obj, key)) { - var desc = Object.defineProperty && Object.getOwnPropertyDescriptor - ? Object.getOwnPropertyDescriptor(obj, key) - : {}; - if (desc.get || desc.set) { - Object.defineProperty(newObj, key, desc); - } else { - newObj[key] = obj[key]; - } - } + } + + if (obj === null || (typeof obj !== "object" && typeof obj !== "function")) { + return { default: obj } + } + + var cache = _getRequireWildcardCache(); + if (cache && cache.has(obj)) { + return cache.get(obj); + } + + var newObj = {}; + var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; + for (var key in obj) { + if (Object.prototype.hasOwnProperty.call(obj, key)) { + var desc = hasPropertyDescriptor + ? Object.getOwnPropertyDescriptor(obj, key) + : null; + if (desc && (desc.get || desc.set)) { + Object.defineProperty(newObj, key, desc); + } else { + newObj[key] = obj[key]; } } - newObj.default = obj; - return newObj; } + newObj.default = obj; + if (cache) { + cache.set(obj, newObj); + } + return newObj; } `; @@ -918,14 +942,16 @@ helpers.iterableToArrayLimit = helper("7.0.0-beta.0")` export default function _iterableToArrayLimit(arr, i) { // this is an expanded form of \`for...of\` that properly supports abrupt completions of // iterators etc. variable names have been minimised to reduce the size of this massive - // helper. sometimes spec compliancy is annoying :( + // helper. sometimes spec compliance is annoying :( // // _n = _iteratorNormalCompletion // _d = _didIteratorError // _e = _iteratorError // _i = _iterator // _s = _step - + if (!( + Symbol.iterator in Object(arr) || Object.prototype.toString.call(arr) === "[object Arguments]" + )) { return } var _arr = []; var _n = true; var _d = false; @@ -951,6 +977,9 @@ helpers.iterableToArrayLimit = helper("7.0.0-beta.0")` helpers.iterableToArrayLimitLoose = helper("7.0.0-beta.0")` export default function _iterableToArrayLimitLoose(arr, i) { + if (!( + Symbol.iterator in Object(arr) || Object.prototype.toString.call(arr) === "[object Arguments]" + )) { return } var _arr = []; for (var _iterator = arr[Symbol.iterator](), _step; !(_step = _iterator.next()).done;) { _arr.push(_step.value); @@ -1015,9 +1044,7 @@ helpers.initializerWarningHelper = helper("7.0.0-beta.0")` export default function _initializerWarningHelper(descriptor, context){ throw new Error( 'Decorating class property failed. Please ensure that ' + - 'proposal-class-properties is enabled and set to use loose mode. ' + - 'To use proposal-class-properties in spec mode with decorators, wait for ' + - 'the next major version of decorators in stage 2.' + 'proposal-class-properties is enabled and runs after the decorators transform.' ); } `; @@ -1159,6 +1186,9 @@ helpers.classStaticPrivateFieldSpecGet = helper("7.0.2")` if (receiver !== classConstructor) { throw new TypeError("Private static access of wrong provenance"); } + if (descriptor.get) { + return descriptor.get.call(receiver); + } return descriptor.value; } `; @@ -1168,13 +1198,18 @@ helpers.classStaticPrivateFieldSpecSet = helper("7.0.2")` if (receiver !== classConstructor) { throw new TypeError("Private static access of wrong provenance"); } - if (!descriptor.writable) { - // This should only throw in strict mode, but class bodies are - // always strict and private fields can only be used inside - // class bodies. - throw new TypeError("attempted to set read only private field"); + if (descriptor.set) { + descriptor.set.call(receiver, value); + } else { + if (!descriptor.writable) { + // This should only throw in strict mode, but class bodies are + // always strict and private fields can only be used inside + // class bodies. + throw new TypeError("attempted to set read only private field"); + } + descriptor.value = value; } - descriptor.value = value; + return value; } `; diff --git a/packages/babel-highlight/package.json b/packages/babel-highlight/package.json index 66fcb3c2db0f..878fb203ebaf 100644 --- a/packages/babel-highlight/package.json +++ b/packages/babel-highlight/package.json @@ -1,6 +1,6 @@ { "name": "@babel/highlight", - "version": "7.5.0", + "version": "7.8.3", "description": "Syntax highlight JavaScript strings for output in terminals.", "author": "suchipi ", "homepage": "https://babeljs.io/", diff --git a/packages/babel-node/package.json b/packages/babel-node/package.json index d613965164c4..1ff61f561d69 100644 --- a/packages/babel-node/package.json +++ b/packages/babel-node/package.json @@ -1,6 +1,6 @@ { "name": "@babel/node", - "version": "7.5.5", + "version": "7.8.3", "description": "Babel command line", "author": "Sebastian McKenzie ", "homepage": "https://babeljs.io/", @@ -19,21 +19,25 @@ "compiler" ], "dependencies": { - "@babel/polyfill": "^7.0.0", - "@babel/register": "^7.5.5", - "commander": "^2.8.1", + "@babel/register": "^7.8.3", + "commander": "^4.0.1", + "core-js": "^3.2.1", "lodash": "^4.17.13", "node-environment-flags": "^1.0.5", + "regenerator-runtime": "^0.13.3", + "resolve": "^1.13.1", "v8flags": "^3.1.1" }, "peerDependencies": { "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.5.5", - "@babel/helper-fixtures": "^7.5.5", + "@babel/core": "^7.8.3", + "@babel/helper-fixtures": "^7.8.3", + "@babel/runtime": "^7.8.3", "fs-readdir-recursive": "^1.0.0", - "output-file-sync": "^2.0.0" + "make-dir": "^2.1.0", + "rimraf": "^3.0.0" }, "bin": { "babel-node": "./bin/babel-node.js" diff --git a/packages/babel-node/src/_babel-node.js b/packages/babel-node/src/_babel-node.js index ff908a56e6d2..22b8e00b779c 100644 --- a/packages/babel-node/src/_babel-node.js +++ b/packages/babel-node/src/_babel-node.js @@ -5,8 +5,10 @@ import path from "path"; import repl from "repl"; import * as babel from "@babel/core"; import vm from "vm"; -import "@babel/polyfill"; +import "core-js/stable"; +import "regenerator-runtime/runtime"; import register from "@babel/register"; +import resolve from "resolve"; import pkg from "../package.json"; @@ -167,15 +169,15 @@ if (program.eval || program.print) { } if (arg[0] === "-") { - const camelArg = arg - .slice(2) - .replace(/-(\w)/, (s, c) => c.toUpperCase()); - const parsedArg = program[camelArg]; - if ( - arg === "-r" || - arg === "--require" || - (parsedArg && parsedArg !== true) - ) { + const parsedOption = program.options.find(option => { + return option.long === arg || option.short === arg; + }); + if (parsedOption === undefined) { + return; + } + const optionName = parsedOption.attributeName(); + const parsedArg = program[optionName]; + if (optionName === "require" || (parsedArg && parsedArg !== true)) { ignoreNext = true; } } else { @@ -187,11 +189,9 @@ if (program.eval || program.print) { // We have to handle require ourselves, as we want to require it in the context of babel-register if (program.require) { - let requireFileName = program.require; - if (!path.isAbsolute(requireFileName)) { - requireFileName = path.join(process.cwd(), requireFileName); - } - require(requireFileName); + require(resolve.sync(program.require, { + basedir: process.cwd(), + })); } // make the filename absolute @@ -212,7 +212,7 @@ if (program.eval || program.print) { function replStart() { repl.start({ - prompt: "> ", + prompt: "babel > ", input: process.stdin, output: process.stdout, eval: replEval, diff --git a/packages/babel-node/src/babel-node.js b/packages/babel-node/src/babel-node.js index d143e4f756b4..4f0a7be101a8 100755 --- a/packages/babel-node/src/babel-node.js +++ b/packages/babel-node/src/babel-node.js @@ -40,7 +40,10 @@ function getNormalizedV8Flag(arg) { } // These are aliases for node options defined by babel-node. -const aliases = new Map([["-d", "--debug"], ["-gc", "--expose-gc"]]); +const aliases = new Map([ + ["-d", "--debug"], + ["-gc", "--expose-gc"], +]); getV8Flags(function(err, v8Flags) { for (let i = 0; i < babelArgs.length; i++) { @@ -93,9 +96,6 @@ getV8Flags(function(err, v8Flags) { } }); }); - process.on("SIGINT", () => { - proc.kill("SIGINT"); - process.exit(1); - }); + process.on("SIGINT", () => proc.kill("SIGINT")); } }); diff --git a/packages/babel-node/test/fixtures/babel-node/--presets/in-files/index.js b/packages/babel-node/test/fixtures/babel-node/--presets/in-files/index.js new file mode 100644 index 000000000000..85ce559e8f22 --- /dev/null +++ b/packages/babel-node/test/fixtures/babel-node/--presets/in-files/index.js @@ -0,0 +1 @@ +console.log("foo"); diff --git a/packages/babel-node/test/fixtures/babel-node/--presets/in-files/presetFile.js b/packages/babel-node/test/fixtures/babel-node/--presets/in-files/presetFile.js new file mode 100644 index 000000000000..b2d0556f1398 --- /dev/null +++ b/packages/babel-node/test/fixtures/babel-node/--presets/in-files/presetFile.js @@ -0,0 +1,4 @@ +module.exports = function () { + console.log("Preset was loaded, so --presets was used."); + return {}; +}; diff --git a/packages/babel-node/test/fixtures/babel-node/--presets/options.json b/packages/babel-node/test/fixtures/babel-node/--presets/options.json new file mode 100644 index 000000000000..bd14d5f365b2 --- /dev/null +++ b/packages/babel-node/test/fixtures/babel-node/--presets/options.json @@ -0,0 +1,3 @@ +{ + "args": ["--presets", "./presetFile.js", "index"] +} diff --git a/packages/babel-node/test/fixtures/babel-node/--presets/stdout.txt b/packages/babel-node/test/fixtures/babel-node/--presets/stdout.txt new file mode 100644 index 000000000000..69ccc409d020 --- /dev/null +++ b/packages/babel-node/test/fixtures/babel-node/--presets/stdout.txt @@ -0,0 +1,2 @@ +Preset was loaded, so --presets was used. +foo diff --git a/packages/babel-node/test/fixtures/babel-node/--require/in-files/dep.js b/packages/babel-node/test/fixtures/babel-node/--require/in-files/dep.js new file mode 100644 index 000000000000..16f81e8b7061 --- /dev/null +++ b/packages/babel-node/test/fixtures/babel-node/--require/in-files/dep.js @@ -0,0 +1 @@ +console.log("dep"); \ No newline at end of file diff --git a/packages/babel-node/test/fixtures/babel-node/--require/in-files/foo.js b/packages/babel-node/test/fixtures/babel-node/--require/in-files/foo.js new file mode 100644 index 000000000000..85ce559e8f22 --- /dev/null +++ b/packages/babel-node/test/fixtures/babel-node/--require/in-files/foo.js @@ -0,0 +1 @@ +console.log("foo"); diff --git a/packages/babel-node/test/fixtures/babel-node/--require/options.json b/packages/babel-node/test/fixtures/babel-node/--require/options.json new file mode 100644 index 000000000000..1384a0394841 --- /dev/null +++ b/packages/babel-node/test/fixtures/babel-node/--require/options.json @@ -0,0 +1,3 @@ +{ + "args": ["foo", "-r", "./dep"] +} diff --git a/packages/babel-node/test/fixtures/babel-node/--require/stdout.txt b/packages/babel-node/test/fixtures/babel-node/--require/stdout.txt new file mode 100644 index 000000000000..4718ef0fa726 --- /dev/null +++ b/packages/babel-node/test/fixtures/babel-node/--require/stdout.txt @@ -0,0 +1,2 @@ +dep +foo diff --git a/packages/babel-node/test/fixtures/babel-node/--require_node_modules/in-files/foo.js b/packages/babel-node/test/fixtures/babel-node/--require_node_modules/in-files/foo.js new file mode 100644 index 000000000000..85ce559e8f22 --- /dev/null +++ b/packages/babel-node/test/fixtures/babel-node/--require_node_modules/in-files/foo.js @@ -0,0 +1 @@ +console.log("foo"); diff --git a/packages/babel-node/test/fixtures/babel-node/--require_node_modules/in-files/node_modules/dep.js b/packages/babel-node/test/fixtures/babel-node/--require_node_modules/in-files/node_modules/dep.js new file mode 100644 index 000000000000..16f81e8b7061 --- /dev/null +++ b/packages/babel-node/test/fixtures/babel-node/--require_node_modules/in-files/node_modules/dep.js @@ -0,0 +1 @@ +console.log("dep"); \ No newline at end of file diff --git a/packages/babel-node/test/fixtures/babel-node/--require_node_modules/options.json b/packages/babel-node/test/fixtures/babel-node/--require_node_modules/options.json new file mode 100644 index 000000000000..473c909f3949 --- /dev/null +++ b/packages/babel-node/test/fixtures/babel-node/--require_node_modules/options.json @@ -0,0 +1,3 @@ +{ + "args": ["foo", "-r", "dep"] +} diff --git a/packages/babel-node/test/fixtures/babel-node/--require_node_modules/stdout.txt b/packages/babel-node/test/fixtures/babel-node/--require_node_modules/stdout.txt new file mode 100644 index 000000000000..4718ef0fa726 --- /dev/null +++ b/packages/babel-node/test/fixtures/babel-node/--require_node_modules/stdout.txt @@ -0,0 +1,2 @@ +dep +foo diff --git a/packages/babel-node/test/fixtures/babel-node/-b/in-files/index.js b/packages/babel-node/test/fixtures/babel-node/-b/in-files/index.js new file mode 100644 index 000000000000..85ce559e8f22 --- /dev/null +++ b/packages/babel-node/test/fixtures/babel-node/-b/in-files/index.js @@ -0,0 +1 @@ +console.log("foo"); diff --git a/packages/babel-node/test/fixtures/babel-node/-b/in-files/presetFile.js b/packages/babel-node/test/fixtures/babel-node/-b/in-files/presetFile.js new file mode 100644 index 000000000000..6e064ea108f2 --- /dev/null +++ b/packages/babel-node/test/fixtures/babel-node/-b/in-files/presetFile.js @@ -0,0 +1,4 @@ +module.exports = function () { + console.log("Preset was loaded, so -b was used."); + return {}; +}; diff --git a/packages/babel-node/test/fixtures/babel-node/-b/options.json b/packages/babel-node/test/fixtures/babel-node/-b/options.json new file mode 100644 index 000000000000..19044775d5e6 --- /dev/null +++ b/packages/babel-node/test/fixtures/babel-node/-b/options.json @@ -0,0 +1,3 @@ +{ + "args": ["-b", "./presetFile.js", "index"] +} diff --git a/packages/babel-node/test/fixtures/babel-node/-b/stdout.txt b/packages/babel-node/test/fixtures/babel-node/-b/stdout.txt new file mode 100644 index 000000000000..29cee3ef1391 --- /dev/null +++ b/packages/babel-node/test/fixtures/babel-node/-b/stdout.txt @@ -0,0 +1,2 @@ +Preset was loaded, so -b was used. +foo diff --git a/packages/babel-node/test/index.js b/packages/babel-node/test/index.js index dfed556b75df..97ee54c02450 100644 --- a/packages/babel-node/test/index.js +++ b/packages/babel-node/test/index.js @@ -2,7 +2,7 @@ const includes = require("lodash/includes"); const readdir = require("fs-readdir-recursive"); const helper = require("@babel/helper-fixtures"); const rimraf = require("rimraf"); -const outputFileSync = require("output-file-sync"); +const { sync: makeDirSync } = require("make-dir"); const child = require("child_process"); const merge = require("lodash/merge"); const path = require("path"); @@ -15,6 +15,11 @@ const fileFilter = function(x) { return x !== ".DS_Store"; }; +const outputFileSync = function(filePath, data) { + makeDirSync(path.dirname(filePath)); + fs.writeFileSync(filePath, data); +}; + const presetLocs = [ path.join(__dirname, "../../babel-preset-env"), path.join(__dirname, "../../babel-preset-react"), @@ -77,7 +82,7 @@ const assertTest = function(stdout, stderr, opts) { const actualFiles = readDir(path.join(tmpLoc)); Object.keys(actualFiles).forEach(function(filename) { - if (!opts.inFiles.hasOwnProperty(filename)) { + if (!Object.prototype.hasOwnProperty.call(opts.inFiles, filename)) { const expected = opts.outFiles[filename]; const actual = actualFiles[filename]; @@ -99,7 +104,6 @@ const buildTest = function(binName, testName, opts) { const binLoc = path.join(__dirname, "../lib", binName); return function(callback) { - clear(); saveInFiles(opts.inFiles); let args = [binLoc]; @@ -146,13 +150,6 @@ const buildTest = function(binName, testName, opts) { }; }; -const clear = function() { - process.chdir(__dirname); - if (fs.existsSync(tmpLoc)) rimraf.sync(tmpLoc); - fs.mkdirSync(tmpLoc); - process.chdir(tmpLoc); -}; - fs.readdirSync(fixtureLoc).forEach(function(binName) { if (binName[0] === ".") return; @@ -162,6 +159,16 @@ fs.readdirSync(fixtureLoc).forEach(function(binName) { beforeEach(() => { cwd = process.cwd(); + + if (fs.existsSync(tmpLoc)) { + for (const child of fs.readdirSync(tmpLoc)) { + rimraf.sync(path.join(tmpLoc, child)); + } + } else { + fs.mkdirSync(tmpLoc); + } + + process.chdir(tmpLoc); }); afterEach(() => { @@ -198,7 +205,7 @@ fs.readdirSync(fixtureLoc).forEach(function(binName) { opts.inFiles[".babelrc"] = helper.readFile(babelrcLoc); } - it(testName, buildTest(binName, testName, opts)); + it(testName, buildTest(binName, testName, opts), 20000); }); }); }); diff --git a/packages/babel-parser/CHANGELOG.md b/packages/babel-parser/CHANGELOG.md index 6ddd17fb8800..8a43406dd600 100644 --- a/packages/babel-parser/CHANGELOG.md +++ b/packages/babel-parser/CHANGELOG.md @@ -2,7 +2,7 @@ > **Tags:** > - :boom: [Breaking Change] -> - :eyeglasses: [Spec Compliancy] +> - :eyeglasses: [Spec Compliance] > - :rocket: [New Feature] > - :bug: [Bug Fix] > - :memo: [Documentation] @@ -56,7 +56,7 @@ See the [Babel Changelog](https://github.com/babel/babel/blob/master/CHANGELOG.m ## 7.0.0-beta.7 (2017-03-22) -### Spec Compliancy +### Spec Compliance * Remove babylon plugin for template revision since it's stage-4 (#426) (Henry Zhu) ### Bug Fix @@ -200,7 +200,7 @@ declare module "C" { } ``` -### :eyeglasses: Spec Compliancy +### :eyeglasses: Spec Compliance Forbid semicolons after decorators in classes ([#352](https://github.com/babel/babylon/pull/352)) (Kevin Gibbons) @@ -305,7 +305,7 @@ AST spec: fix casing of `RegExpLiteral` ([#318](https://github.com/babel/babylon ## 6.15.0 (2017-01-10) -### :eyeglasses: Spec Compliancy +### :eyeglasses: Spec Compliance Add support for Flow shorthand import type ([#267](https://github.com/babel/babylon/pull/267)) (Jeff Morrison) @@ -411,7 +411,7 @@ Will include all parser plugins instead of specifying each one individually. Use ## 6.14.0 (2016-11-16) -### :eyeglasses: Spec Compliancy +### :eyeglasses: Spec Compliance Throw error for reserved words `enum` and `await` ([#195](https://github.com/babel/babylon/pull/195)) (Kai Cataldo) @@ -491,7 +491,7 @@ With that test case, there was a ~95ms savings by removing the need for node to ## v6.13.0 (2016-10-21) -### :eyeglasses: Spec Compliancy +### :eyeglasses: Spec Compliance Property variance type annotations for Flow plugin ([#161](https://github.com/babel/babylon/pull/161)) (Sam Goldman) @@ -549,7 +549,7 @@ Fixes two tests that are failing after the merge of #172 ([#177](https://github. ## v6.12.0 (2016-10-14) -### :eyeglasses: Spec Compliancy +### :eyeglasses: Spec Compliance Implement import() syntax ([#163](https://github.com/babel/babylon/pull/163)) (Jordan Gensler) @@ -643,7 +643,7 @@ export const { foo: [ ,, qux7 ] } = bar; ## v6.11.5 (2016-10-12) -### :eyeglasses: Spec Compliancy +### :eyeglasses: Spec Compliance Fix: Check for duplicate named exports in exported destructuring assignments ([#144](https://github.com/babel/babylon/pull/144)) (Kai Cataldo) @@ -689,7 +689,7 @@ Temporary rollback for erroring on trailing comma with spread (#154) (Henry Zhu) ## v6.11.3 (2016-10-01) -### :eyeglasses: Spec Compliancy +### :eyeglasses: Spec Compliance Add static errors for object rest (#149) ([@danez](https://github.com/danez)) @@ -782,7 +782,7 @@ export toString from './toString'; ## 6.11.0 (2016-09-22) -### Spec Compliancy (will break CI) +### Spec Compliance (will break CI) - Disallow duplicate named exports ([#107](https://github.com/babel/babylon/pull/107)) @kaicataldo @@ -862,9 +862,9 @@ for (+i in {}); ## 6.10.0 (2016-09-19) -> We plan to include some spec compliancy bugs in patch versions. An example was the multiple default exports issue. +> We plan to include some spec compliance bugs in patch versions. An example was the multiple default exports issue. -### Spec Compliancy +### Spec Compliance * Implement ES2016 check for simple parameter list in strict mode ([#106](https://github.com/babel/babylon/pull/106)) (Timothy Gu) @@ -1023,7 +1023,7 @@ declare module "foo" { - The existential type `*` is not a valid type parameter. - The existential type `*` is a primary type -### Spec Compliancy +### Spec Compliance - The param list for type parameter declarations now consists of `TypeParameter` nodes - New `TypeParameter` AST Node (replaces using the `Identifier` node before) diff --git a/packages/babel-parser/package.json b/packages/babel-parser/package.json index 5fa40c1ff68c..743a17d6997a 100644 --- a/packages/babel-parser/package.json +++ b/packages/babel-parser/package.json @@ -1,12 +1,12 @@ { "name": "@babel/parser", - "version": "7.5.5", + "version": "7.8.3", "description": "A JavaScript parser", "author": "Sebastian McKenzie ", "homepage": "https://babeljs.io/", "license": "MIT", "publishConfig": { - "tag": "next" + "access": "public" }, "keywords": [ "babel", @@ -28,8 +28,8 @@ "node": ">=6.0.0" }, "devDependencies": { - "@babel/code-frame": "^7.5.5", - "@babel/helper-fixtures": "^7.5.5", + "@babel/code-frame": "^7.8.3", + "@babel/helper-fixtures": "^7.8.3", "charcodes": "^0.2.0", "unicode-12.0.0": "^0.7.9" }, diff --git a/packages/babel-parser/src/index.js b/packages/babel-parser/src/index.js index d9f812695545..3e9696b858fc 100755 --- a/packages/babel-parser/src/index.js +++ b/packages/babel-parser/src/index.js @@ -25,15 +25,32 @@ export function parse(input: string, options?: Options): File { const parser = getParser(options, input); const ast = parser.parse(); - // Rather than try to parse as a script first, we opt to parse as a module and convert back - // to a script where possible to avoid having to do a full re-parse of the input content. - if (!parser.sawUnambiguousESM) ast.program.sourceType = "script"; + if (parser.sawUnambiguousESM) { + return ast; + } + + if (parser.ambiguousScriptDifferentAst) { + // Top level await introduces code which can be both a valid script and + // a valid module, but which produces different ASTs: + // await + // 0 + // can be parsed either as an AwaitExpression, or as two ExpressionStatements. + try { + options.sourceType = "script"; + return getParser(options, input).parse(); + } catch {} + } else { + // This is both a valid module and a valid script, but + // we parse it as a script by default + ast.program.sourceType = "script"; + } + return ast; } catch (moduleError) { try { options.sourceType = "script"; return getParser(options, input).parse(); - } catch (scriptError) {} + } catch {} throw moduleError; } diff --git a/packages/babel-parser/src/options.js b/packages/babel-parser/src/options.js index 8b030847f970..eb4dd6789605 100755 --- a/packages/babel-parser/src/options.js +++ b/packages/babel-parser/src/options.js @@ -21,6 +21,7 @@ export type Options = { ranges: boolean, tokens: boolean, createParenthesizedExpressions: boolean, + errorRecovery: boolean, }; export const defaultOptions: Options = { @@ -62,6 +63,9 @@ export const defaultOptions: Options = { // Whether to create ParenthesizedExpression AST nodes (if false // the parser sets extra.parenthesized on the expression nodes instead). createParenthesizedExpressions: false, + // When enabled, errors are attached to the AST instead of being directly thrown. + // Some errors will still throw, because @babel/parser can't always recover. + errorRecovery: false, }; // Interpret and default an options object diff --git a/packages/babel-parser/src/parser/base.js b/packages/babel-parser/src/parser/base.js index 1e451794158c..f02e6778270f 100644 --- a/packages/babel-parser/src/parser/base.js +++ b/packages/babel-parser/src/parser/base.js @@ -4,15 +4,18 @@ import type { Options } from "../options"; import type State from "../tokenizer/state"; import type { PluginsMap } from "./index"; import type ScopeHandler from "../util/scope"; +import type ClassScopeHandler from "../util/class-scope"; export default class BaseParser { // Properties set by constructor in index.js options: Options; inModule: boolean; scope: ScopeHandler<*>; + classScope: ClassScopeHandler; plugins: PluginsMap; filename: ?string; sawUnambiguousESM: boolean = false; + ambiguousScriptDifferentAst: boolean = false; // Initialized by Tokenizer state: State; diff --git a/packages/babel-parser/src/parser/comments.js b/packages/babel-parser/src/parser/comments.js index 7f6b6e2de6e2..bf936d2dce10 100644 --- a/packages/babel-parser/src/parser/comments.js +++ b/packages/babel-parser/src/parser/comments.js @@ -38,6 +38,68 @@ export default class CommentsParser extends BaseParser { this.state.leadingComments.push(comment); } + adjustCommentsAfterTrailingComma( + node: Node, + elements: (Node | null)[], + // When the current node is followed by a token which hasn't a respective AST node, we + // need to take all the trailing comments to prevent them from being attached to an + // unrelated node. e.g. in + // var { x } /* cmt */ = { y } + // we don't want /* cmt */ to be attached to { y }. + // On the other hand, in + // fn(x) [new line] /* cmt */ [new line] y + // /* cmt */ is both a trailing comment of fn(x) and a leading comment of y + takeAllComments?: boolean, + ) { + if (this.state.leadingComments.length === 0) { + return; + } + + let lastElement = null; + let i = elements.length; + while (lastElement === null && i > 0) { + lastElement = elements[--i]; + } + if (lastElement === null) { + return; + } + + for (let j = 0; j < this.state.leadingComments.length; j++) { + if ( + this.state.leadingComments[j].end < this.state.commentPreviousNode.end + ) { + this.state.leadingComments.splice(j, 1); + j--; + } + } + + const newTrailingComments = []; + for (let i = 0; i < this.state.leadingComments.length; i++) { + const leadingComment = this.state.leadingComments[i]; + if (leadingComment.end < node.end) { + newTrailingComments.push(leadingComment); + + // Perf: we don't need to splice if we are going to reset the array anyway + if (!takeAllComments) { + this.state.leadingComments.splice(i, 1); + i--; + } + } else { + if (node.trailingComments === undefined) { + node.trailingComments = []; + } + node.trailingComments.push(leadingComment); + } + } + if (takeAllComments) this.state.leadingComments = []; + + if (newTrailingComments.length > 0) { + lastElement.trailingComments = newTrailingComments; + } else if (lastElement.trailingComments !== undefined) { + lastElement.trailingComments = []; + } + } + processComment(node: Node): void { if (node.type === "Program" && node.body.length > 0) return; @@ -84,60 +146,37 @@ export default class CommentsParser extends BaseParser { if (!lastChild && firstChild) lastChild = firstChild; - // Attach comments that follow a trailing comma on the last - // property in an object literal or a trailing comma in function arguments - // as trailing comments - if (firstChild && this.state.leadingComments.length > 0) { - const lastComment = last(this.state.leadingComments); - - if (firstChild.type === "ObjectProperty") { - if (lastComment.start >= node.start) { - if (this.state.commentPreviousNode) { - for (j = 0; j < this.state.leadingComments.length; j++) { - if ( - this.state.leadingComments[j].end < - this.state.commentPreviousNode.end - ) { - this.state.leadingComments.splice(j, 1); - j--; - } - } - - if (this.state.leadingComments.length > 0) { - firstChild.trailingComments = this.state.leadingComments; - this.state.leadingComments = []; - } - } - } - } else if ( - node.type === "CallExpression" && - node.arguments && - node.arguments.length - ) { - const lastArg = last(node.arguments); - - if ( - lastArg && - lastComment.start >= lastArg.start && - lastComment.end <= node.end - ) { - if (this.state.commentPreviousNode) { - for (j = 0; j < this.state.leadingComments.length; j++) { - if ( - this.state.leadingComments[j].end < - this.state.commentPreviousNode.end - ) { - this.state.leadingComments.splice(j, 1); - j--; - } - } - if (this.state.leadingComments.length > 0) { - lastArg.trailingComments = this.state.leadingComments; - this.state.leadingComments = []; - } - } - } + // Adjust comments that follow a trailing comma on the last element in a + // comma separated list of nodes to be the trailing comments on the last + // element + if (firstChild) { + switch (node.type) { + case "ObjectExpression": + this.adjustCommentsAfterTrailingComma(node, node.properties); + break; + case "ObjectPattern": + this.adjustCommentsAfterTrailingComma(node, node.properties, true); + break; + case "CallExpression": + this.adjustCommentsAfterTrailingComma(node, node.arguments); + break; + case "ArrayExpression": + this.adjustCommentsAfterTrailingComma(node, node.elements); + break; + case "ArrayPattern": + this.adjustCommentsAfterTrailingComma(node, node.elements, true); + break; } + } else if ( + this.state.commentPreviousNode && + ((this.state.commentPreviousNode.type === "ImportSpecifier" && + node.type !== "ImportSpecifier") || + (this.state.commentPreviousNode.type === "ExportSpecifier" && + node.type !== "ExportSpecifier")) + ) { + this.adjustCommentsAfterTrailingComma(node, [ + this.state.commentPreviousNode, + ]); } if (lastChild) { diff --git a/packages/babel-parser/src/parser/expression.js b/packages/babel-parser/src/parser/expression.js index 9b48c7129e2f..86c4f0808d78 100644 --- a/packages/babel-parser/src/parser/expression.js +++ b/packages/babel-parser/src/parser/expression.js @@ -19,6 +19,7 @@ // [opp]: http://en.wikipedia.org/wiki/Operator-precedence_parser import { types as tt, type TokenType } from "../tokenizer/types"; +import { types as ct } from "../tokenizer/context"; import * as N from "../types"; import LValParser from "./lval"; import { @@ -38,13 +39,9 @@ import { SCOPE_DIRECT_SUPER, SCOPE_SUPER, SCOPE_PROGRAM, + SCOPE_ASYNC, } from "../util/scopeflags"; - -const unwrapParenthesizedExpression = node => { - return node.type === "ParenthesizedExpression" - ? unwrapParenthesizedExpression(node.expression) - : node; -}; +import { ExpressionErrors } from "./util"; export default class ExpressionParser extends LValParser { // Forward-declaration: defined in statement.js @@ -67,14 +64,14 @@ export default class ExpressionParser extends LValParser { +parseFunctionParams: (node: N.Function, allowModifiers?: boolean) => void; +takeDecorators: (node: N.HasDecorators) => void; - // Check if property name clashes with already added. - // Object/class getters and setters are not allowed to clash — - // either with each other or with an init property — and in - // strict mode, init properties are also not allowed to be repeated. + // Check if property __proto__ has been used more than once. + // If the expression is a destructuring assignment, then __proto__ may appear + // multiple times. Otherwise, __proto__ is a duplicated key. - checkPropClash( + checkDuplicatedProto( prop: N.ObjectMember | N.SpreadElement, - propHash: { [key: string]: boolean }, + protoRef: { used: boolean }, + refExpressionErrors: ?ExpressionErrors, ): void { if ( prop.type === "SpreadElement" || @@ -91,22 +88,33 @@ export default class ExpressionParser extends LValParser { const name = key.type === "Identifier" ? key.name : String(key.value); if (name === "__proto__") { - if (propHash.proto) { - this.raise(key.start, "Redefinition of __proto__ property"); + // Store the first redefinition's position + if (protoRef.used) { + if (refExpressionErrors && refExpressionErrors.doubleProto === -1) { + refExpressionErrors.doubleProto = key.start; + } else { + this.raise(key.start, "Redefinition of __proto__ property"); + } } - propHash.proto = true; + + protoRef.used = true; } } // Convenience method to parse an Expression only getExpression(): N.Expression { - this.scope.enter(SCOPE_PROGRAM); + let scopeFlags = SCOPE_PROGRAM; + if (this.hasPlugin("topLevelAwait") && this.inModule) { + scopeFlags |= SCOPE_ASYNC; + } + this.scope.enter(scopeFlags); this.nextToken(); const expr = this.parseExpression(); if (!this.match(tt.eof)) { this.unexpected(); } expr.comments = this.state.comments; + expr.errors = this.state.errors; return expr; } @@ -125,17 +133,18 @@ export default class ExpressionParser extends LValParser { // and object pattern might appear (so it's possible to raise // delayed syntax error at correct position). - parseExpression(noIn?: boolean, refShorthandDefaultPos?: Pos): N.Expression { + parseExpression( + noIn?: boolean, + refExpressionErrors?: ExpressionErrors, + ): N.Expression { const startPos = this.state.start; const startLoc = this.state.startLoc; - const expr = this.parseMaybeAssign(noIn, refShorthandDefaultPos); + const expr = this.parseMaybeAssign(noIn, refExpressionErrors); if (this.match(tt.comma)) { const node = this.startNodeAt(startPos, startLoc); node.expressions = [expr]; while (this.eat(tt.comma)) { - node.expressions.push( - this.parseMaybeAssign(noIn, refShorthandDefaultPos), - ); + node.expressions.push(this.parseMaybeAssign(noIn, refExpressionErrors)); } this.toReferencedList(node.expressions); return this.finishNode(node, "SequenceExpression"); @@ -148,7 +157,7 @@ export default class ExpressionParser extends LValParser { parseMaybeAssign( noIn?: ?boolean, - refShorthandDefaultPos?: ?Pos, + refExpressionErrors?: ?ExpressionErrors, afterLeftParse?: Function, refNeedsArrowPos?: ?Pos, ): N.Expression { @@ -168,15 +177,12 @@ export default class ExpressionParser extends LValParser { } } - const oldCommaAfterSpreadAt = this.state.commaAfterSpreadAt; - this.state.commaAfterSpreadAt = -1; - - let failOnShorthandAssign; - if (refShorthandDefaultPos) { - failOnShorthandAssign = false; + let ownExpressionErrors; + if (refExpressionErrors) { + ownExpressionErrors = false; } else { - refShorthandDefaultPos = { start: 0 }; - failOnShorthandAssign = true; + refExpressionErrors = new ExpressionErrors(); + ownExpressionErrors = true; } if (this.match(tt.parenL) || this.match(tt.name)) { @@ -185,7 +191,7 @@ export default class ExpressionParser extends LValParser { let left = this.parseMaybeConditional( noIn, - refShorthandDefaultPos, + refExpressionErrors, refNeedsArrowPos, ); if (afterLeftParse) { @@ -197,51 +203,31 @@ export default class ExpressionParser extends LValParser { node.operator = operator; if (operator === "??=") { - this.expectPlugin("nullishCoalescingOperator"); this.expectPlugin("logicalAssignment"); } if (operator === "||=" || operator === "&&=") { this.expectPlugin("logicalAssignment"); } - node.left = this.match(tt.eq) - ? this.toAssignable(left, undefined, "assignment expression") - : left; - refShorthandDefaultPos.start = 0; // reset because shorthand default was used correctly - - this.checkLVal(left, undefined, undefined, "assignment expression"); - - const maybePattern = unwrapParenthesizedExpression(left); - - let patternErrorMsg; - if (maybePattern.type === "ObjectPattern") { - patternErrorMsg = "`({a}) = 0` use `({a} = 0)`"; - } else if (maybePattern.type === "ArrayPattern") { - patternErrorMsg = "`([a]) = 0` use `([a] = 0)`"; + if (this.match(tt.eq)) { + node.left = this.toAssignable(left, undefined, "assignment expression"); + refExpressionErrors.doubleProto = -1; // reset because double __proto__ is valid in assignment expression + } else { + node.left = left; } - if ( - patternErrorMsg && - ((left.extra && left.extra.parenthesized) || - left.type === "ParenthesizedExpression") - ) { - this.raise( - maybePattern.start, - `You're trying to assign to a parenthesized expression, eg. instead of ${patternErrorMsg}`, - ); + if (refExpressionErrors.shorthandAssign >= node.left.start) { + refExpressionErrors.shorthandAssign = -1; // reset because shorthand default was used correctly } - if (patternErrorMsg) this.checkCommaAfterRestFromSpread(); - this.state.commaAfterSpreadAt = oldCommaAfterSpreadAt; + this.checkLVal(left, undefined, undefined, "assignment expression"); this.next(); node.right = this.parseMaybeAssign(noIn); return this.finishNode(node, "AssignmentExpression"); - } else if (failOnShorthandAssign && refShorthandDefaultPos.start) { - this.unexpected(refShorthandDefaultPos.start); + } else if (ownExpressionErrors) { + this.checkExpressionErrors(refExpressionErrors, true); } - this.state.commaAfterSpreadAt = oldCommaAfterSpreadAt; - return left; } @@ -249,13 +235,13 @@ export default class ExpressionParser extends LValParser { parseMaybeConditional( noIn: ?boolean, - refShorthandDefaultPos: Pos, + refExpressionErrors: ExpressionErrors, refNeedsArrowPos?: ?Pos, ): N.Expression { const startPos = this.state.start; const startLoc = this.state.startLoc; const potentialArrowAt = this.state.potentialArrowAt; - const expr = this.parseExprOps(noIn, refShorthandDefaultPos); + const expr = this.parseExprOps(noIn, refExpressionErrors); if ( expr.type === "ArrowFunctionExpression" && @@ -263,7 +249,7 @@ export default class ExpressionParser extends LValParser { ) { return expr; } - if (refShorthandDefaultPos && refShorthandDefaultPos.start) return expr; + if (this.checkExpressionErrors(refExpressionErrors, false)) return expr; return this.parseConditional( expr, @@ -296,11 +282,14 @@ export default class ExpressionParser extends LValParser { // Start the precedence parser. - parseExprOps(noIn: ?boolean, refShorthandDefaultPos: Pos): N.Expression { + parseExprOps( + noIn: ?boolean, + refExpressionErrors: ExpressionErrors, + ): N.Expression { const startPos = this.state.start; const startLoc = this.state.startLoc; const potentialArrowAt = this.state.potentialArrowAt; - const expr = this.parseMaybeUnary(refShorthandDefaultPos); + const expr = this.parseMaybeUnary(refExpressionErrors); if ( expr.type === "ArrowFunctionExpression" && @@ -308,7 +297,7 @@ export default class ExpressionParser extends LValParser { ) { return expr; } - if (refShorthandDefaultPos && refShorthandDefaultPos.start) { + if (this.checkExpressionErrors(refExpressionErrors, false)) { return expr; } @@ -356,8 +345,6 @@ export default class ExpressionParser extends LValParser { this.expectPlugin("pipelineOperator"); this.state.inPipeline = true; this.checkPipelineAtInfixOperator(left, leftStartPos); - } else if (op === tt.nullishCoalescing) { - this.expectPlugin("nullishCoalescingOperator"); } this.next(); @@ -380,6 +367,39 @@ export default class ExpressionParser extends LValParser { node.right = this.parseExprOpRightExpr(op, prec, noIn); + /* this check is for all ?? operators + * a ?? b && c for this example + * b && c => This is considered as a logical expression in the ast tree + * a => Identifier + * so for ?? operator we need to check in this case the right expression to have parenthesis + * second case a && b ?? c + * here a && b => This is considered as a logical expression in the ast tree + * c => identifier + * so now here for ?? operator we need to check the left expression to have parenthesis + * if the parenthesis is missing we raise an error and throw it + */ + if (op === tt.nullishCoalescing) { + if ( + left.type === "LogicalExpression" && + left.operator !== "??" && + !(left.extra && left.extra.parenthesized) + ) { + throw this.raise( + left.start, + `Nullish coalescing operator(??) requires parens when mixing with logical operators`, + ); + } else if ( + node.right.type === "LogicalExpression" && + node.right.operator !== "??" && + !(node.right.extra && node.right.extra.parenthesized) + ) { + throw this.raise( + node.right.start, + `Nullish coalescing operator(??) requires parens when mixing with logical operators`, + ); + } + } + this.finishNode( node, op === tt.logicalOR || @@ -456,12 +476,8 @@ export default class ExpressionParser extends LValParser { // Parse unary operators, both prefix and postfix. - parseMaybeUnary(refShorthandDefaultPos: ?Pos): N.Expression { - if ( - this.isContextual("await") && - (this.scope.inAsync || - (!this.scope.inFunction && this.options.allowAwaitOutsideFunction)) - ) { + parseMaybeUnary(refExpressionErrors: ?ExpressionErrors): N.Expression { + if (this.isContextual("await") && this.isAwaitAllowed()) { return this.parseAwait(); } else if (this.state.type.prefix) { const node = this.startNode(); @@ -476,9 +492,7 @@ export default class ExpressionParser extends LValParser { node.argument = this.parseMaybeUnary(); - if (refShorthandDefaultPos && refShorthandDefaultPos.start) { - this.unexpected(refShorthandDefaultPos.start); - } + this.checkExpressionErrors(refExpressionErrors, true); if (update) { this.checkLVal(node.argument, undefined, undefined, "prefix operation"); @@ -503,8 +517,8 @@ export default class ExpressionParser extends LValParser { const startPos = this.state.start; const startLoc = this.state.startLoc; - let expr = this.parseExprSubscripts(refShorthandDefaultPos); - if (refShorthandDefaultPos && refShorthandDefaultPos.start) return expr; + let expr = this.parseExprSubscripts(refExpressionErrors); + if (this.checkExpressionErrors(refExpressionErrors, false)) return expr; while (this.state.type.postfix && !this.canInsertSemicolon()) { const node = this.startNodeAt(startPos, startLoc); node.operator = this.state.value; @@ -519,11 +533,11 @@ export default class ExpressionParser extends LValParser { // Parse call, dot, and `[]`-subscript expressions. - parseExprSubscripts(refShorthandDefaultPos: ?Pos): N.Expression { + parseExprSubscripts(refExpressionErrors: ?ExpressionErrors): N.Expression { const startPos = this.state.start; const startLoc = this.state.startLoc; const potentialArrowAt = this.state.potentialArrowAt; - const expr = this.parseExprAtom(refShorthandDefaultPos); + const expr = this.parseExprAtom(refExpressionErrors); if ( expr.type === "ArrowFunctionExpression" && @@ -532,7 +546,7 @@ export default class ExpressionParser extends LValParser { return expr; } - if (refShorthandDefaultPos && refShorthandDefaultPos.start) { + if (this.checkExpressionErrors(refExpressionErrors, false)) { return expr; } @@ -545,21 +559,16 @@ export default class ExpressionParser extends LValParser { startLoc: Position, noCalls?: ?boolean, ): N.Expression { - const maybeAsyncArrow = this.atPossibleAsync(base); - const state = { optionalChainMember: false, + maybeAsyncArrow: this.atPossibleAsync(base), stop: false, }; do { - base = this.parseSubscript( - base, - startPos, - startLoc, - noCalls, - state, - maybeAsyncArrow, - ); + base = this.parseSubscript(base, startPos, startLoc, noCalls, state); + + // After parsing a subscript, this isn't "async" for sure. + state.maybeAsyncArrow = false; } while (!state.stop); return base; } @@ -574,7 +583,6 @@ export default class ExpressionParser extends LValParser { startLoc: Position, noCalls: ?boolean, state: N.ParseSubscriptState, - maybeAsyncArrow: boolean, ): N.Expression { if (!noCalls && this.eat(tt.doubleColon)) { const node = this.startNodeAt(startPos, startLoc); @@ -587,90 +595,81 @@ export default class ExpressionParser extends LValParser { startLoc, noCalls, ); - } else if (this.match(tt.questionDot)) { - this.expectPlugin("optionalChaining"); - state.optionalChainMember = true; - if (noCalls && this.lookahead().type === tt.parenL) { + } + let optional = false; + if (this.match(tt.questionDot)) { + state.optionalChainMember = optional = true; + if (noCalls && this.lookaheadCharCode() === charCodes.leftParenthesis) { state.stop = true; return base; } this.next(); - + } + const computed = this.eat(tt.bracketL); + if ( + (optional && !this.match(tt.parenL) && !this.match(tt.backQuote)) || + computed || + this.eat(tt.dot) + ) { const node = this.startNodeAt(startPos, startLoc); + node.object = base; + node.property = computed + ? this.parseExpression() + : optional + ? this.parseIdentifier(true) + : this.parseMaybePrivateName(true); + node.computed = computed; + + if (node.property.type === "PrivateName") { + if (node.object.type === "Super") { + this.raise(startPos, "Private fields can't be accessed on super"); + } + this.classScope.usePrivateName( + node.property.id.name, + node.property.start, + ); + } - if (this.eat(tt.bracketL)) { - node.object = base; - node.property = this.parseExpression(); - node.computed = true; - node.optional = true; + if (computed) { this.expect(tt.bracketR); - return this.finishNode(node, "OptionalMemberExpression"); - } else if (this.eat(tt.parenL)) { - node.callee = base; - node.arguments = this.parseCallExpressionArguments(tt.parenR, false); - node.optional = true; - return this.finishNode(node, "OptionalCallExpression"); - } else { - node.object = base; - node.property = this.parseIdentifier(true); - node.computed = false; - node.optional = true; - return this.finishNode(node, "OptionalMemberExpression"); } - } else if (this.eat(tt.dot)) { - const node = this.startNodeAt(startPos, startLoc); - node.object = base; - node.property = this.parseMaybePrivateName(); - node.computed = false; - if (state.optionalChainMember) { - node.optional = false; - return this.finishNode(node, "OptionalMemberExpression"); - } - return this.finishNode(node, "MemberExpression"); - } else if (this.eat(tt.bracketL)) { - const node = this.startNodeAt(startPos, startLoc); - node.object = base; - node.property = this.parseExpression(); - node.computed = true; - this.expect(tt.bracketR); + if (state.optionalChainMember) { - node.optional = false; + node.optional = optional; return this.finishNode(node, "OptionalMemberExpression"); + } else { + return this.finishNode(node, "MemberExpression"); } - return this.finishNode(node, "MemberExpression"); } else if (!noCalls && this.match(tt.parenL)) { const oldMaybeInArrowParameters = this.state.maybeInArrowParameters; const oldYieldPos = this.state.yieldPos; const oldAwaitPos = this.state.awaitPos; this.state.maybeInArrowParameters = true; - this.state.yieldPos = 0; - this.state.awaitPos = 0; + this.state.yieldPos = -1; + this.state.awaitPos = -1; this.next(); let node = this.startNodeAt(startPos, startLoc); node.callee = base; - const oldCommaAfterSpreadAt = this.state.commaAfterSpreadAt; - this.state.commaAfterSpreadAt = -1; - - node.arguments = this.parseCallExpressionArguments( - tt.parenR, - maybeAsyncArrow, - base.type === "Import", - base.type !== "Super", - ); - if (!state.optionalChainMember) { - this.finishCallExpression(node); + if (optional) { + node.optional = true; + node.arguments = this.parseCallExpressionArguments(tt.parenR, false); } else { - this.finishOptionalCallExpression(node); + node.arguments = this.parseCallExpressionArguments( + tt.parenR, + state.maybeAsyncArrow, + base.type === "Import", + base.type !== "Super", + node, + ); } + this.finishCallExpression(node, state.optionalChainMember); - if (maybeAsyncArrow && this.shouldParseAsyncArrow()) { + if (state.maybeAsyncArrow && this.shouldParseAsyncArrow() && !optional) { state.stop = true; - this.checkCommaAfterRestFromSpread(); - node = this.parseAsyncArrowFromCallExpression( this.startNodeAt(startPos, startLoc), node, @@ -683,12 +682,37 @@ export default class ExpressionParser extends LValParser { // We keep the old value if it isn't null, for cases like // (x = async(yield)) => {} - this.state.yieldPos = oldYieldPos || this.state.yieldPos; - this.state.awaitPos = oldAwaitPos || this.state.awaitPos; + // + // Hi developer of the future :) If you are implementing generator + // arrow functions, please read the note below about "await" and + // verify if the same logic is needed for yield. + if (oldYieldPos !== -1) this.state.yieldPos = oldYieldPos; + + // Await is trickier than yield. When parsing a possible arrow function + // (e.g. something starting with `async(`) we don't know if its possible + // parameters will actually be inside an async arrow function or if it is + // a normal call expression. + // If it ended up being a call expression, if we are in a context where + // await expression are disallowed (and thus "await" is an identifier) + // we must be careful not to leak this.state.awaitPos to an even outer + // context, where "await" could not be an identifier. + // For example, this code is valid because "await" isn't directly inside + // an async function: + // + // async function a() { + // function b(param = async (await)) { + // } + // } + // + if ( + (!this.isAwaitAllowed() && !oldMaybeInArrowParameters) || + oldAwaitPos !== -1 + ) { + this.state.awaitPos = oldAwaitPos; + } } this.state.maybeInArrowParameters = oldMaybeInArrowParameters; - this.state.commaAfterSpreadAt = oldCommaAfterSpreadAt; return node; } else if (this.match(tt.backQuote)) { @@ -737,32 +761,24 @@ export default class ExpressionParser extends LValParser { ); } - finishCallExpression(node: N.CallExpression): N.CallExpression { - if (node.callee.type === "Import") { - if (node.arguments.length !== 1) { - this.raise(node.start, "import() requires exactly one argument"); - } - - const importArg = node.arguments[0]; - if (importArg && importArg.type === "SpreadElement") { - this.raise(importArg.start, "... is not allowed in import()"); - } - } - return this.finishNode(node, "CallExpression"); - } - - finishOptionalCallExpression(node: N.CallExpression): N.CallExpression { + finishCallExpression( + node: T, + optional: boolean, + ): N.Expression { if (node.callee.type === "Import") { if (node.arguments.length !== 1) { this.raise(node.start, "import() requires exactly one argument"); - } - - const importArg = node.arguments[0]; - if (importArg && importArg.type === "SpreadElement") { - this.raise(importArg.start, "... is not allowed in import()"); + } else { + const importArg = node.arguments[0]; + if (importArg && importArg.type === "SpreadElement") { + this.raise(importArg.start, "... is not allowed in import()"); + } } } - return this.finishNode(node, "OptionalCallExpression"); + return this.finishNode( + node, + optional ? "OptionalCallExpression" : "CallExpression", + ); } parseCallExpressionArguments( @@ -770,6 +786,7 @@ export default class ExpressionParser extends LValParser { possibleAsyncArrow: boolean, dynamicImport?: boolean, allowPlaceholder?: boolean, + nodeForExtra?: ?N.Node, ): $ReadOnlyArray { const elts = []; let innerParenStart; @@ -782,13 +799,21 @@ export default class ExpressionParser extends LValParser { first = false; } else { this.expect(tt.comma); - if (this.eat(close)) { + if (this.match(close)) { if (dynamicImport) { this.raise( this.state.lastTokStart, "Trailing comma is disallowed inside import(...) arguments", ); } + if (nodeForExtra) { + this.addExtra( + nodeForExtra, + "trailingComma", + this.state.lastTokStart, + ); + } + this.next(); break; } } @@ -802,7 +827,7 @@ export default class ExpressionParser extends LValParser { elts.push( this.parseExprListItem( false, - possibleAsyncArrow ? { start: 0 } : undefined, + possibleAsyncArrow ? new ExpressionErrors() : undefined, possibleAsyncArrow ? { start: 0 } : undefined, allowPlaceholder, ), @@ -828,7 +853,12 @@ export default class ExpressionParser extends LValParser { call: N.CallExpression, ): N.ArrowFunctionExpression { this.expect(tt.arrow); - this.parseArrowExpression(node, call.arguments, true); + this.parseArrowExpression( + node, + call.arguments, + true, + call.extra?.trailingComma, + ); return node; } @@ -845,7 +875,7 @@ export default class ExpressionParser extends LValParser { // `new`, or an expression wrapped in punctuation like `()`, `[]`, // or `{}`. - parseExprAtom(refShorthandDefaultPos?: ?Pos): N.Expression { + parseExprAtom(refExpressionErrors?: ?ExpressionErrors): N.Expression { // If a division operator appears in an expression position, the // tokenizer got confused, and we force it to read a regexp instead. if (this.state.type === tt.slash) this.readRegexp(); @@ -855,13 +885,6 @@ export default class ExpressionParser extends LValParser { switch (this.state.type) { case tt._super: - if (!this.scope.allowSuper && !this.options.allowSuperOutsideMethod) { - this.raise( - this.state.start, - "super is only allowed in object methods and classes", - ); - } - node = this.startNode(); this.next(); if ( @@ -874,6 +897,14 @@ export default class ExpressionParser extends LValParser { "super() is only valid inside a class constructor of a subclass. " + "Maybe a typo in the method name ('constructor') or not extending another class?", ); + } else if ( + !this.scope.allowSuper && + !this.options.allowSuperOutsideMethod + ) { + this.raise( + node.start, + "super is only allowed in object methods and classes", + ); } if ( @@ -881,7 +912,11 @@ export default class ExpressionParser extends LValParser { !this.match(tt.bracketL) && !this.match(tt.dot) ) { - this.unexpected(); + this.raise( + node.start, + "super can only be used with function calls (i.e. super()) or " + + "in property accesses (i.e. super.prop or super[prop])", + ); } return this.finishNode(node, "Super"); @@ -894,10 +929,11 @@ export default class ExpressionParser extends LValParser { return this.parseImportMetaProperty(node); } - this.expectPlugin("dynamicImport", node.start); - if (!this.match(tt.parenL)) { - this.unexpected(null, tt.parenL); + this.raise( + this.state.lastTokStart, + "import can only be used in import() or import.meta", + ); } return this.finishNode(node, "Import"); case tt._this: @@ -916,6 +952,19 @@ export default class ExpressionParser extends LValParser { this.match(tt._function) && !this.canInsertSemicolon() ) { + const last = this.state.context.length - 1; + if (this.state.context[last] !== ct.functionStatement) { + // Since "async" is an identifier and normally identifiers + // can't be followed by expression, the tokenizer assumes + // that "function" starts a statement. + // Fixing it in the tokenizer would mean tracking not only the + // previous token ("async"), but also the one before to know + // its beforeExpr value. + // It's easier and more efficient to adjust the context here. + throw new Error("Internal error"); + } + this.state.context[last] = ct.functionExpression; + this.next(); return this.parseFunction(node, undefined, true); } else if ( @@ -925,8 +974,18 @@ export default class ExpressionParser extends LValParser { this.match(tt.name) && !this.canInsertSemicolon() ) { + const oldMaybeInArrowParameters = this.state.maybeInArrowParameters; + const oldYieldPos = this.state.yieldPos; + const oldAwaitPos = this.state.awaitPos; + this.state.maybeInArrowParameters = true; + this.state.yieldPos = -1; + this.state.awaitPos = -1; const params = [this.parseIdentifier()]; this.expect(tt.arrow); + this.checkYieldAwaitInDefaultParams(); + this.state.maybeInArrowParameters = oldMaybeInArrowParameters; + this.state.yieldPos = oldYieldPos; + this.state.awaitPos = oldAwaitPos; // let foo = async bar => {}; this.parseArrowExpression(node, params, true); return node; @@ -990,7 +1049,8 @@ export default class ExpressionParser extends LValParser { node.elements = this.parseExprList( tt.bracketR, true, - refShorthandDefaultPos, + refExpressionErrors, + node, ); if (!this.state.maybeInArrowParameters) { // This could be an array pattern: @@ -1007,7 +1067,7 @@ export default class ExpressionParser extends LValParser { const oldInFSharpPipelineDirectBody = this.state .inFSharpPipelineDirectBody; this.state.inFSharpPipelineDirectBody = false; - const ret = this.parseObj(false, refShorthandDefaultPos); + const ret = this.parseObj(false, refExpressionErrors); this.state.inFSharpPipelineDirectBody = oldInFSharpPipelineDirectBody; return ret; } @@ -1057,15 +1117,16 @@ export default class ExpressionParser extends LValParser { } this.next(); - if (this.primaryTopicReferenceIsAllowedInCurrentTopicContext()) { - this.registerTopicReference(); - return this.finishNode(node, "PipelinePrimaryTopicReference"); - } else { - throw this.raise( + + if (!this.primaryTopicReferenceIsAllowedInCurrentTopicContext()) { + this.raise( node.start, `Topic reference was used in a lexical context without topic binding`, ); } + + this.registerTopicReference(); + return this.finishNode(node, "PipelinePrimaryTopicReference"); } } @@ -1081,11 +1142,19 @@ export default class ExpressionParser extends LValParser { return this.finishNode(node, "BooleanLiteral"); } - parseMaybePrivateName(): N.PrivateName | N.Identifier { + parseMaybePrivateName( + isPrivateNameAllowed: boolean, + ): N.PrivateName | N.Identifier { const isPrivate = this.match(tt.hash); if (isPrivate) { this.expectOnePlugin(["classPrivateProperties", "classPrivateMethods"]); + if (!isPrivateNameAllowed) { + this.raise( + this.state.pos, + "Private names can only be used as the name of a class element (i.e. class C { #p = 42; #m() {} } )\n or a property of member expression (i.e. this.#p).", + ); + } const node = this.startNode(); this.next(); this.assertNoSpace("Unexpected space between # and identifier"); @@ -1137,9 +1206,7 @@ export default class ExpressionParser extends LValParser { if (node.property.name !== propertyName || containsEsc) { this.raise( node.property.start, - `The only valid meta property for ${meta.name} is ${ - meta.name - }.${propertyName}`, + `The only valid meta property for ${meta.name} is ${meta.name}.${propertyName}`, ); } @@ -1152,6 +1219,15 @@ export default class ExpressionParser extends LValParser { if (this.isContextual("meta")) { this.expectPlugin("importMeta"); + + if (!this.inModule) { + this.raise( + id.start, + `import.meta may appear only with 'sourceType: "module"'`, + { code: "BABEL_PARSER_SOURCETYPE_MODULE_REQUIRED" }, + ); + } + this.sawUnambiguousESM = true; } else if (!this.hasPlugin("importMeta")) { this.raise( id.start, @@ -1159,15 +1235,6 @@ export default class ExpressionParser extends LValParser { ); } - if (!this.inModule) { - this.raise( - id.start, - `import.meta may appear only with 'sourceType: "module"'`, - { code: "BABEL_PARSER_SOURCETYPE_MODULE_REQUIRED" }, - ); - } - this.sawUnambiguousESM = true; - return this.parseMetaProperty(node, id, "meta"); } @@ -1200,14 +1267,14 @@ export default class ExpressionParser extends LValParser { const oldAwaitPos = this.state.awaitPos; const oldInFSharpPipelineDirectBody = this.state.inFSharpPipelineDirectBody; this.state.maybeInArrowParameters = true; - this.state.yieldPos = 0; - this.state.awaitPos = 0; + this.state.yieldPos = -1; + this.state.awaitPos = -1; this.state.inFSharpPipelineDirectBody = false; const innerStartPos = this.state.start; const innerStartLoc = this.state.startLoc; const exprList = []; - const refShorthandDefaultPos = { start: 0 }; + const refExpressionErrors = new ExpressionErrors(); const refNeedsArrowPos = { start: 0 }; let first = true; let spreadStart; @@ -1236,14 +1303,14 @@ export default class ExpressionParser extends LValParser { ), ); - this.checkCommaAfterRest(); + this.checkCommaAfterRest(charCodes.rightParenthesis); break; } else { exprList.push( this.parseMaybeAssign( false, - refShorthandDefaultPos, + refExpressionErrors, this.parseParenItem, refNeedsArrowPos, ), @@ -1279,17 +1346,15 @@ export default class ExpressionParser extends LValParser { // We keep the old value if it isn't null, for cases like // (x = (yield)) => {} - this.state.yieldPos = oldYieldPos || this.state.yieldPos; - this.state.awaitPos = oldAwaitPos || this.state.awaitPos; + if (oldYieldPos !== -1) this.state.yieldPos = oldYieldPos; + if (oldAwaitPos !== -1) this.state.awaitPos = oldAwaitPos; if (!exprList.length) { this.unexpected(this.state.lastTokStart); } if (optionalCommaStart) this.unexpected(optionalCommaStart); if (spreadStart) this.unexpected(spreadStart); - if (refShorthandDefaultPos.start) { - this.unexpected(refShorthandDefaultPos.start); - } + this.checkExpressionErrors(refExpressionErrors, true); if (refNeedsArrowPos.start) this.unexpected(refNeedsArrowPos.start); this.toReferencedListDeep(exprList, /* isParenthesizedExpr */ true); @@ -1339,12 +1404,15 @@ export default class ExpressionParser extends LValParser { parseNew(): N.NewExpression | N.MetaProperty { const node = this.startNode(); - const meta = this.parseIdentifier(true); + + let meta = this.startNode(); + this.next(); + meta = this.createIdentifier(meta, "new"); if (this.eat(tt.dot)) { const metaProp = this.parseMetaProperty(node, meta, "target"); - if (!this.scope.inNonArrowFunction && !this.state.inClassProperty) { + if (!this.scope.inNonArrowFunction && !this.scope.inClass) { let error = "new.target can only be used in functions"; if (this.hasPlugin("classProperties")) { @@ -1397,13 +1465,7 @@ export default class ExpressionParser extends LValParser { const elem = this.startNode(); if (this.state.value === null) { if (!isTagged) { - // TODO: fix this - this.raise( - this.state.invalidTemplateEscapePosition || 0, - "Invalid escape sequence in template", - ); - } else { - this.state.invalidTemplateEscapePosition = null; + this.raise(this.state.start + 1, "Invalid escape sequence in template"); } } elem.value = { @@ -1437,7 +1499,7 @@ export default class ExpressionParser extends LValParser { parseObj( isPattern: boolean, - refShorthandDefaultPos?: ?Pos, + refExpressionErrors?: ?ExpressionErrors, ): T { const propHash: any = Object.create(null); let first = true; @@ -1451,12 +1513,18 @@ export default class ExpressionParser extends LValParser { first = false; } else { this.expect(tt.comma); - if (this.eat(tt.braceR)) break; + if (this.match(tt.braceR)) { + this.addExtra(node, "trailingComma", this.state.lastTokStart); + this.next(); + break; + } } - const prop = this.parseObjectMember(isPattern, refShorthandDefaultPos); - // $FlowIgnore RestElement will never be returned if !isPattern - if (!isPattern) this.checkPropClash(prop, propHash); + const prop = this.parseObjectMember(isPattern, refExpressionErrors); + if (!isPattern) { + // $FlowIgnore RestElement will never be returned if !isPattern + this.checkDuplicatedProto(prop, propHash, refExpressionErrors); + } // $FlowIgnore if (prop.shorthand) { @@ -1489,7 +1557,7 @@ export default class ExpressionParser extends LValParser { parseObjectMember( isPattern: boolean, - refShorthandDefaultPos: ?Pos, + refExpressionErrors?: ?ExpressionErrors, ): N.ObjectMember | N.SpreadElement | N.RestElement { let decorators = []; if (this.match(tt.at)) { @@ -1498,12 +1566,12 @@ export default class ExpressionParser extends LValParser { this.state.start, "Stage 2 decorators disallow object literal property decorators", ); - } else { - // we needn't check if decorators (stage 0) plugin is enabled since it's checked by - // the call to this.parseDecorator - while (this.match(tt.at)) { - decorators.push(this.parseDecorator()); - } + } + + // we needn't check if decorators (stage 0) plugin is enabled since it's checked by + // the call to this.parseDecorator + while (this.match(tt.at)) { + decorators.push(this.parseDecorator()); } } @@ -1519,7 +1587,7 @@ export default class ExpressionParser extends LValParser { this.next(); // Don't use parseRestBinding() as we only allow Identifier here. prop.argument = this.parseIdentifier(); - this.checkCommaAfterRest(); + this.checkCommaAfterRest(charCodes.rightCurlyBrace); return this.finishNode(prop, "RestElement"); } @@ -1533,7 +1601,7 @@ export default class ExpressionParser extends LValParser { prop.method = false; - if (isPattern || refShorthandDefaultPos) { + if (isPattern || refExpressionErrors) { startPos = this.state.start; startLoc = this.state.startLoc; } @@ -1543,12 +1611,12 @@ export default class ExpressionParser extends LValParser { } const containsEsc = this.state.containsEsc; - this.parsePropertyName(prop); + this.parsePropertyName(prop, /* isPrivateNameAllowed */ false); if (!isPattern && !containsEsc && !isGenerator && this.isAsyncProp(prop)) { isAsync = true; isGenerator = this.eat(tt.star); - this.parsePropertyName(prop); + this.parsePropertyName(prop, /* isPrivateNameAllowed */ false); } else { isAsync = false; } @@ -1560,7 +1628,7 @@ export default class ExpressionParser extends LValParser { isGenerator, isAsync, isPattern, - refShorthandDefaultPos, + refExpressionErrors, containsEsc, ); @@ -1635,7 +1703,7 @@ export default class ExpressionParser extends LValParser { if (!containsEsc && this.isGetterOrSetterMethod(prop, isPattern)) { if (isGenerator || isAsync) this.unexpected(); prop.kind = prop.key.name; - this.parsePropertyName(prop); + this.parsePropertyName(prop, /* isPrivateNameAllowed */ false); this.parseMethod( prop, /* isGenerator */ false, @@ -1654,14 +1722,14 @@ export default class ExpressionParser extends LValParser { startPos: ?number, startLoc: ?Position, isPattern: boolean, - refShorthandDefaultPos: ?Pos, + refExpressionErrors: ?ExpressionErrors, ): ?N.ObjectProperty { prop.shorthand = false; if (this.eat(tt.colon)) { prop.value = isPattern ? this.parseMaybeDefault(this.state.start, this.state.startLoc) - : this.parseMaybeAssign(false, refShorthandDefaultPos); + : this.parseMaybeAssign(false, refExpressionErrors); return this.finishNode(prop, "ObjectProperty"); } @@ -1675,9 +1743,9 @@ export default class ExpressionParser extends LValParser { startLoc, prop.key.__clone(), ); - } else if (this.match(tt.eq) && refShorthandDefaultPos) { - if (!refShorthandDefaultPos.start) { - refShorthandDefaultPos.start = this.state.start; + } else if (this.match(tt.eq) && refExpressionErrors) { + if (refExpressionErrors.shorthandAssign === -1) { + refExpressionErrors.shorthandAssign = this.state.start; } prop.value = this.parseMaybeDefault( startPos, @@ -1700,7 +1768,7 @@ export default class ExpressionParser extends LValParser { isGenerator: boolean, isAsync: boolean, isPattern: boolean, - refShorthandDefaultPos: ?Pos, + refExpressionErrors?: ?ExpressionErrors, containsEsc: boolean, ): void { const node = @@ -1716,7 +1784,7 @@ export default class ExpressionParser extends LValParser { startPos, startLoc, isPattern, - refShorthandDefaultPos, + refExpressionErrors, ); if (!node) this.unexpected(); @@ -1727,6 +1795,7 @@ export default class ExpressionParser extends LValParser { parsePropertyName( prop: N.ObjectOrClassMember | N.ClassMember | N.TsNamedTypeElementBase, + isPrivateNameAllowed: boolean, ): N.Expression | N.Identifier { if (this.eat(tt.bracketL)) { (prop: $FlowSubtype).computed = true; @@ -1737,9 +1806,9 @@ export default class ExpressionParser extends LValParser { this.state.inPropertyName = true; // We check if it's valid for it to be a private name when we push it. (prop: $FlowFixMe).key = - this.match(tt.num) || this.match(tt.string) + this.match(tt.num) || this.match(tt.string) || this.match(tt.bigint) ? this.parseExprAtom() - : this.parseMaybePrivateName(); + : this.parseMaybePrivateName(isPrivateNameAllowed); if (prop.key.type !== "PrivateName") { // ClassPrivateProperty is never computed, so we don't assign in that case. @@ -1773,8 +1842,8 @@ export default class ExpressionParser extends LValParser { ): T { const oldYieldPos = this.state.yieldPos; const oldAwaitPos = this.state.awaitPos; - this.state.yieldPos = 0; - this.state.awaitPos = 0; + this.state.yieldPos = -1; + this.state.awaitPos = -1; this.initFunction(node, isAsync); node.generator = !!isGenerator; @@ -1786,7 +1855,6 @@ export default class ExpressionParser extends LValParser { (allowDirectSuper ? SCOPE_DIRECT_SUPER : 0), ); this.parseFunctionParams((node: any), allowModifiers); - this.checkYieldAwaitInDefaultParams(); this.parseFunctionBodyAndFinish(node, type, true); this.scope.exit(); @@ -1803,6 +1871,7 @@ export default class ExpressionParser extends LValParser { node: N.ArrowFunctionExpression, params: ?(N.Expression[]), isAsync: boolean, + trailingCommaPos: ?number, ): N.ArrowFunctionExpression { this.scope.enter(functionFlags(isAsync, false) | SCOPE_ARROW); this.initFunction(node, isAsync); @@ -1811,10 +1880,10 @@ export default class ExpressionParser extends LValParser { const oldYieldPos = this.state.yieldPos; const oldAwaitPos = this.state.awaitPos; this.state.maybeInArrowParameters = false; - this.state.yieldPos = 0; - this.state.awaitPos = 0; + this.state.yieldPos = -1; + this.state.awaitPos = -1; - if (params) this.setArrowFunctionParameters(node, params); + if (params) this.setArrowFunctionParameters(node, params, trailingCommaPos); this.parseFunctionBody(node, true); this.scope.exit(); @@ -1828,28 +1897,16 @@ export default class ExpressionParser extends LValParser { setArrowFunctionParameters( node: N.ArrowFunctionExpression, params: N.Expression[], + trailingCommaPos: ?number, ): void { node.params = this.toAssignableList( params, true, "arrow function parameters", + trailingCommaPos, ); } - isStrictBody(node: { body: N.BlockStatement }): boolean { - const isBlockStatement = node.body.type === "BlockStatement"; - - if (isBlockStatement && node.body.directives.length) { - for (const directive of node.body.directives) { - if (directive.value.value === "use strict") { - return true; - } - } - } - - return false; - } - parseFunctionBodyAndFinish( node: N.BodilessFunctionOrMethodBase, type: string, @@ -1875,7 +1932,7 @@ export default class ExpressionParser extends LValParser { if (isExpression) { node.body = this.parseMaybeAssign(); - this.checkParams(node, false, allowExpression); + this.checkParams(node, false, allowExpression, false); } else { const nonSimple = !this.isSimpleParamList(node.params); if (!oldStrict || nonSimple) { @@ -1909,6 +1966,7 @@ export default class ExpressionParser extends LValParser { node, !oldStrict && !useStrict && !allowExpression && !isMethod && !nonSimple, allowExpression, + !oldStrict && useStrict, ); node.body = this.parseBlock(true, false); this.state.labels = oldLabels; @@ -1917,7 +1975,14 @@ export default class ExpressionParser extends LValParser { this.state.inParameters = oldInParameters; // Ensure the function name isn't a forbidden identifier in strict mode, e.g. 'eval' if (this.state.strict && node.id) { - this.checkLVal(node.id, BIND_OUTSIDE, undefined, "function name"); + this.checkLVal( + node.id, + BIND_OUTSIDE, + undefined, + "function name", + undefined, + !oldStrict && useStrict, + ); } this.state.strict = oldStrict; } @@ -1936,6 +2001,7 @@ export default class ExpressionParser extends LValParser { allowDuplicates: boolean, // eslint-disable-next-line no-unused-vars isArrowFunction: ?boolean, + strictModeChanged?: boolean = true, ): void { // $FlowIssue const nameHash: {} = Object.create(null); @@ -1944,7 +2010,9 @@ export default class ExpressionParser extends LValParser { node.params[i], BIND_VAR, allowDuplicates ? null : nameHash, - "function paramter list", + "function parameter list", + undefined, + strictModeChanged, ); } } @@ -1958,7 +2026,8 @@ export default class ExpressionParser extends LValParser { parseExprList( close: TokenType, allowEmpty?: boolean, - refShorthandDefaultPos?: ?Pos, + refExpressionErrors?: ?ExpressionErrors, + nodeForExtra?: ?N.Node, ): $ReadOnlyArray { const elts = []; let first = true; @@ -1968,17 +2037,27 @@ export default class ExpressionParser extends LValParser { first = false; } else { this.expect(tt.comma); - if (this.eat(close)) break; + if (this.match(close)) { + if (nodeForExtra) { + this.addExtra( + nodeForExtra, + "trailingComma", + this.state.lastTokStart, + ); + } + this.next(); + break; + } } - elts.push(this.parseExprListItem(allowEmpty, refShorthandDefaultPos)); + elts.push(this.parseExprListItem(allowEmpty, refExpressionErrors)); } return elts; } parseExprListItem( allowEmpty: ?boolean, - refShorthandDefaultPos: ?Pos, + refExpressionErrors?: ?ExpressionErrors, refNeedsArrowPos: ?Pos, allowPlaceholder: ?boolean, ): ?N.Expression { @@ -1989,7 +2068,7 @@ export default class ExpressionParser extends LValParser { const spreadNodeStartPos = this.state.start; const spreadNodeStartLoc = this.state.startLoc; elt = this.parseParenItem( - this.parseSpread(refShorthandDefaultPos, refNeedsArrowPos), + this.parseSpread(refExpressionErrors, refNeedsArrowPos), spreadNodeStartPos, spreadNodeStartLoc, ); @@ -2004,7 +2083,7 @@ export default class ExpressionParser extends LValParser { } else { elt = this.parseMaybeAssign( false, - refShorthandDefaultPos, + refExpressionErrors, this.parseParenItem, refNeedsArrowPos, ); @@ -2015,6 +2094,8 @@ export default class ExpressionParser extends LValParser { // Parse the next token as an identifier. If `liberal` is true (used // when parsing properties), it will also convert keywords into // identifiers. + // This shouldn't be used to parse the keywords of meta properties, since they + // are not identifiers and cannot contain escape sequences. parseIdentifier(liberal?: boolean): N.Identifier { const node = this.startNode(); @@ -2054,7 +2135,11 @@ export default class ExpressionParser extends LValParser { throw this.unexpected(); } - if (!liberal) { + if (liberal) { + // If the current token is not used as a keyword, set its type to "tt.name". + // This will prevent this.next() from throwing about unexpected escapes. + this.state.type = tt.name; + } else { this.checkReservedWord( name, this.state.start, @@ -2079,23 +2164,39 @@ export default class ExpressionParser extends LValParser { startLoc, "Can not use 'yield' as identifier inside a generator", ); + return; } - if (this.scope.inAsync && word === "await") { - this.raise( - startLoc, - "Can not use 'await' as identifier inside an async function", - ); + if (word === "await") { + if (this.scope.inAsync) { + this.raise( + startLoc, + "Can not use 'await' as identifier inside an async function", + ); + return; + } + if ( + this.state.awaitPos === -1 && + (this.state.maybeInArrowParameters || this.isAwaitAllowed()) + ) { + this.state.awaitPos = this.state.start; + } } - if (this.state.inClassProperty && word === "arguments") { + if ( + this.scope.inClass && + !this.scope.inNonArrowFunction && + word === "arguments" + ) { this.raise( startLoc, "'arguments' is not allowed in class field initializer", ); + return; } if (checkKeywords && isKeyword(word)) { this.raise(startLoc, `Unexpected keyword '${word}'`); + return; } const reservedTest = !this.state.strict @@ -2110,17 +2211,24 @@ export default class ExpressionParser extends LValParser { startLoc, "Can not use keyword 'await' outside an async function", ); + } else { + this.raise(startLoc, `Unexpected reserved word '${word}'`); } - this.raise(startLoc, `Unexpected reserved word '${word}'`); } } + isAwaitAllowed(): boolean { + if (this.scope.inFunction) return this.scope.inAsync; + if (this.options.allowAwaitOutsideFunction) return true; + if (this.hasPlugin("topLevelAwait")) { + return this.inModule && this.scope.inAsync; + } + return false; + } + // Parses await expression inside async function. parseAwait(): N.AwaitExpression { - if (!this.state.awaitPos) { - this.state.awaitPos = this.state.start; - } const node = this.startNode(); this.next(); @@ -2130,37 +2238,62 @@ export default class ExpressionParser extends LValParser { node.start, "await is not allowed in async function parameters", ); + } else if (this.state.awaitPos === -1) { + this.state.awaitPos = node.start; } - if (this.match(tt.star)) { + if (this.eat(tt.star)) { this.raise( node.start, "await* has been removed from the async functions proposal. Use Promise.all() instead.", ); } + if (!this.scope.inFunction && !this.options.allowAwaitOutsideFunction) { + if ( + this.hasPrecedingLineBreak() || + // All the following expressions are ambiguous: + // await + 0, await - 0, await ( 0 ), await [ 0 ], await / 0 /u, await `` + this.match(tt.plusMin) || + this.match(tt.parenL) || + this.match(tt.bracketL) || + this.match(tt.backQuote) || + // Sometimes the tokenizer generates tt.slash for regexps, and this is + // handler by parseExprAtom + this.match(tt.regexp) || + this.match(tt.slash) || + // This code could be parsed both as a modulo operator or as an intrinsic: + // await %x(0) + (this.hasPlugin("v8intrinsic") && this.match(tt.modulo)) + ) { + this.ambiguousScriptDifferentAst = true; + } else { + this.sawUnambiguousESM = true; + } + } + if (!this.state.soloAwait) { node.argument = this.parseMaybeUnary(); } + return this.finishNode(node, "AwaitExpression"); } // Parses yield expression inside generator. parseYield(noIn?: ?boolean): N.YieldExpression { - if (!this.state.yieldPos) { - this.state.yieldPos = this.state.start; - } const node = this.startNode(); if (this.state.inParameters) { this.raise(node.start, "yield is not allowed in generator parameters"); + } else if (this.state.yieldPos === -1) { + this.state.yieldPos = node.start; } this.next(); if ( this.match(tt.semi) || (!this.match(tt.star) && !this.state.type.startsExpr) || - this.canInsertSemicolon() + this.hasPrecedingLineBreak() ) { node.delegate = false; node.argument = null; @@ -2179,7 +2312,7 @@ export default class ExpressionParser extends LValParser { if (left.type === "SequenceExpression") { // Ensure that the pipeline head is not a comma-delimited // sequence expression. - throw this.raise( + this.raise( leftStartPos, `Pipeline head should not be a comma-separated sequence expression`, ); @@ -2224,7 +2357,7 @@ export default class ExpressionParser extends LValParser { pipelineStyle === "PipelineTopicExpression" && childExpression.type === "SequenceExpression" ) { - throw this.raise( + this.raise( startPos, `Pipeline body may not be a comma-separated sequence expression`, ); @@ -2250,7 +2383,7 @@ export default class ExpressionParser extends LValParser { break; case "PipelineTopicExpression": if (!this.topicReferenceWasUsedInCurrentTopicContext()) { - throw this.raise( + this.raise( startPos, `Pipeline is in topic style but does not use topic reference`, ); @@ -2258,7 +2391,9 @@ export default class ExpressionParser extends LValParser { bodyNode.expression = childExpression; break; default: - throw this.raise(startPos, `Unknown pipeline style ${pipelineStyle}`); + throw new Error( + `Internal @babel/parser error: Unknown pipeline style (${pipelineStyle})`, + ); } return this.finishNode(bodyNode, pipelineStyle); } diff --git a/packages/babel-parser/src/parser/index.js b/packages/babel-parser/src/parser/index.js index 9e75bf6044d3..d3f5db419c6b 100644 --- a/packages/babel-parser/src/parser/index.js +++ b/packages/babel-parser/src/parser/index.js @@ -5,8 +5,9 @@ import type { File, JSXOpeningElement } from "../types"; import type { PluginList } from "../plugin-utils"; import { getOptions } from "../options"; import StatementParser from "./statement"; -import { SCOPE_PROGRAM } from "../util/scopeflags"; +import { SCOPE_ASYNC, SCOPE_PROGRAM } from "../util/scopeflags"; import ScopeHandler from "../util/scope"; +import ClassScopeHandler from "../util/class-scope"; export type PluginsMap = Map; @@ -25,6 +26,7 @@ export default class Parser extends StatementParser { this.options = options; this.inModule = this.options.sourceType === "module"; this.scope = new ScopeHandler(this.raise.bind(this), this.inModule); + this.classScope = new ClassScopeHandler(this.raise.bind(this)); this.plugins = pluginsMap(this.options.plugins); this.filename = options.sourceFilename; } @@ -35,11 +37,18 @@ export default class Parser extends StatementParser { } parse(): File { - this.scope.enter(SCOPE_PROGRAM); + let scopeFlags = SCOPE_PROGRAM; + if (this.hasPlugin("topLevelAwait") && this.inModule) { + scopeFlags |= SCOPE_ASYNC; + } + this.scope.enter(scopeFlags); const file = this.startNode(); const program = this.startNode(); this.nextToken(); - return this.parseTopLevel(file, program); + file.errors = null; + this.parseTopLevel(file, program); + file.errors = this.state.errors; + return file; } } diff --git a/packages/babel-parser/src/parser/location.js b/packages/babel-parser/src/parser/location.js index 1839f359ae4c..3694a567090a 100644 --- a/packages/babel-parser/src/parser/location.js +++ b/packages/babel-parser/src/parser/location.js @@ -10,6 +10,8 @@ import CommentsParser from "./comments"; // message. export default class LocationParser extends CommentsParser { + +isLookahead: boolean; + getLocationForPosition(pos: number): Position { let loc; if (pos === this.state.start) loc = this.state.startLoc; @@ -31,7 +33,7 @@ export default class LocationParser extends CommentsParser { missingPluginNames?: Array, code?: string, } = {}, - ): empty { + ): Error | empty { const loc = this.getLocationForPosition(pos); message += ` (${loc.line}:${loc.column})`; @@ -47,6 +49,12 @@ export default class LocationParser extends CommentsParser { if (code !== undefined) { err.code = code; } - throw err; + + if (this.options.errorRecovery) { + if (!this.isLookahead) this.state.errors.push(err); + return err; + } else { + throw err; + } } } diff --git a/packages/babel-parser/src/parser/lval.js b/packages/babel-parser/src/parser/lval.js index b4281ab2ffb7..0bb6347ceaab 100644 --- a/packages/babel-parser/src/parser/lval.js +++ b/packages/babel-parser/src/parser/lval.js @@ -1,5 +1,6 @@ // @flow +import * as charCodes from "charcodes"; import { types as tt, type TokenType } from "../tokenizer/types"; import type { TSParameterProperty, @@ -14,28 +15,40 @@ import type { SpreadElement, } from "../types"; import type { Pos, Position } from "../util/location"; -import { isStrictBindReservedWord } from "../util/identifier"; +import { + isStrictBindOnlyReservedWord, + isStrictBindReservedWord, +} from "../util/identifier"; import { NodeUtils } from "./node"; -import { type BindingTypes, BIND_NONE, BIND_LEXICAL } from "../util/scopeflags"; +import { type BindingTypes, BIND_NONE } from "../util/scopeflags"; +import { ExpressionErrors } from "./util"; + +const unwrapParenthesizedExpression = (node: Node) => { + return node.type === "ParenthesizedExpression" + ? unwrapParenthesizedExpression(node.expression) + : node; +}; export default class LValParser extends NodeUtils { // Forward-declaration: defined in expression.js +parseIdentifier: (liberal?: boolean) => Identifier; +parseMaybeAssign: ( noIn?: ?boolean, - refShorthandDefaultPos?: ?Pos, + refExpressionErrors?: ?ExpressionErrors, afterLeftParse?: Function, refNeedsArrowPos?: ?Pos, ) => Expression; +parseObj: ( isPattern: boolean, - refShorthandDefaultPos?: ?Pos, + refExpressionErrors?: ?ExpressionErrors, ) => T; // Forward-declaration: defined in statement.js +parseDecorator: () => Decorator; // Convert existing expression atom to assignable pattern // if possible. + // NOTE: There is a corresponding "isAssignable" method in flow.js. + // When this one is updated, please check if also that one needs to be updated. toAssignable( node: Node, @@ -43,6 +56,20 @@ export default class LValParser extends NodeUtils { contextDescription: string, ): Node { if (node) { + if ( + (this.options.createParenthesizedExpressions && + node.type === "ParenthesizedExpression") || + node.extra?.parenthesized + ) { + const parenthesized = unwrapParenthesizedExpression(node); + if ( + parenthesized.type !== "Identifier" && + parenthesized.type !== "MemberExpression" + ) { + this.raise(node.start, "Invalid parenthesized assignment pattern"); + } + } + switch (node.type) { case "Identifier": case "ObjectPattern": @@ -60,6 +87,14 @@ export default class LValParser extends NodeUtils { const prop = node.properties[i]; const isLast = i === last; this.toAssignableObjectExpressionProp(prop, isBinding, isLast); + + if ( + isLast && + prop.type === "RestElement" && + node.extra?.trailingComma + ) { + this.raiseRestNotLast(node.extra.trailingComma); + } } break; @@ -78,19 +113,25 @@ export default class LValParser extends NodeUtils { case "ArrayExpression": node.type = "ArrayPattern"; - this.toAssignableList(node.elements, isBinding, contextDescription); + this.toAssignableList( + node.elements, + isBinding, + contextDescription, + node.extra?.trailingComma, + ); break; case "AssignmentExpression": - if (node.operator === "=") { - node.type = "AssignmentPattern"; - delete node.operator; - } else { + if (node.operator !== "=") { this.raise( node.left.end, "Only '=' operator can be used for specifying default value.", ); } + + node.type = "AssignmentPattern"; + delete node.operator; + this.toAssignable(node.left, isBinding, contextDescription); break; case "ParenthesizedExpression": @@ -104,14 +145,9 @@ export default class LValParser extends NodeUtils { case "MemberExpression": if (!isBinding) break; - default: { - const message = - "Invalid left-hand side" + - (contextDescription - ? " in " + contextDescription - : /* istanbul ignore next */ "expression"); - this.raise(node.start, message); - } + default: + // We don't know how to deal with this node. It will + // be reported by a later call to checkLVal } } return node; @@ -142,6 +178,7 @@ export default class LValParser extends NodeUtils { exprList: Expression[], isBinding: ?boolean, contextDescription: string, + trailingCommaPos?: ?number, ): $ReadOnlyArray { let end = exprList.length; if (end) { @@ -160,6 +197,11 @@ export default class LValParser extends NodeUtils { ) { this.unexpected(arg.start); } + + if (trailingCommaPos) { + this.raiseTrailingCommaAfterRest(trailingCommaPos); + } + --end; } } @@ -187,7 +229,7 @@ export default class LValParser extends NodeUtils { toReferencedListDeep( exprList: $ReadOnlyArray, isParenthesizedExpr?: boolean, - ): $ReadOnlyArray { + ): void { this.toReferencedList(exprList, isParenthesizedExpr); for (const expr of exprList) { @@ -195,29 +237,22 @@ export default class LValParser extends NodeUtils { this.toReferencedListDeep(expr.elements); } } - - return exprList; } // Parses spread element. parseSpread( - refShorthandDefaultPos: ?Pos, + refExpressionErrors: ?ExpressionErrors, refNeedsArrowPos?: ?Pos, ): SpreadElement { const node = this.startNode(); this.next(); node.argument = this.parseMaybeAssign( false, - refShorthandDefaultPos, + refExpressionErrors, undefined, refNeedsArrowPos, ); - - if (this.state.commaAfterSpreadAt === -1 && this.match(tt.comma)) { - this.state.commaAfterSpreadAt = this.state.start; - } - return this.finishNode(node, "SpreadElement"); } @@ -234,7 +269,11 @@ export default class LValParser extends NodeUtils { case tt.bracketL: { const node = this.startNode(); this.next(); - node.elements = this.parseBindingList(tt.bracketR, true); + node.elements = this.parseBindingList( + tt.bracketR, + charCodes.rightSquareBracket, + true, + ); return this.finishNode(node, "ArrayPattern"); } @@ -247,6 +286,7 @@ export default class LValParser extends NodeUtils { parseBindingList( close: TokenType, + closeCharCode: $Values, allowEmpty?: boolean, allowModifiers?: boolean, ): $ReadOnlyArray { @@ -265,7 +305,7 @@ export default class LValParser extends NodeUtils { break; } else if (this.match(tt.ellipsis)) { elts.push(this.parseAssignableListItemTypes(this.parseRestBinding())); - this.checkCommaAfterRest(); + this.checkCommaAfterRest(closeCharCode); this.expect(close); break; } else { @@ -328,12 +368,19 @@ export default class LValParser extends NodeUtils { bindingType: BindingTypes = BIND_NONE, checkClashes: ?{ [key: string]: boolean }, contextDescription: string, + disallowLetBinding?: boolean, + strictModeChanged?: boolean = false, ): void { switch (expr.type) { case "Identifier": if ( this.state.strict && - isStrictBindReservedWord(expr.name, this.inModule) + // "Global" reserved words have already been checked by parseIdentifier, + // unless they have been found in the id or parameters of a strict-mode + // function in a sloppy context. + (strictModeChanged + ? isStrictBindReservedWord(expr.name, this.inModule) + : isStrictBindOnlyReservedWord(expr.name)) ) { this.raise( expr.start, @@ -363,7 +410,7 @@ export default class LValParser extends NodeUtils { checkClashes[key] = true; } } - if (bindingType === BIND_LEXICAL && expr.name === "let") { + if (disallowLetBinding && expr.name === "let") { this.raise( expr.start, "'let' is not allowed to be used as a name in 'let' or 'const' declarations.", @@ -383,11 +430,17 @@ export default class LValParser extends NodeUtils { case "ObjectPattern": for (let prop of expr.properties) { if (prop.type === "ObjectProperty") prop = prop.value; + // If we find here an ObjectMethod, it's because this was originally + // an ObjectExpression which has then been converted. + // toAssignable already reported this error with a nicer message. + else if (prop.type === "ObjectMethod") continue; + this.checkLVal( prop, bindingType, checkClashes, "object destructuring pattern", + disallowLetBinding, ); } break; @@ -400,6 +453,7 @@ export default class LValParser extends NodeUtils { bindingType, checkClashes, "array destructuring pattern", + disallowLetBinding, ); } } @@ -455,19 +509,21 @@ export default class LValParser extends NodeUtils { } } - checkCommaAfterRest(): void { + checkCommaAfterRest(close: $Values): void { if (this.match(tt.comma)) { - this.raiseRestNotLast(this.state.start); + if (this.lookaheadCharCode() === close) { + this.raiseTrailingCommaAfterRest(this.state.start); + } else { + this.raiseRestNotLast(this.state.start); + } } } - checkCommaAfterRestFromSpread(): void { - if (this.state.commaAfterSpreadAt > -1) { - this.raiseRestNotLast(this.state.commaAfterSpreadAt); - } + raiseRestNotLast(pos: number) { + throw this.raise(pos, `Rest element must be last element`); } - raiseRestNotLast(pos: number) { - this.raise(pos, `Rest element must be last element`); + raiseTrailingCommaAfterRest(pos: number) { + this.raise(pos, `Unexpected trailing comma after rest element`); } } diff --git a/packages/babel-parser/src/parser/statement.js b/packages/babel-parser/src/parser/statement.js index b677bfd0c9e2..a57a618c9748 100644 --- a/packages/babel-parser/src/parser/statement.js +++ b/packages/babel-parser/src/parser/statement.js @@ -8,7 +8,7 @@ import { isIdentifierStart, keywordRelationalOperator, } from "../util/identifier"; -import { lineBreak, skipWhiteSpace } from "../util/whitespace"; +import { lineBreak } from "../util/whitespace"; import * as charCodes from "charcodes"; import { BIND_CLASS, @@ -20,7 +20,14 @@ import { SCOPE_OTHER, SCOPE_SIMPLE_CATCH, SCOPE_SUPER, + CLASS_ELEMENT_OTHER, + CLASS_ELEMENT_INSTANCE_GETTER, + CLASS_ELEMENT_INSTANCE_SETTER, + CLASS_ELEMENT_STATIC_GETTER, + CLASS_ELEMENT_STATIC_SETTER, + type BindingTypes, } from "../util/scopeflags"; +import { ExpressionErrors } from "./util"; const loopLabel = { kind: "loop" }, switchLabel = { kind: "switch" }; @@ -104,10 +111,7 @@ export default class StatementParser extends ExpressionParser { if (!this.isContextual("let")) { return false; } - skipWhiteSpace.lastIndex = this.state.pos; - const skip = skipWhiteSpace.exec(this.input); - // $FlowIgnore - const next = this.state.pos + skip[0].length; + const next = this.nextTokenStart(); const nextCh = this.input.charCodeAt(next); // For ambiguous cases, determine if a LexicalDeclaration (or only a // Statement) is allowed here. If context is not empty then only a Statement @@ -169,7 +173,7 @@ export default class StatementParser extends ExpressionParser { case tt._for: return this.parseForStatement(node); case tt._function: - if (this.lookahead().type === tt.dot) break; + if (this.lookaheadCharCode() === charCodes.dot) break; if (context) { if (this.state.strict) { this.raise( @@ -205,7 +209,7 @@ export default class StatementParser extends ExpressionParser { case tt._var: kind = kind || this.state.value; if (context && kind !== "var") { - this.unexpected( + this.raise( this.state.start, "Lexical declaration cannot appear in a single-statement context", ); @@ -222,8 +226,11 @@ export default class StatementParser extends ExpressionParser { return this.parseEmptyStatement(node); case tt._export: case tt._import: { - const nextToken = this.lookahead(); - if (nextToken.type === tt.parenL || nextToken.type === tt.dot) { + const nextTokenCharCode = this.lookaheadCharCode(); + if ( + nextTokenCharCode === charCodes.leftParenthesis || + nextTokenCharCode === charCodes.dot + ) { break; } @@ -268,8 +275,8 @@ export default class StatementParser extends ExpressionParser { default: { if (this.isAsyncFunction()) { if (context) { - this.unexpected( - null, + this.raise( + this.state.start, "Async functions can only be declared at the top level or inside a block", ); } @@ -350,7 +357,7 @@ export default class StatementParser extends ExpressionParser { ); } } else if (!this.canHaveLeadingDecorator()) { - this.raise( + throw this.raise( this.state.start, "Leading decorators must be attached to a class declaration", ); @@ -494,11 +501,7 @@ export default class StatementParser extends ExpressionParser { this.state.labels.push(loopLabel); let awaitAt = -1; - if ( - (this.scope.inAsync || - (!this.scope.inFunction && this.options.allowAwaitOutsideFunction)) && - this.eatContextual("await") - ) { + if (this.isAwaitAllowed() && this.eatContextual("await")) { awaitAt = this.state.lastTokStart; } this.scope.enter(SCOPE_OTHER); @@ -531,8 +534,8 @@ export default class StatementParser extends ExpressionParser { return this.parseFor(node, init); } - const refShorthandDefaultPos = { start: 0 }; - const init = this.parseExpression(true, refShorthandDefaultPos); + const refExpressionErrors = new ExpressionErrors(); + const init = this.parseExpression(true, refExpressionErrors); if (this.match(tt._in) || this.isContextual("of")) { const description = this.isContextual("of") ? "for-of statement" @@ -540,8 +543,8 @@ export default class StatementParser extends ExpressionParser { this.toAssignable(init, undefined, description); this.checkLVal(init, undefined, undefined, description); return this.parseForIn(node, init, awaitAt); - } else if (refShorthandDefaultPos.start) { - this.unexpected(refShorthandDefaultPos.start); + } else { + this.checkExpressionErrors(refExpressionErrors, true); } if (awaitAt > -1) { this.unexpected(awaitAt); @@ -1020,6 +1023,7 @@ export default class StatementParser extends ExpressionParser { kind === "var" ? BIND_VAR : BIND_LEXICAL, undefined, "variable declaration", + kind !== "var", ); } @@ -1038,7 +1042,7 @@ export default class StatementParser extends ExpressionParser { this.initFunction(node, isAsync); if (this.match(tt.star) && isHangingStatement) { - this.unexpected( + this.raise( this.state.start, "Generators can only be declared at the top level or inside a block", ); @@ -1049,12 +1053,12 @@ export default class StatementParser extends ExpressionParser { node.id = this.parseFunctionId(requireId); } - const oldInClassProperty = this.state.inClassProperty; + const oldMaybeInArrowParameters = this.state.maybeInArrowParameters; const oldYieldPos = this.state.yieldPos; const oldAwaitPos = this.state.awaitPos; - this.state.inClassProperty = false; - this.state.yieldPos = 0; - this.state.awaitPos = 0; + this.state.maybeInArrowParameters = false; + this.state.yieldPos = -1; + this.state.awaitPos = -1; this.scope.enter(functionFlags(node.async, node.generator)); if (!isStatement) { @@ -1077,13 +1081,13 @@ export default class StatementParser extends ExpressionParser { this.scope.exit(); if (isStatement && !isHangingStatement) { - // We need to validate this _after_ parsing the function body + // We need to register this _after_ parsing the function body // because of TypeScript body-less function declarations, // which shouldn't be added to the scope. - this.checkFunctionStatementId(node); + this.registerFunctionStatementId(node); } - this.state.inClassProperty = oldInClassProperty; + this.state.maybeInArrowParameters = oldMaybeInArrowParameters; this.state.yieldPos = oldYieldPos; this.state.awaitPos = oldAwaitPos; @@ -1101,6 +1105,7 @@ export default class StatementParser extends ExpressionParser { this.expect(tt.parenL); node.params = this.parseBindingList( tt.parenR, + charCodes.rightParenthesis, /* allowEmpty */ false, allowModifiers, ); @@ -1109,22 +1114,21 @@ export default class StatementParser extends ExpressionParser { this.checkYieldAwaitInDefaultParams(); } - checkFunctionStatementId(node: N.Function): void { + registerFunctionStatementId(node: N.Function): void { if (!node.id) return; // If it is a regular function declaration in sloppy mode, then it is // subject to Annex B semantics (BIND_FUNCTION). Otherwise, the binding // mode depends on properties of the current scope (see // treatFunctionsAsVar). - this.checkLVal( - node.id, + this.scope.declareName( + node.id.name, this.state.strict || node.generator || node.async ? this.scope.treatFunctionsAsVar ? BIND_VAR : BIND_LEXICAL : BIND_FUNCTION, - null, - "function name", + node.id.start, ); } @@ -1173,7 +1177,7 @@ export default class StatementParser extends ExpressionParser { } parseClassBody(constructorAllowsSuper: boolean): N.ClassBody { - this.state.classLevel++; + this.classScope.enter(); const state = { hadConstructor: false }; let decorators: N.Decorator[] = []; @@ -1189,7 +1193,7 @@ export default class StatementParser extends ExpressionParser { while (!this.eat(tt.braceR)) { if (this.eat(tt.semi)) { if (decorators.length > 0) { - this.raise( + throw this.raise( this.state.lastTokEnd, "Decorators must not be followed by a semicolon", ); @@ -1227,13 +1231,13 @@ export default class StatementParser extends ExpressionParser { }); if (decorators.length) { - this.raise( + throw this.raise( this.state.start, "You have trailing decorators with no method", ); } - this.state.classLevel--; + this.classScope.exit(); return this.finishNode(classBody, "ClassBody"); } @@ -1342,6 +1346,7 @@ export default class StatementParser extends ExpressionParser { const isPrivate = key.type === "PrivateName"; // Check the key is not a computed expression or string literal. const isSimple = key.type === "Identifier"; + const maybeQuestionTokenStart = this.state.start; this.parsePostMemberNameModifiers(publicMember); @@ -1359,13 +1364,6 @@ export default class StatementParser extends ExpressionParser { if (isConstructor) { publicMethod.kind = "constructor"; - if (publicMethod.decorators) { - this.raise( - publicMethod.start, - "You can't attach decorators to a class constructor", - ); - } - // TypeScript allows multiple overloaded constructor declarations. if (state.hadConstructor && !this.hasPlugin("typescript")) { this.raise(key.start, "Duplicate constructor in the same class"); @@ -1397,9 +1395,14 @@ export default class StatementParser extends ExpressionParser { // an async method const isGenerator = this.eat(tt.star); + if (publicMember.optional) { + this.unexpected(maybeQuestionTokenStart); + } + method.kind = "method"; // The so-called parsed name would have been "async": get the real name. this.parseClassPropertyName(method); + this.parsePostMemberNameModifiers(publicMember); if (method.key.type === "PrivateName") { // private async method @@ -1472,7 +1475,7 @@ export default class StatementParser extends ExpressionParser { } parseClassPropertyName(member: N.ClassMember): N.Expression | N.Identifier { - const key = this.parsePropertyName(member); + const key = this.parsePropertyName(member, /* isPrivateNameAllowed */ true); if ( !member.computed && @@ -1497,13 +1500,18 @@ export default class StatementParser extends ExpressionParser { } pushClassProperty(classBody: N.ClassBody, prop: N.ClassProperty) { - // This only affects properties, not methods. - if (this.isNonstaticConstructor(prop)) { + if ( + !prop.computed && + (prop.key.name === "constructor" || prop.key.value === "constructor") + ) { + // Non-computed field, which is either an identifier named "constructor" + // or a string literal named "constructor" this.raise( prop.key.start, - "Classes may not have a non-static field named 'constructor'", + "Classes may not have a field named 'constructor'", ); } + classBody.body.push(this.parseClassProperty(prop)); } @@ -1512,7 +1520,15 @@ export default class StatementParser extends ExpressionParser { prop: N.ClassPrivateProperty, ) { this.expectPlugin("classPrivateProperties", prop.key.start); - classBody.body.push(this.parseClassPrivateProperty(prop)); + + const node = this.parseClassPrivateProperty(prop); + classBody.body.push(node); + + this.classScope.declarePrivateName( + node.key.id.name, + CLASS_ELEMENT_OTHER, + node.key.start, + ); } pushClassMethod( @@ -1543,17 +1559,29 @@ export default class StatementParser extends ExpressionParser { isAsync: boolean, ): void { this.expectPlugin("classPrivateMethods", method.key.start); - classBody.body.push( - this.parseMethod( - method, - isGenerator, - isAsync, - /* isConstructor */ false, - false, - "ClassPrivateMethod", - true, - ), + + const node = this.parseMethod( + method, + isGenerator, + isAsync, + /* isConstructor */ false, + false, + "ClassPrivateMethod", + true, ); + classBody.body.push(node); + + const kind = + node.kind === "get" + ? node.static + ? CLASS_ELEMENT_STATIC_GETTER + : CLASS_ELEMENT_INSTANCE_GETTER + : node.kind === "set" + ? node.static + ? CLASS_ELEMENT_STATIC_SETTER + : CLASS_ELEMENT_INSTANCE_SETTER + : CLASS_ELEMENT_OTHER; + this.classScope.declarePrivateName(node.key.id.name, kind, node.key.start); } // Overridden in typescript.js @@ -1570,13 +1598,10 @@ export default class StatementParser extends ExpressionParser { parseClassPrivateProperty( node: N.ClassPrivateProperty, ): N.ClassPrivateProperty { - this.state.inClassProperty = true; - this.scope.enter(SCOPE_CLASS | SCOPE_SUPER); node.value = this.eat(tt.eq) ? this.parseMaybeAssign() : null; this.semicolon(); - this.state.inClassProperty = false; this.scope.exit(); @@ -1588,8 +1613,6 @@ export default class StatementParser extends ExpressionParser { this.expectPlugin("classProperties"); } - this.state.inClassProperty = true; - this.scope.enter(SCOPE_CLASS | SCOPE_SUPER); if (this.match(tt.eq)) { @@ -1600,7 +1623,6 @@ export default class StatementParser extends ExpressionParser { node.value = null; } this.semicolon(); - this.state.inClassProperty = false; this.scope.exit(); @@ -1611,11 +1633,12 @@ export default class StatementParser extends ExpressionParser { node: N.Class, isStatement: boolean, optionalId: ?boolean, + bindingType: BindingTypes = BIND_CLASS, ): void { if (this.match(tt.name)) { node.id = this.parseIdentifier(); if (isStatement) { - this.checkLVal(node.id, BIND_CLASS, undefined, "class name"); + this.checkLVal(node.id, bindingType, undefined, "class name"); } } else { if (optionalId || !isStatement) { @@ -1702,7 +1725,6 @@ export default class StatementParser extends ExpressionParser { maybeParseExportNamespaceSpecifier(node: N.Node): boolean { if (this.isContextual("as")) { if (!node.specifiers) node.specifiers = []; - this.expectPlugin("exportNamespaceFrom"); const specifier = this.startNodeAt( this.state.lastTokStart, @@ -1736,11 +1758,11 @@ export default class StatementParser extends ExpressionParser { maybeParseExportDeclaration(node: N.Node): boolean { if (this.shouldParseExportDeclaration()) { if (this.isContextual("async")) { - const next = this.lookahead(); + const next = this.nextTokenStart(); // export async; - if (next.type !== tt._function) { - this.unexpected(next.start, `Unexpected token, expected "function"`); + if (!this.isUnparsedContextual(next, "function")) { + this.unexpected(next, `Unexpected token, expected "function"`); } } @@ -1755,21 +1777,10 @@ export default class StatementParser extends ExpressionParser { isAsyncFunction(): boolean { if (!this.isContextual("async")) return false; - - const { pos } = this.state; - - skipWhiteSpace.lastIndex = pos; - const skip = skipWhiteSpace.exec(this.input); - - if (!skip || !skip.length) return false; - - const next = pos + skip[0].length; - + const next = this.nextTokenStart(); return ( - !lineBreak.test(this.input.slice(pos, next)) && - this.input.slice(next, next + 8) === "function" && - (next + 8 === this.length || - !isIdentifierChar(this.input.charCodeAt(next + 8))) + !lineBreak.test(this.input.slice(this.state.pos, next)) && + this.isUnparsedContextual(next, "function") ); } @@ -1796,7 +1807,7 @@ export default class StatementParser extends ExpressionParser { this.hasPlugin("decorators") && this.getPluginOption("decorators", "decoratorsBeforeExport") ) { - this.unexpected( + this.raise( this.state.start, "Decorators must be placed *before* the 'export' keyword." + " You can set the 'decoratorsBeforeExport' option to false to use" + @@ -1806,7 +1817,7 @@ export default class StatementParser extends ExpressionParser { this.parseDecorators(false); return this.parseClass(expr, true, true); } else if (this.match(tt._const) || this.match(tt._var) || this.isLet()) { - return this.raise( + throw this.raise( this.state.start, "Only expressions, functions or classes are allowed as the `default` export.", ); @@ -1831,10 +1842,10 @@ export default class StatementParser extends ExpressionParser { return false; } - const lookahead = this.lookahead(); + const next = this.nextTokenStart(); return ( - lookahead.type === tt.comma || - (lookahead.type === tt.name && lookahead.value === "from") + this.input.charCodeAt(next) === charCodes.comma || + this.isUnparsedContextual(next, "from") ); } @@ -1976,7 +1987,7 @@ export default class StatementParser extends ExpressionParser { name: string, ): void { if (this.state.exportedIdentifiers.indexOf(name) > -1) { - throw this.raise( + this.raise( node.start, name === "default" ? "Only one default export allowed per module." @@ -2097,8 +2108,8 @@ export default class StatementParser extends ExpressionParser { } else { // Detect an attempt to deep destructure if (this.eat(tt.colon)) { - this.unexpected( - null, + throw this.raise( + this.state.start, "ES2015 named imports do not destructure. " + "Use another statement for destructuring after the import.", ); diff --git a/packages/babel-parser/src/parser/util.js b/packages/babel-parser/src/parser/util.js index bd6139a2480a..ceb42ef5a410 100644 --- a/packages/babel-parser/src/parser/util.js +++ b/packages/babel-parser/src/parser/util.js @@ -2,11 +2,22 @@ import { types as tt, type TokenType } from "../tokenizer/types"; import Tokenizer from "../tokenizer"; +import State from "../tokenizer/state"; import type { Node } from "../types"; import { lineBreak, skipWhiteSpace } from "../util/whitespace"; +import { isIdentifierChar } from "../util/identifier"; +import * as charCodes from "charcodes"; const literal = /^('|")((?:\\?.)*?)\1/; +type TryParse = { + node: Node, + error: Error, + thrown: Thrown, + aborted: Aborted, + failState: FailState, +}; + // ## Parser utilities export default class UtilParser extends Tokenizer { @@ -26,8 +37,15 @@ export default class UtilParser extends Tokenizer { } isLookaheadRelational(op: "<" | ">"): boolean { - const l = this.lookahead(); - return l.type === tt.relational && l.value === op; + const next = this.nextTokenStart(); + if (this.input.charAt(next) === op) { + if (next + 1 === this.input.length) { + return true; + } + const afterNext = this.input.charCodeAt(next + 1); + return afterNext !== op.charCodeAt(0) && afterNext !== charCodes.equalsTo; + } + return false; } // TODO @@ -40,16 +58,6 @@ export default class UtilParser extends Tokenizer { } } - // eat() for relational operators. - - eatRelational(op: "<" | ">"): boolean { - if (this.isRelational(op)) { - this.next(); - return true; - } - return false; - } - // Tests whether parsed token is a contextual keyword. isContextual(name: string): boolean { @@ -60,9 +68,18 @@ export default class UtilParser extends Tokenizer { ); } + isUnparsedContextual(nameStart: number, name: string): boolean { + const nameEnd = nameStart + name.length; + return ( + this.input.slice(nameStart, nameEnd) === name && + (nameEnd === this.input.length || + !isIdentifierChar(this.input.charCodeAt(nameEnd))) + ); + } + isLookaheadContextual(name: string): boolean { - const l = this.lookahead(); - return l.type === tt.name && l.value === name; + const next = this.nextTokenStart(); + return this.isUnparsedContextual(next, name); } // Consumes contextual keyword if possible. @@ -159,15 +176,15 @@ export default class UtilParser extends Tokenizer { checkYieldAwaitInDefaultParams() { if ( - this.state.yieldPos && - (!this.state.awaitPos || this.state.yieldPos < this.state.awaitPos) + this.state.yieldPos !== -1 && + (this.state.awaitPos === -1 || this.state.yieldPos < this.state.awaitPos) ) { this.raise( this.state.yieldPos, "Yield cannot be used as name inside a generator function", ); } - if (this.state.awaitPos) { + if (this.state.awaitPos !== -1) { this.raise( this.state.awaitPos, "Await cannot be used as name inside an async function", @@ -197,4 +214,89 @@ export default class UtilParser extends Tokenizer { return false; } + + // tryParse will clone parser state. + // It is expensive and should be used with cautions + tryParse>( + fn: (abort: (node?: T) => empty) => T, + oldState: State = this.state.clone(), + ): + | TryParse + | TryParse + | TryParse { + const abortSignal: { node: T | null } = { node: null }; + try { + const node = fn((node = null) => { + abortSignal.node = node; + throw abortSignal; + }); + if (this.state.errors.length > oldState.errors.length) { + const failState = this.state; + this.state = oldState; + return { + node, + error: (failState.errors[oldState.errors.length]: SyntaxError), + thrown: false, + aborted: false, + failState, + }; + } + + return { + node, + error: null, + thrown: false, + aborted: false, + failState: null, + }; + } catch (error) { + const failState = this.state; + this.state = oldState; + if (error instanceof SyntaxError) { + return { node: null, error, thrown: true, aborted: false, failState }; + } + if (error === abortSignal) { + return { + node: abortSignal.node, + error: null, + thrown: false, + aborted: true, + failState, + }; + } + + throw error; + } + } + + checkExpressionErrors( + refExpressionErrors: ?ExpressionErrors, + andThrow: boolean, + ) { + if (!refExpressionErrors) return false; + const { shorthandAssign, doubleProto } = refExpressionErrors; + if (!andThrow) return shorthandAssign >= 0 || doubleProto >= 0; + if (shorthandAssign >= 0) { + this.unexpected(shorthandAssign); + } + if (doubleProto >= 0) { + this.raise(doubleProto, "Redefinition of __proto__ property"); + } + } +} + +/** + * The ExpressionErrors is a context struct used to track + * - **shorthandAssign**: track initializer `=` position when parsing ambiguous + * patterns. When we are sure the parsed pattern is a RHS, which means it is + * not a pattern, we will throw on this position on invalid assign syntax, + * otherwise it will be reset to -1 + * - **doubleProto**: track the duplicate `__proto__` key position when parsing + * ambiguous object patterns. When we are sure the parsed pattern is a RHS, + * which means it is an object literal, we will throw on this position for + * __proto__ redefinition, otherwise it will be reset to -1 + */ +export class ExpressionErrors { + shorthandAssign = -1; + doubleProto = -1; } diff --git a/packages/babel-parser/src/plugin-utils.js b/packages/babel-parser/src/plugin-utils.js index c1cb6a6b7e92..2cf522532197 100644 --- a/packages/babel-parser/src/plugin-utils.js +++ b/packages/babel-parser/src/plugin-utils.js @@ -69,6 +69,10 @@ export function validatePlugins(plugins: PluginList) { throw new Error("Cannot combine flow and typescript plugins."); } + if (hasPlugin(plugins, "placeholders") && hasPlugin(plugins, "v8intrinsic")) { + throw new Error("Cannot combine placeholders and v8intrinsic plugins."); + } + if ( hasPlugin(plugins, "pipelineOperator") && !PIPELINE_PROPOSALS.includes( @@ -89,6 +93,7 @@ import flow from "./plugins/flow"; import jsx from "./plugins/jsx"; import typescript from "./plugins/typescript"; import placeholders from "./plugins/placeholders"; +import v8intrinsic from "./plugins/v8intrinsic"; // NOTE: order is important. estree must come first; placeholders must come last. export const mixinPlugins: { [name: string]: MixinPlugin } = { @@ -96,6 +101,7 @@ export const mixinPlugins: { [name: string]: MixinPlugin } = { jsx, flow, typescript, + v8intrinsic, placeholders, }; diff --git a/packages/babel-parser/src/plugins/estree.js b/packages/babel-parser/src/plugins/estree.js index a407b8ac84ca..9cd825945015 100644 --- a/packages/babel-parser/src/plugins/estree.js +++ b/packages/babel-parser/src/plugins/estree.js @@ -1,9 +1,12 @@ // @flow +/* global BigInt */ + import { types as tt, TokenType } from "../tokenizer/types"; import type Parser from "../parser"; +import type { ExpressionErrors } from "../parser/util"; import * as N from "../types"; -import type { Pos, Position } from "../util/location"; +import type { Position } from "../util/location"; import { type BindingTypes, BIND_NONE } from "../util/scopeflags"; function isSimpleProperty(node: N.Node): boolean { @@ -31,6 +34,16 @@ export default (superClass: Class): Class => return node; } + estreeParseBigIntLiteral(value: any): N.Node { + // https://github.com/estree/estree/blob/master/es2020.md#bigintliteral + // $FlowIgnore + const bigInt = typeof BigInt !== "undefined" ? BigInt(value) : null; + const node = this.estreeParseLiteral(bigInt); + node.bigint = String(node.value || value); + + return node; + } + estreeParseLiteral(value: any): N.Node { return this.parseLiteral(value, "Literal"); } @@ -93,9 +106,10 @@ export default (superClass: Class): Class => } else { this.raise(start, "setter must have exactly one formal parameter"); } - } - - if (prop.kind === "set" && prop.value.params[0].type === "RestElement") { + } else if ( + prop.kind === "set" && + prop.value.params[0].type === "RestElement" + ) { this.raise( start, "setter function argument must not be a rest parameter", @@ -108,6 +122,7 @@ export default (superClass: Class): Class => bindingType: BindingTypes = BIND_NONE, checkClashes: ?{ [key: string]: boolean }, contextDescription: string, + disallowLetBinding?: boolean, ): void { switch (expr.type) { case "ObjectPattern": @@ -117,17 +132,25 @@ export default (superClass: Class): Class => bindingType, checkClashes, "object destructuring pattern", + disallowLetBinding, ); }); break; default: - super.checkLVal(expr, bindingType, checkClashes, contextDescription); + super.checkLVal( + expr, + bindingType, + checkClashes, + contextDescription, + disallowLetBinding, + ); } } - checkPropClash( + checkDuplicatedProto( prop: N.ObjectMember | N.SpreadElement, - propHash: { [key: string]: boolean }, + protoRef: { used: boolean }, + refExpressionErrors: ?ExpressionErrors, ): void { if ( prop.type === "SpreadElement" || @@ -144,31 +167,17 @@ export default (superClass: Class): Class => const name = key.type === "Identifier" ? key.name : String(key.value); if (name === "__proto__" && prop.kind === "init") { - if (propHash.proto) { - this.raise(key.start, "Redefinition of __proto__ property"); - } - propHash.proto = true; - } - } - - isStrictBody(node: { body: N.BlockStatement }): boolean { - const isBlockStatement = node.body.type === "BlockStatement"; - - if (isBlockStatement && node.body.body.length > 0) { - for (const directive of node.body.body) { - if ( - directive.type === "ExpressionStatement" && - directive.expression.type === "Literal" - ) { - if (directive.expression.value === "use strict") return true; + // Store the first redefinition's position + if (protoRef.used) { + if (refExpressionErrors && refExpressionErrors.doubleProto === -1) { + refExpressionErrors.doubleProto = key.start; } else { - // Break for the first non literal expression - break; + this.raise(key.start, "Redefinition of __proto__ property"); } } - } - return false; + protoRef.used = true; + } } isValidDirective(stmt: N.Statement): boolean { @@ -231,15 +240,18 @@ export default (superClass: Class): Class => classBody.body.push(method); } - parseExprAtom(refShorthandDefaultPos?: ?Pos): N.Expression { + parseExprAtom(refExpressionErrors?: ?ExpressionErrors): N.Expression { switch (this.state.type) { - case tt.regexp: - return this.estreeParseRegExpLiteral(this.state.value); - case tt.num: case tt.string: return this.estreeParseLiteral(this.state.value); + case tt.regexp: + return this.estreeParseRegExpLiteral(this.state.value); + + case tt.bigint: + return this.estreeParseBigIntLiteral(this.state.value); + case tt._null: return this.estreeParseLiteral(null); @@ -250,7 +262,7 @@ export default (superClass: Class): Class => return this.estreeParseLiteral(false); default: - return super.parseExprAtom(refShorthandDefaultPos); + return super.parseExprAtom(refExpressionErrors); } } @@ -334,14 +346,14 @@ export default (superClass: Class): Class => startPos: ?number, startLoc: ?Position, isPattern: boolean, - refShorthandDefaultPos: ?Pos, + refExpressionErrors: ?ExpressionErrors, ): ?N.ObjectProperty { const node: N.EstreeProperty = (super.parseObjectProperty( prop, startPos, startLoc, isPattern, - refShorthandDefaultPos, + refExpressionErrors, ): any); if (node) { @@ -372,14 +384,45 @@ export default (superClass: Class): Class => isLast: boolean, ) { if (prop.kind === "get" || prop.kind === "set") { - this.raise( + throw this.raise( prop.key.start, "Object pattern can't contain getter or setter", ); } else if (prop.method) { - this.raise(prop.key.start, "Object pattern can't contain methods"); + throw this.raise( + prop.key.start, + "Object pattern can't contain methods", + ); } else { super.toAssignableObjectExpressionProp(prop, isBinding, isLast); } } + + finishCallExpression( + node: T, + optional: boolean, + ): N.Expression { + super.finishCallExpression(node, optional); + + if (node.callee.type === "Import") { + ((node: N.Node): N.EstreeImportExpression).type = "ImportExpression"; + ((node: N.Node): N.EstreeImportExpression).source = node.arguments[0]; + delete node.arguments; + delete node.callee; + } + + return node; + } + + toReferencedListDeep( + exprList: $ReadOnlyArray, + isParenthesizedExpr?: boolean, + ): void { + // ImportExpressions do not have an arguments array. + if (!exprList) { + return; + } + + super.toReferencedListDeep(exprList, isParenthesizedExpr); + } }; diff --git a/packages/babel-parser/src/plugins/flow.js b/packages/babel-parser/src/plugins/flow.js index 024a21baa5ab..2ab7604514d1 100644 --- a/packages/babel-parser/src/plugins/flow.js +++ b/packages/babel-parser/src/plugins/flow.js @@ -1,5 +1,7 @@ // @flow +/*:: declare var invariant; */ + import type Parser from "../parser"; import { types as tt, type TokenType } from "../tokenizer/types"; import * as N from "../types"; @@ -14,16 +16,22 @@ import { type BindingTypes, BIND_NONE, BIND_LEXICAL, + BIND_VAR, + BIND_FUNCTION, SCOPE_ARROW, SCOPE_OTHER, } from "../util/scopeflags"; +import type { ExpressionErrors } from "../parser/util"; -const reservedTypes = [ +const reservedTypes = new Set([ + "_", "any", "bool", "boolean", "empty", + "extends", "false", + "interface", "mixed", "null", "number", @@ -32,10 +40,7 @@ const reservedTypes = [ "true", "typeof", "void", - "interface", - "extends", - "_", -]; +]); function isEsModuleType(bodyElement: N.Node): boolean { return ( @@ -79,6 +84,20 @@ function partition( const FLOW_PRAGMA_REGEX = /\*?\s*@((?:no)?flow)\b/; +// Flow enums types +type EnumExplicitType = null | "boolean" | "number" | "string" | "symbol"; +type EnumContext = {| + enumName: string, + explicitType: EnumExplicitType, + memberName: string, +|}; +type EnumMemberInit = + | {| type: "number", pos: number, value: N.Node |} + | {| type: "string", pos: number, value: N.Node |} + | {| type: "boolean", pos: number, value: N.Node |} + | {| type: "invalid", pos: number |} + | {| type: "none", pos: number |}; + export default (superClass: Class): Class => class extends superClass { // The value of the @flow/@noflow pragma. Initially undefined, transitions @@ -95,6 +114,10 @@ export default (superClass: Class): Class => return this.getPluginOption("flow", "all") || this.flowPragma === "flow"; } + shouldParseEnums(): boolean { + return !!this.getPluginOption("flow", "enums"); + } + finishToken(type: TokenType, val: any): void { if ( type !== tt.string && @@ -243,7 +266,7 @@ export default (superClass: Class): Class => return this.flowParseDeclareModuleExports(node); } else { if (insideModule) { - this.unexpected( + this.raise( this.state.lastTokStart, "`declare module` cannot be used inside another `declare module`", ); @@ -270,6 +293,7 @@ export default (superClass: Class): Class => node.id = this.flowParseTypeAnnotatableIdentifier( /*allowPrimitiveOverride*/ true, ); + this.scope.declareName(node.id.name, BIND_VAR, node.id.start); this.semicolon(); return this.finishNode(node, "DeclareVariable"); } @@ -292,7 +316,7 @@ export default (superClass: Class): Class => if (this.match(tt._import)) { this.next(); if (!this.isContextual("type") && !this.match(tt._typeof)) { - this.unexpected( + this.raise( this.state.lastTokStart, "Imports within a `declare module` body must always be `import type` or `import typeof`", ); @@ -324,17 +348,17 @@ export default (superClass: Class): Class => body.forEach(bodyElement => { if (isEsModuleType(bodyElement)) { if (kind === "CommonJS") { - this.unexpected(bodyElement.start, errorMessage); + this.raise(bodyElement.start, errorMessage); } kind = "ES"; } else if (bodyElement.type === "DeclareModuleExports") { if (hasModuleExport) { - this.unexpected( + this.raise( bodyElement.start, "Duplicate `declare module.exports` statement", ); } - if (kind === "ES") this.unexpected(bodyElement.start, errorMessage); + if (kind === "ES") this.raise(bodyElement.start, errorMessage); kind = "CommonJS"; hasModuleExport = true; } @@ -460,7 +484,16 @@ export default (superClass: Class): Class => node: N.FlowDeclare, isClass?: boolean = false, ): void { - node.id = this.flowParseRestrictedIdentifier(/*liberal*/ !isClass); + node.id = this.flowParseRestrictedIdentifier( + /* liberal */ !isClass, + /* declaration */ true, + ); + + this.scope.declareName( + node.id.name, + isClass ? BIND_FUNCTION : BIND_LEXICAL, + node.id.start, + ); if (this.isRelational("<")) { node.typeParameters = this.flowParseTypeParameterDeclaration(); @@ -521,28 +554,39 @@ export default (superClass: Class): Class => checkNotUnderscore(word: string) { if (word === "_") { - throw this.unexpected( - null, + this.raise( + this.state.start, "`_` is only allowed as a type argument to call or new", ); } } - checkReservedType(word: string, startLoc: number) { - if (reservedTypes.indexOf(word) > -1) { + checkReservedType(word: string, startLoc: number, declaration?: boolean) { + if (!reservedTypes.has(word)) return; + + if (declaration) { this.raise(startLoc, `Cannot overwrite reserved type ${word}`); + return; } + + this.raise(startLoc, `Unexpected reserved type ${word}`); } - flowParseRestrictedIdentifier(liberal?: boolean): N.Identifier { - this.checkReservedType(this.state.value, this.state.start); + flowParseRestrictedIdentifier( + liberal?: boolean, + declaration?: boolean, + ): N.Identifier { + this.checkReservedType(this.state.value, this.state.start, declaration); return this.parseIdentifier(liberal); } // Type aliases flowParseTypeAlias(node: N.FlowTypeAlias): N.FlowTypeAlias { - node.id = this.flowParseRestrictedIdentifier(); + node.id = this.flowParseRestrictedIdentifier( + /* liberal */ false, + /* declaration */ true, + ); this.scope.declareName(node.id.name, BIND_LEXICAL, node.id.start); if (this.isRelational("<")) { @@ -562,7 +606,10 @@ export default (superClass: Class): Class => declare: boolean, ): N.FlowOpaqueType { this.expectContextual("type"); - node.id = this.flowParseRestrictedIdentifier(/*liberal*/ true); + node.id = this.flowParseRestrictedIdentifier( + /* liberal */ true, + /* declaration */ true, + ); this.scope.declareName(node.id.name, BIND_LEXICAL, node.id.start); if (this.isRelational("<")) { @@ -605,7 +652,7 @@ export default (superClass: Class): Class => node.default = this.flowParseType(); } else { if (requireDefault) { - this.unexpected( + this.raise( nodeStart, // eslint-disable-next-line max-len "Type parameter declaration needs a default, since a preceding type parameter declaration has a default.", @@ -851,6 +898,7 @@ export default (superClass: Class): Class => while (!this.match(endDelim)) { let isStatic = false; let protoStart: ?number = null; + let inexactStart: ?number = null; const node = this.startNode(); if (allowProto && this.isContextual("proto")) { @@ -923,17 +971,29 @@ export default (superClass: Class): Class => variance, kind, allowSpread, - allowInexact, + allowInexact ?? !exact, ); if (propOrInexact === null) { inexact = true; + inexactStart = this.state.lastTokStart; } else { nodeStart.properties.push(propOrInexact); } } this.flowObjectTypeSemicolon(); + + if ( + inexactStart && + !this.match(tt.braceR) && + !this.match(tt.braceBarR) + ) { + this.raise( + inexactStart, + "Explicit inexact syntax must appear at the end of an inexact object", + ); + } } this.expect(endDelim); @@ -963,10 +1023,38 @@ export default (superClass: Class): Class => allowSpread: boolean, allowInexact: boolean, ): (N.FlowObjectTypeProperty | N.FlowObjectTypeSpreadProperty) | null { - if (this.match(tt.ellipsis)) { + if (this.eat(tt.ellipsis)) { + const isInexactToken = + this.match(tt.comma) || + this.match(tt.semi) || + this.match(tt.braceR) || + this.match(tt.braceBarR); + + if (isInexactToken) { + if (!allowSpread) { + this.raise( + this.state.lastTokStart, + "Explicit inexact syntax cannot appear in class or interface definitions", + ); + } else if (!allowInexact) { + this.raise( + this.state.lastTokStart, + "Explicit inexact syntax cannot appear inside an explicit exact object type", + ); + } + if (variance) { + this.raise( + variance.start, + "Explicit inexact syntax cannot have variance", + ); + } + + return null; + } + if (!allowSpread) { - this.unexpected( - null, + this.raise( + this.state.lastTokStart, "Spread operator cannot appear in class or interface definitions", ); } @@ -974,35 +1062,9 @@ export default (superClass: Class): Class => this.unexpected(protoStart); } if (variance) { - this.unexpected( - variance.start, - "Spread properties cannot have variance", - ); + this.raise(variance.start, "Spread properties cannot have variance"); } - this.expect(tt.ellipsis); - const isInexactToken = this.eat(tt.comma) || this.eat(tt.semi); - if (this.match(tt.braceR)) { - if (allowInexact) return null; - this.unexpected( - null, - "Explicit inexact syntax is only allowed inside inexact objects", - ); - } - - if (this.match(tt.braceBarR)) { - this.unexpected( - null, - "Explicit inexact syntax cannot appear inside an explicit exact object type", - ); - } - - if (isInexactToken) { - this.unexpected( - null, - "Explicit inexact syntax must appear at the end of an inexact object", - ); - } node.argument = this.flowParseType(); return this.finishNode(node, "ObjectTypeSpreadProperty"); } else { @@ -1090,12 +1152,12 @@ export default (superClass: Class): Class => ): N.FlowQualifiedTypeIdentifier { startPos = startPos || this.state.start; startLoc = startLoc || this.state.startLoc; - let node = id || this.parseIdentifier(); + let node = id || this.flowParseRestrictedIdentifier(true); while (this.eat(tt.dot)) { const node2 = this.startNodeAt(startPos, startLoc); node2.qualification = node; - node2.id = this.parseIdentifier(); + node2.id = this.flowParseRestrictedIdentifier(true); node = this.finishNode(node2, "QualifiedTypeIdentifier"); } @@ -1373,8 +1435,8 @@ export default (superClass: Class): Class => ); } - this.unexpected( - null, + throw this.raise( + this.state.start, `Unexpected token, expected "number" or "bigint"`, ); } @@ -1595,7 +1657,7 @@ export default (superClass: Class): Class => super.parseFunctionBodyAndFinish(node, type, isMethod); } - // interfaces + // interfaces and enums parseStatement(context: ?string, topLevel?: boolean): N.Statement { // strict mode handling of `interface` since it's a reserved word if ( @@ -1606,6 +1668,10 @@ export default (superClass: Class): Class => const node = this.startNode(); this.next(); return this.flowParseInterface(node); + } else if (this.shouldParseEnums() && this.isContextual("enum")) { + const node = this.startNode(); + this.next(); + return this.flowParseEnumDeclaration(node); } else { const stmt = super.parseStatement(context, topLevel); // We will parse a flow pragma in any comment before the first statement. @@ -1652,6 +1718,7 @@ export default (superClass: Class): Class => this.isContextual("type") || this.isContextual("interface") || this.isContextual("opaque") || + (this.shouldParseEnums() && this.isContextual("enum")) || super.shouldParseExportDeclaration() ); } @@ -1661,7 +1728,8 @@ export default (superClass: Class): Class => this.match(tt.name) && (this.state.value === "type" || this.state.value === "interface" || - this.state.value === "opaque") + this.state.value === "opaque" || + (this.shouldParseEnums() && this.state.value === "enum")) ) { return false; } @@ -1669,6 +1737,15 @@ export default (superClass: Class): Class => return super.isExportDefaultSpecifier(); } + parseExportDefaultExpression(): N.Expression | N.Declaration { + if (this.shouldParseEnums() && this.isContextual("enum")) { + const node = this.startNode(); + this.next(); + return this.flowParseEnumDeclaration(node); + } + return super.parseExportDefaultExpression(); + } + parseConditional( expr: N.Expression, noIn: ?boolean, @@ -1678,23 +1755,23 @@ export default (superClass: Class): Class => ): N.Expression { if (!this.match(tt.question)) return expr; - // only do the expensive clone if there is a question mark + // only use the expensive "tryParse" method if there is a question mark // and if we come from inside parens if (refNeedsArrowPos) { - const state = this.state.clone(); - try { - return super.parseConditional(expr, noIn, startPos, startLoc); - } catch (err) { - if (err instanceof SyntaxError) { - this.state = state; - refNeedsArrowPos.start = err.pos || this.state.start; - return expr; - } else { - // istanbul ignore next: no such error is expected - throw err; - } + const result = this.tryParse(() => + super.parseConditional(expr, noIn, startPos, startLoc), + ); + + if (!result.node) { + // $FlowIgnore + refNeedsArrowPos.start = result.error.pos || this.state.start; + return expr; } + + if (result.error) this.state = result.failState; + return result.node; } + this.expect(tt.question); const state = this.state.clone(); const originalNoArrowAt = this.state.noArrowAt; @@ -1734,10 +1811,10 @@ export default (superClass: Class): Class => this.state.noArrowAt = noArrowAt.concat(valid[0].start); ({ consequent, failed } = this.tryParseConditionalConsequent()); } - - this.getArrowLikeExpressions(consequent, true); } + this.getArrowLikeExpressions(consequent, true); + this.state.noArrowAt = originalNoArrowAt; this.expect(tt.colon); @@ -1783,18 +1860,7 @@ export default (superClass: Class): Class => if (node.type === "ArrowFunctionExpression") { if (node.typeParameters || !node.returnType) { // This is an arrow expression without ambiguity, so check its parameters - this.toAssignableList( - // node.params is Expression[] instead of $ReadOnlyArray because it - // has not been converted yet. - ((node.params: any): N.Expression[]), - true, - "arrow function parameters", - ); - // Enter scope, as checkParams defines bindings - this.scope.enter(functionFlags(false, false) | SCOPE_ARROW); - // Use super's method to force the parameters to be checked - super.checkParams(node, false, true); - this.scope.exit(); + this.finishArrowValidation(node); } else { arrows.push(node); } @@ -1806,28 +1872,29 @@ export default (superClass: Class): Class => } if (disallowInvalid) { - for (let i = 0; i < arrows.length; i++) { - this.toAssignableList( - ((node.params: any): N.Expression[]), - true, - "arrow function parameters", - ); - } + arrows.forEach(node => this.finishArrowValidation(node)); return [arrows, []]; } - return partition(arrows, node => { - try { - this.toAssignableList( - ((node.params: any): N.Expression[]), - true, - "arrow function parameters", - ); - return true; - } catch (err) { - return false; - } - }); + return partition(arrows, node => + node.params.every(param => this.isAssignable(param, true)), + ); + } + + finishArrowValidation(node: N.ArrowFunctionExpression) { + this.toAssignableList( + // node.params is Expression[] instead of $ReadOnlyArray because it + // has not been converted yet. + ((node.params: any): N.Expression[]), + true, + "arrow function parameters", + node.extra?.trailingComma, + ); + // Enter scope, as checkParams defines bindings + this.scope.enter(functionFlags(false, false) | SCOPE_ARROW); + // Use super's method to force the parameters to be checked + super.checkParams(node, false, true); + this.scope.exit(); } forwardNoArrowParamsConversionAt(node: N.Node, parse: () => T): T { @@ -1923,6 +1990,11 @@ export default (superClass: Class): Class => const declarationNode = this.startNode(); this.next(); return this.flowParseInterface(declarationNode); + } else if (this.shouldParseEnums() && this.isContextual("enum")) { + node.exportKind = "value"; + const declarationNode = this.startNode(); + this.next(); + return this.flowParseEnumDeclaration(declarationNode); } else { return super.parseExportDeclaration(node); } @@ -1975,6 +2047,50 @@ export default (superClass: Class): Class => } } + isAssignable(node: N.Node, isBinding?: boolean): boolean { + switch (node.type) { + case "Identifier": + case "ObjectPattern": + case "ArrayPattern": + case "AssignmentPattern": + return true; + + case "ObjectExpression": { + const last = node.properties.length - 1; + return node.properties.every((prop, i) => { + return ( + prop.type !== "ObjectMethod" && + (i === last || prop.type === "SpreadElement") && + this.isAssignable(prop) + ); + }); + } + + case "ObjectProperty": + return this.isAssignable(node.value); + + case "SpreadElement": + return this.isAssignable(node.argument); + + case "ArrayExpression": + return node.elements.every(element => this.isAssignable(element)); + + case "AssignmentExpression": + return node.operator === "="; + + case "ParenthesizedExpression": + case "TypeCastExpression": + return this.isAssignable(node.expression); + + case "MemberExpression": + case "OptionalMemberExpression": + return !isBinding; + + default: + return false; + } + } + toAssignable( node: N.Node, isBinding: ?boolean, @@ -1996,6 +2112,7 @@ export default (superClass: Class): Class => exprList: N.Expression[], isBinding: ?boolean, contextDescription: string, + trailingCommaPos?: ?number, ): $ReadOnlyArray { for (let i = 0; i < exprList.length; i++) { const expr = exprList[i]; @@ -2003,7 +2120,12 @@ export default (superClass: Class): Class => exprList[i] = this.typeCastToParameter(expr); } } - return super.toAssignableList(exprList, isBinding, contextDescription); + return super.toAssignableList( + exprList, + isBinding, + contextDescription, + trailingCommaPos, + ); } // this is a list of nodes, from something like a call expression, we need to filter the @@ -2145,9 +2267,10 @@ export default (superClass: Class): Class => parsePropertyName( node: N.ObjectOrClassMember | N.ClassMember | N.TsNamedTypeElementBase, + isPrivateNameAllowed: boolean, ): N.Identifier { const variance = this.flowParseVariance(); - const key = super.parsePropertyName(node); + const key = super.parsePropertyName(node, isPrivateNameAllowed); // $FlowIgnore ("variance" not defined on TsNamedTypeElementBase) node.variance = variance; return key; @@ -2161,7 +2284,7 @@ export default (superClass: Class): Class => isGenerator: boolean, isAsync: boolean, isPattern: boolean, - refShorthandDefaultPos: ?Pos, + refExpressionErrors: ?ExpressionErrors, containsEsc: boolean, ): void { if ((prop: $FlowFixMe).variance) { @@ -2184,7 +2307,7 @@ export default (superClass: Class): Class => isGenerator, isAsync, isPattern, - refShorthandDefaultPos, + refExpressionErrors, containsEsc, ); @@ -2197,13 +2320,13 @@ export default (superClass: Class): Class => parseAssignableListItemTypes(param: N.Pattern): N.Pattern { if (this.eat(tt.question)) { if (param.type !== "Identifier") { - throw this.raise( + this.raise( param.start, "A binding pattern parameter cannot be optional in an implementation signature.", ); } - param.optional = true; + ((param: any): N.Identifier).optional = true; } if (this.match(tt.colon)) { param.typeAnnotation = this.flowParseTypeAnnotation(); @@ -2249,7 +2372,10 @@ export default (superClass: Class): Class => contextDescription: string, ): void { specifier.local = hasTypeImportKind(node) - ? this.flowParseRestrictedIdentifier(true) + ? this.flowParseRestrictedIdentifier( + /* liberal */ true, + /* declaration */ true, + ) : this.parseIdentifier(); this.checkLVal( @@ -2355,7 +2481,11 @@ export default (superClass: Class): Class => } if (nodeIsTypeImport || specifierIsTypeImport) { - this.checkReservedType(specifier.local.name, specifier.local.start); + this.checkReservedType( + specifier.local.name, + specifier.local.start, + /* declaration */ true, + ); } if (isBinding && !nodeIsTypeImport && !specifierIsTypeImport) { @@ -2430,79 +2560,107 @@ export default (superClass: Class): Class => // 3. This is neither. Just call the super method parseMaybeAssign( noIn?: ?boolean, - refShorthandDefaultPos?: ?Pos, + refExpressionErrors?: ?ExpressionErrors, afterLeftParse?: Function, refNeedsArrowPos?: ?Pos, ): N.Expression { - let jsxError = null; + let state = null; + + let jsx; + if ( this.hasPlugin("jsx") && (this.match(tt.jsxTagStart) || this.isRelational("<")) ) { - const state = this.state.clone(); - try { - return super.parseMaybeAssign( - noIn, - refShorthandDefaultPos, - afterLeftParse, - refNeedsArrowPos, - ); - } catch (err) { - if (err instanceof SyntaxError) { - this.state = state; - - // Remove `tc.j_expr` and `tc.j_oTag` from context added - // by parsing `jsxTagStart` to stop the JSX plugin from - // messing with the tokens - const cLength = this.state.context.length; - if (this.state.context[cLength - 1] === tc.j_oTag) { - this.state.context.length -= 2; - } - - jsxError = err; - } else { - // istanbul ignore next: no such error is expected - throw err; - } + state = this.state.clone(); + + jsx = this.tryParse( + () => + super.parseMaybeAssign( + noIn, + refExpressionErrors, + afterLeftParse, + refNeedsArrowPos, + ), + state, + ); + /*:: invariant(!jsx.aborted) */ + + if (!jsx.error) return jsx.node; + + // Remove `tc.j_expr` and `tc.j_oTag` from context added + // by parsing `jsxTagStart` to stop the JSX plugin from + // messing with the tokens + const { context } = this.state; + if (context[context.length - 1] === tc.j_oTag) { + context.length -= 2; + } else if (context[context.length - 1] === tc.j_expr) { + context.length -= 1; } } - if (jsxError != null || this.isRelational("<")) { - let arrowExpression; + if ((jsx && jsx.error) || this.isRelational("<")) { + state = state || this.state.clone(); + let typeParameters; - try { + + const arrow = this.tryParse(() => { typeParameters = this.flowParseTypeParameterDeclaration(); - arrowExpression = this.forwardNoArrowParamsConversionAt( + + const arrowExpression = this.forwardNoArrowParamsConversionAt( typeParameters, () => super.parseMaybeAssign( noIn, - refShorthandDefaultPos, + refExpressionErrors, afterLeftParse, refNeedsArrowPos, ), ); arrowExpression.typeParameters = typeParameters; this.resetStartLocationFromNode(arrowExpression, typeParameters); - } catch (err) { - throw jsxError || err; + + return arrowExpression; + }, state); + + const arrowExpression: ?N.ArrowFunctionExpression = + arrow.node && arrow.node.type === "ArrowFunctionExpression" + ? arrow.node + : null; + + if (!arrow.error && arrowExpression) return arrowExpression; + + // If we are here, both JSX and Flow parsing attemps failed. + // Give the precedence to the JSX error, except if JSX had an + // unrecoverable error while Flow didn't. + // If the error is recoverable, we can only re-report it if there is + // a node we can return. + + if (jsx && jsx.node) { + /*:: invariant(jsx.failState) */ + this.state = jsx.failState; + return jsx.node; } - if (arrowExpression.type === "ArrowFunctionExpression") { + if (arrowExpression) { + /*:: invariant(arrow.failState) */ + this.state = arrow.failState; return arrowExpression; - } else if (jsxError != null) { - throw jsxError; - } else { - this.raise( - typeParameters.start, - "Expected an arrow function after this type parameter declaration", - ); } + + if (jsx && jsx.thrown) throw jsx.error; + if (arrow.thrown) throw arrow.error; + + /*:: invariant(typeParameters) */ + throw this.raise( + typeParameters.start, + "Expected an arrow function after this type parameter declaration", + ); } return super.parseMaybeAssign( noIn, - refShorthandDefaultPos, + refExpressionErrors, afterLeftParse, refNeedsArrowPos, ); @@ -2511,8 +2669,7 @@ export default (superClass: Class): Class => // handle return types for arrow functions parseArrow(node: N.ArrowFunctionExpression): ?N.ArrowFunctionExpression { if (this.match(tt.colon)) { - const state = this.state.clone(); - try { + const result = this.tryParse(() => { const oldNoAnonFunctionType = this.state.noAnonFunctionType; this.state.noAnonFunctionType = true; @@ -2530,18 +2687,18 @@ export default (superClass: Class): Class => if (this.canInsertSemicolon()) this.unexpected(); if (!this.match(tt.arrow)) this.unexpected(); - // assign after it is clear it is an arrow - node.returnType = typeNode.typeAnnotation - ? this.finishNode(typeNode, "TypeAnnotation") - : null; - } catch (err) { - if (err instanceof SyntaxError) { - this.state = state; - } else { - // istanbul ignore next: no such error is expected - throw err; - } - } + return typeNode; + }); + + if (result.thrown) return null; + /*:: invariant(result.node) */ + + if (result.error) this.state = result.failState; + + // assign after it is clear it is an arrow + node.returnType = result.node.typeAnnotation + ? this.finishNode(result.node, "TypeAnnotation") + : null; } return super.parseArrow(node); @@ -2574,7 +2731,7 @@ export default (superClass: Class): Class => return; } - return super.checkParams(node, allowDuplicates, isArrowFunction); + return super.checkParams(...arguments); } parseParenAndDistinguishExpression(canBeArrow: boolean): N.Expression { @@ -2606,23 +2763,33 @@ export default (superClass: Class): Class => this.isRelational("<") ) { const state = this.state.clone(); - let error; - try { - const node = this.parseAsyncArrowWithTypeParameters( - startPos, - startLoc, - ); - if (node) return node; - } catch (e) { - error = e; + const arrow = this.tryParse( + abort => + this.parseAsyncArrowWithTypeParameters(startPos, startLoc) || + abort(), + state, + ); + + if (!arrow.error && !arrow.aborted) return arrow.node; + + const result = this.tryParse( + () => super.parseSubscripts(base, startPos, startLoc, noCalls), + state, + ); + + if (result.node && !result.error) return result.node; + + if (arrow.node) { + this.state = arrow.failState; + return arrow.node; } - this.state = state; - try { - return super.parseSubscripts(base, startPos, startLoc, noCalls); - } catch (e) { - throw error || e; + if (result.node) { + this.state = result.failState; + return result.node; } + + throw arrow.error || result.error; } return super.parseSubscripts(base, startPos, startLoc, noCalls); @@ -2634,10 +2801,8 @@ export default (superClass: Class): Class => startLoc: Position, noCalls: ?boolean, subscriptState: N.ParseSubscriptState, - maybeAsyncArrow: boolean, ): N.Expression { if (this.match(tt.questionDot) && this.isLookaheadRelational("<")) { - this.expectPlugin("optionalChaining"); subscriptState.optionalChainMember = true; if (noCalls) { subscriptState.stop = true; @@ -2654,7 +2819,7 @@ export default (superClass: Class): Class => // $FlowFixMe node.arguments = this.parseCallExpressionArguments(tt.parenR, false); node.optional = true; - return this.finishNode(node, "OptionalCallExpression"); + return this.finishCallExpression(node, /* optional */ true); } else if ( !noCalls && this.shouldParseTypes() && @@ -2662,22 +2827,21 @@ export default (superClass: Class): Class => ) { const node = this.startNodeAt(startPos, startLoc); node.callee = base; - const state = this.state.clone(); - try { + + const result = this.tryParse(() => { node.typeArguments = this.flowParseTypeParameterInstantiationCallOrNew(); this.expect(tt.parenL); node.arguments = this.parseCallExpressionArguments(tt.parenR, false); - if (subscriptState.optionalChainMember) { - node.optional = false; - return this.finishNode(node, "OptionalCallExpression"); - } - return this.finishNode(node, "CallExpression"); - } catch (e) { - if (e instanceof SyntaxError) { - this.state = state; - } else { - throw e; - } + if (subscriptState.optionalChainMember) node.optional = false; + return this.finishCallExpression( + node, + subscriptState.optionalChainMember, + ); + }); + + if (result.node) { + if (result.error) this.state = result.failState; + return result.node; } } @@ -2687,23 +2851,15 @@ export default (superClass: Class): Class => startLoc, noCalls, subscriptState, - maybeAsyncArrow, ); } parseNewArguments(node: N.NewExpression): void { let targs = null; if (this.shouldParseTypes() && this.isRelational("<")) { - const state = this.state.clone(); - try { - targs = this.flowParseTypeParameterInstantiationCallOrNew(); - } catch (e) { - if (e instanceof SyntaxError) { - this.state = state; - } else { - throw e; - } - } + targs = this.tryParse(() => + this.flowParseTypeParameterInstantiationCallOrNew(), + ).node; } node.typeArguments = targs; @@ -2757,7 +2913,7 @@ export default (superClass: Class): Class => parseTopLevel(file: N.File, program: N.Program): N.File { const fileNode = super.parseTopLevel(file, program); if (this.state.hasFlowComment) { - this.unexpected(null, "Unterminated flow-comment"); + this.raise(this.state.pos, "Unterminated flow-comment"); } return fileNode; } @@ -2778,7 +2934,9 @@ export default (superClass: Class): Class => if (this.state.hasFlowComment) { const end = this.input.indexOf("*-/", (this.state.pos += 2)); - if (end === -1) this.raise(this.state.pos - 2, "Unterminated comment"); + if (end === -1) { + throw this.raise(this.state.pos - 2, "Unterminated comment"); + } this.state.pos = end + 3; return; } @@ -2820,7 +2978,428 @@ export default (superClass: Class): Class => hasFlowCommentCompletion(): void { const end = this.input.indexOf("*/", this.state.pos); if (end === -1) { - this.raise(this.state.pos, "Unterminated comment"); + throw this.raise(this.state.pos, "Unterminated comment"); + } + } + + // Flow enum parsing + + flowEnumErrorBooleanMemberNotInitialized( + pos: number, + { enumName, memberName }: { enumName: string, memberName: string }, + ): void { + this.raise( + pos, + `Boolean enum members need to be initialized. Use either \`${memberName} = true,\` ` + + `or \`${memberName} = false,\` in enum \`${enumName}\`.`, + ); + } + + flowEnumErrorInvalidMemberName( + pos: number, + { enumName, memberName }: { enumName: string, memberName: string }, + ): void { + const suggestion = memberName[0].toUpperCase() + memberName.slice(1); + this.raise( + pos, + `Enum member names cannot start with lowercase 'a' through 'z'. Instead of using ` + + `\`${memberName}\`, consider using \`${suggestion}\`, in enum \`${enumName}\`.`, + ); + } + + flowEnumErrorDuplicateMemberName( + pos: number, + { enumName, memberName }: { enumName: string, memberName: string }, + ): void { + this.raise( + pos, + `Enum member names need to be unique, but the name \`${memberName}\` has already been used ` + + `before in enum \`${enumName}\`.`, + ); + } + + flowEnumErrorInconsistentMemberValues( + pos: number, + { enumName }: { enumName: string }, + ): void { + this.raise( + pos, + `Enum \`${enumName}\` has inconsistent member initializers. Either use no initializers, or ` + + `consistently use literals (either booleans, numbers, or strings) for all member initializers.`, + ); + } + + flowEnumErrorInvalidExplicitType( + pos: number, + { + enumName, + suppliedType, + }: { enumName: string, suppliedType: null | string }, + ) { + const suggestion = + `Use one of \`boolean\`, \`number\`, \`string\`, or \`symbol\` in ` + + `enum \`${enumName}\`.`; + const message = + suppliedType === null + ? `Supplied enum type is not valid. ${suggestion}` + : `Enum type \`${suppliedType}\` is not valid. ${suggestion}`; + return this.raise(pos, message); + } + + flowEnumErrorInvalidMemberInitializer( + pos: number, + { enumName, explicitType, memberName }: EnumContext, + ) { + let message = null; + switch (explicitType) { + case "boolean": + case "number": + case "string": + message = + `Enum \`${enumName}\` has type \`${explicitType}\`, so the initializer of ` + + `\`${memberName}\` needs to be a ${explicitType} literal.`; + break; + case "symbol": + message = + `Symbol enum members cannot be initialized. Use \`${memberName},\` in ` + + `enum \`${enumName}\`.`; + break; + default: + // null + message = + `The enum member initializer for \`${memberName}\` needs to be a literal (either ` + + `a boolean, number, or string) in enum \`${enumName}\`.`; } + return this.raise(pos, message); + } + + flowEnumErrorNumberMemberNotInitialized( + pos: number, + { enumName, memberName }: { enumName: string, memberName: string }, + ): void { + this.raise( + pos, + `Number enum members need to be initialized, e.g. \`${memberName} = 1\` in enum \`${enumName}\`.`, + ); + } + + flowEnumErrorStringMemberInconsistentlyInitailized( + pos: number, + { enumName }: { enumName: string }, + ): void { + this.raise( + pos, + `String enum members need to consistently either all use initializers, or use no initializers, ` + + `in enum \`${enumName}\`.`, + ); + } + + flowEnumMemberInit(): EnumMemberInit { + const startPos = this.state.start; + const endOfInit = () => this.match(tt.comma) || this.match(tt.braceR); + switch (this.state.type) { + case tt.num: { + const literal = this.parseLiteral(this.state.value, "NumericLiteral"); + if (endOfInit()) { + return { type: "number", pos: literal.start, value: literal }; + } + return { type: "invalid", pos: startPos }; + } + case tt.string: { + const literal = this.parseLiteral(this.state.value, "StringLiteral"); + if (endOfInit()) { + return { type: "string", pos: literal.start, value: literal }; + } + return { type: "invalid", pos: startPos }; + } + case tt._true: + case tt._false: { + const literal = this.parseBooleanLiteral(); + if (endOfInit()) { + return { + type: "boolean", + pos: literal.start, + value: literal, + }; + } + return { type: "invalid", pos: startPos }; + } + default: + return { type: "invalid", pos: startPos }; + } + } + + flowEnumMemberRaw(): { id: N.Node, init: EnumMemberInit } { + const pos = this.state.start; + const id = this.parseIdentifier(true); + const init = this.eat(tt.eq) + ? this.flowEnumMemberInit() + : { type: "none", pos }; + return { id, init }; + } + + flowEnumCheckExplicitTypeMismatch( + pos: number, + context: EnumContext, + expectedType: EnumExplicitType, + ): void { + const { explicitType } = context; + if (explicitType === null) { + return; + } + if (explicitType !== expectedType) { + this.flowEnumErrorInvalidMemberInitializer(pos, context); + } + } + + flowEnumMembers({ + enumName, + explicitType, + }: { + enumName: string, + explicitType: EnumExplicitType, + }): {| + booleanMembers: Array, + numberMembers: Array, + stringMembers: Array, + defaultedMembers: Array, + |} { + const seenNames = new Set(); + const members = { + booleanMembers: [], + numberMembers: [], + stringMembers: [], + defaultedMembers: [], + }; + while (!this.match(tt.braceR)) { + const memberNode = this.startNode(); + const { id, init } = this.flowEnumMemberRaw(); + const memberName = id.name; + if (memberName === "") { + continue; + } + if (/^[a-z]/.test(memberName)) { + this.flowEnumErrorInvalidMemberName(id.start, { + enumName, + memberName, + }); + } + if (seenNames.has(memberName)) { + this.flowEnumErrorDuplicateMemberName(id.start, { + enumName, + memberName, + }); + } + seenNames.add(memberName); + const context = { enumName, explicitType, memberName }; + memberNode.id = id; + switch (init.type) { + case "boolean": { + this.flowEnumCheckExplicitTypeMismatch( + init.pos, + context, + "boolean", + ); + memberNode.init = init.value; + members.booleanMembers.push( + this.finishNode(memberNode, "EnumBooleanMember"), + ); + break; + } + case "number": { + this.flowEnumCheckExplicitTypeMismatch(init.pos, context, "number"); + memberNode.init = init.value; + members.numberMembers.push( + this.finishNode(memberNode, "EnumNumberMember"), + ); + break; + } + case "string": { + this.flowEnumCheckExplicitTypeMismatch(init.pos, context, "string"); + memberNode.init = init.value; + members.stringMembers.push( + this.finishNode(memberNode, "EnumStringMember"), + ); + break; + } + case "invalid": { + throw this.flowEnumErrorInvalidMemberInitializer(init.pos, context); + } + case "none": { + switch (explicitType) { + case "boolean": + this.flowEnumErrorBooleanMemberNotInitialized( + init.pos, + context, + ); + break; + case "number": + this.flowEnumErrorNumberMemberNotInitialized(init.pos, context); + break; + default: + members.defaultedMembers.push( + this.finishNode(memberNode, "EnumDefaultedMember"), + ); + } + } + } + + if (!this.match(tt.braceR)) { + this.expect(tt.comma); + } + } + return members; + } + + flowEnumStringMembers( + initializedMembers: Array, + defaultedMembers: Array, + { enumName }: { enumName: string }, + ): Array { + if (initializedMembers.length === 0) { + return defaultedMembers; + } else if (defaultedMembers.length === 0) { + return initializedMembers; + } else if (defaultedMembers.length > initializedMembers.length) { + for (const member of initializedMembers) { + this.flowEnumErrorStringMemberInconsistentlyInitailized( + member.start, + { enumName }, + ); + } + return defaultedMembers; + } else { + for (const member of defaultedMembers) { + this.flowEnumErrorStringMemberInconsistentlyInitailized( + member.start, + { enumName }, + ); + } + return initializedMembers; + } + } + + flowEnumParseExplicitType({ + enumName, + }: { + enumName: string, + }): EnumExplicitType { + if (this.eatContextual("of")) { + if (!this.match(tt.name)) { + throw this.flowEnumErrorInvalidExplicitType(this.state.start, { + enumName, + suppliedType: null, + }); + } + + const { value } = this.state; + this.next(); + + if ( + value !== "boolean" && + value !== "number" && + value !== "string" && + value !== "symbol" + ) { + this.flowEnumErrorInvalidExplicitType(this.state.start, { + enumName, + suppliedType: value, + }); + } + + return value; + } + return null; + } + + flowEnumBody(node: N.Node, { enumName, nameLoc }): N.Node { + const explicitType = this.flowEnumParseExplicitType({ enumName }); + this.expect(tt.braceL); + const members = this.flowEnumMembers({ enumName, explicitType }); + + switch (explicitType) { + case "boolean": + node.explicitType = true; + node.members = members.booleanMembers; + this.expect(tt.braceR); + return this.finishNode(node, "EnumBooleanBody"); + case "number": + node.explicitType = true; + node.members = members.numberMembers; + this.expect(tt.braceR); + return this.finishNode(node, "EnumNumberBody"); + case "string": + node.explicitType = true; + node.members = this.flowEnumStringMembers( + members.stringMembers, + members.defaultedMembers, + { enumName }, + ); + this.expect(tt.braceR); + return this.finishNode(node, "EnumStringBody"); + case "symbol": + node.members = members.defaultedMembers; + this.expect(tt.braceR); + return this.finishNode(node, "EnumSymbolBody"); + default: { + // `explicitType` is `null` + const empty = () => { + node.members = []; + this.expect(tt.braceR); + return this.finishNode(node, "EnumStringBody"); + }; + node.explicitType = false; + + const boolsLen = members.booleanMembers.length; + const numsLen = members.numberMembers.length; + const strsLen = members.stringMembers.length; + const defaultedLen = members.defaultedMembers.length; + + if (!boolsLen && !numsLen && !strsLen && !defaultedLen) { + return empty(); + } else if (!boolsLen && !numsLen) { + node.members = this.flowEnumStringMembers( + members.stringMembers, + members.defaultedMembers, + { enumName }, + ); + this.expect(tt.braceR); + return this.finishNode(node, "EnumStringBody"); + } else if (!numsLen && !strsLen && boolsLen >= defaultedLen) { + for (const member of members.defaultedMembers) { + this.flowEnumErrorBooleanMemberNotInitialized(member.start, { + enumName, + memberName: member.id.name, + }); + } + node.members = members.booleanMembers; + this.expect(tt.braceR); + return this.finishNode(node, "EnumBooleanBody"); + } else if (!boolsLen && !strsLen && numsLen >= defaultedLen) { + for (const member of members.defaultedMembers) { + this.flowEnumErrorNumberMemberNotInitialized(member.start, { + enumName, + memberName: member.id.name, + }); + } + node.members = members.numberMembers; + this.expect(tt.braceR); + return this.finishNode(node, "EnumNumberBody"); + } else { + this.flowEnumErrorInconsistentMemberValues(nameLoc, { enumName }); + return empty(); + } + } + } + } + + flowParseEnumDeclaration(node: N.Node): N.Node { + const id = this.parseIdentifier(); + node.id = id; + node.body = this.flowEnumBody(this.startNode(), { + enumName: id.name, + nameLoc: id.start, + }); + return this.finishNode(node, "EnumDeclaration"); } }; diff --git a/packages/babel-parser/src/plugins/jsx/index.js b/packages/babel-parser/src/plugins/jsx/index.js index 5d3c2ec2ece1..fce057e48b74 100644 --- a/packages/babel-parser/src/plugins/jsx/index.js +++ b/packages/babel-parser/src/plugins/jsx/index.js @@ -4,11 +4,12 @@ import * as charCodes from "charcodes"; import XHTMLEntities from "./xhtml"; import type Parser from "../../parser"; +import type { ExpressionErrors } from "../../parser/util"; import { TokenType, types as tt } from "../../tokenizer/types"; import { TokContext, types as tc } from "../../tokenizer/context"; import * as N from "../../types"; import { isIdentifierChar, isIdentifierStart } from "../../util/identifier"; -import type { Pos, Position } from "../../util/location"; +import type { Position } from "../../util/location"; import { isNewLine } from "../../util/whitespace"; const HEX_NUMBER = /^[\da-fA-F]+$/; @@ -82,7 +83,7 @@ export default (superClass: Class): Class => let chunkStart = this.state.pos; for (;;) { if (this.state.pos >= this.length) { - this.raise(this.state.start, "Unterminated JSX contents"); + throw this.raise(this.state.start, "Unterminated JSX contents"); } const ch = this.input.charCodeAt(this.state.pos); @@ -142,7 +143,7 @@ export default (superClass: Class): Class => let chunkStart = ++this.state.pos; for (;;) { if (this.state.pos >= this.length) { - this.raise(this.state.start, "Unterminated string constant"); + throw this.raise(this.state.start, "Unterminated string constant"); } const ch = this.input.charCodeAt(this.state.pos); @@ -250,10 +251,16 @@ export default (superClass: Class): Class => // Parses element name in any form - namespaced, member // or single identifier. - jsxParseElementName(): N.JSXNamespacedName | N.JSXMemberExpression { + jsxParseElementName(): + | N.JSXIdentifier + | N.JSXNamespacedName + | N.JSXMemberExpression { const startPos = this.state.start; const startLoc = this.state.startLoc; let node = this.jsxParseNamespacedName(); + if (node.type === "JSXNamespacedName") { + return node; + } while (this.eat(tt.dot)) { const newNode = this.startNodeAt(startPos, startLoc); newNode.object = node; @@ -273,13 +280,12 @@ export default (superClass: Class): Class => this.next(); node = this.jsxParseExpressionContainer(node); if (node.expression.type === "JSXEmptyExpression") { - throw this.raise( + this.raise( node.start, "JSX attributes must only be assigned a non-empty expression", ); - } else { - return node; } + return node; case tt.jsxTagStart: case tt.string: @@ -479,8 +485,8 @@ export default (superClass: Class): Class => node.closingElement = closingElement; } node.children = children; - if (this.match(tt.relational) && this.state.value === "<") { - this.raise( + if (this.isRelational("<")) { + throw this.raise( this.state.start, "Adjacent JSX elements must be wrapped in an enclosing tag. " + "Did you want a JSX fragment <>...?", @@ -505,7 +511,7 @@ export default (superClass: Class): Class => // Overrides // ================================== - parseExprAtom(refShortHandDefaultPos: ?Pos): N.Expression { + parseExprAtom(refExpressionErrors: ?ExpressionErrors): N.Expression { if (this.match(tt.jsxText)) { return this.parseLiteral(this.state.value, "JSXText"); } else if (this.match(tt.jsxTagStart)) { @@ -519,7 +525,7 @@ export default (superClass: Class): Class => this.finishToken(tt.jsxTagStart); return this.jsxParseElement(); } else { - return super.parseExprAtom(refShortHandDefaultPos); + return super.parseExprAtom(refExpressionErrors); } } diff --git a/packages/babel-parser/src/plugins/typescript/index.js b/packages/babel-parser/src/plugins/typescript/index.js index fb6e8363a333..08691c5b90ba 100644 --- a/packages/babel-parser/src/plugins/typescript/index.js +++ b/packages/babel-parser/src/plugins/typescript/index.js @@ -1,6 +1,9 @@ // @flow +/*:: declare var invariant; */ + import type { TokenType } from "../../tokenizer/types"; +import type State from "../../tokenizer/state"; import { types as tt } from "../../tokenizer/types"; import { types as ct } from "../../tokenizer/context"; import * as N from "../../types"; @@ -9,19 +12,25 @@ import type Parser from "../../parser"; import { type BindingTypes, BIND_NONE, + SCOPE_TS_MODULE, SCOPE_OTHER, BIND_TS_ENUM, BIND_TS_CONST_ENUM, BIND_TS_TYPE, BIND_TS_INTERFACE, - BIND_TS_FN_TYPE, + BIND_TS_AMBIENT, BIND_TS_NAMESPACE, + BIND_CLASS, + BIND_LEXICAL, } from "../../util/scopeflags"; import TypeScriptScopeHandler from "./scope"; +import * as charCodes from "charcodes"; +import type { ExpressionErrors } from "../../parser/util"; type TsModifier = | "readonly" | "abstract" + | "declare" | "static" | "public" | "private" @@ -123,6 +132,31 @@ export default (superClass: Class): Class => return undefined; } + /** Parses a list of modifiers, in any order. + * If you need a specific order, you must call this function multiple times: + * this.tsParseModifiers(["public"]); + * this.tsParseModifiers(["abstract", "readonly"]); + */ + tsParseModifiers( + allowedModifiers: T[], + ): { [key: TsModifier]: ?true, __proto__: null } { + const modifiers = Object.create(null); + + while (true) { + const startPos = this.state.start; + const modifier: ?T = this.tsParseModifier(allowedModifiers); + + if (!modifier) break; + + if (Object.hasOwnProperty.call(modifiers, modifier)) { + this.raise(startPos, `Duplicate modifier: '${modifier}'`); + } + modifiers[modifier] = true; + } + + return modifiers; + } + tsIsListTerminator(kind: ParsingContext): boolean { switch (kind) { case "EnumMembers": @@ -231,8 +265,8 @@ export default (superClass: Class): Class => this.expect(tt._import); this.expect(tt.parenL); if (!this.match(tt.string)) { - throw this.unexpected( - null, + this.raise( + this.state.start, "Argument in a type import must be a string literal", ); } @@ -360,22 +394,23 @@ export default (superClass: Class): Class => tsParseBindingListForSignature(): $ReadOnlyArray< N.Identifier | N.RestElement | N.ObjectPattern | N.ArrayPattern, > { - return this.parseBindingList(tt.parenR).map(pattern => { - if ( - pattern.type !== "Identifier" && - pattern.type !== "RestElement" && - pattern.type !== "ObjectPattern" && - pattern.type !== "ArrayPattern" - ) { - throw this.unexpected( - pattern.start, - `Name in a signature must be an Identifier, ObjectPattern or ArrayPattern, instead got ${ - pattern.type - }`, - ); - } - return pattern; - }); + return this.parseBindingList(tt.parenR, charCodes.rightParenthesis).map( + pattern => { + if ( + pattern.type !== "Identifier" && + pattern.type !== "RestElement" && + pattern.type !== "ObjectPattern" && + pattern.type !== "ArrayPattern" + ) { + this.raise( + pattern.start, + "Name in a signature must be an Identifier, ObjectPattern or ArrayPattern," + + `instead got ${pattern.type}`, + ); + } + return (pattern: any); + }, + ); } tsParseTypeMemberSemicolon(): void { @@ -398,7 +433,7 @@ export default (superClass: Class): Class => return this.eat(tt.name) && this.match(tt.colon); } - tsTryParseIndexSignature(node: N.TsIndexSignature): ?N.TsIndexSignature { + tsTryParseIndexSignature(node: N.Node): ?N.TsIndexSignature { if ( !( this.match(tt.bracketL) && @@ -473,7 +508,7 @@ export default (superClass: Class): Class => return idx; } - this.parsePropertyName(node); + this.parsePropertyName(node, /* isPrivateNameAllowed */ false); return this.tsParsePropertyOrMethodSignature(node, readonly); } @@ -584,7 +619,12 @@ export default (superClass: Class): Class => const restNode: N.TsRestType = this.startNode(); this.next(); // skips ellipsis restNode.typeAnnotation = this.tsParseType(); - this.checkCommaAfterRest(); + if ( + this.match(tt.comma) && + this.lookaheadCharCode() !== charCodes.rightSquareBracket + ) { + this.raiseRestNotLast(this.state.start); + } return this.finishNode(restNode, "TSRestType"); } @@ -638,7 +678,7 @@ export default (superClass: Class): Class => const node: N.TsLiteralType = this.startNode(); const templateNode = this.parseTemplate(false); if (templateNode.expressions.length > 0) { - throw this.raise( + this.raise( templateNode.expressions[0].start, "Template literal types cannot have any substitution", ); @@ -647,6 +687,15 @@ export default (superClass: Class): Class => return this.finishNode(node, "TSLiteralType"); } + tsParseThisTypeOrThisTypePredicate(): N.TsThisType | N.TsTypePredicate { + const thisKeyword = this.tsParseThisTypeNode(); + if (this.isContextual("is") && !this.hasPrecedingLineBreak()) { + return this.tsParseThisTypePredicate(thisKeyword); + } else { + return thisKeyword; + } + } + tsParseNonArrayType(): N.TsType { switch (this.state.type) { case tt.name: @@ -657,7 +706,10 @@ export default (superClass: Class): Class => : this.match(tt._null) ? "TSNullKeyword" : keywordTypeFromName(this.state.value); - if (type !== undefined && this.lookahead().type !== tt.dot) { + if ( + type !== undefined && + this.lookaheadCharCode() !== charCodes.dot + ) { const node: N.TsKeywordType = this.startNode(); this.next(); return this.finishNode(node, type); @@ -679,14 +731,8 @@ export default (superClass: Class): Class => return this.finishNode(node, "TSLiteralType"); } break; - case tt._this: { - const thisKeyword = this.tsParseThisTypeNode(); - if (this.isContextual("is") && !this.hasPrecedingLineBreak()) { - return this.tsParseThisTypePredicate(thisKeyword); - } else { - return thisKeyword; - } - } + case tt._this: + return this.tsParseThisTypeOrThisTypePredicate(); case tt._typeof: return this.tsParseTypeQuery(); case tt._import: @@ -897,21 +943,52 @@ export default (superClass: Class): Class => const t: N.TsTypeAnnotation = this.startNode(); this.expect(returnToken); + const asserts = this.tsTryParse( + this.tsParseTypePredicateAsserts.bind(this), + ); + + if (asserts && this.match(tt._this)) { + // When asserts is false, thisKeyword is handled by tsParseNonArrayType + // : asserts this is type + let thisTypePredicate = this.tsParseThisTypeOrThisTypePredicate(); + // if it turns out to be a `TSThisType`, wrap it with `TSTypePredicate` + // : asserts this + if (thisTypePredicate.type === "TSThisType") { + const node: N.TsTypePredicate = this.startNodeAtNode(t); + node.parameterName = (thisTypePredicate: N.TsThisType); + node.asserts = true; + thisTypePredicate = this.finishNode(node, "TSTypePredicate"); + } else { + (thisTypePredicate: N.TsTypePredicate).asserts = true; + } + t.typeAnnotation = thisTypePredicate; + return this.finishNode(t, "TSTypeAnnotation"); + } + const typePredicateVariable = this.tsIsIdentifier() && this.tsTryParse(this.tsParseTypePredicatePrefix.bind(this)); if (!typePredicateVariable) { - return this.tsParseTypeAnnotation(/* eatColon */ false, t); + if (!asserts) { + // : type + return this.tsParseTypeAnnotation(/* eatColon */ false, t); + } + + const node: N.TsTypePredicate = this.startNodeAtNode(t); + // : asserts foo + node.parameterName = this.parseIdentifier(); + node.asserts = asserts; + t.typeAnnotation = this.finishNode(node, "TSTypePredicate"); + return this.finishNode(t, "TSTypeAnnotation"); } + // : asserts foo is type const type = this.tsParseTypeAnnotation(/* eatColon */ false); - - const node: N.TsTypePredicate = this.startNodeAtNode( - typePredicateVariable, - ); + const node = this.startNodeAtNode(t); node.parameterName = typePredicateVariable; node.typeAnnotation = type; + node.asserts = asserts; t.typeAnnotation = this.finishNode(node, "TSTypePredicate"); return this.finishNode(t, "TSTypeAnnotation"); }); @@ -939,6 +1016,30 @@ export default (superClass: Class): Class => } } + tsParseTypePredicateAsserts(): boolean { + if ( + !this.match(tt.name) || + this.state.value !== "asserts" || + this.hasPrecedingLineBreak() + ) { + return false; + } + const containsEsc = this.state.containsEsc; + this.next(); + if (!this.match(tt.name) && !this.match(tt._this)) { + return false; + } + + if (containsEsc) { + this.raise( + this.state.lastTokStart, + "Escape sequence in keyword asserts", + ); + } + + return true; + } + tsParseTypeAnnotation( eatColon = true, t: N.TsTypeAnnotation = this.startNode(), @@ -1163,7 +1264,9 @@ export default (superClass: Class): Class => this.tsParseModuleOrNamespaceDeclaration(inner, true); node.body = inner; } else { + this.scope.enter(SCOPE_TS_MODULE); node.body = this.tsParseModuleBlock(); + this.scope.exit(); } return this.finishNode(node, "TSModuleDeclaration"); } @@ -1179,9 +1282,10 @@ export default (superClass: Class): Class => } else { this.unexpected(); } - if (this.match(tt.braceL)) { + this.scope.enter(SCOPE_TS_MODULE); node.body = this.tsParseModuleBlock(); + this.scope.exit(); } else { this.semicolon(); } @@ -1195,6 +1299,12 @@ export default (superClass: Class): Class => ): N.TsImportEqualsDeclaration { node.isExport = isExport || false; node.id = this.parseIdentifier(); + this.checkLVal( + node.id, + BIND_LEXICAL, + undefined, + "import equals declaration", + ); this.expect(tt.eq); node.moduleReference = this.tsParseModuleReference(); this.semicolon(); @@ -1203,7 +1313,8 @@ export default (superClass: Class): Class => tsIsExternalModuleReference(): boolean { return ( - this.isContextual("require") && this.lookahead().type === tt.parenL + this.isContextual("require") && + this.lookaheadCharCode() === charCodes.leftParenthesis ); } @@ -1235,17 +1346,12 @@ export default (superClass: Class): Class => return res; } - tsTryParseAndCatch(f: () => T): ?T { - const state = this.state.clone(); - try { - return f(); - } catch (e) { - if (e instanceof SyntaxError) { - this.state = state; - return undefined; - } - throw e; - } + tsTryParseAndCatch(f: () => T): ?T { + const result = this.tryParse(abort => f() || abort()); + + if (result.aborted || !result.node) return undefined; + if (result.error) this.state = result.failState; + return result.node; } tsTryParse(f: () => ?T): ?T { @@ -1279,6 +1385,9 @@ export default (superClass: Class): Class => /* declarationPosition */ true, ); case tt._class: + // While this is also set by tsParseExpressionStatement, we need to set it + // before parsing the class declaration to now how to register it in the scope. + nany.declare = true; return this.parseClass( nany, /* isStatement */ true, @@ -1329,10 +1438,12 @@ export default (superClass: Class): Class => // `global { }` (with no `declare`) may appear inside an ambient module declaration. // Would like to use tsParseAmbientExternalModuleDeclaration here, but already ran past "global". if (this.match(tt.braceL)) { + this.scope.enter(SCOPE_TS_MODULE); const mod: N.TsModuleDeclaration = node; mod.global = true; mod.id = expr; mod.body = this.tsParseModuleBlock(); + this.scope.exit(); return this.finishNode(mod, "TSModuleDeclaration"); } break; @@ -1512,12 +1623,12 @@ export default (superClass: Class): Class => if (accessibility) pp.accessibility = accessibility; if (readonly) pp.readonly = readonly; if (elt.type !== "Identifier" && elt.type !== "AssignmentPattern") { - throw this.raise( + this.raise( pp.start, "A parameter property may not be declared using a binding pattern.", ); } - pp.parameter = elt; + pp.parameter = ((elt: any): N.Identifier | N.AssignmentPattern); return this.finishNode(pp, "TSParameterProperty"); } @@ -1551,11 +1662,13 @@ export default (superClass: Class): Class => super.parseFunctionBodyAndFinish(node, type, isMethod); } - checkFunctionStatementId(node: N.Function): void { + registerFunctionStatementId(node: N.Function): void { if (!node.body && node.id) { - this.checkLVal(node.id, BIND_TS_FN_TYPE, null, "function name"); + // Function ids are validated after parsing their body. + // For bodyless function, we need to do it here. + this.checkLVal(node.id, BIND_TS_AMBIENT, null, "function name"); } else { - super.checkFunctionStatementId(...arguments); + super.registerFunctionStatementId(...arguments); } } @@ -1565,7 +1678,6 @@ export default (superClass: Class): Class => startLoc: Position, noCalls: ?boolean, state: N.ParseSubscriptState, - maybeAsyncArrow: boolean, ): N.Expression { if (!this.hasPrecedingLineBreak() && this.match(tt.bang)) { this.state.exprAllowed = false; @@ -1610,7 +1722,7 @@ export default (superClass: Class): Class => /* possibleAsync */ false, ); node.typeParameters = typeArguments; - return this.finishCallExpression(node); + return this.finishCallExpression(node, state.optionalChainMember); } else if (this.match(tt.backQuote)) { return this.parseTaggedTemplateExpression( startPos, @@ -1628,14 +1740,7 @@ export default (superClass: Class): Class => if (result) return result; } - return super.parseSubscript( - base, - startPos, - startLoc, - noCalls, - state, - maybeAsyncArrow, - ); + return super.parseSubscript(base, startPos, startLoc, noCalls, state); } parseNewArguments(node: N.NewExpression): void { @@ -1806,50 +1911,49 @@ export default (superClass: Class): Class => parseClassMemberWithIsStatic( classBody: N.ClassBody, - member: any, + member: N.ClassMember | N.TsIndexSignature, state: { hadConstructor: boolean }, isStatic: boolean, constructorAllowsSuper: boolean, ): void { - const methodOrProp: N.ClassMethod | N.ClassProperty = member; - const prop: N.ClassProperty = member; - const propOrIdx: N.ClassProperty | N.TsIndexSignature = member; - - let abstract = false, - readonly = false; - - const mod = this.tsParseModifier(["abstract", "readonly"]); - switch (mod) { - case "readonly": - readonly = true; - abstract = !!this.tsParseModifier(["abstract"]); - break; - case "abstract": - abstract = true; - readonly = !!this.tsParseModifier(["readonly"]); - break; - } + const modifiers = this.tsParseModifiers([ + "abstract", + "readonly", + "declare", + ]); - if (abstract) methodOrProp.abstract = true; - if (readonly) propOrIdx.readonly = true; + Object.assign(member, modifiers); - if (!abstract && !isStatic && !methodOrProp.accessibility) { - const idx = this.tsTryParseIndexSignature(member); - if (idx) { - classBody.body.push(idx); - return; + const idx = this.tsTryParseIndexSignature(member); + if (idx) { + classBody.body.push(idx); + + if (modifiers.abstract) { + this.raise( + member.start, + "Index signatures cannot have the 'abstract' modifier", + ); + } + if (isStatic) { + this.raise( + member.start, + "Index signatures cannot have the 'static' modifier", + ); + } + if ((member: any).accessibility) { + this.raise( + member.start, + `Index signatures cannot have an accessibility modifier ('${ + (member: any).accessibility + }')`, + ); } - } - if (readonly) { - // Must be a property (if not an index signature). - methodOrProp.static = isStatic; - this.parseClassPropertyName(prop); - this.parsePostMemberNameModifiers(methodOrProp); - this.pushClassProperty(classBody, prop); return; } + /*:: invariant(member.type !== "TSIndexSignature") */ + super.parseClassMemberWithIsStatic( classBody, member, @@ -1860,10 +1964,24 @@ export default (superClass: Class): Class => } parsePostMemberNameModifiers( - methodOrProp: N.ClassMethod | N.ClassProperty, + methodOrProp: N.ClassMethod | N.ClassProperty | N.ClassPrivateProperty, ): void { const optional = this.eat(tt.question); if (optional) methodOrProp.optional = true; + + if ((methodOrProp: any).readonly && this.match(tt.parenL)) { + this.raise( + methodOrProp.start, + "Class methods cannot have the 'readonly' modifier", + ); + } + + if ((methodOrProp: any).declare && this.match(tt.parenL)) { + this.raise( + methodOrProp.start, + "Class methods cannot have the 'declare' modifier", + ); + } } // Note: The reason we do this in `parseExpressionStatement` and not `parseStatement` @@ -1908,19 +2026,17 @@ export default (superClass: Class): Class => ); } - const state = this.state.clone(); - try { - return super.parseConditional(expr, noIn, startPos, startLoc); - } catch (err) { - if (!(err instanceof SyntaxError)) { - // istanbul ignore next: no such error is expected - throw err; - } + const result = this.tryParse(() => + super.parseConditional(expr, noIn, startPos, startLoc), + ); - this.state = state; - refNeedsArrowPos.start = err.pos || this.state.start; + if (!result.node) { + // $FlowIgnore + refNeedsArrowPos.start = result.error.pos || this.state.start; return expr; } + if (result.error) this.state = result.failState; + return result.node; } // Note: These "type casts" are *not* valid TS expressions. @@ -1989,21 +2105,63 @@ export default (superClass: Class): Class => return; } - super.parseClassId(...arguments); + super.parseClassId( + node, + isStatement, + optionalId, + (node: any).declare ? BIND_TS_AMBIENT : BIND_CLASS, + ); const typeParameters = this.tsTryParseTypeParameters(); if (typeParameters) node.typeParameters = typeParameters; } - parseClassProperty(node: N.ClassProperty): N.ClassProperty { + parseClassPropertyAnnotation( + node: N.ClassProperty | N.ClassPrivateProperty, + ): void { if (!node.optional && this.eat(tt.bang)) { node.definite = true; } const type = this.tsTryParseTypeAnnotation(); if (type) node.typeAnnotation = type; + } + + parseClassProperty(node: N.ClassProperty): N.ClassProperty { + this.parseClassPropertyAnnotation(node); + + if (node.declare && this.match(tt.equal)) { + this.raise( + this.state.start, + "'declare' class fields cannot have an initializer", + ); + } + return super.parseClassProperty(node); } + parseClassPrivateProperty( + node: N.ClassPrivateProperty, + ): N.ClassPrivateProperty { + // $FlowIgnore + if (node.abstract) { + this.raise( + node.start, + "Private elements cannot have the 'abstract' modifier.", + ); + } + + // $FlowIgnore + if (node.accessibility) { + this.raise( + node.start, + `Private elements cannot have an accessibility modifier ('${node.accessibility}')`, + ); + } + + this.parseClassPropertyAnnotation(node); + return super.parseClassPrivateProperty(node); + } + pushClassMethod( classBody: N.ClassBody, method: N.ClassMethod, @@ -2089,88 +2247,105 @@ export default (superClass: Class): Class => parseMaybeAssign(...args): N.Expression { // Note: When the JSX plugin is on, type assertions (` x`) aren't valid syntax. - let jsxError: ?SyntaxError; + let state: ?State; + let jsx; + let typeCast; if (this.match(tt.jsxTagStart)) { - const context = this.curContext(); - assert(context === ct.j_oTag); - // Only time j_oTag is pushed is right after j_expr. - assert(this.state.context[this.state.context.length - 2] === ct.j_expr); - // Prefer to parse JSX if possible. But may be an arrow fn. - const state = this.state.clone(); - try { - return super.parseMaybeAssign(...args); - } catch (err) { - if (!(err instanceof SyntaxError)) { - // istanbul ignore next: no such error is expected - throw err; - } + state = this.state.clone(); + + jsx = this.tryParse(() => super.parseMaybeAssign(...args), state); + /*:: invariant(!jsx.aborted) */ - this.state = state; - // Pop the context added by the jsxTagStart. - assert(this.curContext() === ct.j_oTag); - this.state.context.pop(); - assert(this.curContext() === ct.j_expr); - this.state.context.pop(); - jsxError = err; + if (!jsx.error) return jsx.node; + + // Remove `tc.j_expr` and `tc.j_oTag` from context added + // by parsing `jsxTagStart` to stop the JSX plugin from + // messing with the tokens + const { context } = this.state; + if (context[context.length - 1] === ct.j_oTag) { + context.length -= 2; + } else if (context[context.length - 1] === ct.j_expr) { + context.length -= 1; } } - if (jsxError === undefined && !this.isRelational("<")) { + if (!(jsx && jsx.error) && !this.isRelational("<")) { return super.parseMaybeAssign(...args); } // Either way, we're looking at a '<': tt.jsxTagStart or relational. - let arrowExpression; let typeParameters: N.TsTypeParameterDeclaration; - const state = this.state.clone(); - try { + state = state || this.state.clone(); + + const arrow = this.tryParse(abort => { // This is similar to TypeScript's `tryParseParenthesizedArrowFunctionExpression`. typeParameters = this.tsParseTypeParameters(); - arrowExpression = super.parseMaybeAssign(...args); + const expr = super.parseMaybeAssign(...args); + if ( - arrowExpression.type !== "ArrowFunctionExpression" || - (arrowExpression.extra && arrowExpression.extra.parenthesized) + expr.type !== "ArrowFunctionExpression" || + (expr.extra && expr.extra.parenthesized) ) { - this.unexpected(); // Go to the catch block (needs a SyntaxError). - } - } catch (err) { - if (!(err instanceof SyntaxError)) { - // istanbul ignore next: no such error is expected - throw err; + abort(); } - if (jsxError) { - throw jsxError; + // Correct TypeScript code should have at least 1 type parameter, but don't crash on bad code. + if (typeParameters && typeParameters.params.length !== 0) { + this.resetStartLocationFromNode(expr, typeParameters); } + expr.typeParameters = typeParameters; + return expr; + }, state); + if (!arrow.error && !arrow.aborted) return arrow.node; + + if (!jsx) { // Try parsing a type cast instead of an arrow function. // This will never happen outside of JSX. // (Because in JSX the '<' should be a jsxTagStart and not a relational. assert(!this.hasPlugin("jsx")); - // Parsing an arrow function failed, so try a type cast. - this.state = state; + // This will start with a type assertion (via parseMaybeUnary). // But don't directly call `this.tsParseTypeAssertion` because we want to handle any binary after it. - return super.parseMaybeAssign(...args); + typeCast = this.tryParse(() => super.parseMaybeAssign(...args), state); + /*:: invariant(!typeCast.aborted) */ + if (!typeCast.error) return typeCast.node; + } + + if (jsx && jsx.node) { + /*:: invariant(jsx.failState) */ + this.state = jsx.failState; + return jsx.node; + } + + if (arrow.node) { + /*:: invariant(arrow.failState) */ + this.state = arrow.failState; + return arrow.node; } - // Correct TypeScript code should have at least 1 type parameter, but don't crash on bad code. - if (typeParameters && typeParameters.params.length !== 0) { - this.resetStartLocationFromNode(arrowExpression, typeParameters); + if (typeCast && typeCast.node) { + /*:: invariant(typeCast.failState) */ + this.state = typeCast.failState; + return typeCast.node; } - arrowExpression.typeParameters = typeParameters; - return arrowExpression; + + if (jsx && jsx.thrown) throw jsx.error; + if (arrow.thrown) throw arrow.error; + if (typeCast && typeCast.thrown) throw typeCast.error; + + throw (jsx && jsx.error) || arrow.error || (typeCast && typeCast.error); } // Handle type assertions - parseMaybeUnary(refShorthandDefaultPos?: ?Pos): N.Expression { + parseMaybeUnary(refExpressionErrors?: ?ExpressionErrors): N.Expression { if (!this.hasPlugin("jsx") && this.isRelational("<")) { return this.tsParseTypeAssertion(); } else { - return super.parseMaybeUnary(refShorthandDefaultPos); + return super.parseMaybeUnary(refExpressionErrors); } } @@ -2178,23 +2353,20 @@ export default (superClass: Class): Class => if (this.match(tt.colon)) { // This is different from how the TS parser does it. // TS uses lookahead. The Babel Parser parses it as a parenthesized expression and converts. - const state = this.state.clone(); - try { + + const result = this.tryParse(abort => { const returnType = this.tsParseTypeOrTypePredicateAnnotation( tt.colon, ); - if (this.canInsertSemicolon() || !this.match(tt.arrow)) { - this.state = state; - return undefined; - } - node.returnType = returnType; - } catch (err) { - if (err instanceof SyntaxError) { - this.state = state; - } else { - // istanbul ignore next: no such error is expected - throw err; - } + if (this.canInsertSemicolon() || !this.match(tt.arrow)) abort(); + return returnType; + }); + + if (result.aborted) return; + + if (!result.thrown) { + if (result.error) this.state = result.failState; + node.returnType = result.node; } } @@ -2205,13 +2377,13 @@ export default (superClass: Class): Class => parseAssignableListItemTypes(param: N.Pattern) { if (this.eat(tt.question)) { if (param.type !== "Identifier") { - throw this.raise( + this.raise( param.start, "A binding pattern parameter cannot be optional in an implementation signature.", ); } - param.optional = true; + ((param: any): N.Identifier).optional = true; } const type = this.tsTryParseTypeAnnotation(); if (type) param.typeAnnotation = type; @@ -2355,7 +2527,6 @@ export default (superClass: Class): Class => toAssignableList( exprList: N.Expression[], isBinding: ?boolean, - contextDescription: string, ): $ReadOnlyArray { for (let i = 0; i < exprList.length; i++) { const expr = exprList[i]; @@ -2366,14 +2537,18 @@ export default (superClass: Class): Class => break; case "TSAsExpression": case "TSTypeAssertion": - this.raise( - expr.start, - "Unexpected type cast in parameter position.", - ); + if (!isBinding) { + exprList[i] = this.typeCastToParameter(expr); + } else { + this.raise( + expr.start, + "Unexpected type cast in parameter position.", + ); + } break; } } - return super.toAssignableList(exprList, isBinding, contextDescription); + return super.toAssignableList(...arguments); } typeCastToParameter(node: N.TsTypeCastExpression): N.Node { @@ -2394,11 +2569,7 @@ export default (superClass: Class): Class => ): $ReadOnlyArray { for (let i = 0; i < exprList.length; i++) { const expr = exprList[i]; - if ( - expr && - expr._exprListItem && - expr.type === "TsTypeCastExpression" - ) { + if (expr && expr.type === "TSTypeCastExpression") { this.raise(expr.start, "Did not expect a type annotation here."); } } diff --git a/packages/babel-parser/src/plugins/typescript/scope.js b/packages/babel-parser/src/plugins/typescript/scope.js index f706f1e88e99..085b90e73496 100644 --- a/packages/babel-parser/src/plugins/typescript/scope.js +++ b/packages/babel-parser/src/plugins/typescript/scope.js @@ -25,7 +25,7 @@ class TypeScriptScope extends Scope { // classes (which are also in .lexical) and interface (which are also in .types) classes: string[] = []; - // namespaces and bodyless-functions are too difficult to track, + // namespaces and ambient functions (or classes) are too difficult to track, // especially without type analysis. // We need to track them anyway, to avoid "X is not defined" errors // when exporting them. diff --git a/packages/babel-parser/src/plugins/v8intrinsic.js b/packages/babel-parser/src/plugins/v8intrinsic.js new file mode 100644 index 000000000000..be3a1fbaae0d --- /dev/null +++ b/packages/babel-parser/src/plugins/v8intrinsic.js @@ -0,0 +1,32 @@ +import type Parser from "../parser"; +import { types as tt } from "../tokenizer/types"; +import * as N from "../types"; + +export default (superClass: Class): Class => + class extends superClass { + parseV8Intrinsic(): N.Expression { + if (this.match(tt.modulo)) { + const v8IntrinsicStart = this.state.start; + // let the `loc` of Identifier starts from `%` + const node = this.startNode(); + this.eat(tt.modulo); + if (this.match(tt.name)) { + const name = this.parseIdentifierName(this.state.start); + const identifier = this.createIdentifier(node, name); + identifier.type = "V8IntrinsicIdentifier"; + if (this.match(tt.parenL)) { + return identifier; + } + } + this.unexpected(v8IntrinsicStart); + } + } + + /* ============================================================ * + * parser/expression.js * + * ============================================================ */ + + parseExprAtom(): N.Expression { + return this.parseV8Intrinsic() || super.parseExprAtom(...arguments); + } + }; diff --git a/packages/babel-parser/src/tokenizer/index.js b/packages/babel-parser/src/tokenizer/index.js index ffb8cba8ca6f..a4e2de67a242 100644 --- a/packages/babel-parser/src/tokenizer/index.js +++ b/packages/babel-parser/src/tokenizer/index.js @@ -13,6 +13,7 @@ import { lineBreakG, isNewLine, isWhitespace, + skipWhiteSpace, } from "../util/whitespace"; import State from "./state"; @@ -125,8 +126,11 @@ export default class Tokenizer extends LocationParser { // Move to the next token next(): void { - if (this.options.tokens && !this.isLookahead) { - this.state.tokens.push(new Token(this.state)); + if (!this.isLookahead) { + this.checkKeywordEscapes(); + if (this.options.tokens) { + this.state.tokens.push(new Token(this.state)); + } } this.state.lastTokEnd = this.state.end; @@ -168,6 +172,18 @@ export default class Tokenizer extends LocationParser { return curr; } + nextTokenStart(): number { + const thisTokEnd = this.state.pos; + skipWhiteSpace.lastIndex = thisTokEnd; + const skip = skipWhiteSpace.exec(this.input); + // $FlowIgnore: The skipWhiteSpace ensures to match any string + return thisTokEnd + skip[0].length; + } + + lookaheadCharCode(): number { + return this.input.charCodeAt(this.nextTokenStart()); + } + // Toggle strict mode. Re-reads the next number or string to please // pedantic tests (`"use strict"; 010;` should fail). @@ -234,8 +250,8 @@ export default class Tokenizer extends LocationParser { skipBlockComment(): void { const startLoc = this.state.curPosition(); const start = this.state.pos; - const end = this.input.indexOf("*/", (this.state.pos += 2)); - if (end === -1) this.raise(this.state.pos - 2, "Unterminated comment"); + const end = this.input.indexOf("*/", this.state.pos + 2); + if (end === -1) throw this.raise(start, "Unterminated comment"); this.state.pos = end + 2; lineBreakG.lastIndex = start; @@ -267,13 +283,7 @@ export default class Tokenizer extends LocationParser { const startLoc = this.state.curPosition(); let ch = this.input.charCodeAt((this.state.pos += startSkip)); if (this.state.pos < this.length) { - while ( - ch !== charCodes.lineFeed && - ch !== charCodes.carriageReturn && - ch !== charCodes.lineSeparator && - ch !== charCodes.paragraphSeparator && - ++this.state.pos < this.length - ) { + while (!isNewLine(ch) && ++this.state.pos < this.length) { ch = this.input.charCodeAt(this.state.pos); } } @@ -377,23 +387,17 @@ export default class Tokenizer extends LocationParser { const nextPos = this.state.pos + 1; const next = this.input.charCodeAt(nextPos); if (next >= charCodes.digit0 && next <= charCodes.digit9) { - this.raise(this.state.pos, "Unexpected digit after hash token"); + throw this.raise(this.state.pos, "Unexpected digit after hash token"); } if ( - (this.hasPlugin("classPrivateProperties") || - this.hasPlugin("classPrivateMethods")) && - this.state.classLevel > 0 - ) { - ++this.state.pos; - this.finishToken(tt.hash); - return; - } else if ( + this.hasPlugin("classPrivateProperties") || + this.hasPlugin("classPrivateMethods") || this.getPluginOption("pipelineOperator", "proposal") === "smart" ) { this.finishOp(tt.hash, 1); } else { - this.raise(this.state.pos, "Unexpected character '#'"); + throw this.raise(this.state.pos, "Unexpected character '#'"); } } @@ -404,8 +408,10 @@ export default class Tokenizer extends LocationParser { return; } - const next2 = this.input.charCodeAt(this.state.pos + 2); - if (next === charCodes.dot && next2 === charCodes.dot) { + if ( + next === charCodes.dot && + this.input.charCodeAt(this.state.pos + 2) === charCodes.dot + ) { this.state.pos += 3; this.finishToken(tt.ellipsis); } else { @@ -439,13 +445,7 @@ export default class Tokenizer extends LocationParser { let ch = this.input.charCodeAt(this.state.pos); if (ch !== charCodes.exclamationMark) return false; - while ( - ch !== charCodes.lineFeed && - ch !== charCodes.carriageReturn && - ch !== charCodes.lineSeparator && - ch !== charCodes.paragraphSeparator && - ++this.state.pos < this.length - ) { + while (!isNewLine(ch) && ++this.state.pos < this.length) { ch = this.input.charCodeAt(this.state.pos); } @@ -805,7 +805,7 @@ export default class Tokenizer extends LocationParser { } } - this.raise( + throw this.raise( this.state.pos, `Unexpected character '${String.fromCodePoint(code)}'`, ); @@ -822,11 +822,11 @@ export default class Tokenizer extends LocationParser { let escaped, inClass; for (;;) { if (this.state.pos >= this.length) { - this.raise(start, "Unterminated regular expression"); + throw this.raise(start, "Unterminated regular expression"); } const ch = this.input.charAt(this.state.pos); if (lineBreak.test(ch)) { - this.raise(start, "Unterminated regular expression"); + throw this.raise(start, "Unterminated regular expression"); } if (escaped) { escaped = false; @@ -855,9 +855,6 @@ export default class Tokenizer extends LocationParser { if (mods.indexOf(char) > -1) { this.raise(this.state.pos + 1, "Duplicate regular expression flag"); } - - ++this.state.pos; - mods += char; } else if ( isIdentifierChar(charCode) || charCode === charCodes.backslash @@ -866,6 +863,9 @@ export default class Tokenizer extends LocationParser { } else { break; } + + ++this.state.pos; + mods += char; } this.finishToken(tt.regexp, { @@ -877,8 +877,18 @@ export default class Tokenizer extends LocationParser { // Read an integer in the given radix. Return null if zero digits // were read, the integer value otherwise. When `len` is given, this // will return `null` unless the integer has exactly `len` digits. - - readInt(radix: number, len?: number): number | null { + // When `forceLen` is `true`, it means that we already know that in case + // of a malformed number we have to skip `len` characters anyway, instead + // of bailing out early. For example, in "\u{123Z}" we want to read up to } + // anyway, while in "\u00Z" we will stop at Z instead of consuming four + // characters (and thus the closing quote). + + readInt( + radix: number, + len?: number, + forceLen?: boolean, + allowNumSeparator: boolean = true, + ): number | null { const start = this.state.pos; const forbiddenSiblings = radix === 16 @@ -893,6 +903,7 @@ export default class Tokenizer extends LocationParser { ? allowedNumericSeparatorSiblings.oct : allowedNumericSeparatorSiblings.bin; + let invalid = false; let total = 0; for (let i = 0, e = len == null ? Infinity : len; i < e; ++i) { @@ -900,19 +911,30 @@ export default class Tokenizer extends LocationParser { let val; if (this.hasPlugin("numericSeparator")) { - const prev = this.input.charCodeAt(this.state.pos - 1); - const next = this.input.charCodeAt(this.state.pos + 1); if (code === charCodes.underscore) { + const prev = this.input.charCodeAt(this.state.pos - 1); + const next = this.input.charCodeAt(this.state.pos + 1); if (allowedSiblings.indexOf(next) === -1) { - this.raise(this.state.pos, "Invalid or unexpected token"); - } - - if ( + this.raise( + this.state.pos, + "A numeric separator is only allowed between two digits", + ); + } else if ( forbiddenSiblings.indexOf(prev) > -1 || forbiddenSiblings.indexOf(next) > -1 || Number.isNaN(next) ) { - this.raise(this.state.pos, "Invalid or unexpected token"); + this.raise( + this.state.pos, + "A numeric separator is only allowed between two digits", + ); + } + + if (!allowNumSeparator) { + this.raise( + this.state.pos, + "Numeric separators are not allowed inside unicode escape sequences or hex escape sequences", + ); } // Ignore this _ character @@ -930,13 +952,30 @@ export default class Tokenizer extends LocationParser { } else { val = Infinity; } - if (val >= radix) break; + if (val >= radix) { + // If we are in "errorRecovery" mode and we found a digit which is too big, + // don't break the loop. + + if (this.options.errorRecovery && val <= 9) { + val = 0; + this.raise( + this.state.start + i + 2, + "Expected number in radix " + radix, + ); + } else if (forceLen) { + val = 0; + invalid = true; + } else { + break; + } + } ++this.state.pos; total = total * radix + val; } if ( this.state.pos === start || - (len != null && this.state.pos - start !== len) + (len != null && this.state.pos - start !== len) || + invalid ) { return null; } @@ -962,7 +1001,7 @@ export default class Tokenizer extends LocationParser { } if (isIdentifierStart(this.input.codePointAt(this.state.pos))) { - this.raise(this.state.pos, "Identifier directly after number"); + throw this.raise(this.state.pos, "Identifier directly after number"); } if (isBigInt) { @@ -980,6 +1019,7 @@ export default class Tokenizer extends LocationParser { const start = this.state.pos; let isFloat = false; let isBigInt = false; + let isNonOctalDecimalInt = false; if (!startsWithDot && this.readInt(10) === null) { this.raise(start, "Invalid number"); @@ -996,6 +1036,7 @@ export default class Tokenizer extends LocationParser { } if (/[89]/.test(this.input.slice(start, this.state.pos))) { octal = false; + isNonOctalDecimalInt = true; } } @@ -1020,17 +1061,33 @@ export default class Tokenizer extends LocationParser { next = this.input.charCodeAt(this.state.pos); } + // disallow numeric separators in non octal decimals and legacy octal likes + if (this.hasPlugin("numericSeparator") && (octal || isNonOctalDecimalInt)) { + const underscorePos = this.input + .slice(start, this.state.pos) + .indexOf("_"); + if (underscorePos > 0) { + this.raise( + underscorePos + start, + "Numeric separator can not be used after leading 0", + ); + } + } + if (this.hasPlugin("bigInt")) { if (next === charCodes.lowercaseN) { - // disallow floats and legacy octal syntax, new style octal ("0o") is handled in this.readRadixNumber - if (isFloat || octal) this.raise(start, "Invalid BigIntLiteral"); + // disallow floats, legacy octal syntax and non octal decimals + // new style octal ("0o") is handled in this.readRadixNumber + if (isFloat || octal || isNonOctalDecimalInt) { + this.raise(start, "Invalid BigIntLiteral"); + } ++this.state.pos; isBigInt = true; } } if (isIdentifierStart(this.input.codePointAt(this.state.pos))) { - this.raise(this.state.pos, "Identifier directly after number"); + throw this.raise(this.state.pos, "Identifier directly after number"); } // remove "_" for numeric literal separator, and "n" for BigInts @@ -1055,22 +1112,19 @@ export default class Tokenizer extends LocationParser { const codePos = ++this.state.pos; code = this.readHexChar( this.input.indexOf("}", this.state.pos) - this.state.pos, + true, throwOnInvalid, ); ++this.state.pos; - if (code === null) { - // $FlowFixMe (is this always non-null?) - --this.state.invalidTemplateEscapePosition; // to point to the '\'' instead of the 'u' - } else if (code > 0x10ffff) { + if (code !== null && code > 0x10ffff) { if (throwOnInvalid) { this.raise(codePos, "Code point out of bounds"); } else { - this.state.invalidTemplateEscapePosition = codePos - 2; return null; } } } else { - code = this.readHexChar(4, throwOnInvalid); + code = this.readHexChar(4, false, throwOnInvalid); } return code; } @@ -1080,7 +1134,7 @@ export default class Tokenizer extends LocationParser { chunkStart = ++this.state.pos; for (;;) { if (this.state.pos >= this.length) { - this.raise(this.state.start, "Unterminated string constant"); + throw this.raise(this.state.start, "Unterminated string constant"); } const ch = this.input.charCodeAt(this.state.pos); if (ch === quote) break; @@ -1095,8 +1149,9 @@ export default class Tokenizer extends LocationParser { ) { ++this.state.pos; ++this.state.curLine; + this.state.lineStart = this.state.pos; } else if (isNewLine(ch)) { - this.raise(this.state.start, "Unterminated string constant"); + throw this.raise(this.state.start, "Unterminated string constant"); } else { ++this.state.pos; } @@ -1113,7 +1168,7 @@ export default class Tokenizer extends LocationParser { containsInvalid = false; for (;;) { if (this.state.pos >= this.length) { - this.raise(this.state.start, "Unterminated template"); + throw this.raise(this.state.start, "Unterminated template"); } const ch = this.input.charCodeAt(this.state.pos); if ( @@ -1182,7 +1237,7 @@ export default class Tokenizer extends LocationParser { case charCodes.lowercaseR: return "\r"; case charCodes.lowercaseX: { - const code = this.readHexChar(2, throwOnInvalid); + const code = this.readHexChar(2, false, throwOnInvalid); return code === null ? null : String.fromCharCode(code); } case charCodes.lowercaseU: { @@ -1207,6 +1262,11 @@ export default class Tokenizer extends LocationParser { case charCodes.lineSeparator: case charCodes.paragraphSeparator: return ""; + case charCodes.digit8: + case charCodes.digit9: + if (inTemplate) { + return null; + } default: if (ch >= charCodes.digit0 && ch <= charCodes.digit7) { const codePos = this.state.pos - 1; @@ -1227,7 +1287,6 @@ export default class Tokenizer extends LocationParser { next === charCodes.digit9 ) { if (inTemplate) { - this.state.invalidTemplateEscapePosition = codePos; return null; } else if (this.state.strict) { this.raise(codePos, "Octal literal in strict mode"); @@ -1248,15 +1307,18 @@ export default class Tokenizer extends LocationParser { // Used to read character escape sequences ('\x', '\u'). - readHexChar(len: number, throwOnInvalid: boolean): number | null { + readHexChar( + len: number, + forceLen: boolean, + throwOnInvalid: boolean, + ): number | null { const codePos = this.state.pos; - const n = this.readInt(16, len); + const n = this.readInt(16, len, forceLen, false); if (n === null) { if (throwOnInvalid) { this.raise(codePos, "Bad character escape sequence"); } else { this.state.pos = codePos - 1; - this.state.invalidTemplateEscapePosition = codePos - 1; } } return n; @@ -1293,20 +1355,18 @@ export default class Tokenizer extends LocationParser { this.state.pos, "Expecting Unicode escape sequence \\uXXXX", ); + continue; } ++this.state.pos; const esc = this.readCodePoint(true); + if (esc !== null) { + if (!identifierCheck(esc)) { + this.raise(escStart, "Invalid Unicode escape"); + } - if ( - // $FlowFixMe (thinks esc may be null, but throwOnInvalid is true) - !identifierCheck(esc, true) - ) { - this.raise(escStart, "Invalid Unicode escape"); + word += String.fromCodePoint(esc); } - - // $FlowFixMe - word += String.fromCodePoint(esc); chunkStart = this.state.pos; } else { break; @@ -1326,10 +1386,6 @@ export default class Tokenizer extends LocationParser { const word = this.readWord1(); const type = keywordTypes.get(word) || tt.name; - if (type.keyword && this.state.containsEsc) { - this.raise(this.state.pos, `Escape sequence in keyword ${word}`); - } - // Allow @@iterator and @@asyncIterator as a identifier only inside type if ( this.state.isIterator && @@ -1341,6 +1397,13 @@ export default class Tokenizer extends LocationParser { this.finishToken(type, word); } + checkKeywordEscapes(): void { + const kw = this.state.type.keyword; + if (kw && this.state.containsEsc) { + this.raise(this.state.start, `Escape sequence in keyword ${kw}`); + } + } + braceIsBlock(prevType: TokenType): boolean { const parent = this.curContext(); if (parent === ct.functionExpression || parent === ct.functionStatement) { diff --git a/packages/babel-parser/src/tokenizer/state.js b/packages/babel-parser/src/tokenizer/state.js index 80842fbc5103..ff0e704b8f00 100644 --- a/packages/babel-parser/src/tokenizer/state.js +++ b/packages/babel-parser/src/tokenizer/state.js @@ -38,6 +38,8 @@ export default class State { this.startLoc = this.endLoc = this.curPosition(); } + errors: SyntaxError[] = []; + // Used to signify the start of a potential arrow function potentialArrowAt: number = -1; @@ -55,11 +57,6 @@ export default class State { // ^ noArrowParamsConversionAt: number[] = []; - // A comma after "...a" is only allowed in spread, but not in rest. - // Since we parse destructuring patterns as array/object literals - // and then convert them, we need to track it. - commaAfterSpreadAt: number = -1; - // Flags to track inParameters: boolean = false; maybeInArrowParameters: boolean = false; @@ -67,7 +64,6 @@ export default class State { inType: boolean = false; noAnonFunctionType: boolean = false; inPropertyName: boolean = false; - inClassProperty: boolean = false; hasFlowComment: boolean = false; isIterator: boolean = false; @@ -81,9 +77,6 @@ export default class State { soloAwait: boolean = false; inFSharpPipelineDirectBody: boolean = false; - // Check whether we are in a (nested) class or not. - classLevel: number = 0; - // Labels in scope. labels: Array<{ kind: ?("loop" | "switch"), @@ -97,8 +90,8 @@ export default class State { decoratorStack: Array> = [[]]; // Positions to delayed-check that yield/await does not exist in default parameters. - yieldPos: number = 0; - awaitPos: number = 0; + yieldPos: number = -1; + awaitPos: number = -1; // Token store. tokens: Array = []; @@ -160,8 +153,6 @@ export default class State { // `export default foo;` and `export { foo as default };`. exportedIdentifiers: Array = []; - invalidTemplateEscapePosition: ?number = null; - curPosition(): Position { return new Position(this.curLine, this.pos - this.lineStart); } diff --git a/packages/babel-parser/src/tokenizer/types.js b/packages/babel-parser/src/tokenizer/types.js index 34fd891c9256..ecb1e8376571 100644 --- a/packages/babel-parser/src/tokenizer/types.js +++ b/packages/babel-parser/src/tokenizer/types.js @@ -139,21 +139,22 @@ export const types: { [name: string]: TokenType } = { tilde: new TokenType("~", { beforeExpr, prefix, startsExpr }), pipeline: createBinop("|>", 0), nullishCoalescing: createBinop("??", 1), - logicalOR: createBinop("||", 1), - logicalAND: createBinop("&&", 2), - bitwiseOR: createBinop("|", 3), - bitwiseXOR: createBinop("^", 4), - bitwiseAND: createBinop("&", 5), - equality: createBinop("==/!=/===/!==", 6), - relational: createBinop("/<=/>=", 7), - bitShift: createBinop("<>/>>>", 8), - plusMin: new TokenType("+/-", { beforeExpr, binop: 9, prefix, startsExpr }), - modulo: createBinop("%", 10), - star: createBinop("*", 10), - slash: createBinop("/", 10), + logicalOR: createBinop("||", 2), + logicalAND: createBinop("&&", 3), + bitwiseOR: createBinop("|", 4), + bitwiseXOR: createBinop("^", 5), + bitwiseAND: createBinop("&", 6), + equality: createBinop("==/!=/===/!==", 7), + relational: createBinop("/<=/>=", 8), + bitShift: createBinop("<>/>>>", 9), + plusMin: new TokenType("+/-", { beforeExpr, binop: 10, prefix, startsExpr }), + // startsExpr: required by v8intrinsic plugin + modulo: new TokenType("%", { beforeExpr, binop: 11, startsExpr }), + star: createBinop("*", 11), + slash: createBinop("/", 11), exponent: new TokenType("**", { beforeExpr, - binop: 11, + binop: 12, rightAssociative: true, }), @@ -188,8 +189,8 @@ export const types: { [name: string]: TokenType } = { _null: createKeyword("null", { startsExpr }), _true: createKeyword("true", { startsExpr }), _false: createKeyword("false", { startsExpr }), - _in: createKeyword("in", { beforeExpr, binop: 7 }), - _instanceof: createKeyword("instanceof", { beforeExpr, binop: 7 }), + _in: createKeyword("in", { beforeExpr, binop: 8 }), + _instanceof: createKeyword("instanceof", { beforeExpr, binop: 8 }), _typeof: createKeyword("typeof", { beforeExpr, prefix, startsExpr }), _void: createKeyword("void", { beforeExpr, prefix, startsExpr }), _delete: createKeyword("delete", { beforeExpr, prefix, startsExpr }), diff --git a/packages/babel-parser/src/types.js b/packages/babel-parser/src/types.js index 2c5992d2ba6c..597b2f5d674c 100644 --- a/packages/babel-parser/src/types.js +++ b/packages/babel-parser/src/types.js @@ -96,7 +96,8 @@ export type Literal = | NullLiteral | StringLiteral | BooleanLiteral - | NumericLiteral; + | NumericLiteral + | BigIntLiteral; export type RegExpLiteral = NodeBase & { type: "RegExpLiteral", @@ -743,18 +744,19 @@ export type ClassPrivateMethod = NodeBase & computed: false, }; -export type ClassProperty = ClassMemberBase & { - type: "ClassProperty", - key: Expression, - value: ?Expression, // TODO: Not in spec that this is nullable. +export type ClassProperty = ClassMemberBase & + DeclarationBase & { + type: "ClassProperty", + key: Expression, + value: ?Expression, // TODO: Not in spec that this is nullable. - typeAnnotation?: ?TypeAnnotationBase, // TODO: Not in spec - variance?: ?FlowVariance, // TODO: Not in spec + typeAnnotation?: ?TypeAnnotationBase, // TODO: Not in spec + variance?: ?FlowVariance, // TODO: Not in spec - // TypeScript only: (TODO: Not in spec) - readonly?: true, - definite?: true, -}; + // TypeScript only: (TODO: Not in spec) + readonly?: true, + definite?: true, + }; export type ClassPrivateProperty = NodeBase & { type: "ClassPrivateProperty", @@ -762,7 +764,14 @@ export type ClassPrivateProperty = NodeBase & { value: ?Expression, // TODO: Not in spec that this is nullable. static: boolean, computed: false, - typeAnnotation?: ?TypeAnnotation, // TODO: Not in spec + + // Flow and Typescript + typeAnnotation?: ?TypeAnnotationBase, + + // TypeScript only + optional?: true, + definite?: true, + readonly?: true, }; export type OptClassDeclaration = ClassBase & @@ -1004,7 +1013,7 @@ export type FlowInterfaceType = NodeBase & { body: FlowObjectTypeAnnotation, }; -// estree +// ESTree export type EstreeProperty = NodeBase & { type: "Property", @@ -1030,6 +1039,11 @@ export type EstreeMethodDefinition = NodeBase & { variance?: ?FlowVariance, }; +export type EstreeImportExpression = NodeBase & { + type: "ImportExpression", + source: Expression, +}; + // === === === === // TypeScript // === === === === @@ -1219,6 +1233,7 @@ export type TsTypePredicate = TsTypeBase & { type: "TSTypePredicate", parameterName: Identifier | TsThisType, typeAnnotation: TsTypeAnnotation, + asserts?: boolean, }; // `typeof` operator @@ -1447,5 +1462,6 @@ export type Placeholder = NodeBase & { export type ParseSubscriptState = { optionalChainMember: boolean, + maybeAsyncArrow: boolean, stop: boolean, }; diff --git a/packages/babel-parser/src/util/class-scope.js b/packages/babel-parser/src/util/class-scope.js new file mode 100644 index 000000000000..0d1332160a62 --- /dev/null +++ b/packages/babel-parser/src/util/class-scope.js @@ -0,0 +1,113 @@ +// @flow + +import { + CLASS_ELEMENT_KIND_ACCESSOR, + CLASS_ELEMENT_FLAG_STATIC, + type ClassElementTypes, +} from "./scopeflags"; + +export class ClassScope { + // A list of private named declared in the current class + privateNames: Set = new Set(); + + // A list of private getters of setters without their counterpart + loneAccessors: Map = new Map(); + + // A list of private names used before being defined, mapping to + // their position. + undefinedPrivateNames: Map = new Map(); +} + +type raiseFunction = (number, string) => void; + +export default class ClassScopeHandler { + stack: Array = []; + raise: raiseFunction; + undefinedPrivateNames: Map = new Map(); + + constructor(raise: raiseFunction) { + this.raise = raise; + } + + current(): ClassScope { + return this.stack[this.stack.length - 1]; + } + + enter() { + this.stack.push(new ClassScope()); + } + + exit() { + const oldClassScope = this.stack.pop(); + + // Migrate the usage of not yet defined private names to the outer + // class scope, or raise an error if we reached the top-level scope. + + const current = this.current(); + + // Array.from is needed because this is compiled to an array-like for loop + for (const [name, pos] of Array.from(oldClassScope.undefinedPrivateNames)) { + if (current) { + if (!current.undefinedPrivateNames.has(name)) { + current.undefinedPrivateNames.set(name, pos); + } + } else { + this.raiseUndeclaredPrivateName(name, pos); + } + } + } + + declarePrivateName( + name: string, + elementType: ClassElementTypes, + pos: number, + ) { + const classScope = this.current(); + let redefined = classScope.privateNames.has(name); + + if (elementType & CLASS_ELEMENT_KIND_ACCESSOR) { + const accessor = redefined && classScope.loneAccessors.get(name); + if (accessor) { + const oldStatic = accessor & CLASS_ELEMENT_FLAG_STATIC; + const newStatic = elementType & CLASS_ELEMENT_FLAG_STATIC; + + const oldKind = accessor & CLASS_ELEMENT_KIND_ACCESSOR; + const newKind = elementType & CLASS_ELEMENT_KIND_ACCESSOR; + + // The private name can be duplicated only if it is used by + // two accessors with different kind (get and set), and if + // they have the same placement (static or not). + redefined = oldKind === newKind || oldStatic !== newStatic; + + if (!redefined) classScope.loneAccessors.delete(name); + } else if (!redefined) { + classScope.loneAccessors.set(name, elementType); + } + } + + if (redefined) { + this.raise(pos, `Duplicate private name #${name}`); + } + + classScope.privateNames.add(name); + classScope.undefinedPrivateNames.delete(name); + } + + usePrivateName(name: string, pos: number) { + let classScope; + for (classScope of this.stack) { + if (classScope.privateNames.has(name)) return; + } + + if (classScope) { + classScope.undefinedPrivateNames.set(name, pos); + } else { + // top-level + this.raiseUndeclaredPrivateName(name, pos); + } + } + + raiseUndeclaredPrivateName(name: string, pos: number) { + this.raise(pos, `Private name #${name} is not defined`); + } +} diff --git a/packages/babel-parser/src/util/identifier.js b/packages/babel-parser/src/util/identifier.js index 7fda0e27de71..cbcc59cb6f81 100644 --- a/packages/babel-parser/src/util/identifier.js +++ b/packages/babel-parser/src/util/identifier.js @@ -21,9 +21,7 @@ const reservedWords = { }; const reservedWordsStrictSet = new Set(reservedWords.strict); -const reservedWordsStrictBindSet = new Set( - reservedWords.strict.concat(reservedWords.strictBind), -); +const reservedWordsStrictBindSet = new Set(reservedWords.strictBind); /** * Checks if word is a reserved word in non-strict mode @@ -41,6 +39,14 @@ export function isStrictReservedWord(word: string, inModule: boolean): boolean { return isReservedWord(word, inModule) || reservedWordsStrictSet.has(word); } +/** + * Checks if word is a reserved word in binding strict mode, but it is allowed as + * a normal identifier. + */ +export function isStrictBindOnlyReservedWord(word: string): boolean { + return reservedWordsStrictBindSet.has(word); +} + /** * Checks if word is a reserved word in binding strict mode * @@ -50,7 +56,9 @@ export function isStrictBindReservedWord( word: string, inModule: boolean, ): boolean { - return isReservedWord(word, inModule) || reservedWordsStrictBindSet.has(word); + return ( + isStrictReservedWord(word, inModule) || isStrictBindOnlyReservedWord(word) + ); } export function isKeyword(word: string): boolean { diff --git a/packages/babel-parser/src/util/scope.js b/packages/babel-parser/src/util/scope.js index e40cb53e3e33..1cbf06fb671f 100644 --- a/packages/babel-parser/src/util/scope.js +++ b/packages/babel-parser/src/util/scope.js @@ -43,6 +43,7 @@ export default class ScopeHandler { raise: raiseFunction; inModule: boolean; undefinedExports: Map = new Map(); + undefinedPrivateNames: Map = new Map(); constructor(raise: raiseFunction, inModule: boolean) { this.raise = raise; @@ -55,8 +56,21 @@ export default class ScopeHandler { get inGenerator() { return (this.currentVarScope().flags & SCOPE_GENERATOR) > 0; } + // the following loop always exit because SCOPE_PROGRAM is SCOPE_VAR + // $FlowIgnore get inAsync() { - return (this.currentVarScope().flags & SCOPE_ASYNC) > 0; + for (let i = this.scopeStack.length - 1; ; i--) { + const scope = this.scopeStack[i]; + const isVarScope = scope.flags & SCOPE_VAR; + const isClassScope = scope.flags & SCOPE_CLASS; + if (isClassScope && !isVarScope) { + // If it meets a class scope before a var scope, it means it is a class property initializer + // which does not have an [Await] parameter in its grammar + return false; + } else if (isVarScope) { + return (scope.flags & SCOPE_ASYNC) > 0; + } + } } get allowSuper() { return (this.currentThisScope().flags & SCOPE_SUPER) > 0; @@ -64,6 +78,9 @@ export default class ScopeHandler { get allowDirectSuper() { return (this.currentThisScope().flags & SCOPE_DIRECT_SUPER) > 0; } + get inClass() { + return (this.currentThisScope().flags & SCOPE_CLASS) > 0; + } get inNonArrowFunction() { return (this.currentThisScope().flags & SCOPE_FUNCTION) > 0; } @@ -199,7 +216,7 @@ export default class ScopeHandler { } } - // Could be useful for `this`, `new.target`, `super()`, `super.property`, and `super[property]`. + // Could be useful for `arguments`, `this`, `new.target`, `super()`, `super.property`, and `super[property]`. // $FlowIgnore currentThisScope(): IScope { for (let i = this.scopeStack.length - 1; ; i--) { diff --git a/packages/babel-parser/src/util/scopeflags.js b/packages/babel-parser/src/util/scopeflags.js index 8c9697b3a416..e49359cf615c 100644 --- a/packages/babel-parser/src/util/scopeflags.js +++ b/packages/babel-parser/src/util/scopeflags.js @@ -2,17 +2,18 @@ // Each scope gets a bitset that may contain these flags // prettier-ignore -export const SCOPE_OTHER = 0b000000000, - SCOPE_PROGRAM = 0b000000001, - SCOPE_FUNCTION = 0b000000010, - SCOPE_ASYNC = 0b000000100, - SCOPE_GENERATOR = 0b000001000, - SCOPE_ARROW = 0b000010000, - SCOPE_SIMPLE_CATCH = 0b000100000, - SCOPE_SUPER = 0b001000000, - SCOPE_DIRECT_SUPER = 0b010000000, - SCOPE_CLASS = 0b100000000, - SCOPE_VAR = SCOPE_PROGRAM | SCOPE_FUNCTION; +export const SCOPE_OTHER = 0b0000000000, + SCOPE_PROGRAM = 0b0000000001, + SCOPE_FUNCTION = 0b0000000010, + SCOPE_ASYNC = 0b0000000100, + SCOPE_GENERATOR = 0b0000001000, + SCOPE_ARROW = 0b0000010000, + SCOPE_SIMPLE_CATCH = 0b0000100000, + SCOPE_SUPER = 0b0001000000, + SCOPE_DIRECT_SUPER = 0b0010000000, + SCOPE_CLASS = 0b0100000000, + SCOPE_TS_MODULE = 0b1000000000, + SCOPE_VAR = SCOPE_PROGRAM | SCOPE_FUNCTION | SCOPE_TS_MODULE; export type ScopeFlags = | typeof SCOPE_OTHER @@ -62,14 +63,14 @@ export const BIND_CLASS = BIND_KIND_VALUE | BIND_KIND_TYPE | BIND_SCOPE_ BIND_TS_INTERFACE = 0 | BIND_KIND_TYPE | 0 | BIND_FLAGS_CLASS , BIND_TS_TYPE = 0 | BIND_KIND_TYPE | 0 | 0 , BIND_TS_ENUM = BIND_KIND_VALUE | BIND_KIND_TYPE | BIND_SCOPE_LEXICAL | BIND_FLAGS_TS_ENUM, - BIND_TS_FN_TYPE = 0 | 0 | 0 | BIND_FLAGS_TS_EXPORT_ONLY, + BIND_TS_AMBIENT = 0 | 0 | 0 | BIND_FLAGS_TS_EXPORT_ONLY, // These bindings don't introduce anything in the scope. They are used for assignments and // function expressions IDs. BIND_NONE = 0 | 0 | 0 | BIND_FLAGS_NONE , BIND_OUTSIDE = BIND_KIND_VALUE | 0 | 0 | BIND_FLAGS_NONE , BIND_TS_CONST_ENUM = BIND_TS_ENUM | BIND_FLAGS_TS_CONST_ENUM, - BIND_TS_NAMESPACE = BIND_TS_FN_TYPE; + BIND_TS_NAMESPACE = 0 | 0 | 0 | BIND_FLAGS_TS_EXPORT_ONLY; export type BindingTypes = | typeof BIND_NONE @@ -81,5 +82,25 @@ export type BindingTypes = | typeof BIND_TS_INTERFACE | typeof BIND_TS_TYPE | typeof BIND_TS_ENUM - | typeof BIND_TS_FN_TYPE + | typeof BIND_TS_AMBIENT | typeof BIND_TS_NAMESPACE; + +// prettier-ignore +export const CLASS_ELEMENT_FLAG_STATIC = 0b1_00, + CLASS_ELEMENT_KIND_GETTER = 0b0_10, + CLASS_ELEMENT_KIND_SETTER = 0b0_01, + CLASS_ELEMENT_KIND_ACCESSOR = CLASS_ELEMENT_KIND_GETTER | CLASS_ELEMENT_KIND_SETTER; + +// prettier-ignore +export const CLASS_ELEMENT_STATIC_GETTER = CLASS_ELEMENT_KIND_GETTER | CLASS_ELEMENT_FLAG_STATIC, + CLASS_ELEMENT_STATIC_SETTER = CLASS_ELEMENT_KIND_SETTER | CLASS_ELEMENT_FLAG_STATIC, + CLASS_ELEMENT_INSTANCE_GETTER = CLASS_ELEMENT_KIND_GETTER, + CLASS_ELEMENT_INSTANCE_SETTER = CLASS_ELEMENT_KIND_SETTER, + CLASS_ELEMENT_OTHER = 0; + +export type ClassElementTypes = + | typeof CLASS_ELEMENT_STATIC_GETTER + | typeof CLASS_ELEMENT_STATIC_SETTER + | typeof CLASS_ELEMENT_INSTANCE_GETTER + | typeof CLASS_ELEMENT_INSTANCE_SETTER + | typeof CLASS_ELEMENT_OTHER; diff --git a/packages/babel-parser/test/expressions/is-expression-babel-parser/fail/7/options.json b/packages/babel-parser/test/expressions/is-expression-babel-parser/fail/7/options.json deleted file mode 100644 index 12b18792fcc4..000000000000 --- a/packages/babel-parser/test/expressions/is-expression-babel-parser/fail/7/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Illegal 'use strict' directive in function with non-simple parameter list (1:0)" -} diff --git a/packages/babel-parser/test/expressions/is-expression-babel-parser/fail/7/output.json b/packages/babel-parser/test/expressions/is-expression-babel-parser/fail/7/output.json new file mode 100644 index 000000000000..bed17cab3909 --- /dev/null +++ b/packages/babel-parser/test/expressions/is-expression-babel-parser/fail/7/output.json @@ -0,0 +1,128 @@ +{ + "type": "FunctionExpression", + "start": 0, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 40 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "AssignmentPattern", + "start": 10, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "left": { + "type": "Identifier", + "start": 10, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + }, + "identifierName": "a" + }, + "name": "a" + }, + "right": { + "type": "StringLiteral", + "start": 14, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "extra": { + "rawValue": "default", + "raw": "\"default\"" + }, + "value": "default" + } + } + ], + "body": { + "type": "BlockStatement", + "start": 25, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 40 + } + }, + "body": [], + "directives": [ + { + "type": "Directive", + "start": 26, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 26, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 38 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + }, + "errors": [ + "SyntaxError: Illegal 'use strict' directive in function with non-simple parameter list (1:0)" + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/expressions/is-expression-babel-parser/fail/8/options.json b/packages/babel-parser/test/expressions/is-expression-babel-parser/fail/8/options.json index 5f24fc4399ed..4f434cf0aa86 100644 --- a/packages/babel-parser/test/expressions/is-expression-babel-parser/fail/8/options.json +++ b/packages/babel-parser/test/expressions/is-expression-babel-parser/fail/8/options.json @@ -1,4 +1,3 @@ { - "strictMode": true, - "throws": "Unexpected reserved word 'public' (2:0)" -} + "strictMode": true +} \ No newline at end of file diff --git a/packages/babel-parser/test/expressions/is-expression-babel-parser/fail/8/output.json b/packages/babel-parser/test/expressions/is-expression-babel-parser/fail/8/output.json new file mode 100644 index 000000000000..df12702dd8b4 --- /dev/null +++ b/packages/babel-parser/test/expressions/is-expression-babel-parser/fail/8/output.json @@ -0,0 +1,20 @@ +{ + "type": "Identifier", + "start": 1, + "end": 7, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 6 + }, + "identifierName": "public" + }, + "name": "public", + "errors": [ + "SyntaxError: Unexpected reserved word 'public' (2:0)" + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/comments/basic/array-expression-trailing-comma/input.js b/packages/babel-parser/test/fixtures/comments/basic/array-expression-trailing-comma/input.js new file mode 100644 index 000000000000..bc0802b8addd --- /dev/null +++ b/packages/babel-parser/test/fixtures/comments/basic/array-expression-trailing-comma/input.js @@ -0,0 +1,18 @@ +const nonTrailing = [ + "One", // One + // Two + "Two" // Three + // Four +] + +const trailingAfterComma = [ + "One", // One + // Two + "Two", // Three + // Four +] + +const trailingAfterArray = [ + "One", // One + // Two +] // Three diff --git a/packages/babel-parser/test/fixtures/comments/basic/array-expression-trailing-comma/output.json b/packages/babel-parser/test/fixtures/comments/basic/array-expression-trailing-comma/output.json new file mode 100644 index 000000000000..a1a531180079 --- /dev/null +++ b/packages/babel-parser/test/fixtures/comments/basic/array-expression-trailing-comma/output.json @@ -0,0 +1,708 @@ +{ + "type": "File", + "start": 0, + "end": 229, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 18, + "column": 10 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 229, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 18, + "column": 10 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 0, + "end": 76, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 6, + "column": 1 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 6, + "end": 76, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 6, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 17 + }, + "identifierName": "nonTrailing" + }, + "name": "nonTrailing" + }, + "init": { + "type": "ArrayExpression", + "start": 20, + "end": 76, + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 6, + "column": 1 + } + }, + "elements": [ + { + "type": "StringLiteral", + "start": 24, + "end": 29, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 7 + } + }, + "extra": { + "rawValue": "One", + "raw": "\"One\"" + }, + "value": "One" + }, + { + "type": "StringLiteral", + "start": 50, + "end": 55, + "loc": { + "start": { + "line": 4, + "column": 2 + }, + "end": { + "line": 4, + "column": 7 + } + }, + "extra": { + "rawValue": "Two", + "raw": "\"Two\"" + }, + "value": "Two", + "leadingComments": [ + { + "type": "CommentLine", + "value": " One", + "start": 31, + "end": 37, + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 15 + } + } + }, + { + "type": "CommentLine", + "value": " Two", + "start": 41, + "end": 47, + "loc": { + "start": { + "line": 3, + "column": 3 + }, + "end": { + "line": 3, + "column": 9 + } + } + } + ], + "trailingComments": [ + { + "type": "CommentLine", + "value": " Three", + "start": 56, + "end": 64, + "loc": { + "start": { + "line": 4, + "column": 8 + }, + "end": { + "line": 4, + "column": 16 + } + } + }, + { + "type": "CommentLine", + "value": " Four", + "start": 67, + "end": 74, + "loc": { + "start": { + "line": 5, + "column": 2 + }, + "end": { + "line": 5, + "column": 9 + } + } + } + ] + } + ] + } + } + ], + "kind": "const" + }, + { + "type": "VariableDeclaration", + "start": 78, + "end": 162, + "loc": { + "start": { + "line": 8, + "column": 0 + }, + "end": { + "line": 13, + "column": 1 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 84, + "end": 162, + "loc": { + "start": { + "line": 8, + "column": 6 + }, + "end": { + "line": 13, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 84, + "end": 102, + "loc": { + "start": { + "line": 8, + "column": 6 + }, + "end": { + "line": 8, + "column": 24 + }, + "identifierName": "trailingAfterComma" + }, + "name": "trailingAfterComma" + }, + "init": { + "type": "ArrayExpression", + "start": 105, + "end": 162, + "loc": { + "start": { + "line": 8, + "column": 27 + }, + "end": { + "line": 13, + "column": 1 + } + }, + "elements": [ + { + "type": "StringLiteral", + "start": 109, + "end": 114, + "loc": { + "start": { + "line": 9, + "column": 2 + }, + "end": { + "line": 9, + "column": 7 + } + }, + "extra": { + "rawValue": "One", + "raw": "\"One\"" + }, + "value": "One" + }, + { + "type": "StringLiteral", + "start": 135, + "end": 140, + "loc": { + "start": { + "line": 11, + "column": 2 + }, + "end": { + "line": 11, + "column": 7 + } + }, + "extra": { + "rawValue": "Two", + "raw": "\"Two\"" + }, + "value": "Two", + "leadingComments": [ + { + "type": "CommentLine", + "value": " One", + "start": 116, + "end": 122, + "loc": { + "start": { + "line": 9, + "column": 9 + }, + "end": { + "line": 9, + "column": 15 + } + } + }, + { + "type": "CommentLine", + "value": " Two", + "start": 126, + "end": 132, + "loc": { + "start": { + "line": 10, + "column": 3 + }, + "end": { + "line": 10, + "column": 9 + } + } + } + ], + "trailingComments": [ + { + "type": "CommentLine", + "value": " Three", + "start": 142, + "end": 150, + "loc": { + "start": { + "line": 11, + "column": 9 + }, + "end": { + "line": 11, + "column": 17 + } + } + }, + { + "type": "CommentLine", + "value": " Four", + "start": 153, + "end": 160, + "loc": { + "start": { + "line": 12, + "column": 2 + }, + "end": { + "line": 12, + "column": 9 + } + } + } + ] + } + ], + "extra": { + "trailingComma": 140 + } + } + } + ], + "kind": "const" + }, + { + "type": "VariableDeclaration", + "start": 164, + "end": 220, + "loc": { + "start": { + "line": 15, + "column": 0 + }, + "end": { + "line": 18, + "column": 1 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 170, + "end": 220, + "loc": { + "start": { + "line": 15, + "column": 6 + }, + "end": { + "line": 18, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 170, + "end": 188, + "loc": { + "start": { + "line": 15, + "column": 6 + }, + "end": { + "line": 15, + "column": 24 + }, + "identifierName": "trailingAfterArray" + }, + "name": "trailingAfterArray" + }, + "init": { + "type": "ArrayExpression", + "start": 191, + "end": 220, + "loc": { + "start": { + "line": 15, + "column": 27 + }, + "end": { + "line": 18, + "column": 1 + } + }, + "elements": [ + { + "type": "StringLiteral", + "start": 195, + "end": 200, + "loc": { + "start": { + "line": 16, + "column": 2 + }, + "end": { + "line": 16, + "column": 7 + } + }, + "extra": { + "rawValue": "One", + "raw": "\"One\"" + }, + "value": "One", + "trailingComments": [ + { + "type": "CommentLine", + "value": " One", + "start": 202, + "end": 208, + "loc": { + "start": { + "line": 16, + "column": 9 + }, + "end": { + "line": 16, + "column": 15 + } + } + }, + { + "type": "CommentLine", + "value": " Two", + "start": 212, + "end": 218, + "loc": { + "start": { + "line": 17, + "column": 3 + }, + "end": { + "line": 17, + "column": 9 + } + } + } + ] + } + ], + "extra": { + "trailingComma": 200 + } + } + } + ], + "kind": "const", + "trailingComments": [ + { + "type": "CommentLine", + "value": " Three", + "start": 221, + "end": 229, + "loc": { + "start": { + "line": 18, + "column": 2 + }, + "end": { + "line": 18, + "column": 10 + } + } + } + ] + } + ], + "directives": [] + }, + "comments": [ + { + "type": "CommentLine", + "value": " One", + "start": 31, + "end": 37, + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 15 + } + } + }, + { + "type": "CommentLine", + "value": " Two", + "start": 41, + "end": 47, + "loc": { + "start": { + "line": 3, + "column": 3 + }, + "end": { + "line": 3, + "column": 9 + } + } + }, + { + "type": "CommentLine", + "value": " Three", + "start": 56, + "end": 64, + "loc": { + "start": { + "line": 4, + "column": 8 + }, + "end": { + "line": 4, + "column": 16 + } + } + }, + { + "type": "CommentLine", + "value": " Four", + "start": 67, + "end": 74, + "loc": { + "start": { + "line": 5, + "column": 2 + }, + "end": { + "line": 5, + "column": 9 + } + } + }, + { + "type": "CommentLine", + "value": " One", + "start": 116, + "end": 122, + "loc": { + "start": { + "line": 9, + "column": 9 + }, + "end": { + "line": 9, + "column": 15 + } + } + }, + { + "type": "CommentLine", + "value": " Two", + "start": 126, + "end": 132, + "loc": { + "start": { + "line": 10, + "column": 3 + }, + "end": { + "line": 10, + "column": 9 + } + } + }, + { + "type": "CommentLine", + "value": " Three", + "start": 142, + "end": 150, + "loc": { + "start": { + "line": 11, + "column": 9 + }, + "end": { + "line": 11, + "column": 17 + } + } + }, + { + "type": "CommentLine", + "value": " Four", + "start": 153, + "end": 160, + "loc": { + "start": { + "line": 12, + "column": 2 + }, + "end": { + "line": 12, + "column": 9 + } + } + }, + { + "type": "CommentLine", + "value": " One", + "start": 202, + "end": 208, + "loc": { + "start": { + "line": 16, + "column": 9 + }, + "end": { + "line": 16, + "column": 15 + } + } + }, + { + "type": "CommentLine", + "value": " Two", + "start": 212, + "end": 218, + "loc": { + "start": { + "line": 17, + "column": 3 + }, + "end": { + "line": 17, + "column": 9 + } + } + }, + { + "type": "CommentLine", + "value": " Three", + "start": 221, + "end": 229, + "loc": { + "start": { + "line": 18, + "column": 2 + }, + "end": { + "line": 18, + "column": 10 + } + } + } + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/comments/basic/array-pattern-trailing-comma/input.js b/packages/babel-parser/test/fixtures/comments/basic/array-pattern-trailing-comma/input.js new file mode 100644 index 000000000000..3d234bad027c --- /dev/null +++ b/packages/babel-parser/test/fixtures/comments/basic/array-pattern-trailing-comma/input.js @@ -0,0 +1,6 @@ +const [ + /* One */ + x + /* Two */, + /* Three */ +] /* Four */ = []; diff --git a/packages/babel-parser/test/fixtures/comments/basic/array-pattern-trailing-comma/output.json b/packages/babel-parser/test/fixtures/comments/basic/array-pattern-trailing-comma/output.json new file mode 100644 index 000000000000..124041c4bb99 --- /dev/null +++ b/packages/babel-parser/test/fixtures/comments/basic/array-pattern-trailing-comma/output.json @@ -0,0 +1,254 @@ +{ + "type": "File", + "start": 0, + "end": 69, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 6, + "column": 18 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 69, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 6, + "column": 18 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 0, + "end": 69, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 6, + "column": 18 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 6, + "end": 68, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 6, + "column": 17 + } + }, + "id": { + "type": "ArrayPattern", + "start": 6, + "end": 52, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 6, + "column": 1 + } + }, + "elements": [ + { + "type": "Identifier", + "start": 22, + "end": 23, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 3 + }, + "identifierName": "x" + }, + "name": "x", + "leadingComments": [ + { + "type": "CommentBlock", + "value": " One ", + "start": 10, + "end": 19, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 11 + } + } + } + ], + "trailingComments": [ + { + "type": "CommentBlock", + "value": " Two ", + "start": 26, + "end": 35, + "loc": { + "start": { + "line": 4, + "column": 2 + }, + "end": { + "line": 4, + "column": 11 + } + } + }, + { + "type": "CommentBlock", + "value": " Three ", + "start": 39, + "end": 50, + "loc": { + "start": { + "line": 5, + "column": 2 + }, + "end": { + "line": 5, + "column": 13 + } + } + } + ] + } + ], + "trailingComments": [ + { + "type": "CommentBlock", + "value": " Four ", + "start": 53, + "end": 63, + "loc": { + "start": { + "line": 6, + "column": 2 + }, + "end": { + "line": 6, + "column": 12 + } + } + } + ] + }, + "init": { + "type": "ArrayExpression", + "start": 66, + "end": 68, + "loc": { + "start": { + "line": 6, + "column": 15 + }, + "end": { + "line": 6, + "column": 17 + } + }, + "elements": [] + } + } + ], + "kind": "const" + } + ], + "directives": [] + }, + "comments": [ + { + "type": "CommentBlock", + "value": " One ", + "start": 10, + "end": 19, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 11 + } + } + }, + { + "type": "CommentBlock", + "value": " Two ", + "start": 26, + "end": 35, + "loc": { + "start": { + "line": 4, + "column": 2 + }, + "end": { + "line": 4, + "column": 11 + } + } + }, + { + "type": "CommentBlock", + "value": " Three ", + "start": 39, + "end": 50, + "loc": { + "start": { + "line": 5, + "column": 2 + }, + "end": { + "line": 5, + "column": 13 + } + } + }, + { + "type": "CommentBlock", + "value": " Four ", + "start": 53, + "end": 63, + "loc": { + "start": { + "line": 6, + "column": 2 + }, + "end": { + "line": 6, + "column": 12 + } + } + } + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/comments/basic/function-trailing-comma-shorthand/input.js b/packages/babel-parser/test/fixtures/comments/basic/function-trailing-comma-shorthand/input.js index 0936c59b4e55..cbeebe5ee3b6 100644 --- a/packages/babel-parser/test/fixtures/comments/basic/function-trailing-comma-shorthand/input.js +++ b/packages/babel-parser/test/fixtures/comments/basic/function-trailing-comma-shorthand/input.js @@ -1 +1 @@ -fn(a, { b }, /* comment */); +fn(a, { b }, /* comment 1 */) /* comment 2 */; diff --git a/packages/babel-parser/test/fixtures/comments/basic/function-trailing-comma-shorthand/output.json b/packages/babel-parser/test/fixtures/comments/basic/function-trailing-comma-shorthand/output.json index ecc67f22abd0..b27cadb955a0 100644 --- a/packages/babel-parser/test/fixtures/comments/basic/function-trailing-comma-shorthand/output.json +++ b/packages/babel-parser/test/fixtures/comments/basic/function-trailing-comma-shorthand/output.json @@ -1,7 +1,7 @@ { "type": "File", "start": 0, - "end": 28, + "end": 46, "loc": { "start": { "line": 1, @@ -9,13 +9,13 @@ }, "end": { "line": 1, - "column": 28 + "column": 46 } }, "program": { "type": "Program", "start": 0, - "end": 28, + "end": 46, "loc": { "start": { "line": 1, @@ -23,7 +23,7 @@ }, "end": { "line": 1, - "column": 28 + "column": 46 } }, "sourceType": "script", @@ -32,7 +32,7 @@ { "type": "ExpressionStatement", "start": 0, - "end": 28, + "end": 46, "loc": { "start": { "line": 1, @@ -40,13 +40,13 @@ }, "end": { "line": 1, - "column": 28 + "column": 46 } }, "expression": { "type": "CallExpression", "start": 0, - "end": 27, + "end": 29, "loc": { "start": { "line": 1, @@ -54,7 +54,7 @@ }, "end": { "line": 1, - "column": 27 + "column": 29 } }, "callee": { @@ -74,6 +74,9 @@ }, "name": "fn" }, + "extra": { + "trailingComma": 11 + }, "arguments": [ { "type": "Identifier", @@ -166,9 +169,9 @@ "trailingComments": [ { "type": "CommentBlock", - "value": " comment ", + "value": " comment 1 ", "start": 13, - "end": 26, + "end": 28, "loc": { "start": { "line": 1, @@ -176,12 +179,30 @@ }, "end": { "line": 1, - "column": 26 + "column": 28 } } } ] } + ], + "trailingComments": [ + { + "type": "CommentBlock", + "value": " comment 2 ", + "start": 30, + "end": 45, + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 45 + } + } + } ] } } @@ -191,9 +212,9 @@ "comments": [ { "type": "CommentBlock", - "value": " comment ", + "value": " comment 1 ", "start": 13, - "end": 26, + "end": 28, "loc": { "start": { "line": 1, @@ -201,7 +222,23 @@ }, "end": { "line": 1, - "column": 26 + "column": 28 + } + } + }, + { + "type": "CommentBlock", + "value": " comment 2 ", + "start": 30, + "end": 45, + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 45 } } } diff --git a/packages/babel-parser/test/fixtures/comments/basic/function-trailing-comma/input.js b/packages/babel-parser/test/fixtures/comments/basic/function-trailing-comma/input.js index d8611dab0c54..ebebb26100af 100644 --- a/packages/babel-parser/test/fixtures/comments/basic/function-trailing-comma/input.js +++ b/packages/babel-parser/test/fixtures/comments/basic/function-trailing-comma/input.js @@ -1 +1 @@ -fn(a, b, /* comment */); +fn(a, b, /* comment 1 */) /* comment 2*/; diff --git a/packages/babel-parser/test/fixtures/comments/basic/function-trailing-comma/output.json b/packages/babel-parser/test/fixtures/comments/basic/function-trailing-comma/output.json index 756beb301cf3..a224e1810b5d 100644 --- a/packages/babel-parser/test/fixtures/comments/basic/function-trailing-comma/output.json +++ b/packages/babel-parser/test/fixtures/comments/basic/function-trailing-comma/output.json @@ -1,7 +1,7 @@ { "type": "File", "start": 0, - "end": 24, + "end": 41, "loc": { "start": { "line": 1, @@ -9,13 +9,13 @@ }, "end": { "line": 1, - "column": 24 + "column": 41 } }, "program": { "type": "Program", "start": 0, - "end": 24, + "end": 41, "loc": { "start": { "line": 1, @@ -23,7 +23,7 @@ }, "end": { "line": 1, - "column": 24 + "column": 41 } }, "sourceType": "script", @@ -32,7 +32,7 @@ { "type": "ExpressionStatement", "start": 0, - "end": 24, + "end": 41, "loc": { "start": { "line": 1, @@ -40,13 +40,13 @@ }, "end": { "line": 1, - "column": 24 + "column": 41 } }, "expression": { "type": "CallExpression", "start": 0, - "end": 23, + "end": 25, "loc": { "start": { "line": 1, @@ -54,7 +54,7 @@ }, "end": { "line": 1, - "column": 23 + "column": 25 } }, "callee": { @@ -74,6 +74,9 @@ }, "name": "fn" }, + "extra": { + "trailingComma": 7 + }, "arguments": [ { "type": "Identifier", @@ -111,9 +114,9 @@ "trailingComments": [ { "type": "CommentBlock", - "value": " comment ", + "value": " comment 1 ", "start": 9, - "end": 22, + "end": 24, "loc": { "start": { "line": 1, @@ -121,12 +124,30 @@ }, "end": { "line": 1, - "column": 22 + "column": 24 } } } ] } + ], + "trailingComments": [ + { + "type": "CommentBlock", + "value": " comment 2", + "start": 26, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 40 + } + } + } ] } } @@ -136,9 +157,9 @@ "comments": [ { "type": "CommentBlock", - "value": " comment ", + "value": " comment 1 ", "start": 9, - "end": 22, + "end": 24, "loc": { "start": { "line": 1, @@ -146,7 +167,23 @@ }, "end": { "line": 1, - "column": 22 + "column": 24 + } + } + }, + { + "type": "CommentBlock", + "value": " comment 2", + "start": 26, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 40 } } } diff --git a/packages/babel-parser/test/fixtures/comments/basic/object-expression-trailing-comma/input.js b/packages/babel-parser/test/fixtures/comments/basic/object-expression-trailing-comma/input.js new file mode 100644 index 000000000000..78f80a9968e5 --- /dev/null +++ b/packages/babel-parser/test/fixtures/comments/basic/object-expression-trailing-comma/input.js @@ -0,0 +1,6 @@ +const { + /* One */ + x + /* Two */, + /* Three */ +} /* Four */ = {}; \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/comments/basic/object-expression-trailing-comma/output.json b/packages/babel-parser/test/fixtures/comments/basic/object-expression-trailing-comma/output.json new file mode 100644 index 000000000000..8cf9693cb683 --- /dev/null +++ b/packages/babel-parser/test/fixtures/comments/basic/object-expression-trailing-comma/output.json @@ -0,0 +1,295 @@ +{ + "type": "File", + "start": 0, + "end": 69, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 6, + "column": 18 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 69, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 6, + "column": 18 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 0, + "end": 69, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 6, + "column": 18 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 6, + "end": 68, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 6, + "column": 17 + } + }, + "id": { + "type": "ObjectPattern", + "start": 6, + "end": 52, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 6, + "column": 1 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 22, + "end": 23, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 3 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 22, + "end": 23, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 3 + }, + "identifierName": "x" + }, + "name": "x" + }, + "computed": false, + "shorthand": true, + "value": { + "type": "Identifier", + "start": 22, + "end": 23, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 3 + }, + "identifierName": "x" + }, + "name": "x" + }, + "leadingComments": [ + { + "type": "CommentBlock", + "value": " One ", + "start": 10, + "end": 19, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 11 + } + } + } + ], + "trailingComments": [ + { + "type": "CommentBlock", + "value": " Two ", + "start": 26, + "end": 35, + "loc": { + "start": { + "line": 4, + "column": 2 + }, + "end": { + "line": 4, + "column": 11 + } + } + }, + { + "type": "CommentBlock", + "value": " Three ", + "start": 39, + "end": 50, + "loc": { + "start": { + "line": 5, + "column": 2 + }, + "end": { + "line": 5, + "column": 13 + } + } + } + ], + "extra": { + "shorthand": true + } + } + ], + "extra": { + "trailingComma": 35 + }, + "trailingComments": [ + { + "type": "CommentBlock", + "value": " Four ", + "start": 53, + "end": 63, + "loc": { + "start": { + "line": 6, + "column": 2 + }, + "end": { + "line": 6, + "column": 12 + } + } + } + ] + }, + "init": { + "type": "ObjectExpression", + "start": 66, + "end": 68, + "loc": { + "start": { + "line": 6, + "column": 15 + }, + "end": { + "line": 6, + "column": 17 + } + }, + "properties": [] + } + } + ], + "kind": "const" + } + ], + "directives": [] + }, + "comments": [ + { + "type": "CommentBlock", + "value": " One ", + "start": 10, + "end": 19, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 11 + } + } + }, + { + "type": "CommentBlock", + "value": " Two ", + "start": 26, + "end": 35, + "loc": { + "start": { + "line": 4, + "column": 2 + }, + "end": { + "line": 4, + "column": 11 + } + } + }, + { + "type": "CommentBlock", + "value": " Three ", + "start": 39, + "end": 50, + "loc": { + "start": { + "line": 5, + "column": 2 + }, + "end": { + "line": 5, + "column": 13 + } + } + }, + { + "type": "CommentBlock", + "value": " Four ", + "start": 53, + "end": 63, + "loc": { + "start": { + "line": 6, + "column": 2 + }, + "end": { + "line": 6, + "column": 12 + } + } + } + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/comments/basic/object-property-trailing-comma/input.js b/packages/babel-parser/test/fixtures/comments/basic/object-property-trailing-comma/input.js index acd5921a7c0e..695835903290 100644 --- a/packages/babel-parser/test/fixtures/comments/basic/object-property-trailing-comma/input.js +++ b/packages/babel-parser/test/fixtures/comments/basic/object-property-trailing-comma/input.js @@ -2,4 +2,4 @@ var obj = { a: '1', // comment 1 b: '2', // comment 2 c: '3', // comment 3 -}; +}; // comment 4 diff --git a/packages/babel-parser/test/fixtures/comments/basic/object-property-trailing-comma/output.json b/packages/babel-parser/test/fixtures/comments/basic/object-property-trailing-comma/output.json index 0004e27a14fd..1ab0eaed8cb3 100644 --- a/packages/babel-parser/test/fixtures/comments/basic/object-property-trailing-comma/output.json +++ b/packages/babel-parser/test/fixtures/comments/basic/object-property-trailing-comma/output.json @@ -1,7 +1,7 @@ { "type": "File", "start": 0, - "end": 83, + "end": 96, "loc": { "start": { "line": 1, @@ -9,13 +9,13 @@ }, "end": { "line": 5, - "column": 2 + "column": 15 } }, "program": { "type": "Program", "start": 0, - "end": 83, + "end": 96, "loc": { "start": { "line": 1, @@ -23,7 +23,7 @@ }, "end": { "line": 5, - "column": 2 + "column": 15 } }, "sourceType": "script", @@ -309,11 +309,32 @@ } ] } - ] + ], + "extra": { + "trailingComma": 66 + } } } ], - "kind": "var" + "kind": "var", + "trailingComments": [ + { + "type": "CommentLine", + "value": " comment 4", + "start": 84, + "end": 96, + "loc": { + "start": { + "line": 5, + "column": 3 + }, + "end": { + "line": 5, + "column": 15 + } + } + } + ] } ], "directives": [] @@ -366,6 +387,22 @@ "column": 22 } } + }, + { + "type": "CommentLine", + "value": " comment 4", + "start": 84, + "end": 96, + "loc": { + "start": { + "line": 5, + "column": 3 + }, + "end": { + "line": 5, + "column": 15 + } + } } ] } \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/comments/regression/10230/input.js b/packages/babel-parser/test/fixtures/comments/regression/10230/input.js new file mode 100644 index 000000000000..131dbd7a00f7 --- /dev/null +++ b/packages/babel-parser/test/fixtures/comments/regression/10230/input.js @@ -0,0 +1,7 @@ +A = { + a: 42, + // One +} + +// Two +B diff --git a/packages/babel-parser/test/fixtures/comments/regression/10230/output.json b/packages/babel-parser/test/fixtures/comments/regression/10230/output.json new file mode 100644 index 000000000000..fac57ee10213 --- /dev/null +++ b/packages/babel-parser/test/fixtures/comments/regression/10230/output.json @@ -0,0 +1,278 @@ +{ + "type": "File", + "start": 0, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 7, + "column": 1 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 7, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 0, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "operator": "=", + "left": { + "type": "Identifier", + "start": 0, + "end": 1, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + }, + "identifierName": "A" + }, + "name": "A" + }, + "right": { + "type": "ObjectExpression", + "start": 4, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 8, + "end": 13, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 7 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 8, + "end": 9, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 3 + }, + "identifierName": "a" + }, + "name": "a" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "NumericLiteral", + "start": 11, + "end": 13, + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 7 + } + }, + "extra": { + "rawValue": 42, + "raw": "42" + }, + "value": 42 + }, + "trailingComments": [ + { + "type": "CommentLine", + "value": " One", + "start": 17, + "end": 23, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 8 + } + } + } + ] + } + ], + "extra": { + "trailingComma": 13 + } + } + }, + "trailingComments": [ + { + "type": "CommentLine", + "value": " Two", + "start": 27, + "end": 33, + "loc": { + "start": { + "line": 6, + "column": 0 + }, + "end": { + "line": 6, + "column": 6 + } + } + } + ] + }, + { + "type": "ExpressionStatement", + "start": 34, + "end": 35, + "loc": { + "start": { + "line": 7, + "column": 0 + }, + "end": { + "line": 7, + "column": 1 + } + }, + "expression": { + "type": "Identifier", + "start": 34, + "end": 35, + "loc": { + "start": { + "line": 7, + "column": 0 + }, + "end": { + "line": 7, + "column": 1 + }, + "identifierName": "B" + }, + "name": "B" + }, + "leadingComments": [ + { + "type": "CommentLine", + "value": " Two", + "start": 27, + "end": 33, + "loc": { + "start": { + "line": 6, + "column": 0 + }, + "end": { + "line": 6, + "column": 6 + } + } + } + ] + } + ], + "directives": [] + }, + "comments": [ + { + "type": "CommentLine", + "value": " One", + "start": 17, + "end": 23, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 8 + } + } + }, + { + "type": "CommentLine", + "value": " Two", + "start": 27, + "end": 33, + "loc": { + "start": { + "line": 6, + "column": 0 + }, + "end": { + "line": 6, + "column": 6 + } + } + } + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/comments/regression/10432/input.js b/packages/babel-parser/test/fixtures/comments/regression/10432/input.js new file mode 100644 index 000000000000..645dc4cde990 --- /dev/null +++ b/packages/babel-parser/test/fixtures/comments/regression/10432/input.js @@ -0,0 +1,5 @@ +const socket = socketClient(address) +/* istanbul ignore next */ +socket.on('connect', function () { + debug('Connected to ' + address) +}) diff --git a/packages/babel-parser/test/fixtures/comments/regression/10432/output.json b/packages/babel-parser/test/fixtures/comments/regression/10432/output.json new file mode 100644 index 000000000000..075deef7bf64 --- /dev/null +++ b/packages/babel-parser/test/fixtures/comments/regression/10432/output.json @@ -0,0 +1,431 @@ +{ + "type": "File", + "start": 0, + "end": 136, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 2 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 136, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 2 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 6, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 12 + }, + "identifierName": "socket" + }, + "name": "socket" + }, + "init": { + "type": "CallExpression", + "start": 15, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "callee": { + "type": "Identifier", + "start": 15, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 27 + }, + "identifierName": "socketClient" + }, + "name": "socketClient" + }, + "arguments": [ + { + "type": "Identifier", + "start": 28, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 35 + }, + "identifierName": "address" + }, + "name": "address" + } + ] + } + } + ], + "kind": "const", + "trailingComments": [ + { + "type": "CommentBlock", + "value": " istanbul ignore next ", + "start": 37, + "end": 63, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 26 + } + } + } + ] + }, + { + "type": "ExpressionStatement", + "start": 64, + "end": 136, + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 5, + "column": 2 + } + }, + "expression": { + "type": "CallExpression", + "start": 64, + "end": 136, + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 5, + "column": 2 + } + }, + "callee": { + "type": "MemberExpression", + "start": 64, + "end": 73, + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 9 + } + }, + "object": { + "type": "Identifier", + "start": 64, + "end": 70, + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 6 + }, + "identifierName": "socket" + }, + "name": "socket" + }, + "property": { + "type": "Identifier", + "start": 71, + "end": 73, + "loc": { + "start": { + "line": 3, + "column": 7 + }, + "end": { + "line": 3, + "column": 9 + }, + "identifierName": "on" + }, + "name": "on" + }, + "computed": false + }, + "arguments": [ + { + "type": "StringLiteral", + "start": 74, + "end": 83, + "loc": { + "start": { + "line": 3, + "column": 10 + }, + "end": { + "line": 3, + "column": 19 + } + }, + "extra": { + "rawValue": "connect", + "raw": "'connect'" + }, + "value": "connect" + }, + { + "type": "FunctionExpression", + "start": 85, + "end": 135, + "loc": { + "start": { + "line": 3, + "column": 21 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 97, + "end": 135, + "loc": { + "start": { + "line": 3, + "column": 33 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 101, + "end": 133, + "loc": { + "start": { + "line": 4, + "column": 2 + }, + "end": { + "line": 4, + "column": 34 + } + }, + "expression": { + "type": "CallExpression", + "start": 101, + "end": 133, + "loc": { + "start": { + "line": 4, + "column": 2 + }, + "end": { + "line": 4, + "column": 34 + } + }, + "callee": { + "type": "Identifier", + "start": 101, + "end": 106, + "loc": { + "start": { + "line": 4, + "column": 2 + }, + "end": { + "line": 4, + "column": 7 + }, + "identifierName": "debug" + }, + "name": "debug" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 107, + "end": 132, + "loc": { + "start": { + "line": 4, + "column": 8 + }, + "end": { + "line": 4, + "column": 33 + } + }, + "left": { + "type": "StringLiteral", + "start": 107, + "end": 122, + "loc": { + "start": { + "line": 4, + "column": 8 + }, + "end": { + "line": 4, + "column": 23 + } + }, + "extra": { + "rawValue": "Connected to ", + "raw": "'Connected to '" + }, + "value": "Connected to " + }, + "operator": "+", + "right": { + "type": "Identifier", + "start": 125, + "end": 132, + "loc": { + "start": { + "line": 4, + "column": 26 + }, + "end": { + "line": 4, + "column": 33 + }, + "identifierName": "address" + }, + "name": "address" + } + } + ] + } + } + ], + "directives": [] + } + } + ] + }, + "leadingComments": [ + { + "type": "CommentBlock", + "value": " istanbul ignore next ", + "start": 37, + "end": 63, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 26 + } + } + } + ] + } + ], + "directives": [] + }, + "comments": [ + { + "type": "CommentBlock", + "value": " istanbul ignore next ", + "start": 37, + "end": 63, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 26 + } + } + } + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/comments/regression/10448/input.js b/packages/babel-parser/test/fixtures/comments/regression/10448/input.js new file mode 100644 index 000000000000..c0bd1ccbc1cc --- /dev/null +++ b/packages/babel-parser/test/fixtures/comments/regression/10448/input.js @@ -0,0 +1,2 @@ +function foo([foo, /* not used */, /* not used */]) { +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/comments/regression/10448/output.json b/packages/babel-parser/test/fixtures/comments/regression/10448/output.json new file mode 100644 index 000000000000..ab6d764cc245 --- /dev/null +++ b/packages/babel-parser/test/fixtures/comments/regression/10448/output.json @@ -0,0 +1,191 @@ +{ + "type": "File", + "start": 0, + "end": 55, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 1 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 55, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 55, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 12 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "ArrayPattern", + "start": 13, + "end": 50, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 50 + } + }, + "elements": [ + { + "type": "Identifier", + "start": 14, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 17 + }, + "identifierName": "foo" + }, + "name": "foo", + "trailingComments": [ + { + "type": "CommentBlock", + "value": " not used ", + "start": 19, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 33 + } + } + }, + { + "type": "CommentBlock", + "value": " not used ", + "start": 35, + "end": 49, + "loc": { + "start": { + "line": 1, + "column": 35 + }, + "end": { + "line": 1, + "column": 49 + } + } + } + ] + }, + null + ] + } + ], + "body": { + "type": "BlockStatement", + "start": 52, + "end": 55, + "loc": { + "start": { + "line": 1, + "column": 52 + }, + "end": { + "line": 2, + "column": 1 + } + }, + "body": [], + "directives": [] + } + } + ], + "directives": [] + }, + "comments": [ + { + "type": "CommentBlock", + "value": " not used ", + "start": 19, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 33 + } + } + }, + { + "type": "CommentBlock", + "value": " not used ", + "start": 35, + "end": 49, + "loc": { + "start": { + "line": 1, + "column": 35 + }, + "end": { + "line": 1, + "column": 49 + } + } + } + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/comments/regression/10892/input.js b/packages/babel-parser/test/fixtures/comments/regression/10892/input.js new file mode 100644 index 000000000000..05a56ffa976c --- /dev/null +++ b/packages/babel-parser/test/fixtures/comments/regression/10892/input.js @@ -0,0 +1,7 @@ +import { foo } from "bar" + +/** + * lost comment + */ +export default { +} diff --git a/packages/babel-parser/test/fixtures/experimental/dynamic-import/parses-module/options.json b/packages/babel-parser/test/fixtures/comments/regression/10892/options.json similarity index 100% rename from packages/babel-parser/test/fixtures/experimental/dynamic-import/parses-module/options.json rename to packages/babel-parser/test/fixtures/comments/regression/10892/options.json diff --git a/packages/babel-parser/test/fixtures/comments/regression/10892/output.json b/packages/babel-parser/test/fixtures/comments/regression/10892/output.json new file mode 100644 index 000000000000..1ca2d06ab94e --- /dev/null +++ b/packages/babel-parser/test/fixtures/comments/regression/10892/output.json @@ -0,0 +1,206 @@ +{ + "type": "File", + "start": 0, + "end": 69, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 7, + "column": 1 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 69, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 7, + "column": 1 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ImportDeclaration", + "start": 0, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "specifiers": [ + { + "type": "ImportSpecifier", + "start": 9, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "imported": { + "type": "Identifier", + "start": 9, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 12 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "local": { + "type": "Identifier", + "start": 9, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 12 + }, + "identifierName": "foo" + }, + "name": "foo" + } + } + ], + "source": { + "type": "StringLiteral", + "start": 20, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "extra": { + "rawValue": "bar", + "raw": "\"bar\"" + }, + "value": "bar" + }, + "trailingComments": [ + { + "type": "CommentBlock", + "value": "*\n * lost comment\n ", + "start": 27, + "end": 50, + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 5, + "column": 3 + } + } + } + ] + }, + { + "type": "ExportDefaultDeclaration", + "start": 51, + "end": 69, + "loc": { + "start": { + "line": 6, + "column": 0 + }, + "end": { + "line": 7, + "column": 1 + } + }, + "declaration": { + "type": "ObjectExpression", + "start": 66, + "end": 69, + "loc": { + "start": { + "line": 6, + "column": 15 + }, + "end": { + "line": 7, + "column": 1 + } + }, + "properties": [] + }, + "leadingComments": [ + { + "type": "CommentBlock", + "value": "*\n * lost comment\n ", + "start": 27, + "end": 50, + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 5, + "column": 3 + } + } + } + ] + } + ], + "directives": [] + }, + "comments": [ + { + "type": "CommentBlock", + "value": "*\n * lost comment\n ", + "start": 27, + "end": 50, + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 5, + "column": 3 + } + } + } + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/categorized/invalid-assignment-pattern-1/input.js b/packages/babel-parser/test/fixtures/core/categorized/invalid-assignment-pattern-1/input.js new file mode 100644 index 000000000000..0a7f8682331a --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/categorized/invalid-assignment-pattern-1/input.js @@ -0,0 +1 @@ +(a = 1) = t \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/categorized/invalid-assignment-pattern-1/options.json b/packages/babel-parser/test/fixtures/core/categorized/invalid-assignment-pattern-1/options.json new file mode 100644 index 000000000000..070d941a7562 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/categorized/invalid-assignment-pattern-1/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["estree"] +} diff --git a/packages/babel-parser/test/fixtures/core/categorized/invalid-assignment-pattern-1/output.json b/packages/babel-parser/test/fixtures/core/categorized/invalid-assignment-pattern-1/output.json new file mode 100644 index 000000000000..064381b180f6 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/categorized/invalid-assignment-pattern-1/output.json @@ -0,0 +1,138 @@ +{ + "type": "File", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "errors": [ + "SyntaxError: Invalid parenthesized assignment pattern (1:1)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "operator": "=", + "left": { + "type": "AssignmentPattern", + "start": 1, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "left": { + "type": "Identifier", + "start": 1, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + }, + "identifierName": "a" + }, + "name": "a" + }, + "right": { + "type": "Literal", + "start": 5, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "value": 1, + "raw": "1" + }, + "extra": { + "parenthesized": true, + "parenStart": 0 + } + }, + "right": { + "type": "Identifier", + "start": 10, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + }, + "identifierName": "t" + }, + "name": "t" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/categorized/invalid-assignment-pattern-2/input.js b/packages/babel-parser/test/fixtures/core/categorized/invalid-assignment-pattern-2/input.js new file mode 100644 index 000000000000..93c05a981b37 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/categorized/invalid-assignment-pattern-2/input.js @@ -0,0 +1 @@ +[(a = 1)] = t \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/categorized/invalid-assignment-pattern-2/options.json b/packages/babel-parser/test/fixtures/core/categorized/invalid-assignment-pattern-2/options.json new file mode 100644 index 000000000000..070d941a7562 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/categorized/invalid-assignment-pattern-2/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["estree"] +} diff --git a/packages/babel-parser/test/fixtures/core/categorized/invalid-assignment-pattern-2/output.json b/packages/babel-parser/test/fixtures/core/categorized/invalid-assignment-pattern-2/output.json new file mode 100644 index 000000000000..f606fc8063af --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/categorized/invalid-assignment-pattern-2/output.json @@ -0,0 +1,155 @@ +{ + "type": "File", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "errors": [ + "SyntaxError: Invalid parenthesized assignment pattern (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "operator": "=", + "left": { + "type": "ArrayPattern", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "elements": [ + { + "type": "AssignmentPattern", + "start": 2, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "left": { + "type": "Identifier", + "start": 2, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + }, + "identifierName": "a" + }, + "name": "a" + }, + "right": { + "type": "Literal", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "value": 1, + "raw": "1" + }, + "extra": { + "parenthesized": true, + "parenStart": 1 + } + } + ] + }, + "right": { + "type": "Identifier", + "start": 12, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + }, + "identifierName": "t" + }, + "name": "t" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/categorized/invalid-assignment-pattern-3/input.js b/packages/babel-parser/test/fixtures/core/categorized/invalid-assignment-pattern-3/input.js new file mode 100644 index 000000000000..18b5e0796da0 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/categorized/invalid-assignment-pattern-3/input.js @@ -0,0 +1 @@ +[({ a: [b = 2]})] = t \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/categorized/invalid-assignment-pattern-3/options.json b/packages/babel-parser/test/fixtures/core/categorized/invalid-assignment-pattern-3/options.json new file mode 100644 index 000000000000..070d941a7562 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/categorized/invalid-assignment-pattern-3/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["estree"] +} diff --git a/packages/babel-parser/test/fixtures/core/categorized/invalid-assignment-pattern-3/output.json b/packages/babel-parser/test/fixtures/core/categorized/invalid-assignment-pattern-3/output.json new file mode 100644 index 000000000000..dc0122606f36 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/categorized/invalid-assignment-pattern-3/output.json @@ -0,0 +1,225 @@ +{ + "type": "File", + "start": 0, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "errors": [ + "SyntaxError: Invalid parenthesized assignment pattern (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 0, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "operator": "=", + "left": { + "type": "ArrayPattern", + "start": 0, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "elements": [ + { + "type": "ObjectPattern", + "start": 2, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "properties": [ + { + "type": "Property", + "start": 4, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 4, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + }, + "identifierName": "a" + }, + "name": "a" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "ArrayPattern", + "start": 7, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "elements": [ + { + "type": "AssignmentPattern", + "start": 8, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "left": { + "type": "Identifier", + "start": 8, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + }, + "identifierName": "b" + }, + "name": "b" + }, + "right": { + "type": "Literal", + "start": 12, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "value": 2, + "raw": "2" + } + } + ] + }, + "kind": "init" + } + ], + "extra": { + "parenthesized": true, + "parenStart": 1 + } + } + ] + }, + "right": { + "type": "Identifier", + "start": 20, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + }, + "identifierName": "t" + }, + "name": "t" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/categorized/invalid-assignment-pattern-4/input.js b/packages/babel-parser/test/fixtures/core/categorized/invalid-assignment-pattern-4/input.js new file mode 100644 index 000000000000..dff398289765 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/categorized/invalid-assignment-pattern-4/input.js @@ -0,0 +1 @@ +[{b: [([a = 1])]}] = t \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/categorized/invalid-assignment-pattern-4/options.json b/packages/babel-parser/test/fixtures/core/categorized/invalid-assignment-pattern-4/options.json new file mode 100644 index 000000000000..070d941a7562 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/categorized/invalid-assignment-pattern-4/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["estree"] +} diff --git a/packages/babel-parser/test/fixtures/core/categorized/invalid-assignment-pattern-4/output.json b/packages/babel-parser/test/fixtures/core/categorized/invalid-assignment-pattern-4/output.json new file mode 100644 index 000000000000..caf293552bc5 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/categorized/invalid-assignment-pattern-4/output.json @@ -0,0 +1,242 @@ +{ + "type": "File", + "start": 0, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "errors": [ + "SyntaxError: Invalid parenthesized assignment pattern (1:7)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 0, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "operator": "=", + "left": { + "type": "ArrayPattern", + "start": 0, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "elements": [ + { + "type": "ObjectPattern", + "start": 1, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "properties": [ + { + "type": "Property", + "start": 2, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 2, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + }, + "identifierName": "b" + }, + "name": "b" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "ArrayPattern", + "start": 5, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "elements": [ + { + "type": "ArrayPattern", + "start": 7, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "elements": [ + { + "type": "AssignmentPattern", + "start": 8, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "left": { + "type": "Identifier", + "start": 8, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + }, + "identifierName": "a" + }, + "name": "a" + }, + "right": { + "type": "Literal", + "start": 12, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "value": 1, + "raw": "1" + } + } + ], + "extra": { + "parenthesized": true, + "parenStart": 6 + } + } + ] + }, + "kind": "init" + } + ] + } + ] + }, + "right": { + "type": "Identifier", + "start": 21, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + }, + "identifierName": "t" + }, + "name": "t" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/categorized/invalid-assignment-pattern-5/input.js b/packages/babel-parser/test/fixtures/core/categorized/invalid-assignment-pattern-5/input.js new file mode 100644 index 000000000000..0100e137ff7f --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/categorized/invalid-assignment-pattern-5/input.js @@ -0,0 +1 @@ +[([x])] = t; \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/categorized/invalid-assignment-pattern-5/options.json b/packages/babel-parser/test/fixtures/core/categorized/invalid-assignment-pattern-5/options.json new file mode 100644 index 000000000000..070d941a7562 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/categorized/invalid-assignment-pattern-5/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["estree"] +} diff --git a/packages/babel-parser/test/fixtures/core/categorized/invalid-assignment-pattern-5/output.json b/packages/babel-parser/test/fixtures/core/categorized/invalid-assignment-pattern-5/output.json new file mode 100644 index 000000000000..8eaa162030cd --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/categorized/invalid-assignment-pattern-5/output.json @@ -0,0 +1,140 @@ +{ + "type": "File", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "errors": [ + "SyntaxError: Invalid parenthesized assignment pattern (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "operator": "=", + "left": { + "type": "ArrayPattern", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "elements": [ + { + "type": "ArrayPattern", + "start": 2, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "elements": [ + { + "type": "Identifier", + "start": 3, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 4 + }, + "identifierName": "x" + }, + "name": "x" + } + ], + "extra": { + "parenthesized": true, + "parenStart": 1 + } + } + ] + }, + "right": { + "type": "Identifier", + "start": 10, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + }, + "identifierName": "t" + }, + "name": "t" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/categorized/invalid-fn-decl-inside-loop/options.json b/packages/babel-parser/test/fixtures/core/categorized/invalid-fn-decl-inside-loop/options.json deleted file mode 100644 index 05a7826ae8ba..000000000000 --- a/packages/babel-parser/test/fixtures/core/categorized/invalid-fn-decl-inside-loop/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "In non-strict mode code, functions can only be declared at top level, inside a block, or as the body of an if statement (1:10)" -} diff --git a/packages/babel-parser/test/fixtures/core/categorized/invalid-fn-decl-inside-loop/output.json b/packages/babel-parser/test/fixtures/core/categorized/invalid-fn-decl-inside-loop/output.json new file mode 100644 index 000000000000..7ad34b6ae910 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/categorized/invalid-fn-decl-inside-loop/output.json @@ -0,0 +1,125 @@ +{ + "type": "File", + "start": 0, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "errors": [ + "SyntaxError: In non-strict mode code, functions can only be declared at top level, inside a block, or as the body of an if statement (1:10)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "WhileStatement", + "start": 0, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "test": { + "type": "NumericLiteral", + "start": 7, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + }, + "body": { + "type": "FunctionDeclaration", + "start": 10, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "id": { + "type": "Identifier", + "start": 19, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 22 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 24, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "body": [], + "directives": [] + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/categorized/invalid-fn-decl-labeled-inside-loop/options.json b/packages/babel-parser/test/fixtures/core/categorized/invalid-fn-decl-labeled-inside-loop/options.json deleted file mode 100644 index 395620bfa2f8..000000000000 --- a/packages/babel-parser/test/fixtures/core/categorized/invalid-fn-decl-labeled-inside-loop/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "In non-strict mode code, functions can only be declared at top level, inside a block, or as the body of an if statement (1:20)" -} diff --git a/packages/babel-parser/test/fixtures/core/categorized/invalid-fn-decl-labeled-inside-loop/output.json b/packages/babel-parser/test/fixtures/core/categorized/invalid-fn-decl-labeled-inside-loop/output.json new file mode 100644 index 000000000000..64064c04c2b9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/categorized/invalid-fn-decl-labeled-inside-loop/output.json @@ -0,0 +1,189 @@ +{ + "type": "File", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "errors": [ + "SyntaxError: In non-strict mode code, functions can only be declared at top level, inside a block, or as the body of an if statement (1:20)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "WhileStatement", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "test": { + "type": "NumericLiteral", + "start": 7, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + }, + "body": { + "type": "LabeledStatement", + "start": 10, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "body": { + "type": "LabeledStatement", + "start": 15, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "body": { + "type": "FunctionDeclaration", + "start": 20, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "id": { + "type": "Identifier", + "start": 29, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 32 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 34, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 34 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "body": [], + "directives": [] + } + }, + "label": { + "type": "Identifier", + "start": 15, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 18 + }, + "identifierName": "bar" + }, + "name": "bar" + } + }, + "label": { + "type": "Identifier", + "start": 10, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 13 + }, + "identifierName": "foo" + }, + "name": "foo" + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/categorized/valid-assignment-pattern-1/input.js b/packages/babel-parser/test/fixtures/core/categorized/valid-assignment-pattern-1/input.js new file mode 100644 index 000000000000..821f2c5a3c37 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/categorized/valid-assignment-pattern-1/input.js @@ -0,0 +1 @@ +[(a.x)] = t; \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/categorized/valid-assignment-pattern-1/output.json b/packages/babel-parser/test/fixtures/core/categorized/valid-assignment-pattern-1/output.json new file mode 100644 index 000000000000..d0db9dd2f9f2 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/categorized/valid-assignment-pattern-1/output.json @@ -0,0 +1,154 @@ +{ + "type": "File", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "operator": "=", + "left": { + "type": "ArrayPattern", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "elements": [ + { + "type": "MemberExpression", + "start": 2, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "object": { + "type": "Identifier", + "start": 2, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + }, + "identifierName": "a" + }, + "name": "a" + }, + "property": { + "type": "Identifier", + "start": 4, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + }, + "identifierName": "x" + }, + "name": "x" + }, + "computed": false, + "extra": { + "parenthesized": true, + "parenStart": 1 + } + } + ] + }, + "right": { + "type": "Identifier", + "start": 10, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + }, + "identifierName": "t" + }, + "name": "t" + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/categorized/valid-assignment-pattern-2/input.js b/packages/babel-parser/test/fixtures/core/categorized/valid-assignment-pattern-2/input.js new file mode 100644 index 000000000000..d2e8408e783a --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/categorized/valid-assignment-pattern-2/input.js @@ -0,0 +1 @@ +[(x)] = t; \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/categorized/valid-assignment-pattern-2/output.json b/packages/babel-parser/test/fixtures/core/categorized/valid-assignment-pattern-2/output.json new file mode 100644 index 000000000000..96d91c3d80d7 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/categorized/valid-assignment-pattern-2/output.json @@ -0,0 +1,121 @@ +{ + "type": "File", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "operator": "=", + "left": { + "type": "ArrayPattern", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "elements": [ + { + "type": "Identifier", + "start": 2, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + }, + "identifierName": "x" + }, + "name": "x", + "extra": { + "parenthesized": true, + "parenStart": 1 + } + } + ] + }, + "right": { + "type": "Identifier", + "start": 8, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + }, + "identifierName": "t" + }, + "name": "t" + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/categorized/valid-assignment-pattern-3/input.js b/packages/babel-parser/test/fixtures/core/categorized/valid-assignment-pattern-3/input.js new file mode 100644 index 000000000000..320748c0282f --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/categorized/valid-assignment-pattern-3/input.js @@ -0,0 +1 @@ +[(((x)))] = t; \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/categorized/valid-assignment-pattern-3/output.json b/packages/babel-parser/test/fixtures/core/categorized/valid-assignment-pattern-3/output.json new file mode 100644 index 000000000000..ec252128aaf2 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/categorized/valid-assignment-pattern-3/output.json @@ -0,0 +1,121 @@ +{ + "type": "File", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "operator": "=", + "left": { + "type": "ArrayPattern", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "elements": [ + { + "type": "Identifier", + "start": 4, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + }, + "identifierName": "x" + }, + "name": "x", + "extra": { + "parenthesized": true, + "parenStart": 1 + } + } + ] + }, + "right": { + "type": "Identifier", + "start": 12, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + }, + "identifierName": "t" + }, + "name": "t" + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/valid-escape/async/input.js b/packages/babel-parser/test/fixtures/core/escape-keyword/async/input.js similarity index 100% rename from packages/babel-parser/test/fixtures/core/valid-escape/async/input.js rename to packages/babel-parser/test/fixtures/core/escape-keyword/async/input.js diff --git a/packages/babel-parser/test/fixtures/core/valid-escape/async/output.json b/packages/babel-parser/test/fixtures/core/escape-keyword/async/output.json similarity index 100% rename from packages/babel-parser/test/fixtures/core/valid-escape/async/output.json rename to packages/babel-parser/test/fixtures/core/escape-keyword/async/output.json diff --git a/packages/babel-parser/test/fixtures/core/escape-keyword/invalid/input.js b/packages/babel-parser/test/fixtures/core/escape-keyword/invalid/input.js new file mode 100644 index 000000000000..d3f6f142b83a --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/escape-keyword/invalid/input.js @@ -0,0 +1,3 @@ +var a = { + br\u{65}ak +}; diff --git a/packages/babel-parser/test/fixtures/core/escape-keyword/invalid/output.json b/packages/babel-parser/test/fixtures/core/escape-keyword/invalid/output.json new file mode 100644 index 000000000000..742ca4b45728 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/escape-keyword/invalid/output.json @@ -0,0 +1,160 @@ +{ + "type": "File", + "start": 0, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 2 + } + }, + "errors": [ + "SyntaxError: Unexpected keyword 'break' (2:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 2 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 0, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 2 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 4, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 4, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + }, + "identifierName": "a" + }, + "name": "a" + }, + "init": { + "type": "ObjectExpression", + "start": 8, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 12, + "end": 22, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 12 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 12, + "end": 22, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 12 + }, + "identifierName": "break" + }, + "name": "break" + }, + "computed": false, + "shorthand": true, + "value": { + "type": "Identifier", + "start": 12, + "end": 22, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 12 + }, + "identifierName": "break" + }, + "name": "break" + }, + "extra": { + "shorthand": true + } + } + ] + } + } + ], + "kind": "var" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/escape-keyword/used-as-property/input.js b/packages/babel-parser/test/fixtures/core/escape-keyword/used-as-property/input.js new file mode 100644 index 000000000000..d5faad627616 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/escape-keyword/used-as-property/input.js @@ -0,0 +1,3 @@ +var a = { + br\u{65}ak: 2 +}; diff --git a/packages/babel-parser/test/fixtures/core/escape-keyword/used-as-property/output.json b/packages/babel-parser/test/fixtures/core/escape-keyword/used-as-property/output.json new file mode 100644 index 000000000000..894aebee85f1 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/escape-keyword/used-as-property/output.json @@ -0,0 +1,157 @@ +{ + "type": "File", + "start": 0, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 2 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 2 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 0, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 2 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 4, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 4, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + }, + "identifierName": "a" + }, + "name": "a" + }, + "init": { + "type": "ObjectExpression", + "start": 8, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 12, + "end": 25, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 15 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 12, + "end": 22, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 12 + }, + "identifierName": "break" + }, + "name": "break" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "NumericLiteral", + "start": 24, + "end": 25, + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 15 + } + }, + "extra": { + "rawValue": 2, + "raw": "2" + }, + "value": 2 + } + } + ] + } + } + ], + "kind": "var" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/escape-template/non-octal-eight/input.js b/packages/babel-parser/test/fixtures/core/escape-template/non-octal-eight/input.js new file mode 100644 index 000000000000..adc52b823a24 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/escape-template/non-octal-eight/input.js @@ -0,0 +1 @@ +`\8`; diff --git a/packages/babel-parser/test/fixtures/core/escape-template/non-octal-eight/output.json b/packages/babel-parser/test/fixtures/core/escape-template/non-octal-eight/output.json new file mode 100644 index 000000000000..20b84ecf03fa --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/escape-template/non-octal-eight/output.json @@ -0,0 +1,91 @@ +{ + "type": "File", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "expression": { + "type": "TemplateLiteral", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "expressions": [], + "quasis": [ + { + "type": "TemplateElement", + "start": 1, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "value": { + "raw": "\\8", + "cooked": null + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/escape-template/non-octal-nine/input.js b/packages/babel-parser/test/fixtures/core/escape-template/non-octal-nine/input.js new file mode 100644 index 000000000000..b5435620b9cb --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/escape-template/non-octal-nine/input.js @@ -0,0 +1 @@ +`\9`; diff --git a/packages/babel-parser/test/fixtures/core/escape-template/non-octal-nine/output.json b/packages/babel-parser/test/fixtures/core/escape-template/non-octal-nine/output.json new file mode 100644 index 000000000000..9e0985f69a92 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/escape-template/non-octal-nine/output.json @@ -0,0 +1,91 @@ +{ + "type": "File", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "expression": { + "type": "TemplateLiteral", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "expressions": [], + "quasis": [ + { + "type": "TemplateElement", + "start": 1, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "value": { + "raw": "\\9", + "cooked": null + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/object/invalid-escape-get/options.json b/packages/babel-parser/test/fixtures/core/object/invalid-escape-get/options.json index 0cd822570731..99a2bc92f2c0 100644 --- a/packages/babel-parser/test/fixtures/core/object/invalid-escape-get/options.json +++ b/packages/babel-parser/test/fixtures/core/object/invalid-escape-get/options.json @@ -1,3 +1,3 @@ { "throws": "Unexpected token, expected \",\" (1:12)" -} \ No newline at end of file +} diff --git a/packages/babel-parser/test/fixtures/core/object/invalid-property-initializer-1/input.js b/packages/babel-parser/test/fixtures/core/object/invalid-property-initializer-1/input.js new file mode 100644 index 000000000000..9538075c50c3 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/object/invalid-property-initializer-1/input.js @@ -0,0 +1,4 @@ +const obj = { + bar: x = 123, + foo = 123 +}; diff --git a/packages/babel-parser/test/fixtures/core/object/invalid-property-initializer-1/options.json b/packages/babel-parser/test/fixtures/core/object/invalid-property-initializer-1/options.json new file mode 100644 index 000000000000..e92fc4e28742 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/object/invalid-property-initializer-1/options.json @@ -0,0 +1,3 @@ +{ + "throws": "Unexpected token (3:6)" +} diff --git a/packages/babel-parser/test/fixtures/core/object/invalid-property-initializer/input.js b/packages/babel-parser/test/fixtures/core/object/invalid-property-initializer/input.js new file mode 100644 index 000000000000..868f237838df --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/object/invalid-property-initializer/input.js @@ -0,0 +1,4 @@ +const obj = { + foo = 123, + bar: x = 123 +}; diff --git a/packages/babel-parser/test/fixtures/core/object/invalid-property-initializer/options.json b/packages/babel-parser/test/fixtures/core/object/invalid-property-initializer/options.json new file mode 100644 index 000000000000..9660494a29ea --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/object/invalid-property-initializer/options.json @@ -0,0 +1,3 @@ +{ + "throws": "Unexpected token (2:6)" +} diff --git a/packages/babel-parser/test/fixtures/core/object/valid-property-initializer/input.js b/packages/babel-parser/test/fixtures/core/object/valid-property-initializer/input.js new file mode 100644 index 000000000000..0cd0f5146c8d --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/object/valid-property-initializer/input.js @@ -0,0 +1,4 @@ +const obj = { + foo = 123, + bar: x = 123, +} = { foo: 24, bar: 45 }; diff --git a/packages/babel-parser/test/fixtures/core/object/valid-property-initializer/output.json b/packages/babel-parser/test/fixtures/core/object/valid-property-initializer/output.json new file mode 100644 index 000000000000..7b1a47d91e7a --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/object/valid-property-initializer/output.json @@ -0,0 +1,425 @@ +{ + "type": "File", + "start": 0, + "end": 68, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 25 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 68, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 25 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 0, + "end": 68, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 25 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 6, + "end": 67, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 4, + "column": 24 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 9 + }, + "identifierName": "obj" + }, + "name": "obj" + }, + "init": { + "type": "AssignmentExpression", + "start": 12, + "end": 67, + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 4, + "column": 24 + } + }, + "operator": "=", + "left": { + "type": "ObjectPattern", + "start": 12, + "end": 44, + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 16, + "end": 25, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 11 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 16, + "end": 19, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 5 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "computed": false, + "shorthand": true, + "value": { + "type": "AssignmentPattern", + "start": 16, + "end": 25, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 11 + } + }, + "left": { + "type": "Identifier", + "start": 16, + "end": 19, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 5 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "right": { + "type": "NumericLiteral", + "start": 22, + "end": 25, + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 11 + } + }, + "extra": { + "rawValue": 123, + "raw": "123" + }, + "value": 123 + } + }, + "extra": { + "shorthand": true + } + }, + { + "type": "ObjectProperty", + "start": 29, + "end": 41, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 14 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 29, + "end": 32, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 5 + }, + "identifierName": "bar" + }, + "name": "bar" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "AssignmentPattern", + "start": 34, + "end": 41, + "loc": { + "start": { + "line": 3, + "column": 7 + }, + "end": { + "line": 3, + "column": 14 + } + }, + "left": { + "type": "Identifier", + "start": 34, + "end": 35, + "loc": { + "start": { + "line": 3, + "column": 7 + }, + "end": { + "line": 3, + "column": 8 + }, + "identifierName": "x" + }, + "name": "x" + }, + "right": { + "type": "NumericLiteral", + "start": 38, + "end": 41, + "loc": { + "start": { + "line": 3, + "column": 11 + }, + "end": { + "line": 3, + "column": 14 + } + }, + "extra": { + "rawValue": 123, + "raw": "123" + }, + "value": 123 + } + } + } + ], + "extra": { + "trailingComma": 41 + } + }, + "right": { + "type": "ObjectExpression", + "start": 47, + "end": 67, + "loc": { + "start": { + "line": 4, + "column": 4 + }, + "end": { + "line": 4, + "column": 24 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 49, + "end": 56, + "loc": { + "start": { + "line": 4, + "column": 6 + }, + "end": { + "line": 4, + "column": 13 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 49, + "end": 52, + "loc": { + "start": { + "line": 4, + "column": 6 + }, + "end": { + "line": 4, + "column": 9 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "NumericLiteral", + "start": 54, + "end": 56, + "loc": { + "start": { + "line": 4, + "column": 11 + }, + "end": { + "line": 4, + "column": 13 + } + }, + "extra": { + "rawValue": 24, + "raw": "24" + }, + "value": 24 + } + }, + { + "type": "ObjectProperty", + "start": 58, + "end": 65, + "loc": { + "start": { + "line": 4, + "column": 15 + }, + "end": { + "line": 4, + "column": 22 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 58, + "end": 61, + "loc": { + "start": { + "line": 4, + "column": 15 + }, + "end": { + "line": 4, + "column": 18 + }, + "identifierName": "bar" + }, + "name": "bar" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "NumericLiteral", + "start": 63, + "end": 65, + "loc": { + "start": { + "line": 4, + "column": 20 + }, + "end": { + "line": 4, + "column": 22 + } + }, + "extra": { + "rawValue": 45, + "raw": "45" + }, + "value": 45 + } + } + ] + } + } + } + ], + "kind": "const" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/opts/tokens-true/output.json b/packages/babel-parser/test/fixtures/core/opts/tokens-true/output.json index 47117344de0f..a21bf5e27309 100644 --- a/packages/babel-parser/test/fixtures/core/opts/tokens-true/output.json +++ b/packages/babel-parser/test/fixtures/core/opts/tokens-true/output.json @@ -457,7 +457,7 @@ "isAssign": false, "prefix": true, "postfix": false, - "binop": 9, + "binop": 10, "updateContext": null }, "value": "+", diff --git a/packages/babel-parser/test/fixtures/core/regression/non-octal-float-strict-mode/options.json b/packages/babel-parser/test/fixtures/core/regression/non-octal-float-strict-mode/options.json index 8ac5b45f7194..2104ca43283f 100644 --- a/packages/babel-parser/test/fixtures/core/regression/non-octal-float-strict-mode/options.json +++ b/packages/babel-parser/test/fixtures/core/regression/non-octal-float-strict-mode/options.json @@ -1,4 +1,3 @@ { - "sourceType": "module", - "throws": "Legacy octal literals are not allowed in strict mode (1:0)" + "sourceType": "module" } diff --git a/packages/babel-parser/test/fixtures/core/regression/non-octal-float-strict-mode/output.json b/packages/babel-parser/test/fixtures/core/regression/non-octal-float-strict-mode/output.json new file mode 100644 index 000000000000..99253558c815 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/regression/non-octal-float-strict-mode/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "errors": [ + "SyntaxError: Legacy octal literals are not allowed in strict mode (1:0)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "extra": { + "rawValue": 9.5, + "raw": "09.5" + }, + "value": 9.5 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-2nd-lvl-lex-nested/options.json b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-2nd-lvl-lex-nested/options.json deleted file mode 100644 index b09098cda9c8..000000000000 --- a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-2nd-lvl-lex-nested/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'foo' has already been declared (4:6)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-2nd-lvl-lex-nested/output.json b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-2nd-lvl-lex-nested/output.json new file mode 100644 index 000000000000..f017f0fa5f00 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-2nd-lvl-lex-nested/output.json @@ -0,0 +1,247 @@ +{ + "type": "File", + "start": 0, + "end": 44, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Identifier 'foo' has already been declared (4:6)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 44, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "BlockStatement", + "start": 0, + "end": 44, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "body": [ + { + "type": "VariableDeclaration", + "start": 4, + "end": 12, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 10 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 8, + "end": 11, + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 9 + } + }, + "id": { + "type": "Identifier", + "start": 8, + "end": 11, + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 9 + }, + "identifierName": "bar" + }, + "name": "bar" + }, + "init": null + } + ], + "kind": "let" + }, + { + "type": "VariableDeclaration", + "start": 15, + "end": 27, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 14 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 19, + "end": 26, + "loc": { + "start": { + "line": 3, + "column": 6 + }, + "end": { + "line": 3, + "column": 13 + } + }, + "id": { + "type": "Identifier", + "start": 19, + "end": 22, + "loc": { + "start": { + "line": 3, + "column": 6 + }, + "end": { + "line": 3, + "column": 9 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "init": { + "type": "NumericLiteral", + "start": 25, + "end": 26, + "loc": { + "start": { + "line": 3, + "column": 12 + }, + "end": { + "line": 3, + "column": 13 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + ], + "kind": "var" + }, + { + "type": "VariableDeclaration", + "start": 30, + "end": 42, + "loc": { + "start": { + "line": 4, + "column": 2 + }, + "end": { + "line": 4, + "column": 14 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 34, + "end": 41, + "loc": { + "start": { + "line": 4, + "column": 6 + }, + "end": { + "line": 4, + "column": 13 + } + }, + "id": { + "type": "Identifier", + "start": 34, + "end": 37, + "loc": { + "start": { + "line": 4, + "column": 6 + }, + "end": { + "line": 4, + "column": 9 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "init": { + "type": "NumericLiteral", + "start": 40, + "end": 41, + "loc": { + "start": { + "line": 4, + "column": 12 + }, + "end": { + "line": 4, + "column": 13 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + ], + "kind": "let" + } + ], + "directives": [] + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-2nd-lvl-lex/options.json b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-2nd-lvl-lex/options.json deleted file mode 100644 index 37dd7bff7207..000000000000 --- a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-2nd-lvl-lex/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'foo' has already been declared (3:4)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-2nd-lvl-lex/output.json b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-2nd-lvl-lex/output.json new file mode 100644 index 000000000000..758528386efb --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-2nd-lvl-lex/output.json @@ -0,0 +1,229 @@ +{ + "type": "File", + "start": 0, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 12 + } + }, + "errors": [ + "SyntaxError: Identifier 'foo' has already been declared (3:4)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 12 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 4, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "id": { + "type": "Identifier", + "start": 4, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "bar" + }, + "name": "bar" + }, + "init": null + } + ], + "kind": "let" + }, + { + "type": "VariableDeclaration", + "start": 9, + "end": 21, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 12 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 13, + "end": 20, + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 11 + } + }, + "id": { + "type": "Identifier", + "start": 13, + "end": 16, + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 7 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "init": { + "type": "NumericLiteral", + "start": 19, + "end": 20, + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 11 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + ], + "kind": "var" + }, + { + "type": "VariableDeclaration", + "start": 22, + "end": 34, + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 12 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 26, + "end": 33, + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 11 + } + }, + "id": { + "type": "Identifier", + "start": 26, + "end": 29, + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 7 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "init": { + "type": "NumericLiteral", + "start": 32, + "end": 33, + "loc": { + "start": { + "line": 3, + "column": 10 + }, + "end": { + "line": 3, + "column": 11 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + ], + "kind": "let" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-2nd-lvl-var-nested/options.json b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-2nd-lvl-var-nested/options.json deleted file mode 100644 index b09098cda9c8..000000000000 --- a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-2nd-lvl-var-nested/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'foo' has already been declared (4:6)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-2nd-lvl-var-nested/output.json b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-2nd-lvl-var-nested/output.json new file mode 100644 index 000000000000..0444f665d33d --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-2nd-lvl-var-nested/output.json @@ -0,0 +1,247 @@ +{ + "type": "File", + "start": 0, + "end": 44, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Identifier 'foo' has already been declared (4:6)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 44, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "BlockStatement", + "start": 0, + "end": 44, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "body": [ + { + "type": "VariableDeclaration", + "start": 4, + "end": 12, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 10 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 8, + "end": 11, + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 9 + } + }, + "id": { + "type": "Identifier", + "start": 8, + "end": 11, + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 9 + }, + "identifierName": "bar" + }, + "name": "bar" + }, + "init": null + } + ], + "kind": "let" + }, + { + "type": "VariableDeclaration", + "start": 15, + "end": 27, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 14 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 19, + "end": 26, + "loc": { + "start": { + "line": 3, + "column": 6 + }, + "end": { + "line": 3, + "column": 13 + } + }, + "id": { + "type": "Identifier", + "start": 19, + "end": 22, + "loc": { + "start": { + "line": 3, + "column": 6 + }, + "end": { + "line": 3, + "column": 9 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "init": { + "type": "NumericLiteral", + "start": 25, + "end": 26, + "loc": { + "start": { + "line": 3, + "column": 12 + }, + "end": { + "line": 3, + "column": 13 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + ], + "kind": "let" + }, + { + "type": "VariableDeclaration", + "start": 30, + "end": 42, + "loc": { + "start": { + "line": 4, + "column": 2 + }, + "end": { + "line": 4, + "column": 14 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 34, + "end": 41, + "loc": { + "start": { + "line": 4, + "column": 6 + }, + "end": { + "line": 4, + "column": 13 + } + }, + "id": { + "type": "Identifier", + "start": 34, + "end": 37, + "loc": { + "start": { + "line": 4, + "column": 6 + }, + "end": { + "line": 4, + "column": 9 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "init": { + "type": "NumericLiteral", + "start": 40, + "end": 41, + "loc": { + "start": { + "line": 4, + "column": 12 + }, + "end": { + "line": 4, + "column": 13 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + ], + "kind": "var" + } + ], + "directives": [] + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-2nd-lvl-var/options.json b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-2nd-lvl-var/options.json deleted file mode 100644 index 37dd7bff7207..000000000000 --- a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-2nd-lvl-var/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'foo' has already been declared (3:4)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-2nd-lvl-var/output.json b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-2nd-lvl-var/output.json new file mode 100644 index 000000000000..76f48823dd81 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-2nd-lvl-var/output.json @@ -0,0 +1,229 @@ +{ + "type": "File", + "start": 0, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 12 + } + }, + "errors": [ + "SyntaxError: Identifier 'foo' has already been declared (3:4)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 12 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 4, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "id": { + "type": "Identifier", + "start": 4, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "bar" + }, + "name": "bar" + }, + "init": null + } + ], + "kind": "let" + }, + { + "type": "VariableDeclaration", + "start": 9, + "end": 21, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 12 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 13, + "end": 20, + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 11 + } + }, + "id": { + "type": "Identifier", + "start": 13, + "end": 16, + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 7 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "init": { + "type": "NumericLiteral", + "start": 19, + "end": 20, + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 11 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + ], + "kind": "let" + }, + { + "type": "VariableDeclaration", + "start": 22, + "end": 34, + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 12 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 26, + "end": 33, + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 11 + } + }, + "id": { + "type": "Identifier", + "start": 26, + "end": 29, + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 7 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "init": { + "type": "NumericLiteral", + "start": 32, + "end": 33, + "loc": { + "start": { + "line": 3, + "column": 10 + }, + "end": { + "line": 3, + "column": 11 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + ], + "kind": "var" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-arr-destr/options.json b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-arr-destr/options.json deleted file mode 100644 index 70121ca46ead..000000000000 --- a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-arr-destr/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'foo' has already been declared (2:15)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-arr-destr/output.json b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-arr-destr/output.json new file mode 100644 index 000000000000..899412645531 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-arr-destr/output.json @@ -0,0 +1,154 @@ +{ + "type": "File", + "start": 0, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Identifier 'foo' has already been declared (2:15)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "TryStatement", + "start": 0, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "block": { + "type": "BlockStatement", + "start": 4, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 2, + "column": 1 + } + }, + "body": [], + "directives": [] + }, + "handler": { + "type": "CatchClause", + "start": 8, + "end": 30, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "param": { + "type": "ArrayPattern", + "start": 15, + "end": 25, + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 19 + } + }, + "elements": [ + { + "type": "Identifier", + "start": 16, + "end": 19, + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 13 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + { + "type": "Identifier", + "start": 21, + "end": 24, + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 18 + }, + "identifierName": "foo" + }, + "name": "foo" + } + ] + }, + "body": { + "type": "BlockStatement", + "start": 27, + "end": 30, + "loc": { + "start": { + "line": 2, + "column": 21 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": [], + "directives": [] + } + }, + "finalizer": null + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-dbl-let/options.json b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-dbl-let/options.json deleted file mode 100644 index 386e81ecdc4c..000000000000 --- a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-dbl-let/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'foo' has already been declared (1:35)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-dbl-let/output.json b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-dbl-let/output.json new file mode 100644 index 000000000000..cddf0493cba9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-dbl-let/output.json @@ -0,0 +1,222 @@ +{ + "type": "File", + "start": 0, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "errors": [ + "SyntaxError: Identifier 'foo' has already been declared (1:35)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 4, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "id": { + "type": "Identifier", + "start": 4, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "init": null + } + ], + "kind": "let" + }, + { + "type": "TryStatement", + "start": 9, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "block": { + "type": "BlockStatement", + "start": 13, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "body": [], + "directives": [] + }, + "handler": { + "type": "CatchClause", + "start": 16, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "param": { + "type": "Identifier", + "start": 23, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 26 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "body": { + "type": "BlockStatement", + "start": 28, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "body": [], + "directives": [] + } + }, + "finalizer": null + }, + { + "type": "VariableDeclaration", + "start": 31, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 31 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 35, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 35 + }, + "end": { + "line": 1, + "column": 38 + } + }, + "id": { + "type": "Identifier", + "start": 35, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 35 + }, + "end": { + "line": 1, + "column": 38 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "init": null + } + ], + "kind": "let" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-func/options.json b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-func/options.json deleted file mode 100644 index 62b0c73eb164..000000000000 --- a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-func/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'foo' has already been declared (3:11)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-func/output.json b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-func/output.json new file mode 100644 index 000000000000..ab1db27cf0a8 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-func/output.json @@ -0,0 +1,173 @@ +{ + "type": "File", + "start": 0, + "end": 43, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Identifier 'foo' has already been declared (3:11)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 43, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "TryStatement", + "start": 0, + "end": 43, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "block": { + "type": "BlockStatement", + "start": 4, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 2, + "column": 1 + } + }, + "body": [], + "directives": [] + }, + "handler": { + "type": "CatchClause", + "start": 8, + "end": 43, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "param": { + "type": "Identifier", + "start": 15, + "end": 18, + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 12 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "body": { + "type": "BlockStatement", + "start": 20, + "end": 43, + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "body": [ + { + "type": "FunctionDeclaration", + "start": 24, + "end": 41, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 19 + } + }, + "id": { + "type": "Identifier", + "start": 33, + "end": 36, + "loc": { + "start": { + "line": 3, + "column": 11 + }, + "end": { + "line": 3, + "column": 14 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 39, + "end": 41, + "loc": { + "start": { + "line": 3, + "column": 17 + }, + "end": { + "line": 3, + "column": 19 + } + }, + "body": [], + "directives": [] + } + } + ], + "directives": [] + } + }, + "finalizer": null + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-let/options.json b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-let/options.json deleted file mode 100644 index 254a763e653e..000000000000 --- a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-let/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'foo' has already been declared (3:6)" -} diff --git a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-let/output.json b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-let/output.json new file mode 100644 index 000000000000..e759f28d0434 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-let/output.json @@ -0,0 +1,172 @@ +{ + "type": "File", + "start": 0, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Identifier 'foo' has already been declared (3:6)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "TryStatement", + "start": 0, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "block": { + "type": "BlockStatement", + "start": 4, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 2, + "column": 1 + } + }, + "body": [], + "directives": [] + }, + "handler": { + "type": "CatchClause", + "start": 8, + "end": 34, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "param": { + "type": "Identifier", + "start": 15, + "end": 18, + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 12 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "body": { + "type": "BlockStatement", + "start": 20, + "end": 34, + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "body": [ + { + "type": "VariableDeclaration", + "start": 24, + "end": 32, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 10 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 28, + "end": 31, + "loc": { + "start": { + "line": 3, + "column": 6 + }, + "end": { + "line": 3, + "column": 9 + } + }, + "id": { + "type": "Identifier", + "start": 28, + "end": 31, + "loc": { + "start": { + "line": 3, + "column": 6 + }, + "end": { + "line": 3, + "column": 9 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "init": null + } + ], + "kind": "let" + } + ], + "directives": [] + } + }, + "finalizer": null + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-obj-destr/options.json b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-obj-destr/options.json deleted file mode 100644 index a00c2989e1b1..000000000000 --- a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-obj-destr/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'foo' has already been declared (2:28)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-obj-destr/output.json b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-obj-destr/output.json new file mode 100644 index 000000000000..5a4c9d365dbe --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-obj-destr/output.json @@ -0,0 +1,293 @@ +{ + "type": "File", + "start": 0, + "end": 47, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Identifier 'foo' has already been declared (2:28)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 47, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "TryStatement", + "start": 0, + "end": 47, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "block": { + "type": "BlockStatement", + "start": 4, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 2, + "column": 1 + } + }, + "body": [], + "directives": [] + }, + "handler": { + "type": "CatchClause", + "start": 8, + "end": 47, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "param": { + "type": "ObjectPattern", + "start": 15, + "end": 42, + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 36 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 17, + "end": 23, + "loc": { + "start": { + "line": 2, + "column": 11 + }, + "end": { + "line": 2, + "column": 17 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 17, + "end": 18, + "loc": { + "start": { + "line": 2, + "column": 11 + }, + "end": { + "line": 2, + "column": 12 + }, + "identifierName": "a" + }, + "name": "a" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "Identifier", + "start": 20, + "end": 23, + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 17 + }, + "identifierName": "foo" + }, + "name": "foo" + } + }, + { + "type": "ObjectProperty", + "start": 25, + "end": 40, + "loc": { + "start": { + "line": 2, + "column": 19 + }, + "end": { + "line": 2, + "column": 34 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 25, + "end": 26, + "loc": { + "start": { + "line": 2, + "column": 19 + }, + "end": { + "line": 2, + "column": 20 + }, + "identifierName": "b" + }, + "name": "b" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "ObjectPattern", + "start": 28, + "end": 40, + "loc": { + "start": { + "line": 2, + "column": 22 + }, + "end": { + "line": 2, + "column": 34 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 30, + "end": 38, + "loc": { + "start": { + "line": 2, + "column": 24 + }, + "end": { + "line": 2, + "column": 32 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 30, + "end": 31, + "loc": { + "start": { + "line": 2, + "column": 24 + }, + "end": { + "line": 2, + "column": 25 + }, + "identifierName": "c" + }, + "name": "c" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "ArrayPattern", + "start": 33, + "end": 38, + "loc": { + "start": { + "line": 2, + "column": 27 + }, + "end": { + "line": 2, + "column": 32 + } + }, + "elements": [ + { + "type": "Identifier", + "start": 34, + "end": 37, + "loc": { + "start": { + "line": 2, + "column": 28 + }, + "end": { + "line": 2, + "column": 31 + }, + "identifierName": "foo" + }, + "name": "foo" + } + ] + } + } + ] + } + } + ] + }, + "body": { + "type": "BlockStatement", + "start": 44, + "end": 47, + "loc": { + "start": { + "line": 2, + "column": 38 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": [], + "directives": [] + } + }, + "finalizer": null + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-var-arr-destr/options.json b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-var-arr-destr/options.json deleted file mode 100644 index ff69adb0860a..000000000000 --- a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-var-arr-destr/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'foo' has already been declared (3:6)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-var-arr-destr/output.json b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-var-arr-destr/output.json new file mode 100644 index 000000000000..40bb3df74915 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-var-arr-destr/output.json @@ -0,0 +1,189 @@ +{ + "type": "File", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Identifier 'foo' has already been declared (3:6)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "TryStatement", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "block": { + "type": "BlockStatement", + "start": 4, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 2, + "column": 1 + } + }, + "body": [], + "directives": [] + }, + "handler": { + "type": "CatchClause", + "start": 8, + "end": 36, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "param": { + "type": "ArrayPattern", + "start": 15, + "end": 20, + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "elements": [ + { + "type": "Identifier", + "start": 16, + "end": 19, + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 13 + }, + "identifierName": "foo" + }, + "name": "foo" + } + ] + }, + "body": { + "type": "BlockStatement", + "start": 22, + "end": 36, + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "body": [ + { + "type": "VariableDeclaration", + "start": 26, + "end": 34, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 10 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 30, + "end": 33, + "loc": { + "start": { + "line": 3, + "column": 6 + }, + "end": { + "line": 3, + "column": 9 + } + }, + "id": { + "type": "Identifier", + "start": 30, + "end": 33, + "loc": { + "start": { + "line": 3, + "column": 6 + }, + "end": { + "line": 3, + "column": 9 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "init": null + } + ], + "kind": "var" + } + ], + "directives": [] + } + }, + "finalizer": null + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-var-obj-destr/options.json b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-var-obj-destr/options.json deleted file mode 100644 index ff69adb0860a..000000000000 --- a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-var-obj-destr/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'foo' has already been declared (3:6)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-var-obj-destr/output.json b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-var-obj-destr/output.json new file mode 100644 index 000000000000..5cd4c6abd102 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-var-obj-destr/output.json @@ -0,0 +1,227 @@ +{ + "type": "File", + "start": 0, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Identifier 'foo' has already been declared (3:6)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "TryStatement", + "start": 0, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "block": { + "type": "BlockStatement", + "start": 4, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 2, + "column": 1 + } + }, + "body": [], + "directives": [] + }, + "handler": { + "type": "CatchClause", + "start": 8, + "end": 38, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "param": { + "type": "ObjectPattern", + "start": 15, + "end": 22, + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 16 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 17, + "end": 20, + "loc": { + "start": { + "line": 2, + "column": 11 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 17, + "end": 20, + "loc": { + "start": { + "line": 2, + "column": 11 + }, + "end": { + "line": 2, + "column": 14 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "computed": false, + "shorthand": true, + "value": { + "type": "Identifier", + "start": 17, + "end": 20, + "loc": { + "start": { + "line": 2, + "column": 11 + }, + "end": { + "line": 2, + "column": 14 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "extra": { + "shorthand": true + } + } + ] + }, + "body": { + "type": "BlockStatement", + "start": 24, + "end": 38, + "loc": { + "start": { + "line": 2, + "column": 18 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "body": [ + { + "type": "VariableDeclaration", + "start": 28, + "end": 36, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 10 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 32, + "end": 35, + "loc": { + "start": { + "line": 3, + "column": 6 + }, + "end": { + "line": 3, + "column": 9 + } + }, + "id": { + "type": "Identifier", + "start": 32, + "end": 35, + "loc": { + "start": { + "line": 3, + "column": 6 + }, + "end": { + "line": 3, + "column": 9 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "init": null + } + ], + "kind": "var" + } + ], + "directives": [] + } + }, + "finalizer": null + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-class-class/options.json b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-class-class/options.json deleted file mode 100644 index cdd0ac832c57..000000000000 --- a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-class-class/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'foo' has already been declared (2:6)" -} diff --git a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-class-class/output.json b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-class-class/output.json new file mode 100644 index 000000000000..6d2e82b586ae --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-class-class/output.json @@ -0,0 +1,166 @@ +{ + "type": "File", + "start": 0, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 13 + } + }, + "errors": [ + "SyntaxError: Identifier 'foo' has already been declared (2:6)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 13 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 9 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 10, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "body": [] + } + }, + { + "type": "EmptyStatement", + "start": 12, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "ClassDeclaration", + "start": 14, + "end": 26, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 12 + } + }, + "id": { + "type": "Identifier", + "start": 20, + "end": 23, + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 9 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 24, + "end": 26, + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 12 + } + }, + "body": [] + } + }, + { + "type": "EmptyStatement", + "start": 26, + "end": 27, + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 13 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-class-const/options.json b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-class-const/options.json deleted file mode 100644 index c45b9bf38290..000000000000 --- a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-class-const/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'foo' has already been declared (2:6)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-class-const/output.json b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-class-const/output.json new file mode 100644 index 000000000000..a23d95cfc217 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-class-const/output.json @@ -0,0 +1,172 @@ +{ + "type": "File", + "start": 0, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "errors": [ + "SyntaxError: Identifier 'foo' has already been declared (2:6)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 9 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 10, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "body": [] + } + }, + { + "type": "EmptyStatement", + "start": 12, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "VariableDeclaration", + "start": 14, + "end": 28, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 20, + "end": 27, + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 13 + } + }, + "id": { + "type": "Identifier", + "start": 20, + "end": 23, + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 9 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "init": { + "type": "NumericLiteral", + "start": 26, + "end": 27, + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 13 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + ], + "kind": "const" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-class-func/options.json b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-class-func/options.json deleted file mode 100644 index 58aaf9d99d22..000000000000 --- a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-class-func/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'foo' has already been declared (2:9)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-class-func/output.json b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-class-func/output.json new file mode 100644 index 000000000000..a6bf56aa7623 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-class-func/output.json @@ -0,0 +1,169 @@ +{ + "type": "File", + "start": 0, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 19 + } + }, + "errors": [ + "SyntaxError: Identifier 'foo' has already been declared (2:9)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 19 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 9 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 10, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "body": [] + } + }, + { + "type": "EmptyStatement", + "start": 12, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "FunctionDeclaration", + "start": 14, + "end": 32, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 18 + } + }, + "id": { + "type": "Identifier", + "start": 23, + "end": 26, + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 12 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 30, + "end": 32, + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 18 + } + }, + "body": [], + "directives": [] + } + }, + { + "type": "EmptyStatement", + "start": 32, + "end": 33, + "loc": { + "start": { + "line": 2, + "column": 18 + }, + "end": { + "line": 2, + "column": 19 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-class-let/options.json b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-class-let/options.json deleted file mode 100644 index bf89e4692c99..000000000000 --- a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-class-let/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'foo' has already been declared (2:4)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-class-let/output.json b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-class-let/output.json new file mode 100644 index 000000000000..49daeec3aef6 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-class-let/output.json @@ -0,0 +1,172 @@ +{ + "type": "File", + "start": 0, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 12 + } + }, + "errors": [ + "SyntaxError: Identifier 'foo' has already been declared (2:4)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 12 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 9 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 10, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "body": [] + } + }, + { + "type": "EmptyStatement", + "start": 12, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "VariableDeclaration", + "start": 14, + "end": 26, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 12 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 18, + "end": 25, + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 11 + } + }, + "id": { + "type": "Identifier", + "start": 18, + "end": 21, + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 7 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "init": { + "type": "NumericLiteral", + "start": 24, + "end": 25, + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 11 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + ], + "kind": "let" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-class-var/options.json b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-class-var/options.json deleted file mode 100644 index bf89e4692c99..000000000000 --- a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-class-var/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'foo' has already been declared (2:4)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-class-var/output.json b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-class-var/output.json new file mode 100644 index 000000000000..205470069b5d --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-class-var/output.json @@ -0,0 +1,153 @@ +{ + "type": "File", + "start": 0, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 8 + } + }, + "errors": [ + "SyntaxError: Identifier 'foo' has already been declared (2:4)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 8 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 9 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 10, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "body": [] + } + }, + { + "type": "EmptyStatement", + "start": 12, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "VariableDeclaration", + "start": 14, + "end": 22, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 8 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 18, + "end": 21, + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 7 + } + }, + "id": { + "type": "Identifier", + "start": 18, + "end": 21, + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 7 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "init": null + } + ], + "kind": "var" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-const-const/options.json b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-const-const/options.json deleted file mode 100644 index d62aabfd1b07..000000000000 --- a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-const-const/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'foo' has already been declared (1:13)" -} diff --git a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-const-const/output.json b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-const-const/output.json new file mode 100644 index 000000000000..b6f764fce7a5 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-const-const/output.json @@ -0,0 +1,160 @@ +{ + "type": "File", + "start": 0, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "errors": [ + "SyntaxError: Identifier 'foo' has already been declared (1:13)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 0, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 6, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 9 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "init": { + "type": "NumericLiteral", + "start": 10, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + }, + { + "type": "VariableDeclarator", + "start": 13, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "id": { + "type": "Identifier", + "start": 13, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 16 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "init": { + "type": "NumericLiteral", + "start": 17, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "extra": { + "rawValue": 2, + "raw": "2" + }, + "value": 2 + } + } + ], + "kind": "const" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-func-gen/options.json b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-func-gen/options.json deleted file mode 100644 index c083e3d4c063..000000000000 --- a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-func-gen/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'f' has already been declared (1:28)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-func-gen/output.json b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-func-gen/output.json new file mode 100644 index 000000000000..ebd20401ed0f --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-func-gen/output.json @@ -0,0 +1,160 @@ +{ + "type": "File", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "errors": [ + "SyntaxError: Identifier 'f' has already been declared (1:28)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "BlockStatement", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "body": [ + { + "type": "FunctionDeclaration", + "start": 2, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "id": { + "type": "Identifier", + "start": 11, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + }, + "identifierName": "f" + }, + "name": "f" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 15, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "body": [], + "directives": [] + } + }, + { + "type": "FunctionDeclaration", + "start": 18, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "id": { + "type": "Identifier", + "start": 28, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 29 + }, + "identifierName": "f" + }, + "name": "f" + }, + "generator": true, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 32, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "body": [], + "directives": [] + } + } + ], + "directives": [] + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-func-module-sloppy/options.json b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-func-module-sloppy/options.json index 3f4250fbe917..2104ca43283f 100644 --- a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-func-module-sloppy/options.json +++ b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-func-module-sloppy/options.json @@ -1,4 +1,3 @@ { - "sourceType": "module", - "throws": "Identifier 'foo' has already been declared (1:29)" + "sourceType": "module" } diff --git a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-func-module-sloppy/output.json b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-func-module-sloppy/output.json new file mode 100644 index 000000000000..c1b2c1a85a29 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-func-module-sloppy/output.json @@ -0,0 +1,160 @@ +{ + "type": "File", + "start": 0, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "errors": [ + "SyntaxError: Identifier 'foo' has already been declared (1:29)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "BlockStatement", + "start": 0, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "body": [ + { + "type": "FunctionDeclaration", + "start": 2, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "id": { + "type": "Identifier", + "start": 11, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "body": [], + "directives": [] + } + }, + { + "type": "FunctionDeclaration", + "start": 20, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "id": { + "type": "Identifier", + "start": 29, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 32 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 35, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 35 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "body": [], + "directives": [] + } + } + ], + "directives": [] + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-func-module/options.json b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-func-module/options.json index 23553cce3705..2104ca43283f 100644 --- a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-func-module/options.json +++ b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-func-module/options.json @@ -1,4 +1,3 @@ { - "sourceType": "module", - "throws":"Identifier 'foo' has already been declared (2:9)" + "sourceType": "module" } diff --git a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-func-module/output.json b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-func-module/output.json new file mode 100644 index 000000000000..eadbdeeb68f8 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-func-module/output.json @@ -0,0 +1,142 @@ +{ + "type": "File", + "start": 0, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 17 + } + }, + "errors": [ + "SyntaxError: Identifier 'foo' has already been declared (2:9)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 17 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 12 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 15, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "body": [], + "directives": [] + } + }, + { + "type": "FunctionDeclaration", + "start": 18, + "end": 35, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 17 + } + }, + "id": { + "type": "Identifier", + "start": 27, + "end": 30, + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 12 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 33, + "end": 35, + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 17 + } + }, + "body": [], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-func-var-sloppy/options.json b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-func-var-sloppy/options.json deleted file mode 100644 index ff69adb0860a..000000000000 --- a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-func-var-sloppy/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'foo' has already been declared (3:6)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-func-var-sloppy/output.json b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-func-var-sloppy/output.json new file mode 100644 index 000000000000..454a440c3426 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-func-var-sloppy/output.json @@ -0,0 +1,178 @@ +{ + "type": "File", + "start": 0, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Identifier 'foo' has already been declared (3:6)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "BlockStatement", + "start": 0, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "body": [ + { + "type": "FunctionDeclaration", + "start": 4, + "end": 21, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 19 + } + }, + "id": { + "type": "Identifier", + "start": 13, + "end": 16, + "loc": { + "start": { + "line": 2, + "column": 11 + }, + "end": { + "line": 2, + "column": 14 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 19, + "end": 21, + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 19 + } + }, + "body": [], + "directives": [] + } + }, + { + "type": "VariableDeclaration", + "start": 24, + "end": 36, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 14 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 28, + "end": 35, + "loc": { + "start": { + "line": 3, + "column": 6 + }, + "end": { + "line": 3, + "column": 13 + } + }, + "id": { + "type": "Identifier", + "start": 28, + "end": 31, + "loc": { + "start": { + "line": 3, + "column": 6 + }, + "end": { + "line": 3, + "column": 9 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "init": { + "type": "NumericLiteral", + "start": 34, + "end": 35, + "loc": { + "start": { + "line": 3, + "column": 12 + }, + "end": { + "line": 3, + "column": 13 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + ], + "kind": "var" + } + ], + "directives": [] + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-gen-func/options.json b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-gen-func/options.json deleted file mode 100644 index c083e3d4c063..000000000000 --- a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-gen-func/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'f' has already been declared (1:28)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-gen-func/output.json b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-gen-func/output.json new file mode 100644 index 000000000000..fdad445b5deb --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-gen-func/output.json @@ -0,0 +1,160 @@ +{ + "type": "File", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "errors": [ + "SyntaxError: Identifier 'f' has already been declared (1:28)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "BlockStatement", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "body": [ + { + "type": "FunctionDeclaration", + "start": 2, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "id": { + "type": "Identifier", + "start": 12, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + }, + "identifierName": "f" + }, + "name": "f" + }, + "generator": true, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 16, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "body": [], + "directives": [] + } + }, + { + "type": "FunctionDeclaration", + "start": 19, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "id": { + "type": "Identifier", + "start": 28, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 29 + }, + "identifierName": "f" + }, + "name": "f" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 32, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "body": [], + "directives": [] + } + } + ], + "directives": [] + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-let-let/options.json b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-let-let/options.json deleted file mode 100644 index 714354e14501..000000000000 --- a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-let-let/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'foo' has already been declared (1:9)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-let-let/output.json b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-let-let/output.json new file mode 100644 index 000000000000..e28bf9f399b0 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-let-let/output.json @@ -0,0 +1,122 @@ +{ + "type": "File", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "errors": [ + "SyntaxError: Identifier 'foo' has already been declared (1:9)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 4, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "id": { + "type": "Identifier", + "start": 4, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "init": null + }, + { + "type": "VariableDeclarator", + "start": 9, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 12 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "init": null + } + ], + "kind": "let" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-nested-let-var/options.json b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-nested-let-var/options.json deleted file mode 100644 index a0925d495610..000000000000 --- a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-nested-let-var/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'a' has already been declared (3:8)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-nested-let-var/output.json b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-nested-let-var/output.json new file mode 100644 index 000000000000..f925321aef98 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-nested-let-var/output.json @@ -0,0 +1,176 @@ +{ + "type": "File", + "start": 0, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Identifier 'a' has already been declared (3:8)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "BlockStatement", + "start": 0, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "body": [ + { + "type": "VariableDeclaration", + "start": 4, + "end": 10, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 8 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 8, + "end": 9, + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 7 + } + }, + "id": { + "type": "Identifier", + "start": 8, + "end": 9, + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 7 + }, + "identifierName": "a" + }, + "name": "a" + }, + "init": null + } + ], + "kind": "let" + }, + { + "type": "BlockStatement", + "start": 13, + "end": 23, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 12 + } + }, + "body": [ + { + "type": "VariableDeclaration", + "start": 15, + "end": 21, + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 10 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 19, + "end": 20, + "loc": { + "start": { + "line": 3, + "column": 8 + }, + "end": { + "line": 3, + "column": 9 + } + }, + "id": { + "type": "Identifier", + "start": 19, + "end": 20, + "loc": { + "start": { + "line": 3, + "column": 8 + }, + "end": { + "line": 3, + "column": 9 + }, + "identifierName": "a" + }, + "name": "a" + }, + "init": null + } + ], + "kind": "var" + } + ], + "directives": [] + } + ], + "directives": [] + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/scope/for-var/options.json b/packages/babel-parser/test/fixtures/core/scope/for-var/options.json deleted file mode 100644 index 10e45adf4560..000000000000 --- a/packages/babel-parser/test/fixtures/core/scope/for-var/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'i' has already been declared (2:8)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/scope/for-var/output.json b/packages/babel-parser/test/fixtures/core/scope/for-var/output.json new file mode 100644 index 000000000000..bfd483ec7fb4 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/scope/for-var/output.json @@ -0,0 +1,194 @@ +{ + "type": "File", + "start": 0, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Identifier 'i' has already been declared (2:8)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ForStatement", + "start": 0, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "init": { + "type": "VariableDeclaration", + "start": 5, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + }, + "identifierName": "i" + }, + "name": "i" + }, + "init": { + "type": "NumericLiteral", + "start": 13, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + } + ], + "kind": "let" + }, + "test": null, + "update": null, + "body": { + "type": "BlockStatement", + "start": 18, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": [ + { + "type": "VariableDeclaration", + "start": 24, + "end": 30, + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 10 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 28, + "end": 29, + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 9 + } + }, + "id": { + "type": "Identifier", + "start": 28, + "end": 29, + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 9 + }, + "identifierName": "i" + }, + "name": "i" + }, + "init": null + } + ], + "kind": "var" + } + ], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/scope/undecl-export-as-default/options.json b/packages/babel-parser/test/fixtures/core/scope/undecl-export-as-default/options.json index 8448889cf253..2104ca43283f 100644 --- a/packages/babel-parser/test/fixtures/core/scope/undecl-export-as-default/options.json +++ b/packages/babel-parser/test/fixtures/core/scope/undecl-export-as-default/options.json @@ -1,4 +1,3 @@ { - "sourceType": "module", - "throws": "Export 'encrypt' is not defined (1:9)" + "sourceType": "module" } diff --git a/packages/babel-parser/test/fixtures/core/scope/undecl-export-as-default/output.json b/packages/babel-parser/test/fixtures/core/scope/undecl-export-as-default/output.json new file mode 100644 index 000000000000..996bc32d815d --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/scope/undecl-export-as-default/output.json @@ -0,0 +1,106 @@ +{ + "type": "File", + "start": 0, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "errors": [ + "SyntaxError: Export 'encrypt' is not defined (1:9)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExportNamedDeclaration", + "start": 0, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "specifiers": [ + { + "type": "ExportSpecifier", + "start": 9, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "local": { + "type": "Identifier", + "start": 9, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 16 + }, + "identifierName": "encrypt" + }, + "name": "encrypt" + }, + "exported": { + "type": "Identifier", + "start": 20, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 27 + }, + "identifierName": "default" + }, + "name": "default" + } + } + ], + "source": null, + "declaration": null + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/scope/undecl-export-as/options.json b/packages/babel-parser/test/fixtures/core/scope/undecl-export-as/options.json index 8448889cf253..2104ca43283f 100644 --- a/packages/babel-parser/test/fixtures/core/scope/undecl-export-as/options.json +++ b/packages/babel-parser/test/fixtures/core/scope/undecl-export-as/options.json @@ -1,4 +1,3 @@ { - "sourceType": "module", - "throws": "Export 'encrypt' is not defined (1:9)" + "sourceType": "module" } diff --git a/packages/babel-parser/test/fixtures/core/scope/undecl-export-as/output.json b/packages/babel-parser/test/fixtures/core/scope/undecl-export-as/output.json new file mode 100644 index 000000000000..11a778f34809 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/scope/undecl-export-as/output.json @@ -0,0 +1,158 @@ +{ + "type": "File", + "start": 0, + "end": 52, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 21 + } + }, + "errors": [ + "SyntaxError: Export 'encrypt' is not defined (1:9)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 52, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 21 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExportNamedDeclaration", + "start": 0, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "specifiers": [ + { + "type": "ExportSpecifier", + "start": 9, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "local": { + "type": "Identifier", + "start": 9, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 16 + }, + "identifierName": "encrypt" + }, + "name": "encrypt" + }, + "exported": { + "type": "Identifier", + "start": 20, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 27 + }, + "identifierName": "decrypt" + }, + "name": "decrypt" + } + } + ], + "source": null, + "declaration": null + }, + { + "type": "FunctionDeclaration", + "start": 31, + "end": 52, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 21 + } + }, + "id": { + "type": "Identifier", + "start": 40, + "end": 47, + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 16 + }, + "identifierName": "decrypt" + }, + "name": "decrypt" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 50, + "end": 52, + "loc": { + "start": { + "line": 2, + "column": 19 + }, + "end": { + "line": 2, + "column": 21 + } + }, + "body": [], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/scope/undecl-export-block/options.json b/packages/babel-parser/test/fixtures/core/scope/undecl-export-block/options.json index 0844d3e80e68..2104ca43283f 100644 --- a/packages/babel-parser/test/fixtures/core/scope/undecl-export-block/options.json +++ b/packages/babel-parser/test/fixtures/core/scope/undecl-export-block/options.json @@ -1,4 +1,3 @@ { - "sourceType": "module", - "throws": "Export 'encrypt' is not defined (4:9)" + "sourceType": "module" } diff --git a/packages/babel-parser/test/fixtures/core/scope/undecl-export-block/output.json b/packages/babel-parser/test/fixtures/core/scope/undecl-export-block/output.json new file mode 100644 index 000000000000..a660653865e5 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/scope/undecl-export-block/output.json @@ -0,0 +1,176 @@ +{ + "type": "File", + "start": 0, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 18 + } + }, + "errors": [ + "SyntaxError: Export 'encrypt' is not defined (4:9)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 18 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "BlockStatement", + "start": 0, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": [ + { + "type": "FunctionDeclaration", + "start": 4, + "end": 25, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 23 + } + }, + "id": { + "type": "Identifier", + "start": 13, + "end": 20, + "loc": { + "start": { + "line": 2, + "column": 11 + }, + "end": { + "line": 2, + "column": 18 + }, + "identifierName": "encrypt" + }, + "name": "encrypt" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 23, + "end": 25, + "loc": { + "start": { + "line": 2, + "column": 21 + }, + "end": { + "line": 2, + "column": 23 + } + }, + "body": [], + "directives": [] + } + } + ], + "directives": [] + }, + { + "type": "ExportNamedDeclaration", + "start": 28, + "end": 46, + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 4, + "column": 18 + } + }, + "specifiers": [ + { + "type": "ExportSpecifier", + "start": 37, + "end": 44, + "loc": { + "start": { + "line": 4, + "column": 9 + }, + "end": { + "line": 4, + "column": 16 + } + }, + "local": { + "type": "Identifier", + "start": 37, + "end": 44, + "loc": { + "start": { + "line": 4, + "column": 9 + }, + "end": { + "line": 4, + "column": 16 + }, + "identifierName": "encrypt" + }, + "name": "encrypt" + }, + "exported": { + "type": "Identifier", + "start": 37, + "end": 44, + "loc": { + "start": { + "line": 4, + "column": 9 + }, + "end": { + "line": 4, + "column": 16 + }, + "identifierName": "encrypt" + }, + "name": "encrypt" + } + } + ], + "source": null, + "declaration": null + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/scope/undecl-export-builtin-as/options.json b/packages/babel-parser/test/fixtures/core/scope/undecl-export-builtin-as/options.json index cbab70613300..2104ca43283f 100644 --- a/packages/babel-parser/test/fixtures/core/scope/undecl-export-builtin-as/options.json +++ b/packages/babel-parser/test/fixtures/core/scope/undecl-export-builtin-as/options.json @@ -1,4 +1,3 @@ { - "sourceType": "module", - "throws": "Export 'Object' is not defined (1:9)" + "sourceType": "module" } diff --git a/packages/babel-parser/test/fixtures/core/scope/undecl-export-builtin-as/output.json b/packages/babel-parser/test/fixtures/core/scope/undecl-export-builtin-as/output.json new file mode 100644 index 000000000000..ce100047f2fe --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/scope/undecl-export-builtin-as/output.json @@ -0,0 +1,106 @@ +{ + "type": "File", + "start": 0, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "errors": [ + "SyntaxError: Export 'Object' is not defined (1:9)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExportNamedDeclaration", + "start": 0, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "specifiers": [ + { + "type": "ExportSpecifier", + "start": 9, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "local": { + "type": "Identifier", + "start": 9, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 15 + }, + "identifierName": "Object" + }, + "name": "Object" + }, + "exported": { + "type": "Identifier", + "start": 19, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 22 + }, + "identifierName": "Obj" + }, + "name": "Obj" + } + } + ], + "source": null, + "declaration": null + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/scope/undecl-export-builtin/options.json b/packages/babel-parser/test/fixtures/core/scope/undecl-export-builtin/options.json index cbab70613300..2104ca43283f 100644 --- a/packages/babel-parser/test/fixtures/core/scope/undecl-export-builtin/options.json +++ b/packages/babel-parser/test/fixtures/core/scope/undecl-export-builtin/options.json @@ -1,4 +1,3 @@ { - "sourceType": "module", - "throws": "Export 'Object' is not defined (1:9)" + "sourceType": "module" } diff --git a/packages/babel-parser/test/fixtures/core/scope/undecl-export-builtin/output.json b/packages/babel-parser/test/fixtures/core/scope/undecl-export-builtin/output.json new file mode 100644 index 000000000000..22aa25d45da7 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/scope/undecl-export-builtin/output.json @@ -0,0 +1,106 @@ +{ + "type": "File", + "start": 0, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "errors": [ + "SyntaxError: Export 'Object' is not defined (1:9)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExportNamedDeclaration", + "start": 0, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "specifiers": [ + { + "type": "ExportSpecifier", + "start": 9, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "local": { + "type": "Identifier", + "start": 9, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 15 + }, + "identifierName": "Object" + }, + "name": "Object" + }, + "exported": { + "type": "Identifier", + "start": 9, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 15 + }, + "identifierName": "Object" + }, + "name": "Object" + } + } + ], + "source": null, + "declaration": null + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/scope/undecl-export-if/options.json b/packages/babel-parser/test/fixtures/core/scope/undecl-export-if/options.json index 2c97b3ce5a78..2104ca43283f 100644 --- a/packages/babel-parser/test/fixtures/core/scope/undecl-export-if/options.json +++ b/packages/babel-parser/test/fixtures/core/scope/undecl-export-if/options.json @@ -1,4 +1,3 @@ { - "sourceType": "module", - "throws": "In strict mode code, functions can only be declared at top level or inside a block (2:10)" + "sourceType": "module" } diff --git a/packages/babel-parser/test/fixtures/core/scope/undecl-export-if/output.json b/packages/babel-parser/test/fixtures/core/scope/undecl-export-if/output.json new file mode 100644 index 000000000000..dbff016172cc --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/scope/undecl-export-if/output.json @@ -0,0 +1,191 @@ +{ + "type": "File", + "start": 0, + "end": 51, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 31 + } + }, + "errors": [ + "SyntaxError: In strict mode code, functions can only be declared at top level or inside a block (2:10)", + "SyntaxError: Export 'encrypt' is not defined (1:9)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 51, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 31 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExportNamedDeclaration", + "start": 0, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "specifiers": [ + { + "type": "ExportSpecifier", + "start": 9, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "local": { + "type": "Identifier", + "start": 9, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 16 + }, + "identifierName": "encrypt" + }, + "name": "encrypt" + }, + "exported": { + "type": "Identifier", + "start": 9, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 16 + }, + "identifierName": "encrypt" + }, + "name": "encrypt" + } + } + ], + "source": null, + "declaration": null + }, + { + "type": "IfStatement", + "start": 20, + "end": 51, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 31 + } + }, + "test": { + "type": "BooleanLiteral", + "start": 24, + "end": 28, + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 8 + } + }, + "value": true + }, + "consequent": { + "type": "FunctionDeclaration", + "start": 30, + "end": 51, + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 31 + } + }, + "id": { + "type": "Identifier", + "start": 39, + "end": 46, + "loc": { + "start": { + "line": 2, + "column": 19 + }, + "end": { + "line": 2, + "column": 26 + }, + "identifierName": "encrypt" + }, + "name": "encrypt" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 49, + "end": 51, + "loc": { + "start": { + "line": 2, + "column": 29 + }, + "end": { + "line": 2, + "column": 31 + } + }, + "body": [], + "directives": [] + } + }, + "alternate": null + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/scope/undecl-export/options.json b/packages/babel-parser/test/fixtures/core/scope/undecl-export/options.json index 8448889cf253..2104ca43283f 100644 --- a/packages/babel-parser/test/fixtures/core/scope/undecl-export/options.json +++ b/packages/babel-parser/test/fixtures/core/scope/undecl-export/options.json @@ -1,4 +1,3 @@ { - "sourceType": "module", - "throws": "Export 'encrypt' is not defined (1:9)" + "sourceType": "module" } diff --git a/packages/babel-parser/test/fixtures/core/scope/undecl-export/output.json b/packages/babel-parser/test/fixtures/core/scope/undecl-export/output.json new file mode 100644 index 000000000000..6293e83f540f --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/scope/undecl-export/output.json @@ -0,0 +1,106 @@ +{ + "type": "File", + "start": 0, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "errors": [ + "SyntaxError: Export 'encrypt' is not defined (1:9)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExportNamedDeclaration", + "start": 0, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "specifiers": [ + { + "type": "ExportSpecifier", + "start": 9, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "local": { + "type": "Identifier", + "start": 9, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 16 + }, + "identifierName": "encrypt" + }, + "name": "encrypt" + }, + "exported": { + "type": "Identifier", + "start": 9, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 16 + }, + "identifierName": "encrypt" + }, + "name": "encrypt" + } + } + ], + "source": null, + "declaration": null + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/10/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/10/output.json index 3f7e070ca3ac..d2f456d828ab 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/10/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/10/output.json @@ -110,7 +110,10 @@ }, "value": 42 } - ] + ], + "extra": { + "trailingComma": 8 + } } } } diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/108/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/108/options.json deleted file mode 100644 index 080cb0eaaa8a..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/108/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid regular expression flag (1:17)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/108/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/108/output.json new file mode 100644 index 000000000000..65ac2b95f145 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/108/output.json @@ -0,0 +1,112 @@ +{ + "type": "File", + "start": 0, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "errors": [ + "SyntaxError: Invalid regular expression flag (1:17)", + "SyntaxError: Invalid regular expression flag (1:19)", + "SyntaxError: Invalid regular expression flag (1:20)", + "SyntaxError: Invalid regular expression flag (1:21)", + "SyntaxError: Invalid regular expression flag (1:22)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 0, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 4, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "id": { + "type": "Identifier", + "start": 4, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + }, + "identifierName": "x" + }, + "name": "x" + }, + "init": { + "type": "RegExpLiteral", + "start": 8, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "extra": { + "raw": "/[P QR]/\\u0067" + }, + "pattern": "[P QR]", + "flags": "\\u0067" + } + } + ], + "kind": "var" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/12/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/12/output.json index 573eda5bfa9f..0c39b167df03 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/12/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/12/output.json @@ -150,7 +150,10 @@ }, "value": 3 } - ] + ], + "extra": { + "trailingComma": 13 + } } } } diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/13/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/13/output.json index 34c8d7e15c8e..c2fec5bfcf25 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/13/output.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/13/output.json @@ -151,7 +151,10 @@ }, "value": 3 } - ] + ], + "extra": { + "trailingComma": 14 + } } } } diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/347/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/347/options.json index 91bb1eef0c0d..ee18527964e7 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/347/options.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/347/options.json @@ -1,3 +1,3 @@ { - "throws": "Invalid number (1:0)" + "throws": "Identifier directly after number (1:2)" } diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/349/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/349/options.json deleted file mode 100644 index 91bb1eef0c0d..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/349/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid number (1:0)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/349/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/349/output.json new file mode 100644 index 000000000000..284fac8c4357 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/349/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start": 0, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "errors": [ + "SyntaxError: Invalid number (1:0)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 0, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "extra": { + "rawValue": 3, + "raw": "3e" + }, + "value": 3 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/350/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/350/options.json deleted file mode 100644 index 91bb1eef0c0d..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/350/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid number (1:0)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/350/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/350/output.json new file mode 100644 index 000000000000..6b6e666b00ca --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/350/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "errors": [ + "SyntaxError: Invalid number (1:0)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "extra": { + "rawValue": 3, + "raw": "3e+" + }, + "value": 3 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/351/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/351/options.json deleted file mode 100644 index 91bb1eef0c0d..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/351/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid number (1:0)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/351/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/351/output.json new file mode 100644 index 000000000000..b52b27d1ef37 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/351/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "errors": [ + "SyntaxError: Invalid number (1:0)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "extra": { + "rawValue": 3, + "raw": "3e-" + }, + "value": 3 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/354/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/354/options.json deleted file mode 100644 index 1a0693338eee..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/354/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Expected number in radix 16 (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/354/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/354/output.json new file mode 100644 index 000000000000..ffcb3680fd0b --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/354/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start": 0, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "errors": [ + "SyntaxError: Expected number in radix 16 (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 0, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "extra": { + "rawValue": null, + "raw": "0x" + }, + "value": null + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/361/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/361/options.json deleted file mode 100644 index 18c53b997b56..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/361/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Expecting Unicode escape sequence \\uXXXX (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/361/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/361/output.json new file mode 100644 index 000000000000..fbb1d3b5d554 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/361/output.json @@ -0,0 +1,70 @@ +{ + "type": "File", + "start": 0, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "errors": [ + "SyntaxError: Expecting Unicode escape sequence \\uXXXX (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "expression": { + "type": "Identifier", + "start": 0, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + }, + "identifierName": "xx\\" + }, + "name": "xx\\" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/362/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/362/options.json deleted file mode 100644 index ea7ba01dc69c..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/362/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid Unicode escape (1:1)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/362/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/362/output.json new file mode 100644 index 000000000000..fae32b78cde4 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/362/output.json @@ -0,0 +1,70 @@ +{ + "type": "File", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "errors": [ + "SyntaxError: Invalid Unicode escape (1:1)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "expression": { + "type": "Identifier", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "x\\" + }, + "name": "x\\" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/363/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/363/options.json deleted file mode 100644 index ea7ba01dc69c..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/363/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid Unicode escape (1:1)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/363/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/363/output.json new file mode 100644 index 000000000000..37312f42ce97 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/363/output.json @@ -0,0 +1,70 @@ +{ + "type": "File", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "errors": [ + "SyntaxError: Invalid Unicode escape (1:1)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "expression": { + "type": "Identifier", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "x*" + }, + "name": "x*" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/366/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/366/options.json deleted file mode 100644 index adf556b0a352..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/366/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid regular expression flag (1:16)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/366/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/366/output.json new file mode 100644 index 000000000000..68d637a98170 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/366/output.json @@ -0,0 +1,109 @@ +{ + "type": "File", + "start": 0, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "errors": [ + "SyntaxError: Invalid regular expression flag (1:16)", + "SyntaxError: Invalid regular expression flag (1:18)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 0, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 4, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "id": { + "type": "Identifier", + "start": 4, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + }, + "identifierName": "x" + }, + "name": "x" + }, + "init": { + "type": "RegExpLiteral", + "start": 8, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "extra": { + "raw": "/[a-z]/\\ux" + }, + "pattern": "[a-z]", + "flags": "\\ux" + } + } + ], + "kind": "var" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/367/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/367/options.json deleted file mode 100644 index 6010e96ed144..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/367/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid left-hand side in assignment expression (1:0)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/367/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/367/output.json new file mode 100644 index 000000000000..99a3e74a04af --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/367/output.json @@ -0,0 +1,109 @@ +{ + "type": "File", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "errors": [ + "SyntaxError: Invalid left-hand side in assignment expression (1:0)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "operator": "=", + "left": { + "type": "NumericLiteral", + "start": 0, + "end": 1, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + }, + "extra": { + "rawValue": 3, + "raw": "3" + }, + "value": 3 + }, + "right": { + "type": "NumericLiteral", + "start": 4, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "extra": { + "rawValue": 4, + "raw": "4" + }, + "value": 4 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/368/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/368/options.json deleted file mode 100644 index 6010e96ed144..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/368/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid left-hand side in assignment expression (1:0)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/368/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/368/output.json new file mode 100644 index 000000000000..8770df4abba7 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/368/output.json @@ -0,0 +1,122 @@ +{ + "type": "File", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "errors": [ + "SyntaxError: Invalid left-hand side in assignment expression (1:0)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "operator": "=", + "left": { + "type": "CallExpression", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "callee": { + "type": "Identifier", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + }, + "identifierName": "func" + }, + "name": "func" + }, + "arguments": [] + }, + "right": { + "type": "NumericLiteral", + "start": 9, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "extra": { + "rawValue": 4, + "raw": "4" + }, + "value": 4 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/369/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/369/options.json deleted file mode 100644 index 7c5f08eb9ba6..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/369/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid left-hand side in assignment expression (1:1)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/369/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/369/output.json new file mode 100644 index 000000000000..ec3792255a15 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/369/output.json @@ -0,0 +1,150 @@ +{ + "type": "File", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "errors": [ + "SyntaxError: Invalid parenthesized assignment pattern (1:1)", + "SyntaxError: Invalid left-hand side in assignment expression (1:1)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "operator": "=", + "left": { + "type": "BinaryExpression", + "start": 1, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "left": { + "type": "NumericLiteral", + "start": 1, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + }, + "operator": "+", + "right": { + "type": "NumericLiteral", + "start": 5, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + }, + "extra": { + "parenthesized": true, + "parenStart": 0 + } + }, + "right": { + "type": "NumericLiteral", + "start": 10, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "extra": { + "rawValue": 10, + "raw": "10" + }, + "value": 10 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/370/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/370/options.json deleted file mode 100644 index c09dac1301de..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/370/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid left-hand side in postfix operation (1:0)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/370/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/370/output.json new file mode 100644 index 000000000000..ce2cb3d23d67 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/370/output.json @@ -0,0 +1,90 @@ +{ + "type": "File", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "errors": [ + "SyntaxError: Invalid left-hand side in postfix operation (1:0)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "expression": { + "type": "UpdateExpression", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "operator": "++", + "prefix": false, + "argument": { + "type": "NumericLiteral", + "start": 0, + "end": 1, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/371/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/371/options.json deleted file mode 100644 index c09dac1301de..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/371/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid left-hand side in postfix operation (1:0)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/371/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/371/output.json new file mode 100644 index 000000000000..57d55fec0b5d --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/371/output.json @@ -0,0 +1,90 @@ +{ + "type": "File", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "errors": [ + "SyntaxError: Invalid left-hand side in postfix operation (1:0)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "expression": { + "type": "UpdateExpression", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "operator": "--", + "prefix": false, + "argument": { + "type": "NumericLiteral", + "start": 0, + "end": 1, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/372/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/372/options.json deleted file mode 100644 index 515e441e8ea7..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/372/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid left-hand side in prefix operation (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/372/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/372/output.json new file mode 100644 index 000000000000..9a7a240c5b4a --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/372/output.json @@ -0,0 +1,90 @@ +{ + "type": "File", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "errors": [ + "SyntaxError: Invalid left-hand side in prefix operation (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "expression": { + "type": "UpdateExpression", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "operator": "++", + "prefix": true, + "argument": { + "type": "NumericLiteral", + "start": 2, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/373/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/373/options.json deleted file mode 100644 index 515e441e8ea7..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/373/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid left-hand side in prefix operation (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/373/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/373/output.json new file mode 100644 index 000000000000..85107220dae5 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/373/output.json @@ -0,0 +1,90 @@ +{ + "type": "File", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "errors": [ + "SyntaxError: Invalid left-hand side in prefix operation (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "expression": { + "type": "UpdateExpression", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "operator": "--", + "prefix": true, + "argument": { + "type": "NumericLiteral", + "start": 2, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/374/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/374/options.json deleted file mode 100644 index f8560a7de9d6..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/374/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid left-hand side in for-in statement (1:5)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/374/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/374/output.json new file mode 100644 index 000000000000..6cbd0876600e --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/374/output.json @@ -0,0 +1,197 @@ +{ + "type": "File", + "start": 0, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "errors": [ + "SyntaxError: Invalid parenthesized assignment pattern (1:5)", + "SyntaxError: Invalid left-hand side in for-in statement (1:5)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ForInStatement", + "start": 0, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "left": { + "type": "BinaryExpression", + "start": 5, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "left": { + "type": "NumericLiteral", + "start": 5, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + }, + "operator": "+", + "right": { + "type": "NumericLiteral", + "start": 9, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + }, + "extra": { + "parenthesized": true, + "parenStart": 4 + } + }, + "right": { + "type": "Identifier", + "start": 15, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 19 + }, + "identifierName": "list" + }, + "name": "list" + }, + "body": { + "type": "ExpressionStatement", + "start": 21, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "expression": { + "type": "CallExpression", + "start": 21, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "callee": { + "type": "Identifier", + "start": 21, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 28 + }, + "identifierName": "process" + }, + "name": "process" + }, + "arguments": [ + { + "type": "Identifier", + "start": 29, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 30 + }, + "identifierName": "x" + }, + "name": "x" + } + ] + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/382/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/382/options.json deleted file mode 100644 index 2b91be8d5115..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/382/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected keyword 'if' (1:4)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/382/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/382/output.json new file mode 100644 index 000000000000..ac910291b748 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/382/output.json @@ -0,0 +1,108 @@ +{ + "type": "File", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "errors": [ + "SyntaxError: Unexpected keyword 'if' (1:4)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 4, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "id": { + "type": "Identifier", + "start": 4, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 6 + }, + "identifierName": "if" + }, + "name": "if" + }, + "init": { + "type": "NumericLiteral", + "start": 9, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "extra": { + "rawValue": 42, + "raw": "42" + }, + "value": 42 + } + } + ], + "kind": "var" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/383/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/383/options.json deleted file mode 100644 index 6010e96ed144..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/383/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid left-hand side in assignment expression (1:0)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/383/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/383/output.json new file mode 100644 index 000000000000..56547ff7be13 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/383/output.json @@ -0,0 +1,142 @@ +{ + "type": "File", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "errors": [ + "SyntaxError: Invalid left-hand side in assignment expression (1:0)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "operator": "=", + "left": { + "type": "BinaryExpression", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "left": { + "type": "Identifier", + "start": 0, + "end": 1, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + }, + "identifierName": "i" + }, + "name": "i" + }, + "operator": "+", + "right": { + "type": "NumericLiteral", + "start": 4, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "extra": { + "rawValue": 2, + "raw": "2" + }, + "value": 2 + } + }, + "right": { + "type": "NumericLiteral", + "start": 8, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "extra": { + "rawValue": 42, + "raw": "42" + }, + "value": 42 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/384/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/384/options.json deleted file mode 100644 index 6010e96ed144..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/384/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid left-hand side in assignment expression (1:0)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/384/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/384/output.json new file mode 100644 index 000000000000..ece139488ea0 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/384/output.json @@ -0,0 +1,123 @@ +{ + "type": "File", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "errors": [ + "SyntaxError: Invalid left-hand side in assignment expression (1:0)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "operator": "=", + "left": { + "type": "UnaryExpression", + "start": 0, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "operator": "+", + "prefix": true, + "argument": { + "type": "Identifier", + "start": 1, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + }, + "identifierName": "i" + }, + "name": "i" + } + }, + "right": { + "type": "NumericLiteral", + "start": 5, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "extra": { + "rawValue": 42, + "raw": "42" + }, + "value": 42 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/397/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/397/options.json deleted file mode 100644 index f9543317a817..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/397/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected keyword 'if' (1:11)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/397/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/397/output.json new file mode 100644 index 000000000000..0e5a7503ecdd --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/397/output.json @@ -0,0 +1,108 @@ +{ + "type": "File", + "start": 0, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "errors": [ + "SyntaxError: Unexpected keyword 'if' (1:11)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + }, + "identifierName": "t" + }, + "name": "t" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 11, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 13 + }, + "identifierName": "if" + }, + "name": "if" + } + ], + "body": { + "type": "BlockStatement", + "start": 15, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "body": [], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/398/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/398/options.json deleted file mode 100644 index bba7a057d842..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/398/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected keyword 'true' (1:11)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/398/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/398/output.json new file mode 100644 index 000000000000..9da054e4ab90 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/398/output.json @@ -0,0 +1,108 @@ +{ + "type": "File", + "start": 0, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "errors": [ + "SyntaxError: Unexpected keyword 'true' (1:11)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + }, + "identifierName": "t" + }, + "name": "t" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 11, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 15 + }, + "identifierName": "true" + }, + "name": "true" + } + ], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "body": [], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/399/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/399/options.json deleted file mode 100644 index b04b18396af1..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/399/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected keyword 'false' (1:11)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/399/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/399/output.json new file mode 100644 index 000000000000..f4f5b906e9c7 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/399/output.json @@ -0,0 +1,108 @@ +{ + "type": "File", + "start": 0, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "errors": [ + "SyntaxError: Unexpected keyword 'false' (1:11)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + }, + "identifierName": "t" + }, + "name": "t" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 11, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 16 + }, + "identifierName": "false" + }, + "name": "false" + } + ], + "body": { + "type": "BlockStatement", + "start": 18, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "body": [], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/400/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/400/options.json deleted file mode 100644 index 667f2cc8816d..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/400/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected keyword 'null' (1:11)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/400/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/400/output.json new file mode 100644 index 000000000000..b8eaca925ad4 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/400/output.json @@ -0,0 +1,108 @@ +{ + "type": "File", + "start": 0, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "errors": [ + "SyntaxError: Unexpected keyword 'null' (1:11)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + }, + "identifierName": "t" + }, + "name": "t" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 11, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 15 + }, + "identifierName": "null" + }, + "name": "null" + } + ], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "body": [], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/401/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/401/options.json deleted file mode 100644 index fa57d4f43f70..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/401/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected keyword 'null' (1:9)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/401/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/401/output.json new file mode 100644 index 000000000000..3fea78461b66 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/401/output.json @@ -0,0 +1,90 @@ +{ + "type": "File", + "start": 0, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "errors": [ + "SyntaxError: Unexpected keyword 'null' (1:9)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 13 + }, + "identifierName": "null" + }, + "name": "null" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 16, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "body": [], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/402/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/402/options.json deleted file mode 100644 index c4a7ead13704..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/402/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected keyword 'true' (1:9)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/402/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/402/output.json new file mode 100644 index 000000000000..fc0c10f2f765 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/402/output.json @@ -0,0 +1,90 @@ +{ + "type": "File", + "start": 0, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "errors": [ + "SyntaxError: Unexpected keyword 'true' (1:9)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 13 + }, + "identifierName": "true" + }, + "name": "true" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 16, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "body": [], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/403/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/403/options.json deleted file mode 100644 index 0e9cf8962aae..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/403/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected keyword 'false' (1:9)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/403/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/403/output.json new file mode 100644 index 000000000000..7e708faf3684 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/403/output.json @@ -0,0 +1,90 @@ +{ + "type": "File", + "start": 0, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "errors": [ + "SyntaxError: Unexpected keyword 'false' (1:9)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "false" + }, + "name": "false" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "body": [], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/404/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/404/options.json deleted file mode 100644 index a87aa98c0e01..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/404/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected keyword 'if' (1:9)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/404/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/404/output.json new file mode 100644 index 000000000000..813c4e9b903a --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/404/output.json @@ -0,0 +1,90 @@ +{ + "type": "File", + "start": 0, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "errors": [ + "SyntaxError: Unexpected keyword 'if' (1:9)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 11 + }, + "identifierName": "if" + }, + "name": "if" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 14, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "body": [], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/409/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/409/options.json deleted file mode 100644 index 701f9fe8f27a..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/409/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unsyntactic break (1:0)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/409/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/409/output.json new file mode 100644 index 000000000000..d3a105c584dd --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/409/output.json @@ -0,0 +1,54 @@ +{ + "type": "File", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "errors": [ + "SyntaxError: Unsyntactic break (1:0)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "BreakStatement", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "label": null + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/411/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/411/options.json deleted file mode 100644 index de66853a7a3d..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/411/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unsyntactic continue (1:0)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/411/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/411/output.json new file mode 100644 index 000000000000..c32c5b089115 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/411/output.json @@ -0,0 +1,54 @@ +{ + "type": "File", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "errors": [ + "SyntaxError: Unsyntactic continue (1:0)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ContinueStatement", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "label": null + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/417/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/417/options.json deleted file mode 100644 index f8560a7de9d6..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/417/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid left-hand side in for-in statement (1:5)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/417/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/417/output.json new file mode 100644 index 000000000000..3844a4d151a7 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/417/output.json @@ -0,0 +1,137 @@ +{ + "type": "File", + "start": 0, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "errors": [ + "SyntaxError: Invalid left-hand side in for-in statement (1:5)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ForInStatement", + "start": 0, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "left": { + "type": "BinaryExpression", + "start": 5, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "left": { + "type": "Identifier", + "start": 5, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + }, + "identifierName": "i" + }, + "name": "i" + }, + "operator": "+", + "right": { + "type": "NumericLiteral", + "start": 9, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + }, + "right": { + "type": "ObjectExpression", + "start": 14, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "properties": [] + }, + "body": { + "type": "EmptyStatement", + "start": 17, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/418/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/418/options.json deleted file mode 100644 index f8560a7de9d6..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/418/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid left-hand side in for-in statement (1:5)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/418/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/418/output.json new file mode 100644 index 000000000000..9d008175f644 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/418/output.json @@ -0,0 +1,118 @@ +{ + "type": "File", + "start": 0, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "errors": [ + "SyntaxError: Invalid left-hand side in for-in statement (1:5)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ForInStatement", + "start": 0, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "left": { + "type": "UnaryExpression", + "start": 5, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "operator": "+", + "prefix": true, + "argument": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "i" + }, + "name": "i" + } + }, + "right": { + "type": "ObjectExpression", + "start": 11, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "properties": [] + }, + "body": { + "type": "EmptyStatement", + "start": 14, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/425/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/425/options.json deleted file mode 100644 index 429d96ca3f9a..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/425/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Missing catch or finally clause (1:0)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/425/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/425/output.json new file mode 100644 index 000000000000..3d2ee0555b85 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/425/output.json @@ -0,0 +1,72 @@ +{ + "type": "File", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "errors": [ + "SyntaxError: Missing catch or finally clause (1:0)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "TryStatement", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "block": { + "type": "BlockStatement", + "start": 4, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "body": [], + "directives": [] + }, + "handler": null, + "finalizer": null + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/427/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/427/options.json deleted file mode 100644 index aadfa63716c2..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/427/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Multiple default clauses (1:22)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/427/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/427/output.json new file mode 100644 index 000000000000..c90c4eefdc6f --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/427/output.json @@ -0,0 +1,106 @@ +{ + "type": "File", + "start": 0, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "errors": [ + "SyntaxError: Multiple default clauses (1:22)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "SwitchStatement", + "start": 0, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "discriminant": { + "type": "Identifier", + "start": 8, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + }, + "identifierName": "c" + }, + "name": "c" + }, + "cases": [ + { + "type": "SwitchCase", + "start": 13, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "consequent": [], + "test": null + }, + { + "type": "SwitchCase", + "start": 22, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "consequent": [], + "test": null + } + ] + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/446/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/446/options.json deleted file mode 100644 index 381fd12ce2d0..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/446/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Expecting Unicode escape sequence \\uXXXX (1:1)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/446/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/446/output.json new file mode 100644 index 000000000000..1db488318bdf --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/446/output.json @@ -0,0 +1,71 @@ +{ + "type": "File", + "start": 0, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "errors": [ + "SyntaxError: Expecting Unicode escape sequence \\uXXXX (1:1)", + "SyntaxError: Expecting Unicode escape sequence \\uXXXX (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "expression": { + "type": "Identifier", + "start": 0, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + }, + "identifierName": "\\\\\\" + }, + "name": "\\\\\\" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/447/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/447/options.json deleted file mode 100644 index 82bcfe621c49..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/447/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid Unicode escape (1:0)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/447/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/447/output.json new file mode 100644 index 000000000000..d44909ca998a --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/447/output.json @@ -0,0 +1,70 @@ +{ + "type": "File", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "errors": [ + "SyntaxError: Invalid Unicode escape (1:0)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "expression": { + "type": "Identifier", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + }, + "identifierName": "\\" + }, + "name": "\\" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/448/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/448/options.json deleted file mode 100644 index 381fd12ce2d0..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/448/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Expecting Unicode escape sequence \\uXXXX (1:1)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/448/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/448/output.json new file mode 100644 index 000000000000..38cc0c05b021 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/448/output.json @@ -0,0 +1,70 @@ +{ + "type": "File", + "start": 0, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "errors": [ + "SyntaxError: Expecting Unicode escape sequence \\uXXXX (1:1)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "expression": { + "type": "Identifier", + "start": 0, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + }, + "identifierName": "\\x" + }, + "name": "\\x" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/449/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/449/options.json deleted file mode 100644 index 82bcfe621c49..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/449/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid Unicode escape (1:0)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/449/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/449/output.json new file mode 100644 index 000000000000..380e6ec698ef --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/449/output.json @@ -0,0 +1,70 @@ +{ + "type": "File", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "errors": [ + "SyntaxError: Invalid Unicode escape (1:0)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "expression": { + "type": "Identifier", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + }, + "identifierName": "\u0000" + }, + "name": "\u0000" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/453/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/453/options.json index 8e0dce66eff8..d732a1630991 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/453/options.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/453/options.json @@ -1,3 +1,3 @@ { - "throws": "Bad character escape sequence (1:3)" + "throws": "Unterminated string constant (1:0)" } diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/454/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/454/options.json deleted file mode 100644 index f9d29c7f328c..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/454/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "'return' outside of function (1:0)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/454/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/454/output.json new file mode 100644 index 000000000000..e43da2374537 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/454/output.json @@ -0,0 +1,54 @@ +{ + "type": "File", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "errors": [ + "SyntaxError: 'return' outside of function (1:0)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ReturnStatement", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "argument": null + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/455/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/455/options.json deleted file mode 100644 index 701f9fe8f27a..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/455/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unsyntactic break (1:0)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/455/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/455/output.json new file mode 100644 index 000000000000..d3a105c584dd --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/455/output.json @@ -0,0 +1,54 @@ +{ + "type": "File", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "errors": [ + "SyntaxError: Unsyntactic break (1:0)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "BreakStatement", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "label": null + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/456/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/456/options.json deleted file mode 100644 index de66853a7a3d..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/456/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unsyntactic continue (1:0)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/456/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/456/output.json new file mode 100644 index 000000000000..c32c5b089115 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/456/output.json @@ -0,0 +1,54 @@ +{ + "type": "File", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "errors": [ + "SyntaxError: Unsyntactic continue (1:0)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ContinueStatement", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "label": null + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/457/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/457/options.json deleted file mode 100644 index c726e8fa98e4..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/457/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unsyntactic continue (1:22)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/457/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/457/output.json new file mode 100644 index 000000000000..b83145faf5ab --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/457/output.json @@ -0,0 +1,106 @@ +{ + "type": "File", + "start": 0, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "errors": [ + "SyntaxError: Unsyntactic continue (1:22)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "SwitchStatement", + "start": 0, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "discriminant": { + "type": "Identifier", + "start": 8, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + }, + "identifierName": "x" + }, + "name": "x" + }, + "cases": [ + { + "type": "SwitchCase", + "start": 13, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "consequent": [ + { + "type": "ContinueStatement", + "start": 22, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "label": null + } + ], + "test": null + } + ] + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/459/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/459/options.json deleted file mode 100644 index 070e662e80d4..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/459/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unsyntactic break (1:15)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/459/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/459/output.json new file mode 100644 index 000000000000..a7c8d4f9a0ca --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/459/output.json @@ -0,0 +1,119 @@ +{ + "type": "File", + "start": 0, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "errors": [ + "SyntaxError: Unsyntactic break (1:15)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "WhileStatement", + "start": 0, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "test": { + "type": "BooleanLiteral", + "start": 7, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "value": true + }, + "body": { + "type": "BlockStatement", + "start": 13, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "body": [ + { + "type": "BreakStatement", + "start": 15, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "label": { + "type": "Identifier", + "start": 21, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + }, + "identifierName": "x" + }, + "name": "x" + } + } + ], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/460/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/460/options.json deleted file mode 100644 index 2a2e15787aa7..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/460/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unsyntactic continue (1:15)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/460/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/460/output.json new file mode 100644 index 000000000000..2f1c8737b22e --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/460/output.json @@ -0,0 +1,119 @@ +{ + "type": "File", + "start": 0, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "errors": [ + "SyntaxError: Unsyntactic continue (1:15)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "WhileStatement", + "start": 0, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "test": { + "type": "BooleanLiteral", + "start": 7, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "value": true + }, + "body": { + "type": "BlockStatement", + "start": 13, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "body": [ + { + "type": "ContinueStatement", + "start": 15, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "label": { + "type": "Identifier", + "start": 24, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 + }, + "identifierName": "x" + }, + "name": "x" + } + } + ], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/461/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/461/options.json deleted file mode 100644 index 464af80a1561..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/461/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unsyntactic break (1:33)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/461/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/461/output.json new file mode 100644 index 000000000000..7337acd3e8fd --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/461/output.json @@ -0,0 +1,207 @@ +{ + "type": "File", + "start": 0, + "end": 47, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 47 + } + }, + "errors": [ + "SyntaxError: Unsyntactic break (1:33)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 47, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 47 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "LabeledStatement", + "start": 0, + "end": 47, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 47 + } + }, + "body": { + "type": "WhileStatement", + "start": 3, + "end": 47, + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 47 + } + }, + "test": { + "type": "BooleanLiteral", + "start": 10, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "value": true + }, + "body": { + "type": "BlockStatement", + "start": 16, + "end": 47, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 47 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 18, + "end": 45, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 45 + } + }, + "expression": { + "type": "FunctionExpression", + "start": 19, + "end": 43, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 43 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 31, + "end": 43, + "loc": { + "start": { + "line": 1, + "column": 31 + }, + "end": { + "line": 1, + "column": 43 + } + }, + "body": [ + { + "type": "BreakStatement", + "start": 33, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 41 + } + }, + "label": { + "type": "Identifier", + "start": 39, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 39 + }, + "end": { + "line": 1, + "column": 40 + }, + "identifierName": "x" + }, + "name": "x" + } + } + ], + "directives": [] + }, + "extra": { + "parenthesized": true, + "parenStart": 18 + } + } + } + ], + "directives": [] + } + }, + "label": { + "type": "Identifier", + "start": 0, + "end": 1, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + }, + "identifierName": "x" + }, + "name": "x" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/462/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/462/options.json deleted file mode 100644 index a056cb50e190..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/462/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unsyntactic continue (1:33)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/462/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/462/output.json new file mode 100644 index 000000000000..18bc9b977ca7 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/462/output.json @@ -0,0 +1,207 @@ +{ + "type": "File", + "start": 0, + "end": 50, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 50 + } + }, + "errors": [ + "SyntaxError: Unsyntactic continue (1:33)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 50, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 50 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "LabeledStatement", + "start": 0, + "end": 50, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 50 + } + }, + "body": { + "type": "WhileStatement", + "start": 3, + "end": 50, + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 50 + } + }, + "test": { + "type": "BooleanLiteral", + "start": 10, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "value": true + }, + "body": { + "type": "BlockStatement", + "start": 16, + "end": 50, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 50 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 18, + "end": 48, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 48 + } + }, + "expression": { + "type": "FunctionExpression", + "start": 19, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 46 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 31, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 31 + }, + "end": { + "line": 1, + "column": 46 + } + }, + "body": [ + { + "type": "ContinueStatement", + "start": 33, + "end": 44, + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 44 + } + }, + "label": { + "type": "Identifier", + "start": 42, + "end": 43, + "loc": { + "start": { + "line": 1, + "column": 42 + }, + "end": { + "line": 1, + "column": 43 + }, + "identifierName": "x" + }, + "name": "x" + } + } + ], + "directives": [] + }, + "extra": { + "parenthesized": true, + "parenStart": 18 + } + } + } + ], + "directives": [] + } + }, + "label": { + "type": "Identifier", + "start": 0, + "end": 1, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + }, + "identifierName": "x" + }, + "name": "x" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/463/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/463/options.json deleted file mode 100644 index 464af80a1561..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/463/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unsyntactic break (1:33)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/463/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/463/output.json new file mode 100644 index 000000000000..59ae007d6fba --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/463/output.json @@ -0,0 +1,191 @@ +{ + "type": "File", + "start": 0, + "end": 45, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 45 + } + }, + "errors": [ + "SyntaxError: Unsyntactic break (1:33)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 45, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 45 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "LabeledStatement", + "start": 0, + "end": 45, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 45 + } + }, + "body": { + "type": "WhileStatement", + "start": 3, + "end": 45, + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 45 + } + }, + "test": { + "type": "BooleanLiteral", + "start": 10, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "value": true + }, + "body": { + "type": "BlockStatement", + "start": 16, + "end": 45, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 45 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 18, + "end": 43, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 43 + } + }, + "expression": { + "type": "FunctionExpression", + "start": 19, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 41 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 31, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 31 + }, + "end": { + "line": 1, + "column": 41 + } + }, + "body": [ + { + "type": "BreakStatement", + "start": 33, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "label": null + } + ], + "directives": [] + }, + "extra": { + "parenthesized": true, + "parenStart": 18 + } + } + } + ], + "directives": [] + } + }, + "label": { + "type": "Identifier", + "start": 0, + "end": 1, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + }, + "identifierName": "x" + }, + "name": "x" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/464/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/464/options.json deleted file mode 100644 index a056cb50e190..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/464/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unsyntactic continue (1:33)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/464/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/464/output.json new file mode 100644 index 000000000000..d26e37b08031 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/464/output.json @@ -0,0 +1,191 @@ +{ + "type": "File", + "start": 0, + "end": 48, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 48 + } + }, + "errors": [ + "SyntaxError: Unsyntactic continue (1:33)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 48, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 48 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "LabeledStatement", + "start": 0, + "end": 48, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 48 + } + }, + "body": { + "type": "WhileStatement", + "start": 3, + "end": 48, + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 48 + } + }, + "test": { + "type": "BooleanLiteral", + "start": 10, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "value": true + }, + "body": { + "type": "BlockStatement", + "start": 16, + "end": 48, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 48 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 18, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 46 + } + }, + "expression": { + "type": "FunctionExpression", + "start": 19, + "end": 44, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 44 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 31, + "end": 44, + "loc": { + "start": { + "line": 1, + "column": 31 + }, + "end": { + "line": 1, + "column": 44 + } + }, + "body": [ + { + "type": "ContinueStatement", + "start": 33, + "end": 42, + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 42 + } + }, + "label": null + } + ], + "directives": [] + }, + "extra": { + "parenthesized": true, + "parenStart": 18 + } + } + } + ], + "directives": [] + } + }, + "label": { + "type": "Identifier", + "start": 0, + "end": 1, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + }, + "identifierName": "x" + }, + "name": "x" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/465/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/465/options.json deleted file mode 100644 index da7f2590db0b..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/465/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Label 'x' is already declared (1:18)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/465/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/465/output.json new file mode 100644 index 000000000000..3025d6bfbf72 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/465/output.json @@ -0,0 +1,199 @@ +{ + "type": "File", + "start": 0, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "errors": [ + "SyntaxError: Label 'x' is already declared (1:18)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "LabeledStatement", + "start": 0, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "body": { + "type": "WhileStatement", + "start": 3, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "test": { + "type": "BooleanLiteral", + "start": 10, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "value": true + }, + "body": { + "type": "BlockStatement", + "start": 16, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "body": [ + { + "type": "LabeledStatement", + "start": 18, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "body": { + "type": "WhileStatement", + "start": 21, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "test": { + "type": "BooleanLiteral", + "start": 28, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "value": true + }, + "body": { + "type": "BlockStatement", + "start": 34, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 34 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "body": [], + "directives": [] + } + }, + "label": { + "type": "Identifier", + "start": 18, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + }, + "identifierName": "x" + }, + "name": "x" + } + } + ], + "directives": [] + } + }, + "label": { + "type": "Identifier", + "start": 0, + "end": 1, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + }, + "identifierName": "x" + }, + "name": "x" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/466/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/466/options.json deleted file mode 100644 index 1517e1719333..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/466/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Deleting local variable in strict mode (1:29)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/466/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/466/output.json new file mode 100644 index 000000000000..f22f0efb0609 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/466/output.json @@ -0,0 +1,195 @@ +{ + "type": "File", + "start": 0, + "end": 43, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 43 + } + }, + "errors": [ + "SyntaxError: Deleting local variable in strict mode (1:29)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 43, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 43 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 43, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 43 + } + }, + "expression": { + "type": "CallExpression", + "start": 1, + "end": 42, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 42 + } + }, + "callee": { + "type": "FunctionExpression", + "start": 1, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 40 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 13, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 40 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 29, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 38 + } + }, + "expression": { + "type": "UnaryExpression", + "start": 29, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "operator": "delete", + "prefix": true, + "argument": { + "type": "Identifier", + "start": 36, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 36 + }, + "end": { + "line": 1, + "column": 37 + }, + "identifierName": "i" + }, + "name": "i" + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 15, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 15, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + }, + "arguments": [], + "extra": { + "parenthesized": true, + "parenStart": 0 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/467/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/467/options.json deleted file mode 100644 index 31b4c6d2a040..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/467/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "'with' in strict mode (1:29)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/467/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/467/output.json new file mode 100644 index 000000000000..1567b18881d6 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/467/output.json @@ -0,0 +1,193 @@ +{ + "type": "File", + "start": 0, + "end": 43, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 43 + } + }, + "errors": [ + "SyntaxError: 'with' in strict mode (1:29)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 43, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 43 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 43, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 43 + } + }, + "expression": { + "type": "CallExpression", + "start": 1, + "end": 42, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 42 + } + }, + "callee": { + "type": "FunctionExpression", + "start": 1, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 40 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 13, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 40 + } + }, + "body": [ + { + "type": "WithStatement", + "start": 29, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 38 + } + }, + "object": { + "type": "Identifier", + "start": 35, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 35 + }, + "end": { + "line": 1, + "column": 36 + }, + "identifierName": "i" + }, + "name": "i" + }, + "body": { + "type": "EmptyStatement", + "start": 37, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 38 + } + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 15, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 15, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + }, + "arguments": [], + "extra": { + "parenthesized": true, + "parenStart": 0 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/468/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/468/options.json deleted file mode 100644 index b463f315f9eb..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/468/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'eval' in strict mode (1:36)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/468/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/468/output.json new file mode 100644 index 000000000000..7598b7431e9f --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/468/output.json @@ -0,0 +1,197 @@ +{ + "type": "File", + "start": 0, + "end": 48, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 48 + } + }, + "errors": [ + "SyntaxError: Binding 'eval' in strict mode (1:36)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 48, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 48 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 48, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 48 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "hello" + }, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 48, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 48 + } + }, + "body": [ + { + "type": "VariableDeclaration", + "start": 32, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 46 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 36, + "end": 45, + "loc": { + "start": { + "line": 1, + "column": 36 + }, + "end": { + "line": 1, + "column": 45 + } + }, + "id": { + "type": "Identifier", + "start": 36, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 36 + }, + "end": { + "line": 1, + "column": 40 + }, + "identifierName": "eval" + }, + "name": "eval" + }, + "init": { + "type": "NumericLiteral", + "start": 43, + "end": 45, + "loc": { + "start": { + "line": 1, + "column": 43 + }, + "end": { + "line": 1, + "column": 45 + } + }, + "extra": { + "rawValue": 10, + "raw": "10" + }, + "value": 10 + } + } + ], + "kind": "var" + } + ], + "directives": [ + { + "type": "Directive", + "start": 18, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 18, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/469/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/469/options.json deleted file mode 100644 index 9e9f875dfbb5..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/469/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'arguments' in strict mode (1:36)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/469/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/469/output.json new file mode 100644 index 000000000000..7101109189a2 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/469/output.json @@ -0,0 +1,197 @@ +{ + "type": "File", + "start": 0, + "end": 53, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 53 + } + }, + "errors": [ + "SyntaxError: Binding 'arguments' in strict mode (1:36)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 53, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 53 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 53, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 53 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "hello" + }, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 53, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 53 + } + }, + "body": [ + { + "type": "VariableDeclaration", + "start": 32, + "end": 51, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 51 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 36, + "end": 50, + "loc": { + "start": { + "line": 1, + "column": 36 + }, + "end": { + "line": 1, + "column": 50 + } + }, + "id": { + "type": "Identifier", + "start": 36, + "end": 45, + "loc": { + "start": { + "line": 1, + "column": 36 + }, + "end": { + "line": 1, + "column": 45 + }, + "identifierName": "arguments" + }, + "name": "arguments" + }, + "init": { + "type": "NumericLiteral", + "start": 48, + "end": 50, + "loc": { + "start": { + "line": 1, + "column": 48 + }, + "end": { + "line": 1, + "column": 50 + } + }, + "extra": { + "rawValue": 10, + "raw": "10" + }, + "value": 10 + } + } + ], + "kind": "var" + } + ], + "directives": [ + { + "type": "Directive", + "start": 18, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 18, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/470/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/470/options.json deleted file mode 100644 index b5fd79ff5ff1..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/470/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'eval' in strict mode (1:47)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/470/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/470/output.json new file mode 100644 index 000000000000..dd5fca85f2e5 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/470/output.json @@ -0,0 +1,209 @@ +{ + "type": "File", + "start": 0, + "end": 58, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 58 + } + }, + "errors": [ + "SyntaxError: Binding 'eval' in strict mode (1:47)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 58, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 58 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 58, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 58 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "hello" + }, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 58, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 58 + } + }, + "body": [ + { + "type": "TryStatement", + "start": 32, + "end": 56, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 56 + } + }, + "block": { + "type": "BlockStatement", + "start": 36, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 36 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "body": [], + "directives": [] + }, + "handler": { + "type": "CatchClause", + "start": 40, + "end": 56, + "loc": { + "start": { + "line": 1, + "column": 40 + }, + "end": { + "line": 1, + "column": 56 + } + }, + "param": { + "type": "Identifier", + "start": 47, + "end": 51, + "loc": { + "start": { + "line": 1, + "column": 47 + }, + "end": { + "line": 1, + "column": 51 + }, + "identifierName": "eval" + }, + "name": "eval" + }, + "body": { + "type": "BlockStatement", + "start": 53, + "end": 56, + "loc": { + "start": { + "line": 1, + "column": 53 + }, + "end": { + "line": 1, + "column": 56 + } + }, + "body": [], + "directives": [] + } + }, + "finalizer": null + } + ], + "directives": [ + { + "type": "Directive", + "start": 18, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 18, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/471/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/471/options.json deleted file mode 100644 index 15b7ac855374..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/471/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'arguments' in strict mode (1:47)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/471/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/471/output.json new file mode 100644 index 000000000000..3b89f63424e2 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/471/output.json @@ -0,0 +1,209 @@ +{ + "type": "File", + "start": 0, + "end": 63, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 63 + } + }, + "errors": [ + "SyntaxError: Binding 'arguments' in strict mode (1:47)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 63, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 63 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 63, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 63 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "hello" + }, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 63, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 63 + } + }, + "body": [ + { + "type": "TryStatement", + "start": 32, + "end": 61, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 61 + } + }, + "block": { + "type": "BlockStatement", + "start": 36, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 36 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "body": [], + "directives": [] + }, + "handler": { + "type": "CatchClause", + "start": 40, + "end": 61, + "loc": { + "start": { + "line": 1, + "column": 40 + }, + "end": { + "line": 1, + "column": 61 + } + }, + "param": { + "type": "Identifier", + "start": 47, + "end": 56, + "loc": { + "start": { + "line": 1, + "column": 47 + }, + "end": { + "line": 1, + "column": 56 + }, + "identifierName": "arguments" + }, + "name": "arguments" + }, + "body": { + "type": "BlockStatement", + "start": 58, + "end": 61, + "loc": { + "start": { + "line": 1, + "column": 58 + }, + "end": { + "line": 1, + "column": 61 + } + }, + "body": [], + "directives": [] + } + }, + "finalizer": null + } + ], + "directives": [ + { + "type": "Directive", + "start": 18, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 18, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/472/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/472/options.json deleted file mode 100644 index 95f470aed511..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/472/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Assigning to 'eval' in strict mode (1:32)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/472/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/472/output.json new file mode 100644 index 000000000000..2973f3517639 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/472/output.json @@ -0,0 +1,195 @@ +{ + "type": "File", + "start": 0, + "end": 44, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 44 + } + }, + "errors": [ + "SyntaxError: Assigning to 'eval' in strict mode (1:32)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 44, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 44 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 44, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 44 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "hello" + }, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 44, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 44 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 32, + "end": 42, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 42 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 32, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 41 + } + }, + "operator": "=", + "left": { + "type": "Identifier", + "start": 32, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 36 + }, + "identifierName": "eval" + }, + "name": "eval" + }, + "right": { + "type": "NumericLiteral", + "start": 39, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 39 + }, + "end": { + "line": 1, + "column": 41 + } + }, + "extra": { + "rawValue": 10, + "raw": "10" + }, + "value": 10 + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 18, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 18, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/473/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/473/options.json deleted file mode 100644 index ef45890ab53f..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/473/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Assigning to 'arguments' in strict mode (1:32)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/473/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/473/output.json new file mode 100644 index 000000000000..e328a1e98ef9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/473/output.json @@ -0,0 +1,195 @@ +{ + "type": "File", + "start": 0, + "end": 49, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 49 + } + }, + "errors": [ + "SyntaxError: Assigning to 'arguments' in strict mode (1:32)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 49, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 49 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 49, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 49 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "hello" + }, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 49, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 49 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 32, + "end": 47, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 47 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 32, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 46 + } + }, + "operator": "=", + "left": { + "type": "Identifier", + "start": 32, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 41 + }, + "identifierName": "arguments" + }, + "name": "arguments" + }, + "right": { + "type": "NumericLiteral", + "start": 44, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 44 + }, + "end": { + "line": 1, + "column": 46 + } + }, + "extra": { + "rawValue": 10, + "raw": "10" + }, + "value": 10 + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 18, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 18, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/474/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/474/options.json deleted file mode 100644 index 2783b68b3d58..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/474/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Assigning to 'eval' in strict mode (1:34)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/474/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/474/output.json new file mode 100644 index 000000000000..95091e65367d --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/474/output.json @@ -0,0 +1,176 @@ +{ + "type": "File", + "start": 0, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 41 + } + }, + "errors": [ + "SyntaxError: Assigning to 'eval' in strict mode (1:34)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 41 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 41 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "hello" + }, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 41 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 32, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "expression": { + "type": "UpdateExpression", + "start": 32, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 38 + } + }, + "operator": "++", + "prefix": true, + "argument": { + "type": "Identifier", + "start": 34, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 34 + }, + "end": { + "line": 1, + "column": 38 + }, + "identifierName": "eval" + }, + "name": "eval" + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 18, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 18, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/475/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/475/options.json deleted file mode 100644 index 2783b68b3d58..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/475/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Assigning to 'eval' in strict mode (1:34)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/475/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/475/output.json new file mode 100644 index 000000000000..8473055a411c --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/475/output.json @@ -0,0 +1,176 @@ +{ + "type": "File", + "start": 0, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 41 + } + }, + "errors": [ + "SyntaxError: Assigning to 'eval' in strict mode (1:34)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 41 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 41 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "hello" + }, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 41 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 32, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "expression": { + "type": "UpdateExpression", + "start": 32, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 38 + } + }, + "operator": "--", + "prefix": true, + "argument": { + "type": "Identifier", + "start": 34, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 34 + }, + "end": { + "line": 1, + "column": 38 + }, + "identifierName": "eval" + }, + "name": "eval" + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 18, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 18, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/476/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/476/options.json deleted file mode 100644 index fe2654496fc9..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/476/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Assigning to 'arguments' in strict mode (1:34)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/476/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/476/output.json new file mode 100644 index 000000000000..c9974932443e --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/476/output.json @@ -0,0 +1,176 @@ +{ + "type": "File", + "start": 0, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 46 + } + }, + "errors": [ + "SyntaxError: Assigning to 'arguments' in strict mode (1:34)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 46 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 46 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "hello" + }, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 46 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 32, + "end": 44, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 44 + } + }, + "expression": { + "type": "UpdateExpression", + "start": 32, + "end": 43, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 43 + } + }, + "operator": "++", + "prefix": true, + "argument": { + "type": "Identifier", + "start": 34, + "end": 43, + "loc": { + "start": { + "line": 1, + "column": 34 + }, + "end": { + "line": 1, + "column": 43 + }, + "identifierName": "arguments" + }, + "name": "arguments" + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 18, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 18, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/477/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/477/options.json deleted file mode 100644 index fe2654496fc9..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/477/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Assigning to 'arguments' in strict mode (1:34)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/477/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/477/output.json new file mode 100644 index 000000000000..cf31420c53a0 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/477/output.json @@ -0,0 +1,176 @@ +{ + "type": "File", + "start": 0, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 46 + } + }, + "errors": [ + "SyntaxError: Assigning to 'arguments' in strict mode (1:34)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 46 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 46 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "hello" + }, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 46 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 32, + "end": 44, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 44 + } + }, + "expression": { + "type": "UpdateExpression", + "start": 32, + "end": 43, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 43 + } + }, + "operator": "--", + "prefix": true, + "argument": { + "type": "Identifier", + "start": 34, + "end": 43, + "loc": { + "start": { + "line": 1, + "column": 34 + }, + "end": { + "line": 1, + "column": 43 + }, + "identifierName": "arguments" + }, + "name": "arguments" + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 18, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 18, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/478/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/478/options.json deleted file mode 100644 index 95f470aed511..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/478/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Assigning to 'eval' in strict mode (1:32)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/478/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/478/output.json new file mode 100644 index 000000000000..59618c91e2ca --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/478/output.json @@ -0,0 +1,176 @@ +{ + "type": "File", + "start": 0, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 41 + } + }, + "errors": [ + "SyntaxError: Assigning to 'eval' in strict mode (1:32)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 41 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 41 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "hello" + }, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 41 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 32, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "expression": { + "type": "UpdateExpression", + "start": 32, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 38 + } + }, + "operator": "++", + "prefix": false, + "argument": { + "type": "Identifier", + "start": 32, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 36 + }, + "identifierName": "eval" + }, + "name": "eval" + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 18, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 18, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/479/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/479/options.json deleted file mode 100644 index 95f470aed511..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/479/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Assigning to 'eval' in strict mode (1:32)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/479/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/479/output.json new file mode 100644 index 000000000000..0b6b047c7b58 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/479/output.json @@ -0,0 +1,176 @@ +{ + "type": "File", + "start": 0, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 41 + } + }, + "errors": [ + "SyntaxError: Assigning to 'eval' in strict mode (1:32)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 41 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 41 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "hello" + }, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 41 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 32, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "expression": { + "type": "UpdateExpression", + "start": 32, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 38 + } + }, + "operator": "--", + "prefix": false, + "argument": { + "type": "Identifier", + "start": 32, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 36 + }, + "identifierName": "eval" + }, + "name": "eval" + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 18, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 18, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/480/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/480/options.json deleted file mode 100644 index ef45890ab53f..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/480/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Assigning to 'arguments' in strict mode (1:32)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/480/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/480/output.json new file mode 100644 index 000000000000..64f2c09fd91e --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/480/output.json @@ -0,0 +1,176 @@ +{ + "type": "File", + "start": 0, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 46 + } + }, + "errors": [ + "SyntaxError: Assigning to 'arguments' in strict mode (1:32)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 46 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 46 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "hello" + }, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 46 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 32, + "end": 44, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 44 + } + }, + "expression": { + "type": "UpdateExpression", + "start": 32, + "end": 43, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 43 + } + }, + "operator": "++", + "prefix": false, + "argument": { + "type": "Identifier", + "start": 32, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 41 + }, + "identifierName": "arguments" + }, + "name": "arguments" + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 18, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 18, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/481/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/481/options.json deleted file mode 100644 index ef45890ab53f..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/481/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Assigning to 'arguments' in strict mode (1:32)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/481/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/481/output.json new file mode 100644 index 000000000000..34c1b59c4e79 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/481/output.json @@ -0,0 +1,176 @@ +{ + "type": "File", + "start": 0, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 46 + } + }, + "errors": [ + "SyntaxError: Assigning to 'arguments' in strict mode (1:32)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 46 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 46 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "hello" + }, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 46 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 32, + "end": 44, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 44 + } + }, + "expression": { + "type": "UpdateExpression", + "start": 32, + "end": 43, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 43 + } + }, + "operator": "--", + "prefix": false, + "argument": { + "type": "Identifier", + "start": 32, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 41 + }, + "identifierName": "arguments" + }, + "name": "arguments" + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 18, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 18, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/482/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/482/options.json deleted file mode 100644 index 6db4ae7bf008..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/482/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'eval' in strict mode (1:41)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/482/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/482/output.json new file mode 100644 index 000000000000..35af060b7c6e --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/482/output.json @@ -0,0 +1,179 @@ +{ + "type": "File", + "start": 0, + "end": 53, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 53 + } + }, + "errors": [ + "SyntaxError: Binding 'eval' in strict mode (1:41)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 53, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 53 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 53, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 53 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "hello" + }, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 53, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 53 + } + }, + "body": [ + { + "type": "FunctionDeclaration", + "start": 32, + "end": 51, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 51 + } + }, + "id": { + "type": "Identifier", + "start": 41, + "end": 45, + "loc": { + "start": { + "line": 1, + "column": 41 + }, + "end": { + "line": 1, + "column": 45 + }, + "identifierName": "eval" + }, + "name": "eval" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 48, + "end": 51, + "loc": { + "start": { + "line": 1, + "column": 48 + }, + "end": { + "line": 1, + "column": 51 + } + }, + "body": [], + "directives": [] + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 18, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 18, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/483/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/483/options.json deleted file mode 100644 index b02fb725c767..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/483/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'arguments' in strict mode (1:41)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/483/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/483/output.json new file mode 100644 index 000000000000..7419ba446dc9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/483/output.json @@ -0,0 +1,179 @@ +{ + "type": "File", + "start": 0, + "end": 58, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 58 + } + }, + "errors": [ + "SyntaxError: Binding 'arguments' in strict mode (1:41)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 58, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 58 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 58, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 58 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "hello" + }, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 58, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 58 + } + }, + "body": [ + { + "type": "FunctionDeclaration", + "start": 32, + "end": 56, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 56 + } + }, + "id": { + "type": "Identifier", + "start": 41, + "end": 50, + "loc": { + "start": { + "line": 1, + "column": 41 + }, + "end": { + "line": 1, + "column": 50 + }, + "identifierName": "arguments" + }, + "name": "arguments" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 53, + "end": 56, + "loc": { + "start": { + "line": 1, + "column": 53 + }, + "end": { + "line": 1, + "column": 56 + } + }, + "body": [], + "directives": [] + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 18, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 18, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/484/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/484/options.json deleted file mode 100644 index a7490f9321d4..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/484/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'eval' in strict mode (1:9)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/484/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/484/output.json new file mode 100644 index 000000000000..ede15490b692 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/484/output.json @@ -0,0 +1,126 @@ +{ + "type": "File", + "start": 0, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "errors": [ + "SyntaxError: Binding 'eval' in strict mode (1:9)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 13 + }, + "identifierName": "eval" + }, + "name": "eval" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 16, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "body": [], + "directives": [ + { + "type": "Directive", + "start": 17, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 17, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/485/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/485/options.json deleted file mode 100644 index 80b8b2d85caa..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/485/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'arguments' in strict mode (1:9)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/485/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/485/output.json new file mode 100644 index 000000000000..aeccd1a07ed9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/485/output.json @@ -0,0 +1,126 @@ +{ + "type": "File", + "start": 0, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "errors": [ + "SyntaxError: Binding 'arguments' in strict mode (1:9)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 18 + }, + "identifierName": "arguments" + }, + "name": "arguments" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 21, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "body": [], + "directives": [ + { + "type": "Directive", + "start": 22, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 22, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/486/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/486/options.json deleted file mode 100644 index 706ba8380c70..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/486/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'eval' in strict mode (1:42)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/486/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/486/output.json new file mode 100644 index 000000000000..4e8af9c85d04 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/486/output.json @@ -0,0 +1,214 @@ +{ + "type": "File", + "start": 0, + "end": 57, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 57 + } + }, + "errors": [ + "SyntaxError: Binding 'eval' in strict mode (1:42)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 57, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 57 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 57, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 57 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "hello" + }, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 57, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 57 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 32, + "end": 55, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 55 + } + }, + "expression": { + "type": "CallExpression", + "start": 33, + "end": 54, + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 54 + } + }, + "callee": { + "type": "FunctionExpression", + "start": 33, + "end": 52, + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 52 + } + }, + "id": { + "type": "Identifier", + "start": 42, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 42 + }, + "end": { + "line": 1, + "column": 46 + }, + "identifierName": "eval" + }, + "name": "eval" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 49, + "end": 52, + "loc": { + "start": { + "line": 1, + "column": 49 + }, + "end": { + "line": 1, + "column": 52 + } + }, + "body": [], + "directives": [] + } + }, + "arguments": [], + "extra": { + "parenthesized": true, + "parenStart": 32 + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 18, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 18, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/487/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/487/options.json deleted file mode 100644 index d0e461af3911..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/487/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'arguments' in strict mode (1:42)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/487/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/487/output.json new file mode 100644 index 000000000000..49a2e0086f28 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/487/output.json @@ -0,0 +1,214 @@ +{ + "type": "File", + "start": 0, + "end": 62, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 62 + } + }, + "errors": [ + "SyntaxError: Binding 'arguments' in strict mode (1:42)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 62, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 62 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 62, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 62 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "hello" + }, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 62, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 62 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 32, + "end": 60, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 60 + } + }, + "expression": { + "type": "CallExpression", + "start": 33, + "end": 59, + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 59 + } + }, + "callee": { + "type": "FunctionExpression", + "start": 33, + "end": 57, + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 57 + } + }, + "id": { + "type": "Identifier", + "start": 42, + "end": 51, + "loc": { + "start": { + "line": 1, + "column": 42 + }, + "end": { + "line": 1, + "column": 51 + }, + "identifierName": "arguments" + }, + "name": "arguments" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 54, + "end": 57, + "loc": { + "start": { + "line": 1, + "column": 54 + }, + "end": { + "line": 1, + "column": 57 + } + }, + "body": [], + "directives": [] + } + }, + "arguments": [], + "extra": { + "parenthesized": true, + "parenStart": 32 + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 18, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 18, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/488/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/488/options.json deleted file mode 100644 index ee2e7d7c7745..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/488/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'eval' in strict mode (1:10)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/488/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/488/output.json new file mode 100644 index 000000000000..6d1387258a3e --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/488/output.json @@ -0,0 +1,161 @@ +{ + "type": "File", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "errors": [ + "SyntaxError: Binding 'eval' in strict mode (1:10)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "expression": { + "type": "CallExpression", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "callee": { + "type": "FunctionExpression", + "start": 1, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "id": { + "type": "Identifier", + "start": 10, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "eval" + }, + "name": "eval" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "body": [], + "directives": [ + { + "type": "Directive", + "start": 18, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 18, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + }, + "extra": { + "parenthesized": true, + "parenStart": 0 + } + }, + "arguments": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/489/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/489/options.json deleted file mode 100644 index bb4b812bab32..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/489/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'arguments' in strict mode (1:10)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/489/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/489/output.json new file mode 100644 index 000000000000..d3b5c3628386 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/489/output.json @@ -0,0 +1,161 @@ +{ + "type": "File", + "start": 0, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 41 + } + }, + "errors": [ + "SyntaxError: Binding 'arguments' in strict mode (1:10)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 41 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 41 + } + }, + "expression": { + "type": "CallExpression", + "start": 0, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 41 + } + }, + "callee": { + "type": "FunctionExpression", + "start": 1, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 38 + } + }, + "id": { + "type": "Identifier", + "start": 10, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 19 + }, + "identifierName": "arguments" + }, + "name": "arguments" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 22, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 38 + } + }, + "body": [], + "directives": [ + { + "type": "Directive", + "start": 23, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 23, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + }, + "extra": { + "parenthesized": true, + "parenStart": 0 + } + }, + "arguments": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/490/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/490/options.json deleted file mode 100644 index b5fd79ff5ff1..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/490/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'eval' in strict mode (1:47)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/490/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/490/output.json new file mode 100644 index 000000000000..d0eb8e29b2a1 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/490/output.json @@ -0,0 +1,250 @@ +{ + "type": "File", + "start": 0, + "end": 63, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 63 + } + }, + "errors": [ + "SyntaxError: Binding 'eval' in strict mode (1:47)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 63, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 63 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 63, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 63 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "hello" + }, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 63, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 63 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 32, + "end": 61, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 61 + } + }, + "expression": { + "type": "ObjectExpression", + "start": 33, + "end": 59, + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 59 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 35, + "end": 57, + "loc": { + "start": { + "line": 1, + "column": 35 + }, + "end": { + "line": 1, + "column": 57 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 35, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 35 + }, + "end": { + "line": 1, + "column": 36 + }, + "identifierName": "s" + }, + "name": "s" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "FunctionExpression", + "start": 38, + "end": 57, + "loc": { + "start": { + "line": 1, + "column": 38 + }, + "end": { + "line": 1, + "column": 57 + } + }, + "id": { + "type": "Identifier", + "start": 47, + "end": 51, + "loc": { + "start": { + "line": 1, + "column": 47 + }, + "end": { + "line": 1, + "column": 51 + }, + "identifierName": "eval" + }, + "name": "eval" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 54, + "end": 57, + "loc": { + "start": { + "line": 1, + "column": 54 + }, + "end": { + "line": 1, + "column": 57 + } + }, + "body": [], + "directives": [] + } + } + } + ], + "extra": { + "parenthesized": true, + "parenStart": 32 + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 18, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 18, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/491/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/491/options.json deleted file mode 100644 index ff90f09173c4..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/491/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'package' in strict mode (1:10)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/491/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/491/output.json new file mode 100644 index 000000000000..d6510094936e --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/491/output.json @@ -0,0 +1,161 @@ +{ + "type": "File", + "start": 0, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "errors": [ + "SyntaxError: Binding 'package' in strict mode (1:10)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "expression": { + "type": "CallExpression", + "start": 0, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "callee": { + "type": "FunctionExpression", + "start": 1, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "id": { + "type": "Identifier", + "start": 10, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 17 + }, + "identifierName": "package" + }, + "name": "package" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 20, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "body": [], + "directives": [ + { + "type": "Directive", + "start": 21, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 21, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + }, + "extra": { + "parenthesized": true, + "parenStart": 0 + } + }, + "arguments": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/492/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/492/options.json deleted file mode 100644 index b8f97ca4fe56..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/492/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'eval' in strict mode (1:48)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/492/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/492/output.json new file mode 100644 index 000000000000..98e096877880 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/492/output.json @@ -0,0 +1,292 @@ +{ + "type": "File", + "start": 0, + "end": 63, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 63 + } + }, + "errors": [ + "SyntaxError: Binding 'eval' in strict mode (1:48)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 63, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 63 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 63, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 63 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "hello" + }, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 63, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 63 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 32, + "end": 61, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 61 + } + }, + "expression": { + "type": "ObjectExpression", + "start": 33, + "end": 59, + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 59 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 35, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 35 + }, + "end": { + "line": 1, + "column": 40 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 35, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 35 + }, + "end": { + "line": 1, + "column": 36 + }, + "identifierName": "i" + }, + "name": "i" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "NumericLiteral", + "start": 38, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 38 + }, + "end": { + "line": 1, + "column": 40 + } + }, + "extra": { + "rawValue": 10, + "raw": "10" + }, + "value": 10 + } + }, + { + "type": "ObjectMethod", + "start": 42, + "end": 57, + "loc": { + "start": { + "line": 1, + "column": 42 + }, + "end": { + "line": 1, + "column": 57 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 46, + "end": 47, + "loc": { + "start": { + "line": 1, + "column": 46 + }, + "end": { + "line": 1, + "column": 47 + }, + "identifierName": "s" + }, + "name": "s" + }, + "computed": false, + "kind": "set", + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 48, + "end": 52, + "loc": { + "start": { + "line": 1, + "column": 48 + }, + "end": { + "line": 1, + "column": 52 + }, + "identifierName": "eval" + }, + "name": "eval" + } + ], + "body": { + "type": "BlockStatement", + "start": 54, + "end": 57, + "loc": { + "start": { + "line": 1, + "column": 54 + }, + "end": { + "line": 1, + "column": 57 + } + }, + "body": [], + "directives": [] + } + } + ], + "extra": { + "parenthesized": true, + "parenStart": 32 + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 18, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 18, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/493/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/493/options.json deleted file mode 100644 index 6db4ae7bf008..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/493/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'eval' in strict mode (1:41)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/493/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/493/output.json new file mode 100644 index 000000000000..f974d83f5a98 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/493/output.json @@ -0,0 +1,237 @@ +{ + "type": "File", + "start": 0, + "end": 56, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 56 + } + }, + "errors": [ + "SyntaxError: Binding 'eval' in strict mode (1:41)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 56, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 56 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 56, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 56 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "hello" + }, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 56, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 56 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 32, + "end": 54, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 54 + } + }, + "expression": { + "type": "ObjectExpression", + "start": 33, + "end": 52, + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 52 + } + }, + "properties": [ + { + "type": "ObjectMethod", + "start": 35, + "end": 50, + "loc": { + "start": { + "line": 1, + "column": 35 + }, + "end": { + "line": 1, + "column": 50 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 39, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 39 + }, + "end": { + "line": 1, + "column": 40 + }, + "identifierName": "s" + }, + "name": "s" + }, + "computed": false, + "kind": "set", + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 41, + "end": 45, + "loc": { + "start": { + "line": 1, + "column": 41 + }, + "end": { + "line": 1, + "column": 45 + }, + "identifierName": "eval" + }, + "name": "eval" + } + ], + "body": { + "type": "BlockStatement", + "start": 47, + "end": 50, + "loc": { + "start": { + "line": 1, + "column": 47 + }, + "end": { + "line": 1, + "column": 50 + } + }, + "body": [], + "directives": [] + } + } + ], + "extra": { + "parenthesized": true, + "parenStart": 32 + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 18, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 18, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/494/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/494/options.json deleted file mode 100644 index e80a856d48a0..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/494/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'eval' in strict mode (1:49)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/494/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/494/output.json new file mode 100644 index 000000000000..2993cf648835 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/494/output.json @@ -0,0 +1,268 @@ +{ + "type": "File", + "start": 0, + "end": 64, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 64 + } + }, + "errors": [ + "SyntaxError: Binding 'eval' in strict mode (1:49)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 64, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 64 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 64, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 64 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "hello" + }, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 64, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 64 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 32, + "end": 62, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 62 + } + }, + "expression": { + "type": "ObjectExpression", + "start": 33, + "end": 60, + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 60 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 35, + "end": 58, + "loc": { + "start": { + "line": 1, + "column": 35 + }, + "end": { + "line": 1, + "column": 58 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 35, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 35 + }, + "end": { + "line": 1, + "column": 36 + }, + "identifierName": "s" + }, + "name": "s" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "FunctionExpression", + "start": 38, + "end": 58, + "loc": { + "start": { + "line": 1, + "column": 38 + }, + "end": { + "line": 1, + "column": 58 + } + }, + "id": { + "type": "Identifier", + "start": 47, + "end": 48, + "loc": { + "start": { + "line": 1, + "column": 47 + }, + "end": { + "line": 1, + "column": 48 + }, + "identifierName": "s" + }, + "name": "s" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 49, + "end": 53, + "loc": { + "start": { + "line": 1, + "column": 49 + }, + "end": { + "line": 1, + "column": 53 + }, + "identifierName": "eval" + }, + "name": "eval" + } + ], + "body": { + "type": "BlockStatement", + "start": 55, + "end": 58, + "loc": { + "start": { + "line": 1, + "column": 55 + }, + "end": { + "line": 1, + "column": 58 + } + }, + "body": [], + "directives": [] + } + } + } + ], + "extra": { + "parenthesized": true, + "parenStart": 32 + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 18, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 18, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/495/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/495/options.json deleted file mode 100644 index d93d5b2aa62e..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/495/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'eval' in strict mode (1:15)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/495/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/495/output.json new file mode 100644 index 000000000000..4534376b270a --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/495/output.json @@ -0,0 +1,144 @@ +{ + "type": "File", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "errors": [ + "SyntaxError: Binding 'eval' in strict mode (1:15)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "hello" + }, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 15, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 19 + }, + "identifierName": "eval" + }, + "name": "eval" + } + ], + "body": { + "type": "BlockStatement", + "start": 21, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "body": [], + "directives": [ + { + "type": "Directive", + "start": 22, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 22, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/496/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/496/options.json deleted file mode 100644 index 5d2dc563b16e..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/496/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'arguments' in strict mode (1:15)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/496/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/496/output.json new file mode 100644 index 000000000000..cb41c2783446 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/496/output.json @@ -0,0 +1,144 @@ +{ + "type": "File", + "start": 0, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 41 + } + }, + "errors": [ + "SyntaxError: Binding 'arguments' in strict mode (1:15)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 41 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 41 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "hello" + }, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 15, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 24 + }, + "identifierName": "arguments" + }, + "name": "arguments" + } + ], + "body": { + "type": "BlockStatement", + "start": 26, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 41 + } + }, + "body": [], + "directives": [ + { + "type": "Directive", + "start": 27, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 40 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 27, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/497/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/497/options.json deleted file mode 100644 index b8f97ca4fe56..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/497/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'eval' in strict mode (1:48)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/497/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/497/output.json new file mode 100644 index 000000000000..d8df2c1c2d07 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/497/output.json @@ -0,0 +1,197 @@ +{ + "type": "File", + "start": 0, + "end": 58, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 58 + } + }, + "errors": [ + "SyntaxError: Binding 'eval' in strict mode (1:48)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 58, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 58 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 58, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 58 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "hello" + }, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 58, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 58 + } + }, + "body": [ + { + "type": "FunctionDeclaration", + "start": 33, + "end": 56, + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 56 + } + }, + "id": { + "type": "Identifier", + "start": 42, + "end": 47, + "loc": { + "start": { + "line": 1, + "column": 42 + }, + "end": { + "line": 1, + "column": 47 + }, + "identifierName": "inner" + }, + "name": "inner" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 48, + "end": 52, + "loc": { + "start": { + "line": 1, + "column": 48 + }, + "end": { + "line": 1, + "column": 52 + }, + "identifierName": "eval" + }, + "name": "eval" + } + ], + "body": { + "type": "BlockStatement", + "start": 54, + "end": 56, + "loc": { + "start": { + "line": 1, + "column": 54 + }, + "end": { + "line": 1, + "column": 56 + } + }, + "body": [], + "directives": [] + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 19, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 19, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/498/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/498/options.json deleted file mode 100644 index ab7000409bab..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/498/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'arguments' in strict mode (1:48)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/498/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/498/output.json new file mode 100644 index 000000000000..a2fc6cb4db0e --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/498/output.json @@ -0,0 +1,197 @@ +{ + "type": "File", + "start": 0, + "end": 63, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 63 + } + }, + "errors": [ + "SyntaxError: Binding 'arguments' in strict mode (1:48)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 63, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 63 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 63, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 63 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "hello" + }, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 63, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 63 + } + }, + "body": [ + { + "type": "FunctionDeclaration", + "start": 33, + "end": 61, + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 61 + } + }, + "id": { + "type": "Identifier", + "start": 42, + "end": 47, + "loc": { + "start": { + "line": 1, + "column": 42 + }, + "end": { + "line": 1, + "column": 47 + }, + "identifierName": "inner" + }, + "name": "inner" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 48, + "end": 57, + "loc": { + "start": { + "line": 1, + "column": 48 + }, + "end": { + "line": 1, + "column": 57 + }, + "identifierName": "arguments" + }, + "name": "arguments" + } + ], + "body": { + "type": "BlockStatement", + "start": 59, + "end": 61, + "loc": { + "start": { + "line": 1, + "column": 59 + }, + "end": { + "line": 1, + "column": 61 + } + }, + "body": [], + "directives": [] + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 19, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 19, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/499/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/499/options.json deleted file mode 100644 index ae2bfab55c68..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/499/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Octal literal in strict mode (1:35)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/499/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/499/output.json new file mode 100644 index 000000000000..1504ace4ac5d --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/499/output.json @@ -0,0 +1,162 @@ +{ + "type": "File", + "start": 0, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 40 + } + }, + "errors": [ + "SyntaxError: Octal literal in strict mode (1:35)", + "SyntaxError: Octal literal in strict mode (1:35)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 40 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 40 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "hello" + }, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 40 + } + }, + "body": [], + "directives": [ + { + "type": "Directive", + "start": 19, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 19, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + }, + { + "type": "Directive", + "start": 33, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 38 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 33, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "value": "\\1", + "extra": { + "raw": "\"\\1\"", + "rawValue": "\\1" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/500/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/500/options.json deleted file mode 100644 index 45ca229c1e8e..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/500/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Legacy octal literals are not allowed in strict mode (1:33)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/500/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/500/output.json new file mode 100644 index 000000000000..805c176e7856 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/500/output.json @@ -0,0 +1,163 @@ +{ + "type": "File", + "start": 0, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "errors": [ + "SyntaxError: Legacy octal literals are not allowed in strict mode (1:33)", + "SyntaxError: Legacy octal literals are not allowed in strict mode (1:33)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "hello" + }, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 33, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 33, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "extra": { + "rawValue": 17, + "raw": "021" + }, + "value": 17 + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 19, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 19, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/501/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/501/options.json deleted file mode 100644 index 7e50b5f9165e..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/501/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Octal literal in strict mode (1:38)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/501/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/501/output.json new file mode 100644 index 000000000000..f73cb42cd9cf --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/501/output.json @@ -0,0 +1,221 @@ +{ + "type": "File", + "start": 0, + "end": 50, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 50 + } + }, + "errors": [ + "SyntaxError: Octal literal in strict mode (1:38)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 50, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 50 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 50, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 50 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "hello" + }, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 50, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 50 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 33, + "end": 48, + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 48 + } + }, + "expression": { + "type": "ObjectExpression", + "start": 34, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 34 + }, + "end": { + "line": 1, + "column": 46 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 36, + "end": 44, + "loc": { + "start": { + "line": 1, + "column": 36 + }, + "end": { + "line": 1, + "column": 44 + } + }, + "method": false, + "key": { + "type": "StringLiteral", + "start": 36, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 36 + }, + "end": { + "line": 1, + "column": 40 + } + }, + "extra": { + "rawValue": "\u0001", + "raw": "\"\\1\"" + }, + "value": "\u0001" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "NumericLiteral", + "start": 42, + "end": 44, + "loc": { + "start": { + "line": 1, + "column": 42 + }, + "end": { + "line": 1, + "column": 44 + } + }, + "extra": { + "rawValue": 42, + "raw": "42" + }, + "value": 42 + } + } + ], + "extra": { + "parenthesized": true, + "parenStart": 33 + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 19, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 19, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/502/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/502/options.json deleted file mode 100644 index 8f6c8218f747..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/502/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Legacy octal literals are not allowed in strict mode (1:36)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/502/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/502/output.json new file mode 100644 index 000000000000..5eb3bcef0b18 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/502/output.json @@ -0,0 +1,221 @@ +{ + "type": "File", + "start": 0, + "end": 49, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 49 + } + }, + "errors": [ + "SyntaxError: Legacy octal literals are not allowed in strict mode (1:36)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 49, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 49 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 49, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 49 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "hello" + }, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 49, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 49 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 33, + "end": 47, + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 47 + } + }, + "expression": { + "type": "ObjectExpression", + "start": 34, + "end": 45, + "loc": { + "start": { + "line": 1, + "column": 34 + }, + "end": { + "line": 1, + "column": 45 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 36, + "end": 43, + "loc": { + "start": { + "line": 1, + "column": 36 + }, + "end": { + "line": 1, + "column": 43 + } + }, + "method": false, + "key": { + "type": "NumericLiteral", + "start": 36, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 36 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "extra": { + "rawValue": 17, + "raw": "021" + }, + "value": 17 + }, + "computed": false, + "shorthand": false, + "value": { + "type": "NumericLiteral", + "start": 41, + "end": 43, + "loc": { + "start": { + "line": 1, + "column": 41 + }, + "end": { + "line": 1, + "column": 43 + } + }, + "extra": { + "rawValue": 42, + "raw": "42" + }, + "value": 42 + } + } + ], + "extra": { + "parenthesized": true, + "parenStart": 33 + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 19, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 19, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/503/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/503/options.json deleted file mode 100644 index 8389b2c726ca..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/503/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Octal literal in strict mode (1:69)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/503/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/503/output.json new file mode 100644 index 000000000000..e52fa38ccf73 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/503/output.json @@ -0,0 +1,215 @@ +{ + "type": "File", + "start": 0, + "end": 76, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 76 + } + }, + "errors": [ + "SyntaxError: Octal literal in strict mode (1:69)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 76, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 76 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 76, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 76 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "hello" + }, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 76, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 76 + } + }, + "body": [ + { + "type": "FunctionDeclaration", + "start": 33, + "end": 74, + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 74 + } + }, + "id": { + "type": "Identifier", + "start": 42, + "end": 47, + "loc": { + "start": { + "line": 1, + "column": 42 + }, + "end": { + "line": 1, + "column": 47 + }, + "identifierName": "inner" + }, + "name": "inner" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 50, + "end": 74, + "loc": { + "start": { + "line": 1, + "column": 50 + }, + "end": { + "line": 1, + "column": 74 + } + }, + "body": [], + "directives": [ + { + "type": "Directive", + "start": 52, + "end": 72, + "loc": { + "start": { + "line": 1, + "column": 52 + }, + "end": { + "line": 1, + "column": 72 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 52, + "end": 71, + "loc": { + "start": { + "line": 1, + "column": 52 + }, + "end": { + "line": 1, + "column": 71 + } + }, + "value": "octal directive\\1", + "extra": { + "raw": "\"octal directive\\1\"", + "rawValue": "octal directive\\1" + } + } + } + ] + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 19, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 19, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/504/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/504/options.json deleted file mode 100644 index 0641de45e29a..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/504/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected reserved word 'implements' (1:37)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/504/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/504/output.json new file mode 100644 index 000000000000..2201ea3de8c6 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/504/output.json @@ -0,0 +1,178 @@ +{ + "type": "File", + "start": 0, + "end": 50, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 50 + } + }, + "errors": [ + "SyntaxError: Unexpected reserved word 'implements' (1:37)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 50, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 50 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 50, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 50 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "hello" + }, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 50, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 50 + } + }, + "body": [ + { + "type": "VariableDeclaration", + "start": 33, + "end": 48, + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 48 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 37, + "end": 47, + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 47 + } + }, + "id": { + "type": "Identifier", + "start": 37, + "end": 47, + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 47 + }, + "identifierName": "implements" + }, + "name": "implements" + }, + "init": null + } + ], + "kind": "var" + } + ], + "directives": [ + { + "type": "Directive", + "start": 19, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 19, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/505/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/505/options.json deleted file mode 100644 index 859238d0423f..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/505/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected reserved word 'interface' (1:37)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/505/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/505/output.json new file mode 100644 index 000000000000..be76deabc7a1 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/505/output.json @@ -0,0 +1,178 @@ +{ + "type": "File", + "start": 0, + "end": 49, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 49 + } + }, + "errors": [ + "SyntaxError: Unexpected reserved word 'interface' (1:37)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 49, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 49 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 49, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 49 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "hello" + }, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 49, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 49 + } + }, + "body": [ + { + "type": "VariableDeclaration", + "start": 33, + "end": 47, + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 47 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 37, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 46 + } + }, + "id": { + "type": "Identifier", + "start": 37, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 46 + }, + "identifierName": "interface" + }, + "name": "interface" + }, + "init": null + } + ], + "kind": "var" + } + ], + "directives": [ + { + "type": "Directive", + "start": 19, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 19, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/506/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/506/options.json deleted file mode 100644 index 344c7075f4bf..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/506/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected reserved word 'package' (1:37)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/506/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/506/output.json new file mode 100644 index 000000000000..414e229fac38 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/506/output.json @@ -0,0 +1,178 @@ +{ + "type": "File", + "start": 0, + "end": 47, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 47 + } + }, + "errors": [ + "SyntaxError: Unexpected reserved word 'package' (1:37)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 47, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 47 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 47, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 47 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "hello" + }, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 47, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 47 + } + }, + "body": [ + { + "type": "VariableDeclaration", + "start": 33, + "end": 45, + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 45 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 37, + "end": 44, + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 44 + } + }, + "id": { + "type": "Identifier", + "start": 37, + "end": 44, + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 44 + }, + "identifierName": "package" + }, + "name": "package" + }, + "init": null + } + ], + "kind": "var" + } + ], + "directives": [ + { + "type": "Directive", + "start": 19, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 19, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/507/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/507/options.json deleted file mode 100644 index 9fb9deaf9cba..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/507/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected reserved word 'private' (1:37)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/507/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/507/output.json new file mode 100644 index 000000000000..32efcd46a632 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/507/output.json @@ -0,0 +1,178 @@ +{ + "type": "File", + "start": 0, + "end": 47, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 47 + } + }, + "errors": [ + "SyntaxError: Unexpected reserved word 'private' (1:37)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 47, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 47 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 47, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 47 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "hello" + }, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 47, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 47 + } + }, + "body": [ + { + "type": "VariableDeclaration", + "start": 33, + "end": 45, + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 45 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 37, + "end": 44, + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 44 + } + }, + "id": { + "type": "Identifier", + "start": 37, + "end": 44, + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 44 + }, + "identifierName": "private" + }, + "name": "private" + }, + "init": null + } + ], + "kind": "var" + } + ], + "directives": [ + { + "type": "Directive", + "start": 19, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 19, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/508/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/508/options.json deleted file mode 100644 index 292fb56f1cf3..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/508/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected reserved word 'protected' (1:37)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/508/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/508/output.json new file mode 100644 index 000000000000..e3d3f255c253 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/508/output.json @@ -0,0 +1,178 @@ +{ + "type": "File", + "start": 0, + "end": 49, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 49 + } + }, + "errors": [ + "SyntaxError: Unexpected reserved word 'protected' (1:37)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 49, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 49 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 49, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 49 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "hello" + }, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 49, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 49 + } + }, + "body": [ + { + "type": "VariableDeclaration", + "start": 33, + "end": 47, + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 47 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 37, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 46 + } + }, + "id": { + "type": "Identifier", + "start": 37, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 46 + }, + "identifierName": "protected" + }, + "name": "protected" + }, + "init": null + } + ], + "kind": "var" + } + ], + "directives": [ + { + "type": "Directive", + "start": 19, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 19, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/509/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/509/options.json deleted file mode 100644 index d5f48446906a..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/509/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected reserved word 'public' (1:37)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/509/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/509/output.json new file mode 100644 index 000000000000..2e801038c78d --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/509/output.json @@ -0,0 +1,178 @@ +{ + "type": "File", + "start": 0, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 46 + } + }, + "errors": [ + "SyntaxError: Unexpected reserved word 'public' (1:37)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 46 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 46 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "hello" + }, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 46 + } + }, + "body": [ + { + "type": "VariableDeclaration", + "start": 33, + "end": 44, + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 44 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 37, + "end": 43, + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 43 + } + }, + "id": { + "type": "Identifier", + "start": 37, + "end": 43, + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 43 + }, + "identifierName": "public" + }, + "name": "public" + }, + "init": null + } + ], + "kind": "var" + } + ], + "directives": [ + { + "type": "Directive", + "start": 19, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 19, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/510/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/510/options.json deleted file mode 100644 index 0f41ff2e6f24..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/510/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected reserved word 'static' (1:37)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/510/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/510/output.json new file mode 100644 index 000000000000..4ed420518d6d --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/510/output.json @@ -0,0 +1,178 @@ +{ + "type": "File", + "start": 0, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 46 + } + }, + "errors": [ + "SyntaxError: Unexpected reserved word 'static' (1:37)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 46 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 46 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "hello" + }, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 46 + } + }, + "body": [ + { + "type": "VariableDeclaration", + "start": 33, + "end": 44, + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 44 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 37, + "end": 43, + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 43 + } + }, + "id": { + "type": "Identifier", + "start": 37, + "end": 43, + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 43 + }, + "identifierName": "static" + }, + "name": "static" + }, + "init": null + } + ], + "kind": "var" + } + ], + "directives": [ + { + "type": "Directive", + "start": 19, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 19, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/511/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/511/options.json deleted file mode 100644 index fff472344fd7..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/511/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'static' in strict mode (1:15)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/511/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/511/output.json new file mode 100644 index 000000000000..ab669586dc27 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/511/output.json @@ -0,0 +1,144 @@ +{ + "type": "File", + "start": 0, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 40 + } + }, + "errors": [ + "SyntaxError: Binding 'static' in strict mode (1:15)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 40 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 40 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "hello" + }, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 15, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 21 + }, + "identifierName": "static" + }, + "name": "static" + } + ], + "body": { + "type": "BlockStatement", + "start": 23, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 40 + } + }, + "body": [], + "directives": [ + { + "type": "Directive", + "start": 25, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 38 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 25, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/512/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/512/options.json deleted file mode 100644 index d4d0a96bfb64..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/512/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'static' in strict mode (1:9)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/512/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/512/output.json new file mode 100644 index 000000000000..be76a2099b54 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/512/output.json @@ -0,0 +1,126 @@ +{ + "type": "File", + "start": 0, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "errors": [ + "SyntaxError: Binding 'static' in strict mode (1:9)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 15 + }, + "identifierName": "static" + }, + "name": "static" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 18, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "body": [], + "directives": [ + { + "type": "Directive", + "start": 20, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 20, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/513/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/513/options.json deleted file mode 100644 index 91bc36d3f360..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/513/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected reserved word 'static' (1:23)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/513/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/513/output.json new file mode 100644 index 000000000000..c249f39209bf --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/513/output.json @@ -0,0 +1,126 @@ +{ + "type": "File", + "start": 0, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "errors": [ + "SyntaxError: Unexpected reserved word 'static' (1:23)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 14, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "id": { + "type": "Identifier", + "start": 23, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 29 + }, + "identifierName": "static" + }, + "name": "static" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 32, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "body": [], + "directives": [] + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/514/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/514/options.json deleted file mode 100644 index 8b20b9a7df36..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/514/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Argument name clash (1:14)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/514/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/514/output.json new file mode 100644 index 000000000000..f945eeb57491 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/514/output.json @@ -0,0 +1,161 @@ +{ + "type": "File", + "start": 0, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "errors": [ + "SyntaxError: Argument name clash (1:14)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + }, + "identifierName": "a" + }, + "name": "a" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 11, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + }, + "identifierName": "t" + }, + "name": "t" + }, + { + "type": "Identifier", + "start": 14, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + }, + "identifierName": "t" + }, + "name": "t" + } + ], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "body": [], + "directives": [ + { + "type": "Directive", + "start": 19, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 19, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/515/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/515/options.json deleted file mode 100644 index e227bd1a6b74..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/515/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'eval' in strict mode (1:11)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/515/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/515/output.json new file mode 100644 index 000000000000..f2ff5d38de33 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/515/output.json @@ -0,0 +1,144 @@ +{ + "type": "File", + "start": 0, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "errors": [ + "SyntaxError: Binding 'eval' in strict mode (1:11)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + }, + "identifierName": "a" + }, + "name": "a" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 11, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 15 + }, + "identifierName": "eval" + }, + "name": "eval" + } + ], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "body": [], + "directives": [ + { + "type": "Directive", + "start": 19, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 19, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/516/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/516/options.json deleted file mode 100644 index 8e1f9af4ec47..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/516/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'package' in strict mode (1:11)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/516/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/516/output.json new file mode 100644 index 000000000000..2f734055a47a --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/516/output.json @@ -0,0 +1,144 @@ +{ + "type": "File", + "start": 0, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "errors": [ + "SyntaxError: Binding 'package' in strict mode (1:11)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + }, + "identifierName": "a" + }, + "name": "a" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 11, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 18 + }, + "identifierName": "package" + }, + "name": "package" + } + ], + "body": { + "type": "BlockStatement", + "start": 20, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "body": [], + "directives": [ + { + "type": "Directive", + "start": 22, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 22, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/517/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/517/options.json deleted file mode 100644 index 9d2a58081596..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/517/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Argument name clash (1:43)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/517/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/517/output.json new file mode 100644 index 000000000000..60ac3ce8c98c --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/517/output.json @@ -0,0 +1,229 @@ +{ + "type": "File", + "start": 0, + "end": 52, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 52 + } + }, + "errors": [ + "SyntaxError: Argument name clash (1:43)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 52, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 52 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 52, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 52 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + }, + "identifierName": "a" + }, + "name": "a" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 13, + "end": 52, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 52 + } + }, + "body": [ + { + "type": "FunctionDeclaration", + "start": 29, + "end": 49, + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 49 + } + }, + "id": { + "type": "Identifier", + "start": 38, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 38 + }, + "end": { + "line": 1, + "column": 39 + }, + "identifierName": "b" + }, + "name": "b" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 40, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 40 + }, + "end": { + "line": 1, + "column": 41 + }, + "identifierName": "t" + }, + "name": "t" + }, + { + "type": "Identifier", + "start": 43, + "end": 44, + "loc": { + "start": { + "line": 1, + "column": 43 + }, + "end": { + "line": 1, + "column": 44 + }, + "identifierName": "t" + }, + "name": "t" + } + ], + "body": { + "type": "BlockStatement", + "start": 46, + "end": 49, + "loc": { + "start": { + "line": 1, + "column": 46 + }, + "end": { + "line": 1, + "column": 49 + } + }, + "body": [], + "directives": [] + } + }, + { + "type": "EmptyStatement", + "start": 49, + "end": 50, + "loc": { + "start": { + "line": 1, + "column": 49 + }, + "end": { + "line": 1, + "column": 50 + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 15, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 15, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/518/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/518/options.json deleted file mode 100644 index 61c3bbb5abe0..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/518/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Argument name clash (1:15)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/518/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/518/output.json new file mode 100644 index 000000000000..766ec14c5a33 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/518/output.json @@ -0,0 +1,180 @@ +{ + "type": "File", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "errors": [ + "SyntaxError: Argument name clash (1:15)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "expression": { + "type": "FunctionExpression", + "start": 1, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "id": { + "type": "Identifier", + "start": 10, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + }, + "identifierName": "a" + }, + "name": "a" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 12, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + }, + "identifierName": "t" + }, + "name": "t" + }, + { + "type": "Identifier", + "start": 15, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + }, + "identifierName": "t" + }, + "name": "t" + } + ], + "body": { + "type": "BlockStatement", + "start": 18, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "body": [], + "directives": [ + { + "type": "Directive", + "start": 20, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 20, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + }, + "extra": { + "parenthesized": true, + "parenStart": 0 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/519/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/519/options.json deleted file mode 100644 index ae469fbd59da..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/519/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Argument name clash (1:44)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/519/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/519/output.json new file mode 100644 index 000000000000..0f2e3c5dce01 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/519/output.json @@ -0,0 +1,233 @@ +{ + "type": "File", + "start": 0, + "end": 54, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 54 + } + }, + "errors": [ + "SyntaxError: Argument name clash (1:44)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 54, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 54 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 54, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 54 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + }, + "identifierName": "a" + }, + "name": "a" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 13, + "end": 54, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 54 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 29, + "end": 52, + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 52 + } + }, + "expression": { + "type": "FunctionExpression", + "start": 30, + "end": 50, + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 50 + } + }, + "id": { + "type": "Identifier", + "start": 39, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 39 + }, + "end": { + "line": 1, + "column": 40 + }, + "identifierName": "b" + }, + "name": "b" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 41, + "end": 42, + "loc": { + "start": { + "line": 1, + "column": 41 + }, + "end": { + "line": 1, + "column": 42 + }, + "identifierName": "t" + }, + "name": "t" + }, + { + "type": "Identifier", + "start": 44, + "end": 45, + "loc": { + "start": { + "line": 1, + "column": 44 + }, + "end": { + "line": 1, + "column": 45 + }, + "identifierName": "t" + }, + "name": "t" + } + ], + "body": { + "type": "BlockStatement", + "start": 47, + "end": 50, + "loc": { + "start": { + "line": 1, + "column": 47 + }, + "end": { + "line": 1, + "column": 50 + } + }, + "body": [], + "directives": [] + }, + "extra": { + "parenthesized": true, + "parenStart": 29 + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 15, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 15, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/520/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/520/options.json deleted file mode 100644 index 3c24c608c88a..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/520/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'eval' in strict mode (1:12)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/520/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/520/output.json new file mode 100644 index 000000000000..7945e482ca86 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/520/output.json @@ -0,0 +1,163 @@ +{ + "type": "File", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "errors": [ + "SyntaxError: Binding 'eval' in strict mode (1:12)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "expression": { + "type": "FunctionExpression", + "start": 1, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "id": { + "type": "Identifier", + "start": 10, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + }, + "identifierName": "a" + }, + "name": "a" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 12, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 16 + }, + "identifierName": "eval" + }, + "name": "eval" + } + ], + "body": { + "type": "BlockStatement", + "start": 18, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "body": [], + "directives": [ + { + "type": "Directive", + "start": 20, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 20, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + }, + "extra": { + "parenthesized": true, + "parenStart": 0 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/521/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/521/options.json deleted file mode 100644 index 96d524816cc9..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/521/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'package' in strict mode (1:12)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/521/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/521/output.json new file mode 100644 index 000000000000..304b4237e9e7 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/521/output.json @@ -0,0 +1,163 @@ +{ + "type": "File", + "start": 0, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "errors": [ + "SyntaxError: Binding 'package' in strict mode (1:12)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "expression": { + "type": "FunctionExpression", + "start": 1, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 38 + } + }, + "id": { + "type": "Identifier", + "start": 10, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + }, + "identifierName": "a" + }, + "name": "a" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 12, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 19 + }, + "identifierName": "package" + }, + "name": "package" + } + ], + "body": { + "type": "BlockStatement", + "start": 21, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 38 + } + }, + "body": [], + "directives": [ + { + "type": "Directive", + "start": 23, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 23, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + }, + "extra": { + "parenthesized": true, + "parenStart": 0 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/522/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/522/options.json deleted file mode 100644 index 0b443b9bacfa..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/522/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Legacy octal literals are not allowed in strict mode (1:65)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/522/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/522/output.json new file mode 100644 index 000000000000..98d2e052715b --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/522/output.json @@ -0,0 +1,285 @@ +{ + "type": "File", + "start": 0, + "end": 69, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 69 + } + }, + "errors": [ + "SyntaxError: Legacy octal literals are not allowed in strict mode (1:65)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 69, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 69 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 13, + "end": 42, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 42 + } + }, + "id": { + "type": "Identifier", + "start": 22, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 25 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 27, + "end": 42, + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 42 + } + }, + "body": [], + "directives": [ + { + "type": "Directive", + "start": 28, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 41 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 28, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 40 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } + }, + { + "type": "FunctionDeclaration", + "start": 42, + "end": 69, + "loc": { + "start": { + "line": 1, + "column": 42 + }, + "end": { + "line": 1, + "column": 69 + } + }, + "id": { + "type": "Identifier", + "start": 51, + "end": 54, + "loc": { + "start": { + "line": 1, + "column": 51 + }, + "end": { + "line": 1, + "column": 54 + }, + "identifierName": "bar" + }, + "name": "bar" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 56, + "end": 69, + "loc": { + "start": { + "line": 1, + "column": 56 + }, + "end": { + "line": 1, + "column": 69 + } + }, + "body": [ + { + "type": "VariableDeclaration", + "start": 57, + "end": 68, + "loc": { + "start": { + "line": 1, + "column": 57 + }, + "end": { + "line": 1, + "column": 68 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 61, + "end": 68, + "loc": { + "start": { + "line": 1, + "column": 61 + }, + "end": { + "line": 1, + "column": 68 + } + }, + "id": { + "type": "Identifier", + "start": 61, + "end": 62, + "loc": { + "start": { + "line": 1, + "column": 61 + }, + "end": { + "line": 1, + "column": 62 + }, + "identifierName": "v" + }, + "name": "v" + }, + "init": { + "type": "NumericLiteral", + "start": 65, + "end": 68, + "loc": { + "start": { + "line": 1, + "column": 65 + }, + "end": { + "line": 1, + "column": 68 + } + }, + "extra": { + "rawValue": 13, + "raw": "015" + }, + "value": 13 + } + } + ], + "kind": "var" + } + ], + "directives": [] + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/523/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/523/options.json deleted file mode 100644 index 60a9d5934bd2..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/523/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected keyword 'this' (1:4)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/523/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/523/output.json new file mode 100644 index 000000000000..90808a26c8be --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/523/output.json @@ -0,0 +1,108 @@ +{ + "type": "File", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "errors": [ + "SyntaxError: Unexpected keyword 'this' (1:4)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 4, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "id": { + "type": "Identifier", + "start": 4, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 8 + }, + "identifierName": "this" + }, + "name": "this" + }, + "init": { + "type": "NumericLiteral", + "start": 11, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "extra": { + "rawValue": 10, + "raw": "10" + }, + "value": 10 + } + } + ], + "kind": "var" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/524/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/524/options.json deleted file mode 100644 index d07b41872ba6..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/524/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Illegal newline after throw (1:5)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/524/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/524/output.json new file mode 100644 index 000000000000..55552e2994ca --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/524/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 3 + } + }, + "errors": [ + "SyntaxError: Illegal newline after throw (1:5)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 3 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ThrowStatement", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 3 + } + }, + "argument": { + "type": "NumericLiteral", + "start": 6, + "end": 8, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 2 + } + }, + "extra": { + "rawValue": 10, + "raw": "10" + }, + "value": 10 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/544/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/544/options.json deleted file mode 100644 index 37c243afff2a..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/544/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected reserved word 'public' (2:8)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/544/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/544/output.json new file mode 100644 index 000000000000..d3b1ca7ae09c --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/544/output.json @@ -0,0 +1,212 @@ +{ + "type": "File", + "start": 0, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 25 + } + }, + "errors": [ + "SyntaxError: Unexpected reserved word 'public' (2:8)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 25 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 14, + "end": 39, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 25 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 20, + "end": 38, + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 24 + } + }, + "id": { + "type": "ObjectPattern", + "start": 20, + "end": 30, + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 16 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 22, + "end": 28, + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 22, + "end": 28, + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 14 + }, + "identifierName": "public" + }, + "name": "public" + }, + "computed": false, + "shorthand": true, + "value": { + "type": "Identifier", + "start": 22, + "end": 28, + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 14 + }, + "identifierName": "public" + }, + "name": "public" + }, + "extra": { + "shorthand": true + } + } + ] + }, + "init": { + "type": "CallExpression", + "start": 33, + "end": 38, + "loc": { + "start": { + "line": 2, + "column": 19 + }, + "end": { + "line": 2, + "column": 24 + } + }, + "callee": { + "type": "Identifier", + "start": 33, + "end": 36, + "loc": { + "start": { + "line": 2, + "column": 19 + }, + "end": { + "line": 2, + "column": 22 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "arguments": [] + } + } + ], + "kind": "const" + } + ], + "directives": [ + { + "type": "Directive", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/545/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/545/options.json index b09fdddc9d0a..2104ca43283f 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/545/options.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/545/options.json @@ -1,4 +1,3 @@ { - "sourceType": "module", - "throws": "Unexpected reserved word 'public' (1:8)" + "sourceType": "module" } diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/545/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/545/output.json new file mode 100644 index 000000000000..34af0a196c39 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/545/output.json @@ -0,0 +1,176 @@ +{ + "type": "File", + "start": 0, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "errors": [ + "SyntaxError: Unexpected reserved word 'public' (1:8)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 0, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 6, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "id": { + "type": "ObjectPattern", + "start": 6, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 8, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 8, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "public" + }, + "name": "public" + }, + "computed": false, + "shorthand": true, + "value": { + "type": "Identifier", + "start": 8, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "public" + }, + "name": "public" + }, + "extra": { + "shorthand": true + } + } + ] + }, + "init": { + "type": "CallExpression", + "start": 19, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "callee": { + "type": "Identifier", + "start": 19, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 22 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "arguments": [] + } + } + ], + "kind": "const" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/547/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/547/options.json deleted file mode 100644 index c2fb6377e80d..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/547/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected reserved word 'arguments' (2:8)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/547/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/547/output.json new file mode 100644 index 000000000000..39ef331a20b1 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/547/output.json @@ -0,0 +1,213 @@ +{ + "type": "File", + "start": 0, + "end": 42, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 28 + } + }, + "errors": [ + "SyntaxError: Unexpected reserved word 'arguments' (2:8)", + "SyntaxError: Binding 'arguments' in strict mode (2:8)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 42, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 28 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 14, + "end": 42, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 28 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 20, + "end": 41, + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 27 + } + }, + "id": { + "type": "ObjectPattern", + "start": 20, + "end": 33, + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 19 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 22, + "end": 31, + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 17 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 22, + "end": 31, + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 17 + }, + "identifierName": "arguments" + }, + "name": "arguments" + }, + "computed": false, + "shorthand": true, + "value": { + "type": "Identifier", + "start": 22, + "end": 31, + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 17 + }, + "identifierName": "arguments" + }, + "name": "arguments" + }, + "extra": { + "shorthand": true + } + } + ] + }, + "init": { + "type": "CallExpression", + "start": 36, + "end": 41, + "loc": { + "start": { + "line": 2, + "column": 22 + }, + "end": { + "line": 2, + "column": 27 + } + }, + "callee": { + "type": "Identifier", + "start": 36, + "end": 39, + "loc": { + "start": { + "line": 2, + "column": 22 + }, + "end": { + "line": 2, + "column": 25 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "arguments": [] + } + } + ], + "kind": "const" + } + ], + "directives": [ + { + "type": "Directive", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/548/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/548/options.json index 4183c2e22534..2104ca43283f 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/548/options.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/548/options.json @@ -1,4 +1,3 @@ { - "sourceType": "module", - "throws": "Unexpected reserved word 'arguments' (1:8)" + "sourceType": "module" } diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/548/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/548/output.json new file mode 100644 index 000000000000..132483692bbd --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/548/output.json @@ -0,0 +1,177 @@ +{ + "type": "File", + "start": 0, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "errors": [ + "SyntaxError: Unexpected reserved word 'arguments' (1:8)", + "SyntaxError: Binding 'arguments' in strict mode (1:8)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 0, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 6, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "id": { + "type": "ObjectPattern", + "start": 6, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 8, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 8, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 17 + }, + "identifierName": "arguments" + }, + "name": "arguments" + }, + "computed": false, + "shorthand": true, + "value": { + "type": "Identifier", + "start": 8, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 17 + }, + "identifierName": "arguments" + }, + "name": "arguments" + }, + "extra": { + "shorthand": true + } + } + ] + }, + "init": { + "type": "CallExpression", + "start": 22, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "callee": { + "type": "Identifier", + "start": 22, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 25 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "arguments": [] + } + } + ], + "kind": "const" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/550/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/550/options.json deleted file mode 100644 index 5cee88d901e4..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/550/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Legacy octal literals are not allowed in strict mode (2:10)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/550/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/550/output.json new file mode 100644 index 000000000000..9b383cded8fd --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/550/output.json @@ -0,0 +1,144 @@ +{ + "type": "File", + "start": 0, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 13 + } + }, + "errors": [ + "SyntaxError: Legacy octal literals are not allowed in strict mode (2:10)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 13 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 14, + "end": 27, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 13 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 20, + "end": 26, + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 12 + } + }, + "id": { + "type": "Identifier", + "start": 20, + "end": 21, + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 7 + }, + "identifierName": "a" + }, + "name": "a" + }, + "init": { + "type": "NumericLiteral", + "start": 24, + "end": 26, + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 12 + } + }, + "extra": { + "rawValue": 7, + "raw": "07" + }, + "value": 7 + } + } + ], + "kind": "const" + } + ], + "directives": [ + { + "type": "Directive", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/552/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/552/options.json deleted file mode 100644 index 5cee88d901e4..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/552/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Legacy octal literals are not allowed in strict mode (2:10)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/552/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/552/output.json new file mode 100644 index 000000000000..a7d3e10860a2 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/552/output.json @@ -0,0 +1,144 @@ +{ + "type": "File", + "start": 0, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 13 + } + }, + "errors": [ + "SyntaxError: Legacy octal literals are not allowed in strict mode (2:10)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 13 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 14, + "end": 27, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 13 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 20, + "end": 26, + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 12 + } + }, + "id": { + "type": "Identifier", + "start": 20, + "end": 21, + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 7 + }, + "identifierName": "a" + }, + "name": "a" + }, + "init": { + "type": "NumericLiteral", + "start": 24, + "end": 26, + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 12 + } + }, + "extra": { + "rawValue": 8, + "raw": "08" + }, + "value": 8 + } + } + ], + "kind": "const" + } + ], + "directives": [ + { + "type": "Directive", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/556/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/556/options.json index eff49cbfba64..0861962d889d 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/556/options.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/556/options.json @@ -1,4 +1,3 @@ { - "createParenthesizedExpressions": true, - "throws": "You're trying to assign to a parenthesized expression, eg. instead of `({a}) = 0` use `({a} = 0)` (1:1)" + "createParenthesizedExpressions": true } diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/556/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/556/output.json new file mode 100644 index 000000000000..fe203d04bcc6 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/556/output.json @@ -0,0 +1,228 @@ +{ + "type": "File", + "start": 0, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "errors": [ + "SyntaxError: Invalid parenthesized assignment pattern (1:0)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "operator": "=", + "left": { + "type": "ParenthesizedExpression", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "expression": { + "type": "ObjectPattern", + "start": 1, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 2, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 2, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + }, + "identifierName": "x" + }, + "name": "x" + }, + "computed": false, + "shorthand": true, + "value": { + "type": "Identifier", + "start": 2, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + }, + "identifierName": "x" + }, + "name": "x" + }, + "extra": { + "shorthand": true + } + } + ] + } + }, + "right": { + "type": "ObjectExpression", + "start": 8, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 9, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 9, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + }, + "identifierName": "x" + }, + "name": "x" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "NumericLiteral", + "start": 12, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + ] + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/558/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/558/options.json index f37c4bc95c57..0861962d889d 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/558/options.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/558/options.json @@ -1,4 +1,3 @@ { - "createParenthesizedExpressions": true, - "throws": "You're trying to assign to a parenthesized expression, eg. instead of `([a]) = 0` use `([a] = 0)` (1:1)" + "createParenthesizedExpressions": true } diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/558/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/558/output.json new file mode 100644 index 000000000000..c59930c19e03 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/558/output.json @@ -0,0 +1,134 @@ +{ + "type": "File", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "errors": [ + "SyntaxError: Invalid parenthesized assignment pattern (1:0)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "operator": "=", + "left": { + "type": "ParenthesizedExpression", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "expression": { + "type": "ArrayPattern", + "start": 1, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "elements": [ + { + "type": "Identifier", + "start": 2, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + }, + "identifierName": "a" + }, + "name": "a" + } + ] + } + }, + "right": { + "type": "ArrayExpression", + "start": 8, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "elements": [] + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/559/input.js b/packages/babel-parser/test/fixtures/core/uncategorised/559/input.js new file mode 100644 index 000000000000..0a7f8682331a --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/559/input.js @@ -0,0 +1 @@ +(a = 1) = t \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/559/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/559/options.json new file mode 100644 index 000000000000..0861962d889d --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/559/options.json @@ -0,0 +1,3 @@ +{ + "createParenthesizedExpressions": true +} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/559/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/559/output.json new file mode 100644 index 000000000000..2a57774bc903 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/559/output.json @@ -0,0 +1,153 @@ +{ + "type": "File", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "errors": [ + "SyntaxError: Invalid parenthesized assignment pattern (1:0)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "operator": "=", + "left": { + "type": "ParenthesizedExpression", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "expression": { + "type": "AssignmentPattern", + "start": 1, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "left": { + "type": "Identifier", + "start": 1, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + }, + "identifierName": "a" + }, + "name": "a" + }, + "right": { + "type": "NumericLiteral", + "start": 5, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + }, + "right": { + "type": "Identifier", + "start": 10, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + }, + "identifierName": "t" + }, + "name": "t" + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/560/input.js b/packages/babel-parser/test/fixtures/core/uncategorised/560/input.js new file mode 100644 index 000000000000..93c05a981b37 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/560/input.js @@ -0,0 +1 @@ +[(a = 1)] = t \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/560/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/560/options.json new file mode 100644 index 000000000000..0861962d889d --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/560/options.json @@ -0,0 +1,3 @@ +{ + "createParenthesizedExpressions": true +} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/560/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/560/output.json new file mode 100644 index 000000000000..52e007997957 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/560/output.json @@ -0,0 +1,170 @@ +{ + "type": "File", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "errors": [ + "SyntaxError: Invalid parenthesized assignment pattern (1:1)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "operator": "=", + "left": { + "type": "ArrayPattern", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "elements": [ + { + "type": "ParenthesizedExpression", + "start": 1, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "expression": { + "type": "AssignmentPattern", + "start": 2, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "left": { + "type": "Identifier", + "start": 2, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + }, + "identifierName": "a" + }, + "name": "a" + }, + "right": { + "type": "NumericLiteral", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + } + ] + }, + "right": { + "type": "Identifier", + "start": 12, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + }, + "identifierName": "t" + }, + "name": "t" + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/561/input.js b/packages/babel-parser/test/fixtures/core/uncategorised/561/input.js new file mode 100644 index 000000000000..18b5e0796da0 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/561/input.js @@ -0,0 +1 @@ +[({ a: [b = 2]})] = t \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/561/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/561/options.json new file mode 100644 index 000000000000..0861962d889d --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/561/options.json @@ -0,0 +1,3 @@ +{ + "createParenthesizedExpressions": true +} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/561/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/561/output.json new file mode 100644 index 000000000000..6cd38c81eda0 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/561/output.json @@ -0,0 +1,239 @@ +{ + "type": "File", + "start": 0, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "errors": [ + "SyntaxError: Invalid parenthesized assignment pattern (1:1)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 0, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "operator": "=", + "left": { + "type": "ArrayPattern", + "start": 0, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "elements": [ + { + "type": "ParenthesizedExpression", + "start": 1, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "expression": { + "type": "ObjectPattern", + "start": 2, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 4, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 4, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + }, + "identifierName": "a" + }, + "name": "a" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "ArrayPattern", + "start": 7, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "elements": [ + { + "type": "AssignmentPattern", + "start": 8, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "left": { + "type": "Identifier", + "start": 8, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + }, + "identifierName": "b" + }, + "name": "b" + }, + "right": { + "type": "NumericLiteral", + "start": 12, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "extra": { + "rawValue": 2, + "raw": "2" + }, + "value": 2 + } + } + ] + } + } + ] + } + } + ] + }, + "right": { + "type": "Identifier", + "start": 20, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + }, + "identifierName": "t" + }, + "name": "t" + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/562/input.js b/packages/babel-parser/test/fixtures/core/uncategorised/562/input.js new file mode 100644 index 000000000000..2181f4c1d572 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/562/input.js @@ -0,0 +1 @@ +[{b: [([a = 1])]}] = t \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/562/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/562/options.json new file mode 100644 index 000000000000..0861962d889d --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/562/options.json @@ -0,0 +1,3 @@ +{ + "createParenthesizedExpressions": true +} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/562/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/562/output.json new file mode 100644 index 000000000000..f30a6c123cb2 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/562/output.json @@ -0,0 +1,256 @@ +{ + "type": "File", + "start": 0, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "errors": [ + "SyntaxError: Invalid parenthesized assignment pattern (1:6)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 0, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "operator": "=", + "left": { + "type": "ArrayPattern", + "start": 0, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "elements": [ + { + "type": "ObjectPattern", + "start": 1, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 2, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 2, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + }, + "identifierName": "b" + }, + "name": "b" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "ArrayPattern", + "start": 5, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "elements": [ + { + "type": "ParenthesizedExpression", + "start": 6, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "expression": { + "type": "ArrayPattern", + "start": 7, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "elements": [ + { + "type": "AssignmentPattern", + "start": 8, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "left": { + "type": "Identifier", + "start": 8, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + }, + "identifierName": "a" + }, + "name": "a" + }, + "right": { + "type": "NumericLiteral", + "start": 12, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + ] + } + } + ] + } + } + ] + } + ] + }, + "right": { + "type": "Identifier", + "start": 21, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + }, + "identifierName": "t" + }, + "name": "t" + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/563/input.js b/packages/babel-parser/test/fixtures/core/uncategorised/563/input.js new file mode 100644 index 000000000000..0100e137ff7f --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/563/input.js @@ -0,0 +1 @@ +[([x])] = t; \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/563/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/563/options.json new file mode 100644 index 000000000000..0861962d889d --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/563/options.json @@ -0,0 +1,3 @@ +{ + "createParenthesizedExpressions": true +} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/563/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/563/output.json new file mode 100644 index 000000000000..a3ddc206db84 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/563/output.json @@ -0,0 +1,152 @@ +{ + "type": "File", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "errors": [ + "SyntaxError: Invalid parenthesized assignment pattern (1:1)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "operator": "=", + "left": { + "type": "ArrayPattern", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "elements": [ + { + "type": "ParenthesizedExpression", + "start": 1, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "expression": { + "type": "ArrayPattern", + "start": 2, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "elements": [ + { + "type": "Identifier", + "start": 3, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 4 + }, + "identifierName": "x" + }, + "name": "x" + } + ] + } + } + ] + }, + "right": { + "type": "Identifier", + "start": 10, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + }, + "identifierName": "t" + }, + "name": "t" + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/564/input.js b/packages/babel-parser/test/fixtures/core/uncategorised/564/input.js new file mode 100644 index 000000000000..821f2c5a3c37 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/564/input.js @@ -0,0 +1 @@ +[(a.x)] = t; \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/564/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/564/options.json new file mode 100644 index 000000000000..0861962d889d --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/564/options.json @@ -0,0 +1,3 @@ +{ + "createParenthesizedExpressions": true +} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/564/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/564/output.json new file mode 100644 index 000000000000..689a18f8031f --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/564/output.json @@ -0,0 +1,165 @@ +{ + "type": "File", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "operator": "=", + "left": { + "type": "ArrayPattern", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "elements": [ + { + "type": "ParenthesizedExpression", + "start": 1, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "expression": { + "type": "MemberExpression", + "start": 2, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "object": { + "type": "Identifier", + "start": 2, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + }, + "identifierName": "a" + }, + "name": "a" + }, + "property": { + "type": "Identifier", + "start": 4, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + }, + "identifierName": "x" + }, + "name": "x" + }, + "computed": false + } + } + ] + }, + "right": { + "type": "Identifier", + "start": 10, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + }, + "identifierName": "t" + }, + "name": "t" + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/565/input.js b/packages/babel-parser/test/fixtures/core/uncategorised/565/input.js new file mode 100644 index 000000000000..d2e8408e783a --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/565/input.js @@ -0,0 +1 @@ +[(x)] = t; \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/565/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/565/options.json new file mode 100644 index 000000000000..0861962d889d --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/565/options.json @@ -0,0 +1,3 @@ +{ + "createParenthesizedExpressions": true +} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/565/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/565/output.json new file mode 100644 index 000000000000..19de7b03868d --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/565/output.json @@ -0,0 +1,132 @@ +{ + "type": "File", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "operator": "=", + "left": { + "type": "ArrayPattern", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "elements": [ + { + "type": "ParenthesizedExpression", + "start": 1, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "expression": { + "type": "Identifier", + "start": 2, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + }, + "identifierName": "x" + }, + "name": "x" + } + } + ] + }, + "right": { + "type": "Identifier", + "start": 8, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + }, + "identifierName": "t" + }, + "name": "t" + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/566/input.js b/packages/babel-parser/test/fixtures/core/uncategorised/566/input.js new file mode 100644 index 000000000000..320748c0282f --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/566/input.js @@ -0,0 +1 @@ +[(((x)))] = t; \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/566/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/566/options.json new file mode 100644 index 000000000000..0861962d889d --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/566/options.json @@ -0,0 +1,3 @@ +{ + "createParenthesizedExpressions": true +} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/566/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/566/output.json new file mode 100644 index 000000000000..2e4db8c547f6 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/566/output.json @@ -0,0 +1,162 @@ +{ + "type": "File", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "operator": "=", + "left": { + "type": "ArrayPattern", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "elements": [ + { + "type": "ParenthesizedExpression", + "start": 1, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "expression": { + "type": "ParenthesizedExpression", + "start": 2, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "expression": { + "type": "ParenthesizedExpression", + "start": 3, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "expression": { + "type": "Identifier", + "start": 4, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + }, + "identifierName": "x" + }, + "name": "x" + } + } + } + } + ] + }, + "right": { + "type": "Identifier", + "start": 12, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + }, + "identifierName": "t" + }, + "name": "t" + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/array-rest-spread/comma-after-rest/options.json b/packages/babel-parser/test/fixtures/es2015/array-rest-spread/comma-after-rest/options.json deleted file mode 100644 index daa827f45cc4..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/array-rest-spread/comma-after-rest/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Rest element must be last element (1:5)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/array-rest-spread/comma-after-rest/output.json b/packages/babel-parser/test/fixtures/es2015/array-rest-spread/comma-after-rest/output.json new file mode 100644 index 000000000000..3d5c2a07c806 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/array-rest-spread/comma-after-rest/output.json @@ -0,0 +1,137 @@ +{ + "type": "File", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "errors": [ + "SyntaxError: Unexpected trailing comma after rest element (1:5)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "operator": "=", + "left": { + "type": "ArrayPattern", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "extra": { + "trailingComma": 5 + }, + "elements": [ + { + "type": "RestElement", + "start": 1, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "argument": { + "type": "Identifier", + "start": 4, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + }, + "identifierName": "a" + }, + "name": "a" + } + } + ] + }, + "right": { + "type": "ArrayExpression", + "start": 10, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "elements": [] + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/array-rest-spread/comma-after-spread-for-in/input.js b/packages/babel-parser/test/fixtures/es2015/array-rest-spread/comma-after-spread-for-in/input.js new file mode 100644 index 000000000000..b58efbd91c33 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/array-rest-spread/comma-after-spread-for-in/input.js @@ -0,0 +1 @@ +for ([...a,] in []); diff --git a/packages/babel-parser/test/fixtures/es2015/array-rest-spread/comma-after-spread-for-in/output.json b/packages/babel-parser/test/fixtures/es2015/array-rest-spread/comma-after-spread-for-in/output.json new file mode 100644 index 000000000000..f97d7f0db889 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/array-rest-spread/comma-after-spread-for-in/output.json @@ -0,0 +1,136 @@ +{ + "type": "File", + "start": 0, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "errors": [ + "SyntaxError: Unexpected trailing comma after rest element (1:10)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ForInStatement", + "start": 0, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "left": { + "type": "ArrayPattern", + "start": 5, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "extra": { + "trailingComma": 10 + }, + "elements": [ + { + "type": "RestElement", + "start": 6, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "argument": { + "type": "Identifier", + "start": 9, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + }, + "identifierName": "a" + }, + "name": "a" + } + } + ] + }, + "right": { + "type": "ArrayExpression", + "start": 16, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "elements": [] + }, + "body": { + "type": "EmptyStatement", + "start": 19, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/array-rest-spread/comma-after-spread-nested/input.js b/packages/babel-parser/test/fixtures/es2015/array-rest-spread/comma-after-spread-nested/input.js new file mode 100644 index 000000000000..0e2c4750076e --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/array-rest-spread/comma-after-spread-nested/input.js @@ -0,0 +1 @@ +[[...a,]] = []; \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/array-rest-spread/comma-after-spread-nested/output.json b/packages/babel-parser/test/fixtures/es2015/array-rest-spread/comma-after-spread-nested/output.json new file mode 100644 index 000000000000..4cbc33abae7e --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/array-rest-spread/comma-after-spread-nested/output.json @@ -0,0 +1,154 @@ +{ + "type": "File", + "start": 0, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "errors": [ + "SyntaxError: Unexpected trailing comma after rest element (1:6)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "operator": "=", + "left": { + "type": "ArrayPattern", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "elements": [ + { + "type": "ArrayPattern", + "start": 1, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "extra": { + "trailingComma": 6 + }, + "elements": [ + { + "type": "RestElement", + "start": 2, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "argument": { + "type": "Identifier", + "start": 5, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + }, + "identifierName": "a" + }, + "name": "a" + } + } + ] + } + ] + }, + "right": { + "type": "ArrayExpression", + "start": 12, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "elements": [] + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/array-rest-spread/comma-after-spread/output.json b/packages/babel-parser/test/fixtures/es2015/array-rest-spread/comma-after-spread/output.json index 5874666e2695..0a80d6e9f99b 100644 --- a/packages/babel-parser/test/fixtures/es2015/array-rest-spread/comma-after-spread/output.json +++ b/packages/babel-parser/test/fixtures/es2015/array-rest-spread/comma-after-spread/output.json @@ -90,7 +90,10 @@ "name": "a" } } - ] + ], + "extra": { + "trailingComma": 5 + } } } ], diff --git a/packages/babel-parser/test/fixtures/es2015/arrow-functions/comma-after-rest-param/options.json b/packages/babel-parser/test/fixtures/es2015/arrow-functions/comma-after-rest-param/options.json index 65ed8c638978..31d4d73d6c85 100644 --- a/packages/babel-parser/test/fixtures/es2015/arrow-functions/comma-after-rest-param/options.json +++ b/packages/babel-parser/test/fixtures/es2015/arrow-functions/comma-after-rest-param/options.json @@ -1,3 +1,3 @@ { - "throws": "Rest element must be last element (1:8)" + "throws": "Unexpected token, expected \")\" (1:8)" } diff --git a/packages/babel-parser/test/fixtures/es2015/class-methods/direct-super-in-object-method/options.json b/packages/babel-parser/test/fixtures/es2015/class-methods/direct-super-in-object-method/options.json deleted file mode 100644 index 660e644cf6a5..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/class-methods/direct-super-in-object-method/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "super is only allowed in object methods and classes (4:13)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/class-methods/direct-super-in-object-method/output.json b/packages/babel-parser/test/fixtures/es2015/class-methods/direct-super-in-object-method/output.json new file mode 100644 index 000000000000..6a343317ea61 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/class-methods/direct-super-in-object-method/output.json @@ -0,0 +1,340 @@ +{ + "type": "File", + "start": 0, + "end": 87, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 7, + "column": 3 + } + }, + "errors": [ + "SyntaxError: super is only allowed in object methods and classes (4:13)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 87, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 7, + "column": 3 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 87, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 7, + "column": 3 + } + }, + "expression": { + "type": "CallExpression", + "start": 0, + "end": 86, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 7, + "column": 2 + } + }, + "callee": { + "type": "MemberExpression", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "object": { + "type": "Identifier", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + }, + "identifierName": "Object" + }, + "name": "Object" + }, + "property": { + "type": "Identifier", + "start": 7, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 13 + }, + "identifierName": "create" + }, + "name": "create" + }, + "computed": false + }, + "arguments": [ + { + "type": "ObjectExpression", + "start": 14, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "properties": [] + }, + { + "type": "ObjectExpression", + "start": 18, + "end": 85, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 7, + "column": 1 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 22, + "end": 83, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 6, + "column": 3 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 22, + "end": 25, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 5 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "ObjectExpression", + "start": 27, + "end": 83, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 6, + "column": 3 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 33, + "end": 79, + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 5, + "column": 5 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 33, + "end": 36, + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 7 + }, + "identifierName": "get" + }, + "name": "get" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "FunctionExpression", + "start": 38, + "end": 79, + "loc": { + "start": { + "line": 3, + "column": 9 + }, + "end": { + "line": 5, + "column": 5 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 48, + "end": 79, + "loc": { + "start": { + "line": 3, + "column": 19 + }, + "end": { + "line": 5, + "column": 5 + } + }, + "body": [ + { + "type": "ReturnStatement", + "start": 56, + "end": 73, + "loc": { + "start": { + "line": 4, + "column": 6 + }, + "end": { + "line": 4, + "column": 23 + } + }, + "argument": { + "type": "MemberExpression", + "start": 63, + "end": 72, + "loc": { + "start": { + "line": 4, + "column": 13 + }, + "end": { + "line": 4, + "column": 22 + } + }, + "object": { + "type": "Super", + "start": 63, + "end": 68, + "loc": { + "start": { + "line": 4, + "column": 13 + }, + "end": { + "line": 4, + "column": 18 + } + } + }, + "property": { + "type": "Identifier", + "start": 69, + "end": 72, + "loc": { + "start": { + "line": 4, + "column": 19 + }, + "end": { + "line": 4, + "column": 22 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "computed": false + } + } + ], + "directives": [] + } + } + } + ] + } + } + ] + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/class-methods/direct-super-outside-constructor/options.json b/packages/babel-parser/test/fixtures/es2015/class-methods/direct-super-outside-constructor/options.json deleted file mode 100644 index 9461325c423a..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/class-methods/direct-super-outside-constructor/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "super() is only valid inside a class constructor of a subclass. Maybe a typo in the method name ('constructor') or not extending another class? (2:8)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/class-methods/direct-super-outside-constructor/output.json b/packages/babel-parser/test/fixtures/es2015/class-methods/direct-super-outside-constructor/output.json new file mode 100644 index 000000000000..65fe6001d2c6 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/class-methods/direct-super-outside-constructor/output.json @@ -0,0 +1,191 @@ +{ + "type": "File", + "start": 0, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "errors": [ + "SyntaxError: super() is only valid inside a class constructor of a subclass. Maybe a typo in the method name ('constructor') or not extending another class? (2:8)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "A" + }, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 8, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": [ + { + "type": "ClassMethod", + "start": 12, + "end": 26, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 16 + } + }, + "static": false, + "key": { + "type": "Identifier", + "start": 12, + "end": 13, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 3 + }, + "identifierName": "x" + }, + "name": "x" + }, + "computed": false, + "kind": "method", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 26, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 16 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 18, + "end": 25, + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 15 + } + }, + "expression": { + "type": "CallExpression", + "start": 18, + "end": 25, + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 15 + } + }, + "callee": { + "type": "Super", + "start": 18, + "end": 23, + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 13 + } + } + }, + "arguments": [] + } + } + ], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/class-methods/disallow-duplicate-method-params/options.json b/packages/babel-parser/test/fixtures/es2015/class-methods/disallow-duplicate-method-params/options.json deleted file mode 100644 index c7a2c3ba50a0..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/class-methods/disallow-duplicate-method-params/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Argument name clash (2:11)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/class-methods/disallow-duplicate-method-params/output.json b/packages/babel-parser/test/fixtures/es2015/class-methods/disallow-duplicate-method-params/output.json new file mode 100644 index 000000000000..328e55a13f5d --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/class-methods/disallow-duplicate-method-params/output.json @@ -0,0 +1,179 @@ +{ + "type": "File", + "start": 0, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Argument name clash (2:11)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 9 + }, + "identifierName": "Foo" + }, + "name": "Foo" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 10, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": [ + { + "type": "ClassMethod", + "start": 16, + "end": 28, + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 16 + } + }, + "static": false, + "key": { + "type": "Identifier", + "start": 16, + "end": 19, + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 7 + }, + "identifierName": "bar" + }, + "name": "bar" + }, + "computed": false, + "kind": "method", + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 20, + "end": 21, + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 9 + }, + "identifierName": "a" + }, + "name": "a" + }, + { + "type": "Identifier", + "start": 23, + "end": 24, + "loc": { + "start": { + "line": 2, + "column": 11 + }, + "end": { + "line": 2, + "column": 12 + }, + "identifierName": "a" + }, + "name": "a" + } + ], + "body": { + "type": "BlockStatement", + "start": 26, + "end": 28, + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 16 + } + }, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/class-methods/disallow-static-generator-prototype/options.json b/packages/babel-parser/test/fixtures/es2015/class-methods/disallow-static-generator-prototype/options.json deleted file mode 100644 index 524ed587e113..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/class-methods/disallow-static-generator-prototype/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Classes may not have static property named prototype (2:10)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/class-methods/disallow-static-generator-prototype/output.json b/packages/babel-parser/test/fixtures/es2015/class-methods/disallow-static-generator-prototype/output.json new file mode 100644 index 000000000000..0ffcd2fd0520 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/class-methods/disallow-static-generator-prototype/output.json @@ -0,0 +1,144 @@ +{ + "type": "File", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Classes may not have static property named prototype (2:10)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "A" + }, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 8, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": [ + { + "type": "ClassMethod", + "start": 12, + "end": 34, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 24 + } + }, + "static": true, + "kind": "method", + "key": { + "type": "Identifier", + "start": 20, + "end": 29, + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 19 + }, + "identifierName": "prototype" + }, + "name": "prototype" + }, + "computed": false, + "id": null, + "generator": true, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 32, + "end": 34, + "loc": { + "start": { + "line": 2, + "column": 22 + }, + "end": { + "line": 2, + "column": 24 + } + }, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/class-methods/disallow-static-prototype/options.json b/packages/babel-parser/test/fixtures/es2015/class-methods/disallow-static-prototype/options.json deleted file mode 100644 index f30c8a49abd3..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/class-methods/disallow-static-prototype/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Classes may not have static property named prototype (2:9)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/class-methods/disallow-static-prototype/output.json b/packages/babel-parser/test/fixtures/es2015/class-methods/disallow-static-prototype/output.json new file mode 100644 index 000000000000..f78f786f6aa9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/class-methods/disallow-static-prototype/output.json @@ -0,0 +1,144 @@ +{ + "type": "File", + "start": 0, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Classes may not have static property named prototype (2:9)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "A" + }, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 8, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": [ + { + "type": "ClassMethod", + "start": 12, + "end": 33, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 23 + } + }, + "static": true, + "key": { + "type": "Identifier", + "start": 19, + "end": 28, + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 18 + }, + "identifierName": "prototype" + }, + "name": "prototype" + }, + "computed": false, + "kind": "method", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 31, + "end": 33, + "loc": { + "start": { + "line": 2, + "column": 21 + }, + "end": { + "line": 2, + "column": 23 + } + }, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/class-methods/getter-signature/options.json b/packages/babel-parser/test/fixtures/es2015/class-methods/getter-signature/options.json deleted file mode 100644 index 65bc24a66fcd..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/class-methods/getter-signature/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "getter must not have any formal parameters (2:2)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/class-methods/getter-signature/output.json b/packages/babel-parser/test/fixtures/es2015/class-methods/getter-signature/output.json new file mode 100644 index 000000000000..1f5262e935f3 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/class-methods/getter-signature/output.json @@ -0,0 +1,162 @@ +{ + "type": "File", + "start": 0, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "errors": [ + "SyntaxError: getter must not have any formal parameters (2:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "A" + }, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 8, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": [ + { + "type": "ClassMethod", + "start": 12, + "end": 29, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 19 + } + }, + "static": false, + "key": { + "type": "Identifier", + "start": 16, + "end": 20, + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 10 + }, + "identifierName": "prop" + }, + "name": "prop" + }, + "computed": false, + "kind": "get", + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 22, + "end": 25, + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 15 + }, + "identifierName": "arg" + }, + "name": "arg" + } + ], + "body": { + "type": "BlockStatement", + "start": 27, + "end": 29, + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 19 + } + }, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/class-methods/malformed-super-expression/options.json b/packages/babel-parser/test/fixtures/es2015/class-methods/malformed-super-expression/options.json deleted file mode 100644 index dc41f0b14b5a..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/class-methods/malformed-super-expression/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected token (3:10)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/class-methods/malformed-super-expression/output.json b/packages/babel-parser/test/fixtures/es2015/class-methods/malformed-super-expression/output.json new file mode 100644 index 000000000000..6ecafb90e3ab --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/class-methods/malformed-super-expression/output.json @@ -0,0 +1,211 @@ +{ + "type": "File", + "start": 0, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "errors": [ + "SyntaxError: super can only be used with function calls (i.e. super()) or in property accesses (i.e. super.prop or super[prop]) (3:4)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "A" + }, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 8, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "body": [ + { + "type": "ClassMethod", + "start": 12, + "end": 37, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 4, + "column": 3 + } + }, + "static": false, + "key": { + "type": "Identifier", + "start": 12, + "end": 13, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 3 + }, + "identifierName": "x" + }, + "name": "x" + }, + "computed": false, + "kind": "method", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 37, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 4, + "column": 3 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 23, + "end": 33, + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 14 + } + }, + "expression": { + "type": "BinaryExpression", + "start": 23, + "end": 32, + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 13 + } + }, + "left": { + "type": "Super", + "start": 23, + "end": 28, + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 9 + } + } + }, + "operator": "-", + "right": { + "type": "NumericLiteral", + "start": 31, + "end": 32, + "loc": { + "start": { + "line": 3, + "column": 12 + }, + "end": { + "line": 3, + "column": 13 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + } + ], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/class/extends-strict/options.json b/packages/babel-parser/test/fixtures/es2015/class/extends-strict/options.json deleted file mode 100644 index 09a1c52e4354..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/class/extends-strict/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "'with' in strict mode (2:2)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/class/extends-strict/output.json b/packages/babel-parser/test/fixtures/es2015/class/extends-strict/output.json new file mode 100644 index 000000000000..efd21a8e7118 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/class/extends-strict/output.json @@ -0,0 +1,237 @@ +{ + "type": "File", + "start": 0, + "end": 64, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 7 + } + }, + "errors": [ + "SyntaxError: 'with' in strict mode (2:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 64, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 7 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 64, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 7 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "C" + }, + "name": "C" + }, + "superClass": { + "type": "CallExpression", + "start": 17, + "end": 60, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 4, + "column": 3 + } + }, + "callee": { + "type": "FunctionExpression", + "start": 17, + "end": 58, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 26, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 27 + }, + "identifierName": "B" + }, + "name": "B" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 30, + "end": 58, + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "body": [ + { + "type": "WithStatement", + "start": 34, + "end": 44, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 12 + } + }, + "object": { + "type": "ObjectExpression", + "start": 40, + "end": 42, + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 10 + } + }, + "properties": [] + }, + "body": { + "type": "EmptyStatement", + "start": 43, + "end": 44, + "loc": { + "start": { + "line": 2, + "column": 11 + }, + "end": { + "line": 2, + "column": 12 + } + } + } + }, + { + "type": "ReturnStatement", + "start": 47, + "end": 56, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 11 + } + }, + "argument": { + "type": "Identifier", + "start": 54, + "end": 55, + "loc": { + "start": { + "line": 3, + "column": 9 + }, + "end": { + "line": 3, + "column": 10 + }, + "identifierName": "B" + }, + "name": "B" + } + } + ], + "directives": [] + } + }, + "arguments": [], + "extra": { + "parenthesized": true, + "parenStart": 16 + } + }, + "body": { + "type": "ClassBody", + "start": 62, + "end": 64, + "loc": { + "start": { + "line": 4, + "column": 5 + }, + "end": { + "line": 4, + "column": 7 + } + }, + "body": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/class/invalid-escape-get/options.json b/packages/babel-parser/test/fixtures/es2015/class/invalid-escape-get/options.json index 1e730e170733..d5583f7bc5ba 100644 --- a/packages/babel-parser/test/fixtures/es2015/class/invalid-escape-get/options.json +++ b/packages/babel-parser/test/fixtures/es2015/class/invalid-escape-get/options.json @@ -1,3 +1,3 @@ { "throws": "Unexpected token (1:19)" -} \ No newline at end of file +} diff --git a/packages/babel-parser/test/fixtures/es2015/class/invalid-escape-set/options.json b/packages/babel-parser/test/fixtures/es2015/class/invalid-escape-set/options.json index 1e730e170733..d5583f7bc5ba 100644 --- a/packages/babel-parser/test/fixtures/es2015/class/invalid-escape-set/options.json +++ b/packages/babel-parser/test/fixtures/es2015/class/invalid-escape-set/options.json @@ -1,3 +1,3 @@ { "throws": "Unexpected token (1:19)" -} \ No newline at end of file +} diff --git a/packages/babel-parser/test/fixtures/es2015/class/invalid-escape-static/options.json b/packages/babel-parser/test/fixtures/es2015/class/invalid-escape-static/options.json index b23f881870cf..a015cd4108e6 100644 --- a/packages/babel-parser/test/fixtures/es2015/class/invalid-escape-static/options.json +++ b/packages/babel-parser/test/fixtures/es2015/class/invalid-escape-static/options.json @@ -1,3 +1,3 @@ { "throws": "Unexpected token (1:22)" -} \ No newline at end of file +} diff --git a/packages/babel-parser/test/fixtures/es2015/destructuring/binding-this/input.js b/packages/babel-parser/test/fixtures/es2015/destructuring/binding-this/input.js index 11cebfa18894..42403a50ea26 100644 --- a/packages/babel-parser/test/fixtures/es2015/destructuring/binding-this/input.js +++ b/packages/babel-parser/test/fixtures/es2015/destructuring/binding-this/input.js @@ -1 +1 @@ -var { this }; +var { this } = {}; diff --git a/packages/babel-parser/test/fixtures/es2015/destructuring/binding-this/options.json b/packages/babel-parser/test/fixtures/es2015/destructuring/binding-this/options.json deleted file mode 100644 index 1b54b61689e7..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/destructuring/binding-this/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected keyword 'this' (1:6)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/destructuring/binding-this/output.json b/packages/babel-parser/test/fixtures/es2015/destructuring/binding-this/output.json new file mode 100644 index 000000000000..7d830d569103 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/destructuring/binding-this/output.json @@ -0,0 +1,159 @@ +{ + "type": "File", + "start": 0, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "errors": [ + "SyntaxError: Unexpected keyword 'this' (1:6)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 0, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 4, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "id": { + "type": "ObjectPattern", + "start": 4, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 6, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 6, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 10 + }, + "identifierName": "this" + }, + "name": "this" + }, + "computed": false, + "shorthand": true, + "value": { + "type": "Identifier", + "start": 6, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 10 + }, + "identifierName": "this" + }, + "name": "this" + }, + "extra": { + "shorthand": true + } + } + ] + }, + "init": { + "type": "ObjectExpression", + "start": 15, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "properties": [] + } + } + ], + "kind": "var" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/destructuring/duplicate-proto-1/input.js b/packages/babel-parser/test/fixtures/es2015/destructuring/duplicate-proto-1/input.js new file mode 100644 index 000000000000..494000aa3793 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/destructuring/duplicate-proto-1/input.js @@ -0,0 +1 @@ +({ __proto__: x, __proto__: y } = {}); diff --git a/packages/babel-parser/test/fixtures/es2015/destructuring/duplicate-proto-1/output.json b/packages/babel-parser/test/fixtures/es2015/destructuring/duplicate-proto-1/output.json new file mode 100644 index 000000000000..f82a656eae43 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/destructuring/duplicate-proto-1/output.json @@ -0,0 +1,207 @@ +{ + "type": "File", + "start": 0, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 38 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 38 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 38 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 1, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "operator": "=", + "left": { + "type": "ObjectPattern", + "start": 1, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 3, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 3, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 12 + }, + "identifierName": "__proto__" + }, + "name": "__proto__" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "Identifier", + "start": 14, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + }, + "identifierName": "x" + }, + "name": "x" + } + }, + { + "type": "ObjectProperty", + "start": 17, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 17, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 26 + }, + "identifierName": "__proto__" + }, + "name": "__proto__" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "Identifier", + "start": 28, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 29 + }, + "identifierName": "y" + }, + "name": "y" + } + } + ] + }, + "right": { + "type": "ObjectExpression", + "start": 34, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 34 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "properties": [] + }, + "extra": { + "parenthesized": true, + "parenStart": 0 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/destructuring/duplicate-proto-2/input.js b/packages/babel-parser/test/fixtures/es2015/destructuring/duplicate-proto-2/input.js new file mode 100644 index 000000000000..73d46e315061 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/destructuring/duplicate-proto-2/input.js @@ -0,0 +1 @@ +([{ __proto__: x, __proto__: y }] = [{}]); diff --git a/packages/babel-parser/test/fixtures/es2015/destructuring/duplicate-proto-2/output.json b/packages/babel-parser/test/fixtures/es2015/destructuring/duplicate-proto-2/output.json new file mode 100644 index 000000000000..3646ce22df38 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/destructuring/duplicate-proto-2/output.json @@ -0,0 +1,241 @@ +{ + "type": "File", + "start": 0, + "end": 42, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 42 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 42, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 42 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 42, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 42 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 1, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 40 + } + }, + "operator": "=", + "left": { + "type": "ArrayPattern", + "start": 1, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "elements": [ + { + "type": "ObjectPattern", + "start": 2, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 4, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 4, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 13 + }, + "identifierName": "__proto__" + }, + "name": "__proto__" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "Identifier", + "start": 15, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + }, + "identifierName": "x" + }, + "name": "x" + } + }, + { + "type": "ObjectProperty", + "start": 18, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 18, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 27 + }, + "identifierName": "__proto__" + }, + "name": "__proto__" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "Identifier", + "start": 29, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 30 + }, + "identifierName": "y" + }, + "name": "y" + } + } + ] + } + ] + }, + "right": { + "type": "ArrayExpression", + "start": 36, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 36 + }, + "end": { + "line": 1, + "column": 40 + } + }, + "elements": [ + { + "type": "ObjectExpression", + "start": 37, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "properties": [] + } + ] + }, + "extra": { + "parenthesized": true, + "parenStart": 0 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/destructuring/duplicate-proto-3/input.js b/packages/babel-parser/test/fixtures/es2015/destructuring/duplicate-proto-3/input.js new file mode 100644 index 000000000000..478c33774b46 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/destructuring/duplicate-proto-3/input.js @@ -0,0 +1 @@ +({ __proto__: x, __proto__: y }) => {}; diff --git a/packages/babel-parser/test/fixtures/es2015/destructuring/duplicate-proto-3/output.json b/packages/babel-parser/test/fixtures/es2015/destructuring/duplicate-proto-3/output.json new file mode 100644 index 000000000000..27df8bb4401e --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/destructuring/duplicate-proto-3/output.json @@ -0,0 +1,208 @@ +{ + "type": "File", + "start": 0, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "expression": { + "type": "ArrowFunctionExpression", + "start": 0, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 38 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "ObjectPattern", + "start": 1, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 3, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 3, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 12 + }, + "identifierName": "__proto__" + }, + "name": "__proto__" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "Identifier", + "start": 14, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + }, + "identifierName": "x" + }, + "name": "x" + } + }, + { + "type": "ObjectProperty", + "start": 17, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 17, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 26 + }, + "identifierName": "__proto__" + }, + "name": "__proto__" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "Identifier", + "start": 28, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 29 + }, + "identifierName": "y" + }, + "name": "y" + } + } + ] + } + ], + "body": { + "type": "BlockStatement", + "start": 36, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 36 + }, + "end": { + "line": 1, + "column": 38 + } + }, + "body": [], + "directives": [] + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/destructuring/error-operator-for-default/options.json b/packages/babel-parser/test/fixtures/es2015/destructuring/error-operator-for-default/options.json deleted file mode 100644 index f52857170baa..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/destructuring/error-operator-for-default/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Only '=' operator can be used for specifying default value. (1:3)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/destructuring/error-operator-for-default/output.json b/packages/babel-parser/test/fixtures/es2015/destructuring/error-operator-for-default/output.json new file mode 100644 index 000000000000..5a29fd6b5f7b --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/destructuring/error-operator-for-default/output.json @@ -0,0 +1,156 @@ +{ + "type": "File", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "errors": [ + "SyntaxError: Only '=' operator can be used for specifying default value. (1:3)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 1, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "operator": "=", + "left": { + "type": "ArrayPattern", + "start": 1, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "elements": [ + { + "type": "AssignmentPattern", + "start": 2, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "left": { + "type": "Identifier", + "start": 2, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + }, + "identifierName": "a" + }, + "name": "a" + }, + "right": { + "type": "Identifier", + "start": 7, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + }, + "identifierName": "a" + }, + "name": "a" + } + } + ] + }, + "right": { + "type": "Identifier", + "start": 12, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + }, + "identifierName": "a" + }, + "name": "a" + }, + "extra": { + "parenthesized": true, + "parenStart": 0 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/destructuring/parenthesized-lhs-array/options.json b/packages/babel-parser/test/fixtures/es2015/destructuring/parenthesized-lhs-array/options.json deleted file mode 100644 index dfcad1b5cbf0..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/destructuring/parenthesized-lhs-array/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "You're trying to assign to a parenthesized expression, eg. instead of `([a]) = 0` use `([a] = 0)` (1:1)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/destructuring/parenthesized-lhs-array/output.json b/packages/babel-parser/test/fixtures/es2015/destructuring/parenthesized-lhs-array/output.json new file mode 100644 index 000000000000..16f7d7f8e50f --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/destructuring/parenthesized-lhs-array/output.json @@ -0,0 +1,127 @@ +{ + "type": "File", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "errors": [ + "SyntaxError: Invalid parenthesized assignment pattern (1:1)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "operator": "=", + "left": { + "type": "ArrayPattern", + "start": 1, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "elements": [ + { + "type": "Identifier", + "start": 2, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + }, + "identifierName": "a" + }, + "name": "a" + } + ], + "extra": { + "parenthesized": true, + "parenStart": 0 + } + }, + "right": { + "type": "NumericLiteral", + "start": 8, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "extra": { + "rawValue": 2, + "raw": "2" + }, + "value": 2 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/destructuring/parenthesized-lhs-object/options.json b/packages/babel-parser/test/fixtures/es2015/destructuring/parenthesized-lhs-object/options.json deleted file mode 100644 index d0fb48924093..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/destructuring/parenthesized-lhs-object/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "You're trying to assign to a parenthesized expression, eg. instead of `({a}) = 0` use `({a} = 0)` (1:1)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/destructuring/parenthesized-lhs-object/output.json b/packages/babel-parser/test/fixtures/es2015/destructuring/parenthesized-lhs-object/output.json new file mode 100644 index 000000000000..b84a7826945b --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/destructuring/parenthesized-lhs-object/output.json @@ -0,0 +1,165 @@ +{ + "type": "File", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "errors": [ + "SyntaxError: Invalid parenthesized assignment pattern (1:1)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "operator": "=", + "left": { + "type": "ObjectPattern", + "start": 1, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 2, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 2, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + }, + "identifierName": "a" + }, + "name": "a" + }, + "computed": false, + "shorthand": true, + "value": { + "type": "Identifier", + "start": 2, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + }, + "identifierName": "a" + }, + "name": "a" + }, + "extra": { + "shorthand": true + } + } + ], + "extra": { + "parenthesized": true, + "parenStart": 0 + } + }, + "right": { + "type": "NumericLiteral", + "start": 8, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "extra": { + "rawValue": 2, + "raw": "2" + }, + "value": 2 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/duplicate-proto/in-new-expression/input.js b/packages/babel-parser/test/fixtures/es2015/duplicate-proto/in-new-expression/input.js new file mode 100644 index 000000000000..900d3841bc6c --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/duplicate-proto/in-new-expression/input.js @@ -0,0 +1 @@ +new {__proto__: Number, __proto__: Number}.__proto__; diff --git a/packages/babel-parser/test/fixtures/es2015/duplicate-proto/in-new-expression/output.json b/packages/babel-parser/test/fixtures/es2015/duplicate-proto/in-new-expression/output.json new file mode 100644 index 000000000000..8b1e9a9a780d --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/duplicate-proto/in-new-expression/output.json @@ -0,0 +1,223 @@ +{ + "type": "File", + "start": 0, + "end": 53, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 53 + } + }, + "errors": [ + "SyntaxError: Redefinition of __proto__ property (1:24)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 53, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 53 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 53, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 53 + } + }, + "expression": { + "type": "NewExpression", + "start": 0, + "end": 52, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 52 + } + }, + "callee": { + "type": "MemberExpression", + "start": 4, + "end": 52, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 52 + } + }, + "object": { + "type": "ObjectExpression", + "start": 4, + "end": 42, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 42 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 5, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 5, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "__proto__" + }, + "name": "__proto__" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "Identifier", + "start": 16, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 22 + }, + "identifierName": "Number" + }, + "name": "Number" + } + }, + { + "type": "ObjectProperty", + "start": 24, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 41 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 24, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 33 + }, + "identifierName": "__proto__" + }, + "name": "__proto__" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "Identifier", + "start": 35, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 35 + }, + "end": { + "line": 1, + "column": 41 + }, + "identifierName": "Number" + }, + "name": "Number" + } + } + ] + }, + "property": { + "type": "Identifier", + "start": 43, + "end": 52, + "loc": { + "start": { + "line": 1, + "column": 43 + }, + "end": { + "line": 1, + "column": 52 + }, + "identifierName": "__proto__" + }, + "name": "__proto__" + }, + "computed": false + }, + "arguments": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/for-in/bare-initializer/options.json b/packages/babel-parser/test/fixtures/es2015/for-in/bare-initializer/options.json deleted file mode 100644 index f5710cd7a9c9..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/for-in/bare-initializer/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid left-hand side in for-loop (2:5)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/for-in/bare-initializer/output.json b/packages/babel-parser/test/fixtures/es2015/for-in/bare-initializer/output.json new file mode 100644 index 000000000000..bde13b8bdbda --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/for-in/bare-initializer/output.json @@ -0,0 +1,187 @@ +{ + "type": "File", + "start": 0, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 18 + } + }, + "errors": [ + "SyntaxError: Invalid left-hand side in for-loop (2:5)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 18 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 4, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "id": { + "type": "Identifier", + "start": 4, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + }, + "identifierName": "a" + }, + "name": "a" + }, + "init": null + } + ], + "kind": "var" + }, + { + "type": "ForInStatement", + "start": 7, + "end": 25, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 18 + } + }, + "left": { + "type": "AssignmentPattern", + "start": 12, + "end": 17, + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + }, + "left": { + "type": "Identifier", + "start": 12, + "end": 13, + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 6 + }, + "identifierName": "a" + }, + "name": "a" + }, + "right": { + "type": "NumericLiteral", + "start": 16, + "end": 17, + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 10 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + }, + "right": { + "type": "ObjectExpression", + "start": 21, + "end": 23, + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 16 + } + }, + "properties": [] + }, + "body": { + "type": "EmptyStatement", + "start": 24, + "end": 25, + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 18 + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/for-in/const-initializer/options.json b/packages/babel-parser/test/fixtures/es2015/for-in/const-initializer/options.json deleted file mode 100644 index dd3b73e5d533..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/for-in/const-initializer/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "for-in loop variable declaration may not have an initializer (1:5)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/for-in/const-initializer/output.json b/packages/babel-parser/test/fixtures/es2015/for-in/const-initializer/output.json new file mode 100644 index 000000000000..b85f54f50027 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/for-in/const-initializer/output.json @@ -0,0 +1,154 @@ +{ + "type": "File", + "start": 0, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "errors": [ + "SyntaxError: for-in loop variable declaration may not have an initializer (1:5)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ForInStatement", + "start": 0, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "left": { + "type": "VariableDeclaration", + "start": 5, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 11, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "id": { + "type": "Identifier", + "start": 11, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + }, + "identifierName": "a" + }, + "name": "a" + }, + "init": { + "type": "NumericLiteral", + "start": 15, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + } + ], + "kind": "const" + }, + "right": { + "type": "ObjectExpression", + "start": 20, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "properties": [] + }, + "body": { + "type": "EmptyStatement", + "start": 23, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/for-in/let-initializer/options.json b/packages/babel-parser/test/fixtures/es2015/for-in/let-initializer/options.json deleted file mode 100644 index dd3b73e5d533..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/for-in/let-initializer/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "for-in loop variable declaration may not have an initializer (1:5)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/for-in/let-initializer/output.json b/packages/babel-parser/test/fixtures/es2015/for-in/let-initializer/output.json new file mode 100644 index 000000000000..d890ea49e1da --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/for-in/let-initializer/output.json @@ -0,0 +1,154 @@ +{ + "type": "File", + "start": 0, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "errors": [ + "SyntaxError: for-in loop variable declaration may not have an initializer (1:5)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ForInStatement", + "start": 0, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "left": { + "type": "VariableDeclaration", + "start": 5, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + }, + "identifierName": "a" + }, + "name": "a" + }, + "init": { + "type": "NumericLiteral", + "start": 13, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + } + ], + "kind": "let" + }, + "right": { + "type": "ObjectExpression", + "start": 18, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "properties": [] + }, + "body": { + "type": "EmptyStatement", + "start": 21, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/for-in/strict-initializer/options.json b/packages/babel-parser/test/fixtures/es2015/for-in/strict-initializer/options.json deleted file mode 100644 index 0048427255c0..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/for-in/strict-initializer/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "for-in loop variable declaration may not have an initializer (2:5)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/for-in/strict-initializer/output.json b/packages/babel-parser/test/fixtures/es2015/for-in/strict-initializer/output.json new file mode 100644 index 000000000000..556eea44650d --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/for-in/strict-initializer/output.json @@ -0,0 +1,190 @@ +{ + "type": "File", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 22 + } + }, + "errors": [ + "SyntaxError: for-in loop variable declaration may not have an initializer (2:5)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 22 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ForInStatement", + "start": 14, + "end": 36, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 22 + } + }, + "left": { + "type": "VariableDeclaration", + "start": 19, + "end": 28, + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 23, + "end": 28, + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "id": { + "type": "Identifier", + "start": 23, + "end": 24, + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 10 + }, + "identifierName": "a" + }, + "name": "a" + }, + "init": { + "type": "NumericLiteral", + "start": 27, + "end": 28, + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + } + ], + "kind": "var" + }, + "right": { + "type": "ObjectExpression", + "start": 32, + "end": 34, + "loc": { + "start": { + "line": 2, + "column": 18 + }, + "end": { + "line": 2, + "column": 20 + } + }, + "properties": [] + }, + "body": { + "type": "EmptyStatement", + "start": 35, + "end": 36, + "loc": { + "start": { + "line": 2, + "column": 21 + }, + "end": { + "line": 2, + "column": 22 + } + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/for-in/var-arraybindingpattern-initializer/options.json b/packages/babel-parser/test/fixtures/es2015/for-in/var-arraybindingpattern-initializer/options.json deleted file mode 100644 index dd3b73e5d533..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/for-in/var-arraybindingpattern-initializer/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "for-in loop variable declaration may not have an initializer (1:5)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/for-in/var-arraybindingpattern-initializer/output.json b/packages/babel-parser/test/fixtures/es2015/for-in/var-arraybindingpattern-initializer/output.json new file mode 100644 index 000000000000..fbffb7c6994a --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/for-in/var-arraybindingpattern-initializer/output.json @@ -0,0 +1,171 @@ +{ + "type": "File", + "start": 0, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "errors": [ + "SyntaxError: for-in loop variable declaration may not have an initializer (1:5)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ForInStatement", + "start": 0, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "left": { + "type": "VariableDeclaration", + "start": 5, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 9, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "id": { + "type": "ArrayPattern", + "start": 9, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "elements": [ + { + "type": "Identifier", + "start": 10, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + }, + "identifierName": "a" + }, + "name": "a" + } + ] + }, + "init": { + "type": "NumericLiteral", + "start": 15, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + } + ], + "kind": "var" + }, + "right": { + "type": "ObjectExpression", + "start": 20, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "properties": [] + }, + "body": { + "type": "EmptyStatement", + "start": 23, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/for-in/var-objectbindingpattern-initializer/options.json b/packages/babel-parser/test/fixtures/es2015/for-in/var-objectbindingpattern-initializer/options.json deleted file mode 100644 index dd3b73e5d533..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/for-in/var-objectbindingpattern-initializer/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "for-in loop variable declaration may not have an initializer (1:5)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/for-in/var-objectbindingpattern-initializer/output.json b/packages/babel-parser/test/fixtures/es2015/for-in/var-objectbindingpattern-initializer/output.json new file mode 100644 index 000000000000..0afdc7b4d271 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/for-in/var-objectbindingpattern-initializer/output.json @@ -0,0 +1,209 @@ +{ + "type": "File", + "start": 0, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "errors": [ + "SyntaxError: for-in loop variable declaration may not have an initializer (1:5)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ForInStatement", + "start": 0, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "left": { + "type": "VariableDeclaration", + "start": 5, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 9, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "id": { + "type": "ObjectPattern", + "start": 9, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 10, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 10, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + }, + "identifierName": "a" + }, + "name": "a" + }, + "computed": false, + "shorthand": true, + "value": { + "type": "Identifier", + "start": 10, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + }, + "identifierName": "a" + }, + "name": "a" + }, + "extra": { + "shorthand": true + } + } + ] + }, + "init": { + "type": "NumericLiteral", + "start": 15, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + } + ], + "kind": "var" + }, + "right": { + "type": "ObjectExpression", + "start": 20, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "properties": [] + }, + "body": { + "type": "EmptyStatement", + "start": 23, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/for-of/bare-initializer/options.json b/packages/babel-parser/test/fixtures/es2015/for-of/bare-initializer/options.json deleted file mode 100644 index f5710cd7a9c9..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/for-of/bare-initializer/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid left-hand side in for-loop (2:5)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/for-of/bare-initializer/output.json b/packages/babel-parser/test/fixtures/es2015/for-of/bare-initializer/output.json new file mode 100644 index 000000000000..936a7b0183e3 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/for-of/bare-initializer/output.json @@ -0,0 +1,188 @@ +{ + "type": "File", + "start": 0, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 18 + } + }, + "errors": [ + "SyntaxError: Invalid left-hand side in for-loop (2:5)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 18 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 4, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "id": { + "type": "Identifier", + "start": 4, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + }, + "identifierName": "a" + }, + "name": "a" + }, + "init": null + } + ], + "kind": "var" + }, + { + "type": "ForOfStatement", + "start": 7, + "end": 25, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 18 + } + }, + "await": false, + "left": { + "type": "AssignmentPattern", + "start": 12, + "end": 17, + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + }, + "left": { + "type": "Identifier", + "start": 12, + "end": 13, + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 6 + }, + "identifierName": "a" + }, + "name": "a" + }, + "right": { + "type": "NumericLiteral", + "start": 16, + "end": 17, + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 10 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + }, + "right": { + "type": "ObjectExpression", + "start": 21, + "end": 23, + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 16 + } + }, + "properties": [] + }, + "body": { + "type": "EmptyStatement", + "start": 24, + "end": 25, + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 18 + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/for-of/invalid-escape-of/options.json b/packages/babel-parser/test/fixtures/es2015/for-of/invalid-escape-of/options.json index 6b9933a77108..8678455a0f9c 100644 --- a/packages/babel-parser/test/fixtures/es2015/for-of/invalid-escape-of/options.json +++ b/packages/babel-parser/test/fixtures/es2015/for-of/invalid-escape-of/options.json @@ -1,3 +1,3 @@ { "throws": "Unexpected token, expected \";\" (1:7)" -} \ No newline at end of file +} diff --git a/packages/babel-parser/test/fixtures/es2015/for-of/invalid-expr/options.json b/packages/babel-parser/test/fixtures/es2015/for-of/invalid-expr/options.json index e4ff6fef3cde..5eaf674e06e0 100644 --- a/packages/babel-parser/test/fixtures/es2015/for-of/invalid-expr/options.json +++ b/packages/babel-parser/test/fixtures/es2015/for-of/invalid-expr/options.json @@ -1,3 +1,3 @@ { "throws": "Unexpected token, expected \")\" (1:15)" -} \ No newline at end of file +} diff --git a/packages/babel-parser/test/fixtures/es2015/generators/invalid-escape-yield/input.js b/packages/babel-parser/test/fixtures/es2015/generators/invalid-escape-yield/input.js index 521b91facbbc..8a89e37a1275 100644 --- a/packages/babel-parser/test/fixtures/es2015/generators/invalid-escape-yield/input.js +++ b/packages/babel-parser/test/fixtures/es2015/generators/invalid-escape-yield/input.js @@ -1 +1 @@ -(function* () { y\u0069eld 10 }) +(function* () { y\u0069eld; }) diff --git a/packages/babel-parser/test/fixtures/es2015/generators/invalid-escape-yield/options.json b/packages/babel-parser/test/fixtures/es2015/generators/invalid-escape-yield/options.json deleted file mode 100644 index dcd45c9b9715..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/generators/invalid-escape-yield/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Can not use 'yield' as identifier inside a generator (1:16)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/generators/invalid-escape-yield/output.json b/packages/babel-parser/test/fixtures/es2015/generators/invalid-escape-yield/output.json new file mode 100644 index 000000000000..6d1a2d6c3fce --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/generators/invalid-escape-yield/output.json @@ -0,0 +1,126 @@ +{ + "type": "File", + "start": 0, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "errors": [ + "SyntaxError: Can not use 'yield' as identifier inside a generator (1:16)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "expression": { + "type": "FunctionExpression", + "start": 1, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "id": null, + "generator": true, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 14, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 16, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "expression": { + "type": "Identifier", + "start": 16, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 26 + }, + "identifierName": "yield" + }, + "name": "yield" + } + } + ], + "directives": [] + }, + "extra": { + "parenthesized": true, + "parenStart": 0 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/generators/invalid-hanging/options.json b/packages/babel-parser/test/fixtures/es2015/generators/invalid-hanging/options.json deleted file mode 100644 index 8cdac51705a1..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/generators/invalid-hanging/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Generators can only be declared at the top level or inside a block (1:16)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/generators/invalid-hanging/output.json b/packages/babel-parser/test/fixtures/es2015/generators/invalid-hanging/output.json new file mode 100644 index 000000000000..0059c885f4d8 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/generators/invalid-hanging/output.json @@ -0,0 +1,126 @@ +{ + "type": "File", + "start": 0, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "errors": [ + "SyntaxError: Generators can only be declared at the top level or inside a block (1:16)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "IfStatement", + "start": 0, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "test": { + "type": "NumericLiteral", + "start": 4, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + }, + "consequent": { + "type": "FunctionDeclaration", + "start": 7, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "id": { + "type": "Identifier", + "start": 17, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 20 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "generator": true, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 23, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "body": [], + "directives": [] + } + }, + "alternate": null + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/identifiers/invalid-escape-seq-const/input.js b/packages/babel-parser/test/fixtures/es2015/identifiers/invalid-escape-seq-const/input.js index 7db67c0d2dc7..3ec83f02b2f4 100644 --- a/packages/babel-parser/test/fixtures/es2015/identifiers/invalid-escape-seq-const/input.js +++ b/packages/babel-parser/test/fixtures/es2015/identifiers/invalid-escape-seq-const/input.js @@ -1 +1,3 @@ var co\u{6e}st = 123; + +co\u{6e}st x = 2; diff --git a/packages/babel-parser/test/fixtures/es2015/identifiers/invalid-escape-seq-const/options.json b/packages/babel-parser/test/fixtures/es2015/identifiers/invalid-escape-seq-const/options.json deleted file mode 100644 index d6c0b22e3090..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/identifiers/invalid-escape-seq-const/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Escape sequence in keyword const (1:14)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/identifiers/invalid-escape-seq-const/output.json b/packages/babel-parser/test/fixtures/es2015/identifiers/invalid-escape-seq-const/output.json new file mode 100644 index 000000000000..f5d632c23ace --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/identifiers/invalid-escape-seq-const/output.json @@ -0,0 +1,180 @@ +{ + "type": "File", + "start": 0, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 17 + } + }, + "errors": [ + "SyntaxError: Unexpected keyword 'const' (1:4)", + "SyntaxError: Escape sequence in keyword const (1:4)", + "SyntaxError: Escape sequence in keyword const (3:0)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 17 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 0, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 4, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "id": { + "type": "Identifier", + "start": 4, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "const" + }, + "name": "const" + }, + "init": { + "type": "NumericLiteral", + "start": 17, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "extra": { + "rawValue": 123, + "raw": "123" + }, + "value": 123 + } + } + ], + "kind": "var" + }, + { + "type": "VariableDeclaration", + "start": 23, + "end": 40, + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 17 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 34, + "end": 39, + "loc": { + "start": { + "line": 3, + "column": 11 + }, + "end": { + "line": 3, + "column": 16 + } + }, + "id": { + "type": "Identifier", + "start": 34, + "end": 35, + "loc": { + "start": { + "line": 3, + "column": 11 + }, + "end": { + "line": 3, + "column": 12 + }, + "identifierName": "x" + }, + "name": "x" + }, + "init": { + "type": "NumericLiteral", + "start": 38, + "end": 39, + "loc": { + "start": { + "line": 3, + "column": 15 + }, + "end": { + "line": 3, + "column": 16 + } + }, + "extra": { + "rawValue": 2, + "raw": "2" + }, + "value": 2 + } + } + ], + "kind": "const" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/identifiers/invalid-escape-seq-export/input.js b/packages/babel-parser/test/fixtures/es2015/identifiers/invalid-escape-seq-export/input.js index 2c49151ea912..c9bc4e4c28d9 100644 --- a/packages/babel-parser/test/fixtures/es2015/identifiers/invalid-escape-seq-export/input.js +++ b/packages/babel-parser/test/fixtures/es2015/identifiers/invalid-escape-seq-export/input.js @@ -1 +1,4 @@ var expor\u{74} = 123; + +var x; +expor\u{74} { x }; diff --git a/packages/babel-parser/test/fixtures/es2015/identifiers/invalid-escape-seq-export/options.json b/packages/babel-parser/test/fixtures/es2015/identifiers/invalid-escape-seq-export/options.json index 80870219d5cc..2104ca43283f 100644 --- a/packages/babel-parser/test/fixtures/es2015/identifiers/invalid-escape-seq-export/options.json +++ b/packages/babel-parser/test/fixtures/es2015/identifiers/invalid-escape-seq-export/options.json @@ -1,3 +1,3 @@ { - "throws": "Escape sequence in keyword export (1:15)" + "sourceType": "module" } diff --git a/packages/babel-parser/test/fixtures/es2015/identifiers/invalid-escape-seq-export/output.json b/packages/babel-parser/test/fixtures/es2015/identifiers/invalid-escape-seq-export/output.json new file mode 100644 index 000000000000..236b7dc15afa --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/identifiers/invalid-escape-seq-export/output.json @@ -0,0 +1,229 @@ +{ + "type": "File", + "start": 0, + "end": 49, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 18 + } + }, + "errors": [ + "SyntaxError: Unexpected keyword 'export' (1:4)", + "SyntaxError: Escape sequence in keyword export (1:4)", + "SyntaxError: Escape sequence in keyword export (4:0)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 49, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 18 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 0, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 4, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "id": { + "type": "Identifier", + "start": 4, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 15 + }, + "identifierName": "export" + }, + "name": "export" + }, + "init": { + "type": "NumericLiteral", + "start": 18, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "extra": { + "rawValue": 123, + "raw": "123" + }, + "value": 123 + } + } + ], + "kind": "var" + }, + { + "type": "VariableDeclaration", + "start": 24, + "end": 30, + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 6 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 28, + "end": 29, + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 5 + } + }, + "id": { + "type": "Identifier", + "start": 28, + "end": 29, + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 5 + }, + "identifierName": "x" + }, + "name": "x" + }, + "init": null + } + ], + "kind": "var" + }, + { + "type": "ExportNamedDeclaration", + "start": 31, + "end": 49, + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 4, + "column": 18 + } + }, + "specifiers": [ + { + "type": "ExportSpecifier", + "start": 45, + "end": 46, + "loc": { + "start": { + "line": 4, + "column": 14 + }, + "end": { + "line": 4, + "column": 15 + } + }, + "local": { + "type": "Identifier", + "start": 45, + "end": 46, + "loc": { + "start": { + "line": 4, + "column": 14 + }, + "end": { + "line": 4, + "column": 15 + }, + "identifierName": "x" + }, + "name": "x" + }, + "exported": { + "type": "Identifier", + "start": 45, + "end": 46, + "loc": { + "start": { + "line": 4, + "column": 14 + }, + "end": { + "line": 4, + "column": 15 + }, + "identifierName": "x" + }, + "name": "x" + } + } + ], + "source": null, + "declaration": null + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/identifiers/invalid-escape-seq-if/options.json b/packages/babel-parser/test/fixtures/es2015/identifiers/invalid-escape-seq-if/options.json deleted file mode 100644 index 52faf91d3656..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/identifiers/invalid-escape-seq-if/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Escape sequence in keyword if (1:12)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/identifiers/invalid-escape-seq-if/output.json b/packages/babel-parser/test/fixtures/es2015/identifiers/invalid-escape-seq-if/output.json new file mode 100644 index 000000000000..d95df678e8c4 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/identifiers/invalid-escape-seq-if/output.json @@ -0,0 +1,87 @@ +{ + "type": "File", + "start": 0, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "errors": [ + "SyntaxError: Escape sequence in keyword if (1:0)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "IfStatement", + "start": 0, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "test": { + "type": "BooleanLiteral", + "start": 14, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "value": true + }, + "consequent": { + "type": "BlockStatement", + "start": 20, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "body": [], + "directives": [] + }, + "alternate": null + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/identifiers/invalid-escape-seq-import/input.js b/packages/babel-parser/test/fixtures/es2015/identifiers/invalid-escape-seq-import/input.js index f23c79e20fb1..df174d0e56d1 100644 --- a/packages/babel-parser/test/fixtures/es2015/identifiers/invalid-escape-seq-import/input.js +++ b/packages/babel-parser/test/fixtures/es2015/identifiers/invalid-escape-seq-import/input.js @@ -1 +1,3 @@ var \u{69}\u{6d}\u{70}\u{6f}\u{72}\u{74} = 123; + +\u{69}\u{6d}\u{70}\u{6f}\u{72}\u{74} "x"; diff --git a/packages/babel-parser/test/fixtures/es2015/identifiers/invalid-escape-seq-import/options.json b/packages/babel-parser/test/fixtures/es2015/identifiers/invalid-escape-seq-import/options.json index 45763ffa389b..2104ca43283f 100644 --- a/packages/babel-parser/test/fixtures/es2015/identifiers/invalid-escape-seq-import/options.json +++ b/packages/babel-parser/test/fixtures/es2015/identifiers/invalid-escape-seq-import/options.json @@ -1,3 +1,3 @@ { - "throws": "Escape sequence in keyword import (1:40)" + "sourceType": "module" } diff --git a/packages/babel-parser/test/fixtures/es2015/identifiers/invalid-escape-seq-import/output.json b/packages/babel-parser/test/fixtures/es2015/identifiers/invalid-escape-seq-import/output.json new file mode 100644 index 000000000000..8842ac412ce6 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/identifiers/invalid-escape-seq-import/output.json @@ -0,0 +1,146 @@ +{ + "type": "File", + "start": 0, + "end": 90, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 41 + } + }, + "errors": [ + "SyntaxError: Unexpected keyword 'import' (1:4)", + "SyntaxError: Escape sequence in keyword import (1:4)", + "SyntaxError: Escape sequence in keyword import (3:0)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 90, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 41 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 0, + "end": 47, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 47 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 4, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 46 + } + }, + "id": { + "type": "Identifier", + "start": 4, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 40 + }, + "identifierName": "import" + }, + "name": "import" + }, + "init": { + "type": "NumericLiteral", + "start": 43, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 43 + }, + "end": { + "line": 1, + "column": 46 + } + }, + "extra": { + "rawValue": 123, + "raw": "123" + }, + "value": 123 + } + } + ], + "kind": "var" + }, + { + "type": "ImportDeclaration", + "start": 49, + "end": 90, + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 41 + } + }, + "specifiers": [], + "source": { + "type": "StringLiteral", + "start": 86, + "end": 89, + "loc": { + "start": { + "line": 3, + "column": 37 + }, + "end": { + "line": 3, + "column": 40 + } + }, + "extra": { + "rawValue": "x", + "raw": "\"x\"" + }, + "value": "x" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/identifiers/invalid-escape-seq-null/options.json b/packages/babel-parser/test/fixtures/es2015/identifiers/invalid-escape-seq-null/options.json deleted file mode 100644 index 34db9f6413ed..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/identifiers/invalid-escape-seq-null/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Escape sequence in keyword null (1:9)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/identifiers/invalid-escape-seq-null/output.json b/packages/babel-parser/test/fixtures/es2015/identifiers/invalid-escape-seq-null/output.json new file mode 100644 index 000000000000..17c1ae03468e --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/identifiers/invalid-escape-seq-null/output.json @@ -0,0 +1,68 @@ +{ + "type": "File", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "errors": [ + "SyntaxError: Escape sequence in keyword null (1:0)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "expression": { + "type": "NullLiteral", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/identifiers/invalid-escape-seq-true/options.json b/packages/babel-parser/test/fixtures/es2015/identifiers/invalid-escape-seq-true/options.json deleted file mode 100644 index c1c2620da097..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/identifiers/invalid-escape-seq-true/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Escape sequence in keyword true (1:9)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/identifiers/invalid-escape-seq-true/output.json b/packages/babel-parser/test/fixtures/es2015/identifiers/invalid-escape-seq-true/output.json new file mode 100644 index 000000000000..609a782c235a --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/identifiers/invalid-escape-seq-true/output.json @@ -0,0 +1,69 @@ +{ + "type": "File", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "errors": [ + "SyntaxError: Escape sequence in keyword true (1:0)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "expression": { + "type": "BooleanLiteral", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "value": true + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/let/invalid-escape/options.json b/packages/babel-parser/test/fixtures/es2015/let/invalid-escape/options.json index 410ecd16fddf..e4ae9a99d01b 100644 --- a/packages/babel-parser/test/fixtures/es2015/let/invalid-escape/options.json +++ b/packages/babel-parser/test/fixtures/es2015/let/invalid-escape/options.json @@ -1,3 +1,3 @@ { "throws": "Unexpected token, expected \";\" (1:9)" -} \ No newline at end of file +} diff --git a/packages/babel-parser/test/fixtures/es2015/let/let-as-identifier-strict-fail/options.json b/packages/babel-parser/test/fixtures/es2015/let/let-as-identifier-strict-fail/options.json deleted file mode 100644 index ab238c8bbff9..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/let/let-as-identifier-strict-fail/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected reserved word 'let' (2:0)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/let/let-as-identifier-strict-fail/output.json b/packages/babel-parser/test/fixtures/es2015/let/let-as-identifier-strict-fail/output.json new file mode 100644 index 000000000000..85fa32674b37 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/let/let-as-identifier-strict-fail/output.json @@ -0,0 +1,142 @@ +{ + "type": "File", + "start": 0, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 7 + } + }, + "errors": [ + "SyntaxError: Unexpected reserved word 'let' (2:0)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 7 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 14, + "end": 21, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 7 + } + }, + "expression": { + "type": "BinaryExpression", + "start": 14, + "end": 21, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 7 + } + }, + "left": { + "type": "Identifier", + "start": 14, + "end": 17, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 3 + }, + "identifierName": "let" + }, + "name": "let" + }, + "operator": "+", + "right": { + "type": "NumericLiteral", + "start": 20, + "end": 21, + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 7 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/let/let-at-binding-list-fail-1/options.json b/packages/babel-parser/test/fixtures/es2015/let/let-at-binding-list-fail-1/options.json deleted file mode 100644 index f57eb3dfe6c2..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/let/let-at-binding-list-fail-1/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "'let' is not allowed to be used as a name in 'let' or 'const' declarations. (1:6)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/let/let-at-binding-list-fail-1/output.json b/packages/babel-parser/test/fixtures/es2015/let/let-at-binding-list-fail-1/output.json new file mode 100644 index 000000000000..e6e2ced3bb0c --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/let/let-at-binding-list-fail-1/output.json @@ -0,0 +1,159 @@ +{ + "type": "File", + "start": 0, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "errors": [ + "SyntaxError: 'let' is not allowed to be used as a name in 'let' or 'const' declarations. (1:6)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 0, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 4, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "id": { + "type": "ObjectPattern", + "start": 4, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 6, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 6, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 9 + }, + "identifierName": "let" + }, + "name": "let" + }, + "computed": false, + "shorthand": true, + "value": { + "type": "Identifier", + "start": 6, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 9 + }, + "identifierName": "let" + }, + "name": "let" + }, + "extra": { + "shorthand": true + } + } + ] + }, + "init": { + "type": "ObjectExpression", + "start": 14, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "properties": [] + } + } + ], + "kind": "let" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/let/let-at-binding-list-fail-2/options.json b/packages/babel-parser/test/fixtures/es2015/let/let-at-binding-list-fail-2/options.json deleted file mode 100644 index 365d76ddf46e..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/let/let-at-binding-list-fail-2/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "'let' is not allowed to be used as a name in 'let' or 'const' declarations. (1:8)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/let/let-at-binding-list-fail-2/output.json b/packages/babel-parser/test/fixtures/es2015/let/let-at-binding-list-fail-2/output.json new file mode 100644 index 000000000000..2c3d3871ec80 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/let/let-at-binding-list-fail-2/output.json @@ -0,0 +1,159 @@ +{ + "type": "File", + "start": 0, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "errors": [ + "SyntaxError: 'let' is not allowed to be used as a name in 'let' or 'const' declarations. (1:8)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 0, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 6, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "id": { + "type": "ObjectPattern", + "start": 6, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 8, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 8, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 11 + }, + "identifierName": "let" + }, + "name": "let" + }, + "computed": false, + "shorthand": true, + "value": { + "type": "Identifier", + "start": 8, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 11 + }, + "identifierName": "let" + }, + "name": "let" + }, + "extra": { + "shorthand": true + } + } + ] + }, + "init": { + "type": "ObjectExpression", + "start": 16, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "properties": [] + } + } + ], + "kind": "const" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/let/let-at-binding-list-fail-3/options.json b/packages/babel-parser/test/fixtures/es2015/let/let-at-binding-list-fail-3/options.json deleted file mode 100644 index d83275e4a85a..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/let/let-at-binding-list-fail-3/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "'let' is not allowed to be used as a name in 'let' or 'const' declarations. (1:5)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/let/let-at-binding-list-fail-3/output.json b/packages/babel-parser/test/fixtures/es2015/let/let-at-binding-list-fail-3/output.json new file mode 100644 index 000000000000..4354932c617c --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/let/let-at-binding-list-fail-3/output.json @@ -0,0 +1,121 @@ +{ + "type": "File", + "start": 0, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "errors": [ + "SyntaxError: 'let' is not allowed to be used as a name in 'let' or 'const' declarations. (1:5)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 0, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 4, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "id": { + "type": "ArrayPattern", + "start": 4, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "elements": [ + { + "type": "Identifier", + "start": 5, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 8 + }, + "identifierName": "let" + }, + "name": "let" + } + ] + }, + "init": { + "type": "ArrayExpression", + "start": 12, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "elements": [] + } + } + ], + "kind": "let" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/let/let-at-binding-list-fail-4/options.json b/packages/babel-parser/test/fixtures/es2015/let/let-at-binding-list-fail-4/options.json deleted file mode 100644 index 456948bdd272..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/let/let-at-binding-list-fail-4/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "'let' is not allowed to be used as a name in 'let' or 'const' declarations. (1:7)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/let/let-at-binding-list-fail-4/output.json b/packages/babel-parser/test/fixtures/es2015/let/let-at-binding-list-fail-4/output.json new file mode 100644 index 000000000000..720c37df7a15 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/let/let-at-binding-list-fail-4/output.json @@ -0,0 +1,121 @@ +{ + "type": "File", + "start": 0, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "errors": [ + "SyntaxError: 'let' is not allowed to be used as a name in 'let' or 'const' declarations. (1:7)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 0, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 6, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "id": { + "type": "ArrayPattern", + "start": 6, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "elements": [ + { + "type": "Identifier", + "start": 7, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 10 + }, + "identifierName": "let" + }, + "name": "let" + } + ] + }, + "init": { + "type": "ArrayExpression", + "start": 14, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "elements": [] + } + } + ], + "kind": "const" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/let/let-at-binding-list-fail-5/options.json b/packages/babel-parser/test/fixtures/es2015/let/let-at-binding-list-fail-5/options.json deleted file mode 100644 index 4ca932f989ae..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/let/let-at-binding-list-fail-5/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "'let' is not allowed to be used as a name in 'let' or 'const' declarations. (1:4)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/let/let-at-binding-list-fail-5/output.json b/packages/babel-parser/test/fixtures/es2015/let/let-at-binding-list-fail-5/output.json new file mode 100644 index 000000000000..93d70aa80f8b --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/let/let-at-binding-list-fail-5/output.json @@ -0,0 +1,89 @@ +{ + "type": "File", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "errors": [ + "SyntaxError: 'let' is not allowed to be used as a name in 'let' or 'const' declarations. (1:4)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 4, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "id": { + "type": "Identifier", + "start": 4, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "let" + }, + "name": "let" + }, + "init": null + } + ], + "kind": "let" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/let/let-at-binding-list-fail-6/options.json b/packages/babel-parser/test/fixtures/es2015/let/let-at-binding-list-fail-6/options.json deleted file mode 100644 index f57eb3dfe6c2..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/let/let-at-binding-list-fail-6/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "'let' is not allowed to be used as a name in 'let' or 'const' declarations. (1:6)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/let/let-at-binding-list-fail-6/output.json b/packages/babel-parser/test/fixtures/es2015/let/let-at-binding-list-fail-6/output.json new file mode 100644 index 000000000000..77846750f6ed --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/let/let-at-binding-list-fail-6/output.json @@ -0,0 +1,108 @@ +{ + "type": "File", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "errors": [ + "SyntaxError: 'let' is not allowed to be used as a name in 'let' or 'const' declarations. (1:6)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 6, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 9 + }, + "identifierName": "let" + }, + "name": "let" + }, + "init": { + "type": "StringLiteral", + "start": 12, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "extra": { + "rawValue": "", + "raw": "''" + }, + "value": "" + } + } + ], + "kind": "const" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/let/let-at-catch-block/input.js b/packages/babel-parser/test/fixtures/es2015/let/let-at-catch-block/input.js new file mode 100644 index 000000000000..25619fa29b6a --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/let/let-at-catch-block/input.js @@ -0,0 +1,3 @@ +try {} catch (err) { + let let; +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/let/let-at-catch-block/output.json b/packages/babel-parser/test/fixtures/es2015/let/let-at-catch-block/output.json new file mode 100644 index 000000000000..ecd45f67f5c5 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/let/let-at-catch-block/output.json @@ -0,0 +1,172 @@ +{ + "type": "File", + "start": 0, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "errors": [ + "SyntaxError: 'let' is not allowed to be used as a name in 'let' or 'const' declarations. (2:6)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "TryStatement", + "start": 0, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "block": { + "type": "BlockStatement", + "start": 4, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "body": [], + "directives": [] + }, + "handler": { + "type": "CatchClause", + "start": 7, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "param": { + "type": "Identifier", + "start": 14, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 17 + }, + "identifierName": "err" + }, + "name": "err" + }, + "body": { + "type": "BlockStatement", + "start": 19, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": [ + { + "type": "VariableDeclaration", + "start": 23, + "end": 31, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 10 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 27, + "end": 30, + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 9 + } + }, + "id": { + "type": "Identifier", + "start": 27, + "end": 30, + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 9 + }, + "identifierName": "let" + }, + "name": "let" + }, + "init": null + } + ], + "kind": "let" + } + ], + "directives": [] + } + }, + "finalizer": null + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/let/try-catch-let/input.js b/packages/babel-parser/test/fixtures/es2015/let/try-catch-let/input.js new file mode 100644 index 000000000000..a96f76fcd513 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/let/try-catch-let/input.js @@ -0,0 +1 @@ +try {} catch (let) {} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/let/try-catch-let/output.json b/packages/babel-parser/test/fixtures/es2015/let/try-catch-let/output.json new file mode 100644 index 000000000000..3d714b032e34 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/let/try-catch-let/output.json @@ -0,0 +1,117 @@ +{ + "type": "File", + "start": 0, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "TryStatement", + "start": 0, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "block": { + "type": "BlockStatement", + "start": 4, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "body": [], + "directives": [] + }, + "handler": { + "type": "CatchClause", + "start": 7, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "param": { + "type": "Identifier", + "start": 14, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 17 + }, + "identifierName": "let" + }, + "name": "let" + }, + "body": { + "type": "BlockStatement", + "start": 19, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "body": [], + "directives": [] + } + }, + "finalizer": null + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/meta-properties/invalid-arrow-function/options.json b/packages/babel-parser/test/fixtures/es2015/meta-properties/invalid-arrow-function/options.json deleted file mode 100644 index 4be1533d8e29..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/meta-properties/invalid-arrow-function/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "new.target can only be used in functions (2:2)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/meta-properties/invalid-arrow-function/output.json b/packages/babel-parser/test/fixtures/es2015/meta-properties/invalid-arrow-function/output.json new file mode 100644 index 000000000000..64d4a8d35758 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/meta-properties/invalid-arrow-function/output.json @@ -0,0 +1,189 @@ +{ + "type": "File", + "start": 0, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "errors": [ + "SyntaxError: new.target can only be used in functions (2:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 0, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 6, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "A" + }, + "name": "A" + }, + "init": { + "type": "ArrowFunctionExpression", + "start": 10, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 16, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 20, + "end": 31, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 13 + } + }, + "expression": { + "type": "MetaProperty", + "start": 20, + "end": 30, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 12 + } + }, + "meta": { + "type": "Identifier", + "start": 20, + "end": 23, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 5 + }, + "identifierName": "new" + }, + "name": "new" + }, + "property": { + "type": "Identifier", + "start": 24, + "end": 30, + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 12 + }, + "identifierName": "target" + }, + "name": "target" + } + } + } + ], + "directives": [] + } + } + } + ], + "kind": "const" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/meta-properties/new-invalid-prop/input.js b/packages/babel-parser/test/fixtures/es2015/meta-properties/new-invalid-prop/input.js index d775807ddef1..1f159ebd65d2 100644 --- a/packages/babel-parser/test/fixtures/es2015/meta-properties/new-invalid-prop/input.js +++ b/packages/babel-parser/test/fixtures/es2015/meta-properties/new-invalid-prop/input.js @@ -1 +1,3 @@ -new.prop \ No newline at end of file +function f() { + new.prop +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/meta-properties/new-invalid-prop/options.json b/packages/babel-parser/test/fixtures/es2015/meta-properties/new-invalid-prop/options.json deleted file mode 100644 index 8a88f91714d0..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/meta-properties/new-invalid-prop/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "The only valid meta property for new is new.target (1:4)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/meta-properties/new-invalid-prop/output.json b/packages/babel-parser/test/fixtures/es2015/meta-properties/new-invalid-prop/output.json new file mode 100644 index 000000000000..214b3e5417fe --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/meta-properties/new-invalid-prop/output.json @@ -0,0 +1,155 @@ +{ + "type": "File", + "start": 0, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "errors": [ + "SyntaxError: The only valid meta property for new is new.target (2:6)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + }, + "identifierName": "f" + }, + "name": "f" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 13, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 17, + "end": 25, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 10 + } + }, + "expression": { + "type": "MetaProperty", + "start": 17, + "end": 25, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 10 + } + }, + "meta": { + "type": "Identifier", + "start": 17, + "end": 20, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 5 + }, + "identifierName": "new" + }, + "name": "new" + }, + "property": { + "type": "Identifier", + "start": 21, + "end": 25, + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 10 + }, + "identifierName": "prop" + }, + "name": "prop" + } + } + } + ], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/meta-properties/new-target-invalid-escaped-new/options.json b/packages/babel-parser/test/fixtures/es2015/meta-properties/new-target-invalid-escaped-new/options.json deleted file mode 100644 index 112b0adc3e61..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/meta-properties/new-target-invalid-escaped-new/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Escape sequence in keyword new (1:23)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/meta-properties/new-target-invalid-escaped-new/output.json b/packages/babel-parser/test/fixtures/es2015/meta-properties/new-target-invalid-escaped-new/output.json new file mode 100644 index 000000000000..1394b19bdb01 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/meta-properties/new-target-invalid-escaped-new/output.json @@ -0,0 +1,155 @@ +{ + "type": "File", + "start": 0, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "errors": [ + "SyntaxError: Escape sequence in keyword new (1:15)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + }, + "identifierName": "f" + }, + "name": "f" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 13, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 15, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "expression": { + "type": "MetaProperty", + "start": 15, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "meta": { + "type": "Identifier", + "start": 15, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 23 + }, + "identifierName": "new" + }, + "name": "new" + }, + "property": { + "type": "Identifier", + "start": 24, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 30 + }, + "identifierName": "target" + }, + "name": "target" + } + } + } + ], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/meta-properties/new-target-invalid-escaped-target/options.json b/packages/babel-parser/test/fixtures/es2015/meta-properties/new-target-invalid-escaped-target/options.json deleted file mode 100644 index 4f4b2be4c186..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/meta-properties/new-target-invalid-escaped-target/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "The only valid meta property for new is new.target (1:19)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/meta-properties/new-target-invalid-escaped-target/output.json b/packages/babel-parser/test/fixtures/es2015/meta-properties/new-target-invalid-escaped-target/output.json new file mode 100644 index 000000000000..2fa8e1dd5500 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/meta-properties/new-target-invalid-escaped-target/output.json @@ -0,0 +1,155 @@ +{ + "type": "File", + "start": 0, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "errors": [ + "SyntaxError: The only valid meta property for new is new.target (1:19)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + }, + "identifierName": "f" + }, + "name": "f" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 13, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 15, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "expression": { + "type": "MetaProperty", + "start": 15, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "meta": { + "type": "Identifier", + "start": 15, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 18 + }, + "identifierName": "new" + }, + "name": "new" + }, + "property": { + "type": "Identifier", + "start": 19, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 30 + }, + "identifierName": "target" + }, + "name": "target" + } + } + } + ], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/meta-properties/new-target-invalid/options.json b/packages/babel-parser/test/fixtures/es2015/meta-properties/new-target-invalid/options.json deleted file mode 100644 index 092a825444ad..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/meta-properties/new-target-invalid/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "new.target can only be used in functions (1:0)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/meta-properties/new-target-invalid/output.json b/packages/babel-parser/test/fixtures/es2015/meta-properties/new-target-invalid/output.json new file mode 100644 index 000000000000..4283f53e7dea --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/meta-properties/new-target-invalid/output.json @@ -0,0 +1,102 @@ +{ + "type": "File", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "errors": [ + "SyntaxError: new.target can only be used in functions (1:0)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "expression": { + "type": "MetaProperty", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "meta": { + "type": "Identifier", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + }, + "identifierName": "new" + }, + "name": "new" + }, + "property": { + "type": "Identifier", + "start": 4, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 10 + }, + "identifierName": "target" + }, + "name": "target" + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-export-default-and-export-as-default/options.json b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-export-default-and-export-as-default/options.json index 275e6a57f95f..2104ca43283f 100644 --- a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-export-default-and-export-as-default/options.json +++ b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-export-default-and-export-as-default/options.json @@ -1,3 +1,3 @@ { - "throws": "Only one default export allowed per module. (2:9)" + "sourceType": "module" } diff --git a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-export-default-and-export-as-default/output.json b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-export-default-and-export-as-default/output.json new file mode 100644 index 000000000000..019d83e37ab4 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-export-default-and-export-as-default/output.json @@ -0,0 +1,173 @@ +{ + "type": "File", + "start": 0, + "end": 56, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 26 + } + }, + "errors": [ + "SyntaxError: Only one default export allowed per module. (2:9)", + "SyntaxError: Export 'foo' is not defined (2:9)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 56, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 26 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExportDefaultDeclaration", + "start": 0, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "declaration": { + "type": "FunctionDeclaration", + "start": 15, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 26, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "body": [], + "directives": [] + } + } + }, + { + "type": "EmptyStatement", + "start": 28, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 29 + } + } + }, + { + "type": "ExportNamedDeclaration", + "start": 30, + "end": 56, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 26 + } + }, + "specifiers": [ + { + "type": "ExportSpecifier", + "start": 39, + "end": 53, + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 23 + } + }, + "local": { + "type": "Identifier", + "start": 39, + "end": 42, + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 12 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "exported": { + "type": "Identifier", + "start": 46, + "end": 53, + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 23 + }, + "identifierName": "default" + }, + "name": "default" + } + } + ], + "source": null, + "declaration": null + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-export-default/options.json b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-export-default/options.json index 1ec6a5168f14..2104ca43283f 100644 --- a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-export-default/options.json +++ b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-export-default/options.json @@ -1,3 +1,3 @@ { - "throws": "Only one default export allowed per module. (2:0)" + "sourceType": "module" } diff --git a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-export-default/output.json b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-export-default/output.json new file mode 100644 index 000000000000..d8e83bc56d6e --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-export-default/output.json @@ -0,0 +1,135 @@ +{ + "type": "File", + "start": 0, + "end": 48, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 29 + } + }, + "errors": [ + "SyntaxError: Only one default export allowed per module. (2:0)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 48, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 29 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExportDefaultDeclaration", + "start": 0, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "declaration": { + "type": "ObjectExpression", + "start": 15, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "properties": [] + } + }, + { + "type": "ExportDefaultDeclaration", + "start": 19, + "end": 47, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 28 + } + }, + "declaration": { + "type": "FunctionDeclaration", + "start": 34, + "end": 47, + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 28 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 45, + "end": 47, + "loc": { + "start": { + "line": 2, + "column": 26 + }, + "end": { + "line": 2, + "column": 28 + } + }, + "body": [], + "directives": [] + } + } + }, + { + "type": "EmptyStatement", + "start": 47, + "end": 48, + "loc": { + "start": { + "line": 2, + "column": 28 + }, + "end": { + "line": 2, + "column": 29 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-class-declaration/options.json b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-class-declaration/options.json index 3bdafe893282..2104ca43283f 100644 --- a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-class-declaration/options.json +++ b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-class-declaration/options.json @@ -1,3 +1,3 @@ { - "throws": "`Foo` has already been exported. Exported identifiers must be unique. (2:0)" + "sourceType": "module" } diff --git a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-class-declaration/output.json b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-class-declaration/output.json new file mode 100644 index 000000000000..cf1a59d2669e --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-class-declaration/output.json @@ -0,0 +1,187 @@ +{ + "type": "File", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 20 + } + }, + "errors": [ + "SyntaxError: `Foo` has already been exported. Exported identifiers must be unique. (2:0)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 20 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExportNamedDeclaration", + "start": 0, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "specifiers": [ + { + "type": "ExportSpecifier", + "start": 9, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "local": { + "type": "Identifier", + "start": 9, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 12 + }, + "identifierName": "Foo" + }, + "name": "Foo" + }, + "exported": { + "type": "Identifier", + "start": 9, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 12 + }, + "identifierName": "Foo" + }, + "name": "Foo" + } + } + ], + "source": null, + "declaration": null + }, + { + "type": "ExportNamedDeclaration", + "start": 16, + "end": 35, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 19 + } + }, + "specifiers": [], + "source": null, + "declaration": { + "type": "ClassDeclaration", + "start": 23, + "end": 35, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 19 + } + }, + "id": { + "type": "Identifier", + "start": 29, + "end": 32, + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 16 + }, + "identifierName": "Foo" + }, + "name": "Foo" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 33, + "end": 35, + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 19 + } + }, + "body": [] + } + } + }, + { + "type": "EmptyStatement", + "start": 35, + "end": 36, + "loc": { + "start": { + "line": 2, + "column": 19 + }, + "end": { + "line": 2, + "column": 20 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring-assignment/options.json b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring-assignment/options.json index d3d3a199e6e0..2104ca43283f 100644 --- a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring-assignment/options.json +++ b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring-assignment/options.json @@ -1,4 +1,3 @@ { - "sourceType": "module", - "throws": "`foo` has already been exported. Exported identifiers must be unique. (2:15)" -} \ No newline at end of file + "sourceType": "module" +} diff --git a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring-assignment/output.json b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring-assignment/output.json new file mode 100644 index 000000000000..ae3e358fbe8c --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring-assignment/output.json @@ -0,0 +1,280 @@ +{ + "type": "File", + "start": 0, + "end": 47, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 31 + } + }, + "errors": [ + "SyntaxError: `foo` has already been exported. Exported identifiers must be unique. (2:15)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 47, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 31 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExportNamedDeclaration", + "start": 0, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "specifiers": [ + { + "type": "ExportSpecifier", + "start": 9, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "local": { + "type": "Identifier", + "start": 9, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 12 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "exported": { + "type": "Identifier", + "start": 9, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 12 + }, + "identifierName": "foo" + }, + "name": "foo" + } + } + ], + "source": null, + "declaration": null + }, + { + "type": "ExportNamedDeclaration", + "start": 16, + "end": 47, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 31 + } + }, + "specifiers": [], + "source": null, + "declaration": { + "type": "VariableDeclaration", + "start": 23, + "end": 47, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 31 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 29, + "end": 46, + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 30 + } + }, + "id": { + "type": "ObjectPattern", + "start": 29, + "end": 40, + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 24 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 31, + "end": 38, + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 22 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 31, + "end": 34, + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 18 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "computed": false, + "shorthand": true, + "value": { + "type": "AssignmentPattern", + "start": 31, + "end": 38, + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 22 + } + }, + "left": { + "type": "Identifier", + "start": 31, + "end": 34, + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 18 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "right": { + "type": "NumericLiteral", + "start": 37, + "end": 38, + "loc": { + "start": { + "line": 2, + "column": 21 + }, + "end": { + "line": 2, + "column": 22 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + }, + "extra": { + "shorthand": true + } + } + ] + }, + "init": { + "type": "Identifier", + "start": 43, + "end": 46, + "loc": { + "start": { + "line": 2, + "column": 27 + }, + "end": { + "line": 2, + "column": 30 + }, + "identifierName": "bar" + }, + "name": "bar" + } + } + ], + "kind": "const" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring10/options.json b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring10/options.json deleted file mode 100644 index 446a980f5409..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring10/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'foo' has already been declared (2:20)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring10/output.json b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring10/output.json new file mode 100644 index 000000000000..ba018d66dfd9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring10/output.json @@ -0,0 +1,331 @@ +{ + "type": "File", + "start": 0, + "end": 60, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 34 + } + }, + "errors": [ + "SyntaxError: Identifier 'foo' has already been declared (2:20)", + "SyntaxError: `foo` has already been exported. Exported identifiers must be unique. (2:20)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 60, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 34 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExportNamedDeclaration", + "start": 0, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "specifiers": [], + "source": null, + "declaration": { + "type": "FunctionDeclaration", + "start": 7, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "id": { + "type": "Identifier", + "start": 16, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 19 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 22, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "body": [], + "directives": [] + } + } + }, + { + "type": "EmptyStatement", + "start": 24, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + { + "type": "ExportNamedDeclaration", + "start": 26, + "end": 60, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 34 + } + }, + "specifiers": [], + "source": null, + "declaration": { + "type": "VariableDeclaration", + "start": 33, + "end": 60, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 34 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 39, + "end": 59, + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 33 + } + }, + "id": { + "type": "ObjectPattern", + "start": 39, + "end": 53, + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 27 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 41, + "end": 51, + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 25 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 41, + "end": 42, + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 16 + }, + "identifierName": "a" + }, + "name": "a" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "ArrayPattern", + "start": 44, + "end": 51, + "loc": { + "start": { + "line": 2, + "column": 18 + }, + "end": { + "line": 2, + "column": 25 + } + }, + "elements": [ + { + "type": "ObjectPattern", + "start": 45, + "end": 50, + "loc": { + "start": { + "line": 2, + "column": 19 + }, + "end": { + "line": 2, + "column": 24 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 46, + "end": 49, + "loc": { + "start": { + "line": 2, + "column": 20 + }, + "end": { + "line": 2, + "column": 23 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 46, + "end": 49, + "loc": { + "start": { + "line": 2, + "column": 20 + }, + "end": { + "line": 2, + "column": 23 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "computed": false, + "shorthand": true, + "value": { + "type": "Identifier", + "start": 46, + "end": 49, + "loc": { + "start": { + "line": 2, + "column": 20 + }, + "end": { + "line": 2, + "column": 23 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "extra": { + "shorthand": true + } + } + ] + } + ] + } + } + ] + }, + "init": { + "type": "Identifier", + "start": 56, + "end": 59, + "loc": { + "start": { + "line": 2, + "column": 30 + }, + "end": { + "line": 2, + "column": 33 + }, + "identifierName": "bar" + }, + "name": "bar" + } + } + ], + "kind": "const" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring11/options.json b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring11/options.json deleted file mode 100644 index 09b3fa97a0d1..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring11/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'foo4' has already been declared (2:50)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring11/output.json b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring11/output.json new file mode 100644 index 000000000000..853a21053688 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring11/output.json @@ -0,0 +1,521 @@ +{ + "type": "File", + "start": 0, + "end": 96, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 69 + } + }, + "errors": [ + "SyntaxError: Identifier 'foo4' has already been declared (2:50)", + "SyntaxError: `foo4` has already been exported. Exported identifiers must be unique. (2:50)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 96, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 69 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExportNamedDeclaration", + "start": 0, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "specifiers": [], + "source": null, + "declaration": { + "type": "FunctionDeclaration", + "start": 7, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "id": { + "type": "Identifier", + "start": 16, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 20 + }, + "identifierName": "foo4" + }, + "name": "foo4" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 23, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "body": [], + "directives": [] + } + } + }, + { + "type": "EmptyStatement", + "start": 25, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 26 + } + } + }, + { + "type": "ExportNamedDeclaration", + "start": 27, + "end": 96, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 69 + } + }, + "specifiers": [], + "source": null, + "declaration": { + "type": "VariableDeclaration", + "start": 34, + "end": 96, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 69 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 40, + "end": 95, + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 68 + } + }, + "id": { + "type": "ArrayPattern", + "start": 40, + "end": 89, + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 62 + } + }, + "elements": [ + { + "type": "ObjectPattern", + "start": 41, + "end": 88, + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 61 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 43, + "end": 55, + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 28 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 43, + "end": 44, + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 17 + }, + "identifierName": "a" + }, + "name": "a" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "ArrayPattern", + "start": 46, + "end": 55, + "loc": { + "start": { + "line": 2, + "column": 19 + }, + "end": { + "line": 2, + "column": 28 + } + }, + "elements": [ + { + "type": "ObjectPattern", + "start": 47, + "end": 54, + "loc": { + "start": { + "line": 2, + "column": 20 + }, + "end": { + "line": 2, + "column": 27 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 49, + "end": 52, + "loc": { + "start": { + "line": 2, + "column": 22 + }, + "end": { + "line": 2, + "column": 25 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 49, + "end": 52, + "loc": { + "start": { + "line": 2, + "column": 22 + }, + "end": { + "line": 2, + "column": 25 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "computed": false, + "shorthand": true, + "value": { + "type": "Identifier", + "start": 49, + "end": 52, + "loc": { + "start": { + "line": 2, + "column": 22 + }, + "end": { + "line": 2, + "column": 25 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "extra": { + "shorthand": true + } + } + ] + } + ] + } + }, + { + "type": "ObjectProperty", + "start": 57, + "end": 86, + "loc": { + "start": { + "line": 2, + "column": 30 + }, + "end": { + "line": 2, + "column": 59 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 57, + "end": 58, + "loc": { + "start": { + "line": 2, + "column": 30 + }, + "end": { + "line": 2, + "column": 31 + }, + "identifierName": "b" + }, + "name": "b" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "ObjectPattern", + "start": 60, + "end": 86, + "loc": { + "start": { + "line": 2, + "column": 33 + }, + "end": { + "line": 2, + "column": 59 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 62, + "end": 84, + "loc": { + "start": { + "line": 2, + "column": 35 + }, + "end": { + "line": 2, + "column": 57 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 62, + "end": 66, + "loc": { + "start": { + "line": 2, + "column": 35 + }, + "end": { + "line": 2, + "column": 39 + }, + "identifierName": "foo2" + }, + "name": "foo2" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "ArrayPattern", + "start": 68, + "end": 84, + "loc": { + "start": { + "line": 2, + "column": 41 + }, + "end": { + "line": 2, + "column": 57 + } + }, + "elements": [ + { + "type": "ObjectPattern", + "start": 69, + "end": 83, + "loc": { + "start": { + "line": 2, + "column": 42 + }, + "end": { + "line": 2, + "column": 56 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 71, + "end": 81, + "loc": { + "start": { + "line": 2, + "column": 44 + }, + "end": { + "line": 2, + "column": 54 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 71, + "end": 75, + "loc": { + "start": { + "line": 2, + "column": 44 + }, + "end": { + "line": 2, + "column": 48 + }, + "identifierName": "foo3" + }, + "name": "foo3" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "Identifier", + "start": 77, + "end": 81, + "loc": { + "start": { + "line": 2, + "column": 50 + }, + "end": { + "line": 2, + "column": 54 + }, + "identifierName": "foo4" + }, + "name": "foo4" + } + } + ] + } + ] + } + } + ] + } + } + ] + } + ] + }, + "init": { + "type": "Identifier", + "start": 92, + "end": 95, + "loc": { + "start": { + "line": 2, + "column": 65 + }, + "end": { + "line": 2, + "column": 68 + }, + "identifierName": "bar" + }, + "name": "bar" + } + } + ], + "kind": "const" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring12/options.json b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring12/options.json deleted file mode 100644 index 3a7173c837e3..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring12/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'foo4' has already been declared (2:49)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring12/output.json b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring12/output.json new file mode 100644 index 000000000000..9100976f570c --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring12/output.json @@ -0,0 +1,504 @@ +{ + "type": "File", + "start": 0, + "end": 94, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 67 + } + }, + "errors": [ + "SyntaxError: Identifier 'foo4' has already been declared (2:49)", + "SyntaxError: `foo4` has already been exported. Exported identifiers must be unique. (2:49)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 94, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 67 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExportNamedDeclaration", + "start": 0, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "specifiers": [], + "source": null, + "declaration": { + "type": "FunctionDeclaration", + "start": 7, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "id": { + "type": "Identifier", + "start": 16, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 20 + }, + "identifierName": "foo4" + }, + "name": "foo4" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 23, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "body": [], + "directives": [] + } + } + }, + { + "type": "EmptyStatement", + "start": 25, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 26 + } + } + }, + { + "type": "ExportNamedDeclaration", + "start": 27, + "end": 94, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 67 + } + }, + "specifiers": [], + "source": null, + "declaration": { + "type": "VariableDeclaration", + "start": 34, + "end": 94, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 67 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 40, + "end": 93, + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 66 + } + }, + "id": { + "type": "ObjectPattern", + "start": 40, + "end": 87, + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 60 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 42, + "end": 54, + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 27 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 42, + "end": 43, + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 16 + }, + "identifierName": "a" + }, + "name": "a" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "ArrayPattern", + "start": 45, + "end": 54, + "loc": { + "start": { + "line": 2, + "column": 18 + }, + "end": { + "line": 2, + "column": 27 + } + }, + "elements": [ + { + "type": "ObjectPattern", + "start": 46, + "end": 53, + "loc": { + "start": { + "line": 2, + "column": 19 + }, + "end": { + "line": 2, + "column": 26 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 48, + "end": 51, + "loc": { + "start": { + "line": 2, + "column": 21 + }, + "end": { + "line": 2, + "column": 24 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 48, + "end": 51, + "loc": { + "start": { + "line": 2, + "column": 21 + }, + "end": { + "line": 2, + "column": 24 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "computed": false, + "shorthand": true, + "value": { + "type": "Identifier", + "start": 48, + "end": 51, + "loc": { + "start": { + "line": 2, + "column": 21 + }, + "end": { + "line": 2, + "column": 24 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "extra": { + "shorthand": true + } + } + ] + } + ] + } + }, + { + "type": "ObjectProperty", + "start": 56, + "end": 85, + "loc": { + "start": { + "line": 2, + "column": 29 + }, + "end": { + "line": 2, + "column": 58 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 56, + "end": 57, + "loc": { + "start": { + "line": 2, + "column": 29 + }, + "end": { + "line": 2, + "column": 30 + }, + "identifierName": "b" + }, + "name": "b" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "ObjectPattern", + "start": 59, + "end": 85, + "loc": { + "start": { + "line": 2, + "column": 32 + }, + "end": { + "line": 2, + "column": 58 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 61, + "end": 83, + "loc": { + "start": { + "line": 2, + "column": 34 + }, + "end": { + "line": 2, + "column": 56 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 61, + "end": 65, + "loc": { + "start": { + "line": 2, + "column": 34 + }, + "end": { + "line": 2, + "column": 38 + }, + "identifierName": "foo2" + }, + "name": "foo2" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "ArrayPattern", + "start": 67, + "end": 83, + "loc": { + "start": { + "line": 2, + "column": 40 + }, + "end": { + "line": 2, + "column": 56 + } + }, + "elements": [ + { + "type": "ObjectPattern", + "start": 68, + "end": 82, + "loc": { + "start": { + "line": 2, + "column": 41 + }, + "end": { + "line": 2, + "column": 55 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 70, + "end": 80, + "loc": { + "start": { + "line": 2, + "column": 43 + }, + "end": { + "line": 2, + "column": 53 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 70, + "end": 74, + "loc": { + "start": { + "line": 2, + "column": 43 + }, + "end": { + "line": 2, + "column": 47 + }, + "identifierName": "foo3" + }, + "name": "foo3" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "Identifier", + "start": 76, + "end": 80, + "loc": { + "start": { + "line": 2, + "column": 49 + }, + "end": { + "line": 2, + "column": 53 + }, + "identifierName": "foo4" + }, + "name": "foo4" + } + } + ] + } + ] + } + } + ] + } + } + ] + }, + "init": { + "type": "Identifier", + "start": 90, + "end": 93, + "loc": { + "start": { + "line": 2, + "column": 63 + }, + "end": { + "line": 2, + "column": 66 + }, + "identifierName": "bar" + }, + "name": "bar" + } + } + ], + "kind": "const" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring13/options.json b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring13/options.json deleted file mode 100644 index d3fc42a61ba1..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring13/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'foo4' has already been declared (2:58)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring13/output.json b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring13/output.json new file mode 100644 index 000000000000..63e32c488670 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring13/output.json @@ -0,0 +1,556 @@ +{ + "type": "File", + "start": 0, + "end": 103, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 76 + } + }, + "errors": [ + "SyntaxError: Identifier 'foo4' has already been declared (2:58)", + "SyntaxError: `foo4` has already been exported. Exported identifiers must be unique. (2:58)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 103, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 76 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExportNamedDeclaration", + "start": 0, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "specifiers": [], + "source": null, + "declaration": { + "type": "FunctionDeclaration", + "start": 7, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "id": { + "type": "Identifier", + "start": 16, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 20 + }, + "identifierName": "foo4" + }, + "name": "foo4" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 23, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "body": [], + "directives": [] + } + } + }, + { + "type": "EmptyStatement", + "start": 25, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 26 + } + } + }, + { + "type": "ExportNamedDeclaration", + "start": 27, + "end": 103, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 76 + } + }, + "specifiers": [], + "source": null, + "declaration": { + "type": "VariableDeclaration", + "start": 34, + "end": 103, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 76 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 40, + "end": 102, + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 75 + } + }, + "id": { + "type": "ObjectPattern", + "start": 40, + "end": 96, + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 69 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 42, + "end": 60, + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 33 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 42, + "end": 43, + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 16 + }, + "identifierName": "a" + }, + "name": "a" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "ArrayPattern", + "start": 45, + "end": 60, + "loc": { + "start": { + "line": 2, + "column": 18 + }, + "end": { + "line": 2, + "column": 33 + } + }, + "elements": [ + { + "type": "ObjectPattern", + "start": 46, + "end": 59, + "loc": { + "start": { + "line": 2, + "column": 19 + }, + "end": { + "line": 2, + "column": 32 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 48, + "end": 57, + "loc": { + "start": { + "line": 2, + "column": 21 + }, + "end": { + "line": 2, + "column": 30 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 48, + "end": 52, + "loc": { + "start": { + "line": 2, + "column": 21 + }, + "end": { + "line": 2, + "column": 25 + }, + "identifierName": "foo4" + }, + "name": "foo4" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "Identifier", + "start": 54, + "end": 57, + "loc": { + "start": { + "line": 2, + "column": 27 + }, + "end": { + "line": 2, + "column": 30 + }, + "identifierName": "foo" + }, + "name": "foo" + } + } + ] + } + ] + } + }, + { + "type": "ObjectProperty", + "start": 62, + "end": 63, + "loc": { + "start": { + "line": 2, + "column": 35 + }, + "end": { + "line": 2, + "column": 36 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 62, + "end": 63, + "loc": { + "start": { + "line": 2, + "column": 35 + }, + "end": { + "line": 2, + "column": 36 + }, + "identifierName": "b" + }, + "name": "b" + }, + "computed": false, + "shorthand": true, + "value": { + "type": "Identifier", + "start": 62, + "end": 63, + "loc": { + "start": { + "line": 2, + "column": 35 + }, + "end": { + "line": 2, + "column": 36 + }, + "identifierName": "b" + }, + "name": "b" + }, + "extra": { + "shorthand": true + } + }, + { + "type": "ObjectProperty", + "start": 65, + "end": 94, + "loc": { + "start": { + "line": 2, + "column": 38 + }, + "end": { + "line": 2, + "column": 67 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 65, + "end": 66, + "loc": { + "start": { + "line": 2, + "column": 38 + }, + "end": { + "line": 2, + "column": 39 + }, + "identifierName": "c" + }, + "name": "c" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "ObjectPattern", + "start": 68, + "end": 94, + "loc": { + "start": { + "line": 2, + "column": 41 + }, + "end": { + "line": 2, + "column": 67 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 70, + "end": 92, + "loc": { + "start": { + "line": 2, + "column": 43 + }, + "end": { + "line": 2, + "column": 65 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 70, + "end": 74, + "loc": { + "start": { + "line": 2, + "column": 43 + }, + "end": { + "line": 2, + "column": 47 + }, + "identifierName": "foo2" + }, + "name": "foo2" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "ArrayPattern", + "start": 76, + "end": 92, + "loc": { + "start": { + "line": 2, + "column": 49 + }, + "end": { + "line": 2, + "column": 65 + } + }, + "elements": [ + { + "type": "ObjectPattern", + "start": 77, + "end": 91, + "loc": { + "start": { + "line": 2, + "column": 50 + }, + "end": { + "line": 2, + "column": 64 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 79, + "end": 89, + "loc": { + "start": { + "line": 2, + "column": 52 + }, + "end": { + "line": 2, + "column": 62 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 79, + "end": 83, + "loc": { + "start": { + "line": 2, + "column": 52 + }, + "end": { + "line": 2, + "column": 56 + }, + "identifierName": "foo3" + }, + "name": "foo3" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "Identifier", + "start": 85, + "end": 89, + "loc": { + "start": { + "line": 2, + "column": 58 + }, + "end": { + "line": 2, + "column": 62 + }, + "identifierName": "foo4" + }, + "name": "foo4" + } + } + ] + } + ] + } + } + ] + } + } + ] + }, + "init": { + "type": "Identifier", + "start": 99, + "end": 102, + "loc": { + "start": { + "line": 2, + "column": 72 + }, + "end": { + "line": 2, + "column": 75 + }, + "identifierName": "bar" + }, + "name": "bar" + } + } + ], + "kind": "const" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring14/options.json b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring14/options.json deleted file mode 100644 index 80640e0ce127..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring14/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'foo' has already been declared (2:21)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring14/output.json b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring14/output.json new file mode 100644 index 000000000000..1d699b58133a --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring14/output.json @@ -0,0 +1,262 @@ +{ + "type": "File", + "start": 0, + "end": 55, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 33 + } + }, + "errors": [ + "SyntaxError: Identifier 'foo' has already been declared (2:21)", + "SyntaxError: `foo` has already been exported. Exported identifiers must be unique. (2:21)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 55, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 33 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExportNamedDeclaration", + "start": 0, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "specifiers": [], + "source": null, + "declaration": { + "type": "VariableDeclaration", + "start": 7, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 13, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "id": { + "type": "Identifier", + "start": 13, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 16 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "init": { + "type": "NumericLiteral", + "start": 19, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + ], + "kind": "const" + } + }, + { + "type": "ExportNamedDeclaration", + "start": 22, + "end": 55, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 33 + } + }, + "specifiers": [], + "source": null, + "declaration": { + "type": "VariableDeclaration", + "start": 29, + "end": 55, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 33 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 35, + "end": 54, + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 32 + } + }, + "id": { + "type": "ObjectPattern", + "start": 35, + "end": 48, + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 26 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 37, + "end": 46, + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 24 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 37, + "end": 41, + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 19 + }, + "identifierName": "foo2" + }, + "name": "foo2" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "Identifier", + "start": 43, + "end": 46, + "loc": { + "start": { + "line": 2, + "column": 21 + }, + "end": { + "line": 2, + "column": 24 + }, + "identifierName": "foo" + }, + "name": "foo" + } + } + ] + }, + "init": { + "type": "Identifier", + "start": 51, + "end": 54, + "loc": { + "start": { + "line": 2, + "column": 29 + }, + "end": { + "line": 2, + "column": 32 + }, + "identifierName": "bar" + }, + "name": "bar" + } + } + ], + "kind": "const" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring15/options.json b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring15/options.json deleted file mode 100644 index ea3a9b62f493..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring15/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'foo2' has already been declared (2:13)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring15/output.json b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring15/output.json new file mode 100644 index 000000000000..140798f03a2d --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring15/output.json @@ -0,0 +1,262 @@ +{ + "type": "File", + "start": 0, + "end": 56, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 22 + } + }, + "errors": [ + "SyntaxError: Identifier 'foo2' has already been declared (2:13)", + "SyntaxError: `foo2` has already been exported. Exported identifiers must be unique. (2:13)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 56, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 22 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExportNamedDeclaration", + "start": 0, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "specifiers": [], + "source": null, + "declaration": { + "type": "VariableDeclaration", + "start": 7, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 13, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "id": { + "type": "ObjectPattern", + "start": 13, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 15, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 15, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 18 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "Identifier", + "start": 20, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 24 + }, + "identifierName": "foo2" + }, + "name": "foo2" + } + } + ] + }, + "init": { + "type": "Identifier", + "start": 29, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 32 + }, + "identifierName": "bar" + }, + "name": "bar" + } + } + ], + "kind": "const" + } + }, + { + "type": "ExportNamedDeclaration", + "start": 34, + "end": 56, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 22 + } + }, + "specifiers": [], + "source": null, + "declaration": { + "type": "VariableDeclaration", + "start": 41, + "end": 56, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 22 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 47, + "end": 55, + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 21 + } + }, + "id": { + "type": "Identifier", + "start": 47, + "end": 51, + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 17 + }, + "identifierName": "foo2" + }, + "name": "foo2" + }, + "init": { + "type": "NumericLiteral", + "start": 54, + "end": 55, + "loc": { + "start": { + "line": 2, + "column": 20 + }, + "end": { + "line": 2, + "column": 21 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + ], + "kind": "const" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring16/options.json b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring16/options.json deleted file mode 100644 index 42c862ad273a..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring16/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'foo' has already been declared (2:22)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring16/output.json b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring16/output.json new file mode 100644 index 000000000000..d51c3a34e349 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring16/output.json @@ -0,0 +1,259 @@ +{ + "type": "File", + "start": 0, + "end": 55, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 33 + } + }, + "errors": [ + "SyntaxError: Identifier 'foo' has already been declared (2:22)", + "SyntaxError: `foo` has already been exported. Exported identifiers must be unique. (2:22)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 55, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 33 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExportNamedDeclaration", + "start": 0, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "specifiers": [], + "source": null, + "declaration": { + "type": "VariableDeclaration", + "start": 7, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 13, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "id": { + "type": "Identifier", + "start": 13, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 16 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "init": { + "type": "NumericLiteral", + "start": 19, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + ], + "kind": "const" + } + }, + { + "type": "ExportNamedDeclaration", + "start": 22, + "end": 55, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 33 + } + }, + "specifiers": [], + "source": null, + "declaration": { + "type": "VariableDeclaration", + "start": 29, + "end": 55, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 33 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 35, + "end": 54, + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 32 + } + }, + "id": { + "type": "ArrayPattern", + "start": 35, + "end": 48, + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 26 + } + }, + "elements": [ + { + "type": "Identifier", + "start": 36, + "end": 39, + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 17 + }, + "identifierName": "bar" + }, + "name": "bar" + }, + { + "type": "RestElement", + "start": 41, + "end": 47, + "loc": { + "start": { + "line": 2, + "column": 19 + }, + "end": { + "line": 2, + "column": 25 + } + }, + "argument": { + "type": "Identifier", + "start": 44, + "end": 47, + "loc": { + "start": { + "line": 2, + "column": 22 + }, + "end": { + "line": 2, + "column": 25 + }, + "identifierName": "foo" + }, + "name": "foo" + } + } + ] + }, + "init": { + "type": "Identifier", + "start": 51, + "end": 54, + "loc": { + "start": { + "line": 2, + "column": 29 + }, + "end": { + "line": 2, + "column": 32 + }, + "identifierName": "baz" + }, + "name": "baz" + } + } + ], + "kind": "const" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring17/options.json b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring17/options.json deleted file mode 100644 index 125c2618435d..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring17/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'bar' has already been declared (2:13)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring17/output.json b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring17/output.json new file mode 100644 index 000000000000..5d56b3c37e96 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring17/output.json @@ -0,0 +1,259 @@ +{ + "type": "File", + "start": 0, + "end": 55, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 21 + } + }, + "errors": [ + "SyntaxError: Identifier 'bar' has already been declared (2:13)", + "SyntaxError: `bar` has already been exported. Exported identifiers must be unique. (2:13)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 55, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 21 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExportNamedDeclaration", + "start": 0, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "specifiers": [], + "source": null, + "declaration": { + "type": "VariableDeclaration", + "start": 7, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 13, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "id": { + "type": "ArrayPattern", + "start": 13, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "elements": [ + { + "type": "Identifier", + "start": 14, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 17 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + { + "type": "RestElement", + "start": 19, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "argument": { + "type": "Identifier", + "start": 22, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 25 + }, + "identifierName": "bar" + }, + "name": "bar" + } + } + ] + }, + "init": { + "type": "Identifier", + "start": 29, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 32 + }, + "identifierName": "baz" + }, + "name": "baz" + } + } + ], + "kind": "const" + } + }, + { + "type": "ExportNamedDeclaration", + "start": 34, + "end": 55, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 21 + } + }, + "specifiers": [], + "source": null, + "declaration": { + "type": "VariableDeclaration", + "start": 41, + "end": 55, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 21 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 47, + "end": 54, + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 20 + } + }, + "id": { + "type": "Identifier", + "start": 47, + "end": 50, + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 16 + }, + "identifierName": "bar" + }, + "name": "bar" + }, + "init": { + "type": "NumericLiteral", + "start": 53, + "end": 54, + "loc": { + "start": { + "line": 2, + "column": 19 + }, + "end": { + "line": 2, + "column": 20 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + ], + "kind": "const" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring18/options.json b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring18/options.json deleted file mode 100644 index bf345ea77127..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring18/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'foo' has already been declared (2:28)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring18/output.json b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring18/output.json new file mode 100644 index 000000000000..0378d078ec4f --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring18/output.json @@ -0,0 +1,293 @@ +{ + "type": "File", + "start": 0, + "end": 62, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 40 + } + }, + "errors": [ + "SyntaxError: Identifier 'foo' has already been declared (2:28)", + "SyntaxError: `foo` has already been exported. Exported identifiers must be unique. (2:28)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 62, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 40 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExportNamedDeclaration", + "start": 0, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "specifiers": [], + "source": null, + "declaration": { + "type": "VariableDeclaration", + "start": 7, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 13, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "id": { + "type": "Identifier", + "start": 13, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 16 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "init": { + "type": "NumericLiteral", + "start": 19, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + ], + "kind": "const" + } + }, + { + "type": "ExportNamedDeclaration", + "start": 22, + "end": 62, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 40 + } + }, + "specifiers": [], + "source": null, + "declaration": { + "type": "VariableDeclaration", + "start": 29, + "end": 62, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 40 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 35, + "end": 61, + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 39 + } + }, + "id": { + "type": "ArrayPattern", + "start": 35, + "end": 55, + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 33 + } + }, + "elements": [ + { + "type": "Identifier", + "start": 36, + "end": 39, + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 17 + }, + "identifierName": "bar" + }, + "name": "bar" + }, + { + "type": "ArrayPattern", + "start": 41, + "end": 54, + "loc": { + "start": { + "line": 2, + "column": 19 + }, + "end": { + "line": 2, + "column": 32 + } + }, + "elements": [ + { + "type": "Identifier", + "start": 42, + "end": 45, + "loc": { + "start": { + "line": 2, + "column": 20 + }, + "end": { + "line": 2, + "column": 23 + }, + "identifierName": "baz" + }, + "name": "baz" + }, + { + "type": "RestElement", + "start": 47, + "end": 53, + "loc": { + "start": { + "line": 2, + "column": 25 + }, + "end": { + "line": 2, + "column": 31 + } + }, + "argument": { + "type": "Identifier", + "start": 50, + "end": 53, + "loc": { + "start": { + "line": 2, + "column": 28 + }, + "end": { + "line": 2, + "column": 31 + }, + "identifierName": "foo" + }, + "name": "foo" + } + } + ] + } + ] + }, + "init": { + "type": "Identifier", + "start": 58, + "end": 61, + "loc": { + "start": { + "line": 2, + "column": 36 + }, + "end": { + "line": 2, + "column": 39 + }, + "identifierName": "qux" + }, + "name": "qux" + } + } + ], + "kind": "const" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring19/options.json b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring19/options.json deleted file mode 100644 index bf2483362193..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring19/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'foo' has already been declared (2:29)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring19/output.json b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring19/output.json new file mode 100644 index 000000000000..e185b7f4186f --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring19/output.json @@ -0,0 +1,311 @@ +{ + "type": "File", + "start": 0, + "end": 64, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 42 + } + }, + "errors": [ + "SyntaxError: Identifier 'foo' has already been declared (2:29)", + "SyntaxError: `foo` has already been exported. Exported identifiers must be unique. (2:29)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 64, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 42 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExportNamedDeclaration", + "start": 0, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "specifiers": [], + "source": null, + "declaration": { + "type": "VariableDeclaration", + "start": 7, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 13, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "id": { + "type": "Identifier", + "start": 13, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 16 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "init": { + "type": "NumericLiteral", + "start": 19, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + ], + "kind": "const" + } + }, + { + "type": "ExportNamedDeclaration", + "start": 22, + "end": 64, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 42 + } + }, + "specifiers": [], + "source": null, + "declaration": { + "type": "VariableDeclaration", + "start": 29, + "end": 64, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 42 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 35, + "end": 63, + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 41 + } + }, + "id": { + "type": "ObjectPattern", + "start": 35, + "end": 57, + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 35 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 37, + "end": 55, + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 33 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 37, + "end": 40, + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 18 + }, + "identifierName": "bar" + }, + "name": "bar" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "ArrayPattern", + "start": 42, + "end": 55, + "loc": { + "start": { + "line": 2, + "column": 20 + }, + "end": { + "line": 2, + "column": 33 + } + }, + "elements": [ + { + "type": "Identifier", + "start": 43, + "end": 46, + "loc": { + "start": { + "line": 2, + "column": 21 + }, + "end": { + "line": 2, + "column": 24 + }, + "identifierName": "baz" + }, + "name": "baz" + }, + { + "type": "RestElement", + "start": 48, + "end": 54, + "loc": { + "start": { + "line": 2, + "column": 26 + }, + "end": { + "line": 2, + "column": 32 + } + }, + "argument": { + "type": "Identifier", + "start": 51, + "end": 54, + "loc": { + "start": { + "line": 2, + "column": 29 + }, + "end": { + "line": 2, + "column": 32 + }, + "identifierName": "foo" + }, + "name": "foo" + } + } + ] + } + } + ] + }, + "init": { + "type": "Identifier", + "start": 60, + "end": 63, + "loc": { + "start": { + "line": 2, + "column": 38 + }, + "end": { + "line": 2, + "column": 41 + }, + "identifierName": "qux" + }, + "name": "qux" + } + } + ], + "kind": "const" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring2/options.json b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring2/options.json deleted file mode 100644 index 2cbe06c40914..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring2/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'foo' has already been declared (2:15)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring2/output.json b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring2/output.json new file mode 100644 index 000000000000..8e8c195325fc --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring2/output.json @@ -0,0 +1,262 @@ +{ + "type": "File", + "start": 0, + "end": 53, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 27 + } + }, + "errors": [ + "SyntaxError: Identifier 'foo' has already been declared (2:15)", + "SyntaxError: `foo` has already been exported. Exported identifiers must be unique. (2:15)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 53, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 27 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExportNamedDeclaration", + "start": 0, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "specifiers": [], + "source": null, + "declaration": { + "type": "FunctionDeclaration", + "start": 7, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "id": { + "type": "Identifier", + "start": 16, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 19 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 22, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "body": [], + "directives": [] + } + } + }, + { + "type": "EmptyStatement", + "start": 24, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + { + "type": "ExportNamedDeclaration", + "start": 26, + "end": 53, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 27 + } + }, + "specifiers": [], + "source": null, + "declaration": { + "type": "VariableDeclaration", + "start": 33, + "end": 53, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 27 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 39, + "end": 52, + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 26 + } + }, + "id": { + "type": "ObjectPattern", + "start": 39, + "end": 46, + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 20 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 41, + "end": 44, + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 18 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 41, + "end": 44, + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 18 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "computed": false, + "shorthand": true, + "value": { + "type": "Identifier", + "start": 41, + "end": 44, + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 18 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "extra": { + "shorthand": true + } + } + ] + }, + "init": { + "type": "Identifier", + "start": 49, + "end": 52, + "loc": { + "start": { + "line": 2, + "column": 23 + }, + "end": { + "line": 2, + "column": 26 + }, + "identifierName": "bar" + }, + "name": "bar" + } + } + ], + "kind": "const" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring3/options.json b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring3/options.json deleted file mode 100644 index d36390356990..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring3/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'foo' has already been declared (2:16)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring3/output.json b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring3/output.json new file mode 100644 index 000000000000..f862a6a420c6 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring3/output.json @@ -0,0 +1,262 @@ +{ + "type": "File", + "start": 0, + "end": 53, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 25 + } + }, + "errors": [ + "SyntaxError: Identifier 'foo' has already been declared (2:16)", + "SyntaxError: `foo` has already been exported. Exported identifiers must be unique. (2:0)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 53, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 25 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExportNamedDeclaration", + "start": 0, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "specifiers": [], + "source": null, + "declaration": { + "type": "VariableDeclaration", + "start": 7, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 13, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "id": { + "type": "ObjectPattern", + "start": 13, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 15, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 15, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 18 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "computed": false, + "shorthand": true, + "value": { + "type": "Identifier", + "start": 15, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 18 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "extra": { + "shorthand": true + } + } + ] + }, + "init": { + "type": "Identifier", + "start": 23, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 26 + }, + "identifierName": "bar" + }, + "name": "bar" + } + } + ], + "kind": "const" + } + }, + { + "type": "ExportNamedDeclaration", + "start": 28, + "end": 52, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 24 + } + }, + "specifiers": [], + "source": null, + "declaration": { + "type": "FunctionDeclaration", + "start": 35, + "end": 52, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 24 + } + }, + "id": { + "type": "Identifier", + "start": 44, + "end": 47, + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 19 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 50, + "end": 52, + "loc": { + "start": { + "line": 2, + "column": 22 + }, + "end": { + "line": 2, + "column": 24 + } + }, + "body": [], + "directives": [] + } + } + }, + { + "type": "EmptyStatement", + "start": 52, + "end": 53, + "loc": { + "start": { + "line": 2, + "column": 24 + }, + "end": { + "line": 2, + "column": 25 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring4/options.json b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring4/options.json deleted file mode 100644 index 46358493589c..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring4/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'foo' has already been declared (2:14)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring4/output.json b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring4/output.json new file mode 100644 index 000000000000..401baa93a85a --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring4/output.json @@ -0,0 +1,224 @@ +{ + "type": "File", + "start": 0, + "end": 51, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 25 + } + }, + "errors": [ + "SyntaxError: Identifier 'foo' has already been declared (2:14)", + "SyntaxError: `foo` has already been exported. Exported identifiers must be unique. (2:14)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 51, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 25 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExportNamedDeclaration", + "start": 0, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "specifiers": [], + "source": null, + "declaration": { + "type": "FunctionDeclaration", + "start": 7, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "id": { + "type": "Identifier", + "start": 16, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 19 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 22, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "body": [], + "directives": [] + } + } + }, + { + "type": "EmptyStatement", + "start": 24, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + { + "type": "ExportNamedDeclaration", + "start": 26, + "end": 51, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 25 + } + }, + "specifiers": [], + "source": null, + "declaration": { + "type": "VariableDeclaration", + "start": 33, + "end": 51, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 25 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 39, + "end": 50, + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 24 + } + }, + "id": { + "type": "ArrayPattern", + "start": 39, + "end": 44, + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 18 + } + }, + "elements": [ + { + "type": "Identifier", + "start": 40, + "end": 43, + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 17 + }, + "identifierName": "foo" + }, + "name": "foo" + } + ] + }, + "init": { + "type": "Identifier", + "start": 47, + "end": 50, + "loc": { + "start": { + "line": 2, + "column": 21 + }, + "end": { + "line": 2, + "column": 24 + }, + "identifierName": "bar" + }, + "name": "bar" + } + } + ], + "kind": "const" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring5/options.json b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring5/options.json deleted file mode 100644 index d36390356990..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring5/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'foo' has already been declared (2:16)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring5/output.json b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring5/output.json new file mode 100644 index 000000000000..39b035aada97 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring5/output.json @@ -0,0 +1,224 @@ +{ + "type": "File", + "start": 0, + "end": 51, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 25 + } + }, + "errors": [ + "SyntaxError: Identifier 'foo' has already been declared (2:16)", + "SyntaxError: `foo` has already been exported. Exported identifiers must be unique. (2:0)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 51, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 25 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExportNamedDeclaration", + "start": 0, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "specifiers": [], + "source": null, + "declaration": { + "type": "VariableDeclaration", + "start": 7, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 13, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "id": { + "type": "ArrayPattern", + "start": 13, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "elements": [ + { + "type": "Identifier", + "start": 14, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 17 + }, + "identifierName": "foo" + }, + "name": "foo" + } + ] + }, + "init": { + "type": "Identifier", + "start": 21, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 24 + }, + "identifierName": "bar" + }, + "name": "bar" + } + } + ], + "kind": "const" + } + }, + { + "type": "ExportNamedDeclaration", + "start": 26, + "end": 50, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 24 + } + }, + "specifiers": [], + "source": null, + "declaration": { + "type": "FunctionDeclaration", + "start": 33, + "end": 50, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 24 + } + }, + "id": { + "type": "Identifier", + "start": 42, + "end": 45, + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 19 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 48, + "end": 50, + "loc": { + "start": { + "line": 2, + "column": 22 + }, + "end": { + "line": 2, + "column": 24 + } + }, + "body": [], + "directives": [] + } + } + }, + { + "type": "EmptyStatement", + "start": 50, + "end": 51, + "loc": { + "start": { + "line": 2, + "column": 24 + }, + "end": { + "line": 2, + "column": 25 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring6/options.json b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring6/options.json deleted file mode 100644 index 46358493589c..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring6/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'foo' has already been declared (2:14)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring6/output.json b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring6/output.json new file mode 100644 index 000000000000..d4856c9023d7 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring6/output.json @@ -0,0 +1,279 @@ +{ + "type": "File", + "start": 0, + "end": 54, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 26 + } + }, + "errors": [ + "SyntaxError: Identifier 'foo' has already been declared (2:14)", + "SyntaxError: `foo` has already been exported. Exported identifiers must be unique. (2:14)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 54, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 26 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExportNamedDeclaration", + "start": 0, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "specifiers": [], + "source": null, + "declaration": { + "type": "VariableDeclaration", + "start": 7, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 13, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "id": { + "type": "ObjectPattern", + "start": 13, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 15, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 15, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 18 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "computed": false, + "shorthand": true, + "value": { + "type": "Identifier", + "start": 15, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 18 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "extra": { + "shorthand": true + } + } + ] + }, + "init": { + "type": "Identifier", + "start": 23, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 26 + }, + "identifierName": "bar" + }, + "name": "bar" + } + } + ], + "kind": "const" + } + }, + { + "type": "ExportNamedDeclaration", + "start": 28, + "end": 54, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 26 + } + }, + "specifiers": [], + "source": null, + "declaration": { + "type": "VariableDeclaration", + "start": 35, + "end": 54, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 26 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 41, + "end": 53, + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 25 + } + }, + "id": { + "type": "ArrayPattern", + "start": 41, + "end": 46, + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 18 + } + }, + "elements": [ + { + "type": "Identifier", + "start": 42, + "end": 45, + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 17 + }, + "identifierName": "foo" + }, + "name": "foo" + } + ] + }, + "init": { + "type": "Identifier", + "start": 49, + "end": 53, + "loc": { + "start": { + "line": 2, + "column": 21 + }, + "end": { + "line": 2, + "column": 25 + }, + "identifierName": "bar2" + }, + "name": "bar2" + } + } + ], + "kind": "const" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring7/options.json b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring7/options.json deleted file mode 100644 index 2cbe06c40914..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring7/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'foo' has already been declared (2:15)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring7/output.json b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring7/output.json new file mode 100644 index 000000000000..3bfd361f5286 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring7/output.json @@ -0,0 +1,279 @@ +{ + "type": "File", + "start": 0, + "end": 54, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 28 + } + }, + "errors": [ + "SyntaxError: Identifier 'foo' has already been declared (2:15)", + "SyntaxError: `foo` has already been exported. Exported identifiers must be unique. (2:15)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 54, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 28 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExportNamedDeclaration", + "start": 0, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "specifiers": [], + "source": null, + "declaration": { + "type": "VariableDeclaration", + "start": 7, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 13, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "id": { + "type": "ArrayPattern", + "start": 13, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "elements": [ + { + "type": "Identifier", + "start": 14, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 17 + }, + "identifierName": "foo" + }, + "name": "foo" + } + ] + }, + "init": { + "type": "Identifier", + "start": 21, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 24 + }, + "identifierName": "bar" + }, + "name": "bar" + } + } + ], + "kind": "const" + } + }, + { + "type": "ExportNamedDeclaration", + "start": 26, + "end": 54, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 28 + } + }, + "specifiers": [], + "source": null, + "declaration": { + "type": "VariableDeclaration", + "start": 33, + "end": 54, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 28 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 39, + "end": 53, + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 27 + } + }, + "id": { + "type": "ObjectPattern", + "start": 39, + "end": 46, + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 20 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 41, + "end": 44, + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 18 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 41, + "end": 44, + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 18 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "computed": false, + "shorthand": true, + "value": { + "type": "Identifier", + "start": 41, + "end": 44, + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 18 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "extra": { + "shorthand": true + } + } + ] + }, + "init": { + "type": "Identifier", + "start": 49, + "end": 53, + "loc": { + "start": { + "line": 2, + "column": 23 + }, + "end": { + "line": 2, + "column": 27 + }, + "identifierName": "bar2" + }, + "name": "bar2" + } + } + ], + "kind": "const" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring8/options.json b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring8/options.json deleted file mode 100644 index 982078d803c6..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring8/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'Foo' has already been declared (2:15)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring8/output.json b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring8/output.json new file mode 100644 index 000000000000..5826aac519d7 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring8/output.json @@ -0,0 +1,259 @@ +{ + "type": "File", + "start": 0, + "end": 48, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 27 + } + }, + "errors": [ + "SyntaxError: Identifier 'Foo' has already been declared (2:15)", + "SyntaxError: `Foo` has already been exported. Exported identifiers must be unique. (2:15)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 48, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 27 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExportNamedDeclaration", + "start": 0, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "specifiers": [], + "source": null, + "declaration": { + "type": "ClassDeclaration", + "start": 7, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "id": { + "type": "Identifier", + "start": 13, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 16 + }, + "identifierName": "Foo" + }, + "name": "Foo" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 17, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "body": [] + } + } + }, + { + "type": "EmptyStatement", + "start": 19, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + { + "type": "ExportNamedDeclaration", + "start": 21, + "end": 48, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 27 + } + }, + "specifiers": [], + "source": null, + "declaration": { + "type": "VariableDeclaration", + "start": 28, + "end": 48, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 27 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 34, + "end": 47, + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 26 + } + }, + "id": { + "type": "ObjectPattern", + "start": 34, + "end": 41, + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 20 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 36, + "end": 39, + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 18 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 36, + "end": 39, + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 18 + }, + "identifierName": "Foo" + }, + "name": "Foo" + }, + "computed": false, + "shorthand": true, + "value": { + "type": "Identifier", + "start": 36, + "end": 39, + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 18 + }, + "identifierName": "Foo" + }, + "name": "Foo" + }, + "extra": { + "shorthand": true + } + } + ] + }, + "init": { + "type": "Identifier", + "start": 44, + "end": 47, + "loc": { + "start": { + "line": 2, + "column": 23 + }, + "end": { + "line": 2, + "column": 26 + }, + "identifierName": "bar" + }, + "name": "bar" + } + } + ], + "kind": "const" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring9/options.json b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring9/options.json deleted file mode 100644 index f79b5469b1c0..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring9/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'Foo' has already been declared (2:14)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring9/output.json b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring9/output.json new file mode 100644 index 000000000000..4ee921df359a --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring9/output.json @@ -0,0 +1,221 @@ +{ + "type": "File", + "start": 0, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 25 + } + }, + "errors": [ + "SyntaxError: Identifier 'Foo' has already been declared (2:14)", + "SyntaxError: `Foo` has already been exported. Exported identifiers must be unique. (2:14)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 25 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExportNamedDeclaration", + "start": 0, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "specifiers": [], + "source": null, + "declaration": { + "type": "ClassDeclaration", + "start": 7, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "id": { + "type": "Identifier", + "start": 13, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 16 + }, + "identifierName": "Foo" + }, + "name": "Foo" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 17, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "body": [] + } + } + }, + { + "type": "EmptyStatement", + "start": 19, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + { + "type": "ExportNamedDeclaration", + "start": 21, + "end": 46, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 25 + } + }, + "specifiers": [], + "source": null, + "declaration": { + "type": "VariableDeclaration", + "start": 28, + "end": 46, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 25 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 34, + "end": 45, + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 24 + } + }, + "id": { + "type": "ArrayPattern", + "start": 34, + "end": 39, + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 18 + } + }, + "elements": [ + { + "type": "Identifier", + "start": 35, + "end": 38, + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 17 + }, + "identifierName": "Foo" + }, + "name": "Foo" + } + ] + }, + "init": { + "type": "Identifier", + "start": 42, + "end": 45, + "loc": { + "start": { + "line": 2, + "column": 21 + }, + "end": { + "line": 2, + "column": 24 + }, + "identifierName": "bar" + }, + "name": "bar" + } + } + ], + "kind": "const" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-function-declaration/options.json b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-function-declaration/options.json index 1923e4752336..2104ca43283f 100644 --- a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-function-declaration/options.json +++ b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-function-declaration/options.json @@ -1,3 +1,3 @@ { - "throws": "`foo` has already been exported. Exported identifiers must be unique. (2:0)" + "sourceType": "module" } diff --git a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-function-declaration/output.json b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-function-declaration/output.json new file mode 100644 index 000000000000..ac8f210f8ba9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-function-declaration/output.json @@ -0,0 +1,190 @@ +{ + "type": "File", + "start": 0, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 25 + } + }, + "errors": [ + "SyntaxError: `foo` has already been exported. Exported identifiers must be unique. (2:0)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 25 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExportNamedDeclaration", + "start": 0, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "specifiers": [ + { + "type": "ExportSpecifier", + "start": 9, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "local": { + "type": "Identifier", + "start": 9, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 12 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "exported": { + "type": "Identifier", + "start": 9, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 12 + }, + "identifierName": "foo" + }, + "name": "foo" + } + } + ], + "source": null, + "declaration": null + }, + { + "type": "ExportNamedDeclaration", + "start": 16, + "end": 40, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 24 + } + }, + "specifiers": [], + "source": null, + "declaration": { + "type": "FunctionDeclaration", + "start": 23, + "end": 40, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 24 + } + }, + "id": { + "type": "Identifier", + "start": 32, + "end": 35, + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 19 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 38, + "end": 40, + "loc": { + "start": { + "line": 2, + "column": 22 + }, + "end": { + "line": 2, + "column": 24 + } + }, + "body": [], + "directives": [] + } + } + }, + { + "type": "EmptyStatement", + "start": 40, + "end": 41, + "loc": { + "start": { + "line": 2, + "column": 24 + }, + "end": { + "line": 2, + "column": 25 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-variable-declaration/options.json b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-variable-declaration/options.json index 9fdf7082da17..2104ca43283f 100644 --- a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-variable-declaration/options.json +++ b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-variable-declaration/options.json @@ -1,3 +1,3 @@ { - "throws": "`foo` has already been exported. Exported identifiers must be unique. (2:13)" + "sourceType": "module" } diff --git a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-variable-declaration/output.json b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-variable-declaration/output.json new file mode 100644 index 000000000000..981050ec6112 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-variable-declaration/output.json @@ -0,0 +1,190 @@ +{ + "type": "File", + "start": 0, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 23 + } + }, + "errors": [ + "SyntaxError: `foo` has already been exported. Exported identifiers must be unique. (2:13)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 23 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExportNamedDeclaration", + "start": 0, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "specifiers": [ + { + "type": "ExportSpecifier", + "start": 9, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "local": { + "type": "Identifier", + "start": 9, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 12 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "exported": { + "type": "Identifier", + "start": 9, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 12 + }, + "identifierName": "foo" + }, + "name": "foo" + } + } + ], + "source": null, + "declaration": null + }, + { + "type": "ExportNamedDeclaration", + "start": 16, + "end": 39, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 23 + } + }, + "specifiers": [], + "source": null, + "declaration": { + "type": "VariableDeclaration", + "start": 23, + "end": 39, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 23 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 29, + "end": 38, + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 22 + } + }, + "id": { + "type": "Identifier", + "start": 29, + "end": 32, + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 16 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "init": { + "type": "Identifier", + "start": 35, + "end": 38, + "loc": { + "start": { + "line": 2, + "column": 19 + }, + "end": { + "line": 2, + "column": 22 + }, + "identifierName": "bar" + }, + "name": "bar" + } + } + ], + "kind": "const" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export/options.json b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export/options.json index 9bb46f4778eb..2104ca43283f 100644 --- a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export/options.json +++ b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export/options.json @@ -1,3 +1,3 @@ { - "throws": "`foo` has already been exported. Exported identifiers must be unique. (2:9)" + "sourceType": "module" } diff --git a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export/output.json b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export/output.json new file mode 100644 index 000000000000..b6476d620353 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export/output.json @@ -0,0 +1,176 @@ +{ + "type": "File", + "start": 0, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 22 + } + }, + "errors": [ + "SyntaxError: `foo` has already been exported. Exported identifiers must be unique. (2:9)", + "SyntaxError: Export 'foo' is not defined (1:9)", + "SyntaxError: Export 'bar' is not defined (2:9)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 22 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExportNamedDeclaration", + "start": 0, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "specifiers": [ + { + "type": "ExportSpecifier", + "start": 9, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "local": { + "type": "Identifier", + "start": 9, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 12 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "exported": { + "type": "Identifier", + "start": 9, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 12 + }, + "identifierName": "foo" + }, + "name": "foo" + } + } + ], + "source": null, + "declaration": null + }, + { + "type": "ExportNamedDeclaration", + "start": 16, + "end": 38, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 22 + } + }, + "specifiers": [ + { + "type": "ExportSpecifier", + "start": 25, + "end": 35, + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 19 + } + }, + "local": { + "type": "Identifier", + "start": 25, + "end": 28, + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 12 + }, + "identifierName": "bar" + }, + "name": "bar" + }, + "exported": { + "type": "Identifier", + "start": 32, + "end": 35, + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 19 + }, + "identifierName": "foo" + }, + "name": "foo" + } + } + ], + "source": null, + "declaration": null + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/modules/export-declaration-trailing-comma/input.js b/packages/babel-parser/test/fixtures/es2015/modules/export-declaration-trailing-comma/input.js new file mode 100644 index 000000000000..2524b3f08c75 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/modules/export-declaration-trailing-comma/input.js @@ -0,0 +1,5 @@ +export { + /* One */ Foo + /* Two */, + /* Three */ +} /* Four */ from "foo"; diff --git a/packages/babel-parser/test/fixtures/es2015/modules/export-declaration-trailing-comma/output.json b/packages/babel-parser/test/fixtures/es2015/modules/export-declaration-trailing-comma/output.json new file mode 100644 index 000000000000..a663fd513d11 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/modules/export-declaration-trailing-comma/output.json @@ -0,0 +1,256 @@ +{ + "type": "File", + "start": 0, + "end": 76, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 24 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 76, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 24 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExportNamedDeclaration", + "start": 0, + "end": 76, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 24 + } + }, + "specifiers": [ + { + "type": "ExportSpecifier", + "start": 21, + "end": 24, + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 15 + } + }, + "local": { + "type": "Identifier", + "start": 21, + "end": 24, + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 15 + }, + "identifierName": "Foo" + }, + "name": "Foo" + }, + "exported": { + "type": "Identifier", + "start": 21, + "end": 24, + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 15 + }, + "identifierName": "Foo" + }, + "name": "Foo" + }, + "leadingComments": [ + { + "type": "CommentBlock", + "value": " One ", + "start": 11, + "end": 20, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 11 + } + } + } + ], + "trailingComments": [ + { + "type": "CommentBlock", + "value": " Two ", + "start": 27, + "end": 36, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 11 + } + } + }, + { + "type": "CommentBlock", + "value": " Three ", + "start": 40, + "end": 51, + "loc": { + "start": { + "line": 4, + "column": 2 + }, + "end": { + "line": 4, + "column": 13 + } + } + }, + { + "type": "CommentBlock", + "value": " Four ", + "start": 54, + "end": 64, + "loc": { + "start": { + "line": 5, + "column": 2 + }, + "end": { + "line": 5, + "column": 12 + } + } + } + ] + } + ], + "source": { + "type": "StringLiteral", + "start": 70, + "end": 75, + "loc": { + "start": { + "line": 5, + "column": 18 + }, + "end": { + "line": 5, + "column": 23 + } + }, + "extra": { + "rawValue": "foo", + "raw": "\"foo\"" + }, + "value": "foo" + }, + "declaration": null + } + ], + "directives": [] + }, + "comments": [ + { + "type": "CommentBlock", + "value": " One ", + "start": 11, + "end": 20, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 11 + } + } + }, + { + "type": "CommentBlock", + "value": " Two ", + "start": 27, + "end": 36, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 11 + } + } + }, + { + "type": "CommentBlock", + "value": " Three ", + "start": 40, + "end": 51, + "loc": { + "start": { + "line": 4, + "column": 2 + }, + "end": { + "line": 4, + "column": 13 + } + } + }, + { + "type": "CommentBlock", + "value": " Four ", + "start": 54, + "end": 64, + "loc": { + "start": { + "line": 5, + "column": 2 + }, + "end": { + "line": 5, + "column": 12 + } + } + } + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/modules/import-declaration-trailing-comma/input.js b/packages/babel-parser/test/fixtures/es2015/modules/import-declaration-trailing-comma/input.js new file mode 100644 index 000000000000..1b933ff9af5c --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/modules/import-declaration-trailing-comma/input.js @@ -0,0 +1,5 @@ +import { + /* One */ Foo + /* Two */, + /* Three */ +} /* Four */ from "foo"; diff --git a/packages/babel-parser/test/fixtures/es2015/modules/import-declaration-trailing-comma/output.json b/packages/babel-parser/test/fixtures/es2015/modules/import-declaration-trailing-comma/output.json new file mode 100644 index 000000000000..a5ebc224c99b --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/modules/import-declaration-trailing-comma/output.json @@ -0,0 +1,255 @@ +{ + "type": "File", + "start": 0, + "end": 76, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 24 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 76, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 24 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ImportDeclaration", + "start": 0, + "end": 76, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 24 + } + }, + "specifiers": [ + { + "type": "ImportSpecifier", + "start": 21, + "end": 24, + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 15 + } + }, + "imported": { + "type": "Identifier", + "start": 21, + "end": 24, + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 15 + }, + "identifierName": "Foo" + }, + "name": "Foo" + }, + "local": { + "type": "Identifier", + "start": 21, + "end": 24, + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 15 + }, + "identifierName": "Foo" + }, + "name": "Foo" + }, + "leadingComments": [ + { + "type": "CommentBlock", + "value": " One ", + "start": 11, + "end": 20, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 11 + } + } + } + ], + "trailingComments": [ + { + "type": "CommentBlock", + "value": " Two ", + "start": 27, + "end": 36, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 11 + } + } + }, + { + "type": "CommentBlock", + "value": " Three ", + "start": 40, + "end": 51, + "loc": { + "start": { + "line": 4, + "column": 2 + }, + "end": { + "line": 4, + "column": 13 + } + } + }, + { + "type": "CommentBlock", + "value": " Four ", + "start": 54, + "end": 64, + "loc": { + "start": { + "line": 5, + "column": 2 + }, + "end": { + "line": 5, + "column": 12 + } + } + } + ] + } + ], + "source": { + "type": "StringLiteral", + "start": 70, + "end": 75, + "loc": { + "start": { + "line": 5, + "column": 18 + }, + "end": { + "line": 5, + "column": 23 + } + }, + "extra": { + "rawValue": "foo", + "raw": "\"foo\"" + }, + "value": "foo" + } + } + ], + "directives": [] + }, + "comments": [ + { + "type": "CommentBlock", + "value": " One ", + "start": 11, + "end": 20, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 11 + } + } + }, + { + "type": "CommentBlock", + "value": " Two ", + "start": 27, + "end": 36, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 11 + } + } + }, + { + "type": "CommentBlock", + "value": " Three ", + "start": 40, + "end": 51, + "loc": { + "start": { + "line": 4, + "column": 2 + }, + "end": { + "line": 4, + "column": 13 + } + } + }, + { + "type": "CommentBlock", + "value": " Four ", + "start": 54, + "end": 64, + "loc": { + "start": { + "line": 5, + "column": 2 + }, + "end": { + "line": 5, + "column": 12 + } + } + } + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/modules/import-invalid-keyword-flow/options.json b/packages/babel-parser/test/fixtures/es2015/modules/import-invalid-keyword-flow/options.json index 379fb1f86234..8e6ec258aec2 100644 --- a/packages/babel-parser/test/fixtures/es2015/modules/import-invalid-keyword-flow/options.json +++ b/packages/babel-parser/test/fixtures/es2015/modules/import-invalid-keyword-flow/options.json @@ -1,4 +1,4 @@ { - "plugins": ["flow"], - "throws": "Unexpected keyword 'default' (1:9)" + "sourceType": "module", + "plugins": ["flow"] } diff --git a/packages/babel-parser/test/fixtures/es2015/modules/import-invalid-keyword-flow/output.json b/packages/babel-parser/test/fixtures/es2015/modules/import-invalid-keyword-flow/output.json new file mode 100644 index 000000000000..d1f169eb7647 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/modules/import-invalid-keyword-flow/output.json @@ -0,0 +1,126 @@ +{ + "type": "File", + "start": 0, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "errors": [ + "SyntaxError: Unexpected keyword 'default' (1:9)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ImportDeclaration", + "start": 0, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "specifiers": [ + { + "type": "ImportSpecifier", + "start": 9, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "imported": { + "type": "Identifier", + "start": 9, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 16 + }, + "identifierName": "default" + }, + "name": "default" + }, + "importKind": null, + "local": { + "type": "Identifier", + "start": 9, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 16 + }, + "identifierName": "default" + }, + "name": "default" + } + } + ], + "importKind": "value", + "source": { + "type": "StringLiteral", + "start": 24, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "extra": { + "rawValue": "foo", + "raw": "\"foo\"" + }, + "value": "foo" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/modules/import-invalid-keyword-typeof-flow/options.json b/packages/babel-parser/test/fixtures/es2015/modules/import-invalid-keyword-typeof-flow/options.json index cda01e8412c3..8e6ec258aec2 100644 --- a/packages/babel-parser/test/fixtures/es2015/modules/import-invalid-keyword-typeof-flow/options.json +++ b/packages/babel-parser/test/fixtures/es2015/modules/import-invalid-keyword-typeof-flow/options.json @@ -1,4 +1,4 @@ { - "plugins": ["flow"], - "throws": "Unexpected keyword 'typeof' (1:9)" + "sourceType": "module", + "plugins": ["flow"] } diff --git a/packages/babel-parser/test/fixtures/es2015/modules/import-invalid-keyword-typeof-flow/output.json b/packages/babel-parser/test/fixtures/es2015/modules/import-invalid-keyword-typeof-flow/output.json new file mode 100644 index 000000000000..62e2b403628d --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/modules/import-invalid-keyword-typeof-flow/output.json @@ -0,0 +1,126 @@ +{ + "type": "File", + "start": 0, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "errors": [ + "SyntaxError: Unexpected keyword 'typeof' (1:9)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ImportDeclaration", + "start": 0, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "specifiers": [ + { + "type": "ImportSpecifier", + "start": 9, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "imported": { + "type": "Identifier", + "start": 9, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 15 + }, + "identifierName": "typeof" + }, + "name": "typeof" + }, + "importKind": null, + "local": { + "type": "Identifier", + "start": 9, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 15 + }, + "identifierName": "typeof" + }, + "name": "typeof" + } + } + ], + "importKind": "value", + "source": { + "type": "StringLiteral", + "start": 23, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "extra": { + "rawValue": "foo", + "raw": "\"foo\"" + }, + "value": "foo" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/modules/import-invalid-keyword-typeof/options.json b/packages/babel-parser/test/fixtures/es2015/modules/import-invalid-keyword-typeof/options.json index a45cdb986dd1..2104ca43283f 100644 --- a/packages/babel-parser/test/fixtures/es2015/modules/import-invalid-keyword-typeof/options.json +++ b/packages/babel-parser/test/fixtures/es2015/modules/import-invalid-keyword-typeof/options.json @@ -1,3 +1,3 @@ { - "throws": "Unexpected keyword 'typeof' (1:9)" + "sourceType": "module" } diff --git a/packages/babel-parser/test/fixtures/es2015/modules/import-invalid-keyword-typeof/output.json b/packages/babel-parser/test/fixtures/es2015/modules/import-invalid-keyword-typeof/output.json new file mode 100644 index 000000000000..cd60a3c49fe9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/modules/import-invalid-keyword-typeof/output.json @@ -0,0 +1,124 @@ +{ + "type": "File", + "start": 0, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "errors": [ + "SyntaxError: Unexpected keyword 'typeof' (1:9)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ImportDeclaration", + "start": 0, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "specifiers": [ + { + "type": "ImportSpecifier", + "start": 9, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "imported": { + "type": "Identifier", + "start": 9, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 15 + }, + "identifierName": "typeof" + }, + "name": "typeof" + }, + "local": { + "type": "Identifier", + "start": 9, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 15 + }, + "identifierName": "typeof" + }, + "name": "typeof" + } + } + ], + "source": { + "type": "StringLiteral", + "start": 23, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "extra": { + "rawValue": "foo", + "raw": "\"foo\"" + }, + "value": "foo" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/modules/import-invalid-keyword/options.json b/packages/babel-parser/test/fixtures/es2015/modules/import-invalid-keyword/options.json index 2c6a46df3f6e..2104ca43283f 100644 --- a/packages/babel-parser/test/fixtures/es2015/modules/import-invalid-keyword/options.json +++ b/packages/babel-parser/test/fixtures/es2015/modules/import-invalid-keyword/options.json @@ -1,3 +1,3 @@ { - "throws": "Unexpected keyword 'debugger' (1:9)" + "sourceType": "module" } diff --git a/packages/babel-parser/test/fixtures/es2015/modules/import-invalid-keyword/output.json b/packages/babel-parser/test/fixtures/es2015/modules/import-invalid-keyword/output.json new file mode 100644 index 000000000000..40242124c0c4 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/modules/import-invalid-keyword/output.json @@ -0,0 +1,124 @@ +{ + "type": "File", + "start": 0, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "errors": [ + "SyntaxError: Unexpected keyword 'debugger' (1:9)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ImportDeclaration", + "start": 0, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "specifiers": [ + { + "type": "ImportSpecifier", + "start": 9, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "imported": { + "type": "Identifier", + "start": 9, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 17 + }, + "identifierName": "debugger" + }, + "name": "debugger" + }, + "local": { + "type": "Identifier", + "start": 9, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 17 + }, + "identifierName": "debugger" + }, + "name": "debugger" + } + } + ], + "source": { + "type": "StringLiteral", + "start": 25, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "extra": { + "rawValue": "foo", + "raw": "\"foo\"" + }, + "value": "foo" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/modules/invalid-escape-export-as/options.json b/packages/babel-parser/test/fixtures/es2015/modules/invalid-escape-export-as/options.json index 16c061d4dfd4..3e1bec330f62 100644 --- a/packages/babel-parser/test/fixtures/es2015/modules/invalid-escape-export-as/options.json +++ b/packages/babel-parser/test/fixtures/es2015/modules/invalid-escape-export-as/options.json @@ -1,4 +1,4 @@ { "sourceType": "module", "throws": "Unexpected token, expected \",\" (1:11)" -} \ No newline at end of file +} diff --git a/packages/babel-parser/test/fixtures/es2015/modules/invalid-escape-import-from/options.json b/packages/babel-parser/test/fixtures/es2015/modules/invalid-escape-import-from/options.json index 6dab969b1115..5fe96f9ef281 100644 --- a/packages/babel-parser/test/fixtures/es2015/modules/invalid-escape-import-from/options.json +++ b/packages/babel-parser/test/fixtures/es2015/modules/invalid-escape-import-from/options.json @@ -1,4 +1,4 @@ { "sourceType": "module", "throws": "Unexpected token (1:9)" -} \ No newline at end of file +} diff --git a/packages/babel-parser/test/fixtures/es2015/object/async-method-linebreak/options.json b/packages/babel-parser/test/fixtures/es2015/object/async-method-linebreak/options.json index 978486d6a57c..cef3a955d6c4 100644 --- a/packages/babel-parser/test/fixtures/es2015/object/async-method-linebreak/options.json +++ b/packages/babel-parser/test/fixtures/es2015/object/async-method-linebreak/options.json @@ -1,3 +1,3 @@ { "throws": "Unexpected token, expected \",\" (3:4)" -} \ No newline at end of file +} diff --git a/packages/babel-parser/test/fixtures/es2015/object/disallow-duplicate-method-params/options.json b/packages/babel-parser/test/fixtures/es2015/object/disallow-duplicate-method-params/options.json deleted file mode 100644 index c7a2c3ba50a0..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/object/disallow-duplicate-method-params/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Argument name clash (2:11)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/object/disallow-duplicate-method-params/output.json b/packages/babel-parser/test/fixtures/es2015/object/disallow-duplicate-method-params/output.json new file mode 100644 index 000000000000..b9fa1b56ec84 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/object/disallow-duplicate-method-params/output.json @@ -0,0 +1,165 @@ +{ + "type": "File", + "start": 0, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 2 + } + }, + "errors": [ + "SyntaxError: Argument name clash (2:11)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 2 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 2 + } + }, + "expression": { + "type": "ObjectExpression", + "start": 1, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "properties": [ + { + "type": "ObjectMethod", + "start": 7, + "end": 19, + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 16 + } + }, + "method": true, + "key": { + "type": "Identifier", + "start": 7, + "end": 10, + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 7 + }, + "identifierName": "bar" + }, + "name": "bar" + }, + "computed": false, + "kind": "method", + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 11, + "end": 12, + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 9 + }, + "identifierName": "a" + }, + "name": "a" + }, + { + "type": "Identifier", + "start": 14, + "end": 15, + "loc": { + "start": { + "line": 2, + "column": 11 + }, + "end": { + "line": 2, + "column": 12 + }, + "identifierName": "a" + }, + "name": "a" + } + ], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 19, + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 16 + } + }, + "body": [], + "directives": [] + } + } + ], + "extra": { + "parenthesized": true, + "parenStart": 0 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/regex/duplicate-flags/options.json b/packages/babel-parser/test/fixtures/es2015/regex/duplicate-flags/options.json deleted file mode 100644 index 86670c5168d0..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/regex/duplicate-flags/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Duplicate regular expression flag (1:6)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/regex/duplicate-flags/output.json b/packages/babel-parser/test/fixtures/es2015/regex/duplicate-flags/output.json new file mode 100644 index 000000000000..86ec306e13d1 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/regex/duplicate-flags/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "errors": [ + "SyntaxError: Duplicate regular expression flag (1:6)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "expression": { + "type": "RegExpLiteral", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "extra": { + "raw": "/./gii" + }, + "pattern": ".", + "flags": "gii" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/shorthand/1/options.json b/packages/babel-parser/test/fixtures/es2015/shorthand/1/options.json deleted file mode 100644 index eaa26955dc77..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/shorthand/1/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected keyword 'const' (1:11)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/shorthand/1/output.json b/packages/babel-parser/test/fixtures/es2015/shorthand/1/output.json new file mode 100644 index 000000000000..712caaafe1a1 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/shorthand/1/output.json @@ -0,0 +1,164 @@ +{ + "type": "File", + "start": 0, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "errors": [ + "SyntaxError: Unexpected keyword 'const' (1:11)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 0, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 4, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "id": { + "type": "Identifier", + "start": 4, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + }, + "identifierName": "x" + }, + "name": "x" + }, + "init": { + "type": "ObjectExpression", + "start": 9, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 11, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 11, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 16 + }, + "identifierName": "const" + }, + "name": "const" + }, + "computed": false, + "shorthand": true, + "value": { + "type": "Identifier", + "start": 11, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 16 + }, + "identifierName": "const" + }, + "name": "const" + }, + "extra": { + "shorthand": true + } + } + ], + "extra": { + "parenthesized": true, + "parenStart": 8 + } + } + } + ], + "kind": "var" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/shorthand/2/options.json b/packages/babel-parser/test/fixtures/es2015/shorthand/2/options.json deleted file mode 100644 index be39a4451388..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/shorthand/2/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected keyword 'this' (1:8)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/shorthand/2/output.json b/packages/babel-parser/test/fixtures/es2015/shorthand/2/output.json new file mode 100644 index 000000000000..c91daf2f66d8 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/shorthand/2/output.json @@ -0,0 +1,240 @@ +{ + "type": "File", + "start": 0, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "errors": [ + "SyntaxError: Unexpected keyword 'this' (1:8)", + "SyntaxError: Unexpected keyword 'if' (1:14)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "expression": { + "type": "ObjectExpression", + "start": 1, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 3, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 3, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 6 + }, + "identifierName": "get" + }, + "name": "get" + }, + "computed": false, + "shorthand": true, + "value": { + "type": "Identifier", + "start": 3, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 6 + }, + "identifierName": "get" + }, + "name": "get" + }, + "extra": { + "shorthand": true + } + }, + { + "type": "ObjectProperty", + "start": 8, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 8, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 12 + }, + "identifierName": "this" + }, + "name": "this" + }, + "computed": false, + "shorthand": true, + "value": { + "type": "Identifier", + "start": 8, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 12 + }, + "identifierName": "this" + }, + "name": "this" + }, + "extra": { + "shorthand": true + } + }, + { + "type": "ObjectProperty", + "start": 14, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 14, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 16 + }, + "identifierName": "if" + }, + "name": "if" + }, + "computed": false, + "shorthand": true, + "value": { + "type": "Identifier", + "start": 14, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 16 + }, + "identifierName": "if" + }, + "name": "if" + }, + "extra": { + "shorthand": true + } + } + ], + "extra": { + "parenthesized": true, + "parenStart": 0 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/statements/label-invalid-const/options.json b/packages/babel-parser/test/fixtures/es2015/statements/label-invalid-const/options.json deleted file mode 100644 index a064a678e553..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/statements/label-invalid-const/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Lexical declaration cannot appear in a single-statement context (1:5)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/statements/label-invalid-const/output.json b/packages/babel-parser/test/fixtures/es2015/statements/label-invalid-const/output.json new file mode 100644 index 000000000000..b0dd4fe9c6d0 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/statements/label-invalid-const/output.json @@ -0,0 +1,135 @@ +{ + "type": "File", + "start": 0, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "errors": [ + "SyntaxError: Lexical declaration cannot appear in a single-statement context (1:5)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "LabeledStatement", + "start": 0, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "body": { + "type": "VariableDeclaration", + "start": 5, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 11, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "id": { + "type": "Identifier", + "start": 11, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "bar" + }, + "name": "bar" + }, + "init": { + "type": "NullLiteral", + "start": 17, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 21 + } + } + } + } + ], + "kind": "const" + }, + "label": { + "type": "Identifier", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + }, + "identifierName": "foo" + }, + "name": "foo" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/statements/label-invalid-func-async/options.json b/packages/babel-parser/test/fixtures/es2015/statements/label-invalid-func-async/options.json deleted file mode 100644 index 95aaacb458f8..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/statements/label-invalid-func-async/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Async functions can only be declared at the top level or inside a block (1:5)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/statements/label-invalid-func-async/output.json b/packages/babel-parser/test/fixtures/es2015/statements/label-invalid-func-async/output.json new file mode 100644 index 000000000000..31af7aa06caf --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/statements/label-invalid-func-async/output.json @@ -0,0 +1,122 @@ +{ + "type": "File", + "start": 0, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "errors": [ + "SyntaxError: Async functions can only be declared at the top level or inside a block (1:5)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "LabeledStatement", + "start": 0, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "body": { + "type": "FunctionDeclaration", + "start": 5, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "id": { + "type": "Identifier", + "start": 20, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 23 + }, + "identifierName": "bar" + }, + "name": "bar" + }, + "generator": false, + "async": true, + "params": [], + "body": { + "type": "BlockStatement", + "start": 26, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "body": [], + "directives": [] + } + }, + "label": { + "type": "Identifier", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + }, + "identifierName": "foo" + }, + "name": "foo" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/statements/label-invalid-func-generator/options.json b/packages/babel-parser/test/fixtures/es2015/statements/label-invalid-func-generator/options.json deleted file mode 100644 index 3f6e90c7cd27..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/statements/label-invalid-func-generator/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Generators can only be declared at the top level or inside a block (1:13)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/statements/label-invalid-func-generator/output.json b/packages/babel-parser/test/fixtures/es2015/statements/label-invalid-func-generator/output.json new file mode 100644 index 000000000000..5dd39402a92b --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/statements/label-invalid-func-generator/output.json @@ -0,0 +1,122 @@ +{ + "type": "File", + "start": 0, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "errors": [ + "SyntaxError: Generators can only be declared at the top level or inside a block (1:13)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "LabeledStatement", + "start": 0, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "body": { + "type": "FunctionDeclaration", + "start": 5, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "id": { + "type": "Identifier", + "start": 15, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 18 + }, + "identifierName": "bar" + }, + "name": "bar" + }, + "generator": true, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 21, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "body": [], + "directives": [] + } + }, + "label": { + "type": "Identifier", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + }, + "identifierName": "foo" + }, + "name": "foo" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/statements/label-invalid-func-strict/options.json b/packages/babel-parser/test/fixtures/es2015/statements/label-invalid-func-strict/options.json deleted file mode 100644 index 1eebe15c408e..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/statements/label-invalid-func-strict/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "In strict mode code, functions can only be declared at top level or inside a block (1:35)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/statements/label-invalid-func-strict/output.json b/packages/babel-parser/test/fixtures/es2015/statements/label-invalid-func-strict/output.json new file mode 100644 index 000000000000..782989ece4c8 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/statements/label-invalid-func-strict/output.json @@ -0,0 +1,211 @@ +{ + "type": "File", + "start": 0, + "end": 53, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 53 + } + }, + "errors": [ + "SyntaxError: In strict mode code, functions can only be declared at top level or inside a block (1:35)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 53, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 53 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 53, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 53 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 12 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 15, + "end": 53, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 53 + } + }, + "body": [ + { + "type": "LabeledStatement", + "start": 30, + "end": 52, + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 52 + } + }, + "body": { + "type": "FunctionDeclaration", + "start": 35, + "end": 52, + "loc": { + "start": { + "line": 1, + "column": 35 + }, + "end": { + "line": 1, + "column": 52 + } + }, + "id": { + "type": "Identifier", + "start": 44, + "end": 47, + "loc": { + "start": { + "line": 1, + "column": 44 + }, + "end": { + "line": 1, + "column": 47 + }, + "identifierName": "baz" + }, + "name": "baz" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 50, + "end": 52, + "loc": { + "start": { + "line": 1, + "column": 50 + }, + "end": { + "line": 1, + "column": 52 + } + }, + "body": [], + "directives": [] + } + }, + "label": { + "type": "Identifier", + "start": 30, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 33 + }, + "identifierName": "bar" + }, + "name": "bar" + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 16, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 16, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/109/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/109/options.json deleted file mode 100644 index c145a86bc613..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/109/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "for-of loop variable declaration may not have an initializer (1:5)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/109/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/109/output.json new file mode 100644 index 000000000000..1bc303096308 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/109/output.json @@ -0,0 +1,207 @@ +{ + "type": "File", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "errors": [ + "SyntaxError: for-of loop variable declaration may not have an initializer (1:5)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ForOfStatement", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "await": false, + "left": { + "type": "VariableDeclaration", + "start": 5, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 9, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + }, + "identifierName": "x" + }, + "name": "x" + }, + "init": { + "type": "NumericLiteral", + "start": 13, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "extra": { + "rawValue": 42, + "raw": "42" + }, + "value": 42 + } + } + ], + "kind": "var" + }, + "right": { + "type": "Identifier", + "start": 19, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 23 + }, + "identifierName": "list" + }, + "name": "list" + }, + "body": { + "type": "ExpressionStatement", + "start": 25, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "expression": { + "type": "CallExpression", + "start": 25, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "callee": { + "type": "Identifier", + "start": 25, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 32 + }, + "identifierName": "process" + }, + "name": "process" + }, + "arguments": [ + { + "type": "Identifier", + "start": 33, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 34 + }, + "identifierName": "x" + }, + "name": "x" + } + ] + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/123/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/123/options.json deleted file mode 100644 index fdf74cefe1b2..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/123/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "super() is only valid inside a class constructor of a subclass. Maybe a typo in the method name ('constructor') or not extending another class? (1:40)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/123/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/123/output.json new file mode 100644 index 000000000000..fcaa1ad31779 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/123/output.json @@ -0,0 +1,246 @@ +{ + "type": "File", + "start": 0, + "end": 51, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 51 + } + }, + "errors": [ + "SyntaxError: super() is only valid inside a class constructor of a subclass. Maybe a typo in the method name ('constructor') or not extending another class? (1:40)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 51, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 51 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 14, + "end": 51, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 51 + } + }, + "expression": { + "type": "ClassExpression", + "start": 15, + "end": 50, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 50 + } + }, + "id": { + "type": "Identifier", + "start": 21, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + }, + "identifierName": "A" + }, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 23, + "end": 50, + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 50 + } + }, + "body": [ + { + "type": "ClassMethod", + "start": 24, + "end": 49, + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 49 + } + }, + "static": false, + "key": { + "type": "Identifier", + "start": 24, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 35 + }, + "identifierName": "constructor" + }, + "name": "constructor" + }, + "computed": false, + "kind": "constructor", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 38, + "end": 49, + "loc": { + "start": { + "line": 1, + "column": 38 + }, + "end": { + "line": 1, + "column": 49 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 40, + "end": 47, + "loc": { + "start": { + "line": 1, + "column": 40 + }, + "end": { + "line": 1, + "column": 47 + } + }, + "expression": { + "type": "CallExpression", + "start": 40, + "end": 47, + "loc": { + "start": { + "line": 1, + "column": 40 + }, + "end": { + "line": 1, + "column": 47 + } + }, + "callee": { + "type": "Super", + "start": 40, + "end": 45, + "loc": { + "start": { + "line": 1, + "column": 40 + }, + "end": { + "line": 1, + "column": 45 + } + } + }, + "arguments": [] + } + } + ], + "directives": [] + } + } + ] + }, + "extra": { + "parenthesized": true, + "parenStart": 14 + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/125/input.js b/packages/babel-parser/test/fixtures/es2015/uncategorised/125/input.js index a7bd428bbfce..83b8fa3b72d4 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/125/input.js +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/125/input.js @@ -1 +1 @@ -class A { constructor() {} 'constructor'() } \ No newline at end of file +class A { constructor() {} 'constructor'() {} } \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/125/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/125/options.json deleted file mode 100644 index 09e50a3d71c3..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/125/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Duplicate constructor in the same class (1:27)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/125/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/125/output.json new file mode 100644 index 000000000000..d4cca9c08ac4 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/125/output.json @@ -0,0 +1,203 @@ +{ + "type": "File", + "start": 0, + "end": 47, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 47 + } + }, + "errors": [ + "SyntaxError: Duplicate constructor in the same class (1:27)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 47, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 47 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 47, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 47 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "A" + }, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 8, + "end": 47, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 47 + } + }, + "body": [ + { + "type": "ClassMethod", + "start": 10, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "static": false, + "key": { + "type": "Identifier", + "start": 10, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 21 + }, + "identifierName": "constructor" + }, + "name": "constructor" + }, + "computed": false, + "kind": "constructor", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 24, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "body": [], + "directives": [] + } + }, + { + "type": "ClassMethod", + "start": 27, + "end": 45, + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 45 + } + }, + "static": false, + "key": { + "type": "StringLiteral", + "start": 27, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 40 + } + }, + "extra": { + "rawValue": "constructor", + "raw": "'constructor'" + }, + "value": "constructor" + }, + "computed": false, + "kind": "constructor", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 43, + "end": 45, + "loc": { + "start": { + "line": 1, + "column": 43 + }, + "end": { + "line": 1, + "column": 45 + } + }, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/126/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/126/options.json deleted file mode 100644 index 38e87b07044c..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/126/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Constructor can't have get/set modifier (1:14)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/126/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/126/output.json new file mode 100644 index 000000000000..b1c776635e95 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/126/output.json @@ -0,0 +1,144 @@ +{ + "type": "File", + "start": 0, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "errors": [ + "SyntaxError: Constructor can't have get/set modifier (1:14)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "A" + }, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 8, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "body": [ + { + "type": "ClassMethod", + "start": 10, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "static": false, + "key": { + "type": "Identifier", + "start": 14, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 25 + }, + "identifierName": "constructor" + }, + "name": "constructor" + }, + "computed": false, + "kind": "get", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 28, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/127/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/127/options.json deleted file mode 100644 index becf560010f4..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/127/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Constructor can't be a generator (1:11)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/127/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/127/output.json new file mode 100644 index 000000000000..8eb2f5bd2f58 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/127/output.json @@ -0,0 +1,144 @@ +{ + "type": "File", + "start": 0, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "errors": [ + "SyntaxError: Constructor can't be a generator (1:11)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "A" + }, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 8, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "body": [ + { + "type": "ClassMethod", + "start": 10, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "static": false, + "kind": "method", + "key": { + "type": "Identifier", + "start": 11, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 22 + }, + "identifierName": "constructor" + }, + "name": "constructor" + }, + "computed": false, + "id": null, + "generator": true, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 25, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/166/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/166/options.json deleted file mode 100644 index 3481bedf3cc1..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/166/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Argument name clash (1:16)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/166/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/166/output.json new file mode 100644 index 000000000000..62466668edcb --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/166/output.json @@ -0,0 +1,180 @@ +{ + "type": "File", + "start": 0, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "errors": [ + "SyntaxError: Argument name clash (1:16)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + }, + "identifierName": "x" + }, + "name": "x" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 11, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + }, + "identifierName": "a" + }, + "name": "a" + }, + { + "type": "ObjectPattern", + "start": 14, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 16, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 16, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + }, + "identifierName": "a" + }, + "name": "a" + }, + "computed": false, + "shorthand": true, + "value": { + "type": "Identifier", + "start": 16, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + }, + "identifierName": "a" + }, + "name": "a" + }, + "extra": { + "shorthand": true + } + } + ] + } + ], + "body": { + "type": "BlockStatement", + "start": 20, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "body": [], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/198/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/198/options.json deleted file mode 100644 index 3f09c36a5f1c..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/198/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Expected number in radix 8 (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/198/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/198/output.json new file mode 100644 index 000000000000..12a024fb2c03 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/198/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start": 0, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "errors": [ + "SyntaxError: Expected number in radix 8 (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 0, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "extra": { + "rawValue": null, + "raw": "0o" + }, + "value": null + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/200/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/200/options.json deleted file mode 100644 index 3f09c36a5f1c..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/200/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Expected number in radix 8 (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/200/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/200/output.json new file mode 100644 index 000000000000..4b91f320f950 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/200/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "errors": [ + "SyntaxError: Expected number in radix 8 (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "extra": { + "rawValue": 0, + "raw": "0o9" + }, + "value": 0 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/201/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/201/options.json deleted file mode 100644 index d52d9cfac4bc..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/201/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected token, expected \";\" (1:3)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/201/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/201/output.json new file mode 100644 index 000000000000..9978c5342ef3 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/201/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "errors": [ + "SyntaxError: Expected number in radix 8 (1:3)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "extra": { + "rawValue": 8, + "raw": "0o18" + }, + "value": 8 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/202/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/202/options.json deleted file mode 100644 index 3f09c36a5f1c..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/202/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Expected number in radix 8 (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/202/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/202/output.json new file mode 100644 index 000000000000..5d2ed2d91388 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/202/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start": 0, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "errors": [ + "SyntaxError: Expected number in radix 8 (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 0, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "extra": { + "rawValue": null, + "raw": "0O" + }, + "value": null + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/204/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/204/options.json deleted file mode 100644 index 3f09c36a5f1c..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/204/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Expected number in radix 8 (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/204/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/204/output.json new file mode 100644 index 000000000000..af4105738ef8 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/204/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "errors": [ + "SyntaxError: Expected number in radix 8 (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "extra": { + "rawValue": 0, + "raw": "0O9" + }, + "value": 0 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/205/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/205/options.json deleted file mode 100644 index d52d9cfac4bc..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/205/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected token, expected \";\" (1:3)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/205/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/205/output.json new file mode 100644 index 000000000000..617cc13b6615 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/205/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "errors": [ + "SyntaxError: Expected number in radix 8 (1:3)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "extra": { + "rawValue": 8, + "raw": "0O18" + }, + "value": 8 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/206/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/206/options.json deleted file mode 100644 index 40dc3da9a8f4..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/206/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Expected number in radix 2 (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/206/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/206/output.json new file mode 100644 index 000000000000..0688a297c669 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/206/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start": 0, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "errors": [ + "SyntaxError: Expected number in radix 2 (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 0, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "extra": { + "rawValue": null, + "raw": "0b" + }, + "value": null + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/208/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/208/options.json deleted file mode 100644 index 40dc3da9a8f4..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/208/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Expected number in radix 2 (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/208/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/208/output.json new file mode 100644 index 000000000000..7281fb745a17 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/208/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "errors": [ + "SyntaxError: Expected number in radix 2 (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "extra": { + "rawValue": 0, + "raw": "0b9" + }, + "value": 0 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/209/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/209/options.json deleted file mode 100644 index d52d9cfac4bc..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/209/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected token, expected \";\" (1:3)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/209/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/209/output.json new file mode 100644 index 000000000000..25d711669b8b --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/209/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "errors": [ + "SyntaxError: Expected number in radix 2 (1:3)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "extra": { + "rawValue": 2, + "raw": "0b18" + }, + "value": 2 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/210/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/210/options.json deleted file mode 100644 index d52d9cfac4bc..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/210/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected token, expected \";\" (1:3)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/210/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/210/output.json new file mode 100644 index 000000000000..379e9db894c0 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/210/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "errors": [ + "SyntaxError: Expected number in radix 2 (1:3)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "extra": { + "rawValue": 2, + "raw": "0b12" + }, + "value": 2 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/211/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/211/options.json deleted file mode 100644 index 40dc3da9a8f4..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/211/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Expected number in radix 2 (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/211/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/211/output.json new file mode 100644 index 000000000000..c87719ade97e --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/211/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start": 0, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "errors": [ + "SyntaxError: Expected number in radix 2 (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 0, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "extra": { + "rawValue": null, + "raw": "0B" + }, + "value": null + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/213/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/213/options.json deleted file mode 100644 index 40dc3da9a8f4..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/213/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Expected number in radix 2 (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/213/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/213/output.json new file mode 100644 index 000000000000..e82ab6ace61a --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/213/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "errors": [ + "SyntaxError: Expected number in radix 2 (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "extra": { + "rawValue": 0, + "raw": "0B9" + }, + "value": 0 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/214/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/214/options.json deleted file mode 100644 index d52d9cfac4bc..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/214/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected token, expected \";\" (1:3)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/214/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/214/output.json new file mode 100644 index 000000000000..3726afdc10d4 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/214/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "errors": [ + "SyntaxError: Expected number in radix 2 (1:3)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "extra": { + "rawValue": 2, + "raw": "0B18" + }, + "value": 2 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/215/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/215/options.json deleted file mode 100644 index d52d9cfac4bc..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/215/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected token, expected \";\" (1:3)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/215/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/215/output.json new file mode 100644 index 000000000000..402fcffc9e54 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/215/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "errors": [ + "SyntaxError: Expected number in radix 2 (1:3)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "extra": { + "rawValue": 2, + "raw": "0B12" + }, + "value": 2 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/216/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/216/options.json index 77b813987217..0cefc1094055 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/216/options.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/216/options.json @@ -1,3 +1,3 @@ { - "throws": "Code point out of bounds (1:4)" + "throws": "Invalid code point 1114112" } diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/217/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/217/options.json deleted file mode 100644 index efaa7d304ccc..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/217/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Bad character escape sequence (1:4)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/217/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/217/output.json new file mode 100644 index 000000000000..6052cbe571f5 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/217/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "errors": [ + "SyntaxError: Bad character escape sequence (1:4)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [], + "directives": [ + { + "type": "Directive", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "value": "\\u{}", + "extra": { + "raw": "\"\\u{}\"", + "rawValue": "\\u{}" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/218/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/218/options.json deleted file mode 100644 index efaa7d304ccc..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/218/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Bad character escape sequence (1:4)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/218/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/218/output.json new file mode 100644 index 000000000000..781e807d0c94 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/218/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "errors": [ + "SyntaxError: Bad character escape sequence (1:4)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [], + "directives": [ + { + "type": "Directive", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "value": "\\u{FFFF", + "extra": { + "raw": "\"\\u{FFFF\"", + "rawValue": "\\u{FFFF" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/219/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/219/options.json deleted file mode 100644 index efaa7d304ccc..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/219/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Bad character escape sequence (1:4)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/219/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/219/output.json new file mode 100644 index 000000000000..fcf4254c7a65 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/219/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "errors": [ + "SyntaxError: Bad character escape sequence (1:4)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [], + "directives": [ + { + "type": "Directive", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "value": "\\u{FFZ}", + "extra": { + "raw": "\"\\u{FFZ}\"", + "rawValue": "\\u{FFZ}" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/220/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/220/options.json deleted file mode 100644 index 6010e96ed144..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/220/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid left-hand side in assignment expression (1:0)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/220/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/220/output.json new file mode 100644 index 000000000000..51d63380296a --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/220/output.json @@ -0,0 +1,120 @@ +{ + "type": "File", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "errors": [ + "SyntaxError: Invalid left-hand side in assignment expression (1:0)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "operator": "+=", + "left": { + "type": "ArrayExpression", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "elements": [ + { + "type": "Identifier", + "start": 1, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + }, + "identifierName": "v" + }, + "name": "v" + } + ] + }, + "right": { + "type": "Identifier", + "start": 7, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 10 + }, + "identifierName": "ary" + }, + "name": "ary" + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/221/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/221/options.json deleted file mode 100644 index 7c5f08eb9ba6..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/221/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid left-hand side in assignment expression (1:1)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/221/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/221/output.json new file mode 100644 index 000000000000..58fa4ffd7fb9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/221/output.json @@ -0,0 +1,126 @@ +{ + "type": "File", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "errors": [ + "SyntaxError: Invalid left-hand side in array destructuring pattern (1:1)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "operator": "=", + "left": { + "type": "ArrayPattern", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "elements": [ + { + "type": "NumericLiteral", + "start": 1, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "extra": { + "rawValue": 2, + "raw": "2" + }, + "value": 2 + } + ] + }, + "right": { + "type": "NumericLiteral", + "start": 6, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "extra": { + "rawValue": 42, + "raw": "42" + }, + "value": 42 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/222/input.js b/packages/babel-parser/test/fixtures/es2015/uncategorised/222/input.js index 67f4e9ae35f3..2e33b3f144ba 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/222/input.js +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/222/input.js @@ -1 +1 @@ -({ obj:20 }) = 42 \ No newline at end of file +({ obj:20 } = 42) \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/222/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/222/options.json deleted file mode 100644 index e6630c3da3e8..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/222/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid left-hand side in object destructuring pattern (1:7)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/222/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/222/output.json new file mode 100644 index 000000000000..e758dffee7fa --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/222/output.json @@ -0,0 +1,165 @@ +{ + "type": "File", + "start": 0, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "errors": [ + "SyntaxError: Invalid left-hand side in object destructuring pattern (1:7)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 1, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "operator": "=", + "left": { + "type": "ObjectPattern", + "start": 1, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 3, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 3, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 6 + }, + "identifierName": "obj" + }, + "name": "obj" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "NumericLiteral", + "start": 7, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "extra": { + "rawValue": 20, + "raw": "20" + }, + "value": 20 + } + } + ] + }, + "right": { + "type": "NumericLiteral", + "start": 14, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "extra": { + "rawValue": 42, + "raw": "42" + }, + "value": 42 + }, + "extra": { + "parenthesized": true, + "parenStart": 0 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/223/input.js b/packages/babel-parser/test/fixtures/es2015/uncategorised/223/input.js index 6c808fb17ea6..040069f16529 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/223/input.js +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/223/input.js @@ -1 +1 @@ -( { get x() {} } ) = 0 \ No newline at end of file +({ get x() {} } = 0) diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/223/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/223/options.json deleted file mode 100644 index da1e10744904..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/223/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Object pattern can't contain getter or setter (1:8)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/223/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/223/output.json new file mode 100644 index 000000000000..d5fe95dd82c4 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/223/output.json @@ -0,0 +1,166 @@ +{ + "type": "File", + "start": 0, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "errors": [ + "SyntaxError: Object pattern can't contain getter or setter (1:7)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 1, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "operator": "=", + "left": { + "type": "ObjectPattern", + "start": 1, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "properties": [ + { + "type": "ObjectMethod", + "start": 3, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 7, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + }, + "identifierName": "x" + }, + "name": "x" + }, + "computed": false, + "kind": "get", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 11, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "body": [], + "directives": [] + } + } + ] + }, + "right": { + "type": "NumericLiteral", + "start": 18, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + }, + "extra": { + "parenthesized": true, + "parenStart": 0 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/226/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/226/options.json deleted file mode 100644 index 74c1a72d5030..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/226/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected keyword 'default' (1:9)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/226/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/226/output.json new file mode 100644 index 000000000000..c725f1875b33 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/226/output.json @@ -0,0 +1,90 @@ +{ + "type": "File", + "start": 0, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "errors": [ + "SyntaxError: Unexpected keyword 'default' (1:9)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 16 + }, + "identifierName": "default" + }, + "name": "default" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 19, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "body": [], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/227/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/227/options.json deleted file mode 100644 index 6c907b0a7009..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/227/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'eval' in strict mode (1:44)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/227/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/227/output.json new file mode 100644 index 000000000000..2a794ddc885e --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/227/output.json @@ -0,0 +1,292 @@ +{ + "type": "File", + "start": 0, + "end": 59, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 59 + } + }, + "errors": [ + "SyntaxError: Binding 'eval' in strict mode (1:44)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 59, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 59 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 59, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 59 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "hello" + }, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 59, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 59 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 32, + "end": 57, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 57 + } + }, + "expression": { + "type": "ObjectExpression", + "start": 33, + "end": 55, + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 55 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 35, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 35 + }, + "end": { + "line": 1, + "column": 40 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 35, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 35 + }, + "end": { + "line": 1, + "column": 36 + }, + "identifierName": "i" + }, + "name": "i" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "NumericLiteral", + "start": 38, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 38 + }, + "end": { + "line": 1, + "column": 40 + } + }, + "extra": { + "rawValue": 10, + "raw": "10" + }, + "value": 10 + } + }, + { + "type": "ObjectMethod", + "start": 42, + "end": 53, + "loc": { + "start": { + "line": 1, + "column": 42 + }, + "end": { + "line": 1, + "column": 53 + } + }, + "method": true, + "key": { + "type": "Identifier", + "start": 42, + "end": 43, + "loc": { + "start": { + "line": 1, + "column": 42 + }, + "end": { + "line": 1, + "column": 43 + }, + "identifierName": "s" + }, + "name": "s" + }, + "computed": false, + "kind": "method", + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 44, + "end": 48, + "loc": { + "start": { + "line": 1, + "column": 44 + }, + "end": { + "line": 1, + "column": 48 + }, + "identifierName": "eval" + }, + "name": "eval" + } + ], + "body": { + "type": "BlockStatement", + "start": 50, + "end": 53, + "loc": { + "start": { + "line": 1, + "column": 50 + }, + "end": { + "line": 1, + "column": 53 + } + }, + "body": [], + "directives": [] + } + } + ], + "extra": { + "parenthesized": true, + "parenStart": 32 + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 18, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 18, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/228/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/228/options.json deleted file mode 100644 index a33dde469094..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/228/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Argument name clash (1:37)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/228/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/228/output.json new file mode 100644 index 000000000000..73e7c59a8b68 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/228/output.json @@ -0,0 +1,254 @@ +{ + "type": "File", + "start": 0, + "end": 49, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 49 + } + }, + "errors": [ + "SyntaxError: Argument name clash (1:37)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 49, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 49 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 49, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 49 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + }, + "identifierName": "a" + }, + "name": "a" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 13, + "end": 49, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 49 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 29, + "end": 47, + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 47 + } + }, + "expression": { + "type": "ObjectExpression", + "start": 30, + "end": 45, + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 45 + } + }, + "properties": [ + { + "type": "ObjectMethod", + "start": 32, + "end": 43, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 43 + } + }, + "method": true, + "key": { + "type": "Identifier", + "start": 32, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 33 + }, + "identifierName": "b" + }, + "name": "b" + }, + "computed": false, + "kind": "method", + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 34, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 34 + }, + "end": { + "line": 1, + "column": 35 + }, + "identifierName": "t" + }, + "name": "t" + }, + { + "type": "Identifier", + "start": 37, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 38 + }, + "identifierName": "t" + }, + "name": "t" + } + ], + "body": { + "type": "BlockStatement", + "start": 40, + "end": 43, + "loc": { + "start": { + "line": 1, + "column": 40 + }, + "end": { + "line": 1, + "column": 43 + } + }, + "body": [], + "directives": [] + } + } + ], + "extra": { + "parenthesized": true, + "parenStart": 29 + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 15, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 15, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/229/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/229/options.json deleted file mode 100644 index 5c79fd4f4ff2..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/229/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected keyword 'super' (1:4)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/229/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/229/output.json new file mode 100644 index 000000000000..c129c3fce1d1 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/229/output.json @@ -0,0 +1,89 @@ +{ + "type": "File", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "errors": [ + "SyntaxError: Unexpected keyword 'super' (1:4)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 4, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "id": { + "type": "Identifier", + "start": 4, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 9 + }, + "identifierName": "super" + }, + "name": "super" + }, + "init": null + } + ], + "kind": "var" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/230/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/230/options.json deleted file mode 100644 index 8a17d90eba69..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/230/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected keyword 'default' (1:4)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/230/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/230/output.json new file mode 100644 index 000000000000..e901e11e9473 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/230/output.json @@ -0,0 +1,89 @@ +{ + "type": "File", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "errors": [ + "SyntaxError: Unexpected keyword 'default' (1:4)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 4, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "id": { + "type": "Identifier", + "start": 4, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 11 + }, + "identifierName": "default" + }, + "name": "default" + }, + "init": null + } + ], + "kind": "var" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/231/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/231/options.json deleted file mode 100644 index 8a17d90eba69..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/231/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected keyword 'default' (1:4)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/231/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/231/output.json new file mode 100644 index 000000000000..635346ad81de --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/231/output.json @@ -0,0 +1,89 @@ +{ + "type": "File", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "errors": [ + "SyntaxError: Unexpected keyword 'default' (1:4)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 4, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "id": { + "type": "Identifier", + "start": 4, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 11 + }, + "identifierName": "default" + }, + "name": "default" + }, + "init": null + } + ], + "kind": "let" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/232/input.js b/packages/babel-parser/test/fixtures/es2015/uncategorised/232/input.js index 49ff0434557a..5b6b54d778e4 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/232/input.js +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/232/input.js @@ -1 +1 @@ -const default \ No newline at end of file +const default = 2 \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/232/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/232/options.json deleted file mode 100644 index d91e2a5bbc25..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/232/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected keyword 'default' (1:6)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/232/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/232/output.json new file mode 100644 index 000000000000..760cb15ffdeb --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/232/output.json @@ -0,0 +1,108 @@ +{ + "type": "File", + "start": 0, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "errors": [ + "SyntaxError: Unexpected keyword 'default' (1:6)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 0, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 6, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 13 + }, + "identifierName": "default" + }, + "name": "default" + }, + "init": { + "type": "NumericLiteral", + "start": 16, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "extra": { + "rawValue": 2, + "raw": "2" + }, + "value": 2 + } + } + ], + "kind": "const" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/233/input.js b/packages/babel-parser/test/fixtures/es2015/uncategorised/233/input.js index 40ac1e2b4639..7afe6af895a0 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/233/input.js +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/233/input.js @@ -1 +1 @@ -"use strict"; ({ v: eval }) = obj \ No newline at end of file +"use strict"; ({ v: eval } = obj) \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/233/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/233/options.json deleted file mode 100644 index 178fa1e528b2..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/233/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Assigning to 'eval' in strict mode (1:20)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/233/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/233/output.json new file mode 100644 index 000000000000..bd58e38aa176 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/233/output.json @@ -0,0 +1,195 @@ +{ + "type": "File", + "start": 0, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "errors": [ + "SyntaxError: Assigning to 'eval' in strict mode (1:20)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 14, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 15, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "operator": "=", + "left": { + "type": "ObjectPattern", + "start": 15, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 17, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 17, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + }, + "identifierName": "v" + }, + "name": "v" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "Identifier", + "start": 20, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 24 + }, + "identifierName": "eval" + }, + "name": "eval" + } + } + ] + }, + "right": { + "type": "Identifier", + "start": 29, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 32 + }, + "identifierName": "obj" + }, + "name": "obj" + }, + "extra": { + "parenthesized": true, + "parenStart": 14 + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/234/input.js b/packages/babel-parser/test/fixtures/es2015/uncategorised/234/input.js index cb924f3bb153..2e399474efe9 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/234/input.js +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/234/input.js @@ -1 +1 @@ -"use strict"; ({ v: arguments }) = obj \ No newline at end of file +"use strict"; ({ v: arguments } = obj) \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/234/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/234/options.json deleted file mode 100644 index 4ca97da7ca86..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/234/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Assigning to 'arguments' in strict mode (1:20)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/234/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/234/output.json new file mode 100644 index 000000000000..60d3496c8663 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/234/output.json @@ -0,0 +1,195 @@ +{ + "type": "File", + "start": 0, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 38 + } + }, + "errors": [ + "SyntaxError: Assigning to 'arguments' in strict mode (1:20)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 38 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 14, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 38 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 15, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "operator": "=", + "left": { + "type": "ObjectPattern", + "start": 15, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 17, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 17, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + }, + "identifierName": "v" + }, + "name": "v" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "Identifier", + "start": 20, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 29 + }, + "identifierName": "arguments" + }, + "name": "arguments" + } + } + ] + }, + "right": { + "type": "Identifier", + "start": 34, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 34 + }, + "end": { + "line": 1, + "column": 37 + }, + "identifierName": "obj" + }, + "name": "obj" + }, + "extra": { + "parenthesized": true, + "parenStart": 14 + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/235/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/235/options.json deleted file mode 100644 index dd3b73e5d533..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/235/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "for-in loop variable declaration may not have an initializer (1:5)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/235/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/235/output.json new file mode 100644 index 000000000000..f42607bf0849 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/235/output.json @@ -0,0 +1,206 @@ +{ + "type": "File", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "errors": [ + "SyntaxError: for-in loop variable declaration may not have an initializer (1:5)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ForInStatement", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "left": { + "type": "VariableDeclaration", + "start": 5, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 9, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + }, + "identifierName": "x" + }, + "name": "x" + }, + "init": { + "type": "NumericLiteral", + "start": 13, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "extra": { + "rawValue": 42, + "raw": "42" + }, + "value": 42 + } + } + ], + "kind": "let" + }, + "right": { + "type": "Identifier", + "start": 19, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 23 + }, + "identifierName": "list" + }, + "name": "list" + }, + "body": { + "type": "ExpressionStatement", + "start": 25, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "expression": { + "type": "CallExpression", + "start": 25, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "callee": { + "type": "Identifier", + "start": 25, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 32 + }, + "identifierName": "process" + }, + "name": "process" + }, + "arguments": [ + { + "type": "Identifier", + "start": 33, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 34 + }, + "identifierName": "x" + }, + "name": "x" + } + ] + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/236/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/236/options.json deleted file mode 100644 index c145a86bc613..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/236/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "for-of loop variable declaration may not have an initializer (1:5)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/236/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/236/output.json new file mode 100644 index 000000000000..1679566d43da --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/236/output.json @@ -0,0 +1,207 @@ +{ + "type": "File", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "errors": [ + "SyntaxError: for-of loop variable declaration may not have an initializer (1:5)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ForOfStatement", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "await": false, + "left": { + "type": "VariableDeclaration", + "start": 5, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 9, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + }, + "identifierName": "x" + }, + "name": "x" + }, + "init": { + "type": "NumericLiteral", + "start": 13, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "extra": { + "rawValue": 42, + "raw": "42" + }, + "value": 42 + } + } + ], + "kind": "let" + }, + "right": { + "type": "Identifier", + "start": 19, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 23 + }, + "identifierName": "list" + }, + "name": "list" + }, + "body": { + "type": "ExpressionStatement", + "start": 25, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "expression": { + "type": "CallExpression", + "start": 25, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "callee": { + "type": "Identifier", + "start": 25, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 32 + }, + "identifierName": "process" + }, + "name": "process" + }, + "arguments": [ + { + "type": "Identifier", + "start": 33, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 34 + }, + "identifierName": "x" + }, + "name": "x" + } + ] + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/242/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/242/options.json deleted file mode 100644 index 02a0eafbbbbe..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/242/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Assigning to 'eval' in strict mode (1:15)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/242/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/242/output.json new file mode 100644 index 000000000000..3731ec6d7b75 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/242/output.json @@ -0,0 +1,182 @@ +{ + "type": "File", + "start": 0, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "errors": [ + "SyntaxError: Assigning to 'eval' in strict mode (1:15)", + "SyntaxError: Binding 'eval' in strict mode (1:15)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 14, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "expression": { + "type": "ArrowFunctionExpression", + "start": 14, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "AssignmentPattern", + "start": 15, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "left": { + "type": "Identifier", + "start": 15, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 19 + }, + "identifierName": "eval" + }, + "name": "eval" + }, + "right": { + "type": "NumericLiteral", + "start": 22, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "extra": { + "rawValue": 10, + "raw": "10" + }, + "value": 10 + } + } + ], + "body": { + "type": "NumericLiteral", + "start": 29, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "extra": { + "rawValue": 42, + "raw": "42" + }, + "value": 42 + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/243/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/243/options.json deleted file mode 100644 index e4abe279ab29..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/243/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'eval' in strict mode (1:14)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/243/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/243/output.json new file mode 100644 index 000000000000..dbffe6547ab5 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/243/output.json @@ -0,0 +1,146 @@ +{ + "type": "File", + "start": 0, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "errors": [ + "SyntaxError: Binding 'eval' in strict mode (1:14)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 14, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "expression": { + "type": "ArrowFunctionExpression", + "start": 14, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 14, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 18 + }, + "identifierName": "eval" + }, + "name": "eval" + } + ], + "body": { + "type": "NumericLiteral", + "start": 22, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "extra": { + "rawValue": 42, + "raw": "42" + }, + "value": 42 + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/244/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/244/options.json deleted file mode 100644 index c2a4aaec255e..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/244/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'arguments' in strict mode (1:14)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/244/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/244/output.json new file mode 100644 index 000000000000..1b3ed15f002e --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/244/output.json @@ -0,0 +1,146 @@ +{ + "type": "File", + "start": 0, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "errors": [ + "SyntaxError: Binding 'arguments' in strict mode (1:14)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 14, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "expression": { + "type": "ArrowFunctionExpression", + "start": 14, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 14, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 23 + }, + "identifierName": "arguments" + }, + "name": "arguments" + } + ], + "body": { + "type": "NumericLiteral", + "start": 27, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "extra": { + "rawValue": 42, + "raw": "42" + }, + "value": 42 + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/245/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/245/options.json deleted file mode 100644 index d93d5b2aa62e..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/245/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'eval' in strict mode (1:15)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/245/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/245/output.json new file mode 100644 index 000000000000..6b7ae83c0ad2 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/245/output.json @@ -0,0 +1,163 @@ +{ + "type": "File", + "start": 0, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "errors": [ + "SyntaxError: Binding 'eval' in strict mode (1:15)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 14, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "expression": { + "type": "ArrowFunctionExpression", + "start": 14, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 15, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 19 + }, + "identifierName": "eval" + }, + "name": "eval" + }, + { + "type": "Identifier", + "start": 21, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + }, + "identifierName": "a" + }, + "name": "a" + } + ], + "body": { + "type": "NumericLiteral", + "start": 27, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "extra": { + "rawValue": 42, + "raw": "42" + }, + "value": 42 + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/246/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/246/options.json deleted file mode 100644 index 5d2dc563b16e..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/246/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'arguments' in strict mode (1:15)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/246/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/246/output.json new file mode 100644 index 000000000000..c681755fb108 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/246/output.json @@ -0,0 +1,163 @@ +{ + "type": "File", + "start": 0, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "errors": [ + "SyntaxError: Binding 'arguments' in strict mode (1:15)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 14, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "expression": { + "type": "ArrowFunctionExpression", + "start": 14, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 15, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 24 + }, + "identifierName": "arguments" + }, + "name": "arguments" + }, + { + "type": "Identifier", + "start": 26, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 27 + }, + "identifierName": "a" + }, + "name": "a" + } + ], + "body": { + "type": "NumericLiteral", + "start": 32, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "extra": { + "rawValue": 42, + "raw": "42" + }, + "value": 42 + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/247/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/247/options.json deleted file mode 100644 index d93d5b2aa62e..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/247/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'eval' in strict mode (1:15)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/247/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/247/output.json new file mode 100644 index 000000000000..b8b375182e2c --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/247/output.json @@ -0,0 +1,198 @@ +{ + "type": "File", + "start": 0, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "errors": [ + "SyntaxError: Binding 'eval' in strict mode (1:15)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 14, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "expression": { + "type": "ArrowFunctionExpression", + "start": 14, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 15, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 19 + }, + "identifierName": "eval" + }, + "name": "eval" + }, + { + "type": "AssignmentPattern", + "start": 21, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "left": { + "type": "Identifier", + "start": 21, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + }, + "identifierName": "a" + }, + "name": "a" + }, + "right": { + "type": "NumericLiteral", + "start": 25, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "extra": { + "rawValue": 10, + "raw": "10" + }, + "value": 10 + } + } + ], + "body": { + "type": "NumericLiteral", + "start": 32, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "extra": { + "rawValue": 42, + "raw": "42" + }, + "value": 42 + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/248/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/248/options.json deleted file mode 100644 index b99fd35222b1..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/248/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Argument name clash (1:18)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/248/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/248/output.json new file mode 100644 index 000000000000..3a5f60bdddea --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/248/output.json @@ -0,0 +1,163 @@ +{ + "type": "File", + "start": 0, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "errors": [ + "SyntaxError: Argument name clash (1:18)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 14, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "expression": { + "type": "ArrowFunctionExpression", + "start": 14, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 15, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + }, + "identifierName": "a" + }, + "name": "a" + }, + { + "type": "Identifier", + "start": 18, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + }, + "identifierName": "a" + }, + "name": "a" + } + ], + "body": { + "type": "NumericLiteral", + "start": 24, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "extra": { + "rawValue": 42, + "raw": "42" + }, + "value": 42 + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/249/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/249/options.json deleted file mode 100644 index 79a05e62290e..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/249/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Legacy octal literals are not allowed in strict mode (1:21)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/249/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/249/output.json new file mode 100644 index 000000000000..18c0889f74b8 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/249/output.json @@ -0,0 +1,146 @@ +{ + "type": "File", + "start": 0, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "errors": [ + "SyntaxError: Legacy octal literals are not allowed in strict mode (1:21)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 14, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "expression": { + "type": "ArrowFunctionExpression", + "start": 14, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 15, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + }, + "identifierName": "a" + }, + "name": "a" + } + ], + "body": { + "type": "NumericLiteral", + "start": 21, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "extra": { + "rawValue": 0, + "raw": "00" + }, + "value": 0 + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/251/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/251/options.json deleted file mode 100644 index 99ffc0de0153..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/251/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid left-hand side in arrow function parameters (1:1)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/251/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/251/output.json new file mode 100644 index 000000000000..a7c444dfbcdc --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/251/output.json @@ -0,0 +1,113 @@ +{ + "type": "File", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "errors": [ + "SyntaxError: Binding invalid left-hand side in function parameter list (1:1)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "expression": { + "type": "ArrowFunctionExpression", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "NumericLiteral", + "start": 1, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "extra": { + "rawValue": 10, + "raw": "10" + }, + "value": 10 + } + ], + "body": { + "type": "NumericLiteral", + "start": 8, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "extra": { + "rawValue": 0, + "raw": "00" + }, + "value": 0 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/252/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/252/options.json deleted file mode 100644 index 99ffc0de0153..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/252/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid left-hand side in arrow function parameters (1:1)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/252/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/252/output.json new file mode 100644 index 000000000000..2d80f047d283 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/252/output.json @@ -0,0 +1,134 @@ +{ + "type": "File", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "errors": [ + "SyntaxError: Binding invalid left-hand side in function parameter list (1:1)", + "SyntaxError: Binding invalid left-hand side in function parameter list (1:5)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "expression": { + "type": "ArrowFunctionExpression", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "NumericLiteral", + "start": 1, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "extra": { + "rawValue": 10, + "raw": "10" + }, + "value": 10 + }, + { + "type": "NumericLiteral", + "start": 5, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "extra": { + "rawValue": 20, + "raw": "20" + }, + "value": 20 + } + ], + "body": { + "type": "NumericLiteral", + "start": 12, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "extra": { + "rawValue": 0, + "raw": "00" + }, + "value": 0 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/280/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/280/options.json deleted file mode 100644 index 5cbee309bd50..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/280/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Argument name clash (1:30)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/280/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/280/output.json new file mode 100644 index 000000000000..299c0dabdaa1 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/280/output.json @@ -0,0 +1,216 @@ +{ + "type": "File", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "errors": [ + "SyntaxError: Argument name clash (1:30)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 14, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "id": { + "type": "Identifier", + "start": 23, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + }, + "identifierName": "x" + }, + "name": "x" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 25, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 26 + }, + "identifierName": "a" + }, + "name": "a" + }, + { + "type": "ObjectPattern", + "start": 28, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 30, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 30, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 31 + }, + "identifierName": "a" + }, + "name": "a" + }, + "computed": false, + "shorthand": true, + "value": { + "type": "Identifier", + "start": 30, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 31 + }, + "identifierName": "a" + }, + "name": "a" + }, + "extra": { + "shorthand": true + } + } + ] + } + ], + "body": { + "type": "BlockStatement", + "start": 34, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 34 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "body": [], + "directives": [] + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/281/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/281/options.json deleted file mode 100644 index 8dba9882c0dc..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/281/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Argument name clash (1:47)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/281/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/281/output.json new file mode 100644 index 000000000000..50b6eca3fddd --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/281/output.json @@ -0,0 +1,392 @@ +{ + "type": "File", + "start": 0, + "end": 56, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 56 + } + }, + "errors": [ + "SyntaxError: Argument name clash (1:47)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 56, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 56 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 14, + "end": 56, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 56 + } + }, + "id": { + "type": "Identifier", + "start": 23, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + }, + "identifierName": "x" + }, + "name": "x" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "ObjectPattern", + "start": 25, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 27, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 27, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 28 + }, + "identifierName": "b" + }, + "name": "b" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "ObjectPattern", + "start": 30, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 32, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 32, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 33 + }, + "identifierName": "a" + }, + "name": "a" + }, + "computed": false, + "shorthand": true, + "value": { + "type": "Identifier", + "start": 32, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 33 + }, + "identifierName": "a" + }, + "name": "a" + }, + "extra": { + "shorthand": true + } + } + ] + } + } + ] + }, + { + "type": "ArrayPattern", + "start": 39, + "end": 53, + "loc": { + "start": { + "line": 1, + "column": 39 + }, + "end": { + "line": 1, + "column": 53 + } + }, + "elements": [ + { + "type": "ObjectPattern", + "start": 40, + "end": 52, + "loc": { + "start": { + "line": 1, + "column": 40 + }, + "end": { + "line": 1, + "column": 52 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 42, + "end": 50, + "loc": { + "start": { + "line": 1, + "column": 42 + }, + "end": { + "line": 1, + "column": 50 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 42, + "end": 43, + "loc": { + "start": { + "line": 1, + "column": 42 + }, + "end": { + "line": 1, + "column": 43 + }, + "identifierName": "b" + }, + "name": "b" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "ObjectPattern", + "start": 45, + "end": 50, + "loc": { + "start": { + "line": 1, + "column": 45 + }, + "end": { + "line": 1, + "column": 50 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 47, + "end": 48, + "loc": { + "start": { + "line": 1, + "column": 47 + }, + "end": { + "line": 1, + "column": 48 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 47, + "end": 48, + "loc": { + "start": { + "line": 1, + "column": 47 + }, + "end": { + "line": 1, + "column": 48 + }, + "identifierName": "a" + }, + "name": "a" + }, + "computed": false, + "shorthand": true, + "value": { + "type": "Identifier", + "start": 47, + "end": 48, + "loc": { + "start": { + "line": 1, + "column": 47 + }, + "end": { + "line": 1, + "column": 48 + }, + "identifierName": "a" + }, + "name": "a" + }, + "extra": { + "shorthand": true + } + } + ] + } + } + ] + } + ] + } + ], + "body": { + "type": "BlockStatement", + "start": 54, + "end": 56, + "loc": { + "start": { + "line": 1, + "column": 54 + }, + "end": { + "line": 1, + "column": 56 + } + }, + "body": [], + "directives": [] + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/284/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/284/options.json deleted file mode 100644 index 71f5061aff9a..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/284/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid left-hand side in arrow function parameters (1:3)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/284/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/284/output.json new file mode 100644 index 000000000000..68f6ccb7cefc --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/284/output.json @@ -0,0 +1,127 @@ +{ + "type": "File", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "errors": [ + "SyntaxError: Binding invalid left-hand side in array destructuring pattern (1:3)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "expression": { + "type": "ArrowFunctionExpression", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "ArrayPattern", + "start": 1, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "elements": [ + { + "type": "NumericLiteral", + "start": 3, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "extra": { + "rawValue": 5, + "raw": "5" + }, + "value": 5 + } + ] + } + ], + "body": { + "type": "BlockStatement", + "start": 11, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "body": [], + "directives": [] + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/289/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/289/options.json deleted file mode 100644 index 8ed5553896c1..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/289/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'eval' in strict mode (1:5)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/289/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/289/output.json new file mode 100644 index 000000000000..db0bdfa5417b --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/289/output.json @@ -0,0 +1,184 @@ +{ + "type": "File", + "start": 0, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "errors": [ + "SyntaxError: Binding 'eval' in strict mode (1:5)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "expression": { + "type": "ObjectExpression", + "start": 1, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "properties": [ + { + "type": "ObjectMethod", + "start": 3, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "method": true, + "key": { + "type": "Identifier", + "start": 3, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 4 + }, + "identifierName": "t" + }, + "name": "t" + }, + "computed": false, + "kind": "method", + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 5, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 9 + }, + "identifierName": "eval" + }, + "name": "eval" + } + ], + "body": { + "type": "BlockStatement", + "start": 11, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "body": [], + "directives": [ + { + "type": "Directive", + "start": 13, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 13, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "extra": { + "parenthesized": true, + "parenStart": 0 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/290/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/290/options.json deleted file mode 100644 index 473cd470d4f1..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/290/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:23)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/290/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/290/output.json new file mode 100644 index 000000000000..34fe89ec4c5a --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/290/output.json @@ -0,0 +1,165 @@ +{ + "type": "File", + "start": 0, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:23)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 14, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "expression": { + "type": "TemplateLiteral", + "start": 14, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "expressions": [ + { + "type": "Identifier", + "start": 17, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 21 + }, + "identifierName": "test" + }, + "name": "test" + } + ], + "quasis": [ + { + "type": "TemplateElement", + "start": 15, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "value": { + "raw": "", + "cooked": "" + }, + "tail": false + }, + { + "type": "TemplateElement", + "start": 22, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "value": { + "raw": "\\02", + "cooked": null + }, + "tail": true + } + ] + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/291/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/291/options.json deleted file mode 100644 index ae24fbee33c8..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/291/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "'import' and 'export' may only appear at the top level (1:7)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/291/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/291/output.json new file mode 100644 index 000000000000..42655f4b978c --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/291/output.json @@ -0,0 +1,111 @@ +{ + "type": "File", + "start": 0, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "errors": [ + "SyntaxError: 'import' and 'export' may only appear at the top level (1:7)", + "SyntaxError: 'import' and 'export' may appear only with 'sourceType: \"module\"' (1:7)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "IfStatement", + "start": 0, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "test": { + "type": "NumericLiteral", + "start": 4, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + }, + "consequent": { + "type": "ImportDeclaration", + "start": 7, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "specifiers": [], + "source": { + "type": "StringLiteral", + "start": 14, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "extra": { + "rawValue": "acorn", + "raw": "\"acorn\"" + }, + "value": "acorn" + } + }, + "alternate": null + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/296/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/296/options.json deleted file mode 100644 index d93d5b2aa62e..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/296/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'eval' in strict mode (1:15)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/296/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/296/output.json new file mode 100644 index 000000000000..49e0835c1bfc --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/296/output.json @@ -0,0 +1,146 @@ +{ + "type": "File", + "start": 0, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "errors": [ + "SyntaxError: Binding 'eval' in strict mode (1:15)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 14, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "expression": { + "type": "ArrowFunctionExpression", + "start": 14, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 15, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 19 + }, + "identifierName": "eval" + }, + "name": "eval" + } + ], + "body": { + "type": "NumericLiteral", + "start": 24, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "extra": { + "rawValue": 42, + "raw": "42" + }, + "value": 42 + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/297/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/297/options.json deleted file mode 100644 index 224716db8070..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/297/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'eval' in strict mode (1:1)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/297/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/297/output.json new file mode 100644 index 000000000000..85866aeddd23 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/297/output.json @@ -0,0 +1,179 @@ +{ + "type": "File", + "start": 0, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "errors": [ + "SyntaxError: Binding 'eval' in strict mode (1:1)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "expression": { + "type": "ArrowFunctionExpression", + "start": 0, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 1, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 5 + }, + "identifierName": "eval" + }, + "name": "eval" + } + ], + "body": { + "type": "BlockStatement", + "start": 10, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 26, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 26, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "extra": { + "rawValue": 42, + "raw": "42" + }, + "value": 42 + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 12, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 12, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/298/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/298/options.json deleted file mode 100644 index 49d27a1476b0..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/298/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Object pattern can't contain getter or setter (1:7)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/298/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/298/output.json new file mode 100644 index 000000000000..fd0a014544e3 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/298/output.json @@ -0,0 +1,166 @@ +{ + "type": "File", + "start": 0, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "errors": [ + "SyntaxError: Object pattern can't contain getter or setter (1:7)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "expression": { + "type": "ArrowFunctionExpression", + "start": 0, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "ObjectPattern", + "start": 1, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "properties": [ + { + "type": "ObjectMethod", + "start": 3, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 7, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 11 + }, + "identifierName": "test" + }, + "name": "test" + }, + "computed": false, + "kind": "get", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 14, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "body": [], + "directives": [] + } + } + ] + } + ], + "body": { + "type": "NumericLiteral", + "start": 24, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "extra": { + "rawValue": 42, + "raw": "42" + }, + "value": 42 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/322/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/322/output.json index 1749b8360656..68286e968b5c 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/322/output.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/322/output.json @@ -91,7 +91,10 @@ "name": "x" }, null - ] + ], + "extra": { + "trailingComma": 3 + } }, "right": { "type": "NumericLiteral", diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/324/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/324/options.json deleted file mode 100644 index d921abda8ff6..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/324/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Complex binding patterns require an initialization value (1:7)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/324/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/324/output.json new file mode 100644 index 000000000000..09ca9d8754be --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/324/output.json @@ -0,0 +1,106 @@ +{ + "type": "File", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "errors": [ + "SyntaxError: Complex binding patterns require an initialization value (1:7)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 4, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "id": { + "type": "ArrayPattern", + "start": 4, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "elements": [ + { + "type": "Identifier", + "start": 5, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + }, + "identifierName": "x" + }, + "name": "x" + } + ] + }, + "init": null + } + ], + "kind": "let" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/325/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/325/options.json deleted file mode 100644 index d921abda8ff6..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/325/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Complex binding patterns require an initialization value (1:7)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/325/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/325/output.json new file mode 100644 index 000000000000..6d0d7ab1d050 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/325/output.json @@ -0,0 +1,106 @@ +{ + "type": "File", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "errors": [ + "SyntaxError: Complex binding patterns require an initialization value (1:7)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 4, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "id": { + "type": "ArrayPattern", + "start": 4, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "elements": [ + { + "type": "Identifier", + "start": 5, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + }, + "identifierName": "x" + }, + "name": "x" + } + ] + }, + "init": null + } + ], + "kind": "var" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/329/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/329/options.json deleted file mode 100644 index 97818d2eea7e..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/329/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Lexical declaration cannot appear in a single-statement context (1:9)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/329/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/329/output.json new file mode 100644 index 000000000000..9b5c4b8b1857 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/329/output.json @@ -0,0 +1,126 @@ +{ + "type": "File", + "start": 0, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "errors": [ + "SyntaxError: Lexical declaration cannot appear in a single-statement context (1:9)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ForStatement", + "start": 0, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "init": null, + "test": null, + "update": null, + "body": { + "type": "VariableDeclaration", + "start": 9, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 15, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "id": { + "type": "Identifier", + "start": 15, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + }, + "identifierName": "x" + }, + "name": "x" + }, + "init": { + "type": "NumericLiteral", + "start": 19, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "extra": { + "rawValue": 10, + "raw": "10" + }, + "value": 10 + } + } + ], + "kind": "const" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/332/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/332/options.json deleted file mode 100644 index 610884bb674c..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/332/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Assigning to 'eval' in strict mode (1:18)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/332/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/332/output.json new file mode 100644 index 000000000000..cc9bdf3e164e --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/332/output.json @@ -0,0 +1,171 @@ +{ + "type": "File", + "start": 0, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "errors": [ + "SyntaxError: Assigning to 'eval' in strict mode (1:18)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 14, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 14, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "operator": "=", + "left": { + "type": "ArrayPattern", + "start": 14, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "elements": [ + { + "type": "RestElement", + "start": 15, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "argument": { + "type": "Identifier", + "start": 18, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 22 + }, + "identifierName": "eval" + }, + "name": "eval" + } + } + ] + }, + "right": { + "type": "Identifier", + "start": 26, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 29 + }, + "identifierName": "arr" + }, + "name": "arr" + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/333/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/333/options.json deleted file mode 100644 index 567e40541c5b..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/333/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected reserved word 'eval' (1:16)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/333/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/333/output.json new file mode 100644 index 000000000000..5d9acaecea9b --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/333/output.json @@ -0,0 +1,231 @@ +{ + "type": "File", + "start": 0, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "errors": [ + "SyntaxError: Unexpected reserved word 'eval' (1:16)", + "SyntaxError: Assigning to 'eval' in strict mode (1:16)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 14, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 15, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 38 + } + }, + "operator": "=", + "left": { + "type": "ObjectPattern", + "start": 15, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 16, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 16, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 20 + }, + "identifierName": "eval" + }, + "name": "eval" + }, + "computed": false, + "shorthand": true, + "value": { + "type": "AssignmentPattern", + "start": 16, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "left": { + "type": "Identifier", + "start": 16, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 20 + }, + "identifierName": "eval" + }, + "name": "eval" + }, + "right": { + "type": "Identifier", + "start": 23, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 31 + }, + "identifierName": "defValue" + }, + "name": "defValue" + } + }, + "extra": { + "shorthand": true + } + } + ] + }, + "right": { + "type": "Identifier", + "start": 35, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 35 + }, + "end": { + "line": 1, + "column": 38 + }, + "identifierName": "obj" + }, + "name": "obj" + }, + "extra": { + "parenthesized": true, + "parenStart": 14 + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/334/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/334/options.json index e45ea16ee8a4..2104ca43283f 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/334/options.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/334/options.json @@ -1,4 +1,3 @@ { - "sourceType": "module", - "throws": "Assigning to 'eval' in strict mode (1:4)" -} \ No newline at end of file + "sourceType": "module" +} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/334/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/334/output.json new file mode 100644 index 000000000000..a1414d86bbf6 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/334/output.json @@ -0,0 +1,135 @@ +{ + "type": "File", + "start": 0, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "errors": [ + "SyntaxError: Assigning to 'eval' in strict mode (1:4)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 0, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "operator": "=", + "left": { + "type": "ArrayPattern", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "elements": [ + { + "type": "RestElement", + "start": 1, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "argument": { + "type": "Identifier", + "start": 4, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 8 + }, + "identifierName": "eval" + }, + "name": "eval" + } + } + ] + }, + "right": { + "type": "Identifier", + "start": 12, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 15 + }, + "identifierName": "arr" + }, + "name": "arr" + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/339/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/339/options.json deleted file mode 100644 index fd4da953a419..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/339/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/339/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/339/output.json new file mode 100644 index 000000000000..86383c01feb1 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/339/output.json @@ -0,0 +1,91 @@ +{ + "type": "File", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "expression": { + "type": "TemplateLiteral", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "expressions": [], + "quasis": [ + { + "type": "TemplateElement", + "start": 1, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "value": { + "raw": "\\07", + "cooked": null + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/344/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/344/options.json deleted file mode 100644 index ad3fdc7d73f7..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/344/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "super is only allowed in object methods and classes (1:0)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/344/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/344/output.json new file mode 100644 index 000000000000..ee3b4cb3552b --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/344/output.json @@ -0,0 +1,69 @@ +{ + "type": "File", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "errors": [ + "SyntaxError: super is only allowed in object methods and classes (1:0)", + "SyntaxError: super can only be used with function calls (i.e. super()) or in property accesses (i.e. super.prop or super[prop]) (1:0)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "expression": { + "type": "Super", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/347/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/347/options.json deleted file mode 100644 index 9a137564eed4..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/347/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "setter must have exactly one formal parameter (1:10)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/347/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/347/output.json new file mode 100644 index 000000000000..31975621dcf1 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/347/output.json @@ -0,0 +1,179 @@ +{ + "type": "File", + "start": 0, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "errors": [ + "SyntaxError: setter must have exactly one formal parameter (1:10)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "A" + }, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 8, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "body": [ + { + "type": "ClassMethod", + "start": 10, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "static": false, + "key": { + "type": "Identifier", + "start": 14, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 18 + }, + "identifierName": "prop" + }, + "name": "prop" + }, + "computed": false, + "kind": "set", + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 19, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + }, + "identifierName": "x" + }, + "name": "x" + }, + { + "type": "Identifier", + "start": 22, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + }, + "identifierName": "y" + }, + "name": "y" + } + ], + "body": { + "type": "BlockStatement", + "start": 25, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/348/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/348/options.json deleted file mode 100644 index c1ac8e1d138d..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/348/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Redefinition of __proto__ property (1:17)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/348/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/348/output.json new file mode 100644 index 000000000000..49d20172fcc8 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/348/output.json @@ -0,0 +1,184 @@ +{ + "type": "File", + "start": 0, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "errors": [ + "SyntaxError: Redefinition of __proto__ property (1:17)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "expression": { + "type": "ObjectExpression", + "start": 1, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 3, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 3, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 12 + }, + "identifierName": "__proto__" + }, + "name": "__proto__" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "NumericLiteral", + "start": 14, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + }, + { + "type": "ObjectProperty", + "start": 17, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 17, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 26 + }, + "identifierName": "__proto__" + }, + "name": "__proto__" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "NumericLiteral", + "start": 28, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "extra": { + "rawValue": 2, + "raw": "2" + }, + "value": 2 + } + } + ], + "extra": { + "parenthesized": true, + "parenStart": 0 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/349/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/349/options.json deleted file mode 100644 index 0d3bc321ef03..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/349/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Redefinition of __proto__ property (1:19)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/349/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/349/output.json new file mode 100644 index 000000000000..ba254dda4d93 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/349/output.json @@ -0,0 +1,187 @@ +{ + "type": "File", + "start": 0, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "errors": [ + "SyntaxError: Redefinition of __proto__ property (1:19)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "expression": { + "type": "ObjectExpression", + "start": 1, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 3, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "method": false, + "key": { + "type": "StringLiteral", + "start": 3, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "extra": { + "rawValue": "__proto__", + "raw": "'__proto__'" + }, + "value": "__proto__" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "NumericLiteral", + "start": 16, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + }, + { + "type": "ObjectProperty", + "start": 19, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 19, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 28 + }, + "identifierName": "__proto__" + }, + "name": "__proto__" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "NumericLiteral", + "start": 30, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "extra": { + "rawValue": 2, + "raw": "2" + }, + "value": 2 + } + } + ], + "extra": { + "parenthesized": true, + "parenStart": 0 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/357/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/357/options.json index c148ada0c73a..2104ca43283f 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/357/options.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/357/options.json @@ -1,4 +1,3 @@ { - "sourceType": "module", - "throws": "Can not use keyword 'await' outside an async function (1:0)" + "sourceType": "module" } diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/357/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/357/output.json new file mode 100644 index 000000000000..b5f573a72f13 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/357/output.json @@ -0,0 +1,119 @@ +{ + "type": "File", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "errors": [ + "SyntaxError: Can not use keyword 'await' outside an async function (1:0)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "operator": "=", + "left": { + "type": "Identifier", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + }, + "identifierName": "await" + }, + "name": "await" + }, + "right": { + "type": "CallExpression", + "start": 8, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "callee": { + "type": "Identifier", + "start": 8, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 11 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "arguments": [] + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/359/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/359/options.json index fa250ba921b1..2104ca43283f 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/359/options.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/359/options.json @@ -1,4 +1,3 @@ { - "sourceType": "module", - "throws": "Can not use keyword 'await' outside an async function (1:6)" + "sourceType": "module" } diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/359/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/359/output.json new file mode 100644 index 000000000000..cc297fab6b9f --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/359/output.json @@ -0,0 +1,121 @@ +{ + "type": "File", + "start": 0, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "errors": [ + "SyntaxError: Can not use keyword 'await' outside an async function (1:6)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 0, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 6, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 11 + }, + "identifierName": "await" + }, + "name": "await" + }, + "init": { + "type": "CallExpression", + "start": 14, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "callee": { + "type": "Identifier", + "start": 14, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 17 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "arguments": [] + } + } + ], + "kind": "const" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/361/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/361/options.json index fd81c5071d1d..2104ca43283f 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/361/options.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/361/options.json @@ -1,4 +1,3 @@ { - "sourceType": "module", - "throws": "Can not use keyword 'await' outside an async function (1:8)" + "sourceType": "module" } diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/361/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/361/output.json new file mode 100644 index 000000000000..1bbb6a10ec2c --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/361/output.json @@ -0,0 +1,176 @@ +{ + "type": "File", + "start": 0, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "errors": [ + "SyntaxError: Can not use keyword 'await' outside an async function (1:8)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 0, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 6, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "id": { + "type": "ObjectPattern", + "start": 6, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 8, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 8, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 13 + }, + "identifierName": "await" + }, + "name": "await" + }, + "computed": false, + "shorthand": true, + "value": { + "type": "Identifier", + "start": 8, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 13 + }, + "identifierName": "await" + }, + "name": "await" + }, + "extra": { + "shorthand": true + } + } + ] + }, + "init": { + "type": "CallExpression", + "start": 18, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "callee": { + "type": "Identifier", + "start": 18, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 21 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "arguments": [] + } + } + ], + "kind": "const" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/363/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/363/options.json index a72d4ab0ff7f..2104ca43283f 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/363/options.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/363/options.json @@ -1,4 +1,3 @@ { - "sourceType": "module", - "throws": "Can not use keyword 'await' outside an async function (1:15)" + "sourceType": "module" } diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/363/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/363/output.json new file mode 100644 index 000000000000..8734398fed74 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/363/output.json @@ -0,0 +1,163 @@ +{ + "type": "File", + "start": 0, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "errors": [ + "SyntaxError: Can not use keyword 'await' outside an async function (1:15)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 12 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "ObjectPattern", + "start": 13, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 15, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 15, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 20 + }, + "identifierName": "await" + }, + "name": "await" + }, + "computed": false, + "shorthand": true, + "value": { + "type": "Identifier", + "start": 15, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 20 + }, + "identifierName": "await" + }, + "name": "await" + }, + "extra": { + "shorthand": true + } + } + ] + } + ], + "body": { + "type": "BlockStatement", + "start": 24, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "body": [], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/365/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/365/options.json index 18d9310bd147..2104ca43283f 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/365/options.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/365/options.json @@ -1,4 +1,3 @@ { - "sourceType": "module", - "throws": "Can not use keyword 'await' outside an async function (1:9)" + "sourceType": "module" } diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/365/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/365/output.json new file mode 100644 index 000000000000..9f69841ee631 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/365/output.json @@ -0,0 +1,90 @@ +{ + "type": "File", + "start": 0, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "errors": [ + "SyntaxError: Can not use keyword 'await' outside an async function (1:9)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "await" + }, + "name": "await" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "body": [], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/367/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/367/options.json index fa250ba921b1..2104ca43283f 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/367/options.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/367/options.json @@ -1,4 +1,3 @@ { - "sourceType": "module", - "throws": "Can not use keyword 'await' outside an async function (1:6)" + "sourceType": "module" } diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/367/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/367/output.json new file mode 100644 index 000000000000..12f2a4f35608 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/367/output.json @@ -0,0 +1,87 @@ +{ + "type": "File", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "errors": [ + "SyntaxError: Can not use keyword 'await' outside an async function (1:6)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 11 + }, + "identifierName": "await" + }, + "name": "await" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 12, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "body": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/368/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/368/options.json index bd449d1a1743..b412ffe6712f 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/368/options.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/368/options.json @@ -1,4 +1,3 @@ { - "sourceType": "script", - "throws": "Unexpected reserved word 'enum' (1:0)" -} \ No newline at end of file + "sourceType": "script" +} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/368/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/368/output.json new file mode 100644 index 000000000000..db0bfd7b2d15 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/368/output.json @@ -0,0 +1,119 @@ +{ + "type": "File", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "errors": [ + "SyntaxError: Unexpected reserved word 'enum' (1:0)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "operator": "=", + "left": { + "type": "Identifier", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + }, + "identifierName": "enum" + }, + "name": "enum" + }, + "right": { + "type": "CallExpression", + "start": 7, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "callee": { + "type": "Identifier", + "start": 7, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 10 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "arguments": [] + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/369/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/369/options.json index a8c4888490b6..2104ca43283f 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/369/options.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/369/options.json @@ -1,4 +1,3 @@ { - "sourceType": "module", - "throws": "Unexpected reserved word 'enum' (1:0)" -} \ No newline at end of file + "sourceType": "module" +} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/369/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/369/output.json new file mode 100644 index 000000000000..7f7235704637 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/369/output.json @@ -0,0 +1,119 @@ +{ + "type": "File", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "errors": [ + "SyntaxError: Unexpected reserved word 'enum' (1:0)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "operator": "=", + "left": { + "type": "Identifier", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + }, + "identifierName": "enum" + }, + "name": "enum" + }, + "right": { + "type": "CallExpression", + "start": 7, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "callee": { + "type": "Identifier", + "start": 7, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 10 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "arguments": [] + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/37/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/37/options.json deleted file mode 100644 index 401518851fb6..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/37/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid left-hand side in arrow function parameters (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/37/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/37/output.json new file mode 100644 index 000000000000..074d84652acc --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/37/output.json @@ -0,0 +1,160 @@ +{ + "type": "File", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "errors": [ + "SyntaxError: Binding member expression (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "expression": { + "type": "ArrowFunctionExpression", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "ArrayPattern", + "start": 1, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "elements": [ + { + "type": "MemberExpression", + "start": 2, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "object": { + "type": "Identifier", + "start": 2, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + }, + "identifierName": "a" + }, + "name": "a" + }, + "property": { + "type": "Identifier", + "start": 4, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + }, + "identifierName": "a" + }, + "name": "a" + }, + "computed": false + } + ] + } + ], + "body": { + "type": "NumericLiteral", + "start": 11, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "extra": { + "rawValue": 42, + "raw": "42" + }, + "value": 42 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/370/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/370/options.json index eb23932ac559..b412ffe6712f 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/370/options.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/370/options.json @@ -1,4 +1,3 @@ { - "sourceType": "script", - "throws": "Unexpected reserved word 'enum' (1:6)" -} \ No newline at end of file + "sourceType": "script" +} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/370/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/370/output.json new file mode 100644 index 000000000000..6f19d31ea58f --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/370/output.json @@ -0,0 +1,121 @@ +{ + "type": "File", + "start": 0, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "errors": [ + "SyntaxError: Unexpected reserved word 'enum' (1:6)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 0, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 6, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 10 + }, + "identifierName": "enum" + }, + "name": "enum" + }, + "init": { + "type": "CallExpression", + "start": 13, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "callee": { + "type": "Identifier", + "start": 13, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 16 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "arguments": [] + } + } + ], + "kind": "const" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/371/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/371/options.json index caa406928d15..2104ca43283f 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/371/options.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/371/options.json @@ -1,4 +1,3 @@ { - "sourceType": "module", - "throws": "Unexpected reserved word 'enum' (1:6)" -} \ No newline at end of file + "sourceType": "module" +} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/371/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/371/output.json new file mode 100644 index 000000000000..c6e70262550d --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/371/output.json @@ -0,0 +1,121 @@ +{ + "type": "File", + "start": 0, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "errors": [ + "SyntaxError: Unexpected reserved word 'enum' (1:6)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 0, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 6, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 10 + }, + "identifierName": "enum" + }, + "name": "enum" + }, + "init": { + "type": "CallExpression", + "start": 13, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "callee": { + "type": "Identifier", + "start": 13, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 16 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "arguments": [] + } + } + ], + "kind": "const" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/372/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/372/options.json index 1b022077e7c6..b412ffe6712f 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/372/options.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/372/options.json @@ -1,4 +1,3 @@ { - "sourceType": "script", - "throws": "Unexpected reserved word 'enum' (1:8)" -} \ No newline at end of file + "sourceType": "script" +} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/372/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/372/output.json new file mode 100644 index 000000000000..7da63dd7a987 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/372/output.json @@ -0,0 +1,176 @@ +{ + "type": "File", + "start": 0, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "errors": [ + "SyntaxError: Unexpected reserved word 'enum' (1:8)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 0, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 6, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "id": { + "type": "ObjectPattern", + "start": 6, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 8, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 8, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 12 + }, + "identifierName": "enum" + }, + "name": "enum" + }, + "computed": false, + "shorthand": true, + "value": { + "type": "Identifier", + "start": 8, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 12 + }, + "identifierName": "enum" + }, + "name": "enum" + }, + "extra": { + "shorthand": true + } + } + ] + }, + "init": { + "type": "CallExpression", + "start": 17, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "callee": { + "type": "Identifier", + "start": 17, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 20 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "arguments": [] + } + } + ], + "kind": "const" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/373/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/373/options.json index dd3434fd06e4..2104ca43283f 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/373/options.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/373/options.json @@ -1,4 +1,3 @@ { - "sourceType": "module", - "throws": "Unexpected reserved word 'enum' (1:8)" -} \ No newline at end of file + "sourceType": "module" +} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/373/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/373/output.json new file mode 100644 index 000000000000..f906a9f99eba --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/373/output.json @@ -0,0 +1,176 @@ +{ + "type": "File", + "start": 0, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "errors": [ + "SyntaxError: Unexpected reserved word 'enum' (1:8)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 0, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 6, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "id": { + "type": "ObjectPattern", + "start": 6, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 8, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 8, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 12 + }, + "identifierName": "enum" + }, + "name": "enum" + }, + "computed": false, + "shorthand": true, + "value": { + "type": "Identifier", + "start": 8, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 12 + }, + "identifierName": "enum" + }, + "name": "enum" + }, + "extra": { + "shorthand": true + } + } + ] + }, + "init": { + "type": "CallExpression", + "start": 17, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "callee": { + "type": "Identifier", + "start": 17, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 20 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "arguments": [] + } + } + ], + "kind": "const" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/374/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/374/options.json index e8900a801461..b412ffe6712f 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/374/options.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/374/options.json @@ -1,4 +1,3 @@ { - "sourceType": "script", - "throws": "Unexpected reserved word 'enum' (1:15)" -} \ No newline at end of file + "sourceType": "script" +} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/374/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/374/output.json new file mode 100644 index 000000000000..339a9b1d9aef --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/374/output.json @@ -0,0 +1,163 @@ +{ + "type": "File", + "start": 0, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "errors": [ + "SyntaxError: Unexpected reserved word 'enum' (1:15)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 12 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "ObjectPattern", + "start": 13, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 15, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 15, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 19 + }, + "identifierName": "enum" + }, + "name": "enum" + }, + "computed": false, + "shorthand": true, + "value": { + "type": "Identifier", + "start": 15, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 19 + }, + "identifierName": "enum" + }, + "name": "enum" + }, + "extra": { + "shorthand": true + } + } + ] + } + ], + "body": { + "type": "BlockStatement", + "start": 23, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "body": [], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/375/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/375/options.json index 8169da7d9069..2104ca43283f 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/375/options.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/375/options.json @@ -1,4 +1,3 @@ { - "sourceType": "module", - "throws": "Unexpected reserved word 'enum' (1:15)" -} \ No newline at end of file + "sourceType": "module" +} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/375/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/375/output.json new file mode 100644 index 000000000000..9ad60d6cf403 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/375/output.json @@ -0,0 +1,163 @@ +{ + "type": "File", + "start": 0, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "errors": [ + "SyntaxError: Unexpected reserved word 'enum' (1:15)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 12 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "ObjectPattern", + "start": 13, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 15, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 15, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 19 + }, + "identifierName": "enum" + }, + "name": "enum" + }, + "computed": false, + "shorthand": true, + "value": { + "type": "Identifier", + "start": 15, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 19 + }, + "identifierName": "enum" + }, + "name": "enum" + }, + "extra": { + "shorthand": true + } + } + ] + } + ], + "body": { + "type": "BlockStatement", + "start": 23, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "body": [], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/376/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/376/options.json index 24b609367ea8..b412ffe6712f 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/376/options.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/376/options.json @@ -1,4 +1,3 @@ { - "sourceType": "script", - "throws": "Unexpected reserved word 'enum' (1:9)" -} \ No newline at end of file + "sourceType": "script" +} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/376/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/376/output.json new file mode 100644 index 000000000000..ed7ac1e2953c --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/376/output.json @@ -0,0 +1,90 @@ +{ + "type": "File", + "start": 0, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "errors": [ + "SyntaxError: Unexpected reserved word 'enum' (1:9)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 13 + }, + "identifierName": "enum" + }, + "name": "enum" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 16, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "body": [], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/377/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/377/options.json index 51b7612a6eef..2104ca43283f 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/377/options.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/377/options.json @@ -1,4 +1,3 @@ { - "sourceType": "module", - "throws": "Unexpected reserved word 'enum' (1:9)" -} \ No newline at end of file + "sourceType": "module" +} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/377/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/377/output.json new file mode 100644 index 000000000000..7a06864215ea --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/377/output.json @@ -0,0 +1,90 @@ +{ + "type": "File", + "start": 0, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "errors": [ + "SyntaxError: Unexpected reserved word 'enum' (1:9)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 13 + }, + "identifierName": "enum" + }, + "name": "enum" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 16, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "body": [], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/378/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/378/options.json index eb23932ac559..b412ffe6712f 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/378/options.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/378/options.json @@ -1,4 +1,3 @@ { - "sourceType": "script", - "throws": "Unexpected reserved word 'enum' (1:6)" -} \ No newline at end of file + "sourceType": "script" +} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/378/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/378/output.json new file mode 100644 index 000000000000..04f287aef702 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/378/output.json @@ -0,0 +1,87 @@ +{ + "type": "File", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "errors": [ + "SyntaxError: Unexpected reserved word 'enum' (1:6)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 10 + }, + "identifierName": "enum" + }, + "name": "enum" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 11, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "body": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/379/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/379/options.json index caa406928d15..2104ca43283f 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/379/options.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/379/options.json @@ -1,4 +1,3 @@ { - "sourceType": "module", - "throws": "Unexpected reserved word 'enum' (1:6)" -} \ No newline at end of file + "sourceType": "module" +} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/379/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/379/output.json new file mode 100644 index 000000000000..0619ba17f596 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/379/output.json @@ -0,0 +1,87 @@ +{ + "type": "File", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "errors": [ + "SyntaxError: Unexpected reserved word 'enum' (1:6)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 10 + }, + "identifierName": "enum" + }, + "name": "enum" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 11, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "body": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/395/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/395/options.json index db72a6af957d..0861962d889d 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/395/options.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/395/options.json @@ -1,4 +1,3 @@ { - "createParenthesizedExpressions": true, - "throws": "Invalid left-hand side in arrow function parameters (1:2)" + "createParenthesizedExpressions": true } diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/395/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/395/output.json new file mode 100644 index 000000000000..074d84652acc --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/395/output.json @@ -0,0 +1,160 @@ +{ + "type": "File", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "errors": [ + "SyntaxError: Binding member expression (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "expression": { + "type": "ArrowFunctionExpression", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "ArrayPattern", + "start": 1, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "elements": [ + { + "type": "MemberExpression", + "start": 2, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "object": { + "type": "Identifier", + "start": 2, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + }, + "identifierName": "a" + }, + "name": "a" + }, + "property": { + "type": "Identifier", + "start": 4, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + }, + "identifierName": "a" + }, + "name": "a" + }, + "computed": false + } + ] + } + ], + "body": { + "type": "NumericLiteral", + "start": 11, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "extra": { + "rawValue": 42, + "raw": "42" + }, + "value": 42 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/yield/function-name-function-declaration-inside-generator/options.json b/packages/babel-parser/test/fixtures/es2015/yield/function-name-function-declaration-inside-generator/options.json deleted file mode 100644 index 37d7f62549c6..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/yield/function-name-function-declaration-inside-generator/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Can not use 'yield' as identifier inside a generator (2:11)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/yield/function-name-function-declaration-inside-generator/output.json b/packages/babel-parser/test/fixtures/es2015/yield/function-name-function-declaration-inside-generator/output.json new file mode 100644 index 000000000000..a545b4a024b1 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/yield/function-name-function-declaration-inside-generator/output.json @@ -0,0 +1,143 @@ +{ + "type": "File", + "start": 0, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Can not use 'yield' as identifier inside a generator (2:11)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 10, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 12 + }, + "identifierName": "fn" + }, + "name": "fn" + }, + "generator": true, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 15, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": [ + { + "type": "FunctionDeclaration", + "start": 19, + "end": 38, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 21 + } + }, + "id": { + "type": "Identifier", + "start": 28, + "end": 33, + "loc": { + "start": { + "line": 2, + "column": 11 + }, + "end": { + "line": 2, + "column": 16 + }, + "identifierName": "yield" + }, + "name": "yield" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 36, + "end": 38, + "loc": { + "start": { + "line": 2, + "column": 19 + }, + "end": { + "line": 2, + "column": 21 + } + }, + "body": [], + "directives": [] + } + } + ], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/yield/function-name-generator-expression/options.json b/packages/babel-parser/test/fixtures/es2015/yield/function-name-generator-expression/options.json deleted file mode 100644 index 72f8d0e0e4c3..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/yield/function-name-generator-expression/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Can not use 'yield' as identifier inside a generator (1:11)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/yield/function-name-generator-expression/output.json b/packages/babel-parser/test/fixtures/es2015/yield/function-name-generator-expression/output.json new file mode 100644 index 000000000000..39554296d4c3 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/yield/function-name-generator-expression/output.json @@ -0,0 +1,122 @@ +{ + "type": "File", + "start": 0, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "errors": [ + "SyntaxError: Can not use 'yield' as identifier inside a generator (1:11)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "expression": { + "type": "UnaryExpression", + "start": 0, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "operator": "+", + "prefix": true, + "argument": { + "type": "FunctionExpression", + "start": 1, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "id": { + "type": "Identifier", + "start": 11, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 16 + }, + "identifierName": "yield" + }, + "name": "yield" + }, + "generator": true, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 19, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "body": [], + "directives": [] + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/yield/function-name-strict-body/options.json b/packages/babel-parser/test/fixtures/es2015/yield/function-name-strict-body/options.json deleted file mode 100644 index 091e7958db52..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/yield/function-name-strict-body/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'yield' in strict mode (1:9)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/yield/function-name-strict-body/output.json b/packages/babel-parser/test/fixtures/es2015/yield/function-name-strict-body/output.json new file mode 100644 index 000000000000..1a8500a416fb --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/yield/function-name-strict-body/output.json @@ -0,0 +1,126 @@ +{ + "type": "File", + "start": 0, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "errors": [ + "SyntaxError: Binding 'yield' in strict mode (1:9)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "yield" + }, + "name": "yield" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "body": [], + "directives": [ + { + "type": "Directive", + "start": 19, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 19, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/yield/function-name-strict/options.json b/packages/babel-parser/test/fixtures/es2015/yield/function-name-strict/options.json deleted file mode 100644 index 320734ea2ef7..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/yield/function-name-strict/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected reserved word 'yield' (2:9)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/yield/function-name-strict/output.json b/packages/babel-parser/test/fixtures/es2015/yield/function-name-strict/output.json new file mode 100644 index 000000000000..19d96b67a349 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/yield/function-name-strict/output.json @@ -0,0 +1,126 @@ +{ + "type": "File", + "start": 0, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 19 + } + }, + "errors": [ + "SyntaxError: Unexpected reserved word 'yield' (2:9)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 19 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 14, + "end": 33, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 19 + } + }, + "id": { + "type": "Identifier", + "start": 23, + "end": 28, + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 14 + }, + "identifierName": "yield" + }, + "name": "yield" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 31, + "end": 33, + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 19 + } + }, + "body": [], + "directives": [] + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/yield/in-class-heritage/options.json b/packages/babel-parser/test/fixtures/es2015/yield/in-class-heritage/options.json index e817f30acb5c..7fc68d96502e 100644 --- a/packages/babel-parser/test/fixtures/es2015/yield/in-class-heritage/options.json +++ b/packages/babel-parser/test/fixtures/es2015/yield/in-class-heritage/options.json @@ -1,3 +1,3 @@ { - "throws": "Unexpected reserved word 'yield' (1:16)" + "throws": "Unexpected token, expected \"{\" (1:22)" } diff --git a/packages/babel-parser/test/fixtures/es2015/yield/in-iterator-stmt/options.json b/packages/babel-parser/test/fixtures/es2015/yield/in-iterator-stmt/options.json index ad46a65e5082..0ab4d8e9bc1c 100644 --- a/packages/babel-parser/test/fixtures/es2015/yield/in-iterator-stmt/options.json +++ b/packages/babel-parser/test/fixtures/es2015/yield/in-iterator-stmt/options.json @@ -1,3 +1,3 @@ { - "throws": "Invalid left-hand side in for-in statement (2:7)" + "throws": "Unexpected token, expected \")\" (2:21)" } diff --git a/packages/babel-parser/test/fixtures/es2015/yield/parameter-default-inside-arrow-inside-generator-1/options.json b/packages/babel-parser/test/fixtures/es2015/yield/parameter-default-inside-arrow-inside-generator-1/options.json deleted file mode 100644 index 75b3f62fdacb..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/yield/parameter-default-inside-arrow-inside-generator-1/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Yield cannot be used as name inside a generator function (2:7)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/yield/parameter-default-inside-arrow-inside-generator-1/output.json b/packages/babel-parser/test/fixtures/es2015/yield/parameter-default-inside-arrow-inside-generator-1/output.json new file mode 100644 index 000000000000..6639d749ab68 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/yield/parameter-default-inside-arrow-inside-generator-1/output.json @@ -0,0 +1,192 @@ +{ + "type": "File", + "start": 0, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Yield cannot be used as name inside a generator function (2:7)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 10, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 12 + }, + "identifierName": "fn" + }, + "name": "fn" + }, + "generator": true, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 15, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 19, + "end": 37, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 20 + } + }, + "expression": { + "type": "ArrowFunctionExpression", + "start": 19, + "end": 36, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 19 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "AssignmentPattern", + "start": 20, + "end": 29, + "loc": { + "start": { + "line": 2, + "column": 3 + }, + "end": { + "line": 2, + "column": 12 + } + }, + "left": { + "type": "Identifier", + "start": 20, + "end": 21, + "loc": { + "start": { + "line": 2, + "column": 3 + }, + "end": { + "line": 2, + "column": 4 + }, + "identifierName": "x" + }, + "name": "x" + }, + "right": { + "type": "YieldExpression", + "start": 24, + "end": 29, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 12 + } + }, + "delegate": false, + "argument": null + } + } + ], + "body": { + "type": "BlockStatement", + "start": 34, + "end": 36, + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 19 + } + }, + "body": [], + "directives": [] + } + } + } + ], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/yield/parameter-default-inside-arrow-inside-generator-2/options.json b/packages/babel-parser/test/fixtures/es2015/yield/parameter-default-inside-arrow-inside-generator-2/options.json deleted file mode 100644 index 9d35f54190c8..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/yield/parameter-default-inside-arrow-inside-generator-2/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Yield cannot be used as name inside a generator function (2:15)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/yield/parameter-default-inside-arrow-inside-generator-2/output.json b/packages/babel-parser/test/fixtures/es2015/yield/parameter-default-inside-arrow-inside-generator-2/output.json new file mode 100644 index 000000000000..b029ca9f0ce9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/yield/parameter-default-inside-arrow-inside-generator-2/output.json @@ -0,0 +1,331 @@ +{ + "type": "File", + "start": 0, + "end": 53, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Yield cannot be used as name inside a generator function (2:15)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 53, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 53, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 10, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 12 + }, + "identifierName": "fn" + }, + "name": "fn" + }, + "generator": true, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 15, + "end": 53, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 19, + "end": 51, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 34 + } + }, + "expression": { + "type": "ArrowFunctionExpression", + "start": 19, + "end": 50, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 33 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "AssignmentPattern", + "start": 20, + "end": 43, + "loc": { + "start": { + "line": 2, + "column": 3 + }, + "end": { + "line": 2, + "column": 26 + } + }, + "left": { + "type": "Identifier", + "start": 20, + "end": 21, + "loc": { + "start": { + "line": 2, + "column": 3 + }, + "end": { + "line": 2, + "column": 4 + }, + "identifierName": "x" + }, + "name": "x" + }, + "right": { + "type": "BinaryExpression", + "start": 24, + "end": 43, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 26 + } + }, + "left": { + "type": "NumericLiteral", + "start": 24, + "end": 25, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 8 + } + }, + "extra": { + "rawValue": 3, + "raw": "3" + }, + "value": 3 + }, + "operator": "+", + "right": { + "type": "BinaryExpression", + "start": 28, + "end": 43, + "loc": { + "start": { + "line": 2, + "column": 11 + }, + "end": { + "line": 2, + "column": 26 + } + }, + "left": { + "type": "CallExpression", + "start": 28, + "end": 38, + "loc": { + "start": { + "line": 2, + "column": 11 + }, + "end": { + "line": 2, + "column": 21 + } + }, + "callee": { + "type": "MemberExpression", + "start": 28, + "end": 31, + "loc": { + "start": { + "line": 2, + "column": 11 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "object": { + "type": "Identifier", + "start": 28, + "end": 29, + "loc": { + "start": { + "line": 2, + "column": 11 + }, + "end": { + "line": 2, + "column": 12 + }, + "identifierName": "a" + }, + "name": "a" + }, + "property": { + "type": "Identifier", + "start": 30, + "end": 31, + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 14 + }, + "identifierName": "b" + }, + "name": "b" + }, + "computed": false + }, + "arguments": [ + { + "type": "YieldExpression", + "start": 32, + "end": 37, + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 20 + } + }, + "delegate": false, + "argument": null + } + ] + }, + "operator": "**", + "right": { + "type": "NumericLiteral", + "start": 42, + "end": 43, + "loc": { + "start": { + "line": 2, + "column": 25 + }, + "end": { + "line": 2, + "column": 26 + } + }, + "extra": { + "rawValue": 2, + "raw": "2" + }, + "value": 2 + } + } + } + } + ], + "body": { + "type": "BlockStatement", + "start": 48, + "end": 50, + "loc": { + "start": { + "line": 2, + "column": 31 + }, + "end": { + "line": 2, + "column": 33 + } + }, + "body": [], + "directives": [] + } + } + } + ], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/yield/parameter-default-inside-arrow-inside-generator-3/options.json b/packages/babel-parser/test/fixtures/es2015/yield/parameter-default-inside-arrow-inside-generator-3/options.json deleted file mode 100644 index 75b3f62fdacb..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/yield/parameter-default-inside-arrow-inside-generator-3/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Yield cannot be used as name inside a generator function (2:7)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/yield/parameter-default-inside-arrow-inside-generator-3/output.json b/packages/babel-parser/test/fixtures/es2015/yield/parameter-default-inside-arrow-inside-generator-3/output.json new file mode 100644 index 000000000000..7ce61876e0a8 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/yield/parameter-default-inside-arrow-inside-generator-3/output.json @@ -0,0 +1,208 @@ +{ + "type": "File", + "start": 0, + "end": 42, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Yield cannot be used as name inside a generator function (2:7)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 42, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 42, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 10, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 12 + }, + "identifierName": "fn" + }, + "name": "fn" + }, + "generator": true, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 15, + "end": 42, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 19, + "end": 40, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 23 + } + }, + "expression": { + "type": "ArrowFunctionExpression", + "start": 19, + "end": 39, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 22 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "AssignmentPattern", + "start": 20, + "end": 32, + "loc": { + "start": { + "line": 2, + "column": 3 + }, + "end": { + "line": 2, + "column": 15 + } + }, + "left": { + "type": "Identifier", + "start": 20, + "end": 21, + "loc": { + "start": { + "line": 2, + "column": 3 + }, + "end": { + "line": 2, + "column": 4 + }, + "identifierName": "x" + }, + "name": "x" + }, + "right": { + "type": "YieldExpression", + "start": 24, + "end": 32, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 15 + } + }, + "delegate": false, + "argument": { + "type": "Identifier", + "start": 30, + "end": 32, + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 15 + }, + "identifierName": "fn" + }, + "name": "fn" + } + } + } + ], + "body": { + "type": "BlockStatement", + "start": 37, + "end": 39, + "loc": { + "start": { + "line": 2, + "column": 20 + }, + "end": { + "line": 2, + "column": 22 + } + }, + "body": [], + "directives": [] + } + } + } + ], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/yield/parameter-default-inside-arrow-inside-generator-4/options.json b/packages/babel-parser/test/fixtures/es2015/yield/parameter-default-inside-arrow-inside-generator-4/options.json deleted file mode 100644 index b3ac060855bb..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/yield/parameter-default-inside-arrow-inside-generator-4/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Yield cannot be used as name inside a generator function (2:17)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/yield/parameter-default-inside-arrow-inside-generator-4/output.json b/packages/babel-parser/test/fixtures/es2015/yield/parameter-default-inside-arrow-inside-generator-4/output.json new file mode 100644 index 000000000000..e88af5b40a30 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/yield/parameter-default-inside-arrow-inside-generator-4/output.json @@ -0,0 +1,261 @@ +{ + "type": "File", + "start": 0, + "end": 49, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Yield cannot be used as name inside a generator function (2:17)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 49, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 49, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 10, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 12 + }, + "identifierName": "fn" + }, + "name": "fn" + }, + "generator": true, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 15, + "end": 49, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 19, + "end": 47, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 30 + } + }, + "expression": { + "type": "ArrowFunctionExpression", + "start": 19, + "end": 46, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 29 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 20, + "end": 21, + "loc": { + "start": { + "line": 2, + "column": 3 + }, + "end": { + "line": 2, + "column": 4 + }, + "identifierName": "a" + }, + "name": "a" + }, + { + "type": "AssignmentPattern", + "start": 23, + "end": 28, + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 11 + } + }, + "left": { + "type": "Identifier", + "start": 23, + "end": 24, + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 7 + }, + "identifierName": "b" + }, + "name": "b" + }, + "right": { + "type": "NumericLiteral", + "start": 27, + "end": 28, + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 11 + } + }, + "extra": { + "rawValue": 3, + "raw": "3" + }, + "value": 3 + } + }, + { + "type": "AssignmentPattern", + "start": 30, + "end": 39, + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 22 + } + }, + "left": { + "type": "Identifier", + "start": 30, + "end": 31, + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 14 + }, + "identifierName": "x" + }, + "name": "x" + }, + "right": { + "type": "YieldExpression", + "start": 34, + "end": 39, + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 22 + } + }, + "delegate": false, + "argument": null + } + } + ], + "body": { + "type": "BlockStatement", + "start": 44, + "end": 46, + "loc": { + "start": { + "line": 2, + "column": 27 + }, + "end": { + "line": 2, + "column": 29 + } + }, + "body": [], + "directives": [] + } + } + } + ], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/yield/parameter-default-inside-arrow-inside-generator-5/options.json b/packages/babel-parser/test/fixtures/es2015/yield/parameter-default-inside-arrow-inside-generator-5/options.json deleted file mode 100644 index 379c08c57e90..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/yield/parameter-default-inside-arrow-inside-generator-5/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Yield cannot be used as name inside a generator function (2:8)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/yield/parameter-default-inside-arrow-inside-generator-5/output.json b/packages/babel-parser/test/fixtures/es2015/yield/parameter-default-inside-arrow-inside-generator-5/output.json new file mode 100644 index 000000000000..30bb59f8c609 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/yield/parameter-default-inside-arrow-inside-generator-5/output.json @@ -0,0 +1,230 @@ +{ + "type": "File", + "start": 0, + "end": 47, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Yield cannot be used as name inside a generator function (2:8)", + "SyntaxError: Binding invalid left-hand side in function parameter list (2:8)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 47, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 47, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 10, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 12 + }, + "identifierName": "fn" + }, + "name": "fn" + }, + "generator": true, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 15, + "end": 47, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 19, + "end": 45, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 28 + } + }, + "expression": { + "type": "ArrowFunctionExpression", + "start": 19, + "end": 44, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 27 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "AssignmentPattern", + "start": 20, + "end": 37, + "loc": { + "start": { + "line": 2, + "column": 3 + }, + "end": { + "line": 2, + "column": 20 + } + }, + "left": { + "type": "Identifier", + "start": 20, + "end": 21, + "loc": { + "start": { + "line": 2, + "column": 3 + }, + "end": { + "line": 2, + "column": 4 + }, + "identifierName": "x" + }, + "name": "x" + }, + "right": { + "type": "ArrowFunctionExpression", + "start": 24, + "end": 37, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 20 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "YieldExpression", + "start": 25, + "end": 30, + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 13 + } + }, + "delegate": false, + "argument": null + } + ], + "body": { + "type": "BlockStatement", + "start": 35, + "end": 37, + "loc": { + "start": { + "line": 2, + "column": 18 + }, + "end": { + "line": 2, + "column": 20 + } + }, + "body": [], + "directives": [] + } + } + } + ], + "body": { + "type": "BlockStatement", + "start": 42, + "end": 44, + "loc": { + "start": { + "line": 2, + "column": 25 + }, + "end": { + "line": 2, + "column": 27 + } + }, + "body": [], + "directives": [] + } + } + } + ], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/yield/parameter-default-inside-arrow-inside-generator-6/options.json b/packages/babel-parser/test/fixtures/es2015/yield/parameter-default-inside-arrow-inside-generator-6/options.json deleted file mode 100644 index 379c08c57e90..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/yield/parameter-default-inside-arrow-inside-generator-6/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Yield cannot be used as name inside a generator function (2:8)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/yield/parameter-default-inside-arrow-inside-generator-6/output.json b/packages/babel-parser/test/fixtures/es2015/yield/parameter-default-inside-arrow-inside-generator-6/output.json new file mode 100644 index 000000000000..ce92441a5734 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/yield/parameter-default-inside-arrow-inside-generator-6/output.json @@ -0,0 +1,196 @@ +{ + "type": "File", + "start": 0, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Yield cannot be used as name inside a generator function (2:8)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 10, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 12 + }, + "identifierName": "fn" + }, + "name": "fn" + }, + "generator": true, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 15, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 19, + "end": 39, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 22 + } + }, + "expression": { + "type": "ArrowFunctionExpression", + "start": 19, + "end": 38, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 21 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "AssignmentPattern", + "start": 20, + "end": 31, + "loc": { + "start": { + "line": 2, + "column": 3 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "left": { + "type": "Identifier", + "start": 20, + "end": 21, + "loc": { + "start": { + "line": 2, + "column": 3 + }, + "end": { + "line": 2, + "column": 4 + }, + "identifierName": "x" + }, + "name": "x" + }, + "right": { + "type": "YieldExpression", + "start": 25, + "end": 30, + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 13 + } + }, + "delegate": false, + "argument": null, + "extra": { + "parenthesized": true, + "parenStart": 24 + } + } + } + ], + "body": { + "type": "BlockStatement", + "start": 36, + "end": 38, + "loc": { + "start": { + "line": 2, + "column": 19 + }, + "end": { + "line": 2, + "column": 21 + } + }, + "body": [], + "directives": [] + } + } + } + ], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/yield/parameter-default-inside-generator-method/options.json b/packages/babel-parser/test/fixtures/es2015/yield/parameter-default-inside-generator-method/options.json deleted file mode 100644 index 6f5bd40fe357..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/yield/parameter-default-inside-generator-method/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "yield is not allowed in generator parameters (1:15)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/yield/parameter-default-inside-generator-method/output.json b/packages/babel-parser/test/fixtures/es2015/yield/parameter-default-inside-generator-method/output.json new file mode 100644 index 000000000000..a2234a6938db --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/yield/parameter-default-inside-generator-method/output.json @@ -0,0 +1,180 @@ +{ + "type": "File", + "start": 0, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "errors": [ + "SyntaxError: yield is not allowed in generator parameters (1:15)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "expression": { + "type": "ObjectExpression", + "start": 1, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "properties": [ + { + "type": "ObjectMethod", + "start": 3, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "method": true, + "key": { + "type": "Identifier", + "start": 4, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 10 + }, + "identifierName": "method" + }, + "name": "method" + }, + "computed": false, + "kind": "method", + "id": null, + "generator": true, + "async": false, + "params": [ + { + "type": "AssignmentPattern", + "start": 11, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "left": { + "type": "Identifier", + "start": 11, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + }, + "identifierName": "x" + }, + "name": "x" + }, + "right": { + "type": "YieldExpression", + "start": 15, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "delegate": false, + "argument": null + } + } + ], + "body": { + "type": "BlockStatement", + "start": 22, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "body": [], + "directives": [] + } + } + ], + "extra": { + "parenthesized": true, + "parenStart": 0 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/yield/parameter-default-inside-generator/options.json b/packages/babel-parser/test/fixtures/es2015/yield/parameter-default-inside-generator/options.json deleted file mode 100644 index dd9a684ef928..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/yield/parameter-default-inside-generator/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "yield is not allowed in generator parameters (1:17)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/yield/parameter-default-inside-generator/output.json b/packages/babel-parser/test/fixtures/es2015/yield/parameter-default-inside-generator/output.json new file mode 100644 index 000000000000..b21c88bc4f9f --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/yield/parameter-default-inside-generator/output.json @@ -0,0 +1,140 @@ +{ + "type": "File", + "start": 0, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "errors": [ + "SyntaxError: yield is not allowed in generator parameters (1:17)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "id": { + "type": "Identifier", + "start": 10, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 12 + }, + "identifierName": "fn" + }, + "name": "fn" + }, + "generator": true, + "async": false, + "params": [ + { + "type": "AssignmentPattern", + "start": 13, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "left": { + "type": "Identifier", + "start": 13, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "x" + }, + "name": "x" + }, + "right": { + "type": "YieldExpression", + "start": 17, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "delegate": false, + "argument": null + } + } + ], + "body": { + "type": "BlockStatement", + "start": 24, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "body": [], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/yield/parameter-default-strict/options.json b/packages/babel-parser/test/fixtures/es2015/yield/parameter-default-strict/options.json deleted file mode 100644 index ecc179f974cb..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/yield/parameter-default-strict/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected reserved word 'yield' (2:16)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/yield/parameter-default-strict/output.json b/packages/babel-parser/test/fixtures/es2015/yield/parameter-default-strict/output.json new file mode 100644 index 000000000000..e051b9ac1378 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/yield/parameter-default-strict/output.json @@ -0,0 +1,176 @@ +{ + "type": "File", + "start": 0, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 25 + } + }, + "errors": [ + "SyntaxError: Unexpected reserved word 'yield' (2:16)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 25 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 14, + "end": 39, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 25 + } + }, + "id": { + "type": "Identifier", + "start": 23, + "end": 25, + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 11 + }, + "identifierName": "fn" + }, + "name": "fn" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "AssignmentPattern", + "start": 26, + "end": 35, + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 21 + } + }, + "left": { + "type": "Identifier", + "start": 26, + "end": 27, + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 13 + }, + "identifierName": "x" + }, + "name": "x" + }, + "right": { + "type": "Identifier", + "start": 30, + "end": 35, + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 21 + }, + "identifierName": "yield" + }, + "name": "yield" + } + } + ], + "body": { + "type": "BlockStatement", + "start": 37, + "end": 39, + "loc": { + "start": { + "line": 2, + "column": 23 + }, + "end": { + "line": 2, + "column": 25 + } + }, + "body": [], + "directives": [] + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/yield/parameter-name-arrow-inside-generator-1/options.json b/packages/babel-parser/test/fixtures/es2015/yield/parameter-name-arrow-inside-generator-1/options.json deleted file mode 100644 index b566d4944c2c..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/yield/parameter-name-arrow-inside-generator-1/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Yield cannot be used as name inside a generator function (2:3)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/yield/parameter-name-arrow-inside-generator-1/output.json b/packages/babel-parser/test/fixtures/es2015/yield/parameter-name-arrow-inside-generator-1/output.json new file mode 100644 index 000000000000..1bec942c71ac --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/yield/parameter-name-arrow-inside-generator-1/output.json @@ -0,0 +1,161 @@ +{ + "type": "File", + "start": 0, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Yield cannot be used as name inside a generator function (2:3)", + "SyntaxError: Binding invalid left-hand side in function parameter list (2:3)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 10, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 12 + }, + "identifierName": "fn" + }, + "name": "fn" + }, + "generator": true, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 15, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 19, + "end": 33, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 16 + } + }, + "expression": { + "type": "ArrowFunctionExpression", + "start": 19, + "end": 32, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 15 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "YieldExpression", + "start": 20, + "end": 25, + "loc": { + "start": { + "line": 2, + "column": 3 + }, + "end": { + "line": 2, + "column": 8 + } + }, + "delegate": false, + "argument": null + } + ], + "body": { + "type": "BlockStatement", + "start": 30, + "end": 32, + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 15 + } + }, + "body": [], + "directives": [] + } + } + } + ], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/yield/parameter-name-arrow-inside-generator-2/options.json b/packages/babel-parser/test/fixtures/es2015/yield/parameter-name-arrow-inside-generator-2/options.json deleted file mode 100644 index b566d4944c2c..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/yield/parameter-name-arrow-inside-generator-2/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Yield cannot be used as name inside a generator function (2:3)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/yield/parameter-name-arrow-inside-generator-2/output.json b/packages/babel-parser/test/fixtures/es2015/yield/parameter-name-arrow-inside-generator-2/output.json new file mode 100644 index 000000000000..3c16beba8cdf --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/yield/parameter-name-arrow-inside-generator-2/output.json @@ -0,0 +1,177 @@ +{ + "type": "File", + "start": 0, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Yield cannot be used as name inside a generator function (2:3)", + "SyntaxError: Binding invalid left-hand side in function parameter list (2:3)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 10, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 12 + }, + "identifierName": "fn" + }, + "name": "fn" + }, + "generator": true, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 15, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 19, + "end": 36, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 19 + } + }, + "expression": { + "type": "ArrowFunctionExpression", + "start": 19, + "end": 35, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 18 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "YieldExpression", + "start": 20, + "end": 28, + "loc": { + "start": { + "line": 2, + "column": 3 + }, + "end": { + "line": 2, + "column": 11 + } + }, + "delegate": false, + "argument": { + "type": "Identifier", + "start": 26, + "end": 28, + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 11 + }, + "identifierName": "fn" + }, + "name": "fn" + } + } + ], + "body": { + "type": "BlockStatement", + "start": 33, + "end": 35, + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 18 + } + }, + "body": [], + "directives": [] + } + } + } + ], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/yield/parameter-name-arrow-inside-generator-3/options.json b/packages/babel-parser/test/fixtures/es2015/yield/parameter-name-arrow-inside-generator-3/options.json deleted file mode 100644 index 479a9a79f900..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/yield/parameter-name-arrow-inside-generator-3/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Yield cannot be used as name inside a generator function (2:9)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/yield/parameter-name-arrow-inside-generator-3/output.json b/packages/babel-parser/test/fixtures/es2015/yield/parameter-name-arrow-inside-generator-3/output.json new file mode 100644 index 000000000000..18209649f3a6 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/yield/parameter-name-arrow-inside-generator-3/output.json @@ -0,0 +1,195 @@ +{ + "type": "File", + "start": 0, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Yield cannot be used as name inside a generator function (2:9)", + "SyntaxError: Binding invalid left-hand side in function parameter list (2:9)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 10, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 12 + }, + "identifierName": "fn" + }, + "name": "fn" + }, + "generator": true, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 15, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 19, + "end": 39, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 22 + } + }, + "expression": { + "type": "ArrowFunctionExpression", + "start": 19, + "end": 38, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 21 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 20, + "end": 21, + "loc": { + "start": { + "line": 2, + "column": 3 + }, + "end": { + "line": 2, + "column": 4 + }, + "identifierName": "a" + }, + "name": "a" + }, + { + "type": "Identifier", + "start": 23, + "end": 24, + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 7 + }, + "identifierName": "b" + }, + "name": "b" + }, + { + "type": "YieldExpression", + "start": 26, + "end": 31, + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "delegate": false, + "argument": null + } + ], + "body": { + "type": "BlockStatement", + "start": 36, + "end": 38, + "loc": { + "start": { + "line": 2, + "column": 19 + }, + "end": { + "line": 2, + "column": 21 + } + }, + "body": [], + "directives": [] + } + } + } + ], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/yield/parameter-name-generator-method/options.json b/packages/babel-parser/test/fixtures/es2015/yield/parameter-name-generator-method/options.json deleted file mode 100644 index 72f8d0e0e4c3..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/yield/parameter-name-generator-method/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Can not use 'yield' as identifier inside a generator (1:11)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/yield/parameter-name-generator-method/output.json b/packages/babel-parser/test/fixtures/es2015/yield/parameter-name-generator-method/output.json new file mode 100644 index 000000000000..2a15b906e992 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/yield/parameter-name-generator-method/output.json @@ -0,0 +1,148 @@ +{ + "type": "File", + "start": 0, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "errors": [ + "SyntaxError: Can not use 'yield' as identifier inside a generator (1:11)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "expression": { + "type": "ObjectExpression", + "start": 1, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "properties": [ + { + "type": "ObjectMethod", + "start": 3, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "method": true, + "key": { + "type": "Identifier", + "start": 4, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 10 + }, + "identifierName": "method" + }, + "name": "method" + }, + "computed": false, + "kind": "method", + "id": null, + "generator": true, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 11, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 16 + }, + "identifierName": "yield" + }, + "name": "yield" + } + ], + "body": { + "type": "BlockStatement", + "start": 18, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "body": [], + "directives": [] + } + } + ], + "extra": { + "parenthesized": true, + "parenStart": 0 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/yield/parameter-name-generator/options.json b/packages/babel-parser/test/fixtures/es2015/yield/parameter-name-generator/options.json deleted file mode 100644 index dcab4205d32f..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/yield/parameter-name-generator/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Can not use 'yield' as identifier inside a generator (1:13)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/yield/parameter-name-generator/output.json b/packages/babel-parser/test/fixtures/es2015/yield/parameter-name-generator/output.json new file mode 100644 index 000000000000..a8a1424ee419 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/yield/parameter-name-generator/output.json @@ -0,0 +1,108 @@ +{ + "type": "File", + "start": 0, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "errors": [ + "SyntaxError: Can not use 'yield' as identifier inside a generator (1:13)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "id": { + "type": "Identifier", + "start": 10, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 12 + }, + "identifierName": "fn" + }, + "name": "fn" + }, + "generator": true, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 13, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 18 + }, + "identifierName": "yield" + }, + "name": "yield" + } + ], + "body": { + "type": "BlockStatement", + "start": 20, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "body": [], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/yield/parameter-name-strict-body/options.json b/packages/babel-parser/test/fixtures/es2015/yield/parameter-name-strict-body/options.json deleted file mode 100644 index cb8efaaa0aff..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/yield/parameter-name-strict-body/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'yield' in strict mode (1:12)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/yield/parameter-name-strict-body/output.json b/packages/babel-parser/test/fixtures/es2015/yield/parameter-name-strict-body/output.json new file mode 100644 index 000000000000..ad17fc3ec47d --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/yield/parameter-name-strict-body/output.json @@ -0,0 +1,144 @@ +{ + "type": "File", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "errors": [ + "SyntaxError: Binding 'yield' in strict mode (1:12)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 11 + }, + "identifierName": "fn" + }, + "name": "fn" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 12, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 17 + }, + "identifierName": "yield" + }, + "name": "yield" + } + ], + "body": { + "type": "BlockStatement", + "start": 19, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "body": [], + "directives": [ + { + "type": "Directive", + "start": 21, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 21, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/yield/parameter-name-strict/options.json b/packages/babel-parser/test/fixtures/es2015/yield/parameter-name-strict/options.json deleted file mode 100644 index 75bdf3d53d6e..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/yield/parameter-name-strict/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected reserved word 'yield' (2:12)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/yield/parameter-name-strict/output.json b/packages/babel-parser/test/fixtures/es2015/yield/parameter-name-strict/output.json new file mode 100644 index 000000000000..ac0ac6a92f89 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/yield/parameter-name-strict/output.json @@ -0,0 +1,144 @@ +{ + "type": "File", + "start": 0, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 21 + } + }, + "errors": [ + "SyntaxError: Unexpected reserved word 'yield' (2:12)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 21 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 14, + "end": 35, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 21 + } + }, + "id": { + "type": "Identifier", + "start": 23, + "end": 25, + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 11 + }, + "identifierName": "fn" + }, + "name": "fn" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 26, + "end": 31, + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 17 + }, + "identifierName": "yield" + }, + "name": "yield" + } + ], + "body": { + "type": "BlockStatement", + "start": 33, + "end": 35, + "loc": { + "start": { + "line": 2, + "column": 19 + }, + "end": { + "line": 2, + "column": 21 + } + }, + "body": [], + "directives": [] + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/yield/yield-star-parameter-default-inside-generator/options.json b/packages/babel-parser/test/fixtures/es2015/yield/yield-star-parameter-default-inside-generator/options.json deleted file mode 100644 index dd9a684ef928..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/yield/yield-star-parameter-default-inside-generator/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "yield is not allowed in generator parameters (1:17)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/yield/yield-star-parameter-default-inside-generator/output.json b/packages/babel-parser/test/fixtures/es2015/yield/yield-star-parameter-default-inside-generator/output.json new file mode 100644 index 000000000000..77a0a58b8e3b --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/yield/yield-star-parameter-default-inside-generator/output.json @@ -0,0 +1,157 @@ +{ + "type": "File", + "start": 0, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "errors": [ + "SyntaxError: yield is not allowed in generator parameters (1:17)", + "SyntaxError: yield is not allowed in generator parameters (1:24)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "id": { + "type": "Identifier", + "start": 10, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 12 + }, + "identifierName": "fn" + }, + "name": "fn" + }, + "generator": true, + "async": false, + "params": [ + { + "type": "AssignmentPattern", + "start": 13, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "left": { + "type": "Identifier", + "start": 13, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "x" + }, + "name": "x" + }, + "right": { + "type": "YieldExpression", + "start": 17, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "delegate": true, + "argument": { + "type": "YieldExpression", + "start": 24, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "delegate": false, + "argument": null + } + } + } + ], + "body": { + "type": "BlockStatement", + "start": 31, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 31 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "body": [], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2016/exponentiation-operator/10/options.json b/packages/babel-parser/test/fixtures/es2016/exponentiation-operator/10/options.json deleted file mode 100644 index 2c624e8cec70..000000000000 --- a/packages/babel-parser/test/fixtures/es2016/exponentiation-operator/10/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Illegal expression. Wrap left hand side or entire exponentiation in parentheses. (1:1)" -} diff --git a/packages/babel-parser/test/fixtures/es2016/exponentiation-operator/10/output.json b/packages/babel-parser/test/fixtures/es2016/exponentiation-operator/10/output.json new file mode 100644 index 000000000000..99a1c0eac6e6 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2016/exponentiation-operator/10/output.json @@ -0,0 +1,126 @@ +{ + "type": "File", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "errors": [ + "SyntaxError: Illegal expression. Wrap left hand side or entire exponentiation in parentheses. (1:1)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "expression": { + "type": "BinaryExpression", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "left": { + "type": "UnaryExpression", + "start": 0, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "operator": "-", + "prefix": true, + "argument": { + "type": "NumericLiteral", + "start": 1, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "extra": { + "rawValue": 5, + "raw": "5" + }, + "value": 5 + } + }, + "operator": "**", + "right": { + "type": "NumericLiteral", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "extra": { + "rawValue": 6, + "raw": "6" + }, + "value": 6 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2016/exponentiation-operator/11/options.json b/packages/babel-parser/test/fixtures/es2016/exponentiation-operator/11/options.json deleted file mode 100644 index f04c5c035abb..000000000000 --- a/packages/babel-parser/test/fixtures/es2016/exponentiation-operator/11/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Illegal expression. Wrap left hand side or entire exponentiation in parentheses. (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/es2016/exponentiation-operator/11/output.json b/packages/babel-parser/test/fixtures/es2016/exponentiation-operator/11/output.json new file mode 100644 index 000000000000..8bfc60ddbdbc --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2016/exponentiation-operator/11/output.json @@ -0,0 +1,128 @@ +{ + "type": "File", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "errors": [ + "SyntaxError: Illegal expression. Wrap left hand side or entire exponentiation in parentheses. (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "expression": { + "type": "BinaryExpression", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "left": { + "type": "UnaryExpression", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "operator": "-", + "prefix": true, + "argument": { + "type": "NumericLiteral", + "start": 2, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "extra": { + "rawValue": 5, + "raw": "5", + "parenthesized": true, + "parenStart": 1 + }, + "value": 5 + } + }, + "operator": "**", + "right": { + "type": "NumericLiteral", + "start": 8, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "extra": { + "rawValue": 6, + "raw": "6" + }, + "value": 6 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2016/exponentiation-operator/12/options.json b/packages/babel-parser/test/fixtures/es2016/exponentiation-operator/12/options.json deleted file mode 100644 index f04c5c035abb..000000000000 --- a/packages/babel-parser/test/fixtures/es2016/exponentiation-operator/12/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Illegal expression. Wrap left hand side or entire exponentiation in parentheses. (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/es2016/exponentiation-operator/12/output.json b/packages/babel-parser/test/fixtures/es2016/exponentiation-operator/12/output.json new file mode 100644 index 000000000000..1a7be0b48b55 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2016/exponentiation-operator/12/output.json @@ -0,0 +1,130 @@ +{ + "type": "File", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "errors": [ + "SyntaxError: Illegal expression. Wrap left hand side or entire exponentiation in parentheses. (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "expression": { + "type": "BinaryExpression", + "start": 1, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "left": { + "type": "UnaryExpression", + "start": 1, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "operator": "-", + "prefix": true, + "argument": { + "type": "NumericLiteral", + "start": 2, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "extra": { + "rawValue": 5, + "raw": "5" + }, + "value": 5 + } + }, + "operator": "**", + "right": { + "type": "NumericLiteral", + "start": 7, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "extra": { + "rawValue": 6, + "raw": "6" + }, + "value": 6 + }, + "extra": { + "parenthesized": true, + "parenStart": 0 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2016/exponentiation-operator/15/options.json b/packages/babel-parser/test/fixtures/es2016/exponentiation-operator/15/options.json index c694133bf2b1..0861962d889d 100644 --- a/packages/babel-parser/test/fixtures/es2016/exponentiation-operator/15/options.json +++ b/packages/babel-parser/test/fixtures/es2016/exponentiation-operator/15/options.json @@ -1,4 +1,3 @@ { - "createParenthesizedExpressions": true, - "throws": "Illegal expression. Wrap left hand side or entire exponentiation in parentheses. (1:1)" + "createParenthesizedExpressions": true } diff --git a/packages/babel-parser/test/fixtures/es2016/exponentiation-operator/15/output.json b/packages/babel-parser/test/fixtures/es2016/exponentiation-operator/15/output.json new file mode 100644 index 000000000000..56e0b17f480e --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2016/exponentiation-operator/15/output.json @@ -0,0 +1,141 @@ +{ + "type": "File", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "errors": [ + "SyntaxError: Illegal expression. Wrap left hand side or entire exponentiation in parentheses. (1:1)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "expression": { + "type": "BinaryExpression", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "left": { + "type": "UnaryExpression", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "operator": "-", + "prefix": true, + "argument": { + "type": "ParenthesizedExpression", + "start": 1, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 2, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "extra": { + "rawValue": 5, + "raw": "5" + }, + "value": 5 + } + } + }, + "operator": "**", + "right": { + "type": "NumericLiteral", + "start": 8, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "extra": { + "rawValue": 6, + "raw": "6" + }, + "value": 6 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2016/exponentiation-operator/16/options.json b/packages/babel-parser/test/fixtures/es2016/exponentiation-operator/16/options.json index 19687fbe197a..0861962d889d 100644 --- a/packages/babel-parser/test/fixtures/es2016/exponentiation-operator/16/options.json +++ b/packages/babel-parser/test/fixtures/es2016/exponentiation-operator/16/options.json @@ -1,4 +1,3 @@ { - "createParenthesizedExpressions": true, - "throws": "Illegal expression. Wrap left hand side or entire exponentiation in parentheses. (1:2)" + "createParenthesizedExpressions": true } diff --git a/packages/babel-parser/test/fixtures/es2016/exponentiation-operator/16/output.json b/packages/babel-parser/test/fixtures/es2016/exponentiation-operator/16/output.json new file mode 100644 index 000000000000..5fd8ad0e4fbd --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2016/exponentiation-operator/16/output.json @@ -0,0 +1,141 @@ +{ + "type": "File", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "errors": [ + "SyntaxError: Illegal expression. Wrap left hand side or entire exponentiation in parentheses. (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "expression": { + "type": "ParenthesizedExpression", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "expression": { + "type": "BinaryExpression", + "start": 1, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "left": { + "type": "UnaryExpression", + "start": 1, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "operator": "-", + "prefix": true, + "argument": { + "type": "NumericLiteral", + "start": 2, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "extra": { + "rawValue": 5, + "raw": "5" + }, + "value": 5 + } + }, + "operator": "**", + "right": { + "type": "NumericLiteral", + "start": 7, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "extra": { + "rawValue": 6, + "raw": "6" + }, + "value": 6 + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/array-pattern-default/options.json b/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/array-pattern-default/options.json deleted file mode 100644 index 12b18792fcc4..000000000000 --- a/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/array-pattern-default/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Illegal 'use strict' directive in function with non-simple parameter list (1:0)" -} diff --git a/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/array-pattern-default/output.json b/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/array-pattern-default/output.json new file mode 100644 index 000000000000..5c66e79b6581 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/array-pattern-default/output.json @@ -0,0 +1,209 @@ +{ + "type": "File", + "start": 0, + "end": 57, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Illegal 'use strict' directive in function with non-simple parameter list (1:0)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 57, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 57, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + }, + "identifierName": "a" + }, + "name": "a" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "AssignmentPattern", + "start": 11, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "left": { + "type": "ArrayPattern", + "start": 11, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "elements": [ + { + "type": "Identifier", + "start": 13, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 20 + }, + "identifierName": "option1" + }, + "name": "option1" + }, + { + "type": "Identifier", + "start": 22, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 29 + }, + "identifierName": "option2" + }, + "name": "option2" + } + ] + }, + "right": { + "type": "ArrayExpression", + "start": 34, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 34 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "elements": [] + } + } + ], + "body": { + "type": "BlockStatement", + "start": 38, + "end": 57, + "loc": { + "start": { + "line": 1, + "column": 38 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": [], + "directives": [ + { + "type": "Directive", + "start": 42, + "end": 55, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 15 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 42, + "end": 54, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/array-pattern/options.json b/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/array-pattern/options.json deleted file mode 100644 index 12b18792fcc4..000000000000 --- a/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/array-pattern/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Illegal 'use strict' directive in function with non-simple parameter list (1:0)" -} diff --git a/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/array-pattern/output.json b/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/array-pattern/output.json new file mode 100644 index 000000000000..21f903177a3d --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/array-pattern/output.json @@ -0,0 +1,178 @@ +{ + "type": "File", + "start": 0, + "end": 52, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Illegal 'use strict' directive in function with non-simple parameter list (1:0)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 52, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 52, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + }, + "identifierName": "a" + }, + "name": "a" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "ArrayPattern", + "start": 11, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "elements": [ + { + "type": "Identifier", + "start": 13, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 20 + }, + "identifierName": "option1" + }, + "name": "option1" + }, + { + "type": "Identifier", + "start": 22, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 29 + }, + "identifierName": "option2" + }, + "name": "option2" + } + ] + } + ], + "body": { + "type": "BlockStatement", + "start": 33, + "end": 52, + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": [], + "directives": [ + { + "type": "Directive", + "start": 37, + "end": 50, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 15 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 37, + "end": 49, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/arrow-function/options.json b/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/arrow-function/options.json deleted file mode 100644 index 089b542c3704..000000000000 --- a/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/arrow-function/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Illegal 'use strict' directive in function with non-simple parameter list (1:8)" -} diff --git a/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/arrow-function/output.json b/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/arrow-function/output.json new file mode 100644 index 000000000000..c63422a6be79 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/arrow-function/output.json @@ -0,0 +1,209 @@ +{ + "type": "File", + "start": 0, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 2 + } + }, + "errors": [ + "SyntaxError: Illegal 'use strict' directive in function with non-simple parameter list (1:8)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 2 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 0, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 2 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 4, + "end": 45, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 4, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + }, + "identifierName": "a" + }, + "name": "a" + }, + "init": { + "type": "ArrowFunctionExpression", + "start": 8, + "end": 45, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "AssignmentPattern", + "start": 9, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "left": { + "type": "Identifier", + "start": 9, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 16 + }, + "identifierName": "options" + }, + "name": "options" + }, + "right": { + "type": "ObjectExpression", + "start": 19, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "properties": [] + } + } + ], + "body": { + "type": "BlockStatement", + "start": 26, + "end": 45, + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": [], + "directives": [ + { + "type": "Directive", + "start": 30, + "end": 43, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 15 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 30, + "end": 42, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } + } + } + ], + "kind": "var" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/async-arrow-function/options.json b/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/async-arrow-function/options.json deleted file mode 100644 index 089b542c3704..000000000000 --- a/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/async-arrow-function/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Illegal 'use strict' directive in function with non-simple parameter list (1:8)" -} diff --git a/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/async-arrow-function/output.json b/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/async-arrow-function/output.json new file mode 100644 index 000000000000..6183a084c384 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/async-arrow-function/output.json @@ -0,0 +1,209 @@ +{ + "type": "File", + "start": 0, + "end": 52, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 2 + } + }, + "errors": [ + "SyntaxError: Illegal 'use strict' directive in function with non-simple parameter list (1:8)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 52, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 2 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 0, + "end": 52, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 2 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 4, + "end": 51, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 4, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + }, + "identifierName": "a" + }, + "name": "a" + }, + "init": { + "type": "ArrowFunctionExpression", + "start": 8, + "end": 51, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": null, + "generator": false, + "async": true, + "params": [ + { + "type": "AssignmentPattern", + "start": 15, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "left": { + "type": "Identifier", + "start": 15, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 22 + }, + "identifierName": "options" + }, + "name": "options" + }, + "right": { + "type": "ObjectExpression", + "start": 25, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "properties": [] + } + } + ], + "body": { + "type": "BlockStatement", + "start": 32, + "end": 51, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": [], + "directives": [ + { + "type": "Directive", + "start": 36, + "end": 49, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 15 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 36, + "end": 48, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } + } + } + ], + "kind": "var" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/async-function/options.json b/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/async-function/options.json deleted file mode 100644 index 12b18792fcc4..000000000000 --- a/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/async-function/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Illegal 'use strict' directive in function with non-simple parameter list (1:0)" -} diff --git a/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/async-function/output.json b/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/async-function/output.json new file mode 100644 index 000000000000..324b53bc26ec --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/async-function/output.json @@ -0,0 +1,175 @@ +{ + "type": "File", + "start": 0, + "end": 50, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Illegal 'use strict' directive in function with non-simple parameter list (1:0)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 50, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 50, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 15, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + }, + "identifierName": "a" + }, + "name": "a" + }, + "generator": false, + "async": true, + "params": [ + { + "type": "AssignmentPattern", + "start": 17, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "left": { + "type": "Identifier", + "start": 17, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 24 + }, + "identifierName": "options" + }, + "name": "options" + }, + "right": { + "type": "ObjectExpression", + "start": 27, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "properties": [] + } + } + ], + "body": { + "type": "BlockStatement", + "start": 31, + "end": 50, + "loc": { + "start": { + "line": 1, + "column": 31 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": [], + "directives": [ + { + "type": "Directive", + "start": 35, + "end": 48, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 15 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 35, + "end": 47, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/default/options.json b/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/default/options.json deleted file mode 100644 index 12b18792fcc4..000000000000 --- a/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/default/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Illegal 'use strict' directive in function with non-simple parameter list (1:0)" -} diff --git a/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/default/output.json b/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/default/output.json new file mode 100644 index 000000000000..f40df83751ba --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/default/output.json @@ -0,0 +1,175 @@ +{ + "type": "File", + "start": 0, + "end": 44, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Illegal 'use strict' directive in function with non-simple parameter list (1:0)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 44, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 44, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + }, + "identifierName": "a" + }, + "name": "a" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "AssignmentPattern", + "start": 11, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "left": { + "type": "Identifier", + "start": 11, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 18 + }, + "identifierName": "options" + }, + "name": "options" + }, + "right": { + "type": "ObjectExpression", + "start": 21, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "properties": [] + } + } + ], + "body": { + "type": "BlockStatement", + "start": 25, + "end": 44, + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": [], + "directives": [ + { + "type": "Directive", + "start": 29, + "end": 42, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 15 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 29, + "end": 41, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/generator-function/options.json b/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/generator-function/options.json deleted file mode 100644 index 12b18792fcc4..000000000000 --- a/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/generator-function/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Illegal 'use strict' directive in function with non-simple parameter list (1:0)" -} diff --git a/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/generator-function/output.json b/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/generator-function/output.json new file mode 100644 index 000000000000..4d433d4b0bc1 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/generator-function/output.json @@ -0,0 +1,175 @@ +{ + "type": "File", + "start": 0, + "end": 45, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Illegal 'use strict' directive in function with non-simple parameter list (1:0)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 45, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 45, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 10, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + }, + "identifierName": "a" + }, + "name": "a" + }, + "generator": true, + "async": false, + "params": [ + { + "type": "AssignmentPattern", + "start": 12, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "left": { + "type": "Identifier", + "start": 12, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 19 + }, + "identifierName": "options" + }, + "name": "options" + }, + "right": { + "type": "ObjectExpression", + "start": 22, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "properties": [] + } + } + ], + "body": { + "type": "BlockStatement", + "start": 26, + "end": 45, + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": [], + "directives": [ + { + "type": "Directive", + "start": 30, + "end": 43, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 15 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 30, + "end": 42, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/generator-method/options.json b/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/generator-method/options.json deleted file mode 100644 index 9908b496fd2a..000000000000 --- a/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/generator-method/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Illegal 'use strict' directive in function with non-simple parameter list (2:5)" -} diff --git a/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/generator-method/output.json b/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/generator-method/output.json new file mode 100644 index 000000000000..393540b1fa01 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/generator-method/output.json @@ -0,0 +1,246 @@ +{ + "type": "File", + "start": 0, + "end": 58, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 2 + } + }, + "errors": [ + "SyntaxError: Illegal 'use strict' directive in function with non-simple parameter list (2:5)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 58, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 2 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 0, + "end": 58, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 2 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 4, + "end": 57, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 4, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "obj" + }, + "name": "obj" + }, + "init": { + "type": "ObjectExpression", + "start": 10, + "end": 57, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "properties": [ + { + "type": "ObjectMethod", + "start": 14, + "end": 55, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 4, + "column": 3 + } + }, + "method": true, + "key": { + "type": "Identifier", + "start": 16, + "end": 17, + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 5 + }, + "identifierName": "a" + }, + "name": "a" + }, + "computed": false, + "kind": "method", + "id": null, + "generator": true, + "async": false, + "params": [ + { + "type": "AssignmentPattern", + "start": 18, + "end": 30, + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 18 + } + }, + "left": { + "type": "Identifier", + "start": 18, + "end": 25, + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 13 + }, + "identifierName": "options" + }, + "name": "options" + }, + "right": { + "type": "ObjectExpression", + "start": 28, + "end": 30, + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 18 + } + }, + "properties": [] + } + } + ], + "body": { + "type": "BlockStatement", + "start": 32, + "end": 55, + "loc": { + "start": { + "line": 2, + "column": 20 + }, + "end": { + "line": 4, + "column": 3 + } + }, + "body": [], + "directives": [ + { + "type": "Directive", + "start": 38, + "end": 51, + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 17 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 38, + "end": 50, + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 16 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } + } + ] + } + } + ], + "kind": "var" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/method/options.json b/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/method/options.json deleted file mode 100644 index 5d0e394f2b9d..000000000000 --- a/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/method/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Illegal 'use strict' directive in function with non-simple parameter list (2:3)" -} diff --git a/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/method/output.json b/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/method/output.json new file mode 100644 index 000000000000..99d18df924f2 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/method/output.json @@ -0,0 +1,246 @@ +{ + "type": "File", + "start": 0, + "end": 56, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 2 + } + }, + "errors": [ + "SyntaxError: Illegal 'use strict' directive in function with non-simple parameter list (2:3)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 56, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 2 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 0, + "end": 56, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 2 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 4, + "end": 55, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 4, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "obj" + }, + "name": "obj" + }, + "init": { + "type": "ObjectExpression", + "start": 10, + "end": 55, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "properties": [ + { + "type": "ObjectMethod", + "start": 14, + "end": 53, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 4, + "column": 3 + } + }, + "method": true, + "key": { + "type": "Identifier", + "start": 14, + "end": 15, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 3 + }, + "identifierName": "a" + }, + "name": "a" + }, + "computed": false, + "kind": "method", + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "AssignmentPattern", + "start": 16, + "end": 28, + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 16 + } + }, + "left": { + "type": "Identifier", + "start": 16, + "end": 23, + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 11 + }, + "identifierName": "options" + }, + "name": "options" + }, + "right": { + "type": "ObjectExpression", + "start": 26, + "end": 28, + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 16 + } + }, + "properties": [] + } + } + ], + "body": { + "type": "BlockStatement", + "start": 30, + "end": 53, + "loc": { + "start": { + "line": 2, + "column": 18 + }, + "end": { + "line": 4, + "column": 3 + } + }, + "body": [], + "directives": [ + { + "type": "Directive", + "start": 36, + "end": 49, + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 17 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 36, + "end": 48, + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 16 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } + } + ] + } + } + ], + "kind": "var" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/object-pattern-default/options.json b/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/object-pattern-default/options.json deleted file mode 100644 index 12b18792fcc4..000000000000 --- a/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/object-pattern-default/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Illegal 'use strict' directive in function with non-simple parameter list (1:0)" -} diff --git a/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/object-pattern-default/output.json b/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/object-pattern-default/output.json new file mode 100644 index 000000000000..f6c0442d811a --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/object-pattern-default/output.json @@ -0,0 +1,285 @@ +{ + "type": "File", + "start": 0, + "end": 57, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Illegal 'use strict' directive in function with non-simple parameter list (1:0)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 57, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 57, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + }, + "identifierName": "a" + }, + "name": "a" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "AssignmentPattern", + "start": 11, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "left": { + "type": "ObjectPattern", + "start": 11, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 13, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 13, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 20 + }, + "identifierName": "option1" + }, + "name": "option1" + }, + "computed": false, + "shorthand": true, + "value": { + "type": "Identifier", + "start": 13, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 20 + }, + "identifierName": "option1" + }, + "name": "option1" + }, + "extra": { + "shorthand": true + } + }, + { + "type": "ObjectProperty", + "start": 22, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 22, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 29 + }, + "identifierName": "option2" + }, + "name": "option2" + }, + "computed": false, + "shorthand": true, + "value": { + "type": "Identifier", + "start": 22, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 29 + }, + "identifierName": "option2" + }, + "name": "option2" + }, + "extra": { + "shorthand": true + } + } + ] + }, + "right": { + "type": "ObjectExpression", + "start": 34, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 34 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "properties": [] + } + } + ], + "body": { + "type": "BlockStatement", + "start": 38, + "end": 57, + "loc": { + "start": { + "line": 1, + "column": 38 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": [], + "directives": [ + { + "type": "Directive", + "start": 42, + "end": 55, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 15 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 42, + "end": 54, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/object-pattern/options.json b/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/object-pattern/options.json deleted file mode 100644 index 12b18792fcc4..000000000000 --- a/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/object-pattern/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Illegal 'use strict' directive in function with non-simple parameter list (1:0)" -} diff --git a/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/object-pattern/output.json b/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/object-pattern/output.json new file mode 100644 index 000000000000..2089ba375f3e --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/object-pattern/output.json @@ -0,0 +1,254 @@ +{ + "type": "File", + "start": 0, + "end": 52, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Illegal 'use strict' directive in function with non-simple parameter list (1:0)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 52, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 52, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + }, + "identifierName": "a" + }, + "name": "a" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "ObjectPattern", + "start": 11, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 13, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 13, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 20 + }, + "identifierName": "option1" + }, + "name": "option1" + }, + "computed": false, + "shorthand": true, + "value": { + "type": "Identifier", + "start": 13, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 20 + }, + "identifierName": "option1" + }, + "name": "option1" + }, + "extra": { + "shorthand": true + } + }, + { + "type": "ObjectProperty", + "start": 22, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 22, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 29 + }, + "identifierName": "option2" + }, + "name": "option2" + }, + "computed": false, + "shorthand": true, + "value": { + "type": "Identifier", + "start": 22, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 29 + }, + "identifierName": "option2" + }, + "name": "option2" + }, + "extra": { + "shorthand": true + } + } + ] + } + ], + "body": { + "type": "BlockStatement", + "start": 33, + "end": 52, + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": [], + "directives": [ + { + "type": "Directive", + "start": 37, + "end": 50, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 15 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 37, + "end": 49, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/rest/options.json b/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/rest/options.json deleted file mode 100644 index 12b18792fcc4..000000000000 --- a/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/rest/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Illegal 'use strict' directive in function with non-simple parameter list (1:0)" -} diff --git a/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/rest/output.json b/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/rest/output.json new file mode 100644 index 000000000000..9c23ba0225c7 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/rest/output.json @@ -0,0 +1,159 @@ +{ + "type": "File", + "start": 0, + "end": 42, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Illegal 'use strict' directive in function with non-simple parameter list (1:0)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 42, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 42, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + }, + "identifierName": "a" + }, + "name": "a" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "RestElement", + "start": 11, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "argument": { + "type": "Identifier", + "start": 14, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 21 + }, + "identifierName": "options" + }, + "name": "options" + } + } + ], + "body": { + "type": "BlockStatement", + "start": 23, + "end": 42, + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": [], + "directives": [ + { + "type": "Directive", + "start": 27, + "end": 40, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 15 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 27, + "end": 39, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2017/async-functions/2/options.json b/packages/babel-parser/test/fixtures/es2017/async-functions/2/options.json deleted file mode 100644 index c6f19067ee66..000000000000 --- a/packages/babel-parser/test/fixtures/es2017/async-functions/2/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "await* has been removed from the async functions proposal. Use Promise.all() instead. (2:2)" -} diff --git a/packages/babel-parser/test/fixtures/es2017/async-functions/2/output.json b/packages/babel-parser/test/fixtures/es2017/async-functions/2/output.json new file mode 100644 index 000000000000..d6708279fdcb --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2017/async-functions/2/output.json @@ -0,0 +1,154 @@ +{ + "type": "File", + "start": 0, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "errors": [ + "SyntaxError: await* has been removed from the async functions proposal. Use Promise.all() instead. (2:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 15, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 18 + }, + "identifierName": "bar" + }, + "name": "bar" + }, + "generator": false, + "async": true, + "params": [], + "body": { + "type": "BlockStatement", + "start": 21, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 25, + "end": 38, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 15 + } + }, + "expression": { + "type": "AwaitExpression", + "start": 25, + "end": 37, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "argument": { + "type": "CallExpression", + "start": 32, + "end": 37, + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "callee": { + "type": "Identifier", + "start": 32, + "end": 35, + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 12 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "arguments": [] + } + } + } + ], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2017/async-functions/async-await-as-arrow-binding-identifier/input.js b/packages/babel-parser/test/fixtures/es2017/async-functions/async-await-as-arrow-binding-identifier/input.js new file mode 100644 index 000000000000..769cb1594534 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2017/async-functions/async-await-as-arrow-binding-identifier/input.js @@ -0,0 +1 @@ +async await => {} diff --git a/packages/babel-parser/test/fixtures/es2017/async-functions/async-await-as-arrow-binding-identifier/output.json b/packages/babel-parser/test/fixtures/es2017/async-functions/async-await-as-arrow-binding-identifier/output.json new file mode 100644 index 000000000000..b264aa447eeb --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2017/async-functions/async-await-as-arrow-binding-identifier/output.json @@ -0,0 +1,107 @@ +{ + "type": "File", + "start": 0, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "errors": [ + "SyntaxError: Await cannot be used as name inside an async function (1:6)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "expression": { + "type": "ArrowFunctionExpression", + "start": 0, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "id": null, + "generator": false, + "async": true, + "params": [ + { + "type": "Identifier", + "start": 6, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 11 + }, + "identifierName": "await" + }, + "name": "await" + } + ], + "body": { + "type": "BlockStatement", + "start": 15, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "body": [], + "directives": [] + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2017/async-functions/await-async-function-expression-name/options.json b/packages/babel-parser/test/fixtures/es2017/async-functions/await-async-function-expression-name/options.json deleted file mode 100644 index 022428647fee..000000000000 --- a/packages/babel-parser/test/fixtures/es2017/async-functions/await-async-function-expression-name/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Can not use 'await' as identifier inside an async function (1:16)" -} diff --git a/packages/babel-parser/test/fixtures/es2017/async-functions/await-async-function-expression-name/output.json b/packages/babel-parser/test/fixtures/es2017/async-functions/await-async-function-expression-name/output.json new file mode 100644 index 000000000000..34fa5d9a8d4f --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2017/async-functions/await-async-function-expression-name/output.json @@ -0,0 +1,109 @@ +{ + "type": "File", + "start": 0, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "errors": [ + "SyntaxError: Can not use 'await' as identifier inside an async function (1:16)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "expression": { + "type": "FunctionExpression", + "start": 1, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "id": { + "type": "Identifier", + "start": 16, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 21 + }, + "identifierName": "await" + }, + "name": "await" + }, + "generator": false, + "async": true, + "params": [], + "body": { + "type": "BlockStatement", + "start": 24, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "body": [], + "directives": [] + }, + "extra": { + "parenthesized": true, + "parenStart": 0 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2017/async-functions/await-binding-inside-arrow-params-inside-async-arrow-params/input.js b/packages/babel-parser/test/fixtures/es2017/async-functions/await-binding-inside-arrow-params-inside-async-arrow-params/input.js new file mode 100644 index 000000000000..5b6e6b2866ae --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2017/async-functions/await-binding-inside-arrow-params-inside-async-arrow-params/input.js @@ -0,0 +1 @@ +async (a = ({ await }) => {}) => {}; diff --git a/packages/babel-parser/test/fixtures/es2017/async-functions/await-binding-inside-arrow-params-inside-async-arrow-params/output.json b/packages/babel-parser/test/fixtures/es2017/async-functions/await-binding-inside-arrow-params-inside-async-arrow-params/output.json new file mode 100644 index 000000000000..c9a8709666e7 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2017/async-functions/await-binding-inside-arrow-params-inside-async-arrow-params/output.json @@ -0,0 +1,231 @@ +{ + "type": "File", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "errors": [ + "SyntaxError: Await cannot be used as name inside an async function (1:20)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "expression": { + "type": "ArrowFunctionExpression", + "start": 0, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "id": null, + "generator": false, + "async": true, + "params": [ + { + "type": "AssignmentPattern", + "start": 7, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "left": { + "type": "Identifier", + "start": 7, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + }, + "identifierName": "a" + }, + "name": "a" + }, + "right": { + "type": "ArrowFunctionExpression", + "start": 11, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "ObjectPattern", + "start": 12, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 14, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 14, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 19 + }, + "identifierName": "await" + }, + "name": "await" + }, + "computed": false, + "shorthand": true, + "value": { + "type": "Identifier", + "start": 14, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 19 + }, + "identifierName": "await" + }, + "name": "await" + }, + "extra": { + "shorthand": true + } + } + ] + } + ], + "body": { + "type": "BlockStatement", + "start": 26, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "body": [], + "directives": [] + } + } + } + ], + "body": { + "type": "BlockStatement", + "start": 33, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "body": [], + "directives": [] + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2017/async-functions/await-function-declaration-name-inside-async-function/options.json b/packages/babel-parser/test/fixtures/es2017/async-functions/await-function-declaration-name-inside-async-function/options.json deleted file mode 100644 index d45274982dc1..000000000000 --- a/packages/babel-parser/test/fixtures/es2017/async-functions/await-function-declaration-name-inside-async-function/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Can not use 'await' as identifier inside an async function (2:11)" -} diff --git a/packages/babel-parser/test/fixtures/es2017/async-functions/await-function-declaration-name-inside-async-function/output.json b/packages/babel-parser/test/fixtures/es2017/async-functions/await-function-declaration-name-inside-async-function/output.json new file mode 100644 index 000000000000..3d543c665be5 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2017/async-functions/await-function-declaration-name-inside-async-function/output.json @@ -0,0 +1,143 @@ +{ + "type": "File", + "start": 0, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Can not use 'await' as identifier inside an async function (2:11)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 15, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 18 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "generator": false, + "async": true, + "params": [], + "body": { + "type": "BlockStatement", + "start": 21, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": [ + { + "type": "FunctionDeclaration", + "start": 25, + "end": 44, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 21 + } + }, + "id": { + "type": "Identifier", + "start": 34, + "end": 39, + "loc": { + "start": { + "line": 2, + "column": 11 + }, + "end": { + "line": 2, + "column": 16 + }, + "identifierName": "await" + }, + "name": "await" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 42, + "end": 44, + "loc": { + "start": { + "line": 2, + "column": 19 + }, + "end": { + "line": 2, + "column": 21 + } + }, + "body": [], + "directives": [] + } + } + ], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2017/async-functions/await-inside-arguments-of-async-call-inside-parameters-of-async-arrow-function/options.json b/packages/babel-parser/test/fixtures/es2017/async-functions/await-inside-arguments-of-async-call-inside-parameters-of-async-arrow-function/options.json deleted file mode 100644 index 9a4cb65743b5..000000000000 --- a/packages/babel-parser/test/fixtures/es2017/async-functions/await-inside-arguments-of-async-call-inside-parameters-of-async-arrow-function/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Await cannot be used as name inside an async function (2:23)" -} diff --git a/packages/babel-parser/test/fixtures/es2017/async-functions/await-inside-arguments-of-async-call-inside-parameters-of-async-arrow-function/output.json b/packages/babel-parser/test/fixtures/es2017/async-functions/await-inside-arguments-of-async-call-inside-parameters-of-async-arrow-function/output.json new file mode 100644 index 000000000000..281c41288873 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2017/async-functions/await-inside-arguments-of-async-call-inside-parameters-of-async-arrow-function/output.json @@ -0,0 +1,277 @@ +{ + "type": "File", + "start": 0, + "end": 63, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Await cannot be used as name inside an async function (2:23)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 63, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 63, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 15, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 17 + }, + "identifierName": "fn" + }, + "name": "fn" + }, + "generator": false, + "async": true, + "params": [], + "body": { + "type": "BlockStatement", + "start": 20, + "end": 63, + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 24, + "end": 61, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 39 + } + }, + "expression": { + "type": "ArrowFunctionExpression", + "start": 24, + "end": 60, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 38 + } + }, + "id": null, + "generator": false, + "async": true, + "params": [ + { + "type": "AssignmentPattern", + "start": 31, + "end": 53, + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 31 + } + }, + "left": { + "type": "Identifier", + "start": 31, + "end": 32, + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 10 + }, + "identifierName": "x" + }, + "name": "x" + }, + "right": { + "type": "CallExpression", + "start": 35, + "end": 53, + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 31 + } + }, + "callee": { + "type": "Identifier", + "start": 35, + "end": 40, + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 18 + }, + "identifierName": "async" + }, + "name": "async" + }, + "arguments": [ + { + "type": "AssignmentExpression", + "start": 41, + "end": 52, + "loc": { + "start": { + "line": 2, + "column": 19 + }, + "end": { + "line": 2, + "column": 30 + } + }, + "operator": "=", + "left": { + "type": "Identifier", + "start": 41, + "end": 42, + "loc": { + "start": { + "line": 2, + "column": 19 + }, + "end": { + "line": 2, + "column": 20 + }, + "identifierName": "y" + }, + "name": "y" + }, + "right": { + "type": "AwaitExpression", + "start": 45, + "end": 52, + "loc": { + "start": { + "line": 2, + "column": 23 + }, + "end": { + "line": 2, + "column": 30 + } + }, + "argument": { + "type": "NumericLiteral", + "start": 51, + "end": 52, + "loc": { + "start": { + "line": 2, + "column": 29 + }, + "end": { + "line": 2, + "column": 30 + } + }, + "extra": { + "rawValue": 2, + "raw": "2" + }, + "value": 2 + } + } + } + ] + } + } + ], + "body": { + "type": "BlockStatement", + "start": 58, + "end": 60, + "loc": { + "start": { + "line": 2, + "column": 36 + }, + "end": { + "line": 2, + "column": 38 + } + }, + "body": [], + "directives": [] + } + } + } + ], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2017/async-functions/await-inside-async-call-inside-parameters-of-function-inside-async-function/input.js b/packages/babel-parser/test/fixtures/es2017/async-functions/await-inside-async-call-inside-parameters-of-function-inside-async-function/input.js new file mode 100644 index 000000000000..1c99cb921526 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2017/async-functions/await-inside-async-call-inside-parameters-of-function-inside-async-function/input.js @@ -0,0 +1,3 @@ +async function f() { + function g(x = async(await)) {} +} diff --git a/packages/babel-parser/test/fixtures/es2017/async-functions/await-inside-async-call-inside-parameters-of-function-inside-async-function/output.json b/packages/babel-parser/test/fixtures/es2017/async-functions/await-inside-async-call-inside-parameters-of-function-inside-async-function/output.json new file mode 100644 index 000000000000..41946b0a2bcb --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2017/async-functions/await-inside-async-call-inside-parameters-of-function-inside-async-function/output.json @@ -0,0 +1,224 @@ +{ + "type": "File", + "start": 0, + "end": 56, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 56, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 56, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 15, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + }, + "identifierName": "f" + }, + "name": "f" + }, + "generator": false, + "async": true, + "params": [], + "body": { + "type": "BlockStatement", + "start": 19, + "end": 56, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": [ + { + "type": "FunctionDeclaration", + "start": 23, + "end": 54, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 33 + } + }, + "id": { + "type": "Identifier", + "start": 32, + "end": 33, + "loc": { + "start": { + "line": 2, + "column": 11 + }, + "end": { + "line": 2, + "column": 12 + }, + "identifierName": "g" + }, + "name": "g" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "AssignmentPattern", + "start": 34, + "end": 50, + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 29 + } + }, + "left": { + "type": "Identifier", + "start": 34, + "end": 35, + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 14 + }, + "identifierName": "x" + }, + "name": "x" + }, + "right": { + "type": "CallExpression", + "start": 38, + "end": 50, + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 29 + } + }, + "callee": { + "type": "Identifier", + "start": 38, + "end": 43, + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 22 + }, + "identifierName": "async" + }, + "name": "async" + }, + "arguments": [ + { + "type": "Identifier", + "start": 44, + "end": 49, + "loc": { + "start": { + "line": 2, + "column": 23 + }, + "end": { + "line": 2, + "column": 28 + }, + "identifierName": "await" + }, + "name": "await" + } + ] + } + } + ], + "body": { + "type": "BlockStatement", + "start": 52, + "end": 54, + "loc": { + "start": { + "line": 2, + "column": 31 + }, + "end": { + "line": 2, + "column": 33 + } + }, + "body": [], + "directives": [] + } + } + ], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2017/async-functions/await-inside-class-methods/input.js b/packages/babel-parser/test/fixtures/es2017/async-functions/await-inside-class-methods/input.js new file mode 100644 index 000000000000..7a48dfc20087 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2017/async-functions/await-inside-class-methods/input.js @@ -0,0 +1,3 @@ +() => class { + async m() { await 42 } +} diff --git a/packages/babel-parser/test/fixtures/es2017/async-functions/await-inside-class-methods/output.json b/packages/babel-parser/test/fixtures/es2017/async-functions/await-inside-class-methods/output.json new file mode 100644 index 000000000000..04024e014271 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2017/async-functions/await-inside-class-methods/output.json @@ -0,0 +1,210 @@ +{ + "type": "File", + "start": 0, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "expression": { + "type": "ArrowFunctionExpression", + "start": 0, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "ClassExpression", + "start": 6, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": null, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 12, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": [ + { + "type": "ClassMethod", + "start": 16, + "end": 38, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 24 + } + }, + "static": false, + "key": { + "type": "Identifier", + "start": 22, + "end": 23, + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 9 + }, + "identifierName": "m" + }, + "name": "m" + }, + "computed": false, + "kind": "method", + "id": null, + "generator": false, + "async": true, + "params": [], + "body": { + "type": "BlockStatement", + "start": 26, + "end": 38, + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 24 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 28, + "end": 36, + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 22 + } + }, + "expression": { + "type": "AwaitExpression", + "start": 28, + "end": 36, + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 22 + } + }, + "argument": { + "type": "NumericLiteral", + "start": 34, + "end": 36, + "loc": { + "start": { + "line": 2, + "column": 20 + }, + "end": { + "line": 2, + "column": 22 + } + }, + "extra": { + "rawValue": 42, + "raw": "42" + }, + "value": 42 + } + } + } + ], + "directives": [] + } + } + ] + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2017/async-functions/await-inside-computed-class-property/input.js b/packages/babel-parser/test/fixtures/es2017/async-functions/await-inside-computed-class-property/input.js new file mode 100644 index 000000000000..d18a372142f7 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2017/async-functions/await-inside-computed-class-property/input.js @@ -0,0 +1,3 @@ +async () => class { + [await 42]() { } +} diff --git a/packages/babel-parser/test/fixtures/es2017/async-functions/await-inside-computed-class-property/output.json b/packages/babel-parser/test/fixtures/es2017/async-functions/await-inside-computed-class-property/output.json new file mode 100644 index 000000000000..2518cd543d0f --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2017/async-functions/await-inside-computed-class-property/output.json @@ -0,0 +1,177 @@ +{ + "type": "File", + "start": 0, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "expression": { + "type": "ArrowFunctionExpression", + "start": 0, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": null, + "generator": false, + "async": true, + "params": [], + "body": { + "type": "ClassExpression", + "start": 12, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": null, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 18, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": [ + { + "type": "ClassMethod", + "start": 22, + "end": 38, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 18 + } + }, + "static": false, + "computed": true, + "key": { + "type": "AwaitExpression", + "start": 23, + "end": 31, + "loc": { + "start": { + "line": 2, + "column": 3 + }, + "end": { + "line": 2, + "column": 11 + } + }, + "argument": { + "type": "NumericLiteral", + "start": 29, + "end": 31, + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 11 + } + }, + "extra": { + "rawValue": 42, + "raw": "42" + }, + "value": 42 + } + }, + "kind": "method", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 35, + "end": 38, + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 18 + } + }, + "body": [], + "directives": [] + } + } + ] + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2017/async-functions/await-inside-parameters-of-nested-arrow-function/options.json b/packages/babel-parser/test/fixtures/es2017/async-functions/await-inside-parameters-of-nested-arrow-function/options.json deleted file mode 100644 index 7cec39290c2a..000000000000 --- a/packages/babel-parser/test/fixtures/es2017/async-functions/await-inside-parameters-of-nested-arrow-function/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Await cannot be used as name inside an async function (2:7)" -} diff --git a/packages/babel-parser/test/fixtures/es2017/async-functions/await-inside-parameters-of-nested-arrow-function/output.json b/packages/babel-parser/test/fixtures/es2017/async-functions/await-inside-parameters-of-nested-arrow-function/output.json new file mode 100644 index 000000000000..329e0670c59a --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2017/async-functions/await-inside-parameters-of-nested-arrow-function/output.json @@ -0,0 +1,210 @@ +{ + "type": "File", + "start": 0, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Await cannot be used as name inside an async function (2:7)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 15, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 17 + }, + "identifierName": "fn" + }, + "name": "fn" + }, + "generator": false, + "async": true, + "params": [], + "body": { + "type": "BlockStatement", + "start": 20, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 24, + "end": 44, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 22 + } + }, + "expression": { + "type": "ArrowFunctionExpression", + "start": 24, + "end": 43, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 21 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "AssignmentPattern", + "start": 25, + "end": 36, + "loc": { + "start": { + "line": 2, + "column": 3 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "left": { + "type": "Identifier", + "start": 25, + "end": 26, + "loc": { + "start": { + "line": 2, + "column": 3 + }, + "end": { + "line": 2, + "column": 4 + }, + "identifierName": "x" + }, + "name": "x" + }, + "right": { + "type": "AwaitExpression", + "start": 29, + "end": 36, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "argument": { + "type": "NumericLiteral", + "start": 35, + "end": 36, + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "extra": { + "rawValue": 2, + "raw": "2" + }, + "value": 2 + } + } + } + ], + "body": { + "type": "BlockStatement", + "start": 41, + "end": 43, + "loc": { + "start": { + "line": 2, + "column": 19 + }, + "end": { + "line": 2, + "column": 21 + } + }, + "body": [], + "directives": [] + } + } + } + ], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2017/async-functions/await-inside-parameters-of-nested-async-arrow-function/options.json b/packages/babel-parser/test/fixtures/es2017/async-functions/await-inside-parameters-of-nested-async-arrow-function/options.json deleted file mode 100644 index b45bba7cab4a..000000000000 --- a/packages/babel-parser/test/fixtures/es2017/async-functions/await-inside-parameters-of-nested-async-arrow-function/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Await cannot be used as name inside an async function (2:13)" -} diff --git a/packages/babel-parser/test/fixtures/es2017/async-functions/await-inside-parameters-of-nested-async-arrow-function/output.json b/packages/babel-parser/test/fixtures/es2017/async-functions/await-inside-parameters-of-nested-async-arrow-function/output.json new file mode 100644 index 000000000000..39796387c784 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2017/async-functions/await-inside-parameters-of-nested-async-arrow-function/output.json @@ -0,0 +1,210 @@ +{ + "type": "File", + "start": 0, + "end": 52, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Await cannot be used as name inside an async function (2:13)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 52, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 52, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 15, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 17 + }, + "identifierName": "fn" + }, + "name": "fn" + }, + "generator": false, + "async": true, + "params": [], + "body": { + "type": "BlockStatement", + "start": 20, + "end": 52, + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 24, + "end": 50, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 28 + } + }, + "expression": { + "type": "ArrowFunctionExpression", + "start": 24, + "end": 49, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 27 + } + }, + "id": null, + "generator": false, + "async": true, + "params": [ + { + "type": "AssignmentPattern", + "start": 31, + "end": 42, + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 20 + } + }, + "left": { + "type": "Identifier", + "start": 31, + "end": 32, + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 10 + }, + "identifierName": "x" + }, + "name": "x" + }, + "right": { + "type": "AwaitExpression", + "start": 35, + "end": 42, + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 20 + } + }, + "argument": { + "type": "NumericLiteral", + "start": 41, + "end": 42, + "loc": { + "start": { + "line": 2, + "column": 19 + }, + "end": { + "line": 2, + "column": 20 + } + }, + "extra": { + "rawValue": 2, + "raw": "2" + }, + "value": 2 + } + } + } + ], + "body": { + "type": "BlockStatement", + "start": 47, + "end": 49, + "loc": { + "start": { + "line": 2, + "column": 25 + }, + "end": { + "line": 2, + "column": 27 + } + }, + "body": [], + "directives": [] + } + } + } + ], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2017/async-functions/await-inside-parameters/options.json b/packages/babel-parser/test/fixtures/es2017/async-functions/await-inside-parameters/options.json deleted file mode 100644 index f4af75f31164..000000000000 --- a/packages/babel-parser/test/fixtures/es2017/async-functions/await-inside-parameters/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "await is not allowed in async function parameters (1:22)" -} diff --git a/packages/babel-parser/test/fixtures/es2017/async-functions/await-inside-parameters/output.json b/packages/babel-parser/test/fixtures/es2017/async-functions/await-inside-parameters/output.json new file mode 100644 index 000000000000..be635254c883 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2017/async-functions/await-inside-parameters/output.json @@ -0,0 +1,158 @@ +{ + "type": "File", + "start": 0, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "errors": [ + "SyntaxError: await is not allowed in async function parameters (1:22)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "id": { + "type": "Identifier", + "start": 15, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 17 + }, + "identifierName": "fn" + }, + "name": "fn" + }, + "generator": false, + "async": true, + "params": [ + { + "type": "AssignmentPattern", + "start": 18, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "left": { + "type": "Identifier", + "start": 18, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + }, + "identifierName": "x" + }, + "name": "x" + }, + "right": { + "type": "AwaitExpression", + "start": 22, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "argument": { + "type": "NumericLiteral", + "start": 28, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "extra": { + "rawValue": 2, + "raw": "2" + }, + "value": 2 + } + } + } + ], + "body": { + "type": "BlockStatement", + "start": 31, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 31 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "body": [], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2017/async-functions/await-object-key-inside-arrow-params-inside-async-arrow-params copy/input.js b/packages/babel-parser/test/fixtures/es2017/async-functions/await-object-key-inside-arrow-params-inside-async-arrow-params copy/input.js new file mode 100644 index 000000000000..72058aa6dd6b --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2017/async-functions/await-object-key-inside-arrow-params-inside-async-arrow-params copy/input.js @@ -0,0 +1 @@ +async (a = ({ await: x }) => {}) => {}; diff --git a/packages/babel-parser/test/fixtures/es2017/async-functions/await-object-key-inside-arrow-params-inside-async-arrow-params copy/output.json b/packages/babel-parser/test/fixtures/es2017/async-functions/await-object-key-inside-arrow-params-inside-async-arrow-params copy/output.json new file mode 100644 index 000000000000..0d5a5b2fa589 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2017/async-functions/await-object-key-inside-arrow-params-inside-async-arrow-params copy/output.json @@ -0,0 +1,225 @@ +{ + "type": "File", + "start": 0, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "expression": { + "type": "ArrowFunctionExpression", + "start": 0, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 38 + } + }, + "id": null, + "generator": false, + "async": true, + "params": [ + { + "type": "AssignmentPattern", + "start": 7, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "left": { + "type": "Identifier", + "start": 7, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + }, + "identifierName": "a" + }, + "name": "a" + }, + "right": { + "type": "ArrowFunctionExpression", + "start": 11, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "ObjectPattern", + "start": 12, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 14, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 14, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 19 + }, + "identifierName": "await" + }, + "name": "await" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "Identifier", + "start": 21, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + }, + "identifierName": "x" + }, + "name": "x" + } + } + ] + } + ], + "body": { + "type": "BlockStatement", + "start": 29, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "body": [], + "directives": [] + } + } + } + ], + "body": { + "type": "BlockStatement", + "start": 36, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 36 + }, + "end": { + "line": 1, + "column": 38 + } + }, + "body": [], + "directives": [] + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2017/async-functions/context-division-after-expression/input.js b/packages/babel-parser/test/fixtures/es2017/async-functions/context-division-after-expression/input.js new file mode 100644 index 000000000000..1415f9866a40 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2017/async-functions/context-division-after-expression/input.js @@ -0,0 +1,2 @@ +void async function fn() {} +/foo/g \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2017/async-functions/context-division-after-expression/output.json b/packages/babel-parser/test/fixtures/es2017/async-functions/context-division-after-expression/output.json new file mode 100644 index 000000000000..9bd2028bf81f --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2017/async-functions/context-division-after-expression/output.json @@ -0,0 +1,185 @@ +{ + "type": "File", + "start": 0, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 6 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 6 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 6 + } + }, + "expression": { + "type": "BinaryExpression", + "start": 0, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 6 + } + }, + "left": { + "type": "BinaryExpression", + "start": 0, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 4 + } + }, + "left": { + "type": "UnaryExpression", + "start": 0, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "operator": "void", + "prefix": true, + "argument": { + "type": "FunctionExpression", + "start": 5, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "id": { + "type": "Identifier", + "start": 20, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 22 + }, + "identifierName": "fn" + }, + "name": "fn" + }, + "generator": false, + "async": true, + "params": [], + "body": { + "type": "BlockStatement", + "start": 25, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "body": [], + "directives": [] + } + } + }, + "operator": "/", + "right": { + "type": "Identifier", + "start": 29, + "end": 32, + "loc": { + "start": { + "line": 2, + "column": 1 + }, + "end": { + "line": 2, + "column": 4 + }, + "identifierName": "foo" + }, + "name": "foo" + } + }, + "operator": "/", + "right": { + "type": "Identifier", + "start": 33, + "end": 34, + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 6 + }, + "identifierName": "g" + }, + "name": "g" + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2017/async-functions/context-regex-after-statement/input.js b/packages/babel-parser/test/fixtures/es2017/async-functions/context-regex-after-statement/input.js new file mode 100644 index 000000000000..beb4d4ea4675 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2017/async-functions/context-regex-after-statement/input.js @@ -0,0 +1,2 @@ +async function fn() {} +/foo/g \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2017/async-functions/context-regex-after-statement/output.json b/packages/babel-parser/test/fixtures/es2017/async-functions/context-regex-after-statement/output.json new file mode 100644 index 000000000000..05504dd0734f --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2017/async-functions/context-regex-after-statement/output.json @@ -0,0 +1,122 @@ +{ + "type": "File", + "start": 0, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 6 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 6 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "id": { + "type": "Identifier", + "start": 15, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 17 + }, + "identifierName": "fn" + }, + "name": "fn" + }, + "generator": false, + "async": true, + "params": [], + "body": { + "type": "BlockStatement", + "start": 20, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "body": [], + "directives": [] + } + }, + { + "type": "ExpressionStatement", + "start": 23, + "end": 29, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 6 + } + }, + "expression": { + "type": "RegExpLiteral", + "start": 23, + "end": 29, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 6 + } + }, + "extra": { + "raw": "/foo/g" + }, + "pattern": "foo", + "flags": "g" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2017/async-functions/invalid-escape-async-class-method/options.json b/packages/babel-parser/test/fixtures/es2017/async-functions/invalid-escape-async-class-method/options.json index b81bee7fa2e4..3e7adc2e54dd 100644 --- a/packages/babel-parser/test/fixtures/es2017/async-functions/invalid-escape-async-class-method/options.json +++ b/packages/babel-parser/test/fixtures/es2017/async-functions/invalid-escape-async-class-method/options.json @@ -1,3 +1,3 @@ { "throws": "Unexpected token (1:21)" -} \ No newline at end of file +} diff --git a/packages/babel-parser/test/fixtures/es2017/async-functions/invalid-escape-async-obj-method/options.json b/packages/babel-parser/test/fixtures/es2017/async-functions/invalid-escape-async-obj-method/options.json index f0907a448458..4f0d43b57042 100644 --- a/packages/babel-parser/test/fixtures/es2017/async-functions/invalid-escape-async-obj-method/options.json +++ b/packages/babel-parser/test/fixtures/es2017/async-functions/invalid-escape-async-obj-method/options.json @@ -1,3 +1,3 @@ { "throws": "Unexpected token, expected \",\" (1:14)" -} \ No newline at end of file +} diff --git a/packages/babel-parser/test/fixtures/es2017/async-functions/invalid-escape-async-static-class-method/options.json b/packages/babel-parser/test/fixtures/es2017/async-functions/invalid-escape-async-static-class-method/options.json index f55830c1c373..c7dd7266de69 100644 --- a/packages/babel-parser/test/fixtures/es2017/async-functions/invalid-escape-async-static-class-method/options.json +++ b/packages/babel-parser/test/fixtures/es2017/async-functions/invalid-escape-async-static-class-method/options.json @@ -1,3 +1,3 @@ { "throws": "Unexpected token (1:28)" -} \ No newline at end of file +} diff --git a/packages/babel-parser/test/fixtures/es2017/async-functions/invalid-escape-await/options.json b/packages/babel-parser/test/fixtures/es2017/async-functions/invalid-escape-await/options.json index ac6c5914cec6..1cd92c2a1ffd 100644 --- a/packages/babel-parser/test/fixtures/es2017/async-functions/invalid-escape-await/options.json +++ b/packages/babel-parser/test/fixtures/es2017/async-functions/invalid-escape-await/options.json @@ -1,3 +1,3 @@ { - "throws": "Can not use 'await' as identifier inside an async function (1:20)" -} \ No newline at end of file + "throws": "Unexpected token, expected \";\" (1:31)" +} diff --git a/packages/babel-parser/test/fixtures/es2017/async-functions/invalid-escape-export-async-function/options.json b/packages/babel-parser/test/fixtures/es2017/async-functions/invalid-escape-export-async-function/options.json index 9d60866b80c3..f2ecbd9741e7 100644 --- a/packages/babel-parser/test/fixtures/es2017/async-functions/invalid-escape-export-async-function/options.json +++ b/packages/babel-parser/test/fixtures/es2017/async-functions/invalid-escape-export-async-function/options.json @@ -1,3 +1,3 @@ { "throws": "Unexpected token, expected \"{\" (1:7)" -} \ No newline at end of file +} diff --git a/packages/babel-parser/test/fixtures/es2017/async-functions/invalid-escape-export-dflt-async-function/options.json b/packages/babel-parser/test/fixtures/es2017/async-functions/invalid-escape-export-dflt-async-function/options.json index b0e5516212f3..1e1812883385 100644 --- a/packages/babel-parser/test/fixtures/es2017/async-functions/invalid-escape-export-dflt-async-function/options.json +++ b/packages/babel-parser/test/fixtures/es2017/async-functions/invalid-escape-export-dflt-async-function/options.json @@ -1,3 +1,3 @@ { "throws": "Unexpected token, expected \";\" (1:26)" -} \ No newline at end of file +} diff --git a/packages/babel-parser/test/fixtures/es2017/async-functions/invalid-escape-sequence-arrow-list/options.json b/packages/babel-parser/test/fixtures/es2017/async-functions/invalid-escape-sequence-arrow-list/options.json index 0cd822570731..99a2bc92f2c0 100644 --- a/packages/babel-parser/test/fixtures/es2017/async-functions/invalid-escape-sequence-arrow-list/options.json +++ b/packages/babel-parser/test/fixtures/es2017/async-functions/invalid-escape-sequence-arrow-list/options.json @@ -1,3 +1,3 @@ { "throws": "Unexpected token, expected \",\" (1:12)" -} \ No newline at end of file +} diff --git a/packages/babel-parser/test/fixtures/es2017/async-functions/invalid-escape-sequence-arrow/options.json b/packages/babel-parser/test/fixtures/es2017/async-functions/invalid-escape-sequence-arrow/options.json index f6eb197b1dd8..b98beb83593e 100644 --- a/packages/babel-parser/test/fixtures/es2017/async-functions/invalid-escape-sequence-arrow/options.json +++ b/packages/babel-parser/test/fixtures/es2017/async-functions/invalid-escape-sequence-arrow/options.json @@ -1,3 +1,3 @@ { "throws": "Unexpected token, expected \";\" (1:11)" -} \ No newline at end of file +} diff --git a/packages/babel-parser/test/fixtures/es2017/async-functions/invalid-escape-sequence-function-list/options.json b/packages/babel-parser/test/fixtures/es2017/async-functions/invalid-escape-sequence-function-list/options.json index 0cd822570731..99a2bc92f2c0 100644 --- a/packages/babel-parser/test/fixtures/es2017/async-functions/invalid-escape-sequence-function-list/options.json +++ b/packages/babel-parser/test/fixtures/es2017/async-functions/invalid-escape-sequence-function-list/options.json @@ -1,3 +1,3 @@ { "throws": "Unexpected token, expected \",\" (1:12)" -} \ No newline at end of file +} diff --git a/packages/babel-parser/test/fixtures/es2017/async-functions/invalid-escape-sequence-function/options.json b/packages/babel-parser/test/fixtures/es2017/async-functions/invalid-escape-sequence-function/options.json index f6eb197b1dd8..b98beb83593e 100644 --- a/packages/babel-parser/test/fixtures/es2017/async-functions/invalid-escape-sequence-function/options.json +++ b/packages/babel-parser/test/fixtures/es2017/async-functions/invalid-escape-sequence-function/options.json @@ -1,3 +1,3 @@ { "throws": "Unexpected token, expected \";\" (1:11)" -} \ No newline at end of file +} diff --git a/packages/babel-parser/test/fixtures/es2017/async-functions/invalid-inside-loop/options.json b/packages/babel-parser/test/fixtures/es2017/async-functions/invalid-inside-loop/options.json deleted file mode 100644 index 4bcd823e98be..000000000000 --- a/packages/babel-parser/test/fixtures/es2017/async-functions/invalid-inside-loop/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Async functions can only be declared at the top level or inside a block (1:10)" -} diff --git a/packages/babel-parser/test/fixtures/es2017/async-functions/invalid-inside-loop/output.json b/packages/babel-parser/test/fixtures/es2017/async-functions/invalid-inside-loop/output.json new file mode 100644 index 000000000000..e4933140f380 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2017/async-functions/invalid-inside-loop/output.json @@ -0,0 +1,125 @@ +{ + "type": "File", + "start": 0, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "errors": [ + "SyntaxError: Async functions can only be declared at the top level or inside a block (1:10)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "WhileStatement", + "start": 0, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "test": { + "type": "NumericLiteral", + "start": 7, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + }, + "body": { + "type": "FunctionDeclaration", + "start": 10, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "id": { + "type": "Identifier", + "start": 25, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 28 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "generator": false, + "async": true, + "params": [], + "body": { + "type": "BlockStatement", + "start": 30, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "body": [], + "directives": [] + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2017/async-functions/invalid-newline-after-params/options.json b/packages/babel-parser/test/fixtures/es2017/async-functions/invalid-newline-after-params/options.json index 0361d7c7d2b2..7d847e99c88e 100644 --- a/packages/babel-parser/test/fixtures/es2017/async-functions/invalid-newline-after-params/options.json +++ b/packages/babel-parser/test/fixtures/es2017/async-functions/invalid-newline-after-params/options.json @@ -1,3 +1,3 @@ { "throws": "Unexpected token (2:0)" -} \ No newline at end of file +} diff --git a/packages/babel-parser/test/fixtures/es2017/async-functions/invalid-parens-async-arrow/options.json b/packages/babel-parser/test/fixtures/es2017/async-functions/invalid-parens-async-arrow/options.json index f6eb197b1dd8..b98beb83593e 100644 --- a/packages/babel-parser/test/fixtures/es2017/async-functions/invalid-parens-async-arrow/options.json +++ b/packages/babel-parser/test/fixtures/es2017/async-functions/invalid-parens-async-arrow/options.json @@ -1,3 +1,3 @@ { "throws": "Unexpected token, expected \";\" (1:11)" -} \ No newline at end of file +} diff --git a/packages/babel-parser/test/fixtures/es2017/async-functions/invalid-parens-async-func/options.json b/packages/babel-parser/test/fixtures/es2017/async-functions/invalid-parens-async-func/options.json index c2fcdb08cf9f..cf30cd9156b7 100644 --- a/packages/babel-parser/test/fixtures/es2017/async-functions/invalid-parens-async-func/options.json +++ b/packages/babel-parser/test/fixtures/es2017/async-functions/invalid-parens-async-func/options.json @@ -1,3 +1,3 @@ { "throws": "Unexpected token, expected \";\" (1:8)" -} \ No newline at end of file +} diff --git a/packages/babel-parser/test/fixtures/es2017/async-functions/no-constructor/options.json b/packages/babel-parser/test/fixtures/es2017/async-functions/no-constructor/options.json deleted file mode 100644 index 49a2f478c663..000000000000 --- a/packages/babel-parser/test/fixtures/es2017/async-functions/no-constructor/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Constructor can't be an async function (2:8)" -} diff --git a/packages/babel-parser/test/fixtures/es2017/async-functions/no-constructor/output.json b/packages/babel-parser/test/fixtures/es2017/async-functions/no-constructor/output.json new file mode 100644 index 000000000000..8a46002d51c7 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2017/async-functions/no-constructor/output.json @@ -0,0 +1,144 @@ +{ + "type": "File", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Constructor can't be an async function (2:8)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "A" + }, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 8, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": [ + { + "type": "ClassMethod", + "start": 12, + "end": 34, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 24 + } + }, + "static": false, + "key": { + "type": "Identifier", + "start": 18, + "end": 29, + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 19 + }, + "identifierName": "constructor" + }, + "name": "constructor" + }, + "computed": false, + "kind": "method", + "id": null, + "generator": false, + "async": true, + "params": [], + "body": { + "type": "BlockStatement", + "start": 32, + "end": 34, + "loc": { + "start": { + "line": 2, + "column": 22 + }, + "end": { + "line": 2, + "column": 24 + } + }, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2017/async-functions/params-invalid-rest-trailing-comma/options.json b/packages/babel-parser/test/fixtures/es2017/async-functions/params-invalid-rest-trailing-comma/options.json deleted file mode 100644 index f686fb60b45e..000000000000 --- a/packages/babel-parser/test/fixtures/es2017/async-functions/params-invalid-rest-trailing-comma/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Rest element must be last element (1:11)" -} diff --git a/packages/babel-parser/test/fixtures/es2017/async-functions/params-invalid-rest-trailing-comma/output.json b/packages/babel-parser/test/fixtures/es2017/async-functions/params-invalid-rest-trailing-comma/output.json new file mode 100644 index 000000000000..009f7252316f --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2017/async-functions/params-invalid-rest-trailing-comma/output.json @@ -0,0 +1,122 @@ +{ + "type": "File", + "start": 0, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "errors": [ + "SyntaxError: Unexpected trailing comma after rest element (1:11)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "expression": { + "type": "ArrowFunctionExpression", + "start": 0, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "id": null, + "generator": false, + "async": true, + "params": [ + { + "type": "RestElement", + "start": 7, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "argument": { + "type": "Identifier", + "start": 10, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + }, + "identifierName": "a" + }, + "name": "a" + } + } + ], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "body": [], + "directives": [] + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2017/trailing-function-commas/1/output.json b/packages/babel-parser/test/fixtures/es2017/trailing-function-commas/1/output.json index 2373fc85c177..40aa85102591 100644 --- a/packages/babel-parser/test/fixtures/es2017/trailing-function-commas/1/output.json +++ b/packages/babel-parser/test/fixtures/es2017/trailing-function-commas/1/output.json @@ -74,6 +74,9 @@ }, "name": "log" }, + "extra": { + "trailingComma": 13 + }, "arguments": [ { "type": "Identifier", diff --git a/packages/babel-parser/test/fixtures/es2018/async-generators/for-await-no-in/options.json b/packages/babel-parser/test/fixtures/es2018/async-generators/for-await-no-in/options.json index f86bbd48e917..9660494a29ea 100644 --- a/packages/babel-parser/test/fixtures/es2018/async-generators/for-await-no-in/options.json +++ b/packages/babel-parser/test/fixtures/es2018/async-generators/for-await-no-in/options.json @@ -1,3 +1,3 @@ { "throws": "Unexpected token (2:6)" -} \ No newline at end of file +} diff --git a/packages/babel-parser/test/fixtures/es2018/object-rest-spread/10/output.json b/packages/babel-parser/test/fixtures/es2018/object-rest-spread/10/output.json index 485e729af53e..6b852f78deea 100644 --- a/packages/babel-parser/test/fixtures/es2018/object-rest-spread/10/output.json +++ b/packages/babel-parser/test/fixtures/es2018/object-rest-spread/10/output.json @@ -183,7 +183,10 @@ "shorthand": true } } - ] + ], + "extra": { + "trailingComma": 10 + } }, "init": { "type": "Identifier", diff --git a/packages/babel-parser/test/fixtures/es2018/object-rest-spread/11/options.json b/packages/babel-parser/test/fixtures/es2018/object-rest-spread/11/options.json index 6dad74eebd16..2104ca43283f 100644 --- a/packages/babel-parser/test/fixtures/es2018/object-rest-spread/11/options.json +++ b/packages/babel-parser/test/fixtures/es2018/object-rest-spread/11/options.json @@ -1,4 +1,3 @@ { - "sourceType": "module", - "throws": "Identifier 'foo' has already been declared (2:23)" + "sourceType": "module" } diff --git a/packages/babel-parser/test/fixtures/es2018/object-rest-spread/11/output.json b/packages/babel-parser/test/fixtures/es2018/object-rest-spread/11/output.json new file mode 100644 index 000000000000..8e0284f73c05 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2018/object-rest-spread/11/output.json @@ -0,0 +1,297 @@ +{ + "type": "File", + "start": 0, + "end": 57, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 35 + } + }, + "errors": [ + "SyntaxError: Identifier 'foo' has already been declared (2:23)", + "SyntaxError: `foo` has already been exported. Exported identifiers must be unique. (2:23)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 57, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 35 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExportNamedDeclaration", + "start": 0, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "specifiers": [], + "source": null, + "declaration": { + "type": "VariableDeclaration", + "start": 7, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 13, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "id": { + "type": "Identifier", + "start": 13, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 16 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "init": { + "type": "NumericLiteral", + "start": 19, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + ], + "kind": "const" + } + }, + { + "type": "ExportNamedDeclaration", + "start": 22, + "end": 57, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 35 + } + }, + "specifiers": [], + "source": null, + "declaration": { + "type": "VariableDeclaration", + "start": 29, + "end": 57, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 35 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 35, + "end": 56, + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 34 + } + }, + "id": { + "type": "ObjectPattern", + "start": 35, + "end": 50, + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 28 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 37, + "end": 40, + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 18 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 37, + "end": 40, + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 18 + }, + "identifierName": "bar" + }, + "name": "bar" + }, + "computed": false, + "shorthand": true, + "value": { + "type": "Identifier", + "start": 37, + "end": 40, + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 18 + }, + "identifierName": "bar" + }, + "name": "bar" + }, + "extra": { + "shorthand": true + } + }, + { + "type": "RestElement", + "start": 42, + "end": 48, + "loc": { + "start": { + "line": 2, + "column": 20 + }, + "end": { + "line": 2, + "column": 26 + } + }, + "argument": { + "type": "Identifier", + "start": 45, + "end": 48, + "loc": { + "start": { + "line": 2, + "column": 23 + }, + "end": { + "line": 2, + "column": 26 + }, + "identifierName": "foo" + }, + "name": "foo" + } + } + ] + }, + "init": { + "type": "Identifier", + "start": 53, + "end": 56, + "loc": { + "start": { + "line": 2, + "column": 31 + }, + "end": { + "line": 2, + "column": 34 + }, + "identifierName": "baz" + }, + "name": "baz" + } + } + ], + "kind": "const" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2018/object-rest-spread/12/options.json b/packages/babel-parser/test/fixtures/es2018/object-rest-spread/12/options.json index 165223a448a3..2104ca43283f 100644 --- a/packages/babel-parser/test/fixtures/es2018/object-rest-spread/12/options.json +++ b/packages/babel-parser/test/fixtures/es2018/object-rest-spread/12/options.json @@ -1,4 +1,3 @@ { - "sourceType": "module", - "throws": "Identifier 'bar' has already been declared (2:13)" + "sourceType": "module" } diff --git a/packages/babel-parser/test/fixtures/es2018/object-rest-spread/12/output.json b/packages/babel-parser/test/fixtures/es2018/object-rest-spread/12/output.json new file mode 100644 index 000000000000..dd11a6812a7b --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2018/object-rest-spread/12/output.json @@ -0,0 +1,297 @@ +{ + "type": "File", + "start": 0, + "end": 57, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 21 + } + }, + "errors": [ + "SyntaxError: Identifier 'bar' has already been declared (2:13)", + "SyntaxError: `bar` has already been exported. Exported identifiers must be unique. (2:13)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 57, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 21 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExportNamedDeclaration", + "start": 0, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "specifiers": [], + "source": null, + "declaration": { + "type": "VariableDeclaration", + "start": 7, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 13, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "id": { + "type": "ObjectPattern", + "start": 13, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 15, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 15, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 18 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "computed": false, + "shorthand": true, + "value": { + "type": "Identifier", + "start": 15, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 18 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "extra": { + "shorthand": true + } + }, + { + "type": "RestElement", + "start": 20, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "argument": { + "type": "Identifier", + "start": 23, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 26 + }, + "identifierName": "bar" + }, + "name": "bar" + } + } + ] + }, + "init": { + "type": "Identifier", + "start": 31, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 31 + }, + "end": { + "line": 1, + "column": 34 + }, + "identifierName": "baz" + }, + "name": "baz" + } + } + ], + "kind": "const" + } + }, + { + "type": "ExportNamedDeclaration", + "start": 36, + "end": 57, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 21 + } + }, + "specifiers": [], + "source": null, + "declaration": { + "type": "VariableDeclaration", + "start": 43, + "end": 57, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 21 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 49, + "end": 56, + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 20 + } + }, + "id": { + "type": "Identifier", + "start": 49, + "end": 52, + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 16 + }, + "identifierName": "bar" + }, + "name": "bar" + }, + "init": { + "type": "NumericLiteral", + "start": 55, + "end": 56, + "loc": { + "start": { + "line": 2, + "column": 19 + }, + "end": { + "line": 2, + "column": 20 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + ], + "kind": "const" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2018/object-rest-spread/13/options.json b/packages/babel-parser/test/fixtures/es2018/object-rest-spread/13/options.json index 68df28e41c41..2104ca43283f 100644 --- a/packages/babel-parser/test/fixtures/es2018/object-rest-spread/13/options.json +++ b/packages/babel-parser/test/fixtures/es2018/object-rest-spread/13/options.json @@ -1,4 +1,3 @@ { - "sourceType": "module", - "throws": "Identifier 'foo' has already been declared (2:30)" + "sourceType": "module" } diff --git a/packages/babel-parser/test/fixtures/es2018/object-rest-spread/13/output.json b/packages/babel-parser/test/fixtures/es2018/object-rest-spread/13/output.json new file mode 100644 index 000000000000..a591bf90155e --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2018/object-rest-spread/13/output.json @@ -0,0 +1,349 @@ +{ + "type": "File", + "start": 0, + "end": 66, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 44 + } + }, + "errors": [ + "SyntaxError: Identifier 'foo' has already been declared (2:30)", + "SyntaxError: `foo` has already been exported. Exported identifiers must be unique. (2:30)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 66, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 44 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExportNamedDeclaration", + "start": 0, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "specifiers": [], + "source": null, + "declaration": { + "type": "VariableDeclaration", + "start": 7, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 13, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "id": { + "type": "Identifier", + "start": 13, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 16 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "init": { + "type": "NumericLiteral", + "start": 19, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + ], + "kind": "const" + } + }, + { + "type": "ExportNamedDeclaration", + "start": 22, + "end": 66, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 44 + } + }, + "specifiers": [], + "source": null, + "declaration": { + "type": "VariableDeclaration", + "start": 29, + "end": 66, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 44 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 35, + "end": 65, + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 43 + } + }, + "id": { + "type": "ObjectPattern", + "start": 35, + "end": 59, + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 37 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 37, + "end": 57, + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 35 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 37, + "end": 40, + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 18 + }, + "identifierName": "bar" + }, + "name": "bar" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "ObjectPattern", + "start": 42, + "end": 57, + "loc": { + "start": { + "line": 2, + "column": 20 + }, + "end": { + "line": 2, + "column": 35 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 44, + "end": 47, + "loc": { + "start": { + "line": 2, + "column": 22 + }, + "end": { + "line": 2, + "column": 25 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 44, + "end": 47, + "loc": { + "start": { + "line": 2, + "column": 22 + }, + "end": { + "line": 2, + "column": 25 + }, + "identifierName": "baz" + }, + "name": "baz" + }, + "computed": false, + "shorthand": true, + "value": { + "type": "Identifier", + "start": 44, + "end": 47, + "loc": { + "start": { + "line": 2, + "column": 22 + }, + "end": { + "line": 2, + "column": 25 + }, + "identifierName": "baz" + }, + "name": "baz" + }, + "extra": { + "shorthand": true + } + }, + { + "type": "RestElement", + "start": 49, + "end": 55, + "loc": { + "start": { + "line": 2, + "column": 27 + }, + "end": { + "line": 2, + "column": 33 + } + }, + "argument": { + "type": "Identifier", + "start": 52, + "end": 55, + "loc": { + "start": { + "line": 2, + "column": 30 + }, + "end": { + "line": 2, + "column": 33 + }, + "identifierName": "foo" + }, + "name": "foo" + } + } + ] + } + } + ] + }, + "init": { + "type": "Identifier", + "start": 62, + "end": 65, + "loc": { + "start": { + "line": 2, + "column": 40 + }, + "end": { + "line": 2, + "column": 43 + }, + "identifierName": "qux" + }, + "name": "qux" + } + } + ], + "kind": "const" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2018/object-rest-spread/14/options.json b/packages/babel-parser/test/fixtures/es2018/object-rest-spread/14/options.json index 280073b140f0..2104ca43283f 100644 --- a/packages/babel-parser/test/fixtures/es2018/object-rest-spread/14/options.json +++ b/packages/babel-parser/test/fixtures/es2018/object-rest-spread/14/options.json @@ -1,4 +1,3 @@ { - "sourceType": "module", - "throws": "Identifier 'foo' has already been declared (2:29)" + "sourceType": "module" } diff --git a/packages/babel-parser/test/fixtures/es2018/object-rest-spread/14/output.json b/packages/babel-parser/test/fixtures/es2018/object-rest-spread/14/output.json new file mode 100644 index 000000000000..d092e82a47c3 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2018/object-rest-spread/14/output.json @@ -0,0 +1,331 @@ +{ + "type": "File", + "start": 0, + "end": 64, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 42 + } + }, + "errors": [ + "SyntaxError: Identifier 'foo' has already been declared (2:29)", + "SyntaxError: `foo` has already been exported. Exported identifiers must be unique. (2:29)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 64, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 42 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExportNamedDeclaration", + "start": 0, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "specifiers": [], + "source": null, + "declaration": { + "type": "VariableDeclaration", + "start": 7, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 13, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "id": { + "type": "Identifier", + "start": 13, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 16 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "init": { + "type": "NumericLiteral", + "start": 19, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + ], + "kind": "const" + } + }, + { + "type": "ExportNamedDeclaration", + "start": 22, + "end": 64, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 42 + } + }, + "specifiers": [], + "source": null, + "declaration": { + "type": "VariableDeclaration", + "start": 29, + "end": 64, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 42 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 35, + "end": 63, + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 41 + } + }, + "id": { + "type": "ArrayPattern", + "start": 35, + "end": 57, + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 35 + } + }, + "elements": [ + { + "type": "Identifier", + "start": 36, + "end": 39, + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 17 + }, + "identifierName": "bar" + }, + "name": "bar" + }, + { + "type": "ObjectPattern", + "start": 41, + "end": 56, + "loc": { + "start": { + "line": 2, + "column": 19 + }, + "end": { + "line": 2, + "column": 34 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 43, + "end": 46, + "loc": { + "start": { + "line": 2, + "column": 21 + }, + "end": { + "line": 2, + "column": 24 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 43, + "end": 46, + "loc": { + "start": { + "line": 2, + "column": 21 + }, + "end": { + "line": 2, + "column": 24 + }, + "identifierName": "baz" + }, + "name": "baz" + }, + "computed": false, + "shorthand": true, + "value": { + "type": "Identifier", + "start": 43, + "end": 46, + "loc": { + "start": { + "line": 2, + "column": 21 + }, + "end": { + "line": 2, + "column": 24 + }, + "identifierName": "baz" + }, + "name": "baz" + }, + "extra": { + "shorthand": true + } + }, + { + "type": "RestElement", + "start": 48, + "end": 54, + "loc": { + "start": { + "line": 2, + "column": 26 + }, + "end": { + "line": 2, + "column": 32 + } + }, + "argument": { + "type": "Identifier", + "start": 51, + "end": 54, + "loc": { + "start": { + "line": 2, + "column": 29 + }, + "end": { + "line": 2, + "column": 32 + }, + "identifierName": "foo" + }, + "name": "foo" + } + } + ] + } + ] + }, + "init": { + "type": "Identifier", + "start": 60, + "end": 63, + "loc": { + "start": { + "line": 2, + "column": 38 + }, + "end": { + "line": 2, + "column": 41 + }, + "identifierName": "qux" + }, + "name": "qux" + } + } + ], + "kind": "const" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2018/object-rest-spread/15/options.json b/packages/babel-parser/test/fixtures/es2018/object-rest-spread/15/options.json index 68df28e41c41..2104ca43283f 100644 --- a/packages/babel-parser/test/fixtures/es2018/object-rest-spread/15/options.json +++ b/packages/babel-parser/test/fixtures/es2018/object-rest-spread/15/options.json @@ -1,4 +1,3 @@ { - "sourceType": "module", - "throws": "Identifier 'foo' has already been declared (2:30)" + "sourceType": "module" } diff --git a/packages/babel-parser/test/fixtures/es2018/object-rest-spread/15/output.json b/packages/babel-parser/test/fixtures/es2018/object-rest-spread/15/output.json new file mode 100644 index 000000000000..a35595b31013 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2018/object-rest-spread/15/output.json @@ -0,0 +1,348 @@ +{ + "type": "File", + "start": 0, + "end": 66, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 44 + } + }, + "errors": [ + "SyntaxError: Identifier 'foo' has already been declared (2:30)", + "SyntaxError: `foo` has already been exported. Exported identifiers must be unique. (2:30)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 66, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 44 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExportNamedDeclaration", + "start": 0, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "specifiers": [], + "source": null, + "declaration": { + "type": "VariableDeclaration", + "start": 7, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 13, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "id": { + "type": "Identifier", + "start": 13, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 16 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "init": { + "type": "NumericLiteral", + "start": 19, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + ], + "kind": "const" + } + }, + { + "type": "ExportNamedDeclaration", + "start": 22, + "end": 66, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 44 + } + }, + "specifiers": [], + "source": null, + "declaration": { + "type": "VariableDeclaration", + "start": 29, + "end": 66, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 44 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 35, + "end": 65, + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 43 + } + }, + "id": { + "type": "ArrayPattern", + "start": 35, + "end": 59, + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 37 + } + }, + "elements": [ + { + "type": "Identifier", + "start": 36, + "end": 39, + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 17 + }, + "identifierName": "bar" + }, + "name": "bar" + }, + { + "type": "ArrayPattern", + "start": 41, + "end": 58, + "loc": { + "start": { + "line": 2, + "column": 19 + }, + "end": { + "line": 2, + "column": 36 + } + }, + "elements": [ + { + "type": "ObjectPattern", + "start": 42, + "end": 57, + "loc": { + "start": { + "line": 2, + "column": 20 + }, + "end": { + "line": 2, + "column": 35 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 44, + "end": 47, + "loc": { + "start": { + "line": 2, + "column": 22 + }, + "end": { + "line": 2, + "column": 25 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 44, + "end": 47, + "loc": { + "start": { + "line": 2, + "column": 22 + }, + "end": { + "line": 2, + "column": 25 + }, + "identifierName": "baz" + }, + "name": "baz" + }, + "computed": false, + "shorthand": true, + "value": { + "type": "Identifier", + "start": 44, + "end": 47, + "loc": { + "start": { + "line": 2, + "column": 22 + }, + "end": { + "line": 2, + "column": 25 + }, + "identifierName": "baz" + }, + "name": "baz" + }, + "extra": { + "shorthand": true + } + }, + { + "type": "RestElement", + "start": 49, + "end": 55, + "loc": { + "start": { + "line": 2, + "column": 27 + }, + "end": { + "line": 2, + "column": 33 + } + }, + "argument": { + "type": "Identifier", + "start": 52, + "end": 55, + "loc": { + "start": { + "line": 2, + "column": 30 + }, + "end": { + "line": 2, + "column": 33 + }, + "identifierName": "foo" + }, + "name": "foo" + } + } + ] + } + ] + } + ] + }, + "init": { + "type": "Identifier", + "start": 62, + "end": 65, + "loc": { + "start": { + "line": 2, + "column": 40 + }, + "end": { + "line": 2, + "column": 43 + }, + "identifierName": "qux" + }, + "name": "qux" + } + } + ], + "kind": "const" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2018/object-rest-spread/18/options.json b/packages/babel-parser/test/fixtures/es2018/object-rest-spread/18/options.json deleted file mode 100644 index b447c590ab2c..000000000000 --- a/packages/babel-parser/test/fixtures/es2018/object-rest-spread/18/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid rest operator's argument (1:5)" -} diff --git a/packages/babel-parser/test/fixtures/es2018/object-rest-spread/18/output.json b/packages/babel-parser/test/fixtures/es2018/object-rest-spread/18/output.json new file mode 100644 index 000000000000..9a9ef9274914 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2018/object-rest-spread/18/output.json @@ -0,0 +1,137 @@ +{ + "type": "File", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "errors": [ + "SyntaxError: Invalid rest operator's argument (1:5)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 1, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "operator": "=", + "left": { + "type": "ObjectPattern", + "start": 1, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "properties": [ + { + "type": "RestElement", + "start": 2, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "argument": { + "type": "ObjectPattern", + "start": 5, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "properties": [] + } + } + ] + }, + "right": { + "type": "ObjectExpression", + "start": 11, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "properties": [] + }, + "extra": { + "parenthesized": true, + "parenStart": 0 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2018/object-rest-spread/21/options.json b/packages/babel-parser/test/fixtures/es2018/object-rest-spread/21/options.json deleted file mode 100644 index b447c590ab2c..000000000000 --- a/packages/babel-parser/test/fixtures/es2018/object-rest-spread/21/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid rest operator's argument (1:5)" -} diff --git a/packages/babel-parser/test/fixtures/es2018/object-rest-spread/21/output.json b/packages/babel-parser/test/fixtures/es2018/object-rest-spread/21/output.json new file mode 100644 index 000000000000..09b6d303c4ac --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2018/object-rest-spread/21/output.json @@ -0,0 +1,173 @@ +{ + "type": "File", + "start": 0, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "errors": [ + "SyntaxError: Invalid rest operator's argument (1:5)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 1, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "operator": "=", + "left": { + "type": "ObjectPattern", + "start": 1, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "properties": [ + { + "type": "RestElement", + "start": 2, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "argument": { + "type": "AssignmentPattern", + "start": 5, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "left": { + "type": "Identifier", + "start": 5, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + }, + "identifierName": "x" + }, + "name": "x" + }, + "right": { + "type": "NumericLiteral", + "start": 9, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + } + ] + }, + "right": { + "type": "ObjectExpression", + "start": 14, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "properties": [] + }, + "extra": { + "parenthesized": true, + "parenStart": 0 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2018/object-rest-spread/24/options.json b/packages/babel-parser/test/fixtures/es2018/object-rest-spread/24/options.json deleted file mode 100644 index b447c590ab2c..000000000000 --- a/packages/babel-parser/test/fixtures/es2018/object-rest-spread/24/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid rest operator's argument (1:5)" -} diff --git a/packages/babel-parser/test/fixtures/es2018/object-rest-spread/24/output.json b/packages/babel-parser/test/fixtures/es2018/object-rest-spread/24/output.json new file mode 100644 index 000000000000..2f80e2925775 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2018/object-rest-spread/24/output.json @@ -0,0 +1,137 @@ +{ + "type": "File", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "errors": [ + "SyntaxError: Invalid rest operator's argument (1:5)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 1, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "operator": "=", + "left": { + "type": "ObjectPattern", + "start": 1, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "properties": [ + { + "type": "RestElement", + "start": 2, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "argument": { + "type": "ArrayPattern", + "start": 5, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "elements": [] + } + } + ] + }, + "right": { + "type": "ObjectExpression", + "start": 11, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "properties": [] + }, + "extra": { + "parenthesized": true, + "parenStart": 0 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2018/object-rest-spread/6/output.json b/packages/babel-parser/test/fixtures/es2018/object-rest-spread/6/output.json index 1e1e8979748a..66bdc45dc975 100644 --- a/packages/babel-parser/test/fixtures/es2018/object-rest-spread/6/output.json +++ b/packages/babel-parser/test/fixtures/es2018/object-rest-spread/6/output.json @@ -289,6 +289,7 @@ } ], "extra": { + "trailingComma": 21, "parenthesized": true, "parenStart": 0 } diff --git a/packages/babel-parser/test/fixtures/es2018/object-rest-spread/8/options.json b/packages/babel-parser/test/fixtures/es2018/object-rest-spread/8/options.json deleted file mode 100644 index c49db16e2821..000000000000 --- a/packages/babel-parser/test/fixtures/es2018/object-rest-spread/8/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Rest element must be last element (1:16)" -} diff --git a/packages/babel-parser/test/fixtures/es2018/object-rest-spread/8/output.json b/packages/babel-parser/test/fixtures/es2018/object-rest-spread/8/output.json new file mode 100644 index 000000000000..c7ff07e0d0df --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2018/object-rest-spread/8/output.json @@ -0,0 +1,250 @@ +{ + "type": "File", + "start": 0, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "errors": [ + "SyntaxError: Unexpected trailing comma after rest element (1:16)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 0, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 4, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "id": { + "type": "ObjectPattern", + "start": 4, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "x" + }, + "name": "x" + }, + "computed": false, + "shorthand": true, + "value": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "x" + }, + "name": "x" + }, + "extra": { + "shorthand": true + } + }, + { + "type": "ObjectProperty", + "start": 9, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 9, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + }, + "identifierName": "y" + }, + "name": "y" + }, + "computed": false, + "shorthand": true, + "value": { + "type": "Identifier", + "start": 9, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + }, + "identifierName": "y" + }, + "name": "y" + }, + "extra": { + "shorthand": true + } + }, + { + "type": "RestElement", + "start": 12, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "argument": { + "type": "Identifier", + "start": 15, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + }, + "identifierName": "z" + }, + "name": "z" + } + } + ], + "extra": { + "trailingComma": 16 + } + }, + "init": { + "type": "Identifier", + "start": 22, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 25 + }, + "identifierName": "obj" + }, + "name": "obj" + } + } + ], + "kind": "let" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2018/object-rest-spread/comma-after-spread-for-in/input.js b/packages/babel-parser/test/fixtures/es2018/object-rest-spread/comma-after-spread-for-in/input.js new file mode 100644 index 000000000000..f06e08484719 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2018/object-rest-spread/comma-after-spread-for-in/input.js @@ -0,0 +1 @@ +for ({...a,} in []); diff --git a/packages/babel-parser/test/fixtures/es2018/object-rest-spread/comma-after-spread-for-in/options.json b/packages/babel-parser/test/fixtures/es2018/object-rest-spread/comma-after-spread-for-in/options.json new file mode 100644 index 000000000000..b86f80dc4a72 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2018/object-rest-spread/comma-after-spread-for-in/options.json @@ -0,0 +1,3 @@ +{ + "throws": "Rest element must be last element (1:10)" +} diff --git a/packages/babel-parser/test/fixtures/es2018/object-rest-spread/comma-after-spread-nested/input.js b/packages/babel-parser/test/fixtures/es2018/object-rest-spread/comma-after-spread-nested/input.js new file mode 100644 index 000000000000..d532e288fbaf --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2018/object-rest-spread/comma-after-spread-nested/input.js @@ -0,0 +1 @@ +[{...a,}] = []; \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2018/object-rest-spread/comma-after-spread-nested/options.json b/packages/babel-parser/test/fixtures/es2018/object-rest-spread/comma-after-spread-nested/options.json new file mode 100644 index 000000000000..935d087d7ee5 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2018/object-rest-spread/comma-after-spread-nested/options.json @@ -0,0 +1,3 @@ +{ + "throws": "Rest element must be last element (1:6)" +} diff --git a/packages/babel-parser/test/fixtures/es2018/object-rest-spread/comma-after-spread/output.json b/packages/babel-parser/test/fixtures/es2018/object-rest-spread/comma-after-spread/output.json index ffb978345c27..2b3910bf3a5b 100644 --- a/packages/babel-parser/test/fixtures/es2018/object-rest-spread/comma-after-spread/output.json +++ b/packages/babel-parser/test/fixtures/es2018/object-rest-spread/comma-after-spread/output.json @@ -92,6 +92,7 @@ } ], "extra": { + "trailingComma": 6, "parenthesized": true, "parenStart": 0 } diff --git a/packages/babel-parser/test/fixtures/es2019/json-strings/directive-line-separator/output.json b/packages/babel-parser/test/fixtures/es2019/json-strings/directive-line-separator/output.json index 8bf9f02e8706..503c5e4d17c2 100644 --- a/packages/babel-parser/test/fixtures/es2019/json-strings/directive-line-separator/output.json +++ b/packages/babel-parser/test/fixtures/es2019/json-strings/directive-line-separator/output.json @@ -41,7 +41,7 @@ }, "end": { "line": 2, - "column": 15 + "column": 7 } }, "value": { @@ -55,7 +55,7 @@ }, "end": { "line": 2, - "column": 14 + "column": 6 } }, "value": "before
after", diff --git a/packages/babel-parser/test/fixtures/es2019/json-strings/directive-paragraph-separator/output.json b/packages/babel-parser/test/fixtures/es2019/json-strings/directive-paragraph-separator/output.json index f83d867447e7..ac843e7faa2c 100644 --- a/packages/babel-parser/test/fixtures/es2019/json-strings/directive-paragraph-separator/output.json +++ b/packages/babel-parser/test/fixtures/es2019/json-strings/directive-paragraph-separator/output.json @@ -41,7 +41,7 @@ }, "end": { "line": 2, - "column": 15 + "column": 7 } }, "value": { @@ -55,7 +55,7 @@ }, "end": { "line": 2, - "column": 14 + "column": 6 } }, "value": "before
after", diff --git a/packages/babel-parser/test/fixtures/es2019/json-strings/string-line-separator/output.json b/packages/babel-parser/test/fixtures/es2019/json-strings/string-line-separator/output.json index 388733cc206a..9ac309222fd1 100644 --- a/packages/babel-parser/test/fixtures/es2019/json-strings/string-line-separator/output.json +++ b/packages/babel-parser/test/fixtures/es2019/json-strings/string-line-separator/output.json @@ -40,7 +40,7 @@ }, "end": { "line": 2, - "column": 17 + "column": 8 } }, "expression": { @@ -54,7 +54,7 @@ }, "end": { "line": 2, - "column": 15 + "column": 6 } }, "extra": { diff --git a/packages/babel-parser/test/fixtures/es2019/json-strings/string-paragraph-separator/output.json b/packages/babel-parser/test/fixtures/es2019/json-strings/string-paragraph-separator/output.json index a482ccfb266a..edf8712a70d2 100644 --- a/packages/babel-parser/test/fixtures/es2019/json-strings/string-paragraph-separator/output.json +++ b/packages/babel-parser/test/fixtures/es2019/json-strings/string-paragraph-separator/output.json @@ -40,7 +40,7 @@ }, "end": { "line": 2, - "column": 17 + "column": 8 } }, "expression": { @@ -54,7 +54,7 @@ }, "end": { "line": 2, - "column": 15 + "column": 6 } }, "extra": { diff --git a/packages/babel-parser/test/fixtures/es2019/json-strings/template-line-separator/input.js b/packages/babel-parser/test/fixtures/es2019/json-strings/template-line-separator/input.js new file mode 100644 index 000000000000..73604d9cd234 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2019/json-strings/template-line-separator/input.js @@ -0,0 +1,2 @@ +(`before
after`); +// ^ That's a U+2028 LINE SEPARATOR UTF-16 char (between 'before' and 'after') diff --git a/packages/babel-parser/test/fixtures/es2019/json-strings/template-line-separator/output.json b/packages/babel-parser/test/fixtures/es2019/json-strings/template-line-separator/output.json new file mode 100644 index 000000000000..603b0c53b682 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2019/json-strings/template-line-separator/output.json @@ -0,0 +1,128 @@ +{ + "type": "File", + "start": 0, + "end": 101, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 83 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 101, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 83 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 8 + } + }, + "expression": { + "type": "TemplateLiteral", + "start": 1, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 2, + "column": 6 + } + }, + "expressions": [], + "quasis": [ + { + "type": "TemplateElement", + "start": 2, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 2, + "column": 5 + } + }, + "value": { + "raw": "before
after", + "cooked": "before
after" + }, + "tail": true + } + ], + "extra": { + "parenthesized": true, + "parenStart": 0 + } + }, + "trailingComments": [ + { + "type": "CommentLine", + "value": " ^ That's a U+2028 LINE SEPARATOR UTF-16 char (between 'before' and 'after')", + "start": 18, + "end": 101, + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 83 + } + } + } + ] + } + ], + "directives": [] + }, + "comments": [ + { + "type": "CommentLine", + "value": " ^ That's a U+2028 LINE SEPARATOR UTF-16 char (between 'before' and 'after')", + "start": 18, + "end": 101, + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 83 + } + } + } + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2019/json-strings/template-paragraph-separator/input.js b/packages/babel-parser/test/fixtures/es2019/json-strings/template-paragraph-separator/input.js new file mode 100644 index 000000000000..9272512911d9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2019/json-strings/template-paragraph-separator/input.js @@ -0,0 +1,2 @@ +(`before
after`); +// ^ That's a U+2029 PARAGRAPH SEPARATOR UTF-16 char (between 'before' and 'after') diff --git a/packages/babel-parser/test/fixtures/es2019/json-strings/template-paragraph-separator/output.json b/packages/babel-parser/test/fixtures/es2019/json-strings/template-paragraph-separator/output.json new file mode 100644 index 000000000000..d1d7e83639aa --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2019/json-strings/template-paragraph-separator/output.json @@ -0,0 +1,128 @@ +{ + "type": "File", + "start": 0, + "end": 106, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 88 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 106, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 88 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 8 + } + }, + "expression": { + "type": "TemplateLiteral", + "start": 1, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 2, + "column": 6 + } + }, + "expressions": [], + "quasis": [ + { + "type": "TemplateElement", + "start": 2, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 2, + "column": 5 + } + }, + "value": { + "raw": "before
after", + "cooked": "before
after" + }, + "tail": true + } + ], + "extra": { + "parenthesized": true, + "parenStart": 0 + } + }, + "trailingComments": [ + { + "type": "CommentLine", + "value": " ^ That's a U+2029 PARAGRAPH SEPARATOR UTF-16 char (between 'before' and 'after')", + "start": 18, + "end": 106, + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 88 + } + } + } + ] + } + ], + "directives": [] + }, + "comments": [ + { + "type": "CommentLine", + "value": " ^ That's a U+2029 PARAGRAPH SEPARATOR UTF-16 char (between 'before' and 'after')", + "start": 18, + "end": 106, + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 88 + } + } + } + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/dynamic-import/direct-calls-only/input.js b/packages/babel-parser/test/fixtures/es2020/dynamic-import/direct-calls-only/input.js similarity index 100% rename from packages/babel-parser/test/fixtures/experimental/dynamic-import/direct-calls-only/input.js rename to packages/babel-parser/test/fixtures/es2020/dynamic-import/direct-calls-only/input.js diff --git a/packages/babel-parser/test/fixtures/es2020/dynamic-import/direct-calls-only/output.json b/packages/babel-parser/test/fixtures/es2020/dynamic-import/direct-calls-only/output.json new file mode 100644 index 000000000000..07f26c50d81d --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2020/dynamic-import/direct-calls-only/output.json @@ -0,0 +1,172 @@ +{ + "type": "File", + "start": 0, + "end": 49, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Dynamic imports require a parameter: import('a.js') (2:9)", + "SyntaxError: The only valid meta property for import is import.meta (2:16)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 49, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 49, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 19 + }, + "identifierName": "failsParse" + }, + "name": "failsParse" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 22, + "end": 49, + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": [ + { + "type": "ReturnStatement", + "start": 26, + "end": 47, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 23 + } + }, + "argument": { + "type": "CallExpression", + "start": 33, + "end": 46, + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 22 + } + }, + "callee": { + "type": "MetaProperty", + "start": 33, + "end": 44, + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 20 + } + }, + "meta": { + "type": "Identifier", + "start": 33, + "end": 39, + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 15 + }, + "identifierName": "import" + }, + "name": "import" + }, + "property": { + "type": "Identifier", + "start": 40, + "end": 44, + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 20 + }, + "identifierName": "then" + }, + "name": "then" + } + }, + "arguments": [] + } + } + ], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/dynamic-import/generator/input.js b/packages/babel-parser/test/fixtures/es2020/dynamic-import/generator/input.js similarity index 100% rename from packages/babel-parser/test/fixtures/experimental/dynamic-import/generator/input.js rename to packages/babel-parser/test/fixtures/es2020/dynamic-import/generator/input.js diff --git a/packages/babel-parser/test/fixtures/experimental/dynamic-import/generator/output.json b/packages/babel-parser/test/fixtures/es2020/dynamic-import/generator/output.json similarity index 100% rename from packages/babel-parser/test/fixtures/experimental/dynamic-import/generator/output.json rename to packages/babel-parser/test/fixtures/es2020/dynamic-import/generator/output.json diff --git a/packages/babel-parser/test/fixtures/experimental/dynamic-import/inside-function/input.js b/packages/babel-parser/test/fixtures/es2020/dynamic-import/inside-function/input.js similarity index 100% rename from packages/babel-parser/test/fixtures/experimental/dynamic-import/inside-function/input.js rename to packages/babel-parser/test/fixtures/es2020/dynamic-import/inside-function/input.js diff --git a/packages/babel-parser/test/fixtures/experimental/dynamic-import/inside-function/output.json b/packages/babel-parser/test/fixtures/es2020/dynamic-import/inside-function/output.json similarity index 100% rename from packages/babel-parser/test/fixtures/experimental/dynamic-import/inside-function/output.json rename to packages/babel-parser/test/fixtures/es2020/dynamic-import/inside-function/output.json diff --git a/packages/babel-parser/test/fixtures/experimental/dynamic-import/invalid-arguments-spread/input.js b/packages/babel-parser/test/fixtures/es2020/dynamic-import/invalid-arguments-spread/input.js similarity index 100% rename from packages/babel-parser/test/fixtures/experimental/dynamic-import/invalid-arguments-spread/input.js rename to packages/babel-parser/test/fixtures/es2020/dynamic-import/invalid-arguments-spread/input.js diff --git a/packages/babel-parser/test/fixtures/es2020/dynamic-import/invalid-arguments-spread/output.json b/packages/babel-parser/test/fixtures/es2020/dynamic-import/invalid-arguments-spread/output.json new file mode 100644 index 000000000000..d6eaecc7e5c0 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2020/dynamic-import/invalid-arguments-spread/output.json @@ -0,0 +1,137 @@ +{ + "type": "File", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "errors": [ + "SyntaxError: ... is not allowed in import() (1:7)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "expression": { + "type": "CallExpression", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "callee": { + "type": "Import", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + "arguments": [ + { + "type": "SpreadElement", + "start": 7, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "argument": { + "type": "ArrayExpression", + "start": 10, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "elements": [ + { + "type": "NumericLiteral", + "start": 11, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + ] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/dynamic-import/invalid-new/input.js b/packages/babel-parser/test/fixtures/es2020/dynamic-import/invalid-new/input.js similarity index 100% rename from packages/babel-parser/test/fixtures/experimental/dynamic-import/invalid-new/input.js rename to packages/babel-parser/test/fixtures/es2020/dynamic-import/invalid-new/input.js diff --git a/packages/babel-parser/test/fixtures/es2020/dynamic-import/invalid-new/output.json b/packages/babel-parser/test/fixtures/es2020/dynamic-import/invalid-new/output.json new file mode 100644 index 000000000000..a0b8467953bc --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2020/dynamic-import/invalid-new/output.json @@ -0,0 +1,105 @@ +{ + "type": "File", + "start": 0, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "errors": [ + "SyntaxError: Cannot use new with import(...) (1:4)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "expression": { + "type": "NewExpression", + "start": 0, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "callee": { + "type": "Import", + "start": 4, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + "arguments": [ + { + "type": "StringLiteral", + "start": 11, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "extra": { + "rawValue": "foo", + "raw": "\"foo\"" + }, + "value": "foo" + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/dynamic-import/invalid-trailing-comma/input.js b/packages/babel-parser/test/fixtures/es2020/dynamic-import/invalid-trailing-comma/input.js similarity index 100% rename from packages/babel-parser/test/fixtures/experimental/dynamic-import/invalid-trailing-comma/input.js rename to packages/babel-parser/test/fixtures/es2020/dynamic-import/invalid-trailing-comma/input.js diff --git a/packages/babel-parser/test/fixtures/es2020/dynamic-import/invalid-trailing-comma/output.json b/packages/babel-parser/test/fixtures/es2020/dynamic-import/invalid-trailing-comma/output.json new file mode 100644 index 000000000000..fde34fb849ab --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2020/dynamic-import/invalid-trailing-comma/output.json @@ -0,0 +1,108 @@ +{ + "type": "File", + "start": 0, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "errors": [ + "SyntaxError: Trailing comma is disallowed inside import(...) arguments (1:12)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "expression": { + "type": "CallExpression", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "callee": { + "type": "Import", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + "extra": { + "trailingComma": 12 + }, + "arguments": [ + { + "type": "StringLiteral", + "start": 7, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "extra": { + "rawValue": "foo", + "raw": "\"foo\"" + }, + "value": "foo" + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/dynamic-import/multiple-args/input.js b/packages/babel-parser/test/fixtures/es2020/dynamic-import/multiple-args/input.js similarity index 100% rename from packages/babel-parser/test/fixtures/experimental/dynamic-import/multiple-args/input.js rename to packages/babel-parser/test/fixtures/es2020/dynamic-import/multiple-args/input.js diff --git a/packages/babel-parser/test/fixtures/es2020/dynamic-import/multiple-args/output.json b/packages/babel-parser/test/fixtures/es2020/dynamic-import/multiple-args/output.json new file mode 100644 index 000000000000..f66dbbf22885 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2020/dynamic-import/multiple-args/output.json @@ -0,0 +1,125 @@ +{ + "type": "File", + "start": 0, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "errors": [ + "SyntaxError: import() requires exactly one argument (1:0)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "expression": { + "type": "CallExpression", + "start": 0, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "callee": { + "type": "Import", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + "arguments": [ + { + "type": "StringLiteral", + "start": 7, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "extra": { + "rawValue": "hello", + "raw": "'hello'" + }, + "value": "hello" + }, + { + "type": "StringLiteral", + "start": 16, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "extra": { + "rawValue": "world", + "raw": "'world'" + }, + "value": "world" + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/dynamic-import/no-args/input.js b/packages/babel-parser/test/fixtures/es2020/dynamic-import/no-args/input.js similarity index 100% rename from packages/babel-parser/test/fixtures/experimental/dynamic-import/no-args/input.js rename to packages/babel-parser/test/fixtures/es2020/dynamic-import/no-args/input.js diff --git a/packages/babel-parser/test/fixtures/es2020/dynamic-import/no-args/output.json b/packages/babel-parser/test/fixtures/es2020/dynamic-import/no-args/output.json new file mode 100644 index 000000000000..9f50d0da240c --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2020/dynamic-import/no-args/output.json @@ -0,0 +1,84 @@ +{ + "type": "File", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "errors": [ + "SyntaxError: import() requires exactly one argument (1:0)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "expression": { + "type": "CallExpression", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "callee": { + "type": "Import", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + "arguments": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/dynamic-import/no-plugin/input.js b/packages/babel-parser/test/fixtures/es2020/dynamic-import/parses-module/input.js similarity index 100% rename from packages/babel-parser/test/fixtures/experimental/dynamic-import/no-plugin/input.js rename to packages/babel-parser/test/fixtures/es2020/dynamic-import/parses-module/input.js diff --git a/packages/babel-parser/test/fixtures/es2020/dynamic-import/parses-module/options.json b/packages/babel-parser/test/fixtures/es2020/dynamic-import/parses-module/options.json new file mode 100644 index 000000000000..2104ca43283f --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2020/dynamic-import/parses-module/options.json @@ -0,0 +1,3 @@ +{ + "sourceType": "module" +} diff --git a/packages/babel-parser/test/fixtures/experimental/dynamic-import/parses-module/output.json b/packages/babel-parser/test/fixtures/es2020/dynamic-import/parses-module/output.json similarity index 100% rename from packages/babel-parser/test/fixtures/experimental/dynamic-import/parses-module/output.json rename to packages/babel-parser/test/fixtures/es2020/dynamic-import/parses-module/output.json diff --git a/packages/babel-parser/test/fixtures/experimental/dynamic-import/parses-strict/input.js b/packages/babel-parser/test/fixtures/es2020/dynamic-import/parses-strict/input.js similarity index 100% rename from packages/babel-parser/test/fixtures/experimental/dynamic-import/parses-strict/input.js rename to packages/babel-parser/test/fixtures/es2020/dynamic-import/parses-strict/input.js diff --git a/packages/babel-parser/test/fixtures/experimental/dynamic-import/parses-strict/output.json b/packages/babel-parser/test/fixtures/es2020/dynamic-import/parses-strict/output.json similarity index 100% rename from packages/babel-parser/test/fixtures/experimental/dynamic-import/parses-strict/output.json rename to packages/babel-parser/test/fixtures/es2020/dynamic-import/parses-strict/output.json diff --git a/packages/babel-parser/test/fixtures/experimental/dynamic-import/return-value/input.js b/packages/babel-parser/test/fixtures/es2020/dynamic-import/return-value/input.js similarity index 100% rename from packages/babel-parser/test/fixtures/experimental/dynamic-import/return-value/input.js rename to packages/babel-parser/test/fixtures/es2020/dynamic-import/return-value/input.js diff --git a/packages/babel-parser/test/fixtures/experimental/dynamic-import/return-value/output.json b/packages/babel-parser/test/fixtures/es2020/dynamic-import/return-value/output.json similarity index 100% rename from packages/babel-parser/test/fixtures/experimental/dynamic-import/return-value/output.json rename to packages/babel-parser/test/fixtures/es2020/dynamic-import/return-value/output.json diff --git a/packages/babel-parser/test/fixtures/experimental/dynamic-import/top-level/input.js b/packages/babel-parser/test/fixtures/es2020/dynamic-import/top-level/input.js similarity index 100% rename from packages/babel-parser/test/fixtures/experimental/dynamic-import/top-level/input.js rename to packages/babel-parser/test/fixtures/es2020/dynamic-import/top-level/input.js diff --git a/packages/babel-parser/test/fixtures/experimental/dynamic-import/top-level/output.json b/packages/babel-parser/test/fixtures/es2020/dynamic-import/top-level/output.json similarity index 100% rename from packages/babel-parser/test/fixtures/experimental/dynamic-import/top-level/output.json rename to packages/babel-parser/test/fixtures/es2020/dynamic-import/top-level/output.json diff --git a/packages/babel-parser/test/fixtures/experimental/dynamic-import/variable-arguments/input.js b/packages/babel-parser/test/fixtures/es2020/dynamic-import/variable-arguments/input.js similarity index 100% rename from packages/babel-parser/test/fixtures/experimental/dynamic-import/variable-arguments/input.js rename to packages/babel-parser/test/fixtures/es2020/dynamic-import/variable-arguments/input.js diff --git a/packages/babel-parser/test/fixtures/experimental/dynamic-import/variable-arguments/output.json b/packages/babel-parser/test/fixtures/es2020/dynamic-import/variable-arguments/output.json similarity index 100% rename from packages/babel-parser/test/fixtures/experimental/dynamic-import/variable-arguments/output.json rename to packages/babel-parser/test/fixtures/es2020/dynamic-import/variable-arguments/output.json diff --git a/packages/babel-parser/test/fixtures/experimental/export-extensions/ns-and-named/input.js b/packages/babel-parser/test/fixtures/es2020/export-ns-from/ns-and-named/input.js similarity index 100% rename from packages/babel-parser/test/fixtures/experimental/export-extensions/ns-and-named/input.js rename to packages/babel-parser/test/fixtures/es2020/export-ns-from/ns-and-named/input.js diff --git a/packages/babel-parser/test/fixtures/experimental/export-extensions/ns-and-named/output.json b/packages/babel-parser/test/fixtures/es2020/export-ns-from/ns-and-named/output.json similarity index 100% rename from packages/babel-parser/test/fixtures/experimental/export-extensions/ns-and-named/output.json rename to packages/babel-parser/test/fixtures/es2020/export-ns-from/ns-and-named/output.json diff --git a/packages/babel-parser/test/fixtures/experimental/export-extensions/ns-default/input.js b/packages/babel-parser/test/fixtures/es2020/export-ns-from/ns-default/input.js similarity index 100% rename from packages/babel-parser/test/fixtures/experimental/export-extensions/ns-default/input.js rename to packages/babel-parser/test/fixtures/es2020/export-ns-from/ns-default/input.js diff --git a/packages/babel-parser/test/fixtures/experimental/export-extensions/ns-default/output.json b/packages/babel-parser/test/fixtures/es2020/export-ns-from/ns-default/output.json similarity index 100% rename from packages/babel-parser/test/fixtures/experimental/export-extensions/ns-default/output.json rename to packages/babel-parser/test/fixtures/es2020/export-ns-from/ns-default/output.json diff --git a/packages/babel-parser/test/fixtures/experimental/_no-plugin/export-namespace/input.js b/packages/babel-parser/test/fixtures/es2020/export-ns-from/ns/input.js similarity index 100% rename from packages/babel-parser/test/fixtures/experimental/_no-plugin/export-namespace/input.js rename to packages/babel-parser/test/fixtures/es2020/export-ns-from/ns/input.js diff --git a/packages/babel-parser/test/fixtures/experimental/export-extensions/ns/output.json b/packages/babel-parser/test/fixtures/es2020/export-ns-from/ns/output.json similarity index 100% rename from packages/babel-parser/test/fixtures/experimental/export-extensions/ns/output.json rename to packages/babel-parser/test/fixtures/es2020/export-ns-from/ns/output.json diff --git a/packages/babel-parser/test/fixtures/es2020/export-ns-from/options.json b/packages/babel-parser/test/fixtures/es2020/export-ns-from/options.json new file mode 100644 index 000000000000..2104ca43283f --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2020/export-ns-from/options.json @@ -0,0 +1,3 @@ +{ + "sourceType": "module" +} diff --git a/packages/babel-parser/test/fixtures/es2020/nullish-coalescing-operator/and-nullish/input.js b/packages/babel-parser/test/fixtures/es2020/nullish-coalescing-operator/and-nullish/input.js new file mode 100644 index 000000000000..4080eadc3962 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2020/nullish-coalescing-operator/and-nullish/input.js @@ -0,0 +1 @@ +(a && b) ?? c; diff --git a/packages/babel-parser/test/fixtures/es2020/nullish-coalescing-operator/and-nullish/output.json b/packages/babel-parser/test/fixtures/es2020/nullish-coalescing-operator/and-nullish/output.json new file mode 100644 index 000000000000..31a372d44df5 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2020/nullish-coalescing-operator/and-nullish/output.json @@ -0,0 +1,137 @@ +{ + "type": "File", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "expression": { + "type": "LogicalExpression", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "left": { + "type": "LogicalExpression", + "start": 1, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "left": { + "type": "Identifier", + "start": 1, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + }, + "identifierName": "a" + }, + "name": "a" + }, + "operator": "&&", + "right": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "b" + }, + "name": "b" + }, + "extra": { + "parenthesized": true, + "parenStart": 0 + } + }, + "operator": "??", + "right": { + "type": "Identifier", + "start": 12, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + }, + "identifierName": "c" + }, + "name": "c" + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/associativity/input.js b/packages/babel-parser/test/fixtures/es2020/nullish-coalescing-operator/associativity/input.js similarity index 100% rename from packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/associativity/input.js rename to packages/babel-parser/test/fixtures/es2020/nullish-coalescing-operator/associativity/input.js diff --git a/packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/associativity/output.json b/packages/babel-parser/test/fixtures/es2020/nullish-coalescing-operator/associativity/output.json similarity index 100% rename from packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/associativity/output.json rename to packages/babel-parser/test/fixtures/es2020/nullish-coalescing-operator/associativity/output.json diff --git a/packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/expression/input.js b/packages/babel-parser/test/fixtures/es2020/nullish-coalescing-operator/expression/input.js similarity index 100% rename from packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/expression/input.js rename to packages/babel-parser/test/fixtures/es2020/nullish-coalescing-operator/expression/input.js diff --git a/packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/expression/output.json b/packages/babel-parser/test/fixtures/es2020/nullish-coalescing-operator/expression/output.json similarity index 100% rename from packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/expression/output.json rename to packages/babel-parser/test/fixtures/es2020/nullish-coalescing-operator/expression/output.json diff --git a/packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/multiline/input.js b/packages/babel-parser/test/fixtures/es2020/nullish-coalescing-operator/multiline/input.js similarity index 100% rename from packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/multiline/input.js rename to packages/babel-parser/test/fixtures/es2020/nullish-coalescing-operator/multiline/input.js diff --git a/packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/multiline/output.json b/packages/babel-parser/test/fixtures/es2020/nullish-coalescing-operator/multiline/output.json similarity index 100% rename from packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/multiline/output.json rename to packages/babel-parser/test/fixtures/es2020/nullish-coalescing-operator/multiline/output.json diff --git a/packages/babel-parser/test/fixtures/es2020/nullish-coalescing-operator/no-paren-and-nullish/input.js b/packages/babel-parser/test/fixtures/es2020/nullish-coalescing-operator/no-paren-and-nullish/input.js new file mode 100644 index 000000000000..650d93b39a30 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2020/nullish-coalescing-operator/no-paren-and-nullish/input.js @@ -0,0 +1 @@ +c && d ?? e; diff --git a/packages/babel-parser/test/fixtures/es2020/nullish-coalescing-operator/no-paren-and-nullish/options.json b/packages/babel-parser/test/fixtures/es2020/nullish-coalescing-operator/no-paren-and-nullish/options.json new file mode 100644 index 000000000000..8adc3b6ed3e7 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2020/nullish-coalescing-operator/no-paren-and-nullish/options.json @@ -0,0 +1,4 @@ +{ + "plugins": ["estree"], + "throws": "Nullish coalescing operator(??) requires parens when mixing with logical operators (1:0)" +} diff --git a/packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/nullish-and/input.js b/packages/babel-parser/test/fixtures/es2020/nullish-coalescing-operator/no-paren-nullish-and/input.js similarity index 100% rename from packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/nullish-and/input.js rename to packages/babel-parser/test/fixtures/es2020/nullish-coalescing-operator/no-paren-nullish-and/input.js diff --git a/packages/babel-parser/test/fixtures/es2020/nullish-coalescing-operator/no-paren-nullish-and/options.json b/packages/babel-parser/test/fixtures/es2020/nullish-coalescing-operator/no-paren-nullish-and/options.json new file mode 100644 index 000000000000..b4d06207ab24 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2020/nullish-coalescing-operator/no-paren-nullish-and/options.json @@ -0,0 +1,3 @@ +{ + "throws": "Nullish coalescing operator(??) requires parens when mixing with logical operators (1:5)" +} diff --git a/packages/babel-parser/test/fixtures/es2020/nullish-coalescing-operator/no-paren-nullish-or/input.js b/packages/babel-parser/test/fixtures/es2020/nullish-coalescing-operator/no-paren-nullish-or/input.js new file mode 100644 index 000000000000..1fd223be11f9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2020/nullish-coalescing-operator/no-paren-nullish-or/input.js @@ -0,0 +1 @@ +e ?? f ?? g || h; diff --git a/packages/babel-parser/test/fixtures/es2020/nullish-coalescing-operator/no-paren-nullish-or/options.json b/packages/babel-parser/test/fixtures/es2020/nullish-coalescing-operator/no-paren-nullish-or/options.json new file mode 100644 index 000000000000..7905b902574e --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2020/nullish-coalescing-operator/no-paren-nullish-or/options.json @@ -0,0 +1,3 @@ +{ + "throws": "Nullish coalescing operator(??) requires parens when mixing with logical operators (1:10)" +} diff --git a/packages/babel-parser/test/fixtures/es2020/nullish-coalescing-operator/no-paren-or-nullish/input.js b/packages/babel-parser/test/fixtures/es2020/nullish-coalescing-operator/no-paren-or-nullish/input.js new file mode 100644 index 000000000000..5647ff20498f --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2020/nullish-coalescing-operator/no-paren-or-nullish/input.js @@ -0,0 +1 @@ +h || i ?? j; diff --git a/packages/babel-parser/test/fixtures/es2020/nullish-coalescing-operator/no-paren-or-nullish/options.json b/packages/babel-parser/test/fixtures/es2020/nullish-coalescing-operator/no-paren-or-nullish/options.json new file mode 100644 index 000000000000..8adc3b6ed3e7 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2020/nullish-coalescing-operator/no-paren-or-nullish/options.json @@ -0,0 +1,4 @@ +{ + "plugins": ["estree"], + "throws": "Nullish coalescing operator(??) requires parens when mixing with logical operators (1:0)" +} diff --git a/packages/babel-parser/test/fixtures/es2020/nullish-coalescing-operator/nullish-and/input.js b/packages/babel-parser/test/fixtures/es2020/nullish-coalescing-operator/nullish-and/input.js new file mode 100644 index 000000000000..886259bfb68d --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2020/nullish-coalescing-operator/nullish-and/input.js @@ -0,0 +1 @@ +a ?? (b && c); diff --git a/packages/babel-parser/test/fixtures/es2020/nullish-coalescing-operator/nullish-and/output.json b/packages/babel-parser/test/fixtures/es2020/nullish-coalescing-operator/nullish-and/output.json new file mode 100644 index 000000000000..b01e3ccaf935 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2020/nullish-coalescing-operator/nullish-and/output.json @@ -0,0 +1,137 @@ +{ + "type": "File", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "expression": { + "type": "LogicalExpression", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "left": { + "type": "Identifier", + "start": 0, + "end": 1, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + }, + "identifierName": "a" + }, + "name": "a" + }, + "operator": "??", + "right": { + "type": "LogicalExpression", + "start": 6, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "left": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "b" + }, + "name": "b" + }, + "operator": "&&", + "right": { + "type": "Identifier", + "start": 11, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + }, + "identifierName": "c" + }, + "name": "c" + }, + "extra": { + "parenthesized": true, + "parenStart": 5 + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2020/nullish-coalescing-operator/nullish-or/input.js b/packages/babel-parser/test/fixtures/es2020/nullish-coalescing-operator/nullish-or/input.js new file mode 100644 index 000000000000..12162ba162d9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2020/nullish-coalescing-operator/nullish-or/input.js @@ -0,0 +1 @@ +a ?? (b || c); diff --git a/packages/babel-parser/test/fixtures/es2020/nullish-coalescing-operator/nullish-or/output.json b/packages/babel-parser/test/fixtures/es2020/nullish-coalescing-operator/nullish-or/output.json new file mode 100644 index 000000000000..6947e6097892 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2020/nullish-coalescing-operator/nullish-or/output.json @@ -0,0 +1,137 @@ +{ + "type": "File", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "expression": { + "type": "LogicalExpression", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "left": { + "type": "Identifier", + "start": 0, + "end": 1, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + }, + "identifierName": "a" + }, + "name": "a" + }, + "operator": "??", + "right": { + "type": "LogicalExpression", + "start": 6, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "left": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "b" + }, + "name": "b" + }, + "operator": "||", + "right": { + "type": "Identifier", + "start": 11, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + }, + "identifierName": "c" + }, + "name": "c" + }, + "extra": { + "parenthesized": true, + "parenStart": 5 + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2020/nullish-coalescing-operator/or-nullish/input.js b/packages/babel-parser/test/fixtures/es2020/nullish-coalescing-operator/or-nullish/input.js new file mode 100644 index 000000000000..a8204525df1a --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2020/nullish-coalescing-operator/or-nullish/input.js @@ -0,0 +1 @@ +(a || b) ?? c; diff --git a/packages/babel-parser/test/fixtures/es2020/nullish-coalescing-operator/or-nullish/output.json b/packages/babel-parser/test/fixtures/es2020/nullish-coalescing-operator/or-nullish/output.json new file mode 100644 index 000000000000..f2e2798e4046 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2020/nullish-coalescing-operator/or-nullish/output.json @@ -0,0 +1,137 @@ +{ + "type": "File", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "expression": { + "type": "LogicalExpression", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "left": { + "type": "LogicalExpression", + "start": 1, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "left": { + "type": "Identifier", + "start": 1, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + }, + "identifierName": "a" + }, + "name": "a" + }, + "operator": "||", + "right": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "b" + }, + "name": "b" + }, + "extra": { + "parenthesized": true, + "parenStart": 0 + } + }, + "operator": "??", + "right": { + "type": "Identifier", + "start": 12, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + }, + "identifierName": "c" + }, + "name": "c" + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/with-pipeline/input.js b/packages/babel-parser/test/fixtures/es2020/nullish-coalescing-operator/with-pipeline/input.js similarity index 100% rename from packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/with-pipeline/input.js rename to packages/babel-parser/test/fixtures/es2020/nullish-coalescing-operator/with-pipeline/input.js diff --git a/packages/babel-parser/test/fixtures/es2020/nullish-coalescing-operator/with-pipeline/options.json b/packages/babel-parser/test/fixtures/es2020/nullish-coalescing-operator/with-pipeline/options.json new file mode 100644 index 000000000000..f96a57c74821 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2020/nullish-coalescing-operator/with-pipeline/options.json @@ -0,0 +1,5 @@ +{ + "plugins": [ + ["pipelineOperator", { "proposal": "minimal" }] + ] +} diff --git a/packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/with-pipeline/output.json b/packages/babel-parser/test/fixtures/es2020/nullish-coalescing-operator/with-pipeline/output.json similarity index 100% rename from packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/with-pipeline/output.json rename to packages/babel-parser/test/fixtures/es2020/nullish-coalescing-operator/with-pipeline/output.json diff --git a/packages/babel-parser/test/fixtures/experimental/optional-chaining/class-contructor-call/input.js b/packages/babel-parser/test/fixtures/es2020/optional-chaining/class-contructor-call/input.js similarity index 100% rename from packages/babel-parser/test/fixtures/experimental/optional-chaining/class-contructor-call/input.js rename to packages/babel-parser/test/fixtures/es2020/optional-chaining/class-contructor-call/input.js diff --git a/packages/babel-parser/test/fixtures/es2020/optional-chaining/class-contructor-call/output.json b/packages/babel-parser/test/fixtures/es2020/optional-chaining/class-contructor-call/output.json new file mode 100644 index 000000000000..8ecf52133d5f --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2020/optional-chaining/class-contructor-call/output.json @@ -0,0 +1,154 @@ +{ + "type": "File", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "errors": [ + "SyntaxError: constructors in/after an Optional Chain are not allowed (1:10)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "expression": { + "type": "NewExpression", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "callee": { + "type": "OptionalMemberExpression", + "start": 4, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "object": { + "type": "OptionalMemberExpression", + "start": 4, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "object": { + "type": "Identifier", + "start": 4, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + }, + "identifierName": "C" + }, + "name": "C" + }, + "property": { + "type": "Identifier", + "start": 7, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + }, + "identifierName": "b" + }, + "name": "b" + }, + "computed": false, + "optional": true + }, + "property": { + "type": "Identifier", + "start": 9, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + }, + "identifierName": "d" + }, + "name": "d" + }, + "computed": false, + "optional": false + }, + "arguments": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/optional-chaining/conditional-decimal/input.js b/packages/babel-parser/test/fixtures/es2020/optional-chaining/conditional-decimal/input.js similarity index 100% rename from packages/babel-parser/test/fixtures/experimental/optional-chaining/conditional-decimal/input.js rename to packages/babel-parser/test/fixtures/es2020/optional-chaining/conditional-decimal/input.js diff --git a/packages/babel-parser/test/fixtures/experimental/optional-chaining/conditional-decimal/output.json b/packages/babel-parser/test/fixtures/es2020/optional-chaining/conditional-decimal/output.json similarity index 100% rename from packages/babel-parser/test/fixtures/experimental/optional-chaining/conditional-decimal/output.json rename to packages/babel-parser/test/fixtures/es2020/optional-chaining/conditional-decimal/output.json diff --git a/packages/babel-parser/test/fixtures/experimental/optional-chaining/function-call/input.js b/packages/babel-parser/test/fixtures/es2020/optional-chaining/function-call/input.js similarity index 100% rename from packages/babel-parser/test/fixtures/experimental/optional-chaining/function-call/input.js rename to packages/babel-parser/test/fixtures/es2020/optional-chaining/function-call/input.js diff --git a/packages/babel-parser/test/fixtures/experimental/optional-chaining/function-call/output.json b/packages/babel-parser/test/fixtures/es2020/optional-chaining/function-call/output.json similarity index 100% rename from packages/babel-parser/test/fixtures/experimental/optional-chaining/function-call/output.json rename to packages/babel-parser/test/fixtures/es2020/optional-chaining/function-call/output.json diff --git a/packages/babel-parser/test/fixtures/experimental/optional-chaining/member-access-bracket/input.js b/packages/babel-parser/test/fixtures/es2020/optional-chaining/member-access-bracket/input.js similarity index 100% rename from packages/babel-parser/test/fixtures/experimental/optional-chaining/member-access-bracket/input.js rename to packages/babel-parser/test/fixtures/es2020/optional-chaining/member-access-bracket/input.js diff --git a/packages/babel-parser/test/fixtures/experimental/optional-chaining/member-access-bracket/output.json b/packages/babel-parser/test/fixtures/es2020/optional-chaining/member-access-bracket/output.json similarity index 100% rename from packages/babel-parser/test/fixtures/experimental/optional-chaining/member-access-bracket/output.json rename to packages/babel-parser/test/fixtures/es2020/optional-chaining/member-access-bracket/output.json diff --git a/packages/babel-parser/test/fixtures/experimental/optional-chaining/member-access/input.js b/packages/babel-parser/test/fixtures/es2020/optional-chaining/member-access/input.js similarity index 100% rename from packages/babel-parser/test/fixtures/experimental/optional-chaining/member-access/input.js rename to packages/babel-parser/test/fixtures/es2020/optional-chaining/member-access/input.js diff --git a/packages/babel-parser/test/fixtures/experimental/optional-chaining/member-access/output.json b/packages/babel-parser/test/fixtures/es2020/optional-chaining/member-access/output.json similarity index 100% rename from packages/babel-parser/test/fixtures/experimental/optional-chaining/member-access/output.json rename to packages/babel-parser/test/fixtures/es2020/optional-chaining/member-access/output.json diff --git a/packages/babel-parser/test/fixtures/experimental/optional-chaining/optioanl-chain-expression/input.js b/packages/babel-parser/test/fixtures/es2020/optional-chaining/optioanl-chain-expression/input.js similarity index 100% rename from packages/babel-parser/test/fixtures/experimental/optional-chaining/optioanl-chain-expression/input.js rename to packages/babel-parser/test/fixtures/es2020/optional-chaining/optioanl-chain-expression/input.js diff --git a/packages/babel-parser/test/fixtures/experimental/optional-chaining/optioanl-chain-expression/output.json b/packages/babel-parser/test/fixtures/es2020/optional-chaining/optioanl-chain-expression/output.json similarity index 100% rename from packages/babel-parser/test/fixtures/experimental/optional-chaining/optioanl-chain-expression/output.json rename to packages/babel-parser/test/fixtures/es2020/optional-chaining/optioanl-chain-expression/output.json diff --git a/packages/babel-parser/test/fixtures/experimental/optional-chaining/optional-constructor/input.js b/packages/babel-parser/test/fixtures/es2020/optional-chaining/optional-constructor/input.js similarity index 100% rename from packages/babel-parser/test/fixtures/experimental/optional-chaining/optional-constructor/input.js rename to packages/babel-parser/test/fixtures/es2020/optional-chaining/optional-constructor/input.js diff --git a/packages/babel-parser/test/fixtures/es2020/optional-chaining/optional-constructor/output.json b/packages/babel-parser/test/fixtures/es2020/optional-chaining/optional-constructor/output.json new file mode 100644 index 000000000000..6c643fbdd8ab --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2020/optional-chaining/optional-constructor/output.json @@ -0,0 +1,86 @@ +{ + "type": "File", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "errors": [ + "SyntaxError: constructors in/after an Optional Chain are not allowed (1:7)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "expression": { + "type": "NewExpression", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "callee": { + "type": "Identifier", + "start": 4, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + }, + "identifierName": "a" + }, + "name": "a" + }, + "arguments": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/optional-chaining/optional-super-property-class/input.js b/packages/babel-parser/test/fixtures/es2020/optional-chaining/optional-super-property-class/input.js similarity index 100% rename from packages/babel-parser/test/fixtures/experimental/optional-chaining/optional-super-property-class/input.js rename to packages/babel-parser/test/fixtures/es2020/optional-chaining/optional-super-property-class/input.js diff --git a/packages/babel-parser/test/fixtures/es2020/optional-chaining/optional-super-property-class/output.json b/packages/babel-parser/test/fixtures/es2020/optional-chaining/optional-super-property-class/output.json new file mode 100644 index 000000000000..1f9545412a7a --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2020/optional-chaining/optional-super-property-class/output.json @@ -0,0 +1,209 @@ +{ + "type": "File", + "start": 0, + "end": 50, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "errors": [ + "SyntaxError: super can only be used with function calls (i.e. super()) or in property accesses (i.e. super.prop or super[prop]) (3:15)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 50, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 50, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "A" + }, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 7, + "end": 50, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "body": [ + { + "type": "ClassMethod", + "start": 13, + "end": 48, + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 4, + "column": 5 + } + }, + "static": false, + "key": { + "type": "Identifier", + "start": 13, + "end": 14, + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 5 + }, + "identifierName": "b" + }, + "name": "b" + }, + "computed": false, + "kind": "method", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 16, + "end": 48, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 4, + "column": 5 + } + }, + "body": [ + { + "type": "ReturnStatement", + "start": 26, + "end": 42, + "loc": { + "start": { + "line": 3, + "column": 8 + }, + "end": { + "line": 3, + "column": 24 + } + }, + "argument": { + "type": "OptionalMemberExpression", + "start": 33, + "end": 41, + "loc": { + "start": { + "line": 3, + "column": 15 + }, + "end": { + "line": 3, + "column": 23 + } + }, + "object": { + "type": "Super", + "start": 33, + "end": 38, + "loc": { + "start": { + "line": 3, + "column": 15 + }, + "end": { + "line": 3, + "column": 20 + } + } + }, + "property": { + "type": "Identifier", + "start": 40, + "end": 41, + "loc": { + "start": { + "line": 3, + "column": 22 + }, + "end": { + "line": 3, + "column": 23 + }, + "identifierName": "b" + }, + "name": "b" + }, + "computed": false, + "optional": true + } + } + ], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/optional-chaining/optional-super-property/input.js b/packages/babel-parser/test/fixtures/es2020/optional-chaining/optional-super-property/input.js similarity index 100% rename from packages/babel-parser/test/fixtures/experimental/optional-chaining/optional-super-property/input.js rename to packages/babel-parser/test/fixtures/es2020/optional-chaining/optional-super-property/input.js diff --git a/packages/babel-parser/test/fixtures/es2020/optional-chaining/optional-super-property/output.json b/packages/babel-parser/test/fixtures/es2020/optional-chaining/optional-super-property/output.json new file mode 100644 index 000000000000..548b5c32d5a7 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2020/optional-chaining/optional-super-property/output.json @@ -0,0 +1,226 @@ +{ + "type": "File", + "start": 0, + "end": 53, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "errors": [ + "SyntaxError: super can only be used with function calls (i.e. super()) or in property accesses (i.e. super.prop or super[prop]) (3:15)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 53, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 0, + "end": 53, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 6, + "end": 53, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "a" + }, + "name": "a" + }, + "init": { + "type": "ObjectExpression", + "start": 10, + "end": 53, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "properties": [ + { + "type": "ObjectMethod", + "start": 16, + "end": 51, + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 4, + "column": 5 + } + }, + "method": true, + "key": { + "type": "Identifier", + "start": 16, + "end": 17, + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 5 + }, + "identifierName": "b" + }, + "name": "b" + }, + "computed": false, + "kind": "method", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 19, + "end": 51, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 4, + "column": 5 + } + }, + "body": [ + { + "type": "ReturnStatement", + "start": 29, + "end": 45, + "loc": { + "start": { + "line": 3, + "column": 8 + }, + "end": { + "line": 3, + "column": 24 + } + }, + "argument": { + "type": "OptionalMemberExpression", + "start": 36, + "end": 44, + "loc": { + "start": { + "line": 3, + "column": 15 + }, + "end": { + "line": 3, + "column": 23 + } + }, + "object": { + "type": "Super", + "start": 36, + "end": 41, + "loc": { + "start": { + "line": 3, + "column": 15 + }, + "end": { + "line": 3, + "column": 20 + } + } + }, + "property": { + "type": "Identifier", + "start": 43, + "end": 44, + "loc": { + "start": { + "line": 3, + "column": 22 + }, + "end": { + "line": 3, + "column": 23 + }, + "identifierName": "c" + }, + "name": "c" + }, + "computed": false, + "optional": true + } + } + ], + "directives": [] + } + } + ] + } + } + ], + "kind": "const" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/optional-chaining/optional-tagged-template-literals/input.js b/packages/babel-parser/test/fixtures/es2020/optional-chaining/optional-tagged-template-literals/input.js similarity index 100% rename from packages/babel-parser/test/fixtures/experimental/optional-chaining/optional-tagged-template-literals/input.js rename to packages/babel-parser/test/fixtures/es2020/optional-chaining/optional-tagged-template-literals/input.js diff --git a/packages/babel-parser/test/fixtures/es2020/optional-chaining/optional-tagged-template-literals/output.json b/packages/babel-parser/test/fixtures/es2020/optional-chaining/optional-tagged-template-literals/output.json new file mode 100644 index 000000000000..9dff15f15eda --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2020/optional-chaining/optional-tagged-template-literals/output.json @@ -0,0 +1,157 @@ +{ + "type": "File", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "errors": [ + "SyntaxError: Tagged Template Literals are not allowed in optionalChain (1:0)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "expression": { + "type": "TaggedTemplateExpression", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "tag": { + "type": "OptionalMemberExpression", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "object": { + "type": "Identifier", + "start": 0, + "end": 1, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + }, + "identifierName": "a" + }, + "name": "a" + }, + "property": { + "type": "Identifier", + "start": 3, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 4 + }, + "identifierName": "b" + }, + "name": "b" + }, + "computed": false, + "optional": true + }, + "quasi": { + "type": "TemplateLiteral", + "start": 4, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "expressions": [], + "quasis": [ + { + "type": "TemplateElement", + "start": 5, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "value": { + "raw": "foo", + "cooked": "foo" + }, + "tail": true + } + ] + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/optional-chaining/parenthised-chain/input.js b/packages/babel-parser/test/fixtures/es2020/optional-chaining/parenthised-chain/input.js similarity index 100% rename from packages/babel-parser/test/fixtures/experimental/optional-chaining/parenthised-chain/input.js rename to packages/babel-parser/test/fixtures/es2020/optional-chaining/parenthised-chain/input.js diff --git a/packages/babel-parser/test/fixtures/experimental/optional-chaining/parenthised-chain/output.json b/packages/babel-parser/test/fixtures/es2020/optional-chaining/parenthised-chain/output.json similarity index 100% rename from packages/babel-parser/test/fixtures/experimental/optional-chaining/parenthised-chain/output.json rename to packages/babel-parser/test/fixtures/es2020/optional-chaining/parenthised-chain/output.json diff --git a/packages/babel-parser/test/fixtures/experimental/optional-chaining/separated-chaining/input.js b/packages/babel-parser/test/fixtures/es2020/optional-chaining/separated-chaining/input.js similarity index 100% rename from packages/babel-parser/test/fixtures/experimental/optional-chaining/separated-chaining/input.js rename to packages/babel-parser/test/fixtures/es2020/optional-chaining/separated-chaining/input.js diff --git a/packages/babel-parser/test/fixtures/experimental/optional-chaining/separated-chaining/output.json b/packages/babel-parser/test/fixtures/es2020/optional-chaining/separated-chaining/output.json similarity index 100% rename from packages/babel-parser/test/fixtures/experimental/optional-chaining/separated-chaining/output.json rename to packages/babel-parser/test/fixtures/es2020/optional-chaining/separated-chaining/output.json diff --git a/packages/babel-parser/test/fixtures/experimental/optional-chaining/super-method-class/input.js b/packages/babel-parser/test/fixtures/es2020/optional-chaining/super-method-class/input.js similarity index 100% rename from packages/babel-parser/test/fixtures/experimental/optional-chaining/super-method-class/input.js rename to packages/babel-parser/test/fixtures/es2020/optional-chaining/super-method-class/input.js diff --git a/packages/babel-parser/test/fixtures/experimental/optional-chaining/super-method-class/output.json b/packages/babel-parser/test/fixtures/es2020/optional-chaining/super-method-class/output.json similarity index 100% rename from packages/babel-parser/test/fixtures/experimental/optional-chaining/super-method-class/output.json rename to packages/babel-parser/test/fixtures/es2020/optional-chaining/super-method-class/output.json diff --git a/packages/babel-parser/test/fixtures/esprima/declaration-function/dupe-param/options.json b/packages/babel-parser/test/fixtures/esprima/declaration-function/dupe-param/options.json deleted file mode 100644 index 8b20b9a7df36..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/declaration-function/dupe-param/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Argument name clash (1:14)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/declaration-function/dupe-param/output.json b/packages/babel-parser/test/fixtures/esprima/declaration-function/dupe-param/output.json new file mode 100644 index 000000000000..aa4301697cf8 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/declaration-function/dupe-param/output.json @@ -0,0 +1,161 @@ +{ + "type": "File", + "start": 0, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "errors": [ + "SyntaxError: Argument name clash (1:14)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + }, + "identifierName": "a" + }, + "name": "a" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 11, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + }, + "identifierName": "x" + }, + "name": "x" + }, + { + "type": "Identifier", + "start": 14, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + }, + "identifierName": "x" + }, + "name": "x" + } + ], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "body": [], + "directives": [ + { + "type": "Directive", + "start": 18, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 18, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-array-binding-pattern/elision/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-array-binding-pattern/elision/output.json index 10c96101b155..2f49a3a77d71 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-array-binding-pattern/elision/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-array-binding-pattern/elision/output.json @@ -78,7 +78,10 @@ "elements": [ null, null - ] + ], + "extra": { + "trailingComma": 3 + } } ], "body": { diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-array-binding-pattern/invalid-dup-param/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-array-binding-pattern/invalid-dup-param/options.json deleted file mode 100644 index a4a6e207d28c..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/es2015-array-binding-pattern/invalid-dup-param/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Argument name clash (1:11)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-array-binding-pattern/invalid-dup-param/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-array-binding-pattern/invalid-dup-param/output.json new file mode 100644 index 000000000000..09552b591b3f --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-array-binding-pattern/invalid-dup-param/output.json @@ -0,0 +1,193 @@ +{ + "type": "File", + "start": 0, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "errors": [ + "SyntaxError: Argument name clash (1:11)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "expression": { + "type": "ArrowFunctionExpression", + "start": 0, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "ArrayPattern", + "start": 1, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "elements": [ + { + "type": "Identifier", + "start": 2, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + }, + "identifierName": "a" + }, + "name": "a" + }, + { + "type": "ArrayPattern", + "start": 4, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "elements": [ + { + "type": "Identifier", + "start": 5, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + }, + "identifierName": "b" + }, + "name": "b" + } + ] + }, + { + "type": "RestElement", + "start": 8, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "argument": { + "type": "Identifier", + "start": 11, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + }, + "identifierName": "b" + }, + "name": "b" + } + } + ] + } + ], + "body": { + "type": "NumericLiteral", + "start": 16, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-array-pattern/dupe-param-1/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-array-pattern/dupe-param-1/options.json deleted file mode 100644 index 49e8d8e86314..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/es2015-array-pattern/dupe-param-1/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Argument name clash (2:14)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-array-pattern/dupe-param-1/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-array-pattern/dupe-param-1/output.json new file mode 100644 index 000000000000..57442d5cb4fd --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-array-pattern/dupe-param-1/output.json @@ -0,0 +1,178 @@ +{ + "type": "File", + "start": 0, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 20 + } + }, + "errors": [ + "SyntaxError: Argument name clash (2:14)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 20 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 14, + "end": 34, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 20 + } + }, + "id": { + "type": "Identifier", + "start": 23, + "end": 24, + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 10 + }, + "identifierName": "a" + }, + "name": "a" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "ArrayPattern", + "start": 25, + "end": 30, + "loc": { + "start": { + "line": 2, + "column": 11 + }, + "end": { + "line": 2, + "column": 16 + } + }, + "elements": [ + { + "type": "Identifier", + "start": 26, + "end": 27, + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 13 + }, + "identifierName": "a" + }, + "name": "a" + }, + { + "type": "Identifier", + "start": 28, + "end": 29, + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 15 + }, + "identifierName": "a" + }, + "name": "a" + } + ] + } + ], + "body": { + "type": "BlockStatement", + "start": 31, + "end": 34, + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 20 + } + }, + "body": [], + "directives": [] + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-array-pattern/dupe-param-2/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-array-pattern/dupe-param-2/options.json deleted file mode 100644 index 3829082a4878..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/es2015-array-pattern/dupe-param-2/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Argument name clash (2:17)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-array-pattern/dupe-param-2/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-array-pattern/dupe-param-2/output.json new file mode 100644 index 000000000000..4242da8e09f7 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-array-pattern/dupe-param-2/output.json @@ -0,0 +1,193 @@ +{ + "type": "File", + "start": 0, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 23 + } + }, + "errors": [ + "SyntaxError: Argument name clash (2:17)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 23 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 14, + "end": 37, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 23 + } + }, + "id": { + "type": "Identifier", + "start": 23, + "end": 24, + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 10 + }, + "identifierName": "a" + }, + "name": "a" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "ArrayPattern", + "start": 25, + "end": 33, + "loc": { + "start": { + "line": 2, + "column": 11 + }, + "end": { + "line": 2, + "column": 19 + } + }, + "elements": [ + { + "type": "Identifier", + "start": 26, + "end": 27, + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 13 + }, + "identifierName": "a" + }, + "name": "a" + }, + { + "type": "RestElement", + "start": 28, + "end": 32, + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 18 + } + }, + "argument": { + "type": "Identifier", + "start": 31, + "end": 32, + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 18 + }, + "identifierName": "a" + }, + "name": "a" + } + } + ] + } + ], + "body": { + "type": "BlockStatement", + "start": 34, + "end": 37, + "loc": { + "start": { + "line": 2, + "column": 20 + }, + "end": { + "line": 2, + "column": 23 + } + }, + "body": [], + "directives": [] + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-array-pattern/dupe-param-3/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-array-pattern/dupe-param-3/options.json deleted file mode 100644 index 782073313a19..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/es2015-array-pattern/dupe-param-3/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Argument name clash (2:19)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-array-pattern/dupe-param-3/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-array-pattern/dupe-param-3/output.json new file mode 100644 index 000000000000..00b0c28f58c6 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-array-pattern/dupe-param-3/output.json @@ -0,0 +1,248 @@ +{ + "type": "File", + "start": 0, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 25 + } + }, + "errors": [ + "SyntaxError: Argument name clash (2:19)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 25 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 14, + "end": 39, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 25 + } + }, + "id": { + "type": "Identifier", + "start": 23, + "end": 24, + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 10 + }, + "identifierName": "a" + }, + "name": "a" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "ArrayPattern", + "start": 25, + "end": 35, + "loc": { + "start": { + "line": 2, + "column": 11 + }, + "end": { + "line": 2, + "column": 21 + } + }, + "elements": [ + { + "type": "ObjectPattern", + "start": 26, + "end": 29, + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 15 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 27, + "end": 28, + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 27, + "end": 28, + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 14 + }, + "identifierName": "a" + }, + "name": "a" + }, + "computed": false, + "shorthand": true, + "value": { + "type": "Identifier", + "start": 27, + "end": 28, + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 14 + }, + "identifierName": "a" + }, + "name": "a" + }, + "extra": { + "shorthand": true + } + } + ] + }, + { + "type": "RestElement", + "start": 30, + "end": 34, + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 20 + } + }, + "argument": { + "type": "Identifier", + "start": 33, + "end": 34, + "loc": { + "start": { + "line": 2, + "column": 19 + }, + "end": { + "line": 2, + "column": 20 + }, + "identifierName": "a" + }, + "name": "a" + } + } + ] + } + ], + "body": { + "type": "BlockStatement", + "start": 36, + "end": 39, + "loc": { + "start": { + "line": 2, + "column": 22 + }, + "end": { + "line": 2, + "column": 25 + } + }, + "body": [], + "directives": [] + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/complex-rest-in-arrow-not-allowed/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/complex-rest-in-arrow-not-allowed/options.json deleted file mode 100644 index fd74c5228531..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/complex-rest-in-arrow-not-allowed/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Argument name clash (1:7)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/complex-rest-in-arrow-not-allowed/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/complex-rest-in-arrow-not-allowed/output.json new file mode 100644 index 000000000000..34fec649661b --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/complex-rest-in-arrow-not-allowed/output.json @@ -0,0 +1,159 @@ +{ + "type": "File", + "start": 0, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "errors": [ + "SyntaxError: Argument name clash (1:7)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "expression": { + "type": "ArrowFunctionExpression", + "start": 0, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 1, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + }, + "identifierName": "a" + }, + "name": "a" + }, + { + "type": "RestElement", + "start": 3, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "argument": { + "type": "ArrayPattern", + "start": 6, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "elements": [ + { + "type": "Identifier", + "start": 7, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + }, + "identifierName": "a" + }, + "name": "a" + } + ] + } + } + ], + "body": { + "type": "NumericLiteral", + "start": 14, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/invalid-duplicated-params/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/invalid-duplicated-params/options.json deleted file mode 100644 index 368006ae58bd..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/invalid-duplicated-params/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Argument name clash (1:4)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/invalid-duplicated-params/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/invalid-duplicated-params/output.json new file mode 100644 index 000000000000..5456b40fe86d --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/invalid-duplicated-params/output.json @@ -0,0 +1,124 @@ +{ + "type": "File", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "errors": [ + "SyntaxError: Argument name clash (1:4)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "expression": { + "type": "ArrowFunctionExpression", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 1, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + }, + "identifierName": "x" + }, + "name": "x" + }, + { + "type": "Identifier", + "start": 4, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + }, + "identifierName": "x" + }, + "name": "x" + } + ], + "body": { + "type": "Identifier", + "start": 10, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + }, + "identifierName": "y" + }, + "name": "y" + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/invalid-param-strict-mode/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/invalid-param-strict-mode/options.json deleted file mode 100644 index 2e6d7156cf57..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/invalid-param-strict-mode/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'eval' in strict mode (1:0)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/invalid-param-strict-mode/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/invalid-param-strict-mode/output.json new file mode 100644 index 000000000000..1daa964b52b1 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/invalid-param-strict-mode/output.json @@ -0,0 +1,143 @@ +{ + "type": "File", + "start": 0, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "errors": [ + "SyntaxError: Binding 'eval' in strict mode (1:0)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "expression": { + "type": "ArrowFunctionExpression", + "start": 0, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + }, + "identifierName": "eval" + }, + "name": "eval" + } + ], + "body": { + "type": "BlockStatement", + "start": 8, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "body": [], + "directives": [ + { + "type": "Directive", + "start": 9, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 9, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/object-binding-pattern-invalid-member-expr/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/object-binding-pattern-invalid-member-expr/options.json deleted file mode 100644 index bf0f292caad2..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/object-binding-pattern-invalid-member-expr/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid left-hand side in object destructuring pattern (1:4)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/object-binding-pattern-invalid-member-expr/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/object-binding-pattern-invalid-member-expr/output.json new file mode 100644 index 000000000000..9e8858777646 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/object-binding-pattern-invalid-member-expr/output.json @@ -0,0 +1,198 @@ +{ + "type": "File", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "errors": [ + "SyntaxError: Binding member expression (1:4)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "expression": { + "type": "ArrowFunctionExpression", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "ObjectPattern", + "start": 1, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 2, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 2, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + }, + "identifierName": "a" + }, + "name": "a" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "MemberExpression", + "start": 4, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "object": { + "type": "Identifier", + "start": 4, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + }, + "identifierName": "b" + }, + "name": "b" + }, + "property": { + "type": "NumericLiteral", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + }, + "computed": true + } + } + ] + } + ], + "body": { + "type": "NumericLiteral", + "start": 12, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/object-binding-pattern-invalid-method-in-pattern/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/object-binding-pattern-invalid-method-in-pattern/options.json deleted file mode 100644 index 559cc4e11a41..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/object-binding-pattern-invalid-method-in-pattern/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Object pattern can't contain getter or setter (1:6)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/object-binding-pattern-invalid-method-in-pattern/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/object-binding-pattern-invalid-method-in-pattern/output.json new file mode 100644 index 000000000000..d391e09c2dfe --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/object-binding-pattern-invalid-method-in-pattern/output.json @@ -0,0 +1,166 @@ +{ + "type": "File", + "start": 0, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "errors": [ + "SyntaxError: Object pattern can't contain getter or setter (1:6)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "expression": { + "type": "ArrowFunctionExpression", + "start": 0, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "ObjectPattern", + "start": 1, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "properties": [ + { + "type": "ObjectMethod", + "start": 2, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "a" + }, + "name": "a" + }, + "computed": false, + "kind": "get", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 9, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "body": [], + "directives": [] + } + } + ] + } + ], + "body": { + "type": "NumericLiteral", + "start": 17, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/object-binding-pattern-invalid-nested-param/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/object-binding-pattern-invalid-nested-param/options.json deleted file mode 100644 index 30f209db8f07..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/object-binding-pattern-invalid-nested-param/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid left-hand side in object destructuring pattern (1:24)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/object-binding-pattern-invalid-nested-param/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/object-binding-pattern-invalid-nested-param/output.json new file mode 100644 index 000000000000..a0f4f6168da6 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/object-binding-pattern-invalid-nested-param/output.json @@ -0,0 +1,538 @@ +{ + "type": "File", + "start": 0, + "end": 54, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 54 + } + }, + "errors": [ + "SyntaxError: Binding member expression (1:24)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 54, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 54 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 54, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 54 + } + }, + "expression": { + "type": "ArrowFunctionExpression", + "start": 0, + "end": 53, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 53 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "ArrayPattern", + "start": 1, + "end": 49, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 49 + } + }, + "elements": [ + { + "type": "ArrayPattern", + "start": 2, + "end": 48, + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 48 + } + }, + "elements": [ + { + "type": "ArrayPattern", + "start": 3, + "end": 47, + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 47 + } + }, + "elements": [ + { + "type": "ArrayPattern", + "start": 4, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 46 + } + }, + "elements": [ + { + "type": "ArrayPattern", + "start": 5, + "end": 45, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 45 + } + }, + "elements": [ + { + "type": "ArrayPattern", + "start": 6, + "end": 44, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 44 + } + }, + "elements": [ + { + "type": "ArrayPattern", + "start": 7, + "end": 43, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 43 + } + }, + "elements": [ + { + "type": "ArrayPattern", + "start": 8, + "end": 42, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 42 + } + }, + "elements": [ + { + "type": "ArrayPattern", + "start": 9, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 41 + } + }, + "elements": [ + { + "type": "ArrayPattern", + "start": 10, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 40 + } + }, + "elements": [ + { + "type": "ArrayPattern", + "start": 11, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "elements": [ + { + "type": "ArrayPattern", + "start": 12, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 38 + } + }, + "elements": [ + { + "type": "ArrayPattern", + "start": 13, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "elements": [ + { + "type": "ArrayPattern", + "start": 14, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "elements": [ + { + "type": "ArrayPattern", + "start": 15, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "elements": [ + { + "type": "ArrayPattern", + "start": 16, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "elements": [ + { + "type": "ArrayPattern", + "start": 17, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "elements": [ + { + "type": "ArrayPattern", + "start": 18, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "elements": [ + { + "type": "ArrayPattern", + "start": 19, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "elements": [ + { + "type": "ArrayPattern", + "start": 20, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "elements": [ + { + "type": "ObjectPattern", + "start": 21, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 22, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 22, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + }, + "identifierName": "a" + }, + "name": "a" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "MemberExpression", + "start": 24, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "object": { + "type": "Identifier", + "start": 24, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 + }, + "identifierName": "b" + }, + "name": "b" + }, + "property": { + "type": "NumericLiteral", + "start": 26, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + }, + "computed": true + } + } + ] + } + ] + } + ] + } + ] + } + ] + } + ] + } + ] + } + ] + } + ] + } + ] + } + ] + } + ] + } + ] + } + ] + } + ] + } + ] + } + ] + } + ] + } + ] + } + ] + } + ] + } + ], + "body": { + "type": "NumericLiteral", + "start": 52, + "end": 53, + "loc": { + "start": { + "line": 1, + "column": 52 + }, + "end": { + "line": 1, + "column": 53 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-destructuring-assignment-array-pattern/elision/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-destructuring-assignment-array-pattern/elision/output.json index eebd569aa2e6..6032e42c2b32 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-destructuring-assignment-array-pattern/elision/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-destructuring-assignment-array-pattern/elision/output.json @@ -75,7 +75,10 @@ "elements": [ null, null - ] + ], + "extra": { + "trailingComma": 2 + } }, "right": { "type": "NumericLiteral", diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-destructuring-assignment-object-pattern/invalid-lhs-01/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-destructuring-assignment-object-pattern/invalid-lhs-01/options.json deleted file mode 100644 index bf0f292caad2..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/es2015-destructuring-assignment-object-pattern/invalid-lhs-01/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid left-hand side in object destructuring pattern (1:4)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-destructuring-assignment-object-pattern/invalid-lhs-01/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-destructuring-assignment-object-pattern/invalid-lhs-01/output.json new file mode 100644 index 000000000000..b71ec1a70153 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-destructuring-assignment-object-pattern/invalid-lhs-01/output.json @@ -0,0 +1,160 @@ +{ + "type": "File", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "errors": [ + "SyntaxError: Invalid left-hand side in object destructuring pattern (1:4)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 1, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "operator": "=", + "left": { + "type": "ObjectPattern", + "start": 1, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 2, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 2, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + }, + "identifierName": "a" + }, + "name": "a" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "ThisExpression", + "start": 4, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 8 + } + } + } + } + ] + }, + "right": { + "type": "NumericLiteral", + "start": 10, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + }, + "extra": { + "parenthesized": true, + "parenStart": 0 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-destructuring-assignment-object-pattern/invalid-lhs-02/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-destructuring-assignment-object-pattern/invalid-lhs-02/options.json deleted file mode 100644 index 2cfe61cdc033..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/es2015-destructuring-assignment-object-pattern/invalid-lhs-02/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid left-hand side in object destructuring pattern (1:5)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-destructuring-assignment-object-pattern/invalid-lhs-02/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-destructuring-assignment-object-pattern/invalid-lhs-02/output.json new file mode 100644 index 000000000000..0282d2b2a59c --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-destructuring-assignment-object-pattern/invalid-lhs-02/output.json @@ -0,0 +1,160 @@ +{ + "type": "File", + "start": 0, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "errors": [ + "SyntaxError: Invalid left-hand side in object destructuring pattern (1:5)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 1, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "operator": "=", + "left": { + "type": "ObjectPattern", + "start": 1, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 2, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 2, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + }, + "identifierName": "a" + }, + "name": "a" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "ThisExpression", + "start": 5, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 9 + } + } + } + } + ] + }, + "right": { + "type": "NumericLiteral", + "start": 13, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + }, + "extra": { + "parenthesized": true, + "parenStart": 0 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-destructuring-assignment-object-pattern/invalid-pattern-with-method/input.js b/packages/babel-parser/test/fixtures/esprima/es2015-destructuring-assignment-object-pattern/invalid-pattern-with-method/input.js index 1dcb7ce683e6..dd21753e3550 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-destructuring-assignment-object-pattern/invalid-pattern-with-method/input.js +++ b/packages/babel-parser/test/fixtures/esprima/es2015-destructuring-assignment-object-pattern/invalid-pattern-with-method/input.js @@ -1 +1 @@ -({a(){}})=0 +({a(){}}=0) diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-destructuring-assignment-object-pattern/invalid-pattern-with-method/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-destructuring-assignment-object-pattern/invalid-pattern-with-method/options.json deleted file mode 100644 index 081535f854c6..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/es2015-destructuring-assignment-object-pattern/invalid-pattern-with-method/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Object pattern can't contain methods (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-destructuring-assignment-object-pattern/invalid-pattern-with-method/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-destructuring-assignment-object-pattern/invalid-pattern-with-method/output.json new file mode 100644 index 000000000000..4f63aa8f3c12 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-destructuring-assignment-object-pattern/invalid-pattern-with-method/output.json @@ -0,0 +1,166 @@ +{ + "type": "File", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "errors": [ + "SyntaxError: Object pattern can't contain methods (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 1, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "operator": "=", + "left": { + "type": "ObjectPattern", + "start": 1, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "properties": [ + { + "type": "ObjectMethod", + "start": 2, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "method": true, + "key": { + "type": "Identifier", + "start": 2, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + }, + "identifierName": "a" + }, + "name": "a" + }, + "computed": false, + "kind": "method", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 5, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "body": [], + "directives": [] + } + } + ] + }, + "right": { + "type": "NumericLiteral", + "start": 9, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + }, + "extra": { + "parenthesized": true, + "parenStart": 0 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-destructuring-assignment/invalid-group-assignment/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-destructuring-assignment/invalid-group-assignment/options.json deleted file mode 100644 index 7c5f08eb9ba6..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/es2015-destructuring-assignment/invalid-group-assignment/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid left-hand side in assignment expression (1:1)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-destructuring-assignment/invalid-group-assignment/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-destructuring-assignment/invalid-group-assignment/output.json new file mode 100644 index 000000000000..02c910998853 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-destructuring-assignment/invalid-group-assignment/output.json @@ -0,0 +1,180 @@ +{ + "type": "File", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "errors": [ + "SyntaxError: Invalid parenthesized assignment pattern (1:1)", + "SyntaxError: Invalid left-hand side in assignment expression (1:1)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "operator": "=", + "left": { + "type": "SequenceExpression", + "start": 1, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "expressions": [ + { + "type": "Identifier", + "start": 1, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + }, + "identifierName": "a" + }, + "name": "a" + }, + { + "type": "Identifier", + "start": 3, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 4 + }, + "identifierName": "b" + }, + "name": "b" + } + ], + "extra": { + "parenthesized": true, + "parenStart": 0 + } + }, + "right": { + "type": "SequenceExpression", + "start": 7, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "expressions": [ + { + "type": "Identifier", + "start": 7, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + }, + "identifierName": "c" + }, + "name": "c" + }, + { + "type": "Identifier", + "start": 9, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + }, + "identifierName": "d" + }, + "name": "d" + } + ], + "extra": { + "parenthesized": true, + "parenStart": 6 + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-export-declaration/invalid-export-default-token/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-export-declaration/invalid-export-default-token/options.json index b6ce2c43af87..8c1430963ecf 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-export-declaration/invalid-export-default-token/options.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-export-declaration/invalid-export-default-token/options.json @@ -1,4 +1,4 @@ { "sourceType": "module", "throws": "Unexpected token, expected \";\" (1:17)" -} \ No newline at end of file +} diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-export-declaration/invalid-export-named-default/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-export-declaration/invalid-export-named-default/options.json index e03d273fdcd5..2104ca43283f 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-export-declaration/invalid-export-named-default/options.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-export-declaration/invalid-export-named-default/options.json @@ -1,4 +1,3 @@ { - "sourceType": "module", - "throws": "Unexpected keyword 'default' (1:8)" -} \ No newline at end of file + "sourceType": "module" +} diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-export-declaration/invalid-export-named-default/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-export-declaration/invalid-export-named-default/output.json new file mode 100644 index 000000000000..0b3a95c25658 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-export-declaration/invalid-export-named-default/output.json @@ -0,0 +1,107 @@ +{ + "type": "File", + "start": 0, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "errors": [ + "SyntaxError: Unexpected keyword 'default' (1:8)", + "SyntaxError: Export 'default' is not defined (1:8)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExportNamedDeclaration", + "start": 0, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "specifiers": [ + { + "type": "ExportSpecifier", + "start": 8, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "local": { + "type": "Identifier", + "start": 8, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 15 + }, + "identifierName": "default" + }, + "name": "default" + }, + "exported": { + "type": "Identifier", + "start": 8, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 15 + }, + "identifierName": "default" + }, + "name": "default" + } + } + ], + "source": null, + "declaration": null + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-for-of/invalid-const-init/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-for-of/invalid-const-init/options.json deleted file mode 100644 index c145a86bc613..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/es2015-for-of/invalid-const-init/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "for-of loop variable declaration may not have an initializer (1:5)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-for-of/invalid-const-init/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-for-of/invalid-const-init/output.json new file mode 100644 index 000000000000..9addc13c958b --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-for-of/invalid-const-init/output.json @@ -0,0 +1,156 @@ +{ + "type": "File", + "start": 0, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "errors": [ + "SyntaxError: for-of loop variable declaration may not have an initializer (1:5)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ForOfStatement", + "start": 0, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "await": false, + "left": { + "type": "VariableDeclaration", + "start": 5, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 11, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "id": { + "type": "Identifier", + "start": 11, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + }, + "identifierName": "x" + }, + "name": "x" + }, + "init": { + "type": "NumericLiteral", + "start": 15, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + ], + "kind": "const" + }, + "right": { + "type": "Identifier", + "start": 20, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + }, + "identifierName": "y" + }, + "name": "y" + }, + "body": { + "type": "EmptyStatement", + "start": 22, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-for-of/invalid-let-init/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-for-of/invalid-let-init/options.json deleted file mode 100644 index c145a86bc613..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/es2015-for-of/invalid-let-init/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "for-of loop variable declaration may not have an initializer (1:5)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-for-of/invalid-let-init/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-for-of/invalid-let-init/output.json new file mode 100644 index 000000000000..e7720b34974c --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-for-of/invalid-let-init/output.json @@ -0,0 +1,156 @@ +{ + "type": "File", + "start": 0, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "errors": [ + "SyntaxError: for-of loop variable declaration may not have an initializer (1:5)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ForOfStatement", + "start": 0, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "await": false, + "left": { + "type": "VariableDeclaration", + "start": 5, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + }, + "identifierName": "x" + }, + "name": "x" + }, + "init": { + "type": "NumericLiteral", + "start": 13, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + ], + "kind": "let" + }, + "right": { + "type": "Identifier", + "start": 18, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + }, + "identifierName": "y" + }, + "name": "y" + }, + "body": { + "type": "EmptyStatement", + "start": 20, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-for-of/invalid-lhs-init/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-for-of/invalid-lhs-init/options.json deleted file mode 100644 index a4dd545935e8..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/es2015-for-of/invalid-lhs-init/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid left-hand side in for-of statement (1:5)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-for-of/invalid-lhs-init/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-for-of/invalid-lhs-init/output.json new file mode 100644 index 000000000000..bdb80af26d26 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-for-of/invalid-lhs-init/output.json @@ -0,0 +1,101 @@ +{ + "type": "File", + "start": 0, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "errors": [ + "SyntaxError: Invalid left-hand side in for-of statement (1:5)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ForOfStatement", + "start": 0, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "await": false, + "left": { + "type": "ThisExpression", + "start": 5, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "right": { + "type": "Identifier", + "start": 13, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 17 + }, + "identifierName": "that" + }, + "name": "that" + }, + "body": { + "type": "EmptyStatement", + "start": 18, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-for-of/invalid-var-init/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-for-of/invalid-var-init/options.json deleted file mode 100644 index c145a86bc613..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/es2015-for-of/invalid-var-init/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "for-of loop variable declaration may not have an initializer (1:5)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-for-of/invalid-var-init/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-for-of/invalid-var-init/output.json new file mode 100644 index 000000000000..5c95e7b34186 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-for-of/invalid-var-init/output.json @@ -0,0 +1,156 @@ +{ + "type": "File", + "start": 0, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "errors": [ + "SyntaxError: for-of loop variable declaration may not have an initializer (1:5)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ForOfStatement", + "start": 0, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "await": false, + "left": { + "type": "VariableDeclaration", + "start": 5, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + }, + "identifierName": "x" + }, + "name": "x" + }, + "init": { + "type": "NumericLiteral", + "start": 13, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + ], + "kind": "var" + }, + "right": { + "type": "Identifier", + "start": 18, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + }, + "identifierName": "y" + }, + "name": "y" + }, + "body": { + "type": "EmptyStatement", + "start": 20, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-identifier/invalid_escaped_surrogate_pairs/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-identifier/invalid_escaped_surrogate_pairs/options.json deleted file mode 100644 index df97a8ee679f..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/es2015-identifier/invalid_escaped_surrogate_pairs/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid Unicode escape (1:4)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-identifier/invalid_escaped_surrogate_pairs/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-identifier/invalid_escaped_surrogate_pairs/output.json new file mode 100644 index 000000000000..111d8eb97b43 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-identifier/invalid_escaped_surrogate_pairs/output.json @@ -0,0 +1,90 @@ +{ + "type": "File", + "start": 0, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "errors": [ + "SyntaxError: Invalid Unicode escape (1:4)", + "SyntaxError: Invalid Unicode escape (1:10)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 0, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 4, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "id": { + "type": "Identifier", + "start": 4, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 16 + }, + "identifierName": "𞸀" + }, + "name": "𞸀" + }, + "init": null + } + ], + "kind": "var" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-identifier/invalid_expression_await/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-identifier/invalid_expression_await/options.json deleted file mode 100644 index afbed324e92a..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/es2015-identifier/invalid_expression_await/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "'import' and 'export' may appear only with 'sourceType: \"module\"' (1:0)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-identifier/invalid_expression_await/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-identifier/invalid_expression_await/output.json new file mode 100644 index 000000000000..a6d558c93efe --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-identifier/invalid_expression_await/output.json @@ -0,0 +1,158 @@ +{ + "type": "File", + "start": 0, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "errors": [ + "SyntaxError: 'import' and 'export' may appear only with 'sourceType: \"module\"' (1:0)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExportNamedDeclaration", + "start": 0, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "specifiers": [], + "source": null, + "declaration": { + "type": "VariableDeclaration", + "start": 7, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 11, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "id": { + "type": "Identifier", + "start": 11, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 17 + }, + "identifierName": "answer" + }, + "name": "answer" + }, + "init": { + "type": "BinaryExpression", + "start": 20, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "left": { + "type": "Identifier", + "start": 20, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 25 + }, + "identifierName": "await" + }, + "name": "await" + }, + "operator": "+", + "right": { + "type": "NumericLiteral", + "start": 28, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + } + ], + "kind": "var" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-identifier/invalid_var_await/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-identifier/invalid_var_await/options.json deleted file mode 100644 index afbed324e92a..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/es2015-identifier/invalid_var_await/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "'import' and 'export' may appear only with 'sourceType: \"module\"' (1:0)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-identifier/invalid_var_await/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-identifier/invalid_var_await/output.json new file mode 100644 index 000000000000..514e8e0f0abe --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-identifier/invalid_var_await/output.json @@ -0,0 +1,106 @@ +{ + "type": "File", + "start": 0, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "errors": [ + "SyntaxError: 'import' and 'export' may appear only with 'sourceType: \"module\"' (1:0)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExportNamedDeclaration", + "start": 0, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "specifiers": [], + "source": null, + "declaration": { + "type": "VariableDeclaration", + "start": 7, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 11, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "id": { + "type": "Identifier", + "start": 11, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 16 + }, + "identifierName": "await" + }, + "name": "await" + }, + "init": null + } + ], + "kind": "var" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-lexical-declaration/invalid_complex_binding_without_init/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-lexical-declaration/invalid_complex_binding_without_init/options.json deleted file mode 100644 index 57893e4eee56..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/es2015-lexical-declaration/invalid_complex_binding_without_init/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Complex binding patterns require an initialization value (1:6)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-lexical-declaration/invalid_complex_binding_without_init/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-lexical-declaration/invalid_complex_binding_without_init/output.json new file mode 100644 index 000000000000..fe814362c2c8 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-lexical-declaration/invalid_complex_binding_without_init/output.json @@ -0,0 +1,88 @@ +{ + "type": "File", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "errors": [ + "SyntaxError: Complex binding patterns require an initialization value (1:6)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 4, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "id": { + "type": "ArrayPattern", + "start": 4, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "elements": [] + }, + "init": null + } + ], + "kind": "let" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-lexical-declaration/invalid_const_forin/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-lexical-declaration/invalid_const_forin/options.json deleted file mode 100644 index dd3b73e5d533..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/es2015-lexical-declaration/invalid_const_forin/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "for-in loop variable declaration may not have an initializer (1:5)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-lexical-declaration/invalid_const_forin/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-lexical-declaration/invalid_const_forin/output.json new file mode 100644 index 000000000000..f2fe5561bb8d --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-lexical-declaration/invalid_const_forin/output.json @@ -0,0 +1,157 @@ +{ + "type": "File", + "start": 0, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "errors": [ + "SyntaxError: for-in loop variable declaration may not have an initializer (1:5)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ForInStatement", + "start": 0, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "left": { + "type": "VariableDeclaration", + "start": 5, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 11, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "id": { + "type": "Identifier", + "start": 11, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + }, + "identifierName": "x" + }, + "name": "x" + }, + "init": { + "type": "NumericLiteral", + "start": 15, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + } + ], + "kind": "const" + }, + "right": { + "type": "Identifier", + "start": 20, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + }, + "identifierName": "y" + }, + "name": "y" + }, + "body": { + "type": "BlockStatement", + "start": 22, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "body": [], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-lexical-declaration/invalid_let_forin/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-lexical-declaration/invalid_let_forin/options.json deleted file mode 100644 index dd3b73e5d533..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/es2015-lexical-declaration/invalid_let_forin/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "for-in loop variable declaration may not have an initializer (1:5)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-lexical-declaration/invalid_let_forin/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-lexical-declaration/invalid_let_forin/output.json new file mode 100644 index 000000000000..3a3a8f1230c5 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-lexical-declaration/invalid_let_forin/output.json @@ -0,0 +1,157 @@ +{ + "type": "File", + "start": 0, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "errors": [ + "SyntaxError: for-in loop variable declaration may not have an initializer (1:5)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ForInStatement", + "start": 0, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "left": { + "type": "VariableDeclaration", + "start": 5, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + }, + "identifierName": "x" + }, + "name": "x" + }, + "init": { + "type": "NumericLiteral", + "start": 13, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + } + ], + "kind": "let" + }, + "right": { + "type": "Identifier", + "start": 18, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + }, + "identifierName": "y" + }, + "name": "y" + }, + "body": { + "type": "BlockStatement", + "start": 20, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "body": [], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-meta-property/invalid-new-target/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-meta-property/invalid-new-target/options.json deleted file mode 100644 index a8a536e737f3..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/es2015-meta-property/invalid-new-target/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "new.target can only be used in functions (1:8)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-meta-property/invalid-new-target/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-meta-property/invalid-new-target/output.json new file mode 100644 index 000000000000..e02e90a31d33 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-meta-property/invalid-new-target/output.json @@ -0,0 +1,137 @@ +{ + "type": "File", + "start": 0, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "errors": [ + "SyntaxError: new.target can only be used in functions (1:8)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 0, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 4, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "id": { + "type": "Identifier", + "start": 4, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + }, + "identifierName": "x" + }, + "name": "x" + }, + "init": { + "type": "MetaProperty", + "start": 8, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "meta": { + "type": "Identifier", + "start": 8, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 11 + }, + "identifierName": "new" + }, + "name": "new" + }, + "property": { + "type": "Identifier", + "start": 12, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 18 + }, + "identifierName": "target" + }, + "name": "target" + } + } + } + ], + "kind": "var" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-meta-property/unknown-property/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-meta-property/unknown-property/options.json deleted file mode 100644 index f1d291c3e468..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/es2015-meta-property/unknown-property/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "The only valid meta property for new is new.target (1:25)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-meta-property/unknown-property/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-meta-property/unknown-property/output.json new file mode 100644 index 000000000000..4bcbca3b0d36 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-meta-property/unknown-property/output.json @@ -0,0 +1,189 @@ +{ + "type": "File", + "start": 0, + "end": 44, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 44 + } + }, + "errors": [ + "SyntaxError: The only valid meta property for new is new.target (1:25)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 44, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 44 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 0, + "end": 44, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 44 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 4, + "end": 44, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 44 + } + }, + "id": { + "type": "Identifier", + "start": 4, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + }, + "identifierName": "f" + }, + "name": "f" + }, + "init": { + "type": "FunctionExpression", + "start": 8, + "end": 44, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 44 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 19, + "end": 44, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 44 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 21, + "end": 42, + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 42 + } + }, + "expression": { + "type": "MetaProperty", + "start": 21, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 41 + } + }, + "meta": { + "type": "Identifier", + "start": 21, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 24 + }, + "identifierName": "new" + }, + "name": "new" + }, + "property": { + "type": "Identifier", + "start": 25, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 41 + }, + "identifierName": "unknown_property" + }, + "name": "unknown_property" + } + } + } + ], + "directives": [] + } + } + } + ], + "kind": "var" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-object-initialiser/invalid-proto-getter-literal-identifier/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-object-initialiser/invalid-proto-getter-literal-identifier/options.json deleted file mode 100644 index de857a114a82..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/es2015-object-initialiser/invalid-proto-getter-literal-identifier/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Redefinition of __proto__ property (1:39)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-object-initialiser/invalid-proto-getter-literal-identifier/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-object-initialiser/invalid-proto-getter-literal-identifier/output.json new file mode 100644 index 000000000000..8316c5f97f85 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-object-initialiser/invalid-proto-getter-literal-identifier/output.json @@ -0,0 +1,234 @@ +{ + "type": "File", + "start": 0, + "end": 58, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 58 + } + }, + "errors": [ + "SyntaxError: Redefinition of __proto__ property (1:39)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 58, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 58 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 58, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 58 + } + }, + "expression": { + "type": "ObjectExpression", + "start": 1, + "end": 57, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 57 + } + }, + "properties": [ + { + "type": "ObjectMethod", + "start": 3, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 7, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "__proto" + }, + "name": "__proto" + }, + "computed": false, + "kind": "get", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 16, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "body": [], + "directives": [] + } + }, + { + "type": "ObjectProperty", + "start": 20, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "method": false, + "key": { + "type": "StringLiteral", + "start": 20, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "extra": { + "rawValue": "__proto__", + "raw": "\"__proto__\"" + }, + "value": "__proto__" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "NullLiteral", + "start": 33, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 37 + } + } + } + }, + { + "type": "ObjectProperty", + "start": 39, + "end": 54, + "loc": { + "start": { + "line": 1, + "column": 39 + }, + "end": { + "line": 1, + "column": 54 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 39, + "end": 48, + "loc": { + "start": { + "line": 1, + "column": 39 + }, + "end": { + "line": 1, + "column": 48 + }, + "identifierName": "__proto__" + }, + "name": "__proto__" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "NullLiteral", + "start": 50, + "end": 54, + "loc": { + "start": { + "line": 1, + "column": 50 + }, + "end": { + "line": 1, + "column": 54 + } + } + } + } + ], + "extra": { + "trailingComma": 54, + "parenthesized": true, + "parenStart": 0 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-object-initialiser/invalid-proto-identifier-literal/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-object-initialiser/invalid-proto-identifier-literal/options.json deleted file mode 100644 index 5c966843f4fa..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/es2015-object-initialiser/invalid-proto-identifier-literal/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Redefinition of __proto__ property (1:20)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-object-initialiser/invalid-proto-identifier-literal/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-object-initialiser/invalid-proto-identifier-literal/output.json new file mode 100644 index 000000000000..5e3da9129e41 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-object-initialiser/invalid-proto-identifier-literal/output.json @@ -0,0 +1,177 @@ +{ + "type": "File", + "start": 0, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 40 + } + }, + "errors": [ + "SyntaxError: Redefinition of __proto__ property (1:20)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 40 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 40 + } + }, + "expression": { + "type": "ObjectExpression", + "start": 1, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 3, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 3, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 12 + }, + "identifierName": "__proto__" + }, + "name": "__proto__" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "NullLiteral", + "start": 14, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 18 + } + } + } + }, + { + "type": "ObjectProperty", + "start": 20, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "method": false, + "key": { + "type": "StringLiteral", + "start": 20, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "extra": { + "rawValue": "__proto__", + "raw": "\"__proto__\"" + }, + "value": "__proto__" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "NullLiteral", + "start": 33, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 37 + } + } + } + } + ], + "extra": { + "parenthesized": true, + "parenStart": 0 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-object-initialiser/invalid-proto-identifiers/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-object-initialiser/invalid-proto-identifiers/options.json deleted file mode 100644 index 5c966843f4fa..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/es2015-object-initialiser/invalid-proto-identifiers/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Redefinition of __proto__ property (1:20)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-object-initialiser/invalid-proto-identifiers/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-object-initialiser/invalid-proto-identifiers/output.json new file mode 100644 index 000000000000..f0884a922d47 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-object-initialiser/invalid-proto-identifiers/output.json @@ -0,0 +1,174 @@ +{ + "type": "File", + "start": 0, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 38 + } + }, + "errors": [ + "SyntaxError: Redefinition of __proto__ property (1:20)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 38 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 38 + } + }, + "expression": { + "type": "ObjectExpression", + "start": 1, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 3, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 3, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 12 + }, + "identifierName": "__proto__" + }, + "name": "__proto__" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "NullLiteral", + "start": 14, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 18 + } + } + } + }, + { + "type": "ObjectProperty", + "start": 20, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 20, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 29 + }, + "identifierName": "__proto__" + }, + "name": "__proto__" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "NullLiteral", + "start": 31, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 31 + }, + "end": { + "line": 1, + "column": 35 + } + } + } + } + ], + "extra": { + "parenthesized": true, + "parenStart": 0 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-object-initialiser/invalid-proto-literal-identifier/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-object-initialiser/invalid-proto-literal-identifier/options.json deleted file mode 100644 index e19950ad14df..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/es2015-object-initialiser/invalid-proto-literal-identifier/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Redefinition of __proto__ property (1:22)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-object-initialiser/invalid-proto-literal-identifier/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-object-initialiser/invalid-proto-literal-identifier/output.json new file mode 100644 index 000000000000..7b8c0af8927c --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-object-initialiser/invalid-proto-literal-identifier/output.json @@ -0,0 +1,177 @@ +{ + "type": "File", + "start": 0, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 40 + } + }, + "errors": [ + "SyntaxError: Redefinition of __proto__ property (1:22)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 40 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 40 + } + }, + "expression": { + "type": "ObjectExpression", + "start": 1, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 3, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "method": false, + "key": { + "type": "StringLiteral", + "start": 3, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "extra": { + "rawValue": "__proto__", + "raw": "\"__proto__\"" + }, + "value": "__proto__" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "NullLiteral", + "start": 16, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 20 + } + } + } + }, + { + "type": "ObjectProperty", + "start": 22, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 22, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 31 + }, + "identifierName": "__proto__" + }, + "name": "__proto__" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "NullLiteral", + "start": 33, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 37 + } + } + } + } + ], + "extra": { + "parenthesized": true, + "parenStart": 0 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-object-initialiser/invalid-proto-literals/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-object-initialiser/invalid-proto-literals/options.json deleted file mode 100644 index e19950ad14df..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/es2015-object-initialiser/invalid-proto-literals/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Redefinition of __proto__ property (1:22)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-object-initialiser/invalid-proto-literals/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-object-initialiser/invalid-proto-literals/output.json new file mode 100644 index 000000000000..a9e0e52b80af --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-object-initialiser/invalid-proto-literals/output.json @@ -0,0 +1,180 @@ +{ + "type": "File", + "start": 0, + "end": 42, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 42 + } + }, + "errors": [ + "SyntaxError: Redefinition of __proto__ property (1:22)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 42, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 42 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 42, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 42 + } + }, + "expression": { + "type": "ObjectExpression", + "start": 1, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 41 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 3, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "method": false, + "key": { + "type": "StringLiteral", + "start": 3, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "extra": { + "rawValue": "__proto__", + "raw": "\"__proto__\"" + }, + "value": "__proto__" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "NullLiteral", + "start": 16, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 20 + } + } + } + }, + { + "type": "ObjectProperty", + "start": 22, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "method": false, + "key": { + "type": "StringLiteral", + "start": 22, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "extra": { + "rawValue": "__proto__", + "raw": "'__proto__'" + }, + "value": "__proto__" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "NullLiteral", + "start": 35, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 35 + }, + "end": { + "line": 1, + "column": 39 + } + } + } + } + ], + "extra": { + "parenthesized": true, + "parenStart": 0 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-object-initialiser/invalid-proto-setter-literal-identifier/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-object-initialiser/invalid-proto-setter-literal-identifier/options.json deleted file mode 100644 index f364ee918462..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/es2015-object-initialiser/invalid-proto-setter-literal-identifier/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Redefinition of __proto__ property (1:42)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-object-initialiser/invalid-proto-setter-literal-identifier/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-object-initialiser/invalid-proto-setter-literal-identifier/output.json new file mode 100644 index 000000000000..1a77efa6deef --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-object-initialiser/invalid-proto-setter-literal-identifier/output.json @@ -0,0 +1,252 @@ +{ + "type": "File", + "start": 0, + "end": 61, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 61 + } + }, + "errors": [ + "SyntaxError: Redefinition of __proto__ property (1:42)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 61, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 61 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 61, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 61 + } + }, + "expression": { + "type": "ObjectExpression", + "start": 1, + "end": 60, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 60 + } + }, + "properties": [ + { + "type": "ObjectMethod", + "start": 3, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 7, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 16 + }, + "identifierName": "__proto__" + }, + "name": "__proto__" + }, + "computed": false, + "kind": "set", + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 17, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + }, + "identifierName": "x" + }, + "name": "x" + } + ], + "body": { + "type": "BlockStatement", + "start": 19, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "body": [], + "directives": [] + } + }, + { + "type": "ObjectProperty", + "start": 23, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 40 + } + }, + "method": false, + "key": { + "type": "StringLiteral", + "start": 23, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "extra": { + "rawValue": "__proto__", + "raw": "\"__proto__\"" + }, + "value": "__proto__" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "NullLiteral", + "start": 36, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 36 + }, + "end": { + "line": 1, + "column": 40 + } + } + } + }, + { + "type": "ObjectProperty", + "start": 42, + "end": 57, + "loc": { + "start": { + "line": 1, + "column": 42 + }, + "end": { + "line": 1, + "column": 57 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 42, + "end": 51, + "loc": { + "start": { + "line": 1, + "column": 42 + }, + "end": { + "line": 1, + "column": 51 + }, + "identifierName": "__proto__" + }, + "name": "__proto__" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "NullLiteral", + "start": 53, + "end": 57, + "loc": { + "start": { + "line": 1, + "column": 53 + }, + "end": { + "line": 1, + "column": 57 + } + } + } + } + ], + "extra": { + "trailingComma": 57, + "parenthesized": true, + "parenStart": 0 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-object-initialiser/proto-identifier-method/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-object-initialiser/proto-identifier-method/output.json index d6a917129034..76754ed85da4 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-object-initialiser/proto-identifier-method/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-object-initialiser/proto-identifier-method/output.json @@ -166,6 +166,7 @@ } ], "extra": { + "trailingComma": 33, "parenthesized": true, "parenStart": 0 } diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-object-initialiser/proto-literal-method/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-object-initialiser/proto-literal-method/output.json index 0995b435bf70..cd0e7970cac6 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-object-initialiser/proto-literal-method/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-object-initialiser/proto-literal-method/output.json @@ -169,6 +169,7 @@ } ], "extra": { + "trailingComma": 35, "parenthesized": true, "parenStart": 0 } diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-object-pattern/elision/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-object-pattern/elision/output.json index 4f6c7b8f2be5..243668c0d0ad 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-object-pattern/elision/output.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-object-pattern/elision/output.json @@ -128,7 +128,10 @@ "shorthand": true } } - ] + ], + "extra": { + "trailingComma": 6 + } }, "init": { "type": "NumericLiteral", diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-super-property/invalid_super_not_inside_function/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-super-property/invalid_super_not_inside_function/options.json deleted file mode 100644 index cf468e48541b..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/es2015-super-property/invalid_super_not_inside_function/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "super is only allowed in object methods and classes (1:8)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-super-property/invalid_super_not_inside_function/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-super-property/invalid_super_not_inside_function/output.json new file mode 100644 index 000000000000..94b7917cd389 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-super-property/invalid_super_not_inside_function/output.json @@ -0,0 +1,119 @@ +{ + "type": "File", + "start": 0, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "errors": [ + "SyntaxError: super() is only valid inside a class constructor of a subclass. Maybe a typo in the method name ('constructor') or not extending another class? (1:8)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 0, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 4, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "id": { + "type": "Identifier", + "start": 4, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + }, + "identifierName": "x" + }, + "name": "x" + }, + "init": { + "type": "CallExpression", + "start": 8, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "callee": { + "type": "Super", + "start": 8, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + "arguments": [] + } + } + ], + "kind": "var" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-template-literals/invalid-escape/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-template-literals/invalid-escape/options.json deleted file mode 100644 index fd4da953a419..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/es2015-template-literals/invalid-escape/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-template-literals/invalid-escape/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-template-literals/invalid-escape/output.json new file mode 100644 index 000000000000..3f3cd6596907 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-template-literals/invalid-escape/output.json @@ -0,0 +1,91 @@ +{ + "type": "File", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "expression": { + "type": "TemplateLiteral", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "expressions": [], + "quasis": [ + { + "type": "TemplateElement", + "start": 1, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "value": { + "raw": "\\1", + "cooked": null + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-arrow-default/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-arrow-default/options.json deleted file mode 100644 index f81e206da65d..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-arrow-default/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Yield cannot be used as name inside a generator function (1:21)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-arrow-default/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-arrow-default/output.json new file mode 100644 index 000000000000..93f29667086b --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-arrow-default/output.json @@ -0,0 +1,211 @@ +{ + "type": "File", + "start": 0, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 38 + } + }, + "errors": [ + "SyntaxError: Yield cannot be used as name inside a generator function (1:21)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 38 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 38 + } + }, + "id": { + "type": "Identifier", + "start": 10, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + }, + "identifierName": "g" + }, + "name": "g" + }, + "generator": true, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 14, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 38 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 16, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "expression": { + "type": "ArrowFunctionExpression", + "start": 16, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "AssignmentPattern", + "start": 17, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "left": { + "type": "Identifier", + "start": 17, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + }, + "identifierName": "x" + }, + "name": "x" + }, + "right": { + "type": "YieldExpression", + "start": 21, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "delegate": false, + "argument": { + "type": "NumericLiteral", + "start": 27, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "extra": { + "rawValue": 42, + "raw": "42" + }, + "value": 42 + } + } + } + ], + "body": { + "type": "BlockStatement", + "start": 34, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 34 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "body": [], + "directives": [] + } + } + } + ], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-arrow-parameter/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-arrow-parameter/options.json deleted file mode 100644 index efa8ac523c48..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-arrow-parameter/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Yield cannot be used as name inside a generator function (1:16)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-arrow-parameter/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-arrow-parameter/output.json new file mode 100644 index 000000000000..dfdc04d3c48b --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-arrow-parameter/output.json @@ -0,0 +1,164 @@ +{ + "type": "File", + "start": 0, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "errors": [ + "SyntaxError: Yield cannot be used as name inside a generator function (1:16)", + "SyntaxError: Binding invalid left-hand side in function parameter list (1:16)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "id": { + "type": "Identifier", + "start": 10, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + }, + "identifierName": "g" + }, + "name": "g" + }, + "generator": true, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 13, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 15, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "expression": { + "type": "ArrowFunctionExpression", + "start": 15, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "YieldExpression", + "start": 16, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "delegate": false, + "argument": null + } + ], + "body": { + "type": "NumericLiteral", + "start": 26, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "extra": { + "rawValue": 42, + "raw": "42" + }, + "value": 42 + } + } + } + ], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-arrow-parameters/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-arrow-parameters/options.json deleted file mode 100644 index 185008241333..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-arrow-parameters/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Yield cannot be used as name inside a generator function (1:25)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-arrow-parameters/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-arrow-parameters/output.json new file mode 100644 index 000000000000..6bf7ee0d6108 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-arrow-parameters/output.json @@ -0,0 +1,215 @@ +{ + "type": "File", + "start": 0, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "errors": [ + "SyntaxError: Yield cannot be used as name inside a generator function (1:25)", + "SyntaxError: Binding invalid left-hand side in function parameter list (1:25)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "id": { + "type": "Identifier", + "start": 10, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + }, + "identifierName": "g" + }, + "name": "g" + }, + "generator": true, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 13, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 15, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "expression": { + "type": "ArrowFunctionExpression", + "start": 15, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 16, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + }, + "identifierName": "a" + }, + "name": "a" + }, + { + "type": "Identifier", + "start": 19, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + }, + "identifierName": "b" + }, + "name": "b" + }, + { + "type": "Identifier", + "start": 22, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + }, + "identifierName": "c" + }, + "name": "c" + }, + { + "type": "YieldExpression", + "start": 25, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "delegate": false, + "argument": null + } + ], + "body": { + "type": "NumericLiteral", + "start": 35, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 35 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "extra": { + "rawValue": 42, + "raw": "42" + }, + "value": 42 + } + } + } + ], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-catch/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-catch/options.json deleted file mode 100644 index 8c287a1d5b36..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-catch/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Can not use 'yield' as identifier inside a generator (1:30)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-catch/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-catch/output.json new file mode 100644 index 000000000000..638788f4405b --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-catch/output.json @@ -0,0 +1,173 @@ +{ + "type": "File", + "start": 0, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 41 + } + }, + "errors": [ + "SyntaxError: Can not use 'yield' as identifier inside a generator (1:30)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 41 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 41 + } + }, + "id": { + "type": "Identifier", + "start": 10, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + }, + "identifierName": "g" + }, + "name": "g" + }, + "generator": true, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 14, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 41 + } + }, + "body": [ + { + "type": "TryStatement", + "start": 16, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "block": { + "type": "BlockStatement", + "start": 20, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "body": [], + "directives": [] + }, + "handler": { + "type": "CatchClause", + "start": 23, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "param": { + "type": "Identifier", + "start": 30, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 35 + }, + "identifierName": "yield" + }, + "name": "yield" + }, + "body": { + "type": "BlockStatement", + "start": 37, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "body": [], + "directives": [] + } + }, + "finalizer": null + } + ], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-declaration/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-declaration/options.json deleted file mode 100644 index 3ceff8546d37..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-declaration/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Can not use 'yield' as identifier inside a generator (1:26)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-declaration/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-declaration/output.json new file mode 100644 index 000000000000..30846cf74293 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-declaration/output.json @@ -0,0 +1,143 @@ +{ + "type": "File", + "start": 0, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "errors": [ + "SyntaxError: Can not use 'yield' as identifier inside a generator (1:26)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "id": { + "type": "Identifier", + "start": 10, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + }, + "identifierName": "g" + }, + "name": "g" + }, + "generator": true, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 14, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "body": [ + { + "type": "FunctionDeclaration", + "start": 16, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "id": { + "type": "Identifier", + "start": 26, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 31 + }, + "identifierName": "yield" + }, + "name": "yield" + }, + "generator": true, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 33, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "body": [], + "directives": [] + } + } + ], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-export-default/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-export-default/options.json index 23a96f285fe4..2104ca43283f 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-export-default/options.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-export-default/options.json @@ -1,4 +1,3 @@ { - "sourceType": "module", - "throws": "Unexpected reserved word 'yield' (1:25)" + "sourceType": "module" } diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-export-default/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-export-default/output.json new file mode 100644 index 000000000000..273c4fcdf066 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-export-default/output.json @@ -0,0 +1,105 @@ +{ + "type": "File", + "start": 0, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "errors": [ + "SyntaxError: Unexpected reserved word 'yield' (1:25)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExportDefaultDeclaration", + "start": 0, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "declaration": { + "type": "FunctionDeclaration", + "start": 15, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "id": { + "type": "Identifier", + "start": 25, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 30 + }, + "identifierName": "yield" + }, + "name": "yield" + }, + "generator": true, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 33, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "body": [], + "directives": [] + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-expression-name/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-expression-name/options.json deleted file mode 100644 index c32eaf81f281..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-expression-name/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Can not use 'yield' as identifier inside a generator (1:10)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-expression-name/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-expression-name/output.json new file mode 100644 index 000000000000..0eca9154c92a --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-expression-name/output.json @@ -0,0 +1,109 @@ +{ + "type": "File", + "start": 0, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "errors": [ + "SyntaxError: Can not use 'yield' as identifier inside a generator (1:10)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "expression": { + "type": "FunctionExpression", + "start": 1, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "id": { + "type": "Identifier", + "start": 10, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 15 + }, + "identifierName": "yield" + }, + "name": "yield" + }, + "generator": true, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "body": [], + "directives": [] + }, + "extra": { + "parenthesized": true, + "parenStart": 0 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-expression-parameter/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-expression-parameter/options.json deleted file mode 100644 index 28b734910647..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-expression-parameter/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Can not use 'yield' as identifier inside a generator (1:12)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-expression-parameter/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-expression-parameter/output.json new file mode 100644 index 000000000000..dbee42bd9873 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-expression-parameter/output.json @@ -0,0 +1,111 @@ +{ + "type": "File", + "start": 0, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "errors": [ + "SyntaxError: Can not use 'yield' as identifier inside a generator (1:12)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "expression": { + "type": "FunctionExpression", + "start": 1, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "id": null, + "generator": true, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 12, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 17 + }, + "identifierName": "yield" + }, + "name": "yield" + } + ], + "body": { + "type": "BlockStatement", + "start": 18, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "body": [], + "directives": [] + }, + "extra": { + "parenthesized": true, + "parenStart": 0 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-expression-rest/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-expression-rest/options.json deleted file mode 100644 index aef4d7f4f9a2..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-expression-rest/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Can not use 'yield' as identifier inside a generator (1:18)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-expression-rest/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-expression-rest/output.json new file mode 100644 index 000000000000..74eaaceb9832 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-expression-rest/output.json @@ -0,0 +1,143 @@ +{ + "type": "File", + "start": 0, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "errors": [ + "SyntaxError: Can not use 'yield' as identifier inside a generator (1:18)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "expression": { + "type": "FunctionExpression", + "start": 1, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "id": null, + "generator": true, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 12, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + }, + "identifierName": "x" + }, + "name": "x" + }, + { + "type": "RestElement", + "start": 15, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "argument": { + "type": "Identifier", + "start": 18, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 23 + }, + "identifierName": "yield" + }, + "name": "yield" + } + } + ], + "body": { + "type": "BlockStatement", + "start": 24, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "body": [], + "directives": [] + }, + "extra": { + "parenthesized": true, + "parenStart": 0 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-function-declaration/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-function-declaration/options.json deleted file mode 100644 index 6993832643f1..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-function-declaration/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Can not use 'yield' as identifier inside a generator (1:25)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-function-declaration/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-function-declaration/output.json new file mode 100644 index 000000000000..ec55ac771815 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-function-declaration/output.json @@ -0,0 +1,143 @@ +{ + "type": "File", + "start": 0, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "errors": [ + "SyntaxError: Can not use 'yield' as identifier inside a generator (1:25)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "id": { + "type": "Identifier", + "start": 10, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + }, + "identifierName": "g" + }, + "name": "g" + }, + "generator": true, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 14, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "body": [ + { + "type": "FunctionDeclaration", + "start": 16, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "id": { + "type": "Identifier", + "start": 25, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 30 + }, + "identifierName": "yield" + }, + "name": "yield" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 33, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "body": [], + "directives": [] + } + } + ], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-lexical-declaration/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-lexical-declaration/options.json deleted file mode 100644 index ad818f81f136..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-lexical-declaration/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Can not use 'yield' as identifier inside a generator (1:20)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-lexical-declaration/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-lexical-declaration/output.json new file mode 100644 index 000000000000..e07b84fedd4d --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-lexical-declaration/output.json @@ -0,0 +1,142 @@ +{ + "type": "File", + "start": 0, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "errors": [ + "SyntaxError: Can not use 'yield' as identifier inside a generator (1:20)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "id": { + "type": "Identifier", + "start": 10, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + }, + "identifierName": "g" + }, + "name": "g" + }, + "generator": true, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 14, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "body": [ + { + "type": "VariableDeclaration", + "start": 16, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 20, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "id": { + "type": "Identifier", + "start": 20, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 25 + }, + "identifierName": "yield" + }, + "name": "yield" + }, + "init": null + } + ], + "kind": "let" + } + ], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-parameter/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-parameter/options.json deleted file mode 100644 index 28b734910647..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-parameter/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Can not use 'yield' as identifier inside a generator (1:12)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-parameter/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-parameter/output.json new file mode 100644 index 000000000000..91b76a6f9351 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-parameter/output.json @@ -0,0 +1,108 @@ +{ + "type": "File", + "start": 0, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "errors": [ + "SyntaxError: Can not use 'yield' as identifier inside a generator (1:12)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "id": { + "type": "Identifier", + "start": 10, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + }, + "identifierName": "g" + }, + "name": "g" + }, + "generator": true, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 12, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 17 + }, + "identifierName": "yield" + }, + "name": "yield" + } + ], + "body": { + "type": "BlockStatement", + "start": 18, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "body": [], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-rest/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-rest/options.json deleted file mode 100644 index c811689d9abd..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-rest/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Can not use 'yield' as identifier inside a generator (1:24)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-rest/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-rest/output.json new file mode 100644 index 000000000000..0b1e59c7ab58 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-rest/output.json @@ -0,0 +1,174 @@ +{ + "type": "File", + "start": 0, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "errors": [ + "SyntaxError: Can not use 'yield' as identifier inside a generator (1:24)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "id": { + "type": "Identifier", + "start": 10, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + }, + "identifierName": "g" + }, + "name": "g" + }, + "generator": true, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 12, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + }, + "identifierName": "a" + }, + "name": "a" + }, + { + "type": "Identifier", + "start": 15, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + }, + "identifierName": "b" + }, + "name": "b" + }, + { + "type": "Identifier", + "start": 18, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + }, + "identifierName": "c" + }, + "name": "c" + }, + { + "type": "RestElement", + "start": 21, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "argument": { + "type": "Identifier", + "start": 24, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 29 + }, + "identifierName": "yield" + }, + "name": "yield" + } + } + ], + "body": { + "type": "BlockStatement", + "start": 30, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "body": [], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-strict-function-expression/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-strict-function-expression/options.json deleted file mode 100644 index 865e081676d6..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-strict-function-expression/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected reserved word 'yield' (1:46)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-strict-function-expression/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-strict-function-expression/output.json new file mode 100644 index 000000000000..b1b8b4f0880d --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-strict-function-expression/output.json @@ -0,0 +1,229 @@ +{ + "type": "File", + "start": 0, + "end": 58, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 58 + } + }, + "errors": [ + "SyntaxError: Unexpected reserved word 'yield' (1:46)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 58, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 58 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 14, + "end": 58, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 58 + } + }, + "id": { + "type": "Identifier", + "start": 24, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 + }, + "identifierName": "g" + }, + "name": "g" + }, + "generator": true, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 27, + "end": 58, + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 58 + } + }, + "body": [ + { + "type": "VariableDeclaration", + "start": 29, + "end": 56, + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 56 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 33, + "end": 55, + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 55 + } + }, + "id": { + "type": "Identifier", + "start": 33, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 34 + }, + "identifierName": "y" + }, + "name": "y" + }, + "init": { + "type": "FunctionExpression", + "start": 37, + "end": 55, + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 55 + } + }, + "id": { + "type": "Identifier", + "start": 46, + "end": 51, + "loc": { + "start": { + "line": 1, + "column": 46 + }, + "end": { + "line": 1, + "column": 51 + }, + "identifierName": "yield" + }, + "name": "yield" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 53, + "end": 55, + "loc": { + "start": { + "line": 1, + "column": 53 + }, + "end": { + "line": 1, + "column": 55 + } + }, + "body": [], + "directives": [] + } + } + } + ], + "kind": "var" + } + ], + "directives": [] + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-strict-function-parameter/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-strict-function-parameter/options.json deleted file mode 100644 index 21348af52377..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-strict-function-parameter/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected reserved word 'yield' (1:47)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-strict-function-parameter/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-strict-function-parameter/output.json new file mode 100644 index 000000000000..40d206249a26 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-strict-function-parameter/output.json @@ -0,0 +1,231 @@ +{ + "type": "File", + "start": 0, + "end": 58, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 58 + } + }, + "errors": [ + "SyntaxError: Unexpected reserved word 'yield' (1:47)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 58, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 58 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 14, + "end": 58, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 58 + } + }, + "id": { + "type": "Identifier", + "start": 24, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 + }, + "identifierName": "g" + }, + "name": "g" + }, + "generator": true, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 28, + "end": 58, + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 58 + } + }, + "body": [ + { + "type": "VariableDeclaration", + "start": 30, + "end": 56, + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 56 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 34, + "end": 56, + "loc": { + "start": { + "line": 1, + "column": 34 + }, + "end": { + "line": 1, + "column": 56 + } + }, + "id": { + "type": "Identifier", + "start": 34, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 34 + }, + "end": { + "line": 1, + "column": 35 + }, + "identifierName": "z" + }, + "name": "z" + }, + "init": { + "type": "FunctionExpression", + "start": 38, + "end": 56, + "loc": { + "start": { + "line": 1, + "column": 38 + }, + "end": { + "line": 1, + "column": 56 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 47, + "end": 52, + "loc": { + "start": { + "line": 1, + "column": 47 + }, + "end": { + "line": 1, + "column": 52 + }, + "identifierName": "yield" + }, + "name": "yield" + } + ], + "body": { + "type": "BlockStatement", + "start": 54, + "end": 56, + "loc": { + "start": { + "line": 1, + "column": 54 + }, + "end": { + "line": 1, + "column": 56 + } + }, + "body": [], + "directives": [] + } + } + } + ], + "kind": "var" + } + ], + "directives": [] + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-variable-declaration/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-variable-declaration/options.json deleted file mode 100644 index ad818f81f136..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-variable-declaration/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Can not use 'yield' as identifier inside a generator (1:20)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-variable-declaration/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-variable-declaration/output.json new file mode 100644 index 000000000000..770c2246fabb --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-variable-declaration/output.json @@ -0,0 +1,142 @@ +{ + "type": "File", + "start": 0, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "errors": [ + "SyntaxError: Can not use 'yield' as identifier inside a generator (1:20)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "id": { + "type": "Identifier", + "start": 10, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + }, + "identifierName": "g" + }, + "name": "g" + }, + "generator": true, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 14, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "body": [ + { + "type": "VariableDeclaration", + "start": 16, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 20, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "id": { + "type": "Identifier", + "start": 20, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 25 + }, + "identifierName": "yield" + }, + "name": "yield" + }, + "init": null + } + ], + "kind": "var" + } + ], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-array-pattern/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-array-pattern/options.json deleted file mode 100644 index e817f30acb5c..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-array-pattern/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected reserved word 'yield' (1:16)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-array-pattern/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-array-pattern/output.json new file mode 100644 index 000000000000..4a0cd5664566 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-array-pattern/output.json @@ -0,0 +1,160 @@ +{ + "type": "File", + "start": 0, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "errors": [ + "SyntaxError: Unexpected reserved word 'yield' (1:16)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 14, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 15, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "operator": "=", + "left": { + "type": "ArrayPattern", + "start": 15, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "elements": [ + { + "type": "Identifier", + "start": 16, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 21 + }, + "identifierName": "yield" + }, + "name": "yield" + } + ] + }, + "right": { + "type": "Identifier", + "start": 25, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 26 + }, + "identifierName": "x" + }, + "name": "x" + }, + "extra": { + "parenthesized": true, + "parenStart": 14 + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-arrow-parameter-default/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-arrow-parameter-default/options.json deleted file mode 100644 index e80b46c31b86..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-arrow-parameter-default/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected reserved word 'yield' (1:19)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-arrow-parameter-default/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-arrow-parameter-default/output.json new file mode 100644 index 000000000000..b6b507c9e6cb --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-arrow-parameter-default/output.json @@ -0,0 +1,175 @@ +{ + "type": "File", + "start": 0, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "errors": [ + "SyntaxError: Unexpected reserved word 'yield' (1:19)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 14, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "expression": { + "type": "ArrowFunctionExpression", + "start": 14, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "AssignmentPattern", + "start": 15, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "left": { + "type": "Identifier", + "start": 15, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + }, + "identifierName": "x" + }, + "name": "x" + }, + "right": { + "type": "Identifier", + "start": 19, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 24 + }, + "identifierName": "yield" + }, + "name": "yield" + } + } + ], + "body": { + "type": "BlockStatement", + "start": 29, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "body": [], + "directives": [] + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-arrow-parameter-name/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-arrow-parameter-name/options.json deleted file mode 100644 index 27b38d28f986..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-arrow-parameter-name/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected reserved word 'yield' (1:15)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-arrow-parameter-name/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-arrow-parameter-name/output.json new file mode 100644 index 000000000000..3c5b82bd6c7b --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-arrow-parameter-name/output.json @@ -0,0 +1,146 @@ +{ + "type": "File", + "start": 0, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "errors": [ + "SyntaxError: Unexpected reserved word 'yield' (1:15)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 14, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "expression": { + "type": "ArrowFunctionExpression", + "start": 14, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 15, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 20 + }, + "identifierName": "yield" + }, + "name": "yield" + } + ], + "body": { + "type": "NumericLiteral", + "start": 25, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "extra": { + "rawValue": 42, + "raw": "42" + }, + "value": 42 + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-binding-element/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-binding-element/options.json deleted file mode 100644 index 5d111aab9319..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-binding-element/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected reserved word 'yield' (1:23)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-binding-element/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-binding-element/output.json new file mode 100644 index 000000000000..06d787bb4992 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-binding-element/output.json @@ -0,0 +1,193 @@ +{ + "type": "File", + "start": 0, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "errors": [ + "SyntaxError: Unexpected reserved word 'yield' (1:23)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 14, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 18, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "id": { + "type": "ObjectPattern", + "start": 18, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 20, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 20, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + }, + "identifierName": "x" + }, + "name": "x" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "Identifier", + "start": 23, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 28 + }, + "identifierName": "yield" + }, + "name": "yield" + } + } + ] + }, + "init": { + "type": "Identifier", + "start": 33, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 36 + }, + "identifierName": "foo" + }, + "name": "foo" + } + } + ], + "kind": "var" + } + ], + "directives": [ + { + "type": "Directive", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-catch-parameter/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-catch-parameter/options.json deleted file mode 100644 index 01aca4591cea..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-catch-parameter/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected reserved word 'yield' (1:28)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-catch-parameter/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-catch-parameter/output.json new file mode 100644 index 000000000000..2b7952b2afe7 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-catch-parameter/output.json @@ -0,0 +1,156 @@ +{ + "type": "File", + "start": 0, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "errors": [ + "SyntaxError: Unexpected reserved word 'yield' (1:28)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "TryStatement", + "start": 14, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "block": { + "type": "BlockStatement", + "start": 18, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "body": [], + "directives": [] + }, + "handler": { + "type": "CatchClause", + "start": 21, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "param": { + "type": "Identifier", + "start": 28, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 33 + }, + "identifierName": "yield" + }, + "name": "yield" + }, + "body": { + "type": "BlockStatement", + "start": 35, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 35 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "body": [], + "directives": [] + } + }, + "finalizer": null + } + ], + "directives": [ + { + "type": "Directive", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-formal-parameter/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-formal-parameter/options.json deleted file mode 100644 index a4a677fb3136..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-formal-parameter/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected reserved word 'yield' (1:25)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-formal-parameter/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-formal-parameter/output.json new file mode 100644 index 000000000000..f936dc48abf9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-formal-parameter/output.json @@ -0,0 +1,144 @@ +{ + "type": "File", + "start": 0, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "errors": [ + "SyntaxError: Unexpected reserved word 'yield' (1:25)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 14, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "id": { + "type": "Identifier", + "start": 23, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + }, + "identifierName": "f" + }, + "name": "f" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 25, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 30 + }, + "identifierName": "yield" + }, + "name": "yield" + } + ], + "body": { + "type": "BlockStatement", + "start": 32, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "body": [], + "directives": [] + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-function-declaration/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-function-declaration/options.json deleted file mode 100644 index 091e7958db52..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-function-declaration/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'yield' in strict mode (1:9)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-function-declaration/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-function-declaration/output.json new file mode 100644 index 000000000000..7f270919a446 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-function-declaration/output.json @@ -0,0 +1,126 @@ +{ + "type": "File", + "start": 0, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "errors": [ + "SyntaxError: Binding 'yield' in strict mode (1:9)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "yield" + }, + "name": "yield" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 16, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "body": [], + "directives": [ + { + "type": "Directive", + "start": 18, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 18, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-function-expression/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-function-expression/options.json deleted file mode 100644 index 1c3817f8e018..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-function-expression/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'yield' in strict mode (1:10)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-function-expression/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-function-expression/output.json new file mode 100644 index 000000000000..d65f41baceea --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-function-expression/output.json @@ -0,0 +1,145 @@ +{ + "type": "File", + "start": 0, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "errors": [ + "SyntaxError: Binding 'yield' in strict mode (1:10)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "expression": { + "type": "FunctionExpression", + "start": 1, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "id": { + "type": "Identifier", + "start": 10, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 15 + }, + "identifierName": "yield" + }, + "name": "yield" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "body": [], + "directives": [ + { + "type": "Directive", + "start": 19, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 19, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + }, + "extra": { + "parenthesized": true, + "parenStart": 0 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-identifier/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-identifier/options.json deleted file mode 100644 index 412431249548..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-identifier/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected reserved word 'yield' (1:29)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-identifier/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-identifier/output.json new file mode 100644 index 000000000000..0d4e30957667 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-identifier/output.json @@ -0,0 +1,159 @@ +{ + "type": "File", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "errors": [ + "SyntaxError: Unexpected reserved word 'yield' (1:29)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 14, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "id": { + "type": "Identifier", + "start": 23, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + }, + "identifierName": "f" + }, + "name": "f" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 27, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 29, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "expression": { + "type": "Identifier", + "start": 29, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 34 + }, + "identifierName": "yield" + }, + "name": "yield" + } + } + ], + "directives": [] + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-lexical-declaration/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-lexical-declaration/options.json deleted file mode 100644 index 53a8921cb309..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-lexical-declaration/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected reserved word 'yield' (1:18)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-lexical-declaration/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-lexical-declaration/output.json new file mode 100644 index 000000000000..71c86eec827d --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-lexical-declaration/output.json @@ -0,0 +1,144 @@ +{ + "type": "File", + "start": 0, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "errors": [ + "SyntaxError: Unexpected reserved word 'yield' (1:18)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 14, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 18, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "id": { + "type": "Identifier", + "start": 18, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 23 + }, + "identifierName": "yield" + }, + "name": "yield" + }, + "init": { + "type": "NumericLiteral", + "start": 26, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "extra": { + "rawValue": 42, + "raw": "42" + }, + "value": 42 + } + } + ], + "kind": "let" + } + ], + "directives": [ + { + "type": "Directive", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-rest-parameter/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-rest-parameter/options.json deleted file mode 100644 index 01aca4591cea..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-rest-parameter/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected reserved word 'yield' (1:28)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-rest-parameter/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-rest-parameter/output.json new file mode 100644 index 000000000000..d246bfc86e6e --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-rest-parameter/output.json @@ -0,0 +1,159 @@ +{ + "type": "File", + "start": 0, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "errors": [ + "SyntaxError: Unexpected reserved word 'yield' (1:28)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 14, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "id": { + "type": "Identifier", + "start": 23, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + }, + "identifierName": "f" + }, + "name": "f" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "RestElement", + "start": 25, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "argument": { + "type": "Identifier", + "start": 28, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 33 + }, + "identifierName": "yield" + }, + "name": "yield" + } + } + ], + "body": { + "type": "BlockStatement", + "start": 35, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 35 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "body": [], + "directives": [] + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-variable-declaration/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-variable-declaration/options.json deleted file mode 100644 index 53a8921cb309..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-variable-declaration/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected reserved word 'yield' (1:18)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-variable-declaration/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-variable-declaration/output.json new file mode 100644 index 000000000000..0561e522bd7b --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-variable-declaration/output.json @@ -0,0 +1,125 @@ +{ + "type": "File", + "start": 0, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "errors": [ + "SyntaxError: Unexpected reserved word 'yield' (1:18)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 14, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 18, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "id": { + "type": "Identifier", + "start": 18, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 23 + }, + "identifierName": "yield" + }, + "name": "yield" + }, + "init": null + } + ], + "kind": "var" + } + ], + "directives": [ + { + "type": "Directive", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/yield-generator-arrow-default/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/yield-generator-arrow-default/options.json deleted file mode 100644 index f81e206da65d..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/es2015-yield/yield-generator-arrow-default/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Yield cannot be used as name inside a generator function (1:21)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/yield-generator-arrow-default/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/yield-generator-arrow-default/output.json new file mode 100644 index 000000000000..c26b779c0207 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-yield/yield-generator-arrow-default/output.json @@ -0,0 +1,192 @@ +{ + "type": "File", + "start": 0, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "errors": [ + "SyntaxError: Yield cannot be used as name inside a generator function (1:21)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "id": { + "type": "Identifier", + "start": 10, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + }, + "identifierName": "g" + }, + "name": "g" + }, + "generator": true, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 14, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 16, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "expression": { + "type": "ArrowFunctionExpression", + "start": 16, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "AssignmentPattern", + "start": 17, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "left": { + "type": "Identifier", + "start": 17, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + }, + "identifierName": "x" + }, + "name": "x" + }, + "right": { + "type": "YieldExpression", + "start": 21, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "delegate": false, + "argument": null + } + } + ], + "body": { + "type": "BlockStatement", + "start": 31, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 31 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "body": [], + "directives": [] + } + } + } + ], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/expression-primary-array/migrated_0003/output.json b/packages/babel-parser/test/fixtures/esprima/expression-primary-array/migrated_0003/output.json index 3f7e070ca3ac..d2f456d828ab 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-primary-array/migrated_0003/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-primary-array/migrated_0003/output.json @@ -110,7 +110,10 @@ }, "value": 42 } - ] + ], + "extra": { + "trailingComma": 8 + } } } } diff --git a/packages/babel-parser/test/fixtures/esprima/expression-primary-array/migrated_0005/output.json b/packages/babel-parser/test/fixtures/esprima/expression-primary-array/migrated_0005/output.json index 573eda5bfa9f..0c39b167df03 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-primary-array/migrated_0005/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-primary-array/migrated_0005/output.json @@ -150,7 +150,10 @@ }, "value": 3 } - ] + ], + "extra": { + "trailingComma": 13 + } } } } diff --git a/packages/babel-parser/test/fixtures/esprima/expression-primary-array/migrated_0006/output.json b/packages/babel-parser/test/fixtures/esprima/expression-primary-array/migrated_0006/output.json index 34c8d7e15c8e..c2fec5bfcf25 100644 --- a/packages/babel-parser/test/fixtures/esprima/expression-primary-array/migrated_0006/output.json +++ b/packages/babel-parser/test/fixtures/esprima/expression-primary-array/migrated_0006/output.json @@ -151,7 +151,10 @@ }, "value": 3 } - ] + ], + "extra": { + "trailingComma": 14 + } } } } diff --git a/packages/babel-parser/test/fixtures/esprima/expression-primary-array/migrated_0012/input.js b/packages/babel-parser/test/fixtures/esprima/expression-primary-array/migrated_0012/input.js index 79581f8529b7..cbd842119b94 100755 --- a/packages/babel-parser/test/fixtures/esprima/expression-primary-array/migrated_0012/input.js +++ b/packages/babel-parser/test/fixtures/esprima/expression-primary-array/migrated_0012/input.js @@ -1 +1 @@ -\u2163\u2161\u200A=\u2009[] +\u2163\u2161\u200A diff --git a/packages/babel-parser/test/fixtures/esprima/expression-primary-array/migrated_0012/options.json b/packages/babel-parser/test/fixtures/esprima/expression-primary-array/migrated_0012/options.json deleted file mode 100644 index abe9f835b84b..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/expression-primary-array/migrated_0012/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid Unicode escape (1:12)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/expression-primary-array/migrated_0012/output.json b/packages/babel-parser/test/fixtures/esprima/expression-primary-array/migrated_0012/output.json new file mode 100644 index 000000000000..ea30bc6a3013 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/expression-primary-array/migrated_0012/output.json @@ -0,0 +1,70 @@ +{ + "type": "File", + "start": 0, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "errors": [ + "SyntaxError: Invalid Unicode escape (1:12)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "expression": { + "type": "Identifier", + "start": 0, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + }, + "identifierName": "ⅣⅡ " + }, + "name": "ⅣⅡ " + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/GH-1106-00/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/GH-1106-00/options.json deleted file mode 100644 index 8e0dce66eff8..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/GH-1106-00/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Bad character escape sequence (1:3)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/GH-1106-00/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/GH-1106-00/output.json new file mode 100644 index 000000000000..30ad8a2a0533 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/GH-1106-00/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "errors": [ + "SyntaxError: Bad character escape sequence (1:3)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [], + "directives": [ + { + "type": "Directive", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "value": "\\x", + "extra": { + "raw": "\"\\x\"", + "rawValue": "\\x" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/GH-1106-01/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/GH-1106-01/options.json deleted file mode 100644 index 8e0dce66eff8..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/GH-1106-01/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Bad character escape sequence (1:3)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/GH-1106-01/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/GH-1106-01/output.json new file mode 100644 index 000000000000..91bb0ab97d98 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/GH-1106-01/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "errors": [ + "SyntaxError: Bad character escape sequence (1:3)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [], + "directives": [ + { + "type": "Directive", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "value": "\\x0", + "extra": { + "raw": "\"\\x0\"", + "rawValue": "\\x0" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/GH-1106-02/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/GH-1106-02/options.json deleted file mode 100644 index 8e0dce66eff8..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/GH-1106-02/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Bad character escape sequence (1:3)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/GH-1106-02/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/GH-1106-02/output.json new file mode 100644 index 000000000000..422caf2f1ecf --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/GH-1106-02/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "errors": [ + "SyntaxError: Bad character escape sequence (1:3)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [], + "directives": [ + { + "type": "Directive", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "value": "\\xx", + "extra": { + "raw": "\"\\xx\"", + "rawValue": "\\xx" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/GH-1106-03/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/GH-1106-03/options.json deleted file mode 100644 index 8e0dce66eff8..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/GH-1106-03/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Bad character escape sequence (1:3)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/GH-1106-03/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/GH-1106-03/output.json new file mode 100644 index 000000000000..a00ba8fc772c --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/GH-1106-03/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "errors": [ + "SyntaxError: Bad character escape sequence (1:3)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [], + "directives": [ + { + "type": "Directive", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "value": "\\u", + "extra": { + "raw": "\"\\u\"", + "rawValue": "\\u" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/GH-1106-04/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/GH-1106-04/options.json deleted file mode 100644 index 8e0dce66eff8..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/GH-1106-04/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Bad character escape sequence (1:3)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/GH-1106-04/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/GH-1106-04/output.json new file mode 100644 index 000000000000..4158fada8f7f --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/GH-1106-04/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "errors": [ + "SyntaxError: Bad character escape sequence (1:3)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [], + "directives": [ + { + "type": "Directive", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "value": "\\u0", + "extra": { + "raw": "\"\\u0\"", + "rawValue": "\\u0" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/GH-1106-05/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/GH-1106-05/options.json deleted file mode 100644 index 8e0dce66eff8..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/GH-1106-05/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Bad character escape sequence (1:3)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/GH-1106-05/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/GH-1106-05/output.json new file mode 100644 index 000000000000..b36764ece66c --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/GH-1106-05/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "errors": [ + "SyntaxError: Bad character escape sequence (1:3)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [], + "directives": [ + { + "type": "Directive", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "value": "\\ux", + "extra": { + "raw": "\"\\ux\"", + "rawValue": "\\ux" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/GH-1106-06/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/GH-1106-06/options.json deleted file mode 100644 index 8e0dce66eff8..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/GH-1106-06/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Bad character escape sequence (1:3)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/GH-1106-06/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/GH-1106-06/output.json new file mode 100644 index 000000000000..b24d044db414 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/GH-1106-06/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "errors": [ + "SyntaxError: Bad character escape sequence (1:3)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [], + "directives": [ + { + "type": "Directive", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "value": "\\u00", + "extra": { + "raw": "\"\\u00\"", + "rawValue": "\\u00" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/GH-1106-07/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/GH-1106-07/options.json deleted file mode 100644 index 8e0dce66eff8..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/GH-1106-07/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Bad character escape sequence (1:3)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/GH-1106-07/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/GH-1106-07/output.json new file mode 100644 index 000000000000..eb3f631398dc --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/GH-1106-07/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "errors": [ + "SyntaxError: Bad character escape sequence (1:3)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [], + "directives": [ + { + "type": "Directive", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "value": "\\u000", + "extra": { + "raw": "\"\\u000\"", + "rawValue": "\\u000" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0002/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0002/options.json index 91bb1eef0c0d..ee18527964e7 100644 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0002/options.json +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0002/options.json @@ -1,3 +1,3 @@ { - "throws": "Invalid number (1:0)" + "throws": "Identifier directly after number (1:2)" } diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0004/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0004/options.json deleted file mode 100644 index 91bb1eef0c0d..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0004/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid number (1:0)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0004/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0004/output.json new file mode 100644 index 000000000000..284fac8c4357 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0004/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start": 0, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "errors": [ + "SyntaxError: Invalid number (1:0)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 0, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "extra": { + "rawValue": 3, + "raw": "3e" + }, + "value": 3 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0005/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0005/options.json deleted file mode 100644 index 91bb1eef0c0d..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0005/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid number (1:0)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0005/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0005/output.json new file mode 100644 index 000000000000..6b6e666b00ca --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0005/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "errors": [ + "SyntaxError: Invalid number (1:0)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "extra": { + "rawValue": 3, + "raw": "3e+" + }, + "value": 3 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0006/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0006/options.json deleted file mode 100644 index 91bb1eef0c0d..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0006/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid number (1:0)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0006/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0006/output.json new file mode 100644 index 000000000000..b52b27d1ef37 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0006/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "errors": [ + "SyntaxError: Invalid number (1:0)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "extra": { + "rawValue": 3, + "raw": "3e-" + }, + "value": 3 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0009/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0009/options.json deleted file mode 100644 index 1a0693338eee..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0009/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Expected number in radix 16 (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0009/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0009/output.json new file mode 100644 index 000000000000..ffcb3680fd0b --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0009/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start": 0, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "errors": [ + "SyntaxError: Expected number in radix 16 (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 0, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "extra": { + "rawValue": null, + "raw": "0x" + }, + "value": null + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0012/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0012/options.json deleted file mode 100644 index 3f09c36a5f1c..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0012/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Expected number in radix 8 (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0012/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0012/output.json new file mode 100644 index 000000000000..12a024fb2c03 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0012/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start": 0, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "errors": [ + "SyntaxError: Expected number in radix 8 (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 0, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "extra": { + "rawValue": null, + "raw": "0o" + }, + "value": null + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0013/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0013/options.json deleted file mode 100644 index 3f09c36a5f1c..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0013/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Expected number in radix 8 (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0013/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0013/output.json new file mode 100644 index 000000000000..5d2ed2d91388 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0013/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start": 0, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "errors": [ + "SyntaxError: Expected number in radix 8 (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 0, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "extra": { + "rawValue": null, + "raw": "0O" + }, + "value": null + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0014/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0014/options.json deleted file mode 100644 index 3f09c36a5f1c..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0014/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Expected number in radix 8 (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0014/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0014/output.json new file mode 100644 index 000000000000..4b91f320f950 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0014/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "errors": [ + "SyntaxError: Expected number in radix 8 (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "extra": { + "rawValue": 0, + "raw": "0o9" + }, + "value": 0 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0015/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0015/options.json deleted file mode 100644 index d52d9cfac4bc..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0015/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected token, expected \";\" (1:3)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0015/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0015/output.json new file mode 100644 index 000000000000..9978c5342ef3 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0015/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "errors": [ + "SyntaxError: Expected number in radix 8 (1:3)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "extra": { + "rawValue": 8, + "raw": "0o18" + }, + "value": 8 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0017/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0017/options.json deleted file mode 100644 index 40dc3da9a8f4..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0017/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Expected number in radix 2 (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0017/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0017/output.json new file mode 100644 index 000000000000..0688a297c669 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0017/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start": 0, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "errors": [ + "SyntaxError: Expected number in radix 2 (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 0, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "extra": { + "rawValue": null, + "raw": "0b" + }, + "value": null + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0019/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0019/options.json deleted file mode 100644 index 40dc3da9a8f4..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0019/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Expected number in radix 2 (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0019/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0019/output.json new file mode 100644 index 000000000000..7281fb745a17 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0019/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "errors": [ + "SyntaxError: Expected number in radix 2 (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "extra": { + "rawValue": 0, + "raw": "0b9" + }, + "value": 0 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0020/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0020/options.json deleted file mode 100644 index d52d9cfac4bc..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0020/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected token, expected \";\" (1:3)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0020/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0020/output.json new file mode 100644 index 000000000000..25d711669b8b --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0020/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "errors": [ + "SyntaxError: Expected number in radix 2 (1:3)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "extra": { + "rawValue": 2, + "raw": "0b18" + }, + "value": 2 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0021/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0021/options.json deleted file mode 100644 index d52d9cfac4bc..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0021/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected token, expected \";\" (1:3)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0021/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0021/output.json new file mode 100644 index 000000000000..379e9db894c0 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0021/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "errors": [ + "SyntaxError: Expected number in radix 2 (1:3)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "extra": { + "rawValue": 2, + "raw": "0b12" + }, + "value": 2 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0022/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0022/options.json deleted file mode 100644 index 40dc3da9a8f4..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0022/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Expected number in radix 2 (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0022/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0022/output.json new file mode 100644 index 000000000000..c87719ade97e --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0022/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start": 0, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "errors": [ + "SyntaxError: Expected number in radix 2 (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 0, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "extra": { + "rawValue": null, + "raw": "0B" + }, + "value": null + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0024/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0024/options.json deleted file mode 100644 index 40dc3da9a8f4..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0024/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Expected number in radix 2 (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0024/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0024/output.json new file mode 100644 index 000000000000..e82ab6ace61a --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0024/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "errors": [ + "SyntaxError: Expected number in radix 2 (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "extra": { + "rawValue": 0, + "raw": "0B9" + }, + "value": 0 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0025/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0025/options.json deleted file mode 100644 index d52d9cfac4bc..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0025/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected token, expected \";\" (1:3)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0025/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0025/output.json new file mode 100644 index 000000000000..3726afdc10d4 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0025/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "errors": [ + "SyntaxError: Expected number in radix 2 (1:3)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "extra": { + "rawValue": 2, + "raw": "0B18" + }, + "value": 2 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0026/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0026/options.json deleted file mode 100644 index d52d9cfac4bc..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0026/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected token, expected \";\" (1:3)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0026/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0026/output.json new file mode 100644 index 000000000000..402fcffc9e54 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0026/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "errors": [ + "SyntaxError: Expected number in radix 2 (1:3)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "extra": { + "rawValue": 2, + "raw": "0B12" + }, + "value": 2 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0027/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0027/options.json deleted file mode 100644 index 3f09c36a5f1c..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0027/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Expected number in radix 8 (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0027/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0027/output.json new file mode 100644 index 000000000000..af4105738ef8 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0027/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "errors": [ + "SyntaxError: Expected number in radix 8 (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "extra": { + "rawValue": 0, + "raw": "0O9" + }, + "value": 0 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0028/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0028/options.json deleted file mode 100644 index d52d9cfac4bc..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0028/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected token, expected \";\" (1:3)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0028/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0028/output.json new file mode 100644 index 000000000000..617cc13b6615 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0028/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "errors": [ + "SyntaxError: Expected number in radix 8 (1:3)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "extra": { + "rawValue": 8, + "raw": "0O18" + }, + "value": 8 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0032/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0032/options.json deleted file mode 100644 index 18c53b997b56..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0032/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Expecting Unicode escape sequence \\uXXXX (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0032/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0032/output.json new file mode 100644 index 000000000000..fbb1d3b5d554 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0032/output.json @@ -0,0 +1,70 @@ +{ + "type": "File", + "start": 0, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "errors": [ + "SyntaxError: Expecting Unicode escape sequence \\uXXXX (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "expression": { + "type": "Identifier", + "start": 0, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + }, + "identifierName": "xx\\" + }, + "name": "xx\\" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0033/input.js b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0033/input.js index fff580f2044f..0d9e932087f0 100644 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0033/input.js +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0033/input.js @@ -1 +1 @@ -x\\u005c +x\u005c diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0033/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0033/options.json deleted file mode 100644 index 18c53b997b56..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0033/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Expecting Unicode escape sequence \\uXXXX (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0033/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0033/output.json new file mode 100644 index 000000000000..fae32b78cde4 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0033/output.json @@ -0,0 +1,70 @@ +{ + "type": "File", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "errors": [ + "SyntaxError: Invalid Unicode escape (1:1)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "expression": { + "type": "Identifier", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "x\\" + }, + "name": "x\\" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0034/input.js b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0034/input.js index 17112246786b..2999f29197cd 100644 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0034/input.js +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0034/input.js @@ -1 +1 @@ -x\\u002a +x\u002a diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0034/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0034/options.json deleted file mode 100644 index 18c53b997b56..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0034/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Expecting Unicode escape sequence \\uXXXX (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0034/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0034/output.json new file mode 100644 index 000000000000..37312f42ce97 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0034/output.json @@ -0,0 +1,70 @@ +{ + "type": "File", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "errors": [ + "SyntaxError: Invalid Unicode escape (1:1)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "expression": { + "type": "Identifier", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "x*" + }, + "name": "x*" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0036/input.js b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0036/input.js index 3177052a225a..9cfc5e1cb357 100644 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0036/input.js +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0036/input.js @@ -1 +1 @@ -a\\u +a\u diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0036/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0036/options.json deleted file mode 100644 index 18c53b997b56..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0036/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Expecting Unicode escape sequence \\uXXXX (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0036/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0036/output.json new file mode 100644 index 000000000000..3fa5e0bfd57d --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0036/output.json @@ -0,0 +1,70 @@ +{ + "type": "File", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "errors": [ + "SyntaxError: Bad character escape sequence (1:3)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "expression": { + "type": "Identifier", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + }, + "identifierName": "a" + }, + "name": "a" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0037/input.js b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0037/input.js index d56d7c190d02..fa959cc0ecce 100644 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0037/input.js +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0037/input.js @@ -1 +1 @@ -\\ua +\ua diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0037/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0037/options.json deleted file mode 100644 index 381fd12ce2d0..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0037/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Expecting Unicode escape sequence \\uXXXX (1:1)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0037/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0037/output.json new file mode 100644 index 000000000000..be5c03381dd1 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0037/output.json @@ -0,0 +1,70 @@ +{ + "type": "File", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "errors": [ + "SyntaxError: Bad character escape sequence (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "expression": { + "type": "Identifier", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + }, + "identifierName": "" + }, + "name": "" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0041/input.js b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0041/input.js index 9a2dc1767685..7f54fa707500 100644 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0041/input.js +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0041/input.js @@ -1 +1 @@ -var x = /[a-z]/\\ux +var x = /[a-z]/\ux diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0041/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0041/options.json deleted file mode 100644 index adf556b0a352..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0041/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid regular expression flag (1:16)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0041/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0041/output.json new file mode 100644 index 000000000000..68d637a98170 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0041/output.json @@ -0,0 +1,109 @@ +{ + "type": "File", + "start": 0, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "errors": [ + "SyntaxError: Invalid regular expression flag (1:16)", + "SyntaxError: Invalid regular expression flag (1:18)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 0, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 4, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "id": { + "type": "Identifier", + "start": 4, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + }, + "identifierName": "x" + }, + "name": "x" + }, + "init": { + "type": "RegExpLiteral", + "start": 8, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "extra": { + "raw": "/[a-z]/\\ux" + }, + "pattern": "[a-z]", + "flags": "\\ux" + } + } + ], + "kind": "var" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0042/input.js b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0042/input.js index fdbf86f1d023..e8f66bb867d1 100644 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0042/input.js +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0042/input.js @@ -1 +1 @@ -var x = /[a-z\n]/\\ux +var x = /[a-z\n]/\ux diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0042/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0042/options.json deleted file mode 100644 index eae3757f4451..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0042/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid regular expression flag (1:18)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0042/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0042/output.json new file mode 100644 index 000000000000..c4e889cefe20 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0042/output.json @@ -0,0 +1,109 @@ +{ + "type": "File", + "start": 0, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "errors": [ + "SyntaxError: Invalid regular expression flag (1:18)", + "SyntaxError: Invalid regular expression flag (1:20)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 0, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 4, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "id": { + "type": "Identifier", + "start": 4, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + }, + "identifierName": "x" + }, + "name": "x" + }, + "init": { + "type": "RegExpLiteral", + "start": 8, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "extra": { + "raw": "/[a-z\\n]/\\ux" + }, + "pattern": "[a-z\\n]", + "flags": "\\ux" + } + } + ], + "kind": "var" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0043/input.js b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0043/input.js index e2a2d371e229..9a2dc1767685 100644 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0043/input.js +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0043/input.js @@ -1 +1 @@ -var x = /[a-z]/\\\\ux +var x = /[a-z]/\\ux diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0043/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0043/options.json deleted file mode 100644 index adf556b0a352..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0043/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid regular expression flag (1:16)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0043/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0043/output.json new file mode 100644 index 000000000000..76ef6d90fe84 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0043/output.json @@ -0,0 +1,110 @@ +{ + "type": "File", + "start": 0, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "errors": [ + "SyntaxError: Invalid regular expression flag (1:16)", + "SyntaxError: Invalid regular expression flag (1:17)", + "SyntaxError: Invalid regular expression flag (1:19)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 0, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 4, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "id": { + "type": "Identifier", + "start": 4, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + }, + "identifierName": "x" + }, + "name": "x" + }, + "init": { + "type": "RegExpLiteral", + "start": 8, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "extra": { + "raw": "/[a-z]/\\\\ux" + }, + "pattern": "[a-z]", + "flags": "\\\\ux" + } + } + ], + "kind": "var" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0044/input.js b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0044/input.js index fc48dffd74dc..405b48568aa8 100644 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0044/input.js +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0044/input.js @@ -1 +1 @@ -var x = /[P QR]/\\\\u0067 +var x = /[P QR]/\\u0067 diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0044/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0044/options.json deleted file mode 100644 index 080cb0eaaa8a..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0044/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid regular expression flag (1:17)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0044/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0044/output.json new file mode 100644 index 000000000000..430d18e24eac --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0044/output.json @@ -0,0 +1,113 @@ +{ + "type": "File", + "start": 0, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "errors": [ + "SyntaxError: Invalid regular expression flag (1:17)", + "SyntaxError: Invalid regular expression flag (1:18)", + "SyntaxError: Invalid regular expression flag (1:20)", + "SyntaxError: Invalid regular expression flag (1:21)", + "SyntaxError: Invalid regular expression flag (1:22)", + "SyntaxError: Invalid regular expression flag (1:23)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 0, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 4, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "id": { + "type": "Identifier", + "start": 4, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + }, + "identifierName": "x" + }, + "name": "x" + }, + "init": { + "type": "RegExpLiteral", + "start": 8, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "extra": { + "raw": "/[P QR]/\\\\u0067" + }, + "pattern": "[P QR]", + "flags": "\\\\u0067" + } + } + ], + "kind": "var" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0045/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0045/options.json deleted file mode 100644 index 6010e96ed144..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0045/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid left-hand side in assignment expression (1:0)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0045/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0045/output.json new file mode 100644 index 000000000000..99a3e74a04af --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0045/output.json @@ -0,0 +1,109 @@ +{ + "type": "File", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "errors": [ + "SyntaxError: Invalid left-hand side in assignment expression (1:0)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "operator": "=", + "left": { + "type": "NumericLiteral", + "start": 0, + "end": 1, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + }, + "extra": { + "rawValue": 3, + "raw": "3" + }, + "value": 3 + }, + "right": { + "type": "NumericLiteral", + "start": 4, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "extra": { + "rawValue": 4, + "raw": "4" + }, + "value": 4 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0046/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0046/options.json deleted file mode 100644 index 6010e96ed144..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0046/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid left-hand side in assignment expression (1:0)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0046/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0046/output.json new file mode 100644 index 000000000000..8770df4abba7 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0046/output.json @@ -0,0 +1,122 @@ +{ + "type": "File", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "errors": [ + "SyntaxError: Invalid left-hand side in assignment expression (1:0)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "operator": "=", + "left": { + "type": "CallExpression", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "callee": { + "type": "Identifier", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + }, + "identifierName": "func" + }, + "name": "func" + }, + "arguments": [] + }, + "right": { + "type": "NumericLiteral", + "start": 9, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "extra": { + "rawValue": 4, + "raw": "4" + }, + "value": 4 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0047/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0047/options.json deleted file mode 100644 index 7c5f08eb9ba6..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0047/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid left-hand side in assignment expression (1:1)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0047/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0047/output.json new file mode 100644 index 000000000000..ec3792255a15 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0047/output.json @@ -0,0 +1,150 @@ +{ + "type": "File", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "errors": [ + "SyntaxError: Invalid parenthesized assignment pattern (1:1)", + "SyntaxError: Invalid left-hand side in assignment expression (1:1)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "operator": "=", + "left": { + "type": "BinaryExpression", + "start": 1, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "left": { + "type": "NumericLiteral", + "start": 1, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + }, + "operator": "+", + "right": { + "type": "NumericLiteral", + "start": 5, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + }, + "extra": { + "parenthesized": true, + "parenStart": 0 + } + }, + "right": { + "type": "NumericLiteral", + "start": 10, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "extra": { + "rawValue": 10, + "raw": "10" + }, + "value": 10 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0048/input.js b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0048/input.js index 2bbf7ac4d47c..1d1226dada02 100644 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0048/input.js +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0048/input.js @@ -1 +1 @@ -\\u{110000} +\u{110000} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0048/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0048/options.json index 381fd12ce2d0..0cefc1094055 100644 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0048/options.json +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0048/options.json @@ -1,3 +1,3 @@ { - "throws": "Expecting Unicode escape sequence \\uXXXX (1:1)" + "throws": "Invalid code point 1114112" } diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0049/input.js b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0049/input.js index 9943cc7906a5..aabe8d74272e 100644 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0049/input.js +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0049/input.js @@ -1 +1 @@ -\\u{} +\u{} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0049/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0049/options.json deleted file mode 100644 index 381fd12ce2d0..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0049/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Expecting Unicode escape sequence \\uXXXX (1:1)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0049/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0049/output.json new file mode 100644 index 000000000000..9d206b4f8475 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0049/output.json @@ -0,0 +1,70 @@ +{ + "type": "File", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "errors": [ + "SyntaxError: Bad character escape sequence (1:3)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "expression": { + "type": "Identifier", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + }, + "identifierName": "" + }, + "name": "" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0050/input.js b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0050/input.js index 5d4f24cb8271..170edba55da6 100644 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0050/input.js +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0050/input.js @@ -1 +1 @@ -\\u{FFFF +\u{FFFF diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0050/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0050/options.json deleted file mode 100644 index 381fd12ce2d0..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0050/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Expecting Unicode escape sequence \\uXXXX (1:1)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0050/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0050/output.json new file mode 100644 index 000000000000..252665de0e5e --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0050/output.json @@ -0,0 +1,70 @@ +{ + "type": "File", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "errors": [ + "SyntaxError: Bad character escape sequence (1:3)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "expression": { + "type": "Identifier", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "FFF" + }, + "name": "FFF" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0051/input.js b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0051/input.js index 11e05c81c1e8..0c65088d077b 100644 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0051/input.js +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0051/input.js @@ -1 +1 @@ -\\u{FFZ} +\u{FFZ} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0051/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0051/options.json deleted file mode 100644 index 381fd12ce2d0..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0051/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Expecting Unicode escape sequence \\uXXXX (1:1)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0051/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0051/output.json new file mode 100644 index 000000000000..2c27554ffa56 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0051/output.json @@ -0,0 +1,70 @@ +{ + "type": "File", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "errors": [ + "SyntaxError: Bad character escape sequence (1:3)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "expression": { + "type": "Identifier", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "" + }, + "name": "" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0052/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0052/options.json deleted file mode 100644 index c09dac1301de..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0052/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid left-hand side in postfix operation (1:0)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0052/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0052/output.json new file mode 100644 index 000000000000..ce2cb3d23d67 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0052/output.json @@ -0,0 +1,90 @@ +{ + "type": "File", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "errors": [ + "SyntaxError: Invalid left-hand side in postfix operation (1:0)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "expression": { + "type": "UpdateExpression", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "operator": "++", + "prefix": false, + "argument": { + "type": "NumericLiteral", + "start": 0, + "end": 1, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0053/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0053/options.json deleted file mode 100644 index c09dac1301de..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0053/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid left-hand side in postfix operation (1:0)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0053/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0053/output.json new file mode 100644 index 000000000000..57d55fec0b5d --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0053/output.json @@ -0,0 +1,90 @@ +{ + "type": "File", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "errors": [ + "SyntaxError: Invalid left-hand side in postfix operation (1:0)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "expression": { + "type": "UpdateExpression", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "operator": "--", + "prefix": false, + "argument": { + "type": "NumericLiteral", + "start": 0, + "end": 1, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0054/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0054/options.json deleted file mode 100644 index 515e441e8ea7..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0054/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid left-hand side in prefix operation (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0054/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0054/output.json new file mode 100644 index 000000000000..9a7a240c5b4a --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0054/output.json @@ -0,0 +1,90 @@ +{ + "type": "File", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "errors": [ + "SyntaxError: Invalid left-hand side in prefix operation (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "expression": { + "type": "UpdateExpression", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "operator": "++", + "prefix": true, + "argument": { + "type": "NumericLiteral", + "start": 2, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0055/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0055/options.json deleted file mode 100644 index 515e441e8ea7..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0055/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid left-hand side in prefix operation (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0055/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0055/output.json new file mode 100644 index 000000000000..85107220dae5 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0055/output.json @@ -0,0 +1,90 @@ +{ + "type": "File", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "errors": [ + "SyntaxError: Invalid left-hand side in prefix operation (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "expression": { + "type": "UpdateExpression", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "operator": "--", + "prefix": true, + "argument": { + "type": "NumericLiteral", + "start": 2, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0056/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0056/options.json deleted file mode 100644 index f8560a7de9d6..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0056/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid left-hand side in for-in statement (1:5)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0056/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0056/output.json new file mode 100644 index 000000000000..6cbd0876600e --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0056/output.json @@ -0,0 +1,197 @@ +{ + "type": "File", + "start": 0, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "errors": [ + "SyntaxError: Invalid parenthesized assignment pattern (1:5)", + "SyntaxError: Invalid left-hand side in for-in statement (1:5)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ForInStatement", + "start": 0, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "left": { + "type": "BinaryExpression", + "start": 5, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "left": { + "type": "NumericLiteral", + "start": 5, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + }, + "operator": "+", + "right": { + "type": "NumericLiteral", + "start": 9, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + }, + "extra": { + "parenthesized": true, + "parenStart": 4 + } + }, + "right": { + "type": "Identifier", + "start": 15, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 19 + }, + "identifierName": "list" + }, + "name": "list" + }, + "body": { + "type": "ExpressionStatement", + "start": 21, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "expression": { + "type": "CallExpression", + "start": 21, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "callee": { + "type": "Identifier", + "start": 21, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 28 + }, + "identifierName": "process" + }, + "name": "process" + }, + "arguments": [ + { + "type": "Identifier", + "start": 29, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 30 + }, + "identifierName": "x" + }, + "name": "x" + } + ] + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0064/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0064/options.json deleted file mode 100644 index 2b91be8d5115..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0064/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected keyword 'if' (1:4)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0064/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0064/output.json new file mode 100644 index 000000000000..ac910291b748 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0064/output.json @@ -0,0 +1,108 @@ +{ + "type": "File", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "errors": [ + "SyntaxError: Unexpected keyword 'if' (1:4)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 4, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "id": { + "type": "Identifier", + "start": 4, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 6 + }, + "identifierName": "if" + }, + "name": "if" + }, + "init": { + "type": "NumericLiteral", + "start": 9, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "extra": { + "rawValue": 42, + "raw": "42" + }, + "value": 42 + } + } + ], + "kind": "var" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0066/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0066/options.json deleted file mode 100644 index 6010e96ed144..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0066/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid left-hand side in assignment expression (1:0)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0066/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0066/output.json new file mode 100644 index 000000000000..56547ff7be13 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0066/output.json @@ -0,0 +1,142 @@ +{ + "type": "File", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "errors": [ + "SyntaxError: Invalid left-hand side in assignment expression (1:0)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "operator": "=", + "left": { + "type": "BinaryExpression", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "left": { + "type": "Identifier", + "start": 0, + "end": 1, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + }, + "identifierName": "i" + }, + "name": "i" + }, + "operator": "+", + "right": { + "type": "NumericLiteral", + "start": 4, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "extra": { + "rawValue": 2, + "raw": "2" + }, + "value": 2 + } + }, + "right": { + "type": "NumericLiteral", + "start": 8, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "extra": { + "rawValue": 42, + "raw": "42" + }, + "value": 42 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0067/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0067/options.json deleted file mode 100644 index 6010e96ed144..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0067/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid left-hand side in assignment expression (1:0)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0067/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0067/output.json new file mode 100644 index 000000000000..ece139488ea0 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0067/output.json @@ -0,0 +1,123 @@ +{ + "type": "File", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "errors": [ + "SyntaxError: Invalid left-hand side in assignment expression (1:0)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "operator": "=", + "left": { + "type": "UnaryExpression", + "start": 0, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "operator": "+", + "prefix": true, + "argument": { + "type": "Identifier", + "start": 1, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + }, + "identifierName": "i" + }, + "name": "i" + } + }, + "right": { + "type": "NumericLiteral", + "start": 5, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "extra": { + "rawValue": 42, + "raw": "42" + }, + "value": 42 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0075/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0075/options.json index aa55ec4f840f..070d941a7562 100644 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0075/options.json +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0075/options.json @@ -1,3 +1,3 @@ { - "throws": "setter must have exactly one formal parameter (1:3)" + "plugins": ["estree"] } diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0075/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0075/output.json new file mode 100644 index 000000000000..b0ad15758245 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0075/output.json @@ -0,0 +1,145 @@ +{ + "type": "File", + "start": 0, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "errors": [ + "SyntaxError: setter must have exactly one formal parameter (1:3)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "expression": { + "type": "ObjectExpression", + "start": 1, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "properties": [ + { + "type": "Property", + "start": 3, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 7, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + }, + "identifierName": "s" + }, + "name": "s" + }, + "computed": false, + "kind": "set", + "value": { + "type": "FunctionExpression", + "start": 8, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "id": null, + "generator": false, + "async": false, + "expression": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 11, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "body": [] + } + }, + "shorthand": false + } + ], + "extra": { + "parenthesized": true, + "parenStart": 0 + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0087/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0087/options.json deleted file mode 100644 index 02a0eafbbbbe..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0087/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Assigning to 'eval' in strict mode (1:15)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0087/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0087/output.json new file mode 100644 index 000000000000..3731ec6d7b75 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0087/output.json @@ -0,0 +1,182 @@ +{ + "type": "File", + "start": 0, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "errors": [ + "SyntaxError: Assigning to 'eval' in strict mode (1:15)", + "SyntaxError: Binding 'eval' in strict mode (1:15)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 14, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "expression": { + "type": "ArrowFunctionExpression", + "start": 14, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "AssignmentPattern", + "start": 15, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "left": { + "type": "Identifier", + "start": 15, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 19 + }, + "identifierName": "eval" + }, + "name": "eval" + }, + "right": { + "type": "NumericLiteral", + "start": 22, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "extra": { + "rawValue": 10, + "raw": "10" + }, + "value": 10 + } + } + ], + "body": { + "type": "NumericLiteral", + "start": 29, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "extra": { + "rawValue": 42, + "raw": "42" + }, + "value": 42 + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0088/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0088/options.json deleted file mode 100644 index e4abe279ab29..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0088/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'eval' in strict mode (1:14)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0088/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0088/output.json new file mode 100644 index 000000000000..dbffe6547ab5 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0088/output.json @@ -0,0 +1,146 @@ +{ + "type": "File", + "start": 0, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "errors": [ + "SyntaxError: Binding 'eval' in strict mode (1:14)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 14, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "expression": { + "type": "ArrowFunctionExpression", + "start": 14, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 14, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 18 + }, + "identifierName": "eval" + }, + "name": "eval" + } + ], + "body": { + "type": "NumericLiteral", + "start": 22, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "extra": { + "rawValue": 42, + "raw": "42" + }, + "value": 42 + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0089/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0089/options.json deleted file mode 100644 index c2a4aaec255e..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0089/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'arguments' in strict mode (1:14)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0089/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0089/output.json new file mode 100644 index 000000000000..1b3ed15f002e --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0089/output.json @@ -0,0 +1,146 @@ +{ + "type": "File", + "start": 0, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "errors": [ + "SyntaxError: Binding 'arguments' in strict mode (1:14)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 14, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "expression": { + "type": "ArrowFunctionExpression", + "start": 14, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 14, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 23 + }, + "identifierName": "arguments" + }, + "name": "arguments" + } + ], + "body": { + "type": "NumericLiteral", + "start": 27, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "extra": { + "rawValue": 42, + "raw": "42" + }, + "value": 42 + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0090/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0090/options.json deleted file mode 100644 index d93d5b2aa62e..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0090/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'eval' in strict mode (1:15)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0090/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0090/output.json new file mode 100644 index 000000000000..6b7ae83c0ad2 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0090/output.json @@ -0,0 +1,163 @@ +{ + "type": "File", + "start": 0, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "errors": [ + "SyntaxError: Binding 'eval' in strict mode (1:15)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 14, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "expression": { + "type": "ArrowFunctionExpression", + "start": 14, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 15, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 19 + }, + "identifierName": "eval" + }, + "name": "eval" + }, + { + "type": "Identifier", + "start": 21, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + }, + "identifierName": "a" + }, + "name": "a" + } + ], + "body": { + "type": "NumericLiteral", + "start": 27, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "extra": { + "rawValue": 42, + "raw": "42" + }, + "value": 42 + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0091/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0091/options.json deleted file mode 100644 index 5d2dc563b16e..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0091/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'arguments' in strict mode (1:15)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0091/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0091/output.json new file mode 100644 index 000000000000..c681755fb108 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0091/output.json @@ -0,0 +1,163 @@ +{ + "type": "File", + "start": 0, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "errors": [ + "SyntaxError: Binding 'arguments' in strict mode (1:15)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 14, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "expression": { + "type": "ArrowFunctionExpression", + "start": 14, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 15, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 24 + }, + "identifierName": "arguments" + }, + "name": "arguments" + }, + { + "type": "Identifier", + "start": 26, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 27 + }, + "identifierName": "a" + }, + "name": "a" + } + ], + "body": { + "type": "NumericLiteral", + "start": 32, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "extra": { + "rawValue": 42, + "raw": "42" + }, + "value": 42 + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0092/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0092/options.json deleted file mode 100644 index 368006ae58bd..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0092/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Argument name clash (1:4)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0092/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0092/output.json new file mode 100644 index 000000000000..78da40f6d8c7 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0092/output.json @@ -0,0 +1,127 @@ +{ + "type": "File", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "errors": [ + "SyntaxError: Argument name clash (1:4)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "expression": { + "type": "ArrowFunctionExpression", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 1, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + }, + "identifierName": "a" + }, + "name": "a" + }, + { + "type": "Identifier", + "start": 4, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + }, + "identifierName": "a" + }, + "name": "a" + } + ], + "body": { + "type": "NumericLiteral", + "start": 10, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "extra": { + "rawValue": 42, + "raw": "42" + }, + "value": 42 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0093/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0093/options.json deleted file mode 100644 index b99fd35222b1..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0093/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Argument name clash (1:18)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0093/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0093/output.json new file mode 100644 index 000000000000..3a5f60bdddea --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0093/output.json @@ -0,0 +1,163 @@ +{ + "type": "File", + "start": 0, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "errors": [ + "SyntaxError: Argument name clash (1:18)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 14, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "expression": { + "type": "ArrowFunctionExpression", + "start": 14, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 15, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + }, + "identifierName": "a" + }, + "name": "a" + }, + { + "type": "Identifier", + "start": 18, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + }, + "identifierName": "a" + }, + "name": "a" + } + ], + "body": { + "type": "NumericLiteral", + "start": 24, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "extra": { + "rawValue": 42, + "raw": "42" + }, + "value": 42 + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0094/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0094/options.json deleted file mode 100644 index 79a05e62290e..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0094/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Legacy octal literals are not allowed in strict mode (1:21)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0094/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0094/output.json new file mode 100644 index 000000000000..18c0889f74b8 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0094/output.json @@ -0,0 +1,146 @@ +{ + "type": "File", + "start": 0, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "errors": [ + "SyntaxError: Legacy octal literals are not allowed in strict mode (1:21)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 14, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "expression": { + "type": "ArrowFunctionExpression", + "start": 14, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 15, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + }, + "identifierName": "a" + }, + "name": "a" + } + ], + "body": { + "type": "NumericLiteral", + "start": 21, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "extra": { + "rawValue": 0, + "raw": "00" + }, + "value": 0 + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0098/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0098/options.json deleted file mode 100644 index 99ffc0de0153..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0098/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid left-hand side in arrow function parameters (1:1)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0098/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0098/output.json new file mode 100644 index 000000000000..a7c444dfbcdc --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0098/output.json @@ -0,0 +1,113 @@ +{ + "type": "File", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "errors": [ + "SyntaxError: Binding invalid left-hand side in function parameter list (1:1)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "expression": { + "type": "ArrowFunctionExpression", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "NumericLiteral", + "start": 1, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "extra": { + "rawValue": 10, + "raw": "10" + }, + "value": 10 + } + ], + "body": { + "type": "NumericLiteral", + "start": 8, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "extra": { + "rawValue": 0, + "raw": "00" + }, + "value": 0 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0099/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0099/options.json deleted file mode 100644 index 99ffc0de0153..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0099/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid left-hand side in arrow function parameters (1:1)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0099/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0099/output.json new file mode 100644 index 000000000000..2d80f047d283 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0099/output.json @@ -0,0 +1,134 @@ +{ + "type": "File", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "errors": [ + "SyntaxError: Binding invalid left-hand side in function parameter list (1:1)", + "SyntaxError: Binding invalid left-hand side in function parameter list (1:5)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "expression": { + "type": "ArrowFunctionExpression", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "NumericLiteral", + "start": 1, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "extra": { + "rawValue": 10, + "raw": "10" + }, + "value": 10 + }, + { + "type": "NumericLiteral", + "start": 5, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "extra": { + "rawValue": 20, + "raw": "20" + }, + "value": 20 + } + ], + "body": { + "type": "NumericLiteral", + "start": 12, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "extra": { + "rawValue": 0, + "raw": "00" + }, + "value": 0 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0100/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0100/options.json deleted file mode 100644 index d93d5b2aa62e..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0100/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'eval' in strict mode (1:15)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0100/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0100/output.json new file mode 100644 index 000000000000..49e0835c1bfc --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0100/output.json @@ -0,0 +1,146 @@ +{ + "type": "File", + "start": 0, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "errors": [ + "SyntaxError: Binding 'eval' in strict mode (1:15)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 14, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "expression": { + "type": "ArrowFunctionExpression", + "start": 14, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 15, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 19 + }, + "identifierName": "eval" + }, + "name": "eval" + } + ], + "body": { + "type": "NumericLiteral", + "start": 24, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "extra": { + "rawValue": 42, + "raw": "42" + }, + "value": 42 + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0101/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0101/options.json deleted file mode 100644 index 224716db8070..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0101/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'eval' in strict mode (1:1)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0101/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0101/output.json new file mode 100644 index 000000000000..85866aeddd23 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0101/output.json @@ -0,0 +1,179 @@ +{ + "type": "File", + "start": 0, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "errors": [ + "SyntaxError: Binding 'eval' in strict mode (1:1)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "expression": { + "type": "ArrowFunctionExpression", + "start": 0, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 1, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 5 + }, + "identifierName": "eval" + }, + "name": "eval" + } + ], + "body": { + "type": "BlockStatement", + "start": 10, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 26, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 26, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "extra": { + "rawValue": 42, + "raw": "42" + }, + "value": 42 + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 12, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 12, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0116/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0116/options.json deleted file mode 100644 index 701f9fe8f27a..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0116/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unsyntactic break (1:0)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0116/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0116/output.json new file mode 100644 index 000000000000..d3a105c584dd --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0116/output.json @@ -0,0 +1,54 @@ +{ + "type": "File", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "errors": [ + "SyntaxError: Unsyntactic break (1:0)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "BreakStatement", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "label": null + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0118/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0118/options.json deleted file mode 100644 index de66853a7a3d..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0118/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unsyntactic continue (1:0)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0118/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0118/output.json new file mode 100644 index 000000000000..c32c5b089115 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0118/output.json @@ -0,0 +1,54 @@ +{ + "type": "File", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "errors": [ + "SyntaxError: Unsyntactic continue (1:0)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ContinueStatement", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "label": null + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0125/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0125/options.json deleted file mode 100644 index f8560a7de9d6..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0125/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid left-hand side in for-in statement (1:5)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0125/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0125/output.json new file mode 100644 index 000000000000..3844a4d151a7 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0125/output.json @@ -0,0 +1,137 @@ +{ + "type": "File", + "start": 0, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "errors": [ + "SyntaxError: Invalid left-hand side in for-in statement (1:5)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ForInStatement", + "start": 0, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "left": { + "type": "BinaryExpression", + "start": 5, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "left": { + "type": "Identifier", + "start": 5, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + }, + "identifierName": "i" + }, + "name": "i" + }, + "operator": "+", + "right": { + "type": "NumericLiteral", + "start": 9, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + }, + "right": { + "type": "ObjectExpression", + "start": 14, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "properties": [] + }, + "body": { + "type": "EmptyStatement", + "start": 17, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0126/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0126/options.json deleted file mode 100644 index f8560a7de9d6..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0126/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid left-hand side in for-in statement (1:5)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0126/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0126/output.json new file mode 100644 index 000000000000..9d008175f644 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0126/output.json @@ -0,0 +1,118 @@ +{ + "type": "File", + "start": 0, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "errors": [ + "SyntaxError: Invalid left-hand side in for-in statement (1:5)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ForInStatement", + "start": 0, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "left": { + "type": "UnaryExpression", + "start": 5, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "operator": "+", + "prefix": true, + "argument": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "i" + }, + "name": "i" + } + }, + "right": { + "type": "ObjectExpression", + "start": 11, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "properties": [] + }, + "body": { + "type": "EmptyStatement", + "start": 14, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0133/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0133/options.json deleted file mode 100644 index 429d96ca3f9a..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0133/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Missing catch or finally clause (1:0)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0133/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0133/output.json new file mode 100644 index 000000000000..3d2ee0555b85 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0133/output.json @@ -0,0 +1,72 @@ +{ + "type": "File", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "errors": [ + "SyntaxError: Missing catch or finally clause (1:0)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "TryStatement", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "block": { + "type": "BlockStatement", + "start": 4, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "body": [], + "directives": [] + }, + "handler": null, + "finalizer": null + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0137/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0137/options.json deleted file mode 100644 index 82bcfe621c49..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0137/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid Unicode escape (1:0)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0137/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0137/output.json new file mode 100644 index 000000000000..237da8c03a78 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0137/output.json @@ -0,0 +1,106 @@ +{ + "type": "File", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "errors": [ + "SyntaxError: Invalid Unicode escape (1:0)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "operator": "=", + "left": { + "type": "Identifier", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + }, + "identifierName": "‿" + }, + "name": "‿" + }, + "right": { + "type": "NumericLiteral", + "start": 9, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "extra": { + "rawValue": 10, + "raw": "10" + }, + "value": 10 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0142/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0142/options.json deleted file mode 100644 index 97818d2eea7e..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0142/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Lexical declaration cannot appear in a single-statement context (1:9)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0142/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0142/output.json new file mode 100644 index 000000000000..c273b86361e0 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0142/output.json @@ -0,0 +1,140 @@ +{ + "type": "File", + "start": 0, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "errors": [ + "SyntaxError: Lexical declaration cannot appear in a single-statement context (1:9)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "IfStatement", + "start": 0, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "test": { + "type": "BooleanLiteral", + "start": 3, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "value": true + }, + "consequent": { + "type": "VariableDeclaration", + "start": 9, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 15, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "id": { + "type": "Identifier", + "start": 15, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + }, + "identifierName": "a" + }, + "name": "a" + }, + "init": { + "type": "NumericLiteral", + "start": 19, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + ], + "kind": "const" + }, + "alternate": null + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0143/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0143/options.json deleted file mode 100644 index aadfa63716c2..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0143/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Multiple default clauses (1:22)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0143/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0143/output.json new file mode 100644 index 000000000000..c90c4eefdc6f --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0143/output.json @@ -0,0 +1,106 @@ +{ + "type": "File", + "start": 0, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "errors": [ + "SyntaxError: Multiple default clauses (1:22)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "SwitchStatement", + "start": 0, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "discriminant": { + "type": "Identifier", + "start": 8, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + }, + "identifierName": "c" + }, + "name": "c" + }, + "cases": [ + { + "type": "SwitchCase", + "start": 13, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "consequent": [], + "test": null + }, + { + "type": "SwitchCase", + "start": 22, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "consequent": [], + "test": null + } + ] + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0162/input.js b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0162/input.js index adcf3cef4357..57ddad2aec5d 100644 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0162/input.js +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0162/input.js @@ -1 +1 @@ -\\ +\ diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0162/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0162/options.json deleted file mode 100644 index 381fd12ce2d0..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0162/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Expecting Unicode escape sequence \\uXXXX (1:1)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0162/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0162/output.json new file mode 100644 index 000000000000..8644ccf99c0e --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0162/output.json @@ -0,0 +1,70 @@ +{ + "type": "File", + "start": 0, + "end": 1, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Expecting Unicode escape sequence \\uXXXX (1:1)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 1, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 1, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + }, + "expression": { + "type": "Identifier", + "start": 0, + "end": 1, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + }, + "identifierName": "\\" + }, + "name": "\\" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0163/input.js b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0163/input.js index b9e12b2eff54..65bd7cf67b3f 100644 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0163/input.js +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0163/input.js @@ -1 +1 @@ -\\u005c +\u005c diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0163/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0163/options.json deleted file mode 100644 index 381fd12ce2d0..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0163/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Expecting Unicode escape sequence \\uXXXX (1:1)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0163/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0163/output.json new file mode 100644 index 000000000000..d44909ca998a --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0163/output.json @@ -0,0 +1,70 @@ +{ + "type": "File", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "errors": [ + "SyntaxError: Invalid Unicode escape (1:0)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "expression": { + "type": "Identifier", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + }, + "identifierName": "\\" + }, + "name": "\\" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0164/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0164/options.json deleted file mode 100644 index 381fd12ce2d0..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0164/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Expecting Unicode escape sequence \\uXXXX (1:1)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0164/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0164/output.json new file mode 100644 index 000000000000..38cc0c05b021 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0164/output.json @@ -0,0 +1,70 @@ +{ + "type": "File", + "start": 0, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "errors": [ + "SyntaxError: Expecting Unicode escape sequence \\uXXXX (1:1)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "expression": { + "type": "Identifier", + "start": 0, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + }, + "identifierName": "\\x" + }, + "name": "\\x" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0165/input.js b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0165/input.js index a6e819ccd18b..ecb0a859c956 100644 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0165/input.js +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0165/input.js @@ -1 +1 @@ -\\u0000 +\u0000 diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0165/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0165/options.json deleted file mode 100644 index 381fd12ce2d0..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0165/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Expecting Unicode escape sequence \\uXXXX (1:1)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0165/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0165/output.json new file mode 100644 index 000000000000..380e6ec698ef --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0165/output.json @@ -0,0 +1,70 @@ +{ + "type": "File", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "errors": [ + "SyntaxError: Invalid Unicode escape (1:0)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "expression": { + "type": "Identifier", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + }, + "identifierName": "\u0000" + }, + "name": "\u0000" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0166/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0166/options.json deleted file mode 100644 index 82bcfe621c49..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0166/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid Unicode escape (1:0)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0166/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0166/output.json new file mode 100644 index 000000000000..d528d79e32d4 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0166/output.json @@ -0,0 +1,102 @@ +{ + "type": "File", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "errors": [ + "SyntaxError: Invalid Unicode escape (1:0)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "operator": "=", + "left": { + "type": "Identifier", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + }, + "identifierName": "‌" + }, + "name": "‌" + }, + "right": { + "type": "ArrayExpression", + "start": 9, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "elements": [] + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0167/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0167/options.json deleted file mode 100644 index 82bcfe621c49..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0167/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid Unicode escape (1:0)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0167/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0167/output.json new file mode 100644 index 000000000000..91544094b698 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0167/output.json @@ -0,0 +1,102 @@ +{ + "type": "File", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "errors": [ + "SyntaxError: Invalid Unicode escape (1:0)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "operator": "=", + "left": { + "type": "Identifier", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + }, + "identifierName": "‍" + }, + "name": "‍" + }, + "right": { + "type": "ArrayExpression", + "start": 9, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "elements": [] + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0169/input.js b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0169/input.js index 2775e915bb92..1ef32f79a66e 100644 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0169/input.js +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0169/input.js @@ -1 +1 @@ -"\\u +"\u diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0171/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0171/options.json deleted file mode 100644 index f9d29c7f328c..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0171/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "'return' outside of function (1:0)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0171/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0171/output.json new file mode 100644 index 000000000000..e43da2374537 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0171/output.json @@ -0,0 +1,54 @@ +{ + "type": "File", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "errors": [ + "SyntaxError: 'return' outside of function (1:0)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ReturnStatement", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "argument": null + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0172/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0172/options.json deleted file mode 100644 index 701f9fe8f27a..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0172/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unsyntactic break (1:0)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0172/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0172/output.json new file mode 100644 index 000000000000..d3a105c584dd --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0172/output.json @@ -0,0 +1,54 @@ +{ + "type": "File", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "errors": [ + "SyntaxError: Unsyntactic break (1:0)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "BreakStatement", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "label": null + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0173/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0173/options.json deleted file mode 100644 index de66853a7a3d..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0173/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unsyntactic continue (1:0)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0173/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0173/output.json new file mode 100644 index 000000000000..c32c5b089115 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0173/output.json @@ -0,0 +1,54 @@ +{ + "type": "File", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "errors": [ + "SyntaxError: Unsyntactic continue (1:0)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ContinueStatement", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "label": null + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0174/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0174/options.json deleted file mode 100644 index c726e8fa98e4..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0174/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unsyntactic continue (1:22)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0174/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0174/output.json new file mode 100644 index 000000000000..b83145faf5ab --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0174/output.json @@ -0,0 +1,106 @@ +{ + "type": "File", + "start": 0, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "errors": [ + "SyntaxError: Unsyntactic continue (1:22)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "SwitchStatement", + "start": 0, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "discriminant": { + "type": "Identifier", + "start": 8, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + }, + "identifierName": "x" + }, + "name": "x" + }, + "cases": [ + { + "type": "SwitchCase", + "start": 13, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "consequent": [ + { + "type": "ContinueStatement", + "start": 22, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "label": null + } + ], + "test": null + } + ] + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0176/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0176/options.json deleted file mode 100644 index 070e662e80d4..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0176/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unsyntactic break (1:15)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0176/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0176/output.json new file mode 100644 index 000000000000..a7c8d4f9a0ca --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0176/output.json @@ -0,0 +1,119 @@ +{ + "type": "File", + "start": 0, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "errors": [ + "SyntaxError: Unsyntactic break (1:15)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "WhileStatement", + "start": 0, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "test": { + "type": "BooleanLiteral", + "start": 7, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "value": true + }, + "body": { + "type": "BlockStatement", + "start": 13, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "body": [ + { + "type": "BreakStatement", + "start": 15, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "label": { + "type": "Identifier", + "start": 21, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + }, + "identifierName": "x" + }, + "name": "x" + } + } + ], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0177/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0177/options.json deleted file mode 100644 index 2a2e15787aa7..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0177/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unsyntactic continue (1:15)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0177/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0177/output.json new file mode 100644 index 000000000000..2f1c8737b22e --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0177/output.json @@ -0,0 +1,119 @@ +{ + "type": "File", + "start": 0, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "errors": [ + "SyntaxError: Unsyntactic continue (1:15)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "WhileStatement", + "start": 0, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "test": { + "type": "BooleanLiteral", + "start": 7, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "value": true + }, + "body": { + "type": "BlockStatement", + "start": 13, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "body": [ + { + "type": "ContinueStatement", + "start": 15, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "label": { + "type": "Identifier", + "start": 24, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 + }, + "identifierName": "x" + }, + "name": "x" + } + } + ], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0178/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0178/options.json deleted file mode 100644 index 464af80a1561..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0178/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unsyntactic break (1:33)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0178/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0178/output.json new file mode 100644 index 000000000000..7337acd3e8fd --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0178/output.json @@ -0,0 +1,207 @@ +{ + "type": "File", + "start": 0, + "end": 47, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 47 + } + }, + "errors": [ + "SyntaxError: Unsyntactic break (1:33)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 47, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 47 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "LabeledStatement", + "start": 0, + "end": 47, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 47 + } + }, + "body": { + "type": "WhileStatement", + "start": 3, + "end": 47, + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 47 + } + }, + "test": { + "type": "BooleanLiteral", + "start": 10, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "value": true + }, + "body": { + "type": "BlockStatement", + "start": 16, + "end": 47, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 47 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 18, + "end": 45, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 45 + } + }, + "expression": { + "type": "FunctionExpression", + "start": 19, + "end": 43, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 43 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 31, + "end": 43, + "loc": { + "start": { + "line": 1, + "column": 31 + }, + "end": { + "line": 1, + "column": 43 + } + }, + "body": [ + { + "type": "BreakStatement", + "start": 33, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 41 + } + }, + "label": { + "type": "Identifier", + "start": 39, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 39 + }, + "end": { + "line": 1, + "column": 40 + }, + "identifierName": "x" + }, + "name": "x" + } + } + ], + "directives": [] + }, + "extra": { + "parenthesized": true, + "parenStart": 18 + } + } + } + ], + "directives": [] + } + }, + "label": { + "type": "Identifier", + "start": 0, + "end": 1, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + }, + "identifierName": "x" + }, + "name": "x" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0179/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0179/options.json deleted file mode 100644 index a056cb50e190..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0179/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unsyntactic continue (1:33)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0179/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0179/output.json new file mode 100644 index 000000000000..18bc9b977ca7 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0179/output.json @@ -0,0 +1,207 @@ +{ + "type": "File", + "start": 0, + "end": 50, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 50 + } + }, + "errors": [ + "SyntaxError: Unsyntactic continue (1:33)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 50, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 50 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "LabeledStatement", + "start": 0, + "end": 50, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 50 + } + }, + "body": { + "type": "WhileStatement", + "start": 3, + "end": 50, + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 50 + } + }, + "test": { + "type": "BooleanLiteral", + "start": 10, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "value": true + }, + "body": { + "type": "BlockStatement", + "start": 16, + "end": 50, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 50 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 18, + "end": 48, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 48 + } + }, + "expression": { + "type": "FunctionExpression", + "start": 19, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 46 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 31, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 31 + }, + "end": { + "line": 1, + "column": 46 + } + }, + "body": [ + { + "type": "ContinueStatement", + "start": 33, + "end": 44, + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 44 + } + }, + "label": { + "type": "Identifier", + "start": 42, + "end": 43, + "loc": { + "start": { + "line": 1, + "column": 42 + }, + "end": { + "line": 1, + "column": 43 + }, + "identifierName": "x" + }, + "name": "x" + } + } + ], + "directives": [] + }, + "extra": { + "parenthesized": true, + "parenStart": 18 + } + } + } + ], + "directives": [] + } + }, + "label": { + "type": "Identifier", + "start": 0, + "end": 1, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + }, + "identifierName": "x" + }, + "name": "x" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0180/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0180/options.json deleted file mode 100644 index 464af80a1561..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0180/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unsyntactic break (1:33)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0180/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0180/output.json new file mode 100644 index 000000000000..59ae007d6fba --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0180/output.json @@ -0,0 +1,191 @@ +{ + "type": "File", + "start": 0, + "end": 45, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 45 + } + }, + "errors": [ + "SyntaxError: Unsyntactic break (1:33)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 45, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 45 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "LabeledStatement", + "start": 0, + "end": 45, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 45 + } + }, + "body": { + "type": "WhileStatement", + "start": 3, + "end": 45, + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 45 + } + }, + "test": { + "type": "BooleanLiteral", + "start": 10, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "value": true + }, + "body": { + "type": "BlockStatement", + "start": 16, + "end": 45, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 45 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 18, + "end": 43, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 43 + } + }, + "expression": { + "type": "FunctionExpression", + "start": 19, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 41 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 31, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 31 + }, + "end": { + "line": 1, + "column": 41 + } + }, + "body": [ + { + "type": "BreakStatement", + "start": 33, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "label": null + } + ], + "directives": [] + }, + "extra": { + "parenthesized": true, + "parenStart": 18 + } + } + } + ], + "directives": [] + } + }, + "label": { + "type": "Identifier", + "start": 0, + "end": 1, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + }, + "identifierName": "x" + }, + "name": "x" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0181/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0181/options.json deleted file mode 100644 index a056cb50e190..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0181/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unsyntactic continue (1:33)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0181/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0181/output.json new file mode 100644 index 000000000000..d26e37b08031 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0181/output.json @@ -0,0 +1,191 @@ +{ + "type": "File", + "start": 0, + "end": 48, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 48 + } + }, + "errors": [ + "SyntaxError: Unsyntactic continue (1:33)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 48, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 48 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "LabeledStatement", + "start": 0, + "end": 48, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 48 + } + }, + "body": { + "type": "WhileStatement", + "start": 3, + "end": 48, + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 48 + } + }, + "test": { + "type": "BooleanLiteral", + "start": 10, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "value": true + }, + "body": { + "type": "BlockStatement", + "start": 16, + "end": 48, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 48 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 18, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 46 + } + }, + "expression": { + "type": "FunctionExpression", + "start": 19, + "end": 44, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 44 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 31, + "end": 44, + "loc": { + "start": { + "line": 1, + "column": 31 + }, + "end": { + "line": 1, + "column": 44 + } + }, + "body": [ + { + "type": "ContinueStatement", + "start": 33, + "end": 42, + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 42 + } + }, + "label": null + } + ], + "directives": [] + }, + "extra": { + "parenthesized": true, + "parenStart": 18 + } + } + } + ], + "directives": [] + } + }, + "label": { + "type": "Identifier", + "start": 0, + "end": 1, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + }, + "identifierName": "x" + }, + "name": "x" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0182/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0182/options.json deleted file mode 100644 index da7f2590db0b..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0182/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Label 'x' is already declared (1:18)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0182/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0182/output.json new file mode 100644 index 000000000000..3025d6bfbf72 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0182/output.json @@ -0,0 +1,199 @@ +{ + "type": "File", + "start": 0, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "errors": [ + "SyntaxError: Label 'x' is already declared (1:18)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "LabeledStatement", + "start": 0, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "body": { + "type": "WhileStatement", + "start": 3, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "test": { + "type": "BooleanLiteral", + "start": 10, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "value": true + }, + "body": { + "type": "BlockStatement", + "start": 16, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "body": [ + { + "type": "LabeledStatement", + "start": 18, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "body": { + "type": "WhileStatement", + "start": 21, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "test": { + "type": "BooleanLiteral", + "start": 28, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "value": true + }, + "body": { + "type": "BlockStatement", + "start": 34, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 34 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "body": [], + "directives": [] + } + }, + "label": { + "type": "Identifier", + "start": 18, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + }, + "identifierName": "x" + }, + "name": "x" + } + } + ], + "directives": [] + } + }, + "label": { + "type": "Identifier", + "start": 0, + "end": 1, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + }, + "identifierName": "x" + }, + "name": "x" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0183/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0183/options.json deleted file mode 100644 index 1517e1719333..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0183/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Deleting local variable in strict mode (1:29)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0183/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0183/output.json new file mode 100644 index 000000000000..f22f0efb0609 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0183/output.json @@ -0,0 +1,195 @@ +{ + "type": "File", + "start": 0, + "end": 43, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 43 + } + }, + "errors": [ + "SyntaxError: Deleting local variable in strict mode (1:29)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 43, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 43 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 43, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 43 + } + }, + "expression": { + "type": "CallExpression", + "start": 1, + "end": 42, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 42 + } + }, + "callee": { + "type": "FunctionExpression", + "start": 1, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 40 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 13, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 40 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 29, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 38 + } + }, + "expression": { + "type": "UnaryExpression", + "start": 29, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "operator": "delete", + "prefix": true, + "argument": { + "type": "Identifier", + "start": 36, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 36 + }, + "end": { + "line": 1, + "column": 37 + }, + "identifierName": "i" + }, + "name": "i" + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 15, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 15, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + }, + "arguments": [], + "extra": { + "parenthesized": true, + "parenStart": 0 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0184/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0184/options.json deleted file mode 100644 index 31b4c6d2a040..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0184/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "'with' in strict mode (1:29)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0184/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0184/output.json new file mode 100644 index 000000000000..1567b18881d6 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0184/output.json @@ -0,0 +1,193 @@ +{ + "type": "File", + "start": 0, + "end": 43, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 43 + } + }, + "errors": [ + "SyntaxError: 'with' in strict mode (1:29)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 43, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 43 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 43, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 43 + } + }, + "expression": { + "type": "CallExpression", + "start": 1, + "end": 42, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 42 + } + }, + "callee": { + "type": "FunctionExpression", + "start": 1, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 40 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 13, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 40 + } + }, + "body": [ + { + "type": "WithStatement", + "start": 29, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 38 + } + }, + "object": { + "type": "Identifier", + "start": 35, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 35 + }, + "end": { + "line": 1, + "column": 36 + }, + "identifierName": "i" + }, + "name": "i" + }, + "body": { + "type": "EmptyStatement", + "start": 37, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 38 + } + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 15, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 15, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + }, + "arguments": [], + "extra": { + "parenthesized": true, + "parenStart": 0 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0185/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0185/options.json deleted file mode 100644 index b463f315f9eb..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0185/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'eval' in strict mode (1:36)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0185/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0185/output.json new file mode 100644 index 000000000000..7598b7431e9f --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0185/output.json @@ -0,0 +1,197 @@ +{ + "type": "File", + "start": 0, + "end": 48, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 48 + } + }, + "errors": [ + "SyntaxError: Binding 'eval' in strict mode (1:36)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 48, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 48 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 48, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 48 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "hello" + }, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 48, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 48 + } + }, + "body": [ + { + "type": "VariableDeclaration", + "start": 32, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 46 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 36, + "end": 45, + "loc": { + "start": { + "line": 1, + "column": 36 + }, + "end": { + "line": 1, + "column": 45 + } + }, + "id": { + "type": "Identifier", + "start": 36, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 36 + }, + "end": { + "line": 1, + "column": 40 + }, + "identifierName": "eval" + }, + "name": "eval" + }, + "init": { + "type": "NumericLiteral", + "start": 43, + "end": 45, + "loc": { + "start": { + "line": 1, + "column": 43 + }, + "end": { + "line": 1, + "column": 45 + } + }, + "extra": { + "rawValue": 10, + "raw": "10" + }, + "value": 10 + } + } + ], + "kind": "var" + } + ], + "directives": [ + { + "type": "Directive", + "start": 18, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 18, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0186/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0186/options.json deleted file mode 100644 index 9e9f875dfbb5..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0186/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'arguments' in strict mode (1:36)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0186/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0186/output.json new file mode 100644 index 000000000000..7101109189a2 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0186/output.json @@ -0,0 +1,197 @@ +{ + "type": "File", + "start": 0, + "end": 53, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 53 + } + }, + "errors": [ + "SyntaxError: Binding 'arguments' in strict mode (1:36)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 53, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 53 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 53, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 53 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "hello" + }, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 53, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 53 + } + }, + "body": [ + { + "type": "VariableDeclaration", + "start": 32, + "end": 51, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 51 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 36, + "end": 50, + "loc": { + "start": { + "line": 1, + "column": 36 + }, + "end": { + "line": 1, + "column": 50 + } + }, + "id": { + "type": "Identifier", + "start": 36, + "end": 45, + "loc": { + "start": { + "line": 1, + "column": 36 + }, + "end": { + "line": 1, + "column": 45 + }, + "identifierName": "arguments" + }, + "name": "arguments" + }, + "init": { + "type": "NumericLiteral", + "start": 48, + "end": 50, + "loc": { + "start": { + "line": 1, + "column": 48 + }, + "end": { + "line": 1, + "column": 50 + } + }, + "extra": { + "rawValue": 10, + "raw": "10" + }, + "value": 10 + } + } + ], + "kind": "var" + } + ], + "directives": [ + { + "type": "Directive", + "start": 18, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 18, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0187/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0187/options.json deleted file mode 100644 index b5fd79ff5ff1..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0187/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'eval' in strict mode (1:47)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0187/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0187/output.json new file mode 100644 index 000000000000..dd5fca85f2e5 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0187/output.json @@ -0,0 +1,209 @@ +{ + "type": "File", + "start": 0, + "end": 58, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 58 + } + }, + "errors": [ + "SyntaxError: Binding 'eval' in strict mode (1:47)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 58, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 58 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 58, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 58 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "hello" + }, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 58, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 58 + } + }, + "body": [ + { + "type": "TryStatement", + "start": 32, + "end": 56, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 56 + } + }, + "block": { + "type": "BlockStatement", + "start": 36, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 36 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "body": [], + "directives": [] + }, + "handler": { + "type": "CatchClause", + "start": 40, + "end": 56, + "loc": { + "start": { + "line": 1, + "column": 40 + }, + "end": { + "line": 1, + "column": 56 + } + }, + "param": { + "type": "Identifier", + "start": 47, + "end": 51, + "loc": { + "start": { + "line": 1, + "column": 47 + }, + "end": { + "line": 1, + "column": 51 + }, + "identifierName": "eval" + }, + "name": "eval" + }, + "body": { + "type": "BlockStatement", + "start": 53, + "end": 56, + "loc": { + "start": { + "line": 1, + "column": 53 + }, + "end": { + "line": 1, + "column": 56 + } + }, + "body": [], + "directives": [] + } + }, + "finalizer": null + } + ], + "directives": [ + { + "type": "Directive", + "start": 18, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 18, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0188/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0188/options.json deleted file mode 100644 index 15b7ac855374..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0188/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'arguments' in strict mode (1:47)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0188/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0188/output.json new file mode 100644 index 000000000000..3b89f63424e2 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0188/output.json @@ -0,0 +1,209 @@ +{ + "type": "File", + "start": 0, + "end": 63, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 63 + } + }, + "errors": [ + "SyntaxError: Binding 'arguments' in strict mode (1:47)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 63, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 63 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 63, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 63 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "hello" + }, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 63, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 63 + } + }, + "body": [ + { + "type": "TryStatement", + "start": 32, + "end": 61, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 61 + } + }, + "block": { + "type": "BlockStatement", + "start": 36, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 36 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "body": [], + "directives": [] + }, + "handler": { + "type": "CatchClause", + "start": 40, + "end": 61, + "loc": { + "start": { + "line": 1, + "column": 40 + }, + "end": { + "line": 1, + "column": 61 + } + }, + "param": { + "type": "Identifier", + "start": 47, + "end": 56, + "loc": { + "start": { + "line": 1, + "column": 47 + }, + "end": { + "line": 1, + "column": 56 + }, + "identifierName": "arguments" + }, + "name": "arguments" + }, + "body": { + "type": "BlockStatement", + "start": 58, + "end": 61, + "loc": { + "start": { + "line": 1, + "column": 58 + }, + "end": { + "line": 1, + "column": 61 + } + }, + "body": [], + "directives": [] + } + }, + "finalizer": null + } + ], + "directives": [ + { + "type": "Directive", + "start": 18, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 18, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0189/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0189/options.json deleted file mode 100644 index 95f470aed511..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0189/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Assigning to 'eval' in strict mode (1:32)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0189/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0189/output.json new file mode 100644 index 000000000000..2973f3517639 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0189/output.json @@ -0,0 +1,195 @@ +{ + "type": "File", + "start": 0, + "end": 44, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 44 + } + }, + "errors": [ + "SyntaxError: Assigning to 'eval' in strict mode (1:32)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 44, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 44 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 44, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 44 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "hello" + }, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 44, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 44 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 32, + "end": 42, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 42 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 32, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 41 + } + }, + "operator": "=", + "left": { + "type": "Identifier", + "start": 32, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 36 + }, + "identifierName": "eval" + }, + "name": "eval" + }, + "right": { + "type": "NumericLiteral", + "start": 39, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 39 + }, + "end": { + "line": 1, + "column": 41 + } + }, + "extra": { + "rawValue": 10, + "raw": "10" + }, + "value": 10 + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 18, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 18, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0190/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0190/options.json deleted file mode 100644 index ef45890ab53f..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0190/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Assigning to 'arguments' in strict mode (1:32)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0190/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0190/output.json new file mode 100644 index 000000000000..e328a1e98ef9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0190/output.json @@ -0,0 +1,195 @@ +{ + "type": "File", + "start": 0, + "end": 49, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 49 + } + }, + "errors": [ + "SyntaxError: Assigning to 'arguments' in strict mode (1:32)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 49, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 49 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 49, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 49 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "hello" + }, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 49, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 49 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 32, + "end": 47, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 47 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 32, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 46 + } + }, + "operator": "=", + "left": { + "type": "Identifier", + "start": 32, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 41 + }, + "identifierName": "arguments" + }, + "name": "arguments" + }, + "right": { + "type": "NumericLiteral", + "start": 44, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 44 + }, + "end": { + "line": 1, + "column": 46 + } + }, + "extra": { + "rawValue": 10, + "raw": "10" + }, + "value": 10 + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 18, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 18, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0191/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0191/options.json deleted file mode 100644 index 2783b68b3d58..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0191/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Assigning to 'eval' in strict mode (1:34)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0191/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0191/output.json new file mode 100644 index 000000000000..95091e65367d --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0191/output.json @@ -0,0 +1,176 @@ +{ + "type": "File", + "start": 0, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 41 + } + }, + "errors": [ + "SyntaxError: Assigning to 'eval' in strict mode (1:34)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 41 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 41 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "hello" + }, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 41 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 32, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "expression": { + "type": "UpdateExpression", + "start": 32, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 38 + } + }, + "operator": "++", + "prefix": true, + "argument": { + "type": "Identifier", + "start": 34, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 34 + }, + "end": { + "line": 1, + "column": 38 + }, + "identifierName": "eval" + }, + "name": "eval" + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 18, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 18, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0192/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0192/options.json deleted file mode 100644 index 2783b68b3d58..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0192/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Assigning to 'eval' in strict mode (1:34)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0192/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0192/output.json new file mode 100644 index 000000000000..8473055a411c --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0192/output.json @@ -0,0 +1,176 @@ +{ + "type": "File", + "start": 0, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 41 + } + }, + "errors": [ + "SyntaxError: Assigning to 'eval' in strict mode (1:34)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 41 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 41 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "hello" + }, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 41 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 32, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "expression": { + "type": "UpdateExpression", + "start": 32, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 38 + } + }, + "operator": "--", + "prefix": true, + "argument": { + "type": "Identifier", + "start": 34, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 34 + }, + "end": { + "line": 1, + "column": 38 + }, + "identifierName": "eval" + }, + "name": "eval" + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 18, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 18, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0193/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0193/options.json deleted file mode 100644 index fe2654496fc9..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0193/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Assigning to 'arguments' in strict mode (1:34)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0193/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0193/output.json new file mode 100644 index 000000000000..c9974932443e --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0193/output.json @@ -0,0 +1,176 @@ +{ + "type": "File", + "start": 0, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 46 + } + }, + "errors": [ + "SyntaxError: Assigning to 'arguments' in strict mode (1:34)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 46 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 46 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "hello" + }, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 46 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 32, + "end": 44, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 44 + } + }, + "expression": { + "type": "UpdateExpression", + "start": 32, + "end": 43, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 43 + } + }, + "operator": "++", + "prefix": true, + "argument": { + "type": "Identifier", + "start": 34, + "end": 43, + "loc": { + "start": { + "line": 1, + "column": 34 + }, + "end": { + "line": 1, + "column": 43 + }, + "identifierName": "arguments" + }, + "name": "arguments" + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 18, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 18, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0194/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0194/options.json deleted file mode 100644 index fe2654496fc9..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0194/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Assigning to 'arguments' in strict mode (1:34)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0194/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0194/output.json new file mode 100644 index 000000000000..cf31420c53a0 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0194/output.json @@ -0,0 +1,176 @@ +{ + "type": "File", + "start": 0, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 46 + } + }, + "errors": [ + "SyntaxError: Assigning to 'arguments' in strict mode (1:34)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 46 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 46 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "hello" + }, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 46 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 32, + "end": 44, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 44 + } + }, + "expression": { + "type": "UpdateExpression", + "start": 32, + "end": 43, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 43 + } + }, + "operator": "--", + "prefix": true, + "argument": { + "type": "Identifier", + "start": 34, + "end": 43, + "loc": { + "start": { + "line": 1, + "column": 34 + }, + "end": { + "line": 1, + "column": 43 + }, + "identifierName": "arguments" + }, + "name": "arguments" + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 18, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 18, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0195/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0195/options.json deleted file mode 100644 index 95f470aed511..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0195/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Assigning to 'eval' in strict mode (1:32)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0195/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0195/output.json new file mode 100644 index 000000000000..59618c91e2ca --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0195/output.json @@ -0,0 +1,176 @@ +{ + "type": "File", + "start": 0, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 41 + } + }, + "errors": [ + "SyntaxError: Assigning to 'eval' in strict mode (1:32)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 41 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 41 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "hello" + }, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 41 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 32, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "expression": { + "type": "UpdateExpression", + "start": 32, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 38 + } + }, + "operator": "++", + "prefix": false, + "argument": { + "type": "Identifier", + "start": 32, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 36 + }, + "identifierName": "eval" + }, + "name": "eval" + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 18, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 18, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0196/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0196/options.json deleted file mode 100644 index 95f470aed511..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0196/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Assigning to 'eval' in strict mode (1:32)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0196/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0196/output.json new file mode 100644 index 000000000000..0b6b047c7b58 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0196/output.json @@ -0,0 +1,176 @@ +{ + "type": "File", + "start": 0, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 41 + } + }, + "errors": [ + "SyntaxError: Assigning to 'eval' in strict mode (1:32)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 41 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 41 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "hello" + }, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 41 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 32, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "expression": { + "type": "UpdateExpression", + "start": 32, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 38 + } + }, + "operator": "--", + "prefix": false, + "argument": { + "type": "Identifier", + "start": 32, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 36 + }, + "identifierName": "eval" + }, + "name": "eval" + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 18, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 18, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0197/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0197/options.json deleted file mode 100644 index ef45890ab53f..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0197/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Assigning to 'arguments' in strict mode (1:32)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0197/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0197/output.json new file mode 100644 index 000000000000..64f2c09fd91e --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0197/output.json @@ -0,0 +1,176 @@ +{ + "type": "File", + "start": 0, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 46 + } + }, + "errors": [ + "SyntaxError: Assigning to 'arguments' in strict mode (1:32)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 46 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 46 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "hello" + }, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 46 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 32, + "end": 44, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 44 + } + }, + "expression": { + "type": "UpdateExpression", + "start": 32, + "end": 43, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 43 + } + }, + "operator": "++", + "prefix": false, + "argument": { + "type": "Identifier", + "start": 32, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 41 + }, + "identifierName": "arguments" + }, + "name": "arguments" + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 18, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 18, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0198/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0198/options.json deleted file mode 100644 index ef45890ab53f..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0198/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Assigning to 'arguments' in strict mode (1:32)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0198/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0198/output.json new file mode 100644 index 000000000000..34c1b59c4e79 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0198/output.json @@ -0,0 +1,176 @@ +{ + "type": "File", + "start": 0, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 46 + } + }, + "errors": [ + "SyntaxError: Assigning to 'arguments' in strict mode (1:32)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 46 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 46 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "hello" + }, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 46 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 32, + "end": 44, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 44 + } + }, + "expression": { + "type": "UpdateExpression", + "start": 32, + "end": 43, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 43 + } + }, + "operator": "--", + "prefix": false, + "argument": { + "type": "Identifier", + "start": 32, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 41 + }, + "identifierName": "arguments" + }, + "name": "arguments" + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 18, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 18, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0199/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0199/options.json deleted file mode 100644 index 6db4ae7bf008..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0199/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'eval' in strict mode (1:41)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0199/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0199/output.json new file mode 100644 index 000000000000..35af060b7c6e --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0199/output.json @@ -0,0 +1,179 @@ +{ + "type": "File", + "start": 0, + "end": 53, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 53 + } + }, + "errors": [ + "SyntaxError: Binding 'eval' in strict mode (1:41)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 53, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 53 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 53, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 53 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "hello" + }, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 53, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 53 + } + }, + "body": [ + { + "type": "FunctionDeclaration", + "start": 32, + "end": 51, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 51 + } + }, + "id": { + "type": "Identifier", + "start": 41, + "end": 45, + "loc": { + "start": { + "line": 1, + "column": 41 + }, + "end": { + "line": 1, + "column": 45 + }, + "identifierName": "eval" + }, + "name": "eval" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 48, + "end": 51, + "loc": { + "start": { + "line": 1, + "column": 48 + }, + "end": { + "line": 1, + "column": 51 + } + }, + "body": [], + "directives": [] + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 18, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 18, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0200/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0200/options.json deleted file mode 100644 index b02fb725c767..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0200/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'arguments' in strict mode (1:41)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0200/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0200/output.json new file mode 100644 index 000000000000..7419ba446dc9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0200/output.json @@ -0,0 +1,179 @@ +{ + "type": "File", + "start": 0, + "end": 58, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 58 + } + }, + "errors": [ + "SyntaxError: Binding 'arguments' in strict mode (1:41)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 58, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 58 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 58, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 58 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "hello" + }, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 58, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 58 + } + }, + "body": [ + { + "type": "FunctionDeclaration", + "start": 32, + "end": 56, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 56 + } + }, + "id": { + "type": "Identifier", + "start": 41, + "end": 50, + "loc": { + "start": { + "line": 1, + "column": 41 + }, + "end": { + "line": 1, + "column": 50 + }, + "identifierName": "arguments" + }, + "name": "arguments" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 53, + "end": 56, + "loc": { + "start": { + "line": 1, + "column": 53 + }, + "end": { + "line": 1, + "column": 56 + } + }, + "body": [], + "directives": [] + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 18, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 18, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0201/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0201/options.json deleted file mode 100644 index a7490f9321d4..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0201/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'eval' in strict mode (1:9)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0201/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0201/output.json new file mode 100644 index 000000000000..ede15490b692 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0201/output.json @@ -0,0 +1,126 @@ +{ + "type": "File", + "start": 0, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "errors": [ + "SyntaxError: Binding 'eval' in strict mode (1:9)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 13 + }, + "identifierName": "eval" + }, + "name": "eval" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 16, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "body": [], + "directives": [ + { + "type": "Directive", + "start": 17, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 17, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0202/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0202/options.json deleted file mode 100644 index 80b8b2d85caa..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0202/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'arguments' in strict mode (1:9)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0202/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0202/output.json new file mode 100644 index 000000000000..aeccd1a07ed9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0202/output.json @@ -0,0 +1,126 @@ +{ + "type": "File", + "start": 0, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "errors": [ + "SyntaxError: Binding 'arguments' in strict mode (1:9)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 18 + }, + "identifierName": "arguments" + }, + "name": "arguments" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 21, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "body": [], + "directives": [ + { + "type": "Directive", + "start": 22, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 22, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0203/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0203/options.json deleted file mode 100644 index 706ba8380c70..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0203/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'eval' in strict mode (1:42)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0203/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0203/output.json new file mode 100644 index 000000000000..4e8af9c85d04 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0203/output.json @@ -0,0 +1,214 @@ +{ + "type": "File", + "start": 0, + "end": 57, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 57 + } + }, + "errors": [ + "SyntaxError: Binding 'eval' in strict mode (1:42)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 57, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 57 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 57, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 57 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "hello" + }, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 57, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 57 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 32, + "end": 55, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 55 + } + }, + "expression": { + "type": "CallExpression", + "start": 33, + "end": 54, + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 54 + } + }, + "callee": { + "type": "FunctionExpression", + "start": 33, + "end": 52, + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 52 + } + }, + "id": { + "type": "Identifier", + "start": 42, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 42 + }, + "end": { + "line": 1, + "column": 46 + }, + "identifierName": "eval" + }, + "name": "eval" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 49, + "end": 52, + "loc": { + "start": { + "line": 1, + "column": 49 + }, + "end": { + "line": 1, + "column": 52 + } + }, + "body": [], + "directives": [] + } + }, + "arguments": [], + "extra": { + "parenthesized": true, + "parenStart": 32 + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 18, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 18, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0204/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0204/options.json deleted file mode 100644 index d0e461af3911..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0204/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'arguments' in strict mode (1:42)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0204/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0204/output.json new file mode 100644 index 000000000000..49a2e0086f28 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0204/output.json @@ -0,0 +1,214 @@ +{ + "type": "File", + "start": 0, + "end": 62, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 62 + } + }, + "errors": [ + "SyntaxError: Binding 'arguments' in strict mode (1:42)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 62, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 62 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 62, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 62 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "hello" + }, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 62, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 62 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 32, + "end": 60, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 60 + } + }, + "expression": { + "type": "CallExpression", + "start": 33, + "end": 59, + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 59 + } + }, + "callee": { + "type": "FunctionExpression", + "start": 33, + "end": 57, + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 57 + } + }, + "id": { + "type": "Identifier", + "start": 42, + "end": 51, + "loc": { + "start": { + "line": 1, + "column": 42 + }, + "end": { + "line": 1, + "column": 51 + }, + "identifierName": "arguments" + }, + "name": "arguments" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 54, + "end": 57, + "loc": { + "start": { + "line": 1, + "column": 54 + }, + "end": { + "line": 1, + "column": 57 + } + }, + "body": [], + "directives": [] + } + }, + "arguments": [], + "extra": { + "parenthesized": true, + "parenStart": 32 + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 18, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 18, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0205/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0205/options.json deleted file mode 100644 index ee2e7d7c7745..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0205/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'eval' in strict mode (1:10)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0205/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0205/output.json new file mode 100644 index 000000000000..6d1387258a3e --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0205/output.json @@ -0,0 +1,161 @@ +{ + "type": "File", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "errors": [ + "SyntaxError: Binding 'eval' in strict mode (1:10)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "expression": { + "type": "CallExpression", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "callee": { + "type": "FunctionExpression", + "start": 1, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "id": { + "type": "Identifier", + "start": 10, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "eval" + }, + "name": "eval" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "body": [], + "directives": [ + { + "type": "Directive", + "start": 18, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 18, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + }, + "extra": { + "parenthesized": true, + "parenStart": 0 + } + }, + "arguments": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0206/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0206/options.json deleted file mode 100644 index bb4b812bab32..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0206/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'arguments' in strict mode (1:10)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0206/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0206/output.json new file mode 100644 index 000000000000..d3b5c3628386 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0206/output.json @@ -0,0 +1,161 @@ +{ + "type": "File", + "start": 0, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 41 + } + }, + "errors": [ + "SyntaxError: Binding 'arguments' in strict mode (1:10)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 41 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 41 + } + }, + "expression": { + "type": "CallExpression", + "start": 0, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 41 + } + }, + "callee": { + "type": "FunctionExpression", + "start": 1, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 38 + } + }, + "id": { + "type": "Identifier", + "start": 10, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 19 + }, + "identifierName": "arguments" + }, + "name": "arguments" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 22, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 38 + } + }, + "body": [], + "directives": [ + { + "type": "Directive", + "start": 23, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 23, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + }, + "extra": { + "parenthesized": true, + "parenStart": 0 + } + }, + "arguments": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0207/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0207/options.json deleted file mode 100644 index b5fd79ff5ff1..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0207/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'eval' in strict mode (1:47)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0207/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0207/output.json new file mode 100644 index 000000000000..d0eb8e29b2a1 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0207/output.json @@ -0,0 +1,250 @@ +{ + "type": "File", + "start": 0, + "end": 63, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 63 + } + }, + "errors": [ + "SyntaxError: Binding 'eval' in strict mode (1:47)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 63, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 63 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 63, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 63 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "hello" + }, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 63, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 63 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 32, + "end": 61, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 61 + } + }, + "expression": { + "type": "ObjectExpression", + "start": 33, + "end": 59, + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 59 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 35, + "end": 57, + "loc": { + "start": { + "line": 1, + "column": 35 + }, + "end": { + "line": 1, + "column": 57 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 35, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 35 + }, + "end": { + "line": 1, + "column": 36 + }, + "identifierName": "s" + }, + "name": "s" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "FunctionExpression", + "start": 38, + "end": 57, + "loc": { + "start": { + "line": 1, + "column": 38 + }, + "end": { + "line": 1, + "column": 57 + } + }, + "id": { + "type": "Identifier", + "start": 47, + "end": 51, + "loc": { + "start": { + "line": 1, + "column": 47 + }, + "end": { + "line": 1, + "column": 51 + }, + "identifierName": "eval" + }, + "name": "eval" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 54, + "end": 57, + "loc": { + "start": { + "line": 1, + "column": 54 + }, + "end": { + "line": 1, + "column": 57 + } + }, + "body": [], + "directives": [] + } + } + } + ], + "extra": { + "parenthesized": true, + "parenStart": 32 + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 18, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 18, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0208/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0208/options.json deleted file mode 100644 index ff90f09173c4..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0208/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'package' in strict mode (1:10)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0208/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0208/output.json new file mode 100644 index 000000000000..d6510094936e --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0208/output.json @@ -0,0 +1,161 @@ +{ + "type": "File", + "start": 0, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "errors": [ + "SyntaxError: Binding 'package' in strict mode (1:10)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "expression": { + "type": "CallExpression", + "start": 0, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "callee": { + "type": "FunctionExpression", + "start": 1, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "id": { + "type": "Identifier", + "start": 10, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 17 + }, + "identifierName": "package" + }, + "name": "package" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 20, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "body": [], + "directives": [ + { + "type": "Directive", + "start": 21, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 21, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + }, + "extra": { + "parenthesized": true, + "parenStart": 0 + } + }, + "arguments": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0209/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0209/options.json deleted file mode 100644 index b8f97ca4fe56..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0209/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'eval' in strict mode (1:48)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0209/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0209/output.json new file mode 100644 index 000000000000..98e096877880 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0209/output.json @@ -0,0 +1,292 @@ +{ + "type": "File", + "start": 0, + "end": 63, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 63 + } + }, + "errors": [ + "SyntaxError: Binding 'eval' in strict mode (1:48)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 63, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 63 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 63, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 63 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "hello" + }, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 63, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 63 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 32, + "end": 61, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 61 + } + }, + "expression": { + "type": "ObjectExpression", + "start": 33, + "end": 59, + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 59 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 35, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 35 + }, + "end": { + "line": 1, + "column": 40 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 35, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 35 + }, + "end": { + "line": 1, + "column": 36 + }, + "identifierName": "i" + }, + "name": "i" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "NumericLiteral", + "start": 38, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 38 + }, + "end": { + "line": 1, + "column": 40 + } + }, + "extra": { + "rawValue": 10, + "raw": "10" + }, + "value": 10 + } + }, + { + "type": "ObjectMethod", + "start": 42, + "end": 57, + "loc": { + "start": { + "line": 1, + "column": 42 + }, + "end": { + "line": 1, + "column": 57 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 46, + "end": 47, + "loc": { + "start": { + "line": 1, + "column": 46 + }, + "end": { + "line": 1, + "column": 47 + }, + "identifierName": "s" + }, + "name": "s" + }, + "computed": false, + "kind": "set", + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 48, + "end": 52, + "loc": { + "start": { + "line": 1, + "column": 48 + }, + "end": { + "line": 1, + "column": 52 + }, + "identifierName": "eval" + }, + "name": "eval" + } + ], + "body": { + "type": "BlockStatement", + "start": 54, + "end": 57, + "loc": { + "start": { + "line": 1, + "column": 54 + }, + "end": { + "line": 1, + "column": 57 + } + }, + "body": [], + "directives": [] + } + } + ], + "extra": { + "parenthesized": true, + "parenStart": 32 + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 18, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 18, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0210/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0210/options.json deleted file mode 100644 index 6db4ae7bf008..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0210/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'eval' in strict mode (1:41)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0210/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0210/output.json new file mode 100644 index 000000000000..f974d83f5a98 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0210/output.json @@ -0,0 +1,237 @@ +{ + "type": "File", + "start": 0, + "end": 56, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 56 + } + }, + "errors": [ + "SyntaxError: Binding 'eval' in strict mode (1:41)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 56, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 56 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 56, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 56 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "hello" + }, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 56, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 56 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 32, + "end": 54, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 54 + } + }, + "expression": { + "type": "ObjectExpression", + "start": 33, + "end": 52, + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 52 + } + }, + "properties": [ + { + "type": "ObjectMethod", + "start": 35, + "end": 50, + "loc": { + "start": { + "line": 1, + "column": 35 + }, + "end": { + "line": 1, + "column": 50 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 39, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 39 + }, + "end": { + "line": 1, + "column": 40 + }, + "identifierName": "s" + }, + "name": "s" + }, + "computed": false, + "kind": "set", + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 41, + "end": 45, + "loc": { + "start": { + "line": 1, + "column": 41 + }, + "end": { + "line": 1, + "column": 45 + }, + "identifierName": "eval" + }, + "name": "eval" + } + ], + "body": { + "type": "BlockStatement", + "start": 47, + "end": 50, + "loc": { + "start": { + "line": 1, + "column": 47 + }, + "end": { + "line": 1, + "column": 50 + } + }, + "body": [], + "directives": [] + } + } + ], + "extra": { + "parenthesized": true, + "parenStart": 32 + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 18, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 18, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0211/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0211/options.json deleted file mode 100644 index e80a856d48a0..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0211/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'eval' in strict mode (1:49)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0211/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0211/output.json new file mode 100644 index 000000000000..2993cf648835 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0211/output.json @@ -0,0 +1,268 @@ +{ + "type": "File", + "start": 0, + "end": 64, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 64 + } + }, + "errors": [ + "SyntaxError: Binding 'eval' in strict mode (1:49)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 64, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 64 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 64, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 64 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "hello" + }, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 64, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 64 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 32, + "end": 62, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 62 + } + }, + "expression": { + "type": "ObjectExpression", + "start": 33, + "end": 60, + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 60 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 35, + "end": 58, + "loc": { + "start": { + "line": 1, + "column": 35 + }, + "end": { + "line": 1, + "column": 58 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 35, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 35 + }, + "end": { + "line": 1, + "column": 36 + }, + "identifierName": "s" + }, + "name": "s" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "FunctionExpression", + "start": 38, + "end": 58, + "loc": { + "start": { + "line": 1, + "column": 38 + }, + "end": { + "line": 1, + "column": 58 + } + }, + "id": { + "type": "Identifier", + "start": 47, + "end": 48, + "loc": { + "start": { + "line": 1, + "column": 47 + }, + "end": { + "line": 1, + "column": 48 + }, + "identifierName": "s" + }, + "name": "s" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 49, + "end": 53, + "loc": { + "start": { + "line": 1, + "column": 49 + }, + "end": { + "line": 1, + "column": 53 + }, + "identifierName": "eval" + }, + "name": "eval" + } + ], + "body": { + "type": "BlockStatement", + "start": 55, + "end": 58, + "loc": { + "start": { + "line": 1, + "column": 55 + }, + "end": { + "line": 1, + "column": 58 + } + }, + "body": [], + "directives": [] + } + } + } + ], + "extra": { + "parenthesized": true, + "parenStart": 32 + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 18, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 18, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0212/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0212/options.json deleted file mode 100644 index d93d5b2aa62e..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0212/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'eval' in strict mode (1:15)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0212/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0212/output.json new file mode 100644 index 000000000000..4534376b270a --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0212/output.json @@ -0,0 +1,144 @@ +{ + "type": "File", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "errors": [ + "SyntaxError: Binding 'eval' in strict mode (1:15)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "hello" + }, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 15, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 19 + }, + "identifierName": "eval" + }, + "name": "eval" + } + ], + "body": { + "type": "BlockStatement", + "start": 21, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "body": [], + "directives": [ + { + "type": "Directive", + "start": 22, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 22, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0213/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0213/options.json deleted file mode 100644 index 5d2dc563b16e..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0213/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'arguments' in strict mode (1:15)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0213/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0213/output.json new file mode 100644 index 000000000000..cb41c2783446 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0213/output.json @@ -0,0 +1,144 @@ +{ + "type": "File", + "start": 0, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 41 + } + }, + "errors": [ + "SyntaxError: Binding 'arguments' in strict mode (1:15)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 41 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 41 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "hello" + }, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 15, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 24 + }, + "identifierName": "arguments" + }, + "name": "arguments" + } + ], + "body": { + "type": "BlockStatement", + "start": 26, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 41 + } + }, + "body": [], + "directives": [ + { + "type": "Directive", + "start": 27, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 40 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 27, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0214/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0214/options.json deleted file mode 100644 index b8f97ca4fe56..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0214/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'eval' in strict mode (1:48)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0214/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0214/output.json new file mode 100644 index 000000000000..d8df2c1c2d07 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0214/output.json @@ -0,0 +1,197 @@ +{ + "type": "File", + "start": 0, + "end": 58, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 58 + } + }, + "errors": [ + "SyntaxError: Binding 'eval' in strict mode (1:48)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 58, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 58 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 58, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 58 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "hello" + }, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 58, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 58 + } + }, + "body": [ + { + "type": "FunctionDeclaration", + "start": 33, + "end": 56, + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 56 + } + }, + "id": { + "type": "Identifier", + "start": 42, + "end": 47, + "loc": { + "start": { + "line": 1, + "column": 42 + }, + "end": { + "line": 1, + "column": 47 + }, + "identifierName": "inner" + }, + "name": "inner" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 48, + "end": 52, + "loc": { + "start": { + "line": 1, + "column": 48 + }, + "end": { + "line": 1, + "column": 52 + }, + "identifierName": "eval" + }, + "name": "eval" + } + ], + "body": { + "type": "BlockStatement", + "start": 54, + "end": 56, + "loc": { + "start": { + "line": 1, + "column": 54 + }, + "end": { + "line": 1, + "column": 56 + } + }, + "body": [], + "directives": [] + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 19, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 19, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0215/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0215/options.json deleted file mode 100644 index ab7000409bab..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0215/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'arguments' in strict mode (1:48)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0215/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0215/output.json new file mode 100644 index 000000000000..a2fc6cb4db0e --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0215/output.json @@ -0,0 +1,197 @@ +{ + "type": "File", + "start": 0, + "end": 63, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 63 + } + }, + "errors": [ + "SyntaxError: Binding 'arguments' in strict mode (1:48)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 63, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 63 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 63, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 63 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "hello" + }, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 63, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 63 + } + }, + "body": [ + { + "type": "FunctionDeclaration", + "start": 33, + "end": 61, + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 61 + } + }, + "id": { + "type": "Identifier", + "start": 42, + "end": 47, + "loc": { + "start": { + "line": 1, + "column": 42 + }, + "end": { + "line": 1, + "column": 47 + }, + "identifierName": "inner" + }, + "name": "inner" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 48, + "end": 57, + "loc": { + "start": { + "line": 1, + "column": 48 + }, + "end": { + "line": 1, + "column": 57 + }, + "identifierName": "arguments" + }, + "name": "arguments" + } + ], + "body": { + "type": "BlockStatement", + "start": 59, + "end": 61, + "loc": { + "start": { + "line": 1, + "column": 59 + }, + "end": { + "line": 1, + "column": 61 + } + }, + "body": [], + "directives": [] + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 19, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 19, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0216/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0216/options.json deleted file mode 100644 index 61a5834b639e..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0216/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Octal literal in strict mode (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0216/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0216/output.json new file mode 100644 index 000000000000..48c8fda845ba --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0216/output.json @@ -0,0 +1,108 @@ +{ + "type": "File", + "start": 0, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "errors": [ + "SyntaxError: Octal literal in strict mode (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [], + "directives": [ + { + "type": "Directive", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "value": "\\1", + "extra": { + "raw": "\"\\1\"", + "rawValue": "\\1" + } + } + }, + { + "type": "Directive", + "start": 6, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 6, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0217/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0217/options.json deleted file mode 100644 index ae2bfab55c68..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0217/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Octal literal in strict mode (1:35)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0217/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0217/output.json new file mode 100644 index 000000000000..1504ace4ac5d --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0217/output.json @@ -0,0 +1,162 @@ +{ + "type": "File", + "start": 0, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 40 + } + }, + "errors": [ + "SyntaxError: Octal literal in strict mode (1:35)", + "SyntaxError: Octal literal in strict mode (1:35)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 40 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 40 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "hello" + }, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 40 + } + }, + "body": [], + "directives": [ + { + "type": "Directive", + "start": 19, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 19, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + }, + { + "type": "Directive", + "start": 33, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 38 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 33, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "value": "\\1", + "extra": { + "raw": "\"\\1\"", + "rawValue": "\\1" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0218/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0218/options.json deleted file mode 100644 index 45ca229c1e8e..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0218/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Legacy octal literals are not allowed in strict mode (1:33)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0218/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0218/output.json new file mode 100644 index 000000000000..805c176e7856 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0218/output.json @@ -0,0 +1,163 @@ +{ + "type": "File", + "start": 0, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "errors": [ + "SyntaxError: Legacy octal literals are not allowed in strict mode (1:33)", + "SyntaxError: Legacy octal literals are not allowed in strict mode (1:33)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "hello" + }, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 33, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 33, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "extra": { + "rawValue": 17, + "raw": "021" + }, + "value": 17 + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 19, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 19, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0219/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0219/options.json deleted file mode 100644 index 7e50b5f9165e..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0219/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Octal literal in strict mode (1:38)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0219/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0219/output.json new file mode 100644 index 000000000000..f73cb42cd9cf --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0219/output.json @@ -0,0 +1,221 @@ +{ + "type": "File", + "start": 0, + "end": 50, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 50 + } + }, + "errors": [ + "SyntaxError: Octal literal in strict mode (1:38)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 50, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 50 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 50, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 50 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "hello" + }, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 50, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 50 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 33, + "end": 48, + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 48 + } + }, + "expression": { + "type": "ObjectExpression", + "start": 34, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 34 + }, + "end": { + "line": 1, + "column": 46 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 36, + "end": 44, + "loc": { + "start": { + "line": 1, + "column": 36 + }, + "end": { + "line": 1, + "column": 44 + } + }, + "method": false, + "key": { + "type": "StringLiteral", + "start": 36, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 36 + }, + "end": { + "line": 1, + "column": 40 + } + }, + "extra": { + "rawValue": "\u0001", + "raw": "\"\\1\"" + }, + "value": "\u0001" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "NumericLiteral", + "start": 42, + "end": 44, + "loc": { + "start": { + "line": 1, + "column": 42 + }, + "end": { + "line": 1, + "column": 44 + } + }, + "extra": { + "rawValue": 42, + "raw": "42" + }, + "value": 42 + } + } + ], + "extra": { + "parenthesized": true, + "parenStart": 33 + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 19, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 19, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0220/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0220/options.json deleted file mode 100644 index 8f6c8218f747..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0220/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Legacy octal literals are not allowed in strict mode (1:36)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0220/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0220/output.json new file mode 100644 index 000000000000..5eb3bcef0b18 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0220/output.json @@ -0,0 +1,221 @@ +{ + "type": "File", + "start": 0, + "end": 49, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 49 + } + }, + "errors": [ + "SyntaxError: Legacy octal literals are not allowed in strict mode (1:36)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 49, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 49 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 49, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 49 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "hello" + }, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 49, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 49 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 33, + "end": 47, + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 47 + } + }, + "expression": { + "type": "ObjectExpression", + "start": 34, + "end": 45, + "loc": { + "start": { + "line": 1, + "column": 34 + }, + "end": { + "line": 1, + "column": 45 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 36, + "end": 43, + "loc": { + "start": { + "line": 1, + "column": 36 + }, + "end": { + "line": 1, + "column": 43 + } + }, + "method": false, + "key": { + "type": "NumericLiteral", + "start": 36, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 36 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "extra": { + "rawValue": 17, + "raw": "021" + }, + "value": 17 + }, + "computed": false, + "shorthand": false, + "value": { + "type": "NumericLiteral", + "start": 41, + "end": 43, + "loc": { + "start": { + "line": 1, + "column": 41 + }, + "end": { + "line": 1, + "column": 43 + } + }, + "extra": { + "rawValue": 42, + "raw": "42" + }, + "value": 42 + } + } + ], + "extra": { + "parenthesized": true, + "parenStart": 33 + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 19, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 19, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0221/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0221/options.json deleted file mode 100644 index d094fe0284b1..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0221/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Octal literal in strict mode (1:36)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0221/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0221/output.json new file mode 100644 index 000000000000..374201e48c95 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0221/output.json @@ -0,0 +1,161 @@ +{ + "type": "File", + "start": 0, + "end": 55, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 55 + } + }, + "errors": [ + "SyntaxError: Octal literal in strict mode (1:36)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 55, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 55 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 55, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 55 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "hello" + }, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 55, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 55 + } + }, + "body": [], + "directives": [ + { + "type": "Directive", + "start": 19, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 19, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 38 + } + }, + "value": "octal directive\\1", + "extra": { + "raw": "\"octal directive\\1\"", + "rawValue": "octal directive\\1" + } + } + }, + { + "type": "Directive", + "start": 40, + "end": 53, + "loc": { + "start": { + "line": 1, + "column": 40 + }, + "end": { + "line": 1, + "column": 53 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 40, + "end": 52, + "loc": { + "start": { + "line": 1, + "column": 40 + }, + "end": { + "line": 1, + "column": 52 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0222/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0222/options.json deleted file mode 100644 index d094fe0284b1..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0222/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Octal literal in strict mode (1:36)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0222/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0222/output.json new file mode 100644 index 000000000000..1c7a53167a1c --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0222/output.json @@ -0,0 +1,197 @@ +{ + "type": "File", + "start": 0, + "end": 76, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 76 + } + }, + "errors": [ + "SyntaxError: Octal literal in strict mode (1:36)", + "SyntaxError: Octal literal in strict mode (1:57)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 76, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 76 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 76, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 76 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "hello" + }, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 76, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 76 + } + }, + "body": [], + "directives": [ + { + "type": "Directive", + "start": 19, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 19, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 38 + } + }, + "value": "octal directive\\1", + "extra": { + "raw": "\"octal directive\\1\"", + "rawValue": "octal directive\\1" + } + } + }, + { + "type": "Directive", + "start": 40, + "end": 60, + "loc": { + "start": { + "line": 1, + "column": 40 + }, + "end": { + "line": 1, + "column": 60 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 40, + "end": 59, + "loc": { + "start": { + "line": 1, + "column": 40 + }, + "end": { + "line": 1, + "column": 59 + } + }, + "value": "octal directive\\2", + "extra": { + "raw": "\"octal directive\\2\"", + "rawValue": "octal directive\\2" + } + } + }, + { + "type": "Directive", + "start": 61, + "end": 74, + "loc": { + "start": { + "line": 1, + "column": 61 + }, + "end": { + "line": 1, + "column": 74 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 61, + "end": 73, + "loc": { + "start": { + "line": 1, + "column": 61 + }, + "end": { + "line": 1, + "column": 73 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0223/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0223/options.json deleted file mode 100644 index 8389b2c726ca..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0223/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Octal literal in strict mode (1:69)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0223/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0223/output.json new file mode 100644 index 000000000000..e52fa38ccf73 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0223/output.json @@ -0,0 +1,215 @@ +{ + "type": "File", + "start": 0, + "end": 76, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 76 + } + }, + "errors": [ + "SyntaxError: Octal literal in strict mode (1:69)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 76, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 76 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 76, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 76 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "hello" + }, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 76, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 76 + } + }, + "body": [ + { + "type": "FunctionDeclaration", + "start": 33, + "end": 74, + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 74 + } + }, + "id": { + "type": "Identifier", + "start": 42, + "end": 47, + "loc": { + "start": { + "line": 1, + "column": 42 + }, + "end": { + "line": 1, + "column": 47 + }, + "identifierName": "inner" + }, + "name": "inner" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 50, + "end": 74, + "loc": { + "start": { + "line": 1, + "column": 50 + }, + "end": { + "line": 1, + "column": 74 + } + }, + "body": [], + "directives": [ + { + "type": "Directive", + "start": 52, + "end": 72, + "loc": { + "start": { + "line": 1, + "column": 52 + }, + "end": { + "line": 1, + "column": 72 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 52, + "end": 71, + "loc": { + "start": { + "line": 1, + "column": 52 + }, + "end": { + "line": 1, + "column": 71 + } + }, + "value": "octal directive\\1", + "extra": { + "raw": "\"octal directive\\1\"", + "rawValue": "octal directive\\1" + } + } + } + ] + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 19, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 19, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0224/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0224/options.json deleted file mode 100644 index 0641de45e29a..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0224/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected reserved word 'implements' (1:37)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0224/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0224/output.json new file mode 100644 index 000000000000..2201ea3de8c6 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0224/output.json @@ -0,0 +1,178 @@ +{ + "type": "File", + "start": 0, + "end": 50, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 50 + } + }, + "errors": [ + "SyntaxError: Unexpected reserved word 'implements' (1:37)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 50, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 50 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 50, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 50 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "hello" + }, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 50, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 50 + } + }, + "body": [ + { + "type": "VariableDeclaration", + "start": 33, + "end": 48, + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 48 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 37, + "end": 47, + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 47 + } + }, + "id": { + "type": "Identifier", + "start": 37, + "end": 47, + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 47 + }, + "identifierName": "implements" + }, + "name": "implements" + }, + "init": null + } + ], + "kind": "var" + } + ], + "directives": [ + { + "type": "Directive", + "start": 19, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 19, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0225/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0225/options.json deleted file mode 100644 index 859238d0423f..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0225/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected reserved word 'interface' (1:37)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0225/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0225/output.json new file mode 100644 index 000000000000..be76deabc7a1 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0225/output.json @@ -0,0 +1,178 @@ +{ + "type": "File", + "start": 0, + "end": 49, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 49 + } + }, + "errors": [ + "SyntaxError: Unexpected reserved word 'interface' (1:37)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 49, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 49 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 49, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 49 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "hello" + }, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 49, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 49 + } + }, + "body": [ + { + "type": "VariableDeclaration", + "start": 33, + "end": 47, + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 47 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 37, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 46 + } + }, + "id": { + "type": "Identifier", + "start": 37, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 46 + }, + "identifierName": "interface" + }, + "name": "interface" + }, + "init": null + } + ], + "kind": "var" + } + ], + "directives": [ + { + "type": "Directive", + "start": 19, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 19, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0226/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0226/options.json deleted file mode 100644 index 344c7075f4bf..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0226/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected reserved word 'package' (1:37)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0226/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0226/output.json new file mode 100644 index 000000000000..414e229fac38 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0226/output.json @@ -0,0 +1,178 @@ +{ + "type": "File", + "start": 0, + "end": 47, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 47 + } + }, + "errors": [ + "SyntaxError: Unexpected reserved word 'package' (1:37)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 47, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 47 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 47, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 47 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "hello" + }, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 47, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 47 + } + }, + "body": [ + { + "type": "VariableDeclaration", + "start": 33, + "end": 45, + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 45 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 37, + "end": 44, + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 44 + } + }, + "id": { + "type": "Identifier", + "start": 37, + "end": 44, + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 44 + }, + "identifierName": "package" + }, + "name": "package" + }, + "init": null + } + ], + "kind": "var" + } + ], + "directives": [ + { + "type": "Directive", + "start": 19, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 19, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0227/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0227/options.json deleted file mode 100644 index 9fb9deaf9cba..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0227/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected reserved word 'private' (1:37)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0227/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0227/output.json new file mode 100644 index 000000000000..32efcd46a632 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0227/output.json @@ -0,0 +1,178 @@ +{ + "type": "File", + "start": 0, + "end": 47, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 47 + } + }, + "errors": [ + "SyntaxError: Unexpected reserved word 'private' (1:37)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 47, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 47 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 47, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 47 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "hello" + }, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 47, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 47 + } + }, + "body": [ + { + "type": "VariableDeclaration", + "start": 33, + "end": 45, + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 45 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 37, + "end": 44, + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 44 + } + }, + "id": { + "type": "Identifier", + "start": 37, + "end": 44, + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 44 + }, + "identifierName": "private" + }, + "name": "private" + }, + "init": null + } + ], + "kind": "var" + } + ], + "directives": [ + { + "type": "Directive", + "start": 19, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 19, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0228/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0228/options.json deleted file mode 100644 index 292fb56f1cf3..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0228/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected reserved word 'protected' (1:37)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0228/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0228/output.json new file mode 100644 index 000000000000..e3d3f255c253 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0228/output.json @@ -0,0 +1,178 @@ +{ + "type": "File", + "start": 0, + "end": 49, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 49 + } + }, + "errors": [ + "SyntaxError: Unexpected reserved word 'protected' (1:37)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 49, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 49 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 49, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 49 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "hello" + }, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 49, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 49 + } + }, + "body": [ + { + "type": "VariableDeclaration", + "start": 33, + "end": 47, + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 47 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 37, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 46 + } + }, + "id": { + "type": "Identifier", + "start": 37, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 46 + }, + "identifierName": "protected" + }, + "name": "protected" + }, + "init": null + } + ], + "kind": "var" + } + ], + "directives": [ + { + "type": "Directive", + "start": 19, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 19, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0229/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0229/options.json deleted file mode 100644 index d5f48446906a..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0229/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected reserved word 'public' (1:37)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0229/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0229/output.json new file mode 100644 index 000000000000..2e801038c78d --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0229/output.json @@ -0,0 +1,178 @@ +{ + "type": "File", + "start": 0, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 46 + } + }, + "errors": [ + "SyntaxError: Unexpected reserved word 'public' (1:37)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 46 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 46 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "hello" + }, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 46 + } + }, + "body": [ + { + "type": "VariableDeclaration", + "start": 33, + "end": 44, + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 44 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 37, + "end": 43, + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 43 + } + }, + "id": { + "type": "Identifier", + "start": 37, + "end": 43, + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 43 + }, + "identifierName": "public" + }, + "name": "public" + }, + "init": null + } + ], + "kind": "var" + } + ], + "directives": [ + { + "type": "Directive", + "start": 19, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 19, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0230/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0230/options.json deleted file mode 100644 index 0f41ff2e6f24..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0230/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected reserved word 'static' (1:37)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0230/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0230/output.json new file mode 100644 index 000000000000..4ed420518d6d --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0230/output.json @@ -0,0 +1,178 @@ +{ + "type": "File", + "start": 0, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 46 + } + }, + "errors": [ + "SyntaxError: Unexpected reserved word 'static' (1:37)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 46 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 46 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "hello" + }, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 46 + } + }, + "body": [ + { + "type": "VariableDeclaration", + "start": 33, + "end": 44, + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 44 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 37, + "end": 43, + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 43 + } + }, + "id": { + "type": "Identifier", + "start": 37, + "end": 43, + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 43 + }, + "identifierName": "static" + }, + "name": "static" + }, + "init": null + } + ], + "kind": "var" + } + ], + "directives": [ + { + "type": "Directive", + "start": 19, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 19, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0231/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0231/options.json deleted file mode 100644 index 6ab197f35dc9..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0231/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected reserved word 'yield' (1:37)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0231/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0231/output.json new file mode 100644 index 000000000000..55dc17f91beb --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0231/output.json @@ -0,0 +1,178 @@ +{ + "type": "File", + "start": 0, + "end": 45, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 45 + } + }, + "errors": [ + "SyntaxError: Unexpected reserved word 'yield' (1:37)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 45, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 45 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 45, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 45 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "hello" + }, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 45, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 45 + } + }, + "body": [ + { + "type": "VariableDeclaration", + "start": 33, + "end": 43, + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 43 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 37, + "end": 42, + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 42 + } + }, + "id": { + "type": "Identifier", + "start": 37, + "end": 42, + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 42 + }, + "identifierName": "yield" + }, + "name": "yield" + }, + "init": null + } + ], + "kind": "var" + } + ], + "directives": [ + { + "type": "Directive", + "start": 19, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 19, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0232/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0232/options.json deleted file mode 100644 index d2f3cbc2e116..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0232/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected reserved word 'let' (1:37)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0232/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0232/output.json new file mode 100644 index 000000000000..3b946aeb3223 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0232/output.json @@ -0,0 +1,178 @@ +{ + "type": "File", + "start": 0, + "end": 43, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 43 + } + }, + "errors": [ + "SyntaxError: Unexpected reserved word 'let' (1:37)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 43, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 43 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 43, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 43 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "hello" + }, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 43, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 43 + } + }, + "body": [ + { + "type": "VariableDeclaration", + "start": 33, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 41 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 37, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 40 + } + }, + "id": { + "type": "Identifier", + "start": 37, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 40 + }, + "identifierName": "let" + }, + "name": "let" + }, + "init": null + } + ], + "kind": "var" + } + ], + "directives": [ + { + "type": "Directive", + "start": 19, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 19, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0233/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0233/options.json deleted file mode 100644 index fff472344fd7..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0233/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'static' in strict mode (1:15)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0233/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0233/output.json new file mode 100644 index 000000000000..ab669586dc27 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0233/output.json @@ -0,0 +1,144 @@ +{ + "type": "File", + "start": 0, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 40 + } + }, + "errors": [ + "SyntaxError: Binding 'static' in strict mode (1:15)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 40 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 40 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "hello" + }, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 15, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 21 + }, + "identifierName": "static" + }, + "name": "static" + } + ], + "body": { + "type": "BlockStatement", + "start": 23, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 40 + } + }, + "body": [], + "directives": [ + { + "type": "Directive", + "start": 25, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 38 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 25, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0234/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0234/options.json deleted file mode 100644 index d4d0a96bfb64..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0234/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'static' in strict mode (1:9)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0234/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0234/output.json new file mode 100644 index 000000000000..be76a2099b54 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0234/output.json @@ -0,0 +1,126 @@ +{ + "type": "File", + "start": 0, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "errors": [ + "SyntaxError: Binding 'static' in strict mode (1:9)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 15 + }, + "identifierName": "static" + }, + "name": "static" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 18, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "body": [], + "directives": [ + { + "type": "Directive", + "start": 20, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 20, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0235/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0235/options.json deleted file mode 100644 index a7490f9321d4..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0235/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'eval' in strict mode (1:9)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0235/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0235/output.json new file mode 100644 index 000000000000..df217b6af2bc --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0235/output.json @@ -0,0 +1,144 @@ +{ + "type": "File", + "start": 0, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "errors": [ + "SyntaxError: Binding 'eval' in strict mode (1:9)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 13 + }, + "identifierName": "eval" + }, + "name": "eval" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 14, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + }, + "identifierName": "a" + }, + "name": "a" + } + ], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "body": [], + "directives": [ + { + "type": "Directive", + "start": 19, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 19, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0236/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0236/options.json deleted file mode 100644 index 80b8b2d85caa..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0236/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'arguments' in strict mode (1:9)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0236/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0236/output.json new file mode 100644 index 000000000000..0de7c6ba2ac0 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0236/output.json @@ -0,0 +1,144 @@ +{ + "type": "File", + "start": 0, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "errors": [ + "SyntaxError: Binding 'arguments' in strict mode (1:9)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 18 + }, + "identifierName": "arguments" + }, + "name": "arguments" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 19, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + }, + "identifierName": "a" + }, + "name": "a" + } + ], + "body": { + "type": "BlockStatement", + "start": 22, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "body": [], + "directives": [ + { + "type": "Directive", + "start": 24, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 24, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0239/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0239/options.json deleted file mode 100644 index 91bc36d3f360..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0239/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected reserved word 'static' (1:23)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0239/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0239/output.json new file mode 100644 index 000000000000..c249f39209bf --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0239/output.json @@ -0,0 +1,126 @@ +{ + "type": "File", + "start": 0, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "errors": [ + "SyntaxError: Unexpected reserved word 'static' (1:23)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 14, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "id": { + "type": "Identifier", + "start": 23, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 29 + }, + "identifierName": "static" + }, + "name": "static" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 32, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "body": [], + "directives": [] + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0240/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0240/options.json deleted file mode 100644 index 8b20b9a7df36..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0240/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Argument name clash (1:14)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0240/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0240/output.json new file mode 100644 index 000000000000..f945eeb57491 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0240/output.json @@ -0,0 +1,161 @@ +{ + "type": "File", + "start": 0, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "errors": [ + "SyntaxError: Argument name clash (1:14)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + }, + "identifierName": "a" + }, + "name": "a" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 11, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + }, + "identifierName": "t" + }, + "name": "t" + }, + { + "type": "Identifier", + "start": 14, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + }, + "identifierName": "t" + }, + "name": "t" + } + ], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "body": [], + "directives": [ + { + "type": "Directive", + "start": 19, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 19, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0241/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0241/options.json deleted file mode 100644 index e227bd1a6b74..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0241/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'eval' in strict mode (1:11)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0241/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0241/output.json new file mode 100644 index 000000000000..f2ff5d38de33 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0241/output.json @@ -0,0 +1,144 @@ +{ + "type": "File", + "start": 0, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "errors": [ + "SyntaxError: Binding 'eval' in strict mode (1:11)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + }, + "identifierName": "a" + }, + "name": "a" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 11, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 15 + }, + "identifierName": "eval" + }, + "name": "eval" + } + ], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "body": [], + "directives": [ + { + "type": "Directive", + "start": 19, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 19, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0242/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0242/options.json deleted file mode 100644 index 8e1f9af4ec47..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0242/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'package' in strict mode (1:11)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0242/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0242/output.json new file mode 100644 index 000000000000..2f734055a47a --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0242/output.json @@ -0,0 +1,144 @@ +{ + "type": "File", + "start": 0, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "errors": [ + "SyntaxError: Binding 'package' in strict mode (1:11)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + }, + "identifierName": "a" + }, + "name": "a" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 11, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 18 + }, + "identifierName": "package" + }, + "name": "package" + } + ], + "body": { + "type": "BlockStatement", + "start": 20, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "body": [], + "directives": [ + { + "type": "Directive", + "start": 22, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 22, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0243/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0243/options.json deleted file mode 100644 index 9d2a58081596..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0243/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Argument name clash (1:43)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0243/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0243/output.json new file mode 100644 index 000000000000..60ac3ce8c98c --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0243/output.json @@ -0,0 +1,229 @@ +{ + "type": "File", + "start": 0, + "end": 52, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 52 + } + }, + "errors": [ + "SyntaxError: Argument name clash (1:43)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 52, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 52 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 52, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 52 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + }, + "identifierName": "a" + }, + "name": "a" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 13, + "end": 52, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 52 + } + }, + "body": [ + { + "type": "FunctionDeclaration", + "start": 29, + "end": 49, + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 49 + } + }, + "id": { + "type": "Identifier", + "start": 38, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 38 + }, + "end": { + "line": 1, + "column": 39 + }, + "identifierName": "b" + }, + "name": "b" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 40, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 40 + }, + "end": { + "line": 1, + "column": 41 + }, + "identifierName": "t" + }, + "name": "t" + }, + { + "type": "Identifier", + "start": 43, + "end": 44, + "loc": { + "start": { + "line": 1, + "column": 43 + }, + "end": { + "line": 1, + "column": 44 + }, + "identifierName": "t" + }, + "name": "t" + } + ], + "body": { + "type": "BlockStatement", + "start": 46, + "end": 49, + "loc": { + "start": { + "line": 1, + "column": 46 + }, + "end": { + "line": 1, + "column": 49 + } + }, + "body": [], + "directives": [] + } + }, + { + "type": "EmptyStatement", + "start": 49, + "end": 50, + "loc": { + "start": { + "line": 1, + "column": 49 + }, + "end": { + "line": 1, + "column": 50 + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 15, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 15, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0244/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0244/options.json deleted file mode 100644 index 61c3bbb5abe0..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0244/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Argument name clash (1:15)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0244/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0244/output.json new file mode 100644 index 000000000000..766ec14c5a33 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0244/output.json @@ -0,0 +1,180 @@ +{ + "type": "File", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "errors": [ + "SyntaxError: Argument name clash (1:15)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "expression": { + "type": "FunctionExpression", + "start": 1, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "id": { + "type": "Identifier", + "start": 10, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + }, + "identifierName": "a" + }, + "name": "a" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 12, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + }, + "identifierName": "t" + }, + "name": "t" + }, + { + "type": "Identifier", + "start": 15, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + }, + "identifierName": "t" + }, + "name": "t" + } + ], + "body": { + "type": "BlockStatement", + "start": 18, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "body": [], + "directives": [ + { + "type": "Directive", + "start": 20, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 20, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + }, + "extra": { + "parenthesized": true, + "parenStart": 0 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0245/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0245/options.json deleted file mode 100644 index ae469fbd59da..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0245/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Argument name clash (1:44)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0245/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0245/output.json new file mode 100644 index 000000000000..0f2e3c5dce01 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0245/output.json @@ -0,0 +1,233 @@ +{ + "type": "File", + "start": 0, + "end": 54, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 54 + } + }, + "errors": [ + "SyntaxError: Argument name clash (1:44)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 54, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 54 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 54, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 54 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + }, + "identifierName": "a" + }, + "name": "a" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 13, + "end": 54, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 54 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 29, + "end": 52, + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 52 + } + }, + "expression": { + "type": "FunctionExpression", + "start": 30, + "end": 50, + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 50 + } + }, + "id": { + "type": "Identifier", + "start": 39, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 39 + }, + "end": { + "line": 1, + "column": 40 + }, + "identifierName": "b" + }, + "name": "b" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 41, + "end": 42, + "loc": { + "start": { + "line": 1, + "column": 41 + }, + "end": { + "line": 1, + "column": 42 + }, + "identifierName": "t" + }, + "name": "t" + }, + { + "type": "Identifier", + "start": 44, + "end": 45, + "loc": { + "start": { + "line": 1, + "column": 44 + }, + "end": { + "line": 1, + "column": 45 + }, + "identifierName": "t" + }, + "name": "t" + } + ], + "body": { + "type": "BlockStatement", + "start": 47, + "end": 50, + "loc": { + "start": { + "line": 1, + "column": 47 + }, + "end": { + "line": 1, + "column": 50 + } + }, + "body": [], + "directives": [] + }, + "extra": { + "parenthesized": true, + "parenStart": 29 + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 15, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 15, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0246/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0246/options.json deleted file mode 100644 index 3c24c608c88a..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0246/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'eval' in strict mode (1:12)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0246/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0246/output.json new file mode 100644 index 000000000000..7945e482ca86 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0246/output.json @@ -0,0 +1,163 @@ +{ + "type": "File", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "errors": [ + "SyntaxError: Binding 'eval' in strict mode (1:12)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "expression": { + "type": "FunctionExpression", + "start": 1, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "id": { + "type": "Identifier", + "start": 10, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + }, + "identifierName": "a" + }, + "name": "a" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 12, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 16 + }, + "identifierName": "eval" + }, + "name": "eval" + } + ], + "body": { + "type": "BlockStatement", + "start": 18, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "body": [], + "directives": [ + { + "type": "Directive", + "start": 20, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 20, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + }, + "extra": { + "parenthesized": true, + "parenStart": 0 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0247/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0247/options.json deleted file mode 100644 index 96d524816cc9..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0247/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'package' in strict mode (1:12)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0247/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0247/output.json new file mode 100644 index 000000000000..304b4237e9e7 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0247/output.json @@ -0,0 +1,163 @@ +{ + "type": "File", + "start": 0, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "errors": [ + "SyntaxError: Binding 'package' in strict mode (1:12)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "expression": { + "type": "FunctionExpression", + "start": 1, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 38 + } + }, + "id": { + "type": "Identifier", + "start": 10, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + }, + "identifierName": "a" + }, + "name": "a" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 12, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 19 + }, + "identifierName": "package" + }, + "name": "package" + } + ], + "body": { + "type": "BlockStatement", + "start": 21, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 38 + } + }, + "body": [], + "directives": [ + { + "type": "Directive", + "start": 23, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 23, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + }, + "extra": { + "parenthesized": true, + "parenStart": 0 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0248/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0248/options.json deleted file mode 100644 index cb5abd9f7401..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0248/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Label '__proto__' is already declared (1:11)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0248/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0248/output.json new file mode 100644 index 000000000000..2b1e638019cc --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0248/output.json @@ -0,0 +1,137 @@ +{ + "type": "File", + "start": 0, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "errors": [ + "SyntaxError: Label '__proto__' is already declared (1:11)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "LabeledStatement", + "start": 0, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "body": { + "type": "LabeledStatement", + "start": 11, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "body": { + "type": "ExpressionStatement", + "start": 22, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 22, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "extra": { + "rawValue": 42, + "raw": "42" + }, + "value": 42 + } + }, + "label": { + "type": "Identifier", + "start": 11, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 20 + }, + "identifierName": "__proto__" + }, + "name": "__proto__" + } + }, + "label": { + "type": "Identifier", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + }, + "identifierName": "__proto__" + }, + "name": "__proto__" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0249/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0249/options.json deleted file mode 100644 index 505798d5a203..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0249/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Argument name clash (1:36)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0249/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0249/output.json new file mode 100644 index 000000000000..45d9e76d63b8 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0249/output.json @@ -0,0 +1,161 @@ +{ + "type": "File", + "start": 0, + "end": 50, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 50 + } + }, + "errors": [ + "SyntaxError: Argument name clash (1:36)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 50, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 50 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 14, + "end": 50, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 50 + } + }, + "id": { + "type": "Identifier", + "start": 23, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + }, + "identifierName": "t" + }, + "name": "t" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 25, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 34 + }, + "identifierName": "__proto__" + }, + "name": "__proto__" + }, + { + "type": "Identifier", + "start": 36, + "end": 45, + "loc": { + "start": { + "line": 1, + "column": 36 + }, + "end": { + "line": 1, + "column": 45 + }, + "identifierName": "__proto__" + }, + "name": "__proto__" + } + ], + "body": { + "type": "BlockStatement", + "start": 47, + "end": 50, + "loc": { + "start": { + "line": 1, + "column": 47 + }, + "end": { + "line": 1, + "column": 50 + } + }, + "body": [], + "directives": [] + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0250/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0250/options.json deleted file mode 100644 index 8e9b9f585996..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0250/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Redefinition of __proto__ property (1:21)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0250/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0250/output.json new file mode 100644 index 000000000000..6c9cf3db90bb --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0250/output.json @@ -0,0 +1,213 @@ +{ + "type": "File", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "errors": [ + "SyntaxError: Redefinition of __proto__ property (1:21)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "operator": "=", + "left": { + "type": "Identifier", + "start": 0, + "end": 1, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + }, + "identifierName": "x" + }, + "name": "x" + }, + "right": { + "type": "ObjectExpression", + "start": 4, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 6, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 6, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 15 + }, + "identifierName": "__proto__" + }, + "name": "__proto__" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "NumericLiteral", + "start": 17, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "extra": { + "rawValue": 42, + "raw": "42" + }, + "value": 42 + } + }, + { + "type": "ObjectProperty", + "start": 21, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 21, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 30 + }, + "identifierName": "__proto__" + }, + "name": "__proto__" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "NumericLiteral", + "start": 32, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "extra": { + "rawValue": 43, + "raw": "43" + }, + "value": 43 + } + } + ] + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0270/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0270/options.json deleted file mode 100644 index 8df109cb3c33..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0270/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Classes may not have static property named prototype (1:16)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0270/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0270/output.json new file mode 100644 index 000000000000..3c3b792e5b9b --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0270/output.json @@ -0,0 +1,144 @@ +{ + "type": "File", + "start": 0, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "errors": [ + "SyntaxError: Classes may not have static property named prototype (1:16)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "A" + }, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 8, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "body": [ + { + "type": "ClassMethod", + "start": 9, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "static": true, + "key": { + "type": "Identifier", + "start": 16, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 25 + }, + "identifierName": "prototype" + }, + "name": "prototype" + }, + "computed": false, + "kind": "method", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 27, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0271/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0271/options.json deleted file mode 100644 index 8df109cb3c33..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0271/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Classes may not have static property named prototype (1:16)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0271/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0271/output.json new file mode 100644 index 000000000000..0c00e7e06841 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0271/output.json @@ -0,0 +1,147 @@ +{ + "type": "File", + "start": 0, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "errors": [ + "SyntaxError: Classes may not have static property named prototype (1:16)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "A" + }, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 8, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "body": [ + { + "type": "ClassMethod", + "start": 9, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "static": true, + "key": { + "type": "StringLiteral", + "start": 16, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "extra": { + "rawValue": "prototype", + "raw": "\"prototype\"" + }, + "value": "prototype" + }, + "computed": false, + "kind": "method", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 29, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0272/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0272/options.json deleted file mode 100644 index f4b1d256a4ab..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0272/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Constructor can't have get/set modifier (1:13)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0272/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0272/output.json new file mode 100644 index 000000000000..d583a2ec1119 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0272/output.json @@ -0,0 +1,144 @@ +{ + "type": "File", + "start": 0, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "errors": [ + "SyntaxError: Constructor can't have get/set modifier (1:13)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "A" + }, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 8, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "body": [ + { + "type": "ClassMethod", + "start": 9, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "static": false, + "key": { + "type": "Identifier", + "start": 13, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 24 + }, + "identifierName": "constructor" + }, + "name": "constructor" + }, + "computed": false, + "kind": "get", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 26, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0273/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0273/options.json deleted file mode 100644 index f4b1d256a4ab..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0273/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Constructor can't have get/set modifier (1:13)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0273/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0273/output.json new file mode 100644 index 000000000000..532d8ebe70a8 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0273/output.json @@ -0,0 +1,162 @@ +{ + "type": "File", + "start": 0, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "errors": [ + "SyntaxError: Constructor can't have get/set modifier (1:13)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "A" + }, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 8, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "body": [ + { + "type": "ClassMethod", + "start": 9, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "static": false, + "key": { + "type": "Identifier", + "start": 13, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 24 + }, + "identifierName": "constructor" + }, + "name": "constructor" + }, + "computed": false, + "kind": "set", + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 25, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 26 + }, + "identifierName": "m" + }, + "name": "m" + } + ], + "body": { + "type": "BlockStatement", + "start": 27, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0274/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0274/options.json deleted file mode 100644 index 4d892adceff9..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0274/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Duplicate constructor in the same class (1:25)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0274/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0274/output.json new file mode 100644 index 000000000000..4337adcf6eb6 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0274/output.json @@ -0,0 +1,203 @@ +{ + "type": "File", + "start": 0, + "end": 43, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 43 + } + }, + "errors": [ + "SyntaxError: Duplicate constructor in the same class (1:25)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 43, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 43 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 43, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 43 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "A" + }, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 8, + "end": 43, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 43 + } + }, + "body": [ + { + "type": "ClassMethod", + "start": 9, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "static": false, + "key": { + "type": "Identifier", + "start": 9, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 20 + }, + "identifierName": "constructor" + }, + "name": "constructor" + }, + "computed": false, + "kind": "constructor", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 22, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "body": [], + "directives": [] + } + }, + { + "type": "ClassMethod", + "start": 25, + "end": 42, + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 42 + } + }, + "static": false, + "key": { + "type": "StringLiteral", + "start": 25, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 38 + } + }, + "extra": { + "rawValue": "constructor", + "raw": "\"constructor\"" + }, + "value": "constructor" + }, + "computed": false, + "kind": "constructor", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 40, + "end": 42, + "loc": { + "start": { + "line": 1, + "column": 40 + }, + "end": { + "line": 1, + "column": 42 + } + }, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0277/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0277/options.json deleted file mode 100644 index aef7f56007e9..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0277/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected reserved word 'enum' (1:11)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0277/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0277/output.json new file mode 100644 index 000000000000..df10adea166e --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0277/output.json @@ -0,0 +1,162 @@ +{ + "type": "File", + "start": 0, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "errors": [ + "SyntaxError: Unexpected reserved word 'enum' (1:11)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "A" + }, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 8, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "body": [ + { + "type": "ClassMethod", + "start": 9, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "static": false, + "key": { + "type": "Identifier", + "start": 9, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + }, + "identifierName": "a" + }, + "name": "a" + }, + "computed": false, + "kind": "method", + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 11, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 15 + }, + "identifierName": "enum" + }, + "name": "enum" + } + ], + "body": { + "type": "BlockStatement", + "start": 16, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0278/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0278/options.json deleted file mode 100644 index 757b207f0ef2..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0278/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected reserved word 'static' (1:17)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0278/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0278/output.json new file mode 100644 index 000000000000..275b0d3ee35a --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0278/output.json @@ -0,0 +1,144 @@ +{ + "type": "File", + "start": 0, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "errors": [ + "SyntaxError: Unexpected reserved word 'static' (1:17)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "A" + }, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 8, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "body": [ + { + "type": "ClassMethod", + "start": 9, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "static": true, + "computed": true, + "key": { + "type": "Identifier", + "start": 17, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 23 + }, + "identifierName": "static" + }, + "name": "static" + }, + "kind": "method", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 26, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/rest-parameter/invalid-setter-rest/options.json b/packages/babel-parser/test/fixtures/esprima/rest-parameter/invalid-setter-rest/options.json deleted file mode 100644 index 0006fbf98e5c..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/rest-parameter/invalid-setter-rest/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "setter function argument must not be a rest parameter (1:6)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/rest-parameter/invalid-setter-rest/output.json b/packages/babel-parser/test/fixtures/esprima/rest-parameter/invalid-setter-rest/output.json new file mode 100644 index 000000000000..30ec6b3832e2 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/rest-parameter/invalid-setter-rest/output.json @@ -0,0 +1,192 @@ +{ + "type": "File", + "start": 0, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "errors": [ + "SyntaxError: setter function argument must not be a rest parameter (1:6)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 0, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "operator": "=", + "left": { + "type": "Identifier", + "start": 0, + "end": 1, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + }, + "identifierName": "x" + }, + "name": "x" + }, + "right": { + "type": "ObjectExpression", + "start": 4, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "properties": [ + { + "type": "ObjectMethod", + "start": 6, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 10, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + }, + "identifierName": "f" + }, + "name": "f" + }, + "computed": false, + "kind": "set", + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "RestElement", + "start": 12, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "argument": { + "type": "Identifier", + "start": 15, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + }, + "identifierName": "y" + }, + "name": "y" + } + } + ], + "body": { + "type": "BlockStatement", + "start": 18, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "body": [], + "directives": [] + } + } + ] + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/statement-expression/migrated_0002/options.json b/packages/babel-parser/test/fixtures/esprima/statement-expression/migrated_0002/options.json deleted file mode 100644 index 381fd12ce2d0..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/statement-expression/migrated_0002/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Expecting Unicode escape sequence \\uXXXX (1:1)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/statement-expression/migrated_0002/output.json b/packages/babel-parser/test/fixtures/esprima/statement-expression/migrated_0002/output.json new file mode 100644 index 000000000000..e418d699ca2c --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/statement-expression/migrated_0002/output.json @@ -0,0 +1,70 @@ +{ + "type": "File", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "errors": [ + "SyntaxError: Expecting Unicode escape sequence \\uXXXX (1:1)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "expression": { + "type": "Identifier", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "\\a" + }, + "name": "\\a" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/statement-expression/migrated_0003/options.json b/packages/babel-parser/test/fixtures/esprima/statement-expression/migrated_0003/options.json deleted file mode 100644 index 18c53b997b56..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/statement-expression/migrated_0003/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Expecting Unicode escape sequence \\uXXXX (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/statement-expression/migrated_0003/output.json b/packages/babel-parser/test/fixtures/esprima/statement-expression/migrated_0003/output.json new file mode 100644 index 000000000000..6f022e5637c6 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/statement-expression/migrated_0003/output.json @@ -0,0 +1,70 @@ +{ + "type": "File", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "errors": [ + "SyntaxError: Expecting Unicode escape sequence \\uXXXX (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "expression": { + "type": "Identifier", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + }, + "identifierName": "aa\\a" + }, + "name": "aa\\a" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/statement-expression/migrated_0004/options.json b/packages/babel-parser/test/fixtures/esprima/statement-expression/migrated_0004/options.json deleted file mode 100644 index 381fd12ce2d0..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/statement-expression/migrated_0004/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Expecting Unicode escape sequence \\uXXXX (1:1)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/statement-expression/migrated_0004/output.json b/packages/babel-parser/test/fixtures/esprima/statement-expression/migrated_0004/output.json new file mode 100644 index 000000000000..c0f511826127 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/statement-expression/migrated_0004/output.json @@ -0,0 +1,70 @@ +{ + "type": "File", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "errors": [ + "SyntaxError: Expecting Unicode escape sequence \\uXXXX (1:1)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "expression": { + "type": "Identifier", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + }, + "identifierName": "\\aa" + }, + "name": "\\aa" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/statement-expression/migrated_0005/options.json b/packages/babel-parser/test/fixtures/esprima/statement-expression/migrated_0005/options.json deleted file mode 100644 index 381fd12ce2d0..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/statement-expression/migrated_0005/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Expecting Unicode escape sequence \\uXXXX (1:1)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/statement-expression/migrated_0005/output.json b/packages/babel-parser/test/fixtures/esprima/statement-expression/migrated_0005/output.json new file mode 100644 index 000000000000..c0f511826127 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/statement-expression/migrated_0005/output.json @@ -0,0 +1,70 @@ +{ + "type": "File", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "errors": [ + "SyntaxError: Expecting Unicode escape sequence \\uXXXX (1:1)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "expression": { + "type": "Identifier", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + }, + "identifierName": "\\aa" + }, + "name": "\\aa" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/statement-variable/complex-pattern-requires-init/options.json b/packages/babel-parser/test/fixtures/esprima/statement-variable/complex-pattern-requires-init/options.json deleted file mode 100644 index 57893e4eee56..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/statement-variable/complex-pattern-requires-init/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Complex binding patterns require an initialization value (1:6)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/statement-variable/complex-pattern-requires-init/output.json b/packages/babel-parser/test/fixtures/esprima/statement-variable/complex-pattern-requires-init/output.json new file mode 100644 index 000000000000..8c9fa87e494e --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/statement-variable/complex-pattern-requires-init/output.json @@ -0,0 +1,88 @@ +{ + "type": "File", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "errors": [ + "SyntaxError: Complex binding patterns require an initialization value (1:6)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 4, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "id": { + "type": "ArrayPattern", + "start": 4, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "elements": [] + }, + "init": null + } + ], + "kind": "var" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/estree/bigInt/basic/input.js b/packages/babel-parser/test/fixtures/estree/bigInt/basic/input.js new file mode 100644 index 000000000000..b01de9749f99 --- /dev/null +++ b/packages/babel-parser/test/fixtures/estree/bigInt/basic/input.js @@ -0,0 +1 @@ +const a = 1n; diff --git a/packages/babel-parser/test/fixtures/estree/bigInt/basic/output.json b/packages/babel-parser/test/fixtures/estree/bigInt/basic/output.json new file mode 100644 index 000000000000..eebbaebd1306 --- /dev/null +++ b/packages/babel-parser/test/fixtures/estree/bigInt/basic/output.json @@ -0,0 +1,105 @@ +{ + "type": "File", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 6, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "a" + }, + "name": "a" + }, + "init": { + "type": "Literal", + "start": 10, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "value": { + "$$ babel internal serialized type": "BigInt", + "value": "1" + }, + "raw": "1n", + "bigint": "1" + } + } + ], + "kind": "const" + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/estree/bigInt/options.json b/packages/babel-parser/test/fixtures/estree/bigInt/options.json new file mode 100644 index 000000000000..0df9db5c35e7 --- /dev/null +++ b/packages/babel-parser/test/fixtures/estree/bigInt/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["estree", "bigInt"] +} diff --git a/packages/babel-parser/test/fixtures/estree/dynamic-import/basic/input.js b/packages/babel-parser/test/fixtures/estree/dynamic-import/basic/input.js new file mode 100644 index 000000000000..7fc63cc0957a --- /dev/null +++ b/packages/babel-parser/test/fixtures/estree/dynamic-import/basic/input.js @@ -0,0 +1 @@ +const a = import("a"); diff --git a/packages/babel-parser/test/fixtures/estree/dynamic-import/basic/output.json b/packages/babel-parser/test/fixtures/estree/dynamic-import/basic/output.json new file mode 100644 index 000000000000..be4caee8d685 --- /dev/null +++ b/packages/babel-parser/test/fixtures/estree/dynamic-import/basic/output.json @@ -0,0 +1,116 @@ +{ + "type": "File", + "start": 0, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 0, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 6, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "a" + }, + "name": "a" + }, + "init": { + "type": "ImportExpression", + "start": 10, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "source": { + "type": "Literal", + "start": 17, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "value": "a", + "raw": "\"a\"" + } + } + } + ], + "kind": "const" + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/estree/dynamic-import/options.json b/packages/babel-parser/test/fixtures/estree/dynamic-import/options.json new file mode 100644 index 000000000000..9e48801bb9eb --- /dev/null +++ b/packages/babel-parser/test/fixtures/estree/dynamic-import/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["estree", "dynamicImport"] +} diff --git a/packages/babel-parser/test/fixtures/estree/literal/regexp/output.json b/packages/babel-parser/test/fixtures/estree/literal/regexp/output.json index cfdf13c59ac9..fccddbd97a80 100644 --- a/packages/babel-parser/test/fixtures/estree/literal/regexp/output.json +++ b/packages/babel-parser/test/fixtures/estree/literal/regexp/output.json @@ -89,7 +89,11 @@ "column": 13 } }, - "value": "/.*/i", + "value": { + "$$ babel internal serialized type": "RegExp", + "source": ".*", + "flags": "i" + }, "raw": "/.*/i", "regex": { "pattern": ".*", diff --git a/packages/babel-parser/test/fixtures/experimental/_no-plugin/dynamic-import/input.js b/packages/babel-parser/test/fixtures/experimental/_no-plugin/dynamic-import/input.js deleted file mode 100644 index f0038a3c11fd..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/_no-plugin/dynamic-import/input.js +++ /dev/null @@ -1 +0,0 @@ -var $ = import("jquery"); diff --git a/packages/babel-parser/test/fixtures/experimental/_no-plugin/dynamic-import/options.json b/packages/babel-parser/test/fixtures/experimental/_no-plugin/dynamic-import/options.json deleted file mode 100644 index 90bbfd5623c9..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/_no-plugin/dynamic-import/options.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "throws": "This experimental syntax requires enabling the parser plugin: 'dynamicImport' (1:8)", - "plugins": [] -} diff --git a/packages/babel-parser/test/fixtures/experimental/_no-plugin/export-namespace/options.json b/packages/babel-parser/test/fixtures/experimental/_no-plugin/export-namespace/options.json deleted file mode 100644 index b8b7c829daad..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/_no-plugin/export-namespace/options.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "throws": "This experimental syntax requires enabling the parser plugin: 'exportNamespaceFrom' (1:9)", - "plugins": [] -} diff --git a/packages/babel-parser/test/fixtures/experimental/_no-plugin/optional-chaining/input.js b/packages/babel-parser/test/fixtures/experimental/_no-plugin/optional-chaining/input.js deleted file mode 100644 index 280754611364..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/_no-plugin/optional-chaining/input.js +++ /dev/null @@ -1 +0,0 @@ -a?.b diff --git a/packages/babel-parser/test/fixtures/experimental/_no-plugin/optional-chaining/options.json b/packages/babel-parser/test/fixtures/experimental/_no-plugin/optional-chaining/options.json deleted file mode 100644 index b8e170c94adb..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/_no-plugin/optional-chaining/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "This experimental syntax requires enabling the parser plugin: 'optionalChaining' (1:1)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/bigint/decimal-as-property-name/input.js b/packages/babel-parser/test/fixtures/experimental/bigint/decimal-as-property-name/input.js new file mode 100644 index 000000000000..f6c9c2b0d01f --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/bigint/decimal-as-property-name/input.js @@ -0,0 +1 @@ +({ 0n: 0 }); diff --git a/packages/babel-parser/test/fixtures/experimental/bigint/decimal-as-property-name/output.json b/packages/babel-parser/test/fixtures/experimental/bigint/decimal-as-property-name/output.json new file mode 100644 index 000000000000..0e89977f1977 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/bigint/decimal-as-property-name/output.json @@ -0,0 +1,129 @@ +{ + "type": "File", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "expression": { + "type": "ObjectExpression", + "start": 1, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 3, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "method": false, + "key": { + "type": "BigIntLiteral", + "start": 3, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "extra": { + "rawValue": "0", + "raw": "0n" + }, + "value": "0" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "NumericLiteral", + "start": 7, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + } + ], + "extra": { + "parenthesized": true, + "parenStart": 0 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/bigint/hex-as-property-name/input.js b/packages/babel-parser/test/fixtures/experimental/bigint/hex-as-property-name/input.js new file mode 100644 index 000000000000..537fddf64fc1 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/bigint/hex-as-property-name/input.js @@ -0,0 +1 @@ +({ 0xbeefban: 0 }); diff --git a/packages/babel-parser/test/fixtures/experimental/bigint/hex-as-property-name/output.json b/packages/babel-parser/test/fixtures/experimental/bigint/hex-as-property-name/output.json new file mode 100644 index 000000000000..6f4825b89b86 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/bigint/hex-as-property-name/output.json @@ -0,0 +1,129 @@ +{ + "type": "File", + "start": 0, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "expression": { + "type": "ObjectExpression", + "start": 1, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 3, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "method": false, + "key": { + "type": "BigIntLiteral", + "start": 3, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "extra": { + "rawValue": "0xbeefba", + "raw": "0xbeefban" + }, + "value": "0xbeefba" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "NumericLiteral", + "start": 14, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + } + ], + "extra": { + "parenthesized": true, + "parenStart": 0 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/bigint/invalid-decimal/options.json b/packages/babel-parser/test/fixtures/experimental/bigint/invalid-decimal/options.json deleted file mode 100644 index a1fd77a3341e..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/bigint/invalid-decimal/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid BigIntLiteral (1:0)" } diff --git a/packages/babel-parser/test/fixtures/experimental/bigint/invalid-decimal/output.json b/packages/babel-parser/test/fixtures/experimental/bigint/invalid-decimal/output.json new file mode 100644 index 000000000000..26cbd0245288 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/bigint/invalid-decimal/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "errors": [ + "SyntaxError: Invalid BigIntLiteral (1:0)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "expression": { + "type": "BigIntLiteral", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "extra": { + "rawValue": "1.0", + "raw": "1.0n" + }, + "value": "1.0" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/bigint/invalid-e/options.json b/packages/babel-parser/test/fixtures/experimental/bigint/invalid-e/options.json deleted file mode 100644 index a1fd77a3341e..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/bigint/invalid-e/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid BigIntLiteral (1:0)" } diff --git a/packages/babel-parser/test/fixtures/experimental/bigint/invalid-e/output.json b/packages/babel-parser/test/fixtures/experimental/bigint/invalid-e/output.json new file mode 100644 index 000000000000..527c53215960 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/bigint/invalid-e/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "errors": [ + "SyntaxError: Invalid BigIntLiteral (1:0)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "expression": { + "type": "BigIntLiteral", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "extra": { + "rawValue": "2e9", + "raw": "2e9n" + }, + "value": "2e9" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/bigint/invalid-non-octal-decimal-int/input.js b/packages/babel-parser/test/fixtures/experimental/bigint/invalid-non-octal-decimal-int/input.js new file mode 100644 index 000000000000..488077f06c3f --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/bigint/invalid-non-octal-decimal-int/input.js @@ -0,0 +1 @@ +089n \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/bigint/invalid-non-octal-decimal-int/options.json b/packages/babel-parser/test/fixtures/experimental/bigint/invalid-non-octal-decimal-int/options.json new file mode 100644 index 000000000000..f6a5fb21f1c3 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/bigint/invalid-non-octal-decimal-int/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["bigInt"] +} diff --git a/packages/babel-parser/test/fixtures/experimental/bigint/invalid-non-octal-decimal-int/output.json b/packages/babel-parser/test/fixtures/experimental/bigint/invalid-non-octal-decimal-int/output.json new file mode 100644 index 000000000000..86220085cd71 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/bigint/invalid-non-octal-decimal-int/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "errors": [ + "SyntaxError: Invalid BigIntLiteral (1:0)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "expression": { + "type": "BigIntLiteral", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "extra": { + "rawValue": "089", + "raw": "089n" + }, + "value": "089" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/bigint/invalid-octal-legacy/options.json b/packages/babel-parser/test/fixtures/experimental/bigint/invalid-octal-legacy/options.json deleted file mode 100644 index a1fd77a3341e..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/bigint/invalid-octal-legacy/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid BigIntLiteral (1:0)" } diff --git a/packages/babel-parser/test/fixtures/experimental/bigint/invalid-octal-legacy/output.json b/packages/babel-parser/test/fixtures/experimental/bigint/invalid-octal-legacy/output.json new file mode 100644 index 000000000000..baa4133652f9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/bigint/invalid-octal-legacy/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "errors": [ + "SyntaxError: Invalid BigIntLiteral (1:0)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "expression": { + "type": "BigIntLiteral", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "extra": { + "rawValue": "016432", + "raw": "016432n" + }, + "value": "016432" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-methods/failure-name-constructor/options.json b/packages/babel-parser/test/fixtures/experimental/class-private-methods/failure-name-constructor/options.json index d702f4db972b..8d265ec66c23 100644 --- a/packages/babel-parser/test/fixtures/experimental/class-private-methods/failure-name-constructor/options.json +++ b/packages/babel-parser/test/fixtures/experimental/class-private-methods/failure-name-constructor/options.json @@ -1,4 +1,3 @@ { - "throws": "Classes may not have a private field named '#constructor' (2:2)", "plugins": ["classPrivateMethods"] } diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-methods/failure-name-constructor/output.json b/packages/babel-parser/test/fixtures/experimental/class-private-methods/failure-name-constructor/output.json new file mode 100644 index 000000000000..342fc174b592 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-methods/failure-name-constructor/output.json @@ -0,0 +1,158 @@ +{ + "type": "File", + "start": 0, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Classes may not have a private field named '#constructor' (2:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 9 + }, + "identifierName": "Foo" + }, + "name": "Foo" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 10, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": [ + { + "type": "ClassPrivateMethod", + "start": 14, + "end": 31, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 19 + } + }, + "static": false, + "key": { + "type": "PrivateName", + "start": 14, + "end": 26, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "id": { + "type": "Identifier", + "start": 15, + "end": 26, + "loc": { + "start": { + "line": 2, + "column": 3 + }, + "end": { + "line": 2, + "column": 14 + }, + "identifierName": "constructor" + }, + "name": "constructor" + } + }, + "kind": "method", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 29, + "end": 31, + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 19 + } + }, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-methods/failure-spaces/options.json b/packages/babel-parser/test/fixtures/experimental/class-private-methods/failure-spaces/options.json index 9914950b66fe..8d265ec66c23 100644 --- a/packages/babel-parser/test/fixtures/experimental/class-private-methods/failure-spaces/options.json +++ b/packages/babel-parser/test/fixtures/experimental/class-private-methods/failure-spaces/options.json @@ -1,4 +1,3 @@ { - "throws": "Unexpected space between # and identifier (2:3)", "plugins": ["classPrivateMethods"] } diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-methods/failure-spaces/output.json b/packages/babel-parser/test/fixtures/experimental/class-private-methods/failure-spaces/output.json new file mode 100644 index 000000000000..e126bf7fb5fb --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-methods/failure-spaces/output.json @@ -0,0 +1,207 @@ +{ + "type": "File", + "start": 0, + "end": 60, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Unexpected space between # and identifier (2:3)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 60, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 60, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 12 + }, + "identifierName": "Spaces" + }, + "name": "Spaces" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 13, + "end": 60, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "body": [ + { + "type": "ClassPrivateMethod", + "start": 17, + "end": 58, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 4, + "column": 3 + } + }, + "static": false, + "key": { + "type": "PrivateName", + "start": 17, + "end": 31, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 16 + } + }, + "id": { + "type": "Identifier", + "start": 20, + "end": 31, + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 16 + }, + "identifierName": "wrongSpaces" + }, + "name": "wrongSpaces" + } + }, + "kind": "method", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 34, + "end": 58, + "loc": { + "start": { + "line": 2, + "column": 19 + }, + "end": { + "line": 4, + "column": 3 + } + }, + "body": [ + { + "type": "ReturnStatement", + "start": 40, + "end": 54, + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 18 + } + }, + "argument": { + "type": "CallExpression", + "start": 47, + "end": 53, + "loc": { + "start": { + "line": 3, + "column": 11 + }, + "end": { + "line": 3, + "column": 17 + } + }, + "callee": { + "type": "Identifier", + "start": 47, + "end": 51, + "loc": { + "start": { + "line": 3, + "column": 11 + }, + "end": { + "line": 3, + "column": 15 + }, + "identifierName": "fail" + }, + "name": "fail" + }, + "arguments": [] + } + } + ], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/README.md b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/README.md new file mode 100644 index 000000000000..d8f726880604 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/README.md @@ -0,0 +1,26 @@ +These tests have been generated using the following script: + +```js +var feat = { + "field": "#x = 0;", + "method": "#x() {}", + "get": "get #x() {}", + "set": "set #x(_) {}", +}; +var placement = { + "static": "static ", + "instance": "" +} + +for (var f1 in feat) for (var f2 in feat) for (var p1 in placement) for (var p2 in placement) { + var code = `class A { + ${placement[p1]}${feat[f1]} + ${placement[p2]}${feat[f2]} +}`; + var name = `${p1}-${f1}-${p2}-${f2}`; + var folder = "packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/" + name; + + if (!fs.existsSync(folder)) fs.mkdirSync(folder); + fs.writeFileSync(folder + "/input.js", code); +} +``` \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-field-instance-field/input.js b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-field-instance-field/input.js new file mode 100644 index 000000000000..bb68229716d6 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-field-instance-field/input.js @@ -0,0 +1,4 @@ +class A { + #x = 0; + #x = 0; +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-field-instance-field/output.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-field-instance-field/output.json new file mode 100644 index 000000000000..b69a455a0f53 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-field-instance-field/output.json @@ -0,0 +1,224 @@ +{ + "type": "File", + "start": 0, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Duplicate private name #x (3:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "A" + }, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 8, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "body": [ + { + "type": "ClassPrivateProperty", + "start": 12, + "end": 19, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 9 + } + }, + "static": false, + "key": { + "type": "PrivateName", + "start": 12, + "end": 14, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 4 + } + }, + "id": { + "type": "Identifier", + "start": 13, + "end": 14, + "loc": { + "start": { + "line": 2, + "column": 3 + }, + "end": { + "line": 2, + "column": 4 + }, + "identifierName": "x" + }, + "name": "x" + } + }, + "value": { + "type": "NumericLiteral", + "start": 17, + "end": 18, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 8 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + }, + { + "type": "ClassPrivateProperty", + "start": 22, + "end": 29, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 9 + } + }, + "static": false, + "key": { + "type": "PrivateName", + "start": 22, + "end": 24, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 4 + } + }, + "id": { + "type": "Identifier", + "start": 23, + "end": 24, + "loc": { + "start": { + "line": 3, + "column": 3 + }, + "end": { + "line": 3, + "column": 4 + }, + "identifierName": "x" + }, + "name": "x" + } + }, + "value": { + "type": "NumericLiteral", + "start": 27, + "end": 28, + "loc": { + "start": { + "line": 3, + "column": 7 + }, + "end": { + "line": 3, + "column": 8 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-field-instance-get/input.js b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-field-instance-get/input.js new file mode 100644 index 000000000000..95514f1d83fd --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-field-instance-get/input.js @@ -0,0 +1,4 @@ +class A { + #x = 0; + get #x() {} +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-field-instance-get/options.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-field-instance-get/options.json new file mode 100644 index 000000000000..af02072af9d9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-field-instance-get/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["classPrivateProperties", "classPrivateMethods"] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-field-instance-get/output.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-field-instance-get/output.json new file mode 100644 index 000000000000..62a6d3a10f71 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-field-instance-get/output.json @@ -0,0 +1,227 @@ +{ + "type": "File", + "start": 0, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Duplicate private name #x (3:6)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "A" + }, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 8, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "body": [ + { + "type": "ClassPrivateProperty", + "start": 12, + "end": 19, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 9 + } + }, + "static": false, + "key": { + "type": "PrivateName", + "start": 12, + "end": 14, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 4 + } + }, + "id": { + "type": "Identifier", + "start": 13, + "end": 14, + "loc": { + "start": { + "line": 2, + "column": 3 + }, + "end": { + "line": 2, + "column": 4 + }, + "identifierName": "x" + }, + "name": "x" + } + }, + "value": { + "type": "NumericLiteral", + "start": 17, + "end": 18, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 8 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + }, + { + "type": "ClassPrivateMethod", + "start": 22, + "end": 33, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 13 + } + }, + "static": false, + "key": { + "type": "PrivateName", + "start": 26, + "end": 28, + "loc": { + "start": { + "line": 3, + "column": 6 + }, + "end": { + "line": 3, + "column": 8 + } + }, + "id": { + "type": "Identifier", + "start": 27, + "end": 28, + "loc": { + "start": { + "line": 3, + "column": 7 + }, + "end": { + "line": 3, + "column": 8 + }, + "identifierName": "x" + }, + "name": "x" + } + }, + "computed": false, + "kind": "get", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 31, + "end": 33, + "loc": { + "start": { + "line": 3, + "column": 11 + }, + "end": { + "line": 3, + "column": 13 + } + }, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-field-instance-method/input.js b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-field-instance-method/input.js new file mode 100644 index 000000000000..82fa3236ab43 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-field-instance-method/input.js @@ -0,0 +1,4 @@ +class A { + #x = 0; + #x() {} +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-field-instance-method/options.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-field-instance-method/options.json new file mode 100644 index 000000000000..af02072af9d9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-field-instance-method/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["classPrivateProperties", "classPrivateMethods"] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-field-instance-method/output.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-field-instance-method/output.json new file mode 100644 index 000000000000..0d301cbb847c --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-field-instance-method/output.json @@ -0,0 +1,226 @@ +{ + "type": "File", + "start": 0, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Duplicate private name #x (3:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "A" + }, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 8, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "body": [ + { + "type": "ClassPrivateProperty", + "start": 12, + "end": 19, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 9 + } + }, + "static": false, + "key": { + "type": "PrivateName", + "start": 12, + "end": 14, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 4 + } + }, + "id": { + "type": "Identifier", + "start": 13, + "end": 14, + "loc": { + "start": { + "line": 2, + "column": 3 + }, + "end": { + "line": 2, + "column": 4 + }, + "identifierName": "x" + }, + "name": "x" + } + }, + "value": { + "type": "NumericLiteral", + "start": 17, + "end": 18, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 8 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + }, + { + "type": "ClassPrivateMethod", + "start": 22, + "end": 29, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 9 + } + }, + "static": false, + "key": { + "type": "PrivateName", + "start": 22, + "end": 24, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 4 + } + }, + "id": { + "type": "Identifier", + "start": 23, + "end": 24, + "loc": { + "start": { + "line": 3, + "column": 3 + }, + "end": { + "line": 3, + "column": 4 + }, + "identifierName": "x" + }, + "name": "x" + } + }, + "kind": "method", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 27, + "end": 29, + "loc": { + "start": { + "line": 3, + "column": 7 + }, + "end": { + "line": 3, + "column": 9 + } + }, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-field-instance-set/input.js b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-field-instance-set/input.js new file mode 100644 index 000000000000..4bb80c110229 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-field-instance-set/input.js @@ -0,0 +1,4 @@ +class A { + #x = 0; + set #x(_) {} +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-field-instance-set/options.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-field-instance-set/options.json new file mode 100644 index 000000000000..af02072af9d9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-field-instance-set/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["classPrivateProperties", "classPrivateMethods"] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-field-instance-set/output.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-field-instance-set/output.json new file mode 100644 index 000000000000..99af2b8a69a0 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-field-instance-set/output.json @@ -0,0 +1,245 @@ +{ + "type": "File", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Duplicate private name #x (3:6)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "A" + }, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 8, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "body": [ + { + "type": "ClassPrivateProperty", + "start": 12, + "end": 19, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 9 + } + }, + "static": false, + "key": { + "type": "PrivateName", + "start": 12, + "end": 14, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 4 + } + }, + "id": { + "type": "Identifier", + "start": 13, + "end": 14, + "loc": { + "start": { + "line": 2, + "column": 3 + }, + "end": { + "line": 2, + "column": 4 + }, + "identifierName": "x" + }, + "name": "x" + } + }, + "value": { + "type": "NumericLiteral", + "start": 17, + "end": 18, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 8 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + }, + { + "type": "ClassPrivateMethod", + "start": 22, + "end": 34, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 14 + } + }, + "static": false, + "key": { + "type": "PrivateName", + "start": 26, + "end": 28, + "loc": { + "start": { + "line": 3, + "column": 6 + }, + "end": { + "line": 3, + "column": 8 + } + }, + "id": { + "type": "Identifier", + "start": 27, + "end": 28, + "loc": { + "start": { + "line": 3, + "column": 7 + }, + "end": { + "line": 3, + "column": 8 + }, + "identifierName": "x" + }, + "name": "x" + } + }, + "computed": false, + "kind": "set", + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 29, + "end": 30, + "loc": { + "start": { + "line": 3, + "column": 9 + }, + "end": { + "line": 3, + "column": 10 + }, + "identifierName": "_" + }, + "name": "_" + } + ], + "body": { + "type": "BlockStatement", + "start": 32, + "end": 34, + "loc": { + "start": { + "line": 3, + "column": 12 + }, + "end": { + "line": 3, + "column": 14 + } + }, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-field-static-field/input.js b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-field-static-field/input.js new file mode 100644 index 000000000000..67c3cc794ef3 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-field-static-field/input.js @@ -0,0 +1,4 @@ +class A { + #x = 0; + static #x = 0; +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-field-static-field/options.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-field-static-field/options.json new file mode 100644 index 000000000000..af02072af9d9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-field-static-field/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["classPrivateProperties", "classPrivateMethods"] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-field-static-field/output.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-field-static-field/output.json new file mode 100644 index 000000000000..45ed934caa5d --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-field-static-field/output.json @@ -0,0 +1,224 @@ +{ + "type": "File", + "start": 0, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Duplicate private name #x (3:9)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "A" + }, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 8, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "body": [ + { + "type": "ClassPrivateProperty", + "start": 12, + "end": 19, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 9 + } + }, + "static": false, + "key": { + "type": "PrivateName", + "start": 12, + "end": 14, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 4 + } + }, + "id": { + "type": "Identifier", + "start": 13, + "end": 14, + "loc": { + "start": { + "line": 2, + "column": 3 + }, + "end": { + "line": 2, + "column": 4 + }, + "identifierName": "x" + }, + "name": "x" + } + }, + "value": { + "type": "NumericLiteral", + "start": 17, + "end": 18, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 8 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + }, + { + "type": "ClassPrivateProperty", + "start": 22, + "end": 36, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 16 + } + }, + "static": true, + "key": { + "type": "PrivateName", + "start": 29, + "end": 31, + "loc": { + "start": { + "line": 3, + "column": 9 + }, + "end": { + "line": 3, + "column": 11 + } + }, + "id": { + "type": "Identifier", + "start": 30, + "end": 31, + "loc": { + "start": { + "line": 3, + "column": 10 + }, + "end": { + "line": 3, + "column": 11 + }, + "identifierName": "x" + }, + "name": "x" + } + }, + "value": { + "type": "NumericLiteral", + "start": 34, + "end": 35, + "loc": { + "start": { + "line": 3, + "column": 14 + }, + "end": { + "line": 3, + "column": 15 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-field-static-get/input.js b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-field-static-get/input.js new file mode 100644 index 000000000000..1f53201d6970 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-field-static-get/input.js @@ -0,0 +1,4 @@ +class A { + #x = 0; + static get #x() {} +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-field-static-get/options.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-field-static-get/options.json new file mode 100644 index 000000000000..af02072af9d9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-field-static-get/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["classPrivateProperties", "classPrivateMethods"] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-field-static-get/output.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-field-static-get/output.json new file mode 100644 index 000000000000..d4e1a7d1e628 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-field-static-get/output.json @@ -0,0 +1,227 @@ +{ + "type": "File", + "start": 0, + "end": 42, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Duplicate private name #x (3:13)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 42, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 42, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "A" + }, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 8, + "end": 42, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "body": [ + { + "type": "ClassPrivateProperty", + "start": 12, + "end": 19, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 9 + } + }, + "static": false, + "key": { + "type": "PrivateName", + "start": 12, + "end": 14, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 4 + } + }, + "id": { + "type": "Identifier", + "start": 13, + "end": 14, + "loc": { + "start": { + "line": 2, + "column": 3 + }, + "end": { + "line": 2, + "column": 4 + }, + "identifierName": "x" + }, + "name": "x" + } + }, + "value": { + "type": "NumericLiteral", + "start": 17, + "end": 18, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 8 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + }, + { + "type": "ClassPrivateMethod", + "start": 22, + "end": 40, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 20 + } + }, + "static": true, + "key": { + "type": "PrivateName", + "start": 33, + "end": 35, + "loc": { + "start": { + "line": 3, + "column": 13 + }, + "end": { + "line": 3, + "column": 15 + } + }, + "id": { + "type": "Identifier", + "start": 34, + "end": 35, + "loc": { + "start": { + "line": 3, + "column": 14 + }, + "end": { + "line": 3, + "column": 15 + }, + "identifierName": "x" + }, + "name": "x" + } + }, + "computed": false, + "kind": "get", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 38, + "end": 40, + "loc": { + "start": { + "line": 3, + "column": 18 + }, + "end": { + "line": 3, + "column": 20 + } + }, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-field-static-method/input.js b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-field-static-method/input.js new file mode 100644 index 000000000000..a1229c8992f1 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-field-static-method/input.js @@ -0,0 +1,4 @@ +class A { + #x = 0; + static #x() {} +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-field-static-method/options.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-field-static-method/options.json new file mode 100644 index 000000000000..af02072af9d9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-field-static-method/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["classPrivateProperties", "classPrivateMethods"] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-field-static-method/output.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-field-static-method/output.json new file mode 100644 index 000000000000..3fa0178df710 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-field-static-method/output.json @@ -0,0 +1,226 @@ +{ + "type": "File", + "start": 0, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Duplicate private name #x (3:9)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "A" + }, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 8, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "body": [ + { + "type": "ClassPrivateProperty", + "start": 12, + "end": 19, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 9 + } + }, + "static": false, + "key": { + "type": "PrivateName", + "start": 12, + "end": 14, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 4 + } + }, + "id": { + "type": "Identifier", + "start": 13, + "end": 14, + "loc": { + "start": { + "line": 2, + "column": 3 + }, + "end": { + "line": 2, + "column": 4 + }, + "identifierName": "x" + }, + "name": "x" + } + }, + "value": { + "type": "NumericLiteral", + "start": 17, + "end": 18, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 8 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + }, + { + "type": "ClassPrivateMethod", + "start": 22, + "end": 36, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 16 + } + }, + "static": true, + "key": { + "type": "PrivateName", + "start": 29, + "end": 31, + "loc": { + "start": { + "line": 3, + "column": 9 + }, + "end": { + "line": 3, + "column": 11 + } + }, + "id": { + "type": "Identifier", + "start": 30, + "end": 31, + "loc": { + "start": { + "line": 3, + "column": 10 + }, + "end": { + "line": 3, + "column": 11 + }, + "identifierName": "x" + }, + "name": "x" + } + }, + "kind": "method", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 34, + "end": 36, + "loc": { + "start": { + "line": 3, + "column": 14 + }, + "end": { + "line": 3, + "column": 16 + } + }, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-field-static-set/input.js b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-field-static-set/input.js new file mode 100644 index 000000000000..4221a39406f9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-field-static-set/input.js @@ -0,0 +1,4 @@ +class A { + #x = 0; + static set #x(_) {} +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-field-static-set/options.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-field-static-set/options.json new file mode 100644 index 000000000000..af02072af9d9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-field-static-set/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["classPrivateProperties", "classPrivateMethods"] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-field-static-set/output.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-field-static-set/output.json new file mode 100644 index 000000000000..3e3d50633689 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-field-static-set/output.json @@ -0,0 +1,245 @@ +{ + "type": "File", + "start": 0, + "end": 43, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Duplicate private name #x (3:13)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 43, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 43, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "A" + }, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 8, + "end": 43, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "body": [ + { + "type": "ClassPrivateProperty", + "start": 12, + "end": 19, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 9 + } + }, + "static": false, + "key": { + "type": "PrivateName", + "start": 12, + "end": 14, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 4 + } + }, + "id": { + "type": "Identifier", + "start": 13, + "end": 14, + "loc": { + "start": { + "line": 2, + "column": 3 + }, + "end": { + "line": 2, + "column": 4 + }, + "identifierName": "x" + }, + "name": "x" + } + }, + "value": { + "type": "NumericLiteral", + "start": 17, + "end": 18, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 8 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + }, + { + "type": "ClassPrivateMethod", + "start": 22, + "end": 41, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 21 + } + }, + "static": true, + "key": { + "type": "PrivateName", + "start": 33, + "end": 35, + "loc": { + "start": { + "line": 3, + "column": 13 + }, + "end": { + "line": 3, + "column": 15 + } + }, + "id": { + "type": "Identifier", + "start": 34, + "end": 35, + "loc": { + "start": { + "line": 3, + "column": 14 + }, + "end": { + "line": 3, + "column": 15 + }, + "identifierName": "x" + }, + "name": "x" + } + }, + "computed": false, + "kind": "set", + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 36, + "end": 37, + "loc": { + "start": { + "line": 3, + "column": 16 + }, + "end": { + "line": 3, + "column": 17 + }, + "identifierName": "_" + }, + "name": "_" + } + ], + "body": { + "type": "BlockStatement", + "start": 39, + "end": 41, + "loc": { + "start": { + "line": 3, + "column": 19 + }, + "end": { + "line": 3, + "column": 21 + } + }, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-get-instance-field/input.js b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-get-instance-field/input.js new file mode 100644 index 000000000000..45adc3907e0a --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-get-instance-field/input.js @@ -0,0 +1,4 @@ +class A { + get #x() {} + #x = 0; +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-get-instance-field/options.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-get-instance-field/options.json new file mode 100644 index 000000000000..af02072af9d9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-get-instance-field/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["classPrivateProperties", "classPrivateMethods"] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-get-instance-field/output.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-get-instance-field/output.json new file mode 100644 index 000000000000..e7c6f5e6bb2e --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-get-instance-field/output.json @@ -0,0 +1,227 @@ +{ + "type": "File", + "start": 0, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Duplicate private name #x (3:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "A" + }, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 8, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "body": [ + { + "type": "ClassPrivateMethod", + "start": 12, + "end": 23, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 13 + } + }, + "static": false, + "key": { + "type": "PrivateName", + "start": 16, + "end": 18, + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 8 + } + }, + "id": { + "type": "Identifier", + "start": 17, + "end": 18, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 8 + }, + "identifierName": "x" + }, + "name": "x" + } + }, + "computed": false, + "kind": "get", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 21, + "end": 23, + "loc": { + "start": { + "line": 2, + "column": 11 + }, + "end": { + "line": 2, + "column": 13 + } + }, + "body": [], + "directives": [] + } + }, + { + "type": "ClassPrivateProperty", + "start": 26, + "end": 33, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 9 + } + }, + "static": false, + "key": { + "type": "PrivateName", + "start": 26, + "end": 28, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 4 + } + }, + "id": { + "type": "Identifier", + "start": 27, + "end": 28, + "loc": { + "start": { + "line": 3, + "column": 3 + }, + "end": { + "line": 3, + "column": 4 + }, + "identifierName": "x" + }, + "name": "x" + } + }, + "value": { + "type": "NumericLiteral", + "start": 31, + "end": 32, + "loc": { + "start": { + "line": 3, + "column": 7 + }, + "end": { + "line": 3, + "column": 8 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-get-instance-get/input.js b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-get-instance-get/input.js new file mode 100644 index 000000000000..7818246e3fd0 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-get-instance-get/input.js @@ -0,0 +1,4 @@ +class A { + get #x() {} + get #x() {} +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-get-instance-get/options.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-get-instance-get/options.json new file mode 100644 index 000000000000..af02072af9d9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-get-instance-get/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["classPrivateProperties", "classPrivateMethods"] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-get-instance-get/output.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-get-instance-get/output.json new file mode 100644 index 000000000000..c63e32cca838 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-get-instance-get/output.json @@ -0,0 +1,230 @@ +{ + "type": "File", + "start": 0, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Duplicate private name #x (3:6)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "A" + }, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 8, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "body": [ + { + "type": "ClassPrivateMethod", + "start": 12, + "end": 23, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 13 + } + }, + "static": false, + "key": { + "type": "PrivateName", + "start": 16, + "end": 18, + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 8 + } + }, + "id": { + "type": "Identifier", + "start": 17, + "end": 18, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 8 + }, + "identifierName": "x" + }, + "name": "x" + } + }, + "computed": false, + "kind": "get", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 21, + "end": 23, + "loc": { + "start": { + "line": 2, + "column": 11 + }, + "end": { + "line": 2, + "column": 13 + } + }, + "body": [], + "directives": [] + } + }, + { + "type": "ClassPrivateMethod", + "start": 26, + "end": 37, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 13 + } + }, + "static": false, + "key": { + "type": "PrivateName", + "start": 30, + "end": 32, + "loc": { + "start": { + "line": 3, + "column": 6 + }, + "end": { + "line": 3, + "column": 8 + } + }, + "id": { + "type": "Identifier", + "start": 31, + "end": 32, + "loc": { + "start": { + "line": 3, + "column": 7 + }, + "end": { + "line": 3, + "column": 8 + }, + "identifierName": "x" + }, + "name": "x" + } + }, + "computed": false, + "kind": "get", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 35, + "end": 37, + "loc": { + "start": { + "line": 3, + "column": 11 + }, + "end": { + "line": 3, + "column": 13 + } + }, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-get-instance-method/input.js b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-get-instance-method/input.js new file mode 100644 index 000000000000..00d50846e973 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-get-instance-method/input.js @@ -0,0 +1,4 @@ +class A { + get #x() {} + #x() {} +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-get-instance-method/options.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-get-instance-method/options.json new file mode 100644 index 000000000000..af02072af9d9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-get-instance-method/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["classPrivateProperties", "classPrivateMethods"] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-get-instance-method/output.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-get-instance-method/output.json new file mode 100644 index 000000000000..9fa1c2917097 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-get-instance-method/output.json @@ -0,0 +1,229 @@ +{ + "type": "File", + "start": 0, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Duplicate private name #x (3:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "A" + }, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 8, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "body": [ + { + "type": "ClassPrivateMethod", + "start": 12, + "end": 23, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 13 + } + }, + "static": false, + "key": { + "type": "PrivateName", + "start": 16, + "end": 18, + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 8 + } + }, + "id": { + "type": "Identifier", + "start": 17, + "end": 18, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 8 + }, + "identifierName": "x" + }, + "name": "x" + } + }, + "computed": false, + "kind": "get", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 21, + "end": 23, + "loc": { + "start": { + "line": 2, + "column": 11 + }, + "end": { + "line": 2, + "column": 13 + } + }, + "body": [], + "directives": [] + } + }, + { + "type": "ClassPrivateMethod", + "start": 26, + "end": 33, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 9 + } + }, + "static": false, + "key": { + "type": "PrivateName", + "start": 26, + "end": 28, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 4 + } + }, + "id": { + "type": "Identifier", + "start": 27, + "end": 28, + "loc": { + "start": { + "line": 3, + "column": 3 + }, + "end": { + "line": 3, + "column": 4 + }, + "identifierName": "x" + }, + "name": "x" + } + }, + "kind": "method", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 31, + "end": 33, + "loc": { + "start": { + "line": 3, + "column": 7 + }, + "end": { + "line": 3, + "column": 9 + } + }, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-get-instance-set/input.js b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-get-instance-set/input.js new file mode 100644 index 000000000000..f5b4f4bb8764 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-get-instance-set/input.js @@ -0,0 +1,4 @@ +class A { + get #x() {} + set #x(_) {} +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-get-instance-set/output.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-get-instance-set/output.json new file mode 100644 index 000000000000..109fbb70bafe --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-get-instance-set/output.json @@ -0,0 +1,245 @@ +{ + "type": "File", + "start": 0, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "A" + }, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 8, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "body": [ + { + "type": "ClassPrivateMethod", + "start": 12, + "end": 23, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 13 + } + }, + "static": false, + "key": { + "type": "PrivateName", + "start": 16, + "end": 18, + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 8 + } + }, + "id": { + "type": "Identifier", + "start": 17, + "end": 18, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 8 + }, + "identifierName": "x" + }, + "name": "x" + } + }, + "computed": false, + "kind": "get", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 21, + "end": 23, + "loc": { + "start": { + "line": 2, + "column": 11 + }, + "end": { + "line": 2, + "column": 13 + } + }, + "body": [], + "directives": [] + } + }, + { + "type": "ClassPrivateMethod", + "start": 26, + "end": 38, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 14 + } + }, + "static": false, + "key": { + "type": "PrivateName", + "start": 30, + "end": 32, + "loc": { + "start": { + "line": 3, + "column": 6 + }, + "end": { + "line": 3, + "column": 8 + } + }, + "id": { + "type": "Identifier", + "start": 31, + "end": 32, + "loc": { + "start": { + "line": 3, + "column": 7 + }, + "end": { + "line": 3, + "column": 8 + }, + "identifierName": "x" + }, + "name": "x" + } + }, + "computed": false, + "kind": "set", + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 33, + "end": 34, + "loc": { + "start": { + "line": 3, + "column": 9 + }, + "end": { + "line": 3, + "column": 10 + }, + "identifierName": "_" + }, + "name": "_" + } + ], + "body": { + "type": "BlockStatement", + "start": 36, + "end": 38, + "loc": { + "start": { + "line": 3, + "column": 12 + }, + "end": { + "line": 3, + "column": 14 + } + }, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-get-static-field/input.js b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-get-static-field/input.js new file mode 100644 index 000000000000..c915535f827c --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-get-static-field/input.js @@ -0,0 +1,4 @@ +class A { + get #x() {} + static #x = 0; +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-get-static-field/options.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-get-static-field/options.json new file mode 100644 index 000000000000..af02072af9d9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-get-static-field/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["classPrivateProperties", "classPrivateMethods"] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-get-static-field/output.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-get-static-field/output.json new file mode 100644 index 000000000000..5c6ec686f516 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-get-static-field/output.json @@ -0,0 +1,227 @@ +{ + "type": "File", + "start": 0, + "end": 42, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Duplicate private name #x (3:9)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 42, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 42, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "A" + }, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 8, + "end": 42, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "body": [ + { + "type": "ClassPrivateMethod", + "start": 12, + "end": 23, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 13 + } + }, + "static": false, + "key": { + "type": "PrivateName", + "start": 16, + "end": 18, + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 8 + } + }, + "id": { + "type": "Identifier", + "start": 17, + "end": 18, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 8 + }, + "identifierName": "x" + }, + "name": "x" + } + }, + "computed": false, + "kind": "get", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 21, + "end": 23, + "loc": { + "start": { + "line": 2, + "column": 11 + }, + "end": { + "line": 2, + "column": 13 + } + }, + "body": [], + "directives": [] + } + }, + { + "type": "ClassPrivateProperty", + "start": 26, + "end": 40, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 16 + } + }, + "static": true, + "key": { + "type": "PrivateName", + "start": 33, + "end": 35, + "loc": { + "start": { + "line": 3, + "column": 9 + }, + "end": { + "line": 3, + "column": 11 + } + }, + "id": { + "type": "Identifier", + "start": 34, + "end": 35, + "loc": { + "start": { + "line": 3, + "column": 10 + }, + "end": { + "line": 3, + "column": 11 + }, + "identifierName": "x" + }, + "name": "x" + } + }, + "value": { + "type": "NumericLiteral", + "start": 38, + "end": 39, + "loc": { + "start": { + "line": 3, + "column": 14 + }, + "end": { + "line": 3, + "column": 15 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-get-static-get/input.js b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-get-static-get/input.js new file mode 100644 index 000000000000..88136bae1fe0 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-get-static-get/input.js @@ -0,0 +1,4 @@ +class A { + get #x() {} + static get #x() {} +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-get-static-get/options.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-get-static-get/options.json new file mode 100644 index 000000000000..af02072af9d9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-get-static-get/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["classPrivateProperties", "classPrivateMethods"] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-get-static-get/output.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-get-static-get/output.json new file mode 100644 index 000000000000..65ec3150bbea --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-get-static-get/output.json @@ -0,0 +1,230 @@ +{ + "type": "File", + "start": 0, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Duplicate private name #x (3:13)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "A" + }, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 8, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "body": [ + { + "type": "ClassPrivateMethod", + "start": 12, + "end": 23, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 13 + } + }, + "static": false, + "key": { + "type": "PrivateName", + "start": 16, + "end": 18, + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 8 + } + }, + "id": { + "type": "Identifier", + "start": 17, + "end": 18, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 8 + }, + "identifierName": "x" + }, + "name": "x" + } + }, + "computed": false, + "kind": "get", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 21, + "end": 23, + "loc": { + "start": { + "line": 2, + "column": 11 + }, + "end": { + "line": 2, + "column": 13 + } + }, + "body": [], + "directives": [] + } + }, + { + "type": "ClassPrivateMethod", + "start": 26, + "end": 44, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 20 + } + }, + "static": true, + "key": { + "type": "PrivateName", + "start": 37, + "end": 39, + "loc": { + "start": { + "line": 3, + "column": 13 + }, + "end": { + "line": 3, + "column": 15 + } + }, + "id": { + "type": "Identifier", + "start": 38, + "end": 39, + "loc": { + "start": { + "line": 3, + "column": 14 + }, + "end": { + "line": 3, + "column": 15 + }, + "identifierName": "x" + }, + "name": "x" + } + }, + "computed": false, + "kind": "get", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 42, + "end": 44, + "loc": { + "start": { + "line": 3, + "column": 18 + }, + "end": { + "line": 3, + "column": 20 + } + }, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-get-static-method/input.js b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-get-static-method/input.js new file mode 100644 index 000000000000..73288616ed47 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-get-static-method/input.js @@ -0,0 +1,4 @@ +class A { + get #x() {} + static #x() {} +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-get-static-method/options.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-get-static-method/options.json new file mode 100644 index 000000000000..af02072af9d9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-get-static-method/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["classPrivateProperties", "classPrivateMethods"] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-get-static-method/output.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-get-static-method/output.json new file mode 100644 index 000000000000..68c3ff18b28b --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-get-static-method/output.json @@ -0,0 +1,229 @@ +{ + "type": "File", + "start": 0, + "end": 42, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Duplicate private name #x (3:9)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 42, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 42, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "A" + }, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 8, + "end": 42, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "body": [ + { + "type": "ClassPrivateMethod", + "start": 12, + "end": 23, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 13 + } + }, + "static": false, + "key": { + "type": "PrivateName", + "start": 16, + "end": 18, + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 8 + } + }, + "id": { + "type": "Identifier", + "start": 17, + "end": 18, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 8 + }, + "identifierName": "x" + }, + "name": "x" + } + }, + "computed": false, + "kind": "get", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 21, + "end": 23, + "loc": { + "start": { + "line": 2, + "column": 11 + }, + "end": { + "line": 2, + "column": 13 + } + }, + "body": [], + "directives": [] + } + }, + { + "type": "ClassPrivateMethod", + "start": 26, + "end": 40, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 16 + } + }, + "static": true, + "key": { + "type": "PrivateName", + "start": 33, + "end": 35, + "loc": { + "start": { + "line": 3, + "column": 9 + }, + "end": { + "line": 3, + "column": 11 + } + }, + "id": { + "type": "Identifier", + "start": 34, + "end": 35, + "loc": { + "start": { + "line": 3, + "column": 10 + }, + "end": { + "line": 3, + "column": 11 + }, + "identifierName": "x" + }, + "name": "x" + } + }, + "kind": "method", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 38, + "end": 40, + "loc": { + "start": { + "line": 3, + "column": 14 + }, + "end": { + "line": 3, + "column": 16 + } + }, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-get-static-set/input.js b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-get-static-set/input.js new file mode 100644 index 000000000000..bce8d6c24669 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-get-static-set/input.js @@ -0,0 +1,4 @@ +class A { + get #x() {} + static set #x(_) {} +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-get-static-set/options.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-get-static-set/options.json new file mode 100644 index 000000000000..af02072af9d9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-get-static-set/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["classPrivateProperties", "classPrivateMethods"] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-get-static-set/output.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-get-static-set/output.json new file mode 100644 index 000000000000..470062c22b80 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-get-static-set/output.json @@ -0,0 +1,248 @@ +{ + "type": "File", + "start": 0, + "end": 47, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Duplicate private name #x (3:13)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 47, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 47, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "A" + }, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 8, + "end": 47, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "body": [ + { + "type": "ClassPrivateMethod", + "start": 12, + "end": 23, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 13 + } + }, + "static": false, + "key": { + "type": "PrivateName", + "start": 16, + "end": 18, + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 8 + } + }, + "id": { + "type": "Identifier", + "start": 17, + "end": 18, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 8 + }, + "identifierName": "x" + }, + "name": "x" + } + }, + "computed": false, + "kind": "get", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 21, + "end": 23, + "loc": { + "start": { + "line": 2, + "column": 11 + }, + "end": { + "line": 2, + "column": 13 + } + }, + "body": [], + "directives": [] + } + }, + { + "type": "ClassPrivateMethod", + "start": 26, + "end": 45, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 21 + } + }, + "static": true, + "key": { + "type": "PrivateName", + "start": 37, + "end": 39, + "loc": { + "start": { + "line": 3, + "column": 13 + }, + "end": { + "line": 3, + "column": 15 + } + }, + "id": { + "type": "Identifier", + "start": 38, + "end": 39, + "loc": { + "start": { + "line": 3, + "column": 14 + }, + "end": { + "line": 3, + "column": 15 + }, + "identifierName": "x" + }, + "name": "x" + } + }, + "computed": false, + "kind": "set", + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 40, + "end": 41, + "loc": { + "start": { + "line": 3, + "column": 16 + }, + "end": { + "line": 3, + "column": 17 + }, + "identifierName": "_" + }, + "name": "_" + } + ], + "body": { + "type": "BlockStatement", + "start": 43, + "end": 45, + "loc": { + "start": { + "line": 3, + "column": 19 + }, + "end": { + "line": 3, + "column": 21 + } + }, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-method-instance-field/input.js b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-method-instance-field/input.js new file mode 100644 index 000000000000..48e8c322691f --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-method-instance-field/input.js @@ -0,0 +1,4 @@ +class A { + #x() {} + #x = 0; +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-method-instance-field/options.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-method-instance-field/options.json new file mode 100644 index 000000000000..af02072af9d9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-method-instance-field/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["classPrivateProperties", "classPrivateMethods"] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-method-instance-field/output.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-method-instance-field/output.json new file mode 100644 index 000000000000..d32285dc3ae0 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-method-instance-field/output.json @@ -0,0 +1,226 @@ +{ + "type": "File", + "start": 0, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Duplicate private name #x (3:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "A" + }, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 8, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "body": [ + { + "type": "ClassPrivateMethod", + "start": 12, + "end": 19, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 9 + } + }, + "static": false, + "key": { + "type": "PrivateName", + "start": 12, + "end": 14, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 4 + } + }, + "id": { + "type": "Identifier", + "start": 13, + "end": 14, + "loc": { + "start": { + "line": 2, + "column": 3 + }, + "end": { + "line": 2, + "column": 4 + }, + "identifierName": "x" + }, + "name": "x" + } + }, + "kind": "method", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 19, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 9 + } + }, + "body": [], + "directives": [] + } + }, + { + "type": "ClassPrivateProperty", + "start": 22, + "end": 29, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 9 + } + }, + "static": false, + "key": { + "type": "PrivateName", + "start": 22, + "end": 24, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 4 + } + }, + "id": { + "type": "Identifier", + "start": 23, + "end": 24, + "loc": { + "start": { + "line": 3, + "column": 3 + }, + "end": { + "line": 3, + "column": 4 + }, + "identifierName": "x" + }, + "name": "x" + } + }, + "value": { + "type": "NumericLiteral", + "start": 27, + "end": 28, + "loc": { + "start": { + "line": 3, + "column": 7 + }, + "end": { + "line": 3, + "column": 8 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-method-instance-get/input.js b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-method-instance-get/input.js new file mode 100644 index 000000000000..b1d19924d288 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-method-instance-get/input.js @@ -0,0 +1,4 @@ +class A { + #x() {} + get #x() {} +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-method-instance-get/options.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-method-instance-get/options.json new file mode 100644 index 000000000000..af02072af9d9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-method-instance-get/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["classPrivateProperties", "classPrivateMethods"] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-method-instance-get/output.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-method-instance-get/output.json new file mode 100644 index 000000000000..8dbf70cdb04b --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-method-instance-get/output.json @@ -0,0 +1,229 @@ +{ + "type": "File", + "start": 0, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Duplicate private name #x (3:6)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "A" + }, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 8, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "body": [ + { + "type": "ClassPrivateMethod", + "start": 12, + "end": 19, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 9 + } + }, + "static": false, + "key": { + "type": "PrivateName", + "start": 12, + "end": 14, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 4 + } + }, + "id": { + "type": "Identifier", + "start": 13, + "end": 14, + "loc": { + "start": { + "line": 2, + "column": 3 + }, + "end": { + "line": 2, + "column": 4 + }, + "identifierName": "x" + }, + "name": "x" + } + }, + "kind": "method", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 19, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 9 + } + }, + "body": [], + "directives": [] + } + }, + { + "type": "ClassPrivateMethod", + "start": 22, + "end": 33, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 13 + } + }, + "static": false, + "key": { + "type": "PrivateName", + "start": 26, + "end": 28, + "loc": { + "start": { + "line": 3, + "column": 6 + }, + "end": { + "line": 3, + "column": 8 + } + }, + "id": { + "type": "Identifier", + "start": 27, + "end": 28, + "loc": { + "start": { + "line": 3, + "column": 7 + }, + "end": { + "line": 3, + "column": 8 + }, + "identifierName": "x" + }, + "name": "x" + } + }, + "computed": false, + "kind": "get", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 31, + "end": 33, + "loc": { + "start": { + "line": 3, + "column": 11 + }, + "end": { + "line": 3, + "column": 13 + } + }, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-method-instance-method/input.js b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-method-instance-method/input.js new file mode 100644 index 000000000000..c1a8a11a361a --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-method-instance-method/input.js @@ -0,0 +1,4 @@ +class A { + #x() {} + #x() {} +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-method-instance-method/options.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-method-instance-method/options.json new file mode 100644 index 000000000000..af02072af9d9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-method-instance-method/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["classPrivateProperties", "classPrivateMethods"] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-method-instance-method/output.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-method-instance-method/output.json new file mode 100644 index 000000000000..7fe8d83f31e1 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-method-instance-method/output.json @@ -0,0 +1,228 @@ +{ + "type": "File", + "start": 0, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Duplicate private name #x (3:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "A" + }, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 8, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "body": [ + { + "type": "ClassPrivateMethod", + "start": 12, + "end": 19, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 9 + } + }, + "static": false, + "key": { + "type": "PrivateName", + "start": 12, + "end": 14, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 4 + } + }, + "id": { + "type": "Identifier", + "start": 13, + "end": 14, + "loc": { + "start": { + "line": 2, + "column": 3 + }, + "end": { + "line": 2, + "column": 4 + }, + "identifierName": "x" + }, + "name": "x" + } + }, + "kind": "method", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 19, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 9 + } + }, + "body": [], + "directives": [] + } + }, + { + "type": "ClassPrivateMethod", + "start": 22, + "end": 29, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 9 + } + }, + "static": false, + "key": { + "type": "PrivateName", + "start": 22, + "end": 24, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 4 + } + }, + "id": { + "type": "Identifier", + "start": 23, + "end": 24, + "loc": { + "start": { + "line": 3, + "column": 3 + }, + "end": { + "line": 3, + "column": 4 + }, + "identifierName": "x" + }, + "name": "x" + } + }, + "kind": "method", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 27, + "end": 29, + "loc": { + "start": { + "line": 3, + "column": 7 + }, + "end": { + "line": 3, + "column": 9 + } + }, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-method-instance-set/input.js b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-method-instance-set/input.js new file mode 100644 index 000000000000..3ac461db7a73 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-method-instance-set/input.js @@ -0,0 +1,4 @@ +class A { + #x() {} + set #x(_) {} +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-method-instance-set/options.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-method-instance-set/options.json new file mode 100644 index 000000000000..af02072af9d9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-method-instance-set/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["classPrivateProperties", "classPrivateMethods"] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-method-instance-set/output.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-method-instance-set/output.json new file mode 100644 index 000000000000..35d6a2f29be3 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-method-instance-set/output.json @@ -0,0 +1,247 @@ +{ + "type": "File", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Duplicate private name #x (3:6)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "A" + }, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 8, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "body": [ + { + "type": "ClassPrivateMethod", + "start": 12, + "end": 19, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 9 + } + }, + "static": false, + "key": { + "type": "PrivateName", + "start": 12, + "end": 14, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 4 + } + }, + "id": { + "type": "Identifier", + "start": 13, + "end": 14, + "loc": { + "start": { + "line": 2, + "column": 3 + }, + "end": { + "line": 2, + "column": 4 + }, + "identifierName": "x" + }, + "name": "x" + } + }, + "kind": "method", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 19, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 9 + } + }, + "body": [], + "directives": [] + } + }, + { + "type": "ClassPrivateMethod", + "start": 22, + "end": 34, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 14 + } + }, + "static": false, + "key": { + "type": "PrivateName", + "start": 26, + "end": 28, + "loc": { + "start": { + "line": 3, + "column": 6 + }, + "end": { + "line": 3, + "column": 8 + } + }, + "id": { + "type": "Identifier", + "start": 27, + "end": 28, + "loc": { + "start": { + "line": 3, + "column": 7 + }, + "end": { + "line": 3, + "column": 8 + }, + "identifierName": "x" + }, + "name": "x" + } + }, + "computed": false, + "kind": "set", + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 29, + "end": 30, + "loc": { + "start": { + "line": 3, + "column": 9 + }, + "end": { + "line": 3, + "column": 10 + }, + "identifierName": "_" + }, + "name": "_" + } + ], + "body": { + "type": "BlockStatement", + "start": 32, + "end": 34, + "loc": { + "start": { + "line": 3, + "column": 12 + }, + "end": { + "line": 3, + "column": 14 + } + }, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-method-static-field/input.js b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-method-static-field/input.js new file mode 100644 index 000000000000..f9f1b1015567 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-method-static-field/input.js @@ -0,0 +1,4 @@ +class A { + #x() {} + static #x = 0; +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-method-static-field/options.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-method-static-field/options.json new file mode 100644 index 000000000000..af02072af9d9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-method-static-field/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["classPrivateProperties", "classPrivateMethods"] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-method-static-field/output.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-method-static-field/output.json new file mode 100644 index 000000000000..8e3500892679 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-method-static-field/output.json @@ -0,0 +1,226 @@ +{ + "type": "File", + "start": 0, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Duplicate private name #x (3:9)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "A" + }, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 8, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "body": [ + { + "type": "ClassPrivateMethod", + "start": 12, + "end": 19, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 9 + } + }, + "static": false, + "key": { + "type": "PrivateName", + "start": 12, + "end": 14, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 4 + } + }, + "id": { + "type": "Identifier", + "start": 13, + "end": 14, + "loc": { + "start": { + "line": 2, + "column": 3 + }, + "end": { + "line": 2, + "column": 4 + }, + "identifierName": "x" + }, + "name": "x" + } + }, + "kind": "method", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 19, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 9 + } + }, + "body": [], + "directives": [] + } + }, + { + "type": "ClassPrivateProperty", + "start": 22, + "end": 36, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 16 + } + }, + "static": true, + "key": { + "type": "PrivateName", + "start": 29, + "end": 31, + "loc": { + "start": { + "line": 3, + "column": 9 + }, + "end": { + "line": 3, + "column": 11 + } + }, + "id": { + "type": "Identifier", + "start": 30, + "end": 31, + "loc": { + "start": { + "line": 3, + "column": 10 + }, + "end": { + "line": 3, + "column": 11 + }, + "identifierName": "x" + }, + "name": "x" + } + }, + "value": { + "type": "NumericLiteral", + "start": 34, + "end": 35, + "loc": { + "start": { + "line": 3, + "column": 14 + }, + "end": { + "line": 3, + "column": 15 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-method-static-get/input.js b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-method-static-get/input.js new file mode 100644 index 000000000000..fdf3bef6984c --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-method-static-get/input.js @@ -0,0 +1,4 @@ +class A { + #x() {} + static get #x() {} +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-method-static-get/options.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-method-static-get/options.json new file mode 100644 index 000000000000..af02072af9d9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-method-static-get/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["classPrivateProperties", "classPrivateMethods"] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-method-static-get/output.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-method-static-get/output.json new file mode 100644 index 000000000000..1d94cf85460b --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-method-static-get/output.json @@ -0,0 +1,229 @@ +{ + "type": "File", + "start": 0, + "end": 42, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Duplicate private name #x (3:13)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 42, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 42, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "A" + }, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 8, + "end": 42, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "body": [ + { + "type": "ClassPrivateMethod", + "start": 12, + "end": 19, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 9 + } + }, + "static": false, + "key": { + "type": "PrivateName", + "start": 12, + "end": 14, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 4 + } + }, + "id": { + "type": "Identifier", + "start": 13, + "end": 14, + "loc": { + "start": { + "line": 2, + "column": 3 + }, + "end": { + "line": 2, + "column": 4 + }, + "identifierName": "x" + }, + "name": "x" + } + }, + "kind": "method", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 19, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 9 + } + }, + "body": [], + "directives": [] + } + }, + { + "type": "ClassPrivateMethod", + "start": 22, + "end": 40, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 20 + } + }, + "static": true, + "key": { + "type": "PrivateName", + "start": 33, + "end": 35, + "loc": { + "start": { + "line": 3, + "column": 13 + }, + "end": { + "line": 3, + "column": 15 + } + }, + "id": { + "type": "Identifier", + "start": 34, + "end": 35, + "loc": { + "start": { + "line": 3, + "column": 14 + }, + "end": { + "line": 3, + "column": 15 + }, + "identifierName": "x" + }, + "name": "x" + } + }, + "computed": false, + "kind": "get", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 38, + "end": 40, + "loc": { + "start": { + "line": 3, + "column": 18 + }, + "end": { + "line": 3, + "column": 20 + } + }, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-method-static-method/input.js b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-method-static-method/input.js new file mode 100644 index 000000000000..a1aa1d542441 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-method-static-method/input.js @@ -0,0 +1,4 @@ +class A { + #x() {} + static #x() {} +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-method-static-method/options.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-method-static-method/options.json new file mode 100644 index 000000000000..af02072af9d9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-method-static-method/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["classPrivateProperties", "classPrivateMethods"] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-method-static-method/output.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-method-static-method/output.json new file mode 100644 index 000000000000..fd8bc97f5bbd --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-method-static-method/output.json @@ -0,0 +1,228 @@ +{ + "type": "File", + "start": 0, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Duplicate private name #x (3:9)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "A" + }, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 8, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "body": [ + { + "type": "ClassPrivateMethod", + "start": 12, + "end": 19, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 9 + } + }, + "static": false, + "key": { + "type": "PrivateName", + "start": 12, + "end": 14, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 4 + } + }, + "id": { + "type": "Identifier", + "start": 13, + "end": 14, + "loc": { + "start": { + "line": 2, + "column": 3 + }, + "end": { + "line": 2, + "column": 4 + }, + "identifierName": "x" + }, + "name": "x" + } + }, + "kind": "method", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 19, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 9 + } + }, + "body": [], + "directives": [] + } + }, + { + "type": "ClassPrivateMethod", + "start": 22, + "end": 36, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 16 + } + }, + "static": true, + "key": { + "type": "PrivateName", + "start": 29, + "end": 31, + "loc": { + "start": { + "line": 3, + "column": 9 + }, + "end": { + "line": 3, + "column": 11 + } + }, + "id": { + "type": "Identifier", + "start": 30, + "end": 31, + "loc": { + "start": { + "line": 3, + "column": 10 + }, + "end": { + "line": 3, + "column": 11 + }, + "identifierName": "x" + }, + "name": "x" + } + }, + "kind": "method", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 34, + "end": 36, + "loc": { + "start": { + "line": 3, + "column": 14 + }, + "end": { + "line": 3, + "column": 16 + } + }, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-method-static-set/input.js b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-method-static-set/input.js new file mode 100644 index 000000000000..3b2e1e37704a --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-method-static-set/input.js @@ -0,0 +1,4 @@ +class A { + #x() {} + static set #x(_) {} +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-method-static-set/options.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-method-static-set/options.json new file mode 100644 index 000000000000..af02072af9d9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-method-static-set/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["classPrivateProperties", "classPrivateMethods"] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-method-static-set/output.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-method-static-set/output.json new file mode 100644 index 000000000000..b984451082ec --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-method-static-set/output.json @@ -0,0 +1,247 @@ +{ + "type": "File", + "start": 0, + "end": 43, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Duplicate private name #x (3:13)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 43, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 43, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "A" + }, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 8, + "end": 43, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "body": [ + { + "type": "ClassPrivateMethod", + "start": 12, + "end": 19, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 9 + } + }, + "static": false, + "key": { + "type": "PrivateName", + "start": 12, + "end": 14, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 4 + } + }, + "id": { + "type": "Identifier", + "start": 13, + "end": 14, + "loc": { + "start": { + "line": 2, + "column": 3 + }, + "end": { + "line": 2, + "column": 4 + }, + "identifierName": "x" + }, + "name": "x" + } + }, + "kind": "method", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 19, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 9 + } + }, + "body": [], + "directives": [] + } + }, + { + "type": "ClassPrivateMethod", + "start": 22, + "end": 41, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 21 + } + }, + "static": true, + "key": { + "type": "PrivateName", + "start": 33, + "end": 35, + "loc": { + "start": { + "line": 3, + "column": 13 + }, + "end": { + "line": 3, + "column": 15 + } + }, + "id": { + "type": "Identifier", + "start": 34, + "end": 35, + "loc": { + "start": { + "line": 3, + "column": 14 + }, + "end": { + "line": 3, + "column": 15 + }, + "identifierName": "x" + }, + "name": "x" + } + }, + "computed": false, + "kind": "set", + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 36, + "end": 37, + "loc": { + "start": { + "line": 3, + "column": 16 + }, + "end": { + "line": 3, + "column": 17 + }, + "identifierName": "_" + }, + "name": "_" + } + ], + "body": { + "type": "BlockStatement", + "start": 39, + "end": 41, + "loc": { + "start": { + "line": 3, + "column": 19 + }, + "end": { + "line": 3, + "column": 21 + } + }, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-set-instance-field/input.js b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-set-instance-field/input.js new file mode 100644 index 000000000000..095f191f877b --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-set-instance-field/input.js @@ -0,0 +1,4 @@ +class A { + set #x(_) {} + #x = 0; +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-set-instance-field/options.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-set-instance-field/options.json new file mode 100644 index 000000000000..af02072af9d9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-set-instance-field/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["classPrivateProperties", "classPrivateMethods"] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-set-instance-field/output.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-set-instance-field/output.json new file mode 100644 index 000000000000..83b198523bad --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-set-instance-field/output.json @@ -0,0 +1,245 @@ +{ + "type": "File", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Duplicate private name #x (3:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "A" + }, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 8, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "body": [ + { + "type": "ClassPrivateMethod", + "start": 12, + "end": 24, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "static": false, + "key": { + "type": "PrivateName", + "start": 16, + "end": 18, + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 8 + } + }, + "id": { + "type": "Identifier", + "start": 17, + "end": 18, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 8 + }, + "identifierName": "x" + }, + "name": "x" + } + }, + "computed": false, + "kind": "set", + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 19, + "end": 20, + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 10 + }, + "identifierName": "_" + }, + "name": "_" + } + ], + "body": { + "type": "BlockStatement", + "start": 22, + "end": 24, + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "body": [], + "directives": [] + } + }, + { + "type": "ClassPrivateProperty", + "start": 27, + "end": 34, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 9 + } + }, + "static": false, + "key": { + "type": "PrivateName", + "start": 27, + "end": 29, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 4 + } + }, + "id": { + "type": "Identifier", + "start": 28, + "end": 29, + "loc": { + "start": { + "line": 3, + "column": 3 + }, + "end": { + "line": 3, + "column": 4 + }, + "identifierName": "x" + }, + "name": "x" + } + }, + "value": { + "type": "NumericLiteral", + "start": 32, + "end": 33, + "loc": { + "start": { + "line": 3, + "column": 7 + }, + "end": { + "line": 3, + "column": 8 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-set-instance-get/input.js b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-set-instance-get/input.js new file mode 100644 index 000000000000..8e7e5544b96e --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-set-instance-get/input.js @@ -0,0 +1,4 @@ +class A { + set #x(_) {} + get #x() {} +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-set-instance-get/output.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-set-instance-get/output.json new file mode 100644 index 000000000000..08513a3011e8 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-set-instance-get/output.json @@ -0,0 +1,245 @@ +{ + "type": "File", + "start": 0, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "A" + }, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 8, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "body": [ + { + "type": "ClassPrivateMethod", + "start": 12, + "end": 24, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "static": false, + "key": { + "type": "PrivateName", + "start": 16, + "end": 18, + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 8 + } + }, + "id": { + "type": "Identifier", + "start": 17, + "end": 18, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 8 + }, + "identifierName": "x" + }, + "name": "x" + } + }, + "computed": false, + "kind": "set", + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 19, + "end": 20, + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 10 + }, + "identifierName": "_" + }, + "name": "_" + } + ], + "body": { + "type": "BlockStatement", + "start": 22, + "end": 24, + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "body": [], + "directives": [] + } + }, + { + "type": "ClassPrivateMethod", + "start": 27, + "end": 38, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 13 + } + }, + "static": false, + "key": { + "type": "PrivateName", + "start": 31, + "end": 33, + "loc": { + "start": { + "line": 3, + "column": 6 + }, + "end": { + "line": 3, + "column": 8 + } + }, + "id": { + "type": "Identifier", + "start": 32, + "end": 33, + "loc": { + "start": { + "line": 3, + "column": 7 + }, + "end": { + "line": 3, + "column": 8 + }, + "identifierName": "x" + }, + "name": "x" + } + }, + "computed": false, + "kind": "get", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 36, + "end": 38, + "loc": { + "start": { + "line": 3, + "column": 11 + }, + "end": { + "line": 3, + "column": 13 + } + }, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-set-instance-method/input.js b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-set-instance-method/input.js new file mode 100644 index 000000000000..f0d912243eef --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-set-instance-method/input.js @@ -0,0 +1,4 @@ +class A { + set #x(_) {} + #x() {} +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-set-instance-method/options.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-set-instance-method/options.json new file mode 100644 index 000000000000..af02072af9d9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-set-instance-method/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["classPrivateProperties", "classPrivateMethods"] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-set-instance-method/output.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-set-instance-method/output.json new file mode 100644 index 000000000000..dceb3bd390a6 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-set-instance-method/output.json @@ -0,0 +1,247 @@ +{ + "type": "File", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Duplicate private name #x (3:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "A" + }, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 8, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "body": [ + { + "type": "ClassPrivateMethod", + "start": 12, + "end": 24, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "static": false, + "key": { + "type": "PrivateName", + "start": 16, + "end": 18, + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 8 + } + }, + "id": { + "type": "Identifier", + "start": 17, + "end": 18, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 8 + }, + "identifierName": "x" + }, + "name": "x" + } + }, + "computed": false, + "kind": "set", + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 19, + "end": 20, + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 10 + }, + "identifierName": "_" + }, + "name": "_" + } + ], + "body": { + "type": "BlockStatement", + "start": 22, + "end": 24, + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "body": [], + "directives": [] + } + }, + { + "type": "ClassPrivateMethod", + "start": 27, + "end": 34, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 9 + } + }, + "static": false, + "key": { + "type": "PrivateName", + "start": 27, + "end": 29, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 4 + } + }, + "id": { + "type": "Identifier", + "start": 28, + "end": 29, + "loc": { + "start": { + "line": 3, + "column": 3 + }, + "end": { + "line": 3, + "column": 4 + }, + "identifierName": "x" + }, + "name": "x" + } + }, + "kind": "method", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 32, + "end": 34, + "loc": { + "start": { + "line": 3, + "column": 7 + }, + "end": { + "line": 3, + "column": 9 + } + }, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-set-instance-set/input.js b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-set-instance-set/input.js new file mode 100644 index 000000000000..d4e2624635cb --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-set-instance-set/input.js @@ -0,0 +1,4 @@ +class A { + set #x(_) {} + set #x(_) {} +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-set-instance-set/options.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-set-instance-set/options.json new file mode 100644 index 000000000000..af02072af9d9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-set-instance-set/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["classPrivateProperties", "classPrivateMethods"] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-set-instance-set/output.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-set-instance-set/output.json new file mode 100644 index 000000000000..7add5089ff95 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-set-instance-set/output.json @@ -0,0 +1,266 @@ +{ + "type": "File", + "start": 0, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Duplicate private name #x (3:6)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "A" + }, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 8, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "body": [ + { + "type": "ClassPrivateMethod", + "start": 12, + "end": 24, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "static": false, + "key": { + "type": "PrivateName", + "start": 16, + "end": 18, + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 8 + } + }, + "id": { + "type": "Identifier", + "start": 17, + "end": 18, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 8 + }, + "identifierName": "x" + }, + "name": "x" + } + }, + "computed": false, + "kind": "set", + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 19, + "end": 20, + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 10 + }, + "identifierName": "_" + }, + "name": "_" + } + ], + "body": { + "type": "BlockStatement", + "start": 22, + "end": 24, + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "body": [], + "directives": [] + } + }, + { + "type": "ClassPrivateMethod", + "start": 27, + "end": 39, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 14 + } + }, + "static": false, + "key": { + "type": "PrivateName", + "start": 31, + "end": 33, + "loc": { + "start": { + "line": 3, + "column": 6 + }, + "end": { + "line": 3, + "column": 8 + } + }, + "id": { + "type": "Identifier", + "start": 32, + "end": 33, + "loc": { + "start": { + "line": 3, + "column": 7 + }, + "end": { + "line": 3, + "column": 8 + }, + "identifierName": "x" + }, + "name": "x" + } + }, + "computed": false, + "kind": "set", + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 34, + "end": 35, + "loc": { + "start": { + "line": 3, + "column": 9 + }, + "end": { + "line": 3, + "column": 10 + }, + "identifierName": "_" + }, + "name": "_" + } + ], + "body": { + "type": "BlockStatement", + "start": 37, + "end": 39, + "loc": { + "start": { + "line": 3, + "column": 12 + }, + "end": { + "line": 3, + "column": 14 + } + }, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-set-static-field/input.js b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-set-static-field/input.js new file mode 100644 index 000000000000..3e3b25f208b6 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-set-static-field/input.js @@ -0,0 +1,4 @@ +class A { + set #x(_) {} + static #x = 0; +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-set-static-field/options.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-set-static-field/options.json new file mode 100644 index 000000000000..af02072af9d9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-set-static-field/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["classPrivateProperties", "classPrivateMethods"] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-set-static-field/output.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-set-static-field/output.json new file mode 100644 index 000000000000..06e380aea7f2 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-set-static-field/output.json @@ -0,0 +1,245 @@ +{ + "type": "File", + "start": 0, + "end": 43, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Duplicate private name #x (3:9)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 43, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 43, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "A" + }, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 8, + "end": 43, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "body": [ + { + "type": "ClassPrivateMethod", + "start": 12, + "end": 24, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "static": false, + "key": { + "type": "PrivateName", + "start": 16, + "end": 18, + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 8 + } + }, + "id": { + "type": "Identifier", + "start": 17, + "end": 18, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 8 + }, + "identifierName": "x" + }, + "name": "x" + } + }, + "computed": false, + "kind": "set", + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 19, + "end": 20, + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 10 + }, + "identifierName": "_" + }, + "name": "_" + } + ], + "body": { + "type": "BlockStatement", + "start": 22, + "end": 24, + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "body": [], + "directives": [] + } + }, + { + "type": "ClassPrivateProperty", + "start": 27, + "end": 41, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 16 + } + }, + "static": true, + "key": { + "type": "PrivateName", + "start": 34, + "end": 36, + "loc": { + "start": { + "line": 3, + "column": 9 + }, + "end": { + "line": 3, + "column": 11 + } + }, + "id": { + "type": "Identifier", + "start": 35, + "end": 36, + "loc": { + "start": { + "line": 3, + "column": 10 + }, + "end": { + "line": 3, + "column": 11 + }, + "identifierName": "x" + }, + "name": "x" + } + }, + "value": { + "type": "NumericLiteral", + "start": 39, + "end": 40, + "loc": { + "start": { + "line": 3, + "column": 14 + }, + "end": { + "line": 3, + "column": 15 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-set-static-get/input.js b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-set-static-get/input.js new file mode 100644 index 000000000000..3c0764dfad45 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-set-static-get/input.js @@ -0,0 +1,4 @@ +class A { + set #x(_) {} + static get #x() {} +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-set-static-get/options.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-set-static-get/options.json new file mode 100644 index 000000000000..af02072af9d9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-set-static-get/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["classPrivateProperties", "classPrivateMethods"] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-set-static-get/output.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-set-static-get/output.json new file mode 100644 index 000000000000..339ca0c0d546 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-set-static-get/output.json @@ -0,0 +1,248 @@ +{ + "type": "File", + "start": 0, + "end": 47, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Duplicate private name #x (3:13)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 47, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 47, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "A" + }, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 8, + "end": 47, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "body": [ + { + "type": "ClassPrivateMethod", + "start": 12, + "end": 24, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "static": false, + "key": { + "type": "PrivateName", + "start": 16, + "end": 18, + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 8 + } + }, + "id": { + "type": "Identifier", + "start": 17, + "end": 18, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 8 + }, + "identifierName": "x" + }, + "name": "x" + } + }, + "computed": false, + "kind": "set", + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 19, + "end": 20, + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 10 + }, + "identifierName": "_" + }, + "name": "_" + } + ], + "body": { + "type": "BlockStatement", + "start": 22, + "end": 24, + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "body": [], + "directives": [] + } + }, + { + "type": "ClassPrivateMethod", + "start": 27, + "end": 45, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 20 + } + }, + "static": true, + "key": { + "type": "PrivateName", + "start": 38, + "end": 40, + "loc": { + "start": { + "line": 3, + "column": 13 + }, + "end": { + "line": 3, + "column": 15 + } + }, + "id": { + "type": "Identifier", + "start": 39, + "end": 40, + "loc": { + "start": { + "line": 3, + "column": 14 + }, + "end": { + "line": 3, + "column": 15 + }, + "identifierName": "x" + }, + "name": "x" + } + }, + "computed": false, + "kind": "get", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 43, + "end": 45, + "loc": { + "start": { + "line": 3, + "column": 18 + }, + "end": { + "line": 3, + "column": 20 + } + }, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-set-static-method/input.js b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-set-static-method/input.js new file mode 100644 index 000000000000..ce3a89c61108 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-set-static-method/input.js @@ -0,0 +1,4 @@ +class A { + set #x(_) {} + static #x() {} +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-set-static-method/options.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-set-static-method/options.json new file mode 100644 index 000000000000..af02072af9d9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-set-static-method/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["classPrivateProperties", "classPrivateMethods"] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-set-static-method/output.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-set-static-method/output.json new file mode 100644 index 000000000000..184125273236 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-set-static-method/output.json @@ -0,0 +1,247 @@ +{ + "type": "File", + "start": 0, + "end": 43, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Duplicate private name #x (3:9)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 43, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 43, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "A" + }, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 8, + "end": 43, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "body": [ + { + "type": "ClassPrivateMethod", + "start": 12, + "end": 24, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "static": false, + "key": { + "type": "PrivateName", + "start": 16, + "end": 18, + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 8 + } + }, + "id": { + "type": "Identifier", + "start": 17, + "end": 18, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 8 + }, + "identifierName": "x" + }, + "name": "x" + } + }, + "computed": false, + "kind": "set", + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 19, + "end": 20, + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 10 + }, + "identifierName": "_" + }, + "name": "_" + } + ], + "body": { + "type": "BlockStatement", + "start": 22, + "end": 24, + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "body": [], + "directives": [] + } + }, + { + "type": "ClassPrivateMethod", + "start": 27, + "end": 41, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 16 + } + }, + "static": true, + "key": { + "type": "PrivateName", + "start": 34, + "end": 36, + "loc": { + "start": { + "line": 3, + "column": 9 + }, + "end": { + "line": 3, + "column": 11 + } + }, + "id": { + "type": "Identifier", + "start": 35, + "end": 36, + "loc": { + "start": { + "line": 3, + "column": 10 + }, + "end": { + "line": 3, + "column": 11 + }, + "identifierName": "x" + }, + "name": "x" + } + }, + "kind": "method", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 39, + "end": 41, + "loc": { + "start": { + "line": 3, + "column": 14 + }, + "end": { + "line": 3, + "column": 16 + } + }, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-set-static-set/input.js b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-set-static-set/input.js new file mode 100644 index 000000000000..7a5e410fdd91 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-set-static-set/input.js @@ -0,0 +1,4 @@ +class A { + set #x(_) {} + static set #x(_) {} +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-set-static-set/options.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-set-static-set/options.json new file mode 100644 index 000000000000..af02072af9d9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-set-static-set/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["classPrivateProperties", "classPrivateMethods"] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-set-static-set/output.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-set-static-set/output.json new file mode 100644 index 000000000000..128468f9659f --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/instance-set-static-set/output.json @@ -0,0 +1,266 @@ +{ + "type": "File", + "start": 0, + "end": 48, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Duplicate private name #x (3:13)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 48, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 48, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "A" + }, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 8, + "end": 48, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "body": [ + { + "type": "ClassPrivateMethod", + "start": 12, + "end": 24, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "static": false, + "key": { + "type": "PrivateName", + "start": 16, + "end": 18, + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 8 + } + }, + "id": { + "type": "Identifier", + "start": 17, + "end": 18, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 8 + }, + "identifierName": "x" + }, + "name": "x" + } + }, + "computed": false, + "kind": "set", + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 19, + "end": 20, + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 10 + }, + "identifierName": "_" + }, + "name": "_" + } + ], + "body": { + "type": "BlockStatement", + "start": 22, + "end": 24, + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "body": [], + "directives": [] + } + }, + { + "type": "ClassPrivateMethod", + "start": 27, + "end": 46, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 21 + } + }, + "static": true, + "key": { + "type": "PrivateName", + "start": 38, + "end": 40, + "loc": { + "start": { + "line": 3, + "column": 13 + }, + "end": { + "line": 3, + "column": 15 + } + }, + "id": { + "type": "Identifier", + "start": 39, + "end": 40, + "loc": { + "start": { + "line": 3, + "column": 14 + }, + "end": { + "line": 3, + "column": 15 + }, + "identifierName": "x" + }, + "name": "x" + } + }, + "computed": false, + "kind": "set", + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 41, + "end": 42, + "loc": { + "start": { + "line": 3, + "column": 16 + }, + "end": { + "line": 3, + "column": 17 + }, + "identifierName": "_" + }, + "name": "_" + } + ], + "body": { + "type": "BlockStatement", + "start": 44, + "end": 46, + "loc": { + "start": { + "line": 3, + "column": 19 + }, + "end": { + "line": 3, + "column": 21 + } + }, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/options.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/options.json new file mode 100644 index 000000000000..af02072af9d9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["classPrivateProperties", "classPrivateMethods"] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-field-instance-field/input.js b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-field-instance-field/input.js new file mode 100644 index 000000000000..3de944035833 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-field-instance-field/input.js @@ -0,0 +1,4 @@ +class A { + static #x = 0; + #x = 0; +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-field-instance-field/options.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-field-instance-field/options.json new file mode 100644 index 000000000000..af02072af9d9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-field-instance-field/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["classPrivateProperties", "classPrivateMethods"] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-field-instance-field/output.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-field-instance-field/output.json new file mode 100644 index 000000000000..0724b9e565a2 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-field-instance-field/output.json @@ -0,0 +1,224 @@ +{ + "type": "File", + "start": 0, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Duplicate private name #x (3:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "A" + }, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 8, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "body": [ + { + "type": "ClassPrivateProperty", + "start": 12, + "end": 26, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 16 + } + }, + "static": true, + "key": { + "type": "PrivateName", + "start": 19, + "end": 21, + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 11 + } + }, + "id": { + "type": "Identifier", + "start": 20, + "end": 21, + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 11 + }, + "identifierName": "x" + }, + "name": "x" + } + }, + "value": { + "type": "NumericLiteral", + "start": 24, + "end": 25, + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 15 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + }, + { + "type": "ClassPrivateProperty", + "start": 29, + "end": 36, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 9 + } + }, + "static": false, + "key": { + "type": "PrivateName", + "start": 29, + "end": 31, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 4 + } + }, + "id": { + "type": "Identifier", + "start": 30, + "end": 31, + "loc": { + "start": { + "line": 3, + "column": 3 + }, + "end": { + "line": 3, + "column": 4 + }, + "identifierName": "x" + }, + "name": "x" + } + }, + "value": { + "type": "NumericLiteral", + "start": 34, + "end": 35, + "loc": { + "start": { + "line": 3, + "column": 7 + }, + "end": { + "line": 3, + "column": 8 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-field-instance-get/input.js b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-field-instance-get/input.js new file mode 100644 index 000000000000..dd34390358ee --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-field-instance-get/input.js @@ -0,0 +1,4 @@ +class A { + static #x = 0; + get #x() {} +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-field-instance-get/options.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-field-instance-get/options.json new file mode 100644 index 000000000000..af02072af9d9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-field-instance-get/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["classPrivateProperties", "classPrivateMethods"] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-field-instance-get/output.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-field-instance-get/output.json new file mode 100644 index 000000000000..1a3e576e3b80 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-field-instance-get/output.json @@ -0,0 +1,227 @@ +{ + "type": "File", + "start": 0, + "end": 42, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Duplicate private name #x (3:6)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 42, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 42, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "A" + }, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 8, + "end": 42, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "body": [ + { + "type": "ClassPrivateProperty", + "start": 12, + "end": 26, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 16 + } + }, + "static": true, + "key": { + "type": "PrivateName", + "start": 19, + "end": 21, + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 11 + } + }, + "id": { + "type": "Identifier", + "start": 20, + "end": 21, + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 11 + }, + "identifierName": "x" + }, + "name": "x" + } + }, + "value": { + "type": "NumericLiteral", + "start": 24, + "end": 25, + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 15 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + }, + { + "type": "ClassPrivateMethod", + "start": 29, + "end": 40, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 13 + } + }, + "static": false, + "key": { + "type": "PrivateName", + "start": 33, + "end": 35, + "loc": { + "start": { + "line": 3, + "column": 6 + }, + "end": { + "line": 3, + "column": 8 + } + }, + "id": { + "type": "Identifier", + "start": 34, + "end": 35, + "loc": { + "start": { + "line": 3, + "column": 7 + }, + "end": { + "line": 3, + "column": 8 + }, + "identifierName": "x" + }, + "name": "x" + } + }, + "computed": false, + "kind": "get", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 38, + "end": 40, + "loc": { + "start": { + "line": 3, + "column": 11 + }, + "end": { + "line": 3, + "column": 13 + } + }, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-field-instance-method/input.js b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-field-instance-method/input.js new file mode 100644 index 000000000000..ae2b2f980b8a --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-field-instance-method/input.js @@ -0,0 +1,4 @@ +class A { + static #x = 0; + #x() {} +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-field-instance-method/options.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-field-instance-method/options.json new file mode 100644 index 000000000000..af02072af9d9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-field-instance-method/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["classPrivateProperties", "classPrivateMethods"] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-field-instance-method/output.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-field-instance-method/output.json new file mode 100644 index 000000000000..d1c2347cb125 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-field-instance-method/output.json @@ -0,0 +1,226 @@ +{ + "type": "File", + "start": 0, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Duplicate private name #x (3:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "A" + }, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 8, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "body": [ + { + "type": "ClassPrivateProperty", + "start": 12, + "end": 26, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 16 + } + }, + "static": true, + "key": { + "type": "PrivateName", + "start": 19, + "end": 21, + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 11 + } + }, + "id": { + "type": "Identifier", + "start": 20, + "end": 21, + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 11 + }, + "identifierName": "x" + }, + "name": "x" + } + }, + "value": { + "type": "NumericLiteral", + "start": 24, + "end": 25, + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 15 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + }, + { + "type": "ClassPrivateMethod", + "start": 29, + "end": 36, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 9 + } + }, + "static": false, + "key": { + "type": "PrivateName", + "start": 29, + "end": 31, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 4 + } + }, + "id": { + "type": "Identifier", + "start": 30, + "end": 31, + "loc": { + "start": { + "line": 3, + "column": 3 + }, + "end": { + "line": 3, + "column": 4 + }, + "identifierName": "x" + }, + "name": "x" + } + }, + "kind": "method", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 34, + "end": 36, + "loc": { + "start": { + "line": 3, + "column": 7 + }, + "end": { + "line": 3, + "column": 9 + } + }, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-field-instance-set/input.js b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-field-instance-set/input.js new file mode 100644 index 000000000000..8962661873c3 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-field-instance-set/input.js @@ -0,0 +1,4 @@ +class A { + static #x = 0; + set #x(_) {} +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-field-instance-set/options.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-field-instance-set/options.json new file mode 100644 index 000000000000..af02072af9d9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-field-instance-set/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["classPrivateProperties", "classPrivateMethods"] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-field-instance-set/output.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-field-instance-set/output.json new file mode 100644 index 000000000000..0a638b426ae2 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-field-instance-set/output.json @@ -0,0 +1,245 @@ +{ + "type": "File", + "start": 0, + "end": 43, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Duplicate private name #x (3:6)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 43, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 43, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "A" + }, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 8, + "end": 43, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "body": [ + { + "type": "ClassPrivateProperty", + "start": 12, + "end": 26, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 16 + } + }, + "static": true, + "key": { + "type": "PrivateName", + "start": 19, + "end": 21, + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 11 + } + }, + "id": { + "type": "Identifier", + "start": 20, + "end": 21, + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 11 + }, + "identifierName": "x" + }, + "name": "x" + } + }, + "value": { + "type": "NumericLiteral", + "start": 24, + "end": 25, + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 15 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + }, + { + "type": "ClassPrivateMethod", + "start": 29, + "end": 41, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 14 + } + }, + "static": false, + "key": { + "type": "PrivateName", + "start": 33, + "end": 35, + "loc": { + "start": { + "line": 3, + "column": 6 + }, + "end": { + "line": 3, + "column": 8 + } + }, + "id": { + "type": "Identifier", + "start": 34, + "end": 35, + "loc": { + "start": { + "line": 3, + "column": 7 + }, + "end": { + "line": 3, + "column": 8 + }, + "identifierName": "x" + }, + "name": "x" + } + }, + "computed": false, + "kind": "set", + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 36, + "end": 37, + "loc": { + "start": { + "line": 3, + "column": 9 + }, + "end": { + "line": 3, + "column": 10 + }, + "identifierName": "_" + }, + "name": "_" + } + ], + "body": { + "type": "BlockStatement", + "start": 39, + "end": 41, + "loc": { + "start": { + "line": 3, + "column": 12 + }, + "end": { + "line": 3, + "column": 14 + } + }, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-field-static-field/input.js b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-field-static-field/input.js new file mode 100644 index 000000000000..f30eaf46a76c --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-field-static-field/input.js @@ -0,0 +1,4 @@ +class A { + static #x = 0; + static #x = 0; +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-field-static-field/options.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-field-static-field/options.json new file mode 100644 index 000000000000..af02072af9d9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-field-static-field/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["classPrivateProperties", "classPrivateMethods"] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-field-static-field/output.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-field-static-field/output.json new file mode 100644 index 000000000000..7cf03fd42bb7 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-field-static-field/output.json @@ -0,0 +1,224 @@ +{ + "type": "File", + "start": 0, + "end": 45, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Duplicate private name #x (3:9)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 45, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 45, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "A" + }, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 8, + "end": 45, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "body": [ + { + "type": "ClassPrivateProperty", + "start": 12, + "end": 26, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 16 + } + }, + "static": true, + "key": { + "type": "PrivateName", + "start": 19, + "end": 21, + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 11 + } + }, + "id": { + "type": "Identifier", + "start": 20, + "end": 21, + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 11 + }, + "identifierName": "x" + }, + "name": "x" + } + }, + "value": { + "type": "NumericLiteral", + "start": 24, + "end": 25, + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 15 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + }, + { + "type": "ClassPrivateProperty", + "start": 29, + "end": 43, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 16 + } + }, + "static": true, + "key": { + "type": "PrivateName", + "start": 36, + "end": 38, + "loc": { + "start": { + "line": 3, + "column": 9 + }, + "end": { + "line": 3, + "column": 11 + } + }, + "id": { + "type": "Identifier", + "start": 37, + "end": 38, + "loc": { + "start": { + "line": 3, + "column": 10 + }, + "end": { + "line": 3, + "column": 11 + }, + "identifierName": "x" + }, + "name": "x" + } + }, + "value": { + "type": "NumericLiteral", + "start": 41, + "end": 42, + "loc": { + "start": { + "line": 3, + "column": 14 + }, + "end": { + "line": 3, + "column": 15 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-field-static-get/input.js b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-field-static-get/input.js new file mode 100644 index 000000000000..27598cc9b1ef --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-field-static-get/input.js @@ -0,0 +1,4 @@ +class A { + static #x = 0; + static get #x() {} +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-field-static-get/options.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-field-static-get/options.json new file mode 100644 index 000000000000..af02072af9d9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-field-static-get/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["classPrivateProperties", "classPrivateMethods"] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-field-static-get/output.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-field-static-get/output.json new file mode 100644 index 000000000000..98d454b78c67 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-field-static-get/output.json @@ -0,0 +1,227 @@ +{ + "type": "File", + "start": 0, + "end": 49, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Duplicate private name #x (3:13)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 49, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 49, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "A" + }, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 8, + "end": 49, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "body": [ + { + "type": "ClassPrivateProperty", + "start": 12, + "end": 26, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 16 + } + }, + "static": true, + "key": { + "type": "PrivateName", + "start": 19, + "end": 21, + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 11 + } + }, + "id": { + "type": "Identifier", + "start": 20, + "end": 21, + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 11 + }, + "identifierName": "x" + }, + "name": "x" + } + }, + "value": { + "type": "NumericLiteral", + "start": 24, + "end": 25, + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 15 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + }, + { + "type": "ClassPrivateMethod", + "start": 29, + "end": 47, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 20 + } + }, + "static": true, + "key": { + "type": "PrivateName", + "start": 40, + "end": 42, + "loc": { + "start": { + "line": 3, + "column": 13 + }, + "end": { + "line": 3, + "column": 15 + } + }, + "id": { + "type": "Identifier", + "start": 41, + "end": 42, + "loc": { + "start": { + "line": 3, + "column": 14 + }, + "end": { + "line": 3, + "column": 15 + }, + "identifierName": "x" + }, + "name": "x" + } + }, + "computed": false, + "kind": "get", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 45, + "end": 47, + "loc": { + "start": { + "line": 3, + "column": 18 + }, + "end": { + "line": 3, + "column": 20 + } + }, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-field-static-method/input.js b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-field-static-method/input.js new file mode 100644 index 000000000000..3530aef207c1 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-field-static-method/input.js @@ -0,0 +1,4 @@ +class A { + static #x = 0; + static #x() {} +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-field-static-method/options.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-field-static-method/options.json new file mode 100644 index 000000000000..af02072af9d9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-field-static-method/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["classPrivateProperties", "classPrivateMethods"] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-field-static-method/output.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-field-static-method/output.json new file mode 100644 index 000000000000..74c7d35d4fa3 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-field-static-method/output.json @@ -0,0 +1,226 @@ +{ + "type": "File", + "start": 0, + "end": 45, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Duplicate private name #x (3:9)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 45, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 45, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "A" + }, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 8, + "end": 45, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "body": [ + { + "type": "ClassPrivateProperty", + "start": 12, + "end": 26, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 16 + } + }, + "static": true, + "key": { + "type": "PrivateName", + "start": 19, + "end": 21, + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 11 + } + }, + "id": { + "type": "Identifier", + "start": 20, + "end": 21, + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 11 + }, + "identifierName": "x" + }, + "name": "x" + } + }, + "value": { + "type": "NumericLiteral", + "start": 24, + "end": 25, + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 15 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + }, + { + "type": "ClassPrivateMethod", + "start": 29, + "end": 43, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 16 + } + }, + "static": true, + "key": { + "type": "PrivateName", + "start": 36, + "end": 38, + "loc": { + "start": { + "line": 3, + "column": 9 + }, + "end": { + "line": 3, + "column": 11 + } + }, + "id": { + "type": "Identifier", + "start": 37, + "end": 38, + "loc": { + "start": { + "line": 3, + "column": 10 + }, + "end": { + "line": 3, + "column": 11 + }, + "identifierName": "x" + }, + "name": "x" + } + }, + "kind": "method", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 41, + "end": 43, + "loc": { + "start": { + "line": 3, + "column": 14 + }, + "end": { + "line": 3, + "column": 16 + } + }, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-field-static-set/input.js b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-field-static-set/input.js new file mode 100644 index 000000000000..705e02850f9c --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-field-static-set/input.js @@ -0,0 +1,4 @@ +class A { + static #x = 0; + static set #x(_) {} +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-field-static-set/options.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-field-static-set/options.json new file mode 100644 index 000000000000..af02072af9d9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-field-static-set/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["classPrivateProperties", "classPrivateMethods"] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-field-static-set/output.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-field-static-set/output.json new file mode 100644 index 000000000000..379ee84d2d94 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-field-static-set/output.json @@ -0,0 +1,245 @@ +{ + "type": "File", + "start": 0, + "end": 50, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Duplicate private name #x (3:13)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 50, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 50, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "A" + }, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 8, + "end": 50, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "body": [ + { + "type": "ClassPrivateProperty", + "start": 12, + "end": 26, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 16 + } + }, + "static": true, + "key": { + "type": "PrivateName", + "start": 19, + "end": 21, + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 11 + } + }, + "id": { + "type": "Identifier", + "start": 20, + "end": 21, + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 11 + }, + "identifierName": "x" + }, + "name": "x" + } + }, + "value": { + "type": "NumericLiteral", + "start": 24, + "end": 25, + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 15 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + }, + { + "type": "ClassPrivateMethod", + "start": 29, + "end": 48, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 21 + } + }, + "static": true, + "key": { + "type": "PrivateName", + "start": 40, + "end": 42, + "loc": { + "start": { + "line": 3, + "column": 13 + }, + "end": { + "line": 3, + "column": 15 + } + }, + "id": { + "type": "Identifier", + "start": 41, + "end": 42, + "loc": { + "start": { + "line": 3, + "column": 14 + }, + "end": { + "line": 3, + "column": 15 + }, + "identifierName": "x" + }, + "name": "x" + } + }, + "computed": false, + "kind": "set", + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 43, + "end": 44, + "loc": { + "start": { + "line": 3, + "column": 16 + }, + "end": { + "line": 3, + "column": 17 + }, + "identifierName": "_" + }, + "name": "_" + } + ], + "body": { + "type": "BlockStatement", + "start": 46, + "end": 48, + "loc": { + "start": { + "line": 3, + "column": 19 + }, + "end": { + "line": 3, + "column": 21 + } + }, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-get-instance-field/input.js b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-get-instance-field/input.js new file mode 100644 index 000000000000..5063908de961 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-get-instance-field/input.js @@ -0,0 +1,4 @@ +class A { + static get #x() {} + #x = 0; +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-get-instance-field/options.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-get-instance-field/options.json new file mode 100644 index 000000000000..af02072af9d9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-get-instance-field/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["classPrivateProperties", "classPrivateMethods"] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-get-instance-field/output.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-get-instance-field/output.json new file mode 100644 index 000000000000..113e8bbbbeeb --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-get-instance-field/output.json @@ -0,0 +1,227 @@ +{ + "type": "File", + "start": 0, + "end": 42, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Duplicate private name #x (3:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 42, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 42, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "A" + }, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 8, + "end": 42, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "body": [ + { + "type": "ClassPrivateMethod", + "start": 12, + "end": 30, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 20 + } + }, + "static": true, + "key": { + "type": "PrivateName", + "start": 23, + "end": 25, + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 15 + } + }, + "id": { + "type": "Identifier", + "start": 24, + "end": 25, + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 15 + }, + "identifierName": "x" + }, + "name": "x" + } + }, + "computed": false, + "kind": "get", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 28, + "end": 30, + "loc": { + "start": { + "line": 2, + "column": 18 + }, + "end": { + "line": 2, + "column": 20 + } + }, + "body": [], + "directives": [] + } + }, + { + "type": "ClassPrivateProperty", + "start": 33, + "end": 40, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 9 + } + }, + "static": false, + "key": { + "type": "PrivateName", + "start": 33, + "end": 35, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 4 + } + }, + "id": { + "type": "Identifier", + "start": 34, + "end": 35, + "loc": { + "start": { + "line": 3, + "column": 3 + }, + "end": { + "line": 3, + "column": 4 + }, + "identifierName": "x" + }, + "name": "x" + } + }, + "value": { + "type": "NumericLiteral", + "start": 38, + "end": 39, + "loc": { + "start": { + "line": 3, + "column": 7 + }, + "end": { + "line": 3, + "column": 8 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-get-instance-get/input.js b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-get-instance-get/input.js new file mode 100644 index 000000000000..819cf9b38c3c --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-get-instance-get/input.js @@ -0,0 +1,4 @@ +class A { + static get #x() {} + get #x() {} +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-get-instance-get/options.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-get-instance-get/options.json new file mode 100644 index 000000000000..af02072af9d9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-get-instance-get/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["classPrivateProperties", "classPrivateMethods"] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-get-instance-get/output.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-get-instance-get/output.json new file mode 100644 index 000000000000..c7fd9652e864 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-get-instance-get/output.json @@ -0,0 +1,230 @@ +{ + "type": "File", + "start": 0, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Duplicate private name #x (3:6)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "A" + }, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 8, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "body": [ + { + "type": "ClassPrivateMethod", + "start": 12, + "end": 30, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 20 + } + }, + "static": true, + "key": { + "type": "PrivateName", + "start": 23, + "end": 25, + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 15 + } + }, + "id": { + "type": "Identifier", + "start": 24, + "end": 25, + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 15 + }, + "identifierName": "x" + }, + "name": "x" + } + }, + "computed": false, + "kind": "get", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 28, + "end": 30, + "loc": { + "start": { + "line": 2, + "column": 18 + }, + "end": { + "line": 2, + "column": 20 + } + }, + "body": [], + "directives": [] + } + }, + { + "type": "ClassPrivateMethod", + "start": 33, + "end": 44, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 13 + } + }, + "static": false, + "key": { + "type": "PrivateName", + "start": 37, + "end": 39, + "loc": { + "start": { + "line": 3, + "column": 6 + }, + "end": { + "line": 3, + "column": 8 + } + }, + "id": { + "type": "Identifier", + "start": 38, + "end": 39, + "loc": { + "start": { + "line": 3, + "column": 7 + }, + "end": { + "line": 3, + "column": 8 + }, + "identifierName": "x" + }, + "name": "x" + } + }, + "computed": false, + "kind": "get", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 42, + "end": 44, + "loc": { + "start": { + "line": 3, + "column": 11 + }, + "end": { + "line": 3, + "column": 13 + } + }, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-get-instance-method/input.js b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-get-instance-method/input.js new file mode 100644 index 000000000000..e22778f87886 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-get-instance-method/input.js @@ -0,0 +1,4 @@ +class A { + static get #x() {} + #x() {} +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-get-instance-method/options.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-get-instance-method/options.json new file mode 100644 index 000000000000..af02072af9d9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-get-instance-method/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["classPrivateProperties", "classPrivateMethods"] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-get-instance-method/output.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-get-instance-method/output.json new file mode 100644 index 000000000000..67e2f41f4ca2 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-get-instance-method/output.json @@ -0,0 +1,229 @@ +{ + "type": "File", + "start": 0, + "end": 42, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Duplicate private name #x (3:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 42, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 42, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "A" + }, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 8, + "end": 42, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "body": [ + { + "type": "ClassPrivateMethod", + "start": 12, + "end": 30, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 20 + } + }, + "static": true, + "key": { + "type": "PrivateName", + "start": 23, + "end": 25, + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 15 + } + }, + "id": { + "type": "Identifier", + "start": 24, + "end": 25, + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 15 + }, + "identifierName": "x" + }, + "name": "x" + } + }, + "computed": false, + "kind": "get", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 28, + "end": 30, + "loc": { + "start": { + "line": 2, + "column": 18 + }, + "end": { + "line": 2, + "column": 20 + } + }, + "body": [], + "directives": [] + } + }, + { + "type": "ClassPrivateMethod", + "start": 33, + "end": 40, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 9 + } + }, + "static": false, + "key": { + "type": "PrivateName", + "start": 33, + "end": 35, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 4 + } + }, + "id": { + "type": "Identifier", + "start": 34, + "end": 35, + "loc": { + "start": { + "line": 3, + "column": 3 + }, + "end": { + "line": 3, + "column": 4 + }, + "identifierName": "x" + }, + "name": "x" + } + }, + "kind": "method", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 38, + "end": 40, + "loc": { + "start": { + "line": 3, + "column": 7 + }, + "end": { + "line": 3, + "column": 9 + } + }, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-get-instance-set/input.js b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-get-instance-set/input.js new file mode 100644 index 000000000000..21bab2d3e874 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-get-instance-set/input.js @@ -0,0 +1,4 @@ +class A { + static get #x() {} + set #x(_) {} +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-get-instance-set/options.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-get-instance-set/options.json new file mode 100644 index 000000000000..af02072af9d9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-get-instance-set/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["classPrivateProperties", "classPrivateMethods"] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-get-instance-set/output.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-get-instance-set/output.json new file mode 100644 index 000000000000..ef06223a73fb --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-get-instance-set/output.json @@ -0,0 +1,248 @@ +{ + "type": "File", + "start": 0, + "end": 47, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Duplicate private name #x (3:6)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 47, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 47, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "A" + }, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 8, + "end": 47, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "body": [ + { + "type": "ClassPrivateMethod", + "start": 12, + "end": 30, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 20 + } + }, + "static": true, + "key": { + "type": "PrivateName", + "start": 23, + "end": 25, + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 15 + } + }, + "id": { + "type": "Identifier", + "start": 24, + "end": 25, + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 15 + }, + "identifierName": "x" + }, + "name": "x" + } + }, + "computed": false, + "kind": "get", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 28, + "end": 30, + "loc": { + "start": { + "line": 2, + "column": 18 + }, + "end": { + "line": 2, + "column": 20 + } + }, + "body": [], + "directives": [] + } + }, + { + "type": "ClassPrivateMethod", + "start": 33, + "end": 45, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 14 + } + }, + "static": false, + "key": { + "type": "PrivateName", + "start": 37, + "end": 39, + "loc": { + "start": { + "line": 3, + "column": 6 + }, + "end": { + "line": 3, + "column": 8 + } + }, + "id": { + "type": "Identifier", + "start": 38, + "end": 39, + "loc": { + "start": { + "line": 3, + "column": 7 + }, + "end": { + "line": 3, + "column": 8 + }, + "identifierName": "x" + }, + "name": "x" + } + }, + "computed": false, + "kind": "set", + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 40, + "end": 41, + "loc": { + "start": { + "line": 3, + "column": 9 + }, + "end": { + "line": 3, + "column": 10 + }, + "identifierName": "_" + }, + "name": "_" + } + ], + "body": { + "type": "BlockStatement", + "start": 43, + "end": 45, + "loc": { + "start": { + "line": 3, + "column": 12 + }, + "end": { + "line": 3, + "column": 14 + } + }, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-get-static-field/input.js b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-get-static-field/input.js new file mode 100644 index 000000000000..70ab10f5eafd --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-get-static-field/input.js @@ -0,0 +1,4 @@ +class A { + static get #x() {} + static #x = 0; +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-get-static-field/options.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-get-static-field/options.json new file mode 100644 index 000000000000..af02072af9d9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-get-static-field/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["classPrivateProperties", "classPrivateMethods"] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-get-static-field/output.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-get-static-field/output.json new file mode 100644 index 000000000000..e0271651aae5 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-get-static-field/output.json @@ -0,0 +1,227 @@ +{ + "type": "File", + "start": 0, + "end": 49, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Duplicate private name #x (3:9)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 49, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 49, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "A" + }, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 8, + "end": 49, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "body": [ + { + "type": "ClassPrivateMethod", + "start": 12, + "end": 30, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 20 + } + }, + "static": true, + "key": { + "type": "PrivateName", + "start": 23, + "end": 25, + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 15 + } + }, + "id": { + "type": "Identifier", + "start": 24, + "end": 25, + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 15 + }, + "identifierName": "x" + }, + "name": "x" + } + }, + "computed": false, + "kind": "get", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 28, + "end": 30, + "loc": { + "start": { + "line": 2, + "column": 18 + }, + "end": { + "line": 2, + "column": 20 + } + }, + "body": [], + "directives": [] + } + }, + { + "type": "ClassPrivateProperty", + "start": 33, + "end": 47, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 16 + } + }, + "static": true, + "key": { + "type": "PrivateName", + "start": 40, + "end": 42, + "loc": { + "start": { + "line": 3, + "column": 9 + }, + "end": { + "line": 3, + "column": 11 + } + }, + "id": { + "type": "Identifier", + "start": 41, + "end": 42, + "loc": { + "start": { + "line": 3, + "column": 10 + }, + "end": { + "line": 3, + "column": 11 + }, + "identifierName": "x" + }, + "name": "x" + } + }, + "value": { + "type": "NumericLiteral", + "start": 45, + "end": 46, + "loc": { + "start": { + "line": 3, + "column": 14 + }, + "end": { + "line": 3, + "column": 15 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-get-static-get/input.js b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-get-static-get/input.js new file mode 100644 index 000000000000..dcb23a94a7fa --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-get-static-get/input.js @@ -0,0 +1,4 @@ +class A { + static get #x() {} + static get #x() {} +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-get-static-get/options.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-get-static-get/options.json new file mode 100644 index 000000000000..af02072af9d9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-get-static-get/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["classPrivateProperties", "classPrivateMethods"] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-get-static-get/output.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-get-static-get/output.json new file mode 100644 index 000000000000..dd680abb9878 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-get-static-get/output.json @@ -0,0 +1,230 @@ +{ + "type": "File", + "start": 0, + "end": 53, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Duplicate private name #x (3:13)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 53, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 53, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "A" + }, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 8, + "end": 53, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "body": [ + { + "type": "ClassPrivateMethod", + "start": 12, + "end": 30, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 20 + } + }, + "static": true, + "key": { + "type": "PrivateName", + "start": 23, + "end": 25, + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 15 + } + }, + "id": { + "type": "Identifier", + "start": 24, + "end": 25, + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 15 + }, + "identifierName": "x" + }, + "name": "x" + } + }, + "computed": false, + "kind": "get", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 28, + "end": 30, + "loc": { + "start": { + "line": 2, + "column": 18 + }, + "end": { + "line": 2, + "column": 20 + } + }, + "body": [], + "directives": [] + } + }, + { + "type": "ClassPrivateMethod", + "start": 33, + "end": 51, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 20 + } + }, + "static": true, + "key": { + "type": "PrivateName", + "start": 44, + "end": 46, + "loc": { + "start": { + "line": 3, + "column": 13 + }, + "end": { + "line": 3, + "column": 15 + } + }, + "id": { + "type": "Identifier", + "start": 45, + "end": 46, + "loc": { + "start": { + "line": 3, + "column": 14 + }, + "end": { + "line": 3, + "column": 15 + }, + "identifierName": "x" + }, + "name": "x" + } + }, + "computed": false, + "kind": "get", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 49, + "end": 51, + "loc": { + "start": { + "line": 3, + "column": 18 + }, + "end": { + "line": 3, + "column": 20 + } + }, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-get-static-method/input.js b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-get-static-method/input.js new file mode 100644 index 000000000000..5cf7a3e6524f --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-get-static-method/input.js @@ -0,0 +1,4 @@ +class A { + static get #x() {} + static #x() {} +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-get-static-method/options.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-get-static-method/options.json new file mode 100644 index 000000000000..af02072af9d9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-get-static-method/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["classPrivateProperties", "classPrivateMethods"] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-get-static-method/output.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-get-static-method/output.json new file mode 100644 index 000000000000..297ceb941b4b --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-get-static-method/output.json @@ -0,0 +1,229 @@ +{ + "type": "File", + "start": 0, + "end": 49, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Duplicate private name #x (3:9)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 49, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 49, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "A" + }, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 8, + "end": 49, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "body": [ + { + "type": "ClassPrivateMethod", + "start": 12, + "end": 30, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 20 + } + }, + "static": true, + "key": { + "type": "PrivateName", + "start": 23, + "end": 25, + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 15 + } + }, + "id": { + "type": "Identifier", + "start": 24, + "end": 25, + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 15 + }, + "identifierName": "x" + }, + "name": "x" + } + }, + "computed": false, + "kind": "get", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 28, + "end": 30, + "loc": { + "start": { + "line": 2, + "column": 18 + }, + "end": { + "line": 2, + "column": 20 + } + }, + "body": [], + "directives": [] + } + }, + { + "type": "ClassPrivateMethod", + "start": 33, + "end": 47, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 16 + } + }, + "static": true, + "key": { + "type": "PrivateName", + "start": 40, + "end": 42, + "loc": { + "start": { + "line": 3, + "column": 9 + }, + "end": { + "line": 3, + "column": 11 + } + }, + "id": { + "type": "Identifier", + "start": 41, + "end": 42, + "loc": { + "start": { + "line": 3, + "column": 10 + }, + "end": { + "line": 3, + "column": 11 + }, + "identifierName": "x" + }, + "name": "x" + } + }, + "kind": "method", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 45, + "end": 47, + "loc": { + "start": { + "line": 3, + "column": 14 + }, + "end": { + "line": 3, + "column": 16 + } + }, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-get-static-set/input.js b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-get-static-set/input.js new file mode 100644 index 000000000000..f13a22c0b724 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-get-static-set/input.js @@ -0,0 +1,4 @@ +class A { + static get #x() {} + static set #x(_) {} +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-get-static-set/output.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-get-static-set/output.json new file mode 100644 index 000000000000..cb14ff5bd58b --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-get-static-set/output.json @@ -0,0 +1,245 @@ +{ + "type": "File", + "start": 0, + "end": 54, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 54, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 54, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "A" + }, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 8, + "end": 54, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "body": [ + { + "type": "ClassPrivateMethod", + "start": 12, + "end": 30, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 20 + } + }, + "static": true, + "key": { + "type": "PrivateName", + "start": 23, + "end": 25, + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 15 + } + }, + "id": { + "type": "Identifier", + "start": 24, + "end": 25, + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 15 + }, + "identifierName": "x" + }, + "name": "x" + } + }, + "computed": false, + "kind": "get", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 28, + "end": 30, + "loc": { + "start": { + "line": 2, + "column": 18 + }, + "end": { + "line": 2, + "column": 20 + } + }, + "body": [], + "directives": [] + } + }, + { + "type": "ClassPrivateMethod", + "start": 33, + "end": 52, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 21 + } + }, + "static": true, + "key": { + "type": "PrivateName", + "start": 44, + "end": 46, + "loc": { + "start": { + "line": 3, + "column": 13 + }, + "end": { + "line": 3, + "column": 15 + } + }, + "id": { + "type": "Identifier", + "start": 45, + "end": 46, + "loc": { + "start": { + "line": 3, + "column": 14 + }, + "end": { + "line": 3, + "column": 15 + }, + "identifierName": "x" + }, + "name": "x" + } + }, + "computed": false, + "kind": "set", + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 47, + "end": 48, + "loc": { + "start": { + "line": 3, + "column": 16 + }, + "end": { + "line": 3, + "column": 17 + }, + "identifierName": "_" + }, + "name": "_" + } + ], + "body": { + "type": "BlockStatement", + "start": 50, + "end": 52, + "loc": { + "start": { + "line": 3, + "column": 19 + }, + "end": { + "line": 3, + "column": 21 + } + }, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-method-instance-field/input.js b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-method-instance-field/input.js new file mode 100644 index 000000000000..2e87605b197c --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-method-instance-field/input.js @@ -0,0 +1,4 @@ +class A { + static #x() {} + #x = 0; +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-method-instance-field/options.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-method-instance-field/options.json new file mode 100644 index 000000000000..af02072af9d9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-method-instance-field/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["classPrivateProperties", "classPrivateMethods"] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-method-instance-field/output.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-method-instance-field/output.json new file mode 100644 index 000000000000..e34c853586a9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-method-instance-field/output.json @@ -0,0 +1,226 @@ +{ + "type": "File", + "start": 0, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Duplicate private name #x (3:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "A" + }, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 8, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "body": [ + { + "type": "ClassPrivateMethod", + "start": 12, + "end": 26, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 16 + } + }, + "static": true, + "key": { + "type": "PrivateName", + "start": 19, + "end": 21, + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 11 + } + }, + "id": { + "type": "Identifier", + "start": 20, + "end": 21, + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 11 + }, + "identifierName": "x" + }, + "name": "x" + } + }, + "kind": "method", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 24, + "end": 26, + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 16 + } + }, + "body": [], + "directives": [] + } + }, + { + "type": "ClassPrivateProperty", + "start": 29, + "end": 36, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 9 + } + }, + "static": false, + "key": { + "type": "PrivateName", + "start": 29, + "end": 31, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 4 + } + }, + "id": { + "type": "Identifier", + "start": 30, + "end": 31, + "loc": { + "start": { + "line": 3, + "column": 3 + }, + "end": { + "line": 3, + "column": 4 + }, + "identifierName": "x" + }, + "name": "x" + } + }, + "value": { + "type": "NumericLiteral", + "start": 34, + "end": 35, + "loc": { + "start": { + "line": 3, + "column": 7 + }, + "end": { + "line": 3, + "column": 8 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-method-instance-get/input.js b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-method-instance-get/input.js new file mode 100644 index 000000000000..d714c04e0f50 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-method-instance-get/input.js @@ -0,0 +1,4 @@ +class A { + static #x() {} + get #x() {} +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-method-instance-get/options.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-method-instance-get/options.json new file mode 100644 index 000000000000..af02072af9d9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-method-instance-get/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["classPrivateProperties", "classPrivateMethods"] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-method-instance-get/output.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-method-instance-get/output.json new file mode 100644 index 000000000000..c6b5cb7b3f5b --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-method-instance-get/output.json @@ -0,0 +1,229 @@ +{ + "type": "File", + "start": 0, + "end": 42, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Duplicate private name #x (3:6)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 42, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 42, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "A" + }, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 8, + "end": 42, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "body": [ + { + "type": "ClassPrivateMethod", + "start": 12, + "end": 26, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 16 + } + }, + "static": true, + "key": { + "type": "PrivateName", + "start": 19, + "end": 21, + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 11 + } + }, + "id": { + "type": "Identifier", + "start": 20, + "end": 21, + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 11 + }, + "identifierName": "x" + }, + "name": "x" + } + }, + "kind": "method", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 24, + "end": 26, + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 16 + } + }, + "body": [], + "directives": [] + } + }, + { + "type": "ClassPrivateMethod", + "start": 29, + "end": 40, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 13 + } + }, + "static": false, + "key": { + "type": "PrivateName", + "start": 33, + "end": 35, + "loc": { + "start": { + "line": 3, + "column": 6 + }, + "end": { + "line": 3, + "column": 8 + } + }, + "id": { + "type": "Identifier", + "start": 34, + "end": 35, + "loc": { + "start": { + "line": 3, + "column": 7 + }, + "end": { + "line": 3, + "column": 8 + }, + "identifierName": "x" + }, + "name": "x" + } + }, + "computed": false, + "kind": "get", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 38, + "end": 40, + "loc": { + "start": { + "line": 3, + "column": 11 + }, + "end": { + "line": 3, + "column": 13 + } + }, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-method-instance-method/input.js b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-method-instance-method/input.js new file mode 100644 index 000000000000..520c9088d109 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-method-instance-method/input.js @@ -0,0 +1,4 @@ +class A { + static #x() {} + #x() {} +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-method-instance-method/options.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-method-instance-method/options.json new file mode 100644 index 000000000000..af02072af9d9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-method-instance-method/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["classPrivateProperties", "classPrivateMethods"] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-method-instance-method/output.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-method-instance-method/output.json new file mode 100644 index 000000000000..56572b56584e --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-method-instance-method/output.json @@ -0,0 +1,228 @@ +{ + "type": "File", + "start": 0, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Duplicate private name #x (3:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "A" + }, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 8, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "body": [ + { + "type": "ClassPrivateMethod", + "start": 12, + "end": 26, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 16 + } + }, + "static": true, + "key": { + "type": "PrivateName", + "start": 19, + "end": 21, + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 11 + } + }, + "id": { + "type": "Identifier", + "start": 20, + "end": 21, + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 11 + }, + "identifierName": "x" + }, + "name": "x" + } + }, + "kind": "method", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 24, + "end": 26, + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 16 + } + }, + "body": [], + "directives": [] + } + }, + { + "type": "ClassPrivateMethod", + "start": 29, + "end": 36, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 9 + } + }, + "static": false, + "key": { + "type": "PrivateName", + "start": 29, + "end": 31, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 4 + } + }, + "id": { + "type": "Identifier", + "start": 30, + "end": 31, + "loc": { + "start": { + "line": 3, + "column": 3 + }, + "end": { + "line": 3, + "column": 4 + }, + "identifierName": "x" + }, + "name": "x" + } + }, + "kind": "method", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 34, + "end": 36, + "loc": { + "start": { + "line": 3, + "column": 7 + }, + "end": { + "line": 3, + "column": 9 + } + }, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-method-instance-set/input.js b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-method-instance-set/input.js new file mode 100644 index 000000000000..b2c76dfa77f4 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-method-instance-set/input.js @@ -0,0 +1,4 @@ +class A { + static #x() {} + set #x(_) {} +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-method-instance-set/options.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-method-instance-set/options.json new file mode 100644 index 000000000000..af02072af9d9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-method-instance-set/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["classPrivateProperties", "classPrivateMethods"] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-method-instance-set/output.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-method-instance-set/output.json new file mode 100644 index 000000000000..b8a0773cf4d6 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-method-instance-set/output.json @@ -0,0 +1,247 @@ +{ + "type": "File", + "start": 0, + "end": 43, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Duplicate private name #x (3:6)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 43, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 43, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "A" + }, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 8, + "end": 43, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "body": [ + { + "type": "ClassPrivateMethod", + "start": 12, + "end": 26, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 16 + } + }, + "static": true, + "key": { + "type": "PrivateName", + "start": 19, + "end": 21, + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 11 + } + }, + "id": { + "type": "Identifier", + "start": 20, + "end": 21, + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 11 + }, + "identifierName": "x" + }, + "name": "x" + } + }, + "kind": "method", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 24, + "end": 26, + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 16 + } + }, + "body": [], + "directives": [] + } + }, + { + "type": "ClassPrivateMethod", + "start": 29, + "end": 41, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 14 + } + }, + "static": false, + "key": { + "type": "PrivateName", + "start": 33, + "end": 35, + "loc": { + "start": { + "line": 3, + "column": 6 + }, + "end": { + "line": 3, + "column": 8 + } + }, + "id": { + "type": "Identifier", + "start": 34, + "end": 35, + "loc": { + "start": { + "line": 3, + "column": 7 + }, + "end": { + "line": 3, + "column": 8 + }, + "identifierName": "x" + }, + "name": "x" + } + }, + "computed": false, + "kind": "set", + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 36, + "end": 37, + "loc": { + "start": { + "line": 3, + "column": 9 + }, + "end": { + "line": 3, + "column": 10 + }, + "identifierName": "_" + }, + "name": "_" + } + ], + "body": { + "type": "BlockStatement", + "start": 39, + "end": 41, + "loc": { + "start": { + "line": 3, + "column": 12 + }, + "end": { + "line": 3, + "column": 14 + } + }, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-method-static-field/input.js b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-method-static-field/input.js new file mode 100644 index 000000000000..24d63ae53646 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-method-static-field/input.js @@ -0,0 +1,4 @@ +class A { + static #x() {} + static #x = 0; +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-method-static-field/options.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-method-static-field/options.json new file mode 100644 index 000000000000..af02072af9d9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-method-static-field/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["classPrivateProperties", "classPrivateMethods"] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-method-static-field/output.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-method-static-field/output.json new file mode 100644 index 000000000000..dfaf6f688e1e --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-method-static-field/output.json @@ -0,0 +1,226 @@ +{ + "type": "File", + "start": 0, + "end": 45, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Duplicate private name #x (3:9)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 45, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 45, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "A" + }, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 8, + "end": 45, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "body": [ + { + "type": "ClassPrivateMethod", + "start": 12, + "end": 26, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 16 + } + }, + "static": true, + "key": { + "type": "PrivateName", + "start": 19, + "end": 21, + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 11 + } + }, + "id": { + "type": "Identifier", + "start": 20, + "end": 21, + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 11 + }, + "identifierName": "x" + }, + "name": "x" + } + }, + "kind": "method", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 24, + "end": 26, + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 16 + } + }, + "body": [], + "directives": [] + } + }, + { + "type": "ClassPrivateProperty", + "start": 29, + "end": 43, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 16 + } + }, + "static": true, + "key": { + "type": "PrivateName", + "start": 36, + "end": 38, + "loc": { + "start": { + "line": 3, + "column": 9 + }, + "end": { + "line": 3, + "column": 11 + } + }, + "id": { + "type": "Identifier", + "start": 37, + "end": 38, + "loc": { + "start": { + "line": 3, + "column": 10 + }, + "end": { + "line": 3, + "column": 11 + }, + "identifierName": "x" + }, + "name": "x" + } + }, + "value": { + "type": "NumericLiteral", + "start": 41, + "end": 42, + "loc": { + "start": { + "line": 3, + "column": 14 + }, + "end": { + "line": 3, + "column": 15 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-method-static-get/input.js b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-method-static-get/input.js new file mode 100644 index 000000000000..8a3c3ff6a962 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-method-static-get/input.js @@ -0,0 +1,4 @@ +class A { + static #x() {} + static get #x() {} +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-method-static-get/options.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-method-static-get/options.json new file mode 100644 index 000000000000..af02072af9d9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-method-static-get/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["classPrivateProperties", "classPrivateMethods"] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-method-static-get/output.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-method-static-get/output.json new file mode 100644 index 000000000000..e019b3c9aaaa --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-method-static-get/output.json @@ -0,0 +1,229 @@ +{ + "type": "File", + "start": 0, + "end": 49, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Duplicate private name #x (3:13)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 49, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 49, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "A" + }, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 8, + "end": 49, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "body": [ + { + "type": "ClassPrivateMethod", + "start": 12, + "end": 26, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 16 + } + }, + "static": true, + "key": { + "type": "PrivateName", + "start": 19, + "end": 21, + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 11 + } + }, + "id": { + "type": "Identifier", + "start": 20, + "end": 21, + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 11 + }, + "identifierName": "x" + }, + "name": "x" + } + }, + "kind": "method", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 24, + "end": 26, + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 16 + } + }, + "body": [], + "directives": [] + } + }, + { + "type": "ClassPrivateMethod", + "start": 29, + "end": 47, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 20 + } + }, + "static": true, + "key": { + "type": "PrivateName", + "start": 40, + "end": 42, + "loc": { + "start": { + "line": 3, + "column": 13 + }, + "end": { + "line": 3, + "column": 15 + } + }, + "id": { + "type": "Identifier", + "start": 41, + "end": 42, + "loc": { + "start": { + "line": 3, + "column": 14 + }, + "end": { + "line": 3, + "column": 15 + }, + "identifierName": "x" + }, + "name": "x" + } + }, + "computed": false, + "kind": "get", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 45, + "end": 47, + "loc": { + "start": { + "line": 3, + "column": 18 + }, + "end": { + "line": 3, + "column": 20 + } + }, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-method-static-method/input.js b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-method-static-method/input.js new file mode 100644 index 000000000000..316f6d89f48f --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-method-static-method/input.js @@ -0,0 +1,4 @@ +class A { + static #x() {} + static #x() {} +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-method-static-method/options.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-method-static-method/options.json new file mode 100644 index 000000000000..af02072af9d9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-method-static-method/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["classPrivateProperties", "classPrivateMethods"] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-method-static-method/output.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-method-static-method/output.json new file mode 100644 index 000000000000..029d9cd6f8a3 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-method-static-method/output.json @@ -0,0 +1,228 @@ +{ + "type": "File", + "start": 0, + "end": 45, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Duplicate private name #x (3:9)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 45, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 45, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "A" + }, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 8, + "end": 45, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "body": [ + { + "type": "ClassPrivateMethod", + "start": 12, + "end": 26, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 16 + } + }, + "static": true, + "key": { + "type": "PrivateName", + "start": 19, + "end": 21, + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 11 + } + }, + "id": { + "type": "Identifier", + "start": 20, + "end": 21, + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 11 + }, + "identifierName": "x" + }, + "name": "x" + } + }, + "kind": "method", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 24, + "end": 26, + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 16 + } + }, + "body": [], + "directives": [] + } + }, + { + "type": "ClassPrivateMethod", + "start": 29, + "end": 43, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 16 + } + }, + "static": true, + "key": { + "type": "PrivateName", + "start": 36, + "end": 38, + "loc": { + "start": { + "line": 3, + "column": 9 + }, + "end": { + "line": 3, + "column": 11 + } + }, + "id": { + "type": "Identifier", + "start": 37, + "end": 38, + "loc": { + "start": { + "line": 3, + "column": 10 + }, + "end": { + "line": 3, + "column": 11 + }, + "identifierName": "x" + }, + "name": "x" + } + }, + "kind": "method", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 41, + "end": 43, + "loc": { + "start": { + "line": 3, + "column": 14 + }, + "end": { + "line": 3, + "column": 16 + } + }, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-method-static-set/input.js b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-method-static-set/input.js new file mode 100644 index 000000000000..590b70f3987e --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-method-static-set/input.js @@ -0,0 +1,4 @@ +class A { + static #x() {} + static set #x(_) {} +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-method-static-set/options.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-method-static-set/options.json new file mode 100644 index 000000000000..af02072af9d9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-method-static-set/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["classPrivateProperties", "classPrivateMethods"] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-method-static-set/output.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-method-static-set/output.json new file mode 100644 index 000000000000..d788eda7fd02 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-method-static-set/output.json @@ -0,0 +1,247 @@ +{ + "type": "File", + "start": 0, + "end": 50, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Duplicate private name #x (3:13)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 50, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 50, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "A" + }, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 8, + "end": 50, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "body": [ + { + "type": "ClassPrivateMethod", + "start": 12, + "end": 26, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 16 + } + }, + "static": true, + "key": { + "type": "PrivateName", + "start": 19, + "end": 21, + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 11 + } + }, + "id": { + "type": "Identifier", + "start": 20, + "end": 21, + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 11 + }, + "identifierName": "x" + }, + "name": "x" + } + }, + "kind": "method", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 24, + "end": 26, + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 16 + } + }, + "body": [], + "directives": [] + } + }, + { + "type": "ClassPrivateMethod", + "start": 29, + "end": 48, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 21 + } + }, + "static": true, + "key": { + "type": "PrivateName", + "start": 40, + "end": 42, + "loc": { + "start": { + "line": 3, + "column": 13 + }, + "end": { + "line": 3, + "column": 15 + } + }, + "id": { + "type": "Identifier", + "start": 41, + "end": 42, + "loc": { + "start": { + "line": 3, + "column": 14 + }, + "end": { + "line": 3, + "column": 15 + }, + "identifierName": "x" + }, + "name": "x" + } + }, + "computed": false, + "kind": "set", + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 43, + "end": 44, + "loc": { + "start": { + "line": 3, + "column": 16 + }, + "end": { + "line": 3, + "column": 17 + }, + "identifierName": "_" + }, + "name": "_" + } + ], + "body": { + "type": "BlockStatement", + "start": 46, + "end": 48, + "loc": { + "start": { + "line": 3, + "column": 19 + }, + "end": { + "line": 3, + "column": 21 + } + }, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-set-instance-field/input.js b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-set-instance-field/input.js new file mode 100644 index 000000000000..315703f68bce --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-set-instance-field/input.js @@ -0,0 +1,4 @@ +class A { + static set #x(_) {} + #x = 0; +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-set-instance-field/options.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-set-instance-field/options.json new file mode 100644 index 000000000000..af02072af9d9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-set-instance-field/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["classPrivateProperties", "classPrivateMethods"] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-set-instance-field/output.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-set-instance-field/output.json new file mode 100644 index 000000000000..b50939f38415 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-set-instance-field/output.json @@ -0,0 +1,245 @@ +{ + "type": "File", + "start": 0, + "end": 43, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Duplicate private name #x (3:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 43, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 43, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "A" + }, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 8, + "end": 43, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "body": [ + { + "type": "ClassPrivateMethod", + "start": 12, + "end": 31, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 21 + } + }, + "static": true, + "key": { + "type": "PrivateName", + "start": 23, + "end": 25, + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 15 + } + }, + "id": { + "type": "Identifier", + "start": 24, + "end": 25, + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 15 + }, + "identifierName": "x" + }, + "name": "x" + } + }, + "computed": false, + "kind": "set", + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 26, + "end": 27, + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 17 + }, + "identifierName": "_" + }, + "name": "_" + } + ], + "body": { + "type": "BlockStatement", + "start": 29, + "end": 31, + "loc": { + "start": { + "line": 2, + "column": 19 + }, + "end": { + "line": 2, + "column": 21 + } + }, + "body": [], + "directives": [] + } + }, + { + "type": "ClassPrivateProperty", + "start": 34, + "end": 41, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 9 + } + }, + "static": false, + "key": { + "type": "PrivateName", + "start": 34, + "end": 36, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 4 + } + }, + "id": { + "type": "Identifier", + "start": 35, + "end": 36, + "loc": { + "start": { + "line": 3, + "column": 3 + }, + "end": { + "line": 3, + "column": 4 + }, + "identifierName": "x" + }, + "name": "x" + } + }, + "value": { + "type": "NumericLiteral", + "start": 39, + "end": 40, + "loc": { + "start": { + "line": 3, + "column": 7 + }, + "end": { + "line": 3, + "column": 8 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-set-instance-get/input.js b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-set-instance-get/input.js new file mode 100644 index 000000000000..b2515ac17405 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-set-instance-get/input.js @@ -0,0 +1,4 @@ +class A { + static set #x(_) {} + get #x() {} +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-set-instance-get/options.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-set-instance-get/options.json new file mode 100644 index 000000000000..af02072af9d9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-set-instance-get/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["classPrivateProperties", "classPrivateMethods"] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-set-instance-get/output.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-set-instance-get/output.json new file mode 100644 index 000000000000..ddea1a756790 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-set-instance-get/output.json @@ -0,0 +1,248 @@ +{ + "type": "File", + "start": 0, + "end": 47, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Duplicate private name #x (3:6)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 47, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 47, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "A" + }, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 8, + "end": 47, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "body": [ + { + "type": "ClassPrivateMethod", + "start": 12, + "end": 31, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 21 + } + }, + "static": true, + "key": { + "type": "PrivateName", + "start": 23, + "end": 25, + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 15 + } + }, + "id": { + "type": "Identifier", + "start": 24, + "end": 25, + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 15 + }, + "identifierName": "x" + }, + "name": "x" + } + }, + "computed": false, + "kind": "set", + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 26, + "end": 27, + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 17 + }, + "identifierName": "_" + }, + "name": "_" + } + ], + "body": { + "type": "BlockStatement", + "start": 29, + "end": 31, + "loc": { + "start": { + "line": 2, + "column": 19 + }, + "end": { + "line": 2, + "column": 21 + } + }, + "body": [], + "directives": [] + } + }, + { + "type": "ClassPrivateMethod", + "start": 34, + "end": 45, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 13 + } + }, + "static": false, + "key": { + "type": "PrivateName", + "start": 38, + "end": 40, + "loc": { + "start": { + "line": 3, + "column": 6 + }, + "end": { + "line": 3, + "column": 8 + } + }, + "id": { + "type": "Identifier", + "start": 39, + "end": 40, + "loc": { + "start": { + "line": 3, + "column": 7 + }, + "end": { + "line": 3, + "column": 8 + }, + "identifierName": "x" + }, + "name": "x" + } + }, + "computed": false, + "kind": "get", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 43, + "end": 45, + "loc": { + "start": { + "line": 3, + "column": 11 + }, + "end": { + "line": 3, + "column": 13 + } + }, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-set-instance-method/input.js b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-set-instance-method/input.js new file mode 100644 index 000000000000..8249487ab52e --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-set-instance-method/input.js @@ -0,0 +1,4 @@ +class A { + static set #x(_) {} + #x() {} +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-set-instance-method/options.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-set-instance-method/options.json new file mode 100644 index 000000000000..af02072af9d9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-set-instance-method/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["classPrivateProperties", "classPrivateMethods"] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-set-instance-method/output.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-set-instance-method/output.json new file mode 100644 index 000000000000..3b9334d91225 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-set-instance-method/output.json @@ -0,0 +1,247 @@ +{ + "type": "File", + "start": 0, + "end": 43, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Duplicate private name #x (3:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 43, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 43, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "A" + }, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 8, + "end": 43, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "body": [ + { + "type": "ClassPrivateMethod", + "start": 12, + "end": 31, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 21 + } + }, + "static": true, + "key": { + "type": "PrivateName", + "start": 23, + "end": 25, + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 15 + } + }, + "id": { + "type": "Identifier", + "start": 24, + "end": 25, + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 15 + }, + "identifierName": "x" + }, + "name": "x" + } + }, + "computed": false, + "kind": "set", + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 26, + "end": 27, + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 17 + }, + "identifierName": "_" + }, + "name": "_" + } + ], + "body": { + "type": "BlockStatement", + "start": 29, + "end": 31, + "loc": { + "start": { + "line": 2, + "column": 19 + }, + "end": { + "line": 2, + "column": 21 + } + }, + "body": [], + "directives": [] + } + }, + { + "type": "ClassPrivateMethod", + "start": 34, + "end": 41, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 9 + } + }, + "static": false, + "key": { + "type": "PrivateName", + "start": 34, + "end": 36, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 4 + } + }, + "id": { + "type": "Identifier", + "start": 35, + "end": 36, + "loc": { + "start": { + "line": 3, + "column": 3 + }, + "end": { + "line": 3, + "column": 4 + }, + "identifierName": "x" + }, + "name": "x" + } + }, + "kind": "method", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 39, + "end": 41, + "loc": { + "start": { + "line": 3, + "column": 7 + }, + "end": { + "line": 3, + "column": 9 + } + }, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-set-instance-set/input.js b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-set-instance-set/input.js new file mode 100644 index 000000000000..3b7d8653ee40 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-set-instance-set/input.js @@ -0,0 +1,4 @@ +class A { + static set #x(_) {} + set #x(_) {} +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-set-instance-set/options.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-set-instance-set/options.json new file mode 100644 index 000000000000..af02072af9d9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-set-instance-set/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["classPrivateProperties", "classPrivateMethods"] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-set-instance-set/output.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-set-instance-set/output.json new file mode 100644 index 000000000000..b56cf90f93db --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-set-instance-set/output.json @@ -0,0 +1,266 @@ +{ + "type": "File", + "start": 0, + "end": 48, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Duplicate private name #x (3:6)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 48, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 48, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "A" + }, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 8, + "end": 48, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "body": [ + { + "type": "ClassPrivateMethod", + "start": 12, + "end": 31, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 21 + } + }, + "static": true, + "key": { + "type": "PrivateName", + "start": 23, + "end": 25, + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 15 + } + }, + "id": { + "type": "Identifier", + "start": 24, + "end": 25, + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 15 + }, + "identifierName": "x" + }, + "name": "x" + } + }, + "computed": false, + "kind": "set", + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 26, + "end": 27, + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 17 + }, + "identifierName": "_" + }, + "name": "_" + } + ], + "body": { + "type": "BlockStatement", + "start": 29, + "end": 31, + "loc": { + "start": { + "line": 2, + "column": 19 + }, + "end": { + "line": 2, + "column": 21 + } + }, + "body": [], + "directives": [] + } + }, + { + "type": "ClassPrivateMethod", + "start": 34, + "end": 46, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 14 + } + }, + "static": false, + "key": { + "type": "PrivateName", + "start": 38, + "end": 40, + "loc": { + "start": { + "line": 3, + "column": 6 + }, + "end": { + "line": 3, + "column": 8 + } + }, + "id": { + "type": "Identifier", + "start": 39, + "end": 40, + "loc": { + "start": { + "line": 3, + "column": 7 + }, + "end": { + "line": 3, + "column": 8 + }, + "identifierName": "x" + }, + "name": "x" + } + }, + "computed": false, + "kind": "set", + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 41, + "end": 42, + "loc": { + "start": { + "line": 3, + "column": 9 + }, + "end": { + "line": 3, + "column": 10 + }, + "identifierName": "_" + }, + "name": "_" + } + ], + "body": { + "type": "BlockStatement", + "start": 44, + "end": 46, + "loc": { + "start": { + "line": 3, + "column": 12 + }, + "end": { + "line": 3, + "column": 14 + } + }, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-set-static-field/input.js b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-set-static-field/input.js new file mode 100644 index 000000000000..3dfbfe2861d4 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-set-static-field/input.js @@ -0,0 +1,4 @@ +class A { + static set #x(_) {} + static #x = 0; +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-set-static-field/options.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-set-static-field/options.json new file mode 100644 index 000000000000..af02072af9d9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-set-static-field/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["classPrivateProperties", "classPrivateMethods"] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-set-static-field/output.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-set-static-field/output.json new file mode 100644 index 000000000000..c063c6722c93 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-set-static-field/output.json @@ -0,0 +1,245 @@ +{ + "type": "File", + "start": 0, + "end": 50, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Duplicate private name #x (3:9)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 50, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 50, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "A" + }, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 8, + "end": 50, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "body": [ + { + "type": "ClassPrivateMethod", + "start": 12, + "end": 31, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 21 + } + }, + "static": true, + "key": { + "type": "PrivateName", + "start": 23, + "end": 25, + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 15 + } + }, + "id": { + "type": "Identifier", + "start": 24, + "end": 25, + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 15 + }, + "identifierName": "x" + }, + "name": "x" + } + }, + "computed": false, + "kind": "set", + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 26, + "end": 27, + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 17 + }, + "identifierName": "_" + }, + "name": "_" + } + ], + "body": { + "type": "BlockStatement", + "start": 29, + "end": 31, + "loc": { + "start": { + "line": 2, + "column": 19 + }, + "end": { + "line": 2, + "column": 21 + } + }, + "body": [], + "directives": [] + } + }, + { + "type": "ClassPrivateProperty", + "start": 34, + "end": 48, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 16 + } + }, + "static": true, + "key": { + "type": "PrivateName", + "start": 41, + "end": 43, + "loc": { + "start": { + "line": 3, + "column": 9 + }, + "end": { + "line": 3, + "column": 11 + } + }, + "id": { + "type": "Identifier", + "start": 42, + "end": 43, + "loc": { + "start": { + "line": 3, + "column": 10 + }, + "end": { + "line": 3, + "column": 11 + }, + "identifierName": "x" + }, + "name": "x" + } + }, + "value": { + "type": "NumericLiteral", + "start": 46, + "end": 47, + "loc": { + "start": { + "line": 3, + "column": 14 + }, + "end": { + "line": 3, + "column": 15 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-set-static-get/input.js b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-set-static-get/input.js new file mode 100644 index 000000000000..5ac842d7dc2f --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-set-static-get/input.js @@ -0,0 +1,4 @@ +class A { + static set #x(_) {} + static get #x() {} +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-set-static-get/output.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-set-static-get/output.json new file mode 100644 index 000000000000..06b5a7c528b0 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-set-static-get/output.json @@ -0,0 +1,245 @@ +{ + "type": "File", + "start": 0, + "end": 54, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 54, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 54, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "A" + }, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 8, + "end": 54, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "body": [ + { + "type": "ClassPrivateMethod", + "start": 12, + "end": 31, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 21 + } + }, + "static": true, + "key": { + "type": "PrivateName", + "start": 23, + "end": 25, + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 15 + } + }, + "id": { + "type": "Identifier", + "start": 24, + "end": 25, + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 15 + }, + "identifierName": "x" + }, + "name": "x" + } + }, + "computed": false, + "kind": "set", + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 26, + "end": 27, + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 17 + }, + "identifierName": "_" + }, + "name": "_" + } + ], + "body": { + "type": "BlockStatement", + "start": 29, + "end": 31, + "loc": { + "start": { + "line": 2, + "column": 19 + }, + "end": { + "line": 2, + "column": 21 + } + }, + "body": [], + "directives": [] + } + }, + { + "type": "ClassPrivateMethod", + "start": 34, + "end": 52, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 20 + } + }, + "static": true, + "key": { + "type": "PrivateName", + "start": 45, + "end": 47, + "loc": { + "start": { + "line": 3, + "column": 13 + }, + "end": { + "line": 3, + "column": 15 + } + }, + "id": { + "type": "Identifier", + "start": 46, + "end": 47, + "loc": { + "start": { + "line": 3, + "column": 14 + }, + "end": { + "line": 3, + "column": 15 + }, + "identifierName": "x" + }, + "name": "x" + } + }, + "computed": false, + "kind": "get", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 50, + "end": 52, + "loc": { + "start": { + "line": 3, + "column": 18 + }, + "end": { + "line": 3, + "column": 20 + } + }, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-set-static-method/input.js b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-set-static-method/input.js new file mode 100644 index 000000000000..3f3537bcb0a0 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-set-static-method/input.js @@ -0,0 +1,4 @@ +class A { + static set #x(_) {} + static #x() {} +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-set-static-method/options.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-set-static-method/options.json new file mode 100644 index 000000000000..af02072af9d9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-set-static-method/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["classPrivateProperties", "classPrivateMethods"] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-set-static-method/output.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-set-static-method/output.json new file mode 100644 index 000000000000..78b17369506f --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-set-static-method/output.json @@ -0,0 +1,247 @@ +{ + "type": "File", + "start": 0, + "end": 50, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Duplicate private name #x (3:9)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 50, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 50, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "A" + }, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 8, + "end": 50, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "body": [ + { + "type": "ClassPrivateMethod", + "start": 12, + "end": 31, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 21 + } + }, + "static": true, + "key": { + "type": "PrivateName", + "start": 23, + "end": 25, + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 15 + } + }, + "id": { + "type": "Identifier", + "start": 24, + "end": 25, + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 15 + }, + "identifierName": "x" + }, + "name": "x" + } + }, + "computed": false, + "kind": "set", + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 26, + "end": 27, + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 17 + }, + "identifierName": "_" + }, + "name": "_" + } + ], + "body": { + "type": "BlockStatement", + "start": 29, + "end": 31, + "loc": { + "start": { + "line": 2, + "column": 19 + }, + "end": { + "line": 2, + "column": 21 + } + }, + "body": [], + "directives": [] + } + }, + { + "type": "ClassPrivateMethod", + "start": 34, + "end": 48, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 16 + } + }, + "static": true, + "key": { + "type": "PrivateName", + "start": 41, + "end": 43, + "loc": { + "start": { + "line": 3, + "column": 9 + }, + "end": { + "line": 3, + "column": 11 + } + }, + "id": { + "type": "Identifier", + "start": 42, + "end": 43, + "loc": { + "start": { + "line": 3, + "column": 10 + }, + "end": { + "line": 3, + "column": 11 + }, + "identifierName": "x" + }, + "name": "x" + } + }, + "kind": "method", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 46, + "end": 48, + "loc": { + "start": { + "line": 3, + "column": 14 + }, + "end": { + "line": 3, + "column": 16 + } + }, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-set-static-set/input.js b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-set-static-set/input.js new file mode 100644 index 000000000000..d6337e16b74f --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-set-static-set/input.js @@ -0,0 +1,4 @@ +class A { + static set #x(_) {} + static set #x(_) {} +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-set-static-set/options.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-set-static-set/options.json new file mode 100644 index 000000000000..af02072af9d9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-set-static-set/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["classPrivateProperties", "classPrivateMethods"] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-set-static-set/output.json b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-set-static-set/output.json new file mode 100644 index 000000000000..146f1c39f34d --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-names-duplicated/static-set-static-set/output.json @@ -0,0 +1,266 @@ +{ + "type": "File", + "start": 0, + "end": 55, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Duplicate private name #x (3:13)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 55, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 55, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "A" + }, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 8, + "end": 55, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "body": [ + { + "type": "ClassPrivateMethod", + "start": 12, + "end": 31, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 21 + } + }, + "static": true, + "key": { + "type": "PrivateName", + "start": 23, + "end": 25, + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 15 + } + }, + "id": { + "type": "Identifier", + "start": 24, + "end": 25, + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 15 + }, + "identifierName": "x" + }, + "name": "x" + } + }, + "computed": false, + "kind": "set", + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 26, + "end": 27, + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 17 + }, + "identifierName": "_" + }, + "name": "_" + } + ], + "body": { + "type": "BlockStatement", + "start": 29, + "end": 31, + "loc": { + "start": { + "line": 2, + "column": 19 + }, + "end": { + "line": 2, + "column": 21 + } + }, + "body": [], + "directives": [] + } + }, + { + "type": "ClassPrivateMethod", + "start": 34, + "end": 53, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 21 + } + }, + "static": true, + "key": { + "type": "PrivateName", + "start": 45, + "end": 47, + "loc": { + "start": { + "line": 3, + "column": 13 + }, + "end": { + "line": 3, + "column": 15 + } + }, + "id": { + "type": "Identifier", + "start": 46, + "end": 47, + "loc": { + "start": { + "line": 3, + "column": 14 + }, + "end": { + "line": 3, + "column": 15 + }, + "identifierName": "x" + }, + "name": "x" + } + }, + "computed": false, + "kind": "set", + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 48, + "end": 49, + "loc": { + "start": { + "line": 3, + "column": 16 + }, + "end": { + "line": 3, + "column": 17 + }, + "identifierName": "_" + }, + "name": "_" + } + ], + "body": { + "type": "BlockStatement", + "start": 51, + "end": 53, + "loc": { + "start": { + "line": 3, + "column": 19 + }, + "end": { + "line": 3, + "column": 21 + } + }, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-properties/await-in-async-in-private-property/input.js b/packages/babel-parser/test/fixtures/experimental/class-private-properties/await-in-async-in-private-property/input.js new file mode 100644 index 000000000000..f01601af7a3a --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-properties/await-in-async-in-private-property/input.js @@ -0,0 +1,3 @@ +class C { + #p = async () => await 42; +} diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-properties/await-in-async-in-private-property/options.json b/packages/babel-parser/test/fixtures/experimental/class-private-properties/await-in-async-in-private-property/options.json new file mode 100644 index 000000000000..f26e916957c8 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-properties/await-in-async-in-private-property/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["classPrivateProperties"] +} diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-properties/await-in-async-in-private-property/output.json b/packages/babel-parser/test/fixtures/experimental/class-private-properties/await-in-async-in-private-property/output.json new file mode 100644 index 000000000000..ebac6a0e3b90 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-properties/await-in-async-in-private-property/output.json @@ -0,0 +1,187 @@ +{ + "type": "File", + "start": 0, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "C" + }, + "name": "C" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 8, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": [ + { + "type": "ClassPrivateProperty", + "start": 12, + "end": 38, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 28 + } + }, + "static": false, + "key": { + "type": "PrivateName", + "start": 12, + "end": 14, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 4 + } + }, + "id": { + "type": "Identifier", + "start": 13, + "end": 14, + "loc": { + "start": { + "line": 2, + "column": 3 + }, + "end": { + "line": 2, + "column": 4 + }, + "identifierName": "p" + }, + "name": "p" + } + }, + "value": { + "type": "ArrowFunctionExpression", + "start": 17, + "end": 37, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 27 + } + }, + "id": null, + "generator": false, + "async": true, + "params": [], + "body": { + "type": "AwaitExpression", + "start": 29, + "end": 37, + "loc": { + "start": { + "line": 2, + "column": 19 + }, + "end": { + "line": 2, + "column": 27 + } + }, + "argument": { + "type": "NumericLiteral", + "start": 35, + "end": 37, + "loc": { + "start": { + "line": 2, + "column": 25 + }, + "end": { + "line": 2, + "column": 27 + } + }, + "extra": { + "rawValue": 42, + "raw": "42" + }, + "value": 42 + } + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-properties/await-in-private-property-in-async/input.js b/packages/babel-parser/test/fixtures/experimental/class-private-properties/await-in-private-property-in-async/input.js new file mode 100644 index 000000000000..f2cbab75f49c --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-properties/await-in-private-property-in-async/input.js @@ -0,0 +1,6 @@ +async () => { + class C { + // here await is an identifier reference + #p = await + 42; + } +} diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-properties/await-in-private-property-in-async/options.json b/packages/babel-parser/test/fixtures/experimental/class-private-properties/await-in-private-property-in-async/options.json new file mode 100644 index 000000000000..f26e916957c8 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-properties/await-in-private-property-in-async/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["classPrivateProperties"] +} diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-properties/await-in-private-property-in-async/output.json b/packages/babel-parser/test/fixtures/experimental/class-private-properties/await-in-private-property-in-async/output.json new file mode 100644 index 000000000000..cc5429e9fce3 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-properties/await-in-private-property-in-async/output.json @@ -0,0 +1,274 @@ +{ + "type": "File", + "start": 0, + "end": 97, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 6, + "column": 1 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 97, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 6, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 97, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 6, + "column": 1 + } + }, + "expression": { + "type": "ArrowFunctionExpression", + "start": 0, + "end": 97, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 6, + "column": 1 + } + }, + "id": null, + "generator": false, + "async": true, + "params": [], + "body": { + "type": "BlockStatement", + "start": 12, + "end": 97, + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 6, + "column": 1 + } + }, + "body": [ + { + "type": "ClassDeclaration", + "start": 16, + "end": 95, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 5, + "column": 3 + } + }, + "id": { + "type": "Identifier", + "start": 22, + "end": 23, + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 9 + }, + "identifierName": "C" + }, + "name": "C" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 24, + "end": 95, + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 5, + "column": 3 + } + }, + "body": [ + { + "type": "ClassPrivateProperty", + "start": 75, + "end": 91, + "loc": { + "start": { + "line": 4, + "column": 4 + }, + "end": { + "line": 4, + "column": 20 + } + }, + "static": false, + "key": { + "type": "PrivateName", + "start": 75, + "end": 77, + "loc": { + "start": { + "line": 4, + "column": 4 + }, + "end": { + "line": 4, + "column": 6 + } + }, + "id": { + "type": "Identifier", + "start": 76, + "end": 77, + "loc": { + "start": { + "line": 4, + "column": 5 + }, + "end": { + "line": 4, + "column": 6 + }, + "identifierName": "p" + }, + "name": "p" + } + }, + "value": { + "type": "BinaryExpression", + "start": 80, + "end": 90, + "loc": { + "start": { + "line": 4, + "column": 9 + }, + "end": { + "line": 4, + "column": 19 + } + }, + "left": { + "type": "Identifier", + "start": 80, + "end": 85, + "loc": { + "start": { + "line": 4, + "column": 9 + }, + "end": { + "line": 4, + "column": 14 + }, + "identifierName": "await" + }, + "name": "await" + }, + "operator": "+", + "right": { + "type": "NumericLiteral", + "start": 88, + "end": 90, + "loc": { + "start": { + "line": 4, + "column": 17 + }, + "end": { + "line": 4, + "column": 19 + } + }, + "extra": { + "rawValue": 42, + "raw": "42" + }, + "value": 42 + } + }, + "leadingComments": [ + { + "type": "CommentLine", + "value": " here await is an identifier reference", + "start": 30, + "end": 70, + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 44 + } + } + } + ] + } + ] + } + } + ], + "directives": [] + } + } + } + ], + "directives": [] + }, + "comments": [ + { + "type": "CommentLine", + "value": " here await is an identifier reference", + "start": 30, + "end": 70, + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 44 + } + } + } + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-properties/declared-later-outer-class/input.js b/packages/babel-parser/test/fixtures/experimental/class-private-properties/declared-later-outer-class/input.js new file mode 100644 index 000000000000..e4e3ae4c3870 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-properties/declared-later-outer-class/input.js @@ -0,0 +1,9 @@ +class B { + meth() { + class A { + #x = this.#y; + } + } + + #y; +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-properties/declared-later-outer-class/options.json b/packages/babel-parser/test/fixtures/experimental/class-private-properties/declared-later-outer-class/options.json new file mode 100644 index 000000000000..25819769bb20 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-properties/declared-later-outer-class/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["classPrivateProperties"] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-properties/declared-later-outer-class/output.json b/packages/babel-parser/test/fixtures/experimental/class-private-properties/declared-later-outer-class/output.json new file mode 100644 index 000000000000..1bd1092fae92 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-properties/declared-later-outer-class/output.json @@ -0,0 +1,352 @@ +{ + "type": "File", + "start": 0, + "end": 73, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 9, + "column": 1 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 73, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 9, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 73, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 9, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "B" + }, + "name": "B" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 8, + "end": 73, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 9, + "column": 1 + } + }, + "body": [ + { + "type": "ClassMethod", + "start": 12, + "end": 64, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 6, + "column": 3 + } + }, + "static": false, + "key": { + "type": "Identifier", + "start": 12, + "end": 16, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 6 + }, + "identifierName": "meth" + }, + "name": "meth" + }, + "computed": false, + "kind": "method", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 19, + "end": 64, + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 6, + "column": 3 + } + }, + "body": [ + { + "type": "ClassDeclaration", + "start": 25, + "end": 60, + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 5, + "column": 5 + } + }, + "id": { + "type": "Identifier", + "start": 31, + "end": 32, + "loc": { + "start": { + "line": 3, + "column": 10 + }, + "end": { + "line": 3, + "column": 11 + }, + "identifierName": "A" + }, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 33, + "end": 60, + "loc": { + "start": { + "line": 3, + "column": 12 + }, + "end": { + "line": 5, + "column": 5 + } + }, + "body": [ + { + "type": "ClassPrivateProperty", + "start": 41, + "end": 54, + "loc": { + "start": { + "line": 4, + "column": 6 + }, + "end": { + "line": 4, + "column": 19 + } + }, + "static": false, + "key": { + "type": "PrivateName", + "start": 41, + "end": 43, + "loc": { + "start": { + "line": 4, + "column": 6 + }, + "end": { + "line": 4, + "column": 8 + } + }, + "id": { + "type": "Identifier", + "start": 42, + "end": 43, + "loc": { + "start": { + "line": 4, + "column": 7 + }, + "end": { + "line": 4, + "column": 8 + }, + "identifierName": "x" + }, + "name": "x" + } + }, + "value": { + "type": "MemberExpression", + "start": 46, + "end": 53, + "loc": { + "start": { + "line": 4, + "column": 11 + }, + "end": { + "line": 4, + "column": 18 + } + }, + "object": { + "type": "ThisExpression", + "start": 46, + "end": 50, + "loc": { + "start": { + "line": 4, + "column": 11 + }, + "end": { + "line": 4, + "column": 15 + } + } + }, + "property": { + "type": "PrivateName", + "start": 51, + "end": 53, + "loc": { + "start": { + "line": 4, + "column": 16 + }, + "end": { + "line": 4, + "column": 18 + } + }, + "id": { + "type": "Identifier", + "start": 52, + "end": 53, + "loc": { + "start": { + "line": 4, + "column": 17 + }, + "end": { + "line": 4, + "column": 18 + }, + "identifierName": "y" + }, + "name": "y" + } + }, + "computed": false + } + } + ] + } + } + ], + "directives": [] + } + }, + { + "type": "ClassPrivateProperty", + "start": 68, + "end": 71, + "loc": { + "start": { + "line": 8, + "column": 2 + }, + "end": { + "line": 8, + "column": 5 + } + }, + "static": false, + "key": { + "type": "PrivateName", + "start": 68, + "end": 70, + "loc": { + "start": { + "line": 8, + "column": 2 + }, + "end": { + "line": 8, + "column": 4 + } + }, + "id": { + "type": "Identifier", + "start": 69, + "end": 70, + "loc": { + "start": { + "line": 8, + "column": 3 + }, + "end": { + "line": 8, + "column": 4 + }, + "identifierName": "y" + }, + "name": "y" + } + }, + "value": null + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-properties/declared-later-same-class/input.js b/packages/babel-parser/test/fixtures/experimental/class-private-properties/declared-later-same-class/input.js new file mode 100644 index 000000000000..bd7c6a515696 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-properties/declared-later-same-class/input.js @@ -0,0 +1,4 @@ +class A { + #x = this.#y; + #y; +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-properties/declared-later-same-class/options.json b/packages/babel-parser/test/fixtures/experimental/class-private-properties/declared-later-same-class/options.json new file mode 100644 index 000000000000..25819769bb20 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-properties/declared-later-same-class/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["classPrivateProperties"] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-properties/declared-later-same-class/output.json b/packages/babel-parser/test/fixtures/experimental/class-private-properties/declared-later-same-class/output.json new file mode 100644 index 000000000000..3c7ad5de9321 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-properties/declared-later-same-class/output.json @@ -0,0 +1,245 @@ +{ + "type": "File", + "start": 0, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "A" + }, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 8, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "body": [ + { + "type": "ClassPrivateProperty", + "start": 12, + "end": 25, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 15 + } + }, + "static": false, + "key": { + "type": "PrivateName", + "start": 12, + "end": 14, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 4 + } + }, + "id": { + "type": "Identifier", + "start": 13, + "end": 14, + "loc": { + "start": { + "line": 2, + "column": 3 + }, + "end": { + "line": 2, + "column": 4 + }, + "identifierName": "x" + }, + "name": "x" + } + }, + "value": { + "type": "MemberExpression", + "start": 17, + "end": 24, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "object": { + "type": "ThisExpression", + "start": 17, + "end": 21, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 11 + } + } + }, + "property": { + "type": "PrivateName", + "start": 22, + "end": 24, + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "id": { + "type": "Identifier", + "start": 23, + "end": 24, + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 14 + }, + "identifierName": "y" + }, + "name": "y" + } + }, + "computed": false + } + }, + { + "type": "ClassPrivateProperty", + "start": 28, + "end": 31, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 5 + } + }, + "static": false, + "key": { + "type": "PrivateName", + "start": 28, + "end": 30, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 4 + } + }, + "id": { + "type": "Identifier", + "start": 29, + "end": 30, + "loc": { + "start": { + "line": 3, + "column": 3 + }, + "end": { + "line": 3, + "column": 4 + }, + "identifierName": "y" + }, + "name": "y" + } + }, + "value": null + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-properties/failure-delete-private-property/options.json b/packages/babel-parser/test/fixtures/experimental/class-private-properties/failure-delete-private-property/options.json index e9f18e93d1d5..f26e916957c8 100644 --- a/packages/babel-parser/test/fixtures/experimental/class-private-properties/failure-delete-private-property/options.json +++ b/packages/babel-parser/test/fixtures/experimental/class-private-properties/failure-delete-private-property/options.json @@ -1,4 +1,3 @@ { - "throws": "Deleting a private field is not allowed (4:4)", "plugins": ["classPrivateProperties"] } diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-properties/failure-delete-private-property/output.json b/packages/babel-parser/test/fixtures/experimental/class-private-properties/failure-delete-private-property/output.json new file mode 100644 index 000000000000..1f5d18e55096 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-properties/failure-delete-private-property/output.json @@ -0,0 +1,289 @@ +{ + "type": "File", + "start": 0, + "end": 61, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 6, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Deleting a private field is not allowed (4:4)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 61, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 6, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 61, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 6, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 9 + }, + "identifierName": "Foo" + }, + "name": "Foo" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 10, + "end": 61, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 6, + "column": 1 + } + }, + "body": [ + { + "type": "ClassPrivateProperty", + "start": 14, + "end": 17, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 5 + } + }, + "static": false, + "key": { + "type": "PrivateName", + "start": 14, + "end": 16, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 4 + } + }, + "id": { + "type": "Identifier", + "start": 15, + "end": 16, + "loc": { + "start": { + "line": 2, + "column": 3 + }, + "end": { + "line": 2, + "column": 4 + }, + "identifierName": "x" + }, + "name": "x" + } + }, + "value": null + }, + { + "type": "ClassMethod", + "start": 20, + "end": 59, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 5, + "column": 3 + } + }, + "static": false, + "key": { + "type": "Identifier", + "start": 20, + "end": 31, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 13 + }, + "identifierName": "constructor" + }, + "name": "constructor" + }, + "computed": false, + "kind": "constructor", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 34, + "end": 59, + "loc": { + "start": { + "line": 3, + "column": 16 + }, + "end": { + "line": 5, + "column": 3 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 40, + "end": 55, + "loc": { + "start": { + "line": 4, + "column": 4 + }, + "end": { + "line": 4, + "column": 19 + } + }, + "expression": { + "type": "UnaryExpression", + "start": 40, + "end": 54, + "loc": { + "start": { + "line": 4, + "column": 4 + }, + "end": { + "line": 4, + "column": 18 + } + }, + "operator": "delete", + "prefix": true, + "argument": { + "type": "MemberExpression", + "start": 47, + "end": 54, + "loc": { + "start": { + "line": 4, + "column": 11 + }, + "end": { + "line": 4, + "column": 18 + } + }, + "object": { + "type": "ThisExpression", + "start": 47, + "end": 51, + "loc": { + "start": { + "line": 4, + "column": 11 + }, + "end": { + "line": 4, + "column": 15 + } + } + }, + "property": { + "type": "PrivateName", + "start": 52, + "end": 54, + "loc": { + "start": { + "line": 4, + "column": 16 + }, + "end": { + "line": 4, + "column": 18 + } + }, + "id": { + "type": "Identifier", + "start": 53, + "end": 54, + "loc": { + "start": { + "line": 4, + "column": 17 + }, + "end": { + "line": 4, + "column": 18 + }, + "identifierName": "x" + }, + "name": "x" + } + }, + "computed": false + } + } + } + ], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-properties/failure-name-constructor/options.json b/packages/babel-parser/test/fixtures/experimental/class-private-properties/failure-name-constructor/options.json index 51343aac3b23..f26e916957c8 100644 --- a/packages/babel-parser/test/fixtures/experimental/class-private-properties/failure-name-constructor/options.json +++ b/packages/babel-parser/test/fixtures/experimental/class-private-properties/failure-name-constructor/options.json @@ -1,4 +1,3 @@ { - "throws": "Classes may not have a private field named '#constructor' (2:2)", "plugins": ["classPrivateProperties"] } diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-properties/failure-name-constructor/output.json b/packages/babel-parser/test/fixtures/experimental/class-private-properties/failure-name-constructor/output.json new file mode 100644 index 000000000000..1f4da38f9f9f --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-properties/failure-name-constructor/output.json @@ -0,0 +1,137 @@ +{ + "type": "File", + "start": 0, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Classes may not have a private field named '#constructor' (2:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 9 + }, + "identifierName": "Foo" + }, + "name": "Foo" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 10, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": [ + { + "type": "ClassPrivateProperty", + "start": 14, + "end": 27, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 15 + } + }, + "static": false, + "key": { + "type": "PrivateName", + "start": 14, + "end": 26, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "id": { + "type": "Identifier", + "start": 15, + "end": 26, + "loc": { + "start": { + "line": 2, + "column": 3 + }, + "end": { + "line": 2, + "column": 14 + }, + "identifierName": "constructor" + }, + "name": "constructor" + } + }, + "value": null + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-properties/failure-spaces/options.json b/packages/babel-parser/test/fixtures/experimental/class-private-properties/failure-spaces/options.json index 9914950b66fe..f26e916957c8 100644 --- a/packages/babel-parser/test/fixtures/experimental/class-private-properties/failure-spaces/options.json +++ b/packages/babel-parser/test/fixtures/experimental/class-private-properties/failure-spaces/options.json @@ -1,4 +1,3 @@ { - "throws": "Unexpected space between # and identifier (2:3)", - "plugins": ["classPrivateMethods"] + "plugins": ["classPrivateProperties"] } diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-properties/failure-spaces/output.json b/packages/babel-parser/test/fixtures/experimental/class-private-properties/failure-spaces/output.json new file mode 100644 index 000000000000..34003e4e9209 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-properties/failure-spaces/output.json @@ -0,0 +1,137 @@ +{ + "type": "File", + "start": 0, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Unexpected space between # and identifier (2:3)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 12 + }, + "identifierName": "Spaces" + }, + "name": "Spaces" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 13, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": [ + { + "type": "ClassPrivateProperty", + "start": 17, + "end": 32, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 17 + } + }, + "static": false, + "key": { + "type": "PrivateName", + "start": 17, + "end": 31, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 16 + } + }, + "id": { + "type": "Identifier", + "start": 20, + "end": 31, + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 16 + }, + "identifierName": "wrongSpaces" + }, + "name": "wrongSpaces" + } + }, + "value": null + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-properties/invalid-destructuring-arguments/input.js b/packages/babel-parser/test/fixtures/experimental/class-private-properties/invalid-destructuring-arguments/input.js new file mode 100644 index 000000000000..efc69f1bc6eb --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-properties/invalid-destructuring-arguments/input.js @@ -0,0 +1,4 @@ +class C { + #x = 1; + #p = ({ #x: x }) => {} +} diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-properties/invalid-destructuring-arguments/options.json b/packages/babel-parser/test/fixtures/experimental/class-private-properties/invalid-destructuring-arguments/options.json new file mode 100644 index 000000000000..f26e916957c8 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-properties/invalid-destructuring-arguments/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["classPrivateProperties"] +} diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-properties/invalid-destructuring-arguments/output.json b/packages/babel-parser/test/fixtures/experimental/class-private-properties/invalid-destructuring-arguments/output.json new file mode 100644 index 000000000000..d8c6109cf982 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-properties/invalid-destructuring-arguments/output.json @@ -0,0 +1,324 @@ +{ + "type": "File", + "start": 0, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Private names can only be used as the name of a class element (i.e. class C { #p = 42; #m() {} } )\n or a property of member expression (i.e. this.#p). (3:11)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "C" + }, + "name": "C" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 8, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "body": [ + { + "type": "ClassPrivateProperty", + "start": 12, + "end": 19, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 9 + } + }, + "static": false, + "key": { + "type": "PrivateName", + "start": 12, + "end": 14, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 4 + } + }, + "id": { + "type": "Identifier", + "start": 13, + "end": 14, + "loc": { + "start": { + "line": 2, + "column": 3 + }, + "end": { + "line": 2, + "column": 4 + }, + "identifierName": "x" + }, + "name": "x" + } + }, + "value": { + "type": "NumericLiteral", + "start": 17, + "end": 18, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 8 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + }, + { + "type": "ClassPrivateProperty", + "start": 22, + "end": 44, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 24 + } + }, + "static": false, + "key": { + "type": "PrivateName", + "start": 22, + "end": 24, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 4 + } + }, + "id": { + "type": "Identifier", + "start": 23, + "end": 24, + "loc": { + "start": { + "line": 3, + "column": 3 + }, + "end": { + "line": 3, + "column": 4 + }, + "identifierName": "p" + }, + "name": "p" + } + }, + "value": { + "type": "ArrowFunctionExpression", + "start": 27, + "end": 44, + "loc": { + "start": { + "line": 3, + "column": 7 + }, + "end": { + "line": 3, + "column": 24 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "ObjectPattern", + "start": 28, + "end": 37, + "loc": { + "start": { + "line": 3, + "column": 8 + }, + "end": { + "line": 3, + "column": 17 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 30, + "end": 35, + "loc": { + "start": { + "line": 3, + "column": 10 + }, + "end": { + "line": 3, + "column": 15 + } + }, + "method": false, + "key": { + "type": "PrivateName", + "start": 30, + "end": 32, + "loc": { + "start": { + "line": 3, + "column": 10 + }, + "end": { + "line": 3, + "column": 12 + } + }, + "id": { + "type": "Identifier", + "start": 31, + "end": 32, + "loc": { + "start": { + "line": 3, + "column": 11 + }, + "end": { + "line": 3, + "column": 12 + }, + "identifierName": "x" + }, + "name": "x" + } + }, + "shorthand": false, + "value": { + "type": "Identifier", + "start": 34, + "end": 35, + "loc": { + "start": { + "line": 3, + "column": 14 + }, + "end": { + "line": 3, + "column": 15 + }, + "identifierName": "x" + }, + "name": "x" + } + } + ] + } + ], + "body": { + "type": "BlockStatement", + "start": 42, + "end": 44, + "loc": { + "start": { + "line": 3, + "column": 22 + }, + "end": { + "line": 3, + "column": 24 + } + }, + "body": [], + "directives": [] + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-properties/invalid-destructuring/input.js b/packages/babel-parser/test/fixtures/experimental/class-private-properties/invalid-destructuring/input.js new file mode 100644 index 000000000000..980a785949d2 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-properties/invalid-destructuring/input.js @@ -0,0 +1,6 @@ +class C { + #x = 1; + m() { + const {#x: x} = this; + } +} diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-properties/invalid-destructuring/options.json b/packages/babel-parser/test/fixtures/experimental/class-private-properties/invalid-destructuring/options.json new file mode 100644 index 000000000000..f26e916957c8 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-properties/invalid-destructuring/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["classPrivateProperties"] +} diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-properties/invalid-destructuring/output.json b/packages/babel-parser/test/fixtures/experimental/class-private-properties/invalid-destructuring/output.json new file mode 100644 index 000000000000..73b7c2579453 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-properties/invalid-destructuring/output.json @@ -0,0 +1,344 @@ +{ + "type": "File", + "start": 0, + "end": 59, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 6, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Private names can only be used as the name of a class element (i.e. class C { #p = 42; #m() {} } )\n or a property of member expression (i.e. this.#p). (4:12)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 59, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 6, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 59, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 6, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "C" + }, + "name": "C" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 8, + "end": 59, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 6, + "column": 1 + } + }, + "body": [ + { + "type": "ClassPrivateProperty", + "start": 12, + "end": 19, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 9 + } + }, + "static": false, + "key": { + "type": "PrivateName", + "start": 12, + "end": 14, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 4 + } + }, + "id": { + "type": "Identifier", + "start": 13, + "end": 14, + "loc": { + "start": { + "line": 2, + "column": 3 + }, + "end": { + "line": 2, + "column": 4 + }, + "identifierName": "x" + }, + "name": "x" + } + }, + "value": { + "type": "NumericLiteral", + "start": 17, + "end": 18, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 8 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + }, + { + "type": "ClassMethod", + "start": 22, + "end": 57, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 5, + "column": 3 + } + }, + "static": false, + "key": { + "type": "Identifier", + "start": 22, + "end": 23, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 3 + }, + "identifierName": "m" + }, + "name": "m" + }, + "computed": false, + "kind": "method", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 26, + "end": 57, + "loc": { + "start": { + "line": 3, + "column": 6 + }, + "end": { + "line": 5, + "column": 3 + } + }, + "body": [ + { + "type": "VariableDeclaration", + "start": 32, + "end": 53, + "loc": { + "start": { + "line": 4, + "column": 4 + }, + "end": { + "line": 4, + "column": 25 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 38, + "end": 52, + "loc": { + "start": { + "line": 4, + "column": 10 + }, + "end": { + "line": 4, + "column": 24 + } + }, + "id": { + "type": "ObjectPattern", + "start": 38, + "end": 45, + "loc": { + "start": { + "line": 4, + "column": 10 + }, + "end": { + "line": 4, + "column": 17 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 39, + "end": 44, + "loc": { + "start": { + "line": 4, + "column": 11 + }, + "end": { + "line": 4, + "column": 16 + } + }, + "method": false, + "key": { + "type": "PrivateName", + "start": 39, + "end": 41, + "loc": { + "start": { + "line": 4, + "column": 11 + }, + "end": { + "line": 4, + "column": 13 + } + }, + "id": { + "type": "Identifier", + "start": 40, + "end": 41, + "loc": { + "start": { + "line": 4, + "column": 12 + }, + "end": { + "line": 4, + "column": 13 + }, + "identifierName": "x" + }, + "name": "x" + } + }, + "shorthand": false, + "value": { + "type": "Identifier", + "start": 43, + "end": 44, + "loc": { + "start": { + "line": 4, + "column": 15 + }, + "end": { + "line": 4, + "column": 16 + }, + "identifierName": "x" + }, + "name": "x" + } + } + ] + }, + "init": { + "type": "ThisExpression", + "start": 48, + "end": 52, + "loc": { + "start": { + "line": 4, + "column": 20 + }, + "end": { + "line": 4, + "column": 24 + } + } + } + } + ], + "kind": "const" + } + ], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-properties/invalid-object-method/input.js b/packages/babel-parser/test/fixtures/experimental/class-private-properties/invalid-object-method/input.js new file mode 100644 index 000000000000..234c9a49371e --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-properties/invalid-object-method/input.js @@ -0,0 +1,3 @@ +class C { + #p = ({ #x: 42 }); +} diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-properties/invalid-object-method/options.json b/packages/babel-parser/test/fixtures/experimental/class-private-properties/invalid-object-method/options.json new file mode 100644 index 000000000000..f26e916957c8 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-properties/invalid-object-method/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["classPrivateProperties"] +} diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-properties/invalid-object-method/output.json b/packages/babel-parser/test/fixtures/experimental/class-private-properties/invalid-object-method/output.json new file mode 100644 index 000000000000..7a5716ee676d --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-properties/invalid-object-method/output.json @@ -0,0 +1,226 @@ +{ + "type": "File", + "start": 0, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Private names can only be used as the name of a class element (i.e. class C { #p = 42; #m() {} } )\n or a property of member expression (i.e. this.#p). (2:11)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "C" + }, + "name": "C" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 8, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": [ + { + "type": "ClassPrivateProperty", + "start": 12, + "end": 30, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 20 + } + }, + "static": false, + "key": { + "type": "PrivateName", + "start": 12, + "end": 14, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 4 + } + }, + "id": { + "type": "Identifier", + "start": 13, + "end": 14, + "loc": { + "start": { + "line": 2, + "column": 3 + }, + "end": { + "line": 2, + "column": 4 + }, + "identifierName": "p" + }, + "name": "p" + } + }, + "value": { + "type": "ObjectExpression", + "start": 18, + "end": 28, + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 18 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 20, + "end": 26, + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 16 + } + }, + "method": false, + "key": { + "type": "PrivateName", + "start": 20, + "end": 22, + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 12 + } + }, + "id": { + "type": "Identifier", + "start": 21, + "end": 22, + "loc": { + "start": { + "line": 2, + "column": 11 + }, + "end": { + "line": 2, + "column": 12 + }, + "identifierName": "x" + }, + "name": "x" + } + }, + "shorthand": false, + "value": { + "type": "NumericLiteral", + "start": 24, + "end": 26, + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 16 + } + }, + "extra": { + "rawValue": 42, + "raw": "42" + }, + "value": 42 + } + } + ], + "extra": { + "parenthesized": true, + "parenStart": 17 + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-properties/invalid-ts-type-literal/input.js b/packages/babel-parser/test/fixtures/experimental/class-private-properties/invalid-ts-type-literal/input.js new file mode 100644 index 000000000000..dd79bd88301a --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-properties/invalid-ts-type-literal/input.js @@ -0,0 +1,3 @@ +interface I { + #p: string +} diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-properties/invalid-ts-type-literal/options.json b/packages/babel-parser/test/fixtures/experimental/class-private-properties/invalid-ts-type-literal/options.json new file mode 100644 index 000000000000..cb835ce4233c --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-properties/invalid-ts-type-literal/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["classPrivateProperties", "typescript"] +} diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-properties/invalid-ts-type-literal/output.json b/packages/babel-parser/test/fixtures/experimental/class-private-properties/invalid-ts-type-literal/output.json new file mode 100644 index 000000000000..3422be4603b9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-properties/invalid-ts-type-literal/output.json @@ -0,0 +1,164 @@ +{ + "type": "File", + "start": 0, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Private names can only be used as the name of a class element (i.e. class C { #p = 42; #m() {} } )\n or a property of member expression (i.e. this.#p). (2:3)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "TSInterfaceDeclaration", + "start": 0, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 10, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + }, + "identifierName": "I" + }, + "name": "I" + }, + "body": { + "type": "TSInterfaceBody", + "start": 12, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": [ + { + "type": "TSPropertySignature", + "start": 16, + "end": 26, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 12 + } + }, + "key": { + "type": "PrivateName", + "start": 16, + "end": 18, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 4 + } + }, + "id": { + "type": "Identifier", + "start": 17, + "end": 18, + "loc": { + "start": { + "line": 2, + "column": 3 + }, + "end": { + "line": 2, + "column": 4 + }, + "identifierName": "p" + }, + "name": "p" + } + }, + "typeAnnotation": { + "type": "TSTypeAnnotation", + "start": 18, + "end": 26, + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 12 + } + }, + "typeAnnotation": { + "type": "TSStringKeyword", + "start": 20, + "end": 26, + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 12 + } + } + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-properties/super-call/options.json b/packages/babel-parser/test/fixtures/experimental/class-private-properties/super-call/options.json index 2154c844bfd7..f26e916957c8 100644 --- a/packages/babel-parser/test/fixtures/experimental/class-private-properties/super-call/options.json +++ b/packages/babel-parser/test/fixtures/experimental/class-private-properties/super-call/options.json @@ -1,4 +1,3 @@ { - "plugins": ["classPrivateProperties"], - "throws": "super() is only valid inside a class constructor of a subclass. Maybe a typo in the method name ('constructor') or not extending another class? (4:13)" + "plugins": ["classPrivateProperties"] } diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-properties/super-call/output.json b/packages/babel-parser/test/fixtures/experimental/class-private-properties/super-call/output.json new file mode 100644 index 000000000000..26e00894a7a7 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-properties/super-call/output.json @@ -0,0 +1,306 @@ +{ + "type": "File", + "start": 0, + "end": 95, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 7, + "column": 1 + } + }, + "errors": [ + "SyntaxError: super() is only valid inside a class constructor of a subclass. Maybe a typo in the method name ('constructor') or not extending another class? (4:13)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 95, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 7, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 95, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 7, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "A" + }, + "name": "A" + }, + "superClass": { + "type": "Identifier", + "start": 16, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + }, + "identifierName": "B" + }, + "name": "B" + }, + "body": { + "type": "ClassBody", + "start": 18, + "end": 95, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 7, + "column": 1 + } + }, + "body": [ + { + "type": "ClassMethod", + "start": 22, + "end": 93, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 6, + "column": 3 + } + }, + "static": false, + "key": { + "type": "Identifier", + "start": 22, + "end": 33, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 13 + }, + "identifierName": "constructor" + }, + "name": "constructor" + }, + "computed": false, + "kind": "constructor", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 36, + "end": 93, + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 6, + "column": 3 + } + }, + "body": [ + { + "type": "ClassDeclaration", + "start": 42, + "end": 89, + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 5, + "column": 5 + } + }, + "id": { + "type": "Identifier", + "start": 48, + "end": 49, + "loc": { + "start": { + "line": 3, + "column": 10 + }, + "end": { + "line": 3, + "column": 11 + }, + "identifierName": "C" + }, + "name": "C" + }, + "superClass": { + "type": "Identifier", + "start": 58, + "end": 59, + "loc": { + "start": { + "line": 3, + "column": 20 + }, + "end": { + "line": 3, + "column": 21 + }, + "identifierName": "D" + }, + "name": "D" + }, + "body": { + "type": "ClassBody", + "start": 60, + "end": 89, + "loc": { + "start": { + "line": 3, + "column": 22 + }, + "end": { + "line": 5, + "column": 5 + } + }, + "body": [ + { + "type": "ClassPrivateProperty", + "start": 68, + "end": 83, + "loc": { + "start": { + "line": 4, + "column": 6 + }, + "end": { + "line": 4, + "column": 21 + } + }, + "static": false, + "key": { + "type": "PrivateName", + "start": 68, + "end": 72, + "loc": { + "start": { + "line": 4, + "column": 6 + }, + "end": { + "line": 4, + "column": 10 + } + }, + "id": { + "type": "Identifier", + "start": 69, + "end": 72, + "loc": { + "start": { + "line": 4, + "column": 7 + }, + "end": { + "line": 4, + "column": 10 + }, + "identifierName": "foo" + }, + "name": "foo" + } + }, + "value": { + "type": "CallExpression", + "start": 75, + "end": 82, + "loc": { + "start": { + "line": 4, + "column": 13 + }, + "end": { + "line": 4, + "column": 20 + } + }, + "callee": { + "type": "Super", + "start": 75, + "end": 80, + "loc": { + "start": { + "line": 4, + "column": 13 + }, + "end": { + "line": 4, + "column": 18 + } + } + }, + "arguments": [] + } + } + ] + } + } + ], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-properties/super-private-member-access/input.js b/packages/babel-parser/test/fixtures/experimental/class-private-properties/super-private-member-access/input.js new file mode 100644 index 000000000000..5cd2ffd252f7 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-properties/super-private-member-access/input.js @@ -0,0 +1,7 @@ +class A extends B { + #x; + + method() { + super.#x; + } +} diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-properties/super-private-member-access/options.json b/packages/babel-parser/test/fixtures/experimental/class-private-properties/super-private-member-access/options.json new file mode 100644 index 000000000000..f26e916957c8 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-properties/super-private-member-access/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["classPrivateProperties"] +} diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-properties/super-private-member-access/output.json b/packages/babel-parser/test/fixtures/experimental/class-private-properties/super-private-member-access/output.json new file mode 100644 index 000000000000..bf5051685be7 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-properties/super-private-member-access/output.json @@ -0,0 +1,288 @@ +{ + "type": "File", + "start": 0, + "end": 59, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 7, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Private fields can't be accessed on super (5:4)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 59, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 7, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 59, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 7, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "A" + }, + "name": "A" + }, + "superClass": { + "type": "Identifier", + "start": 16, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + }, + "identifierName": "B" + }, + "name": "B" + }, + "body": { + "type": "ClassBody", + "start": 18, + "end": 59, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 7, + "column": 1 + } + }, + "body": [ + { + "type": "ClassPrivateProperty", + "start": 22, + "end": 25, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 5 + } + }, + "static": false, + "key": { + "type": "PrivateName", + "start": 22, + "end": 24, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 4 + } + }, + "id": { + "type": "Identifier", + "start": 23, + "end": 24, + "loc": { + "start": { + "line": 2, + "column": 3 + }, + "end": { + "line": 2, + "column": 4 + }, + "identifierName": "x" + }, + "name": "x" + } + }, + "value": null + }, + { + "type": "ClassMethod", + "start": 29, + "end": 57, + "loc": { + "start": { + "line": 4, + "column": 2 + }, + "end": { + "line": 6, + "column": 3 + } + }, + "static": false, + "key": { + "type": "Identifier", + "start": 29, + "end": 35, + "loc": { + "start": { + "line": 4, + "column": 2 + }, + "end": { + "line": 4, + "column": 8 + }, + "identifierName": "method" + }, + "name": "method" + }, + "computed": false, + "kind": "method", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 38, + "end": 57, + "loc": { + "start": { + "line": 4, + "column": 11 + }, + "end": { + "line": 6, + "column": 3 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 44, + "end": 53, + "loc": { + "start": { + "line": 5, + "column": 4 + }, + "end": { + "line": 5, + "column": 13 + } + }, + "expression": { + "type": "MemberExpression", + "start": 44, + "end": 52, + "loc": { + "start": { + "line": 5, + "column": 4 + }, + "end": { + "line": 5, + "column": 12 + } + }, + "object": { + "type": "Super", + "start": 44, + "end": 49, + "loc": { + "start": { + "line": 5, + "column": 4 + }, + "end": { + "line": 5, + "column": 9 + } + } + }, + "property": { + "type": "PrivateName", + "start": 50, + "end": 52, + "loc": { + "start": { + "line": 5, + "column": 10 + }, + "end": { + "line": 5, + "column": 12 + } + }, + "id": { + "type": "Identifier", + "start": 51, + "end": 52, + "loc": { + "start": { + "line": 5, + "column": 11 + }, + "end": { + "line": 5, + "column": 12 + }, + "identifierName": "x" + }, + "name": "x" + } + }, + "computed": false + } + } + ], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-properties/undeclared-nested/input.js b/packages/babel-parser/test/fixtures/experimental/class-private-properties/undeclared-nested/input.js new file mode 100644 index 000000000000..3177068d7eb0 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-properties/undeclared-nested/input.js @@ -0,0 +1,6 @@ +class A { + #x; + meth() { + var prop = foo.#priv; + } +} diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-properties/undeclared-nested/options.json b/packages/babel-parser/test/fixtures/experimental/class-private-properties/undeclared-nested/options.json new file mode 100644 index 000000000000..1ca5069a3a2f --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-properties/undeclared-nested/options.json @@ -0,0 +1,5 @@ +{ + "plugins": [ + "classPrivateProperties" + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-properties/undeclared-nested/output.json b/packages/babel-parser/test/fixtures/experimental/class-private-properties/undeclared-nested/output.json new file mode 100644 index 000000000000..f13ed5f0567c --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-properties/undeclared-nested/output.json @@ -0,0 +1,309 @@ +{ + "type": "File", + "start": 0, + "end": 58, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 6, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Private name #priv is not defined (4:19)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 58, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 6, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 58, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 6, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "A" + }, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 8, + "end": 58, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 6, + "column": 1 + } + }, + "body": [ + { + "type": "ClassPrivateProperty", + "start": 12, + "end": 15, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 5 + } + }, + "static": false, + "key": { + "type": "PrivateName", + "start": 12, + "end": 14, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 4 + } + }, + "id": { + "type": "Identifier", + "start": 13, + "end": 14, + "loc": { + "start": { + "line": 2, + "column": 3 + }, + "end": { + "line": 2, + "column": 4 + }, + "identifierName": "x" + }, + "name": "x" + } + }, + "value": null + }, + { + "type": "ClassMethod", + "start": 18, + "end": 56, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 5, + "column": 3 + } + }, + "static": false, + "key": { + "type": "Identifier", + "start": 18, + "end": 22, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 6 + }, + "identifierName": "meth" + }, + "name": "meth" + }, + "computed": false, + "kind": "method", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 25, + "end": 56, + "loc": { + "start": { + "line": 3, + "column": 9 + }, + "end": { + "line": 5, + "column": 3 + } + }, + "body": [ + { + "type": "VariableDeclaration", + "start": 31, + "end": 52, + "loc": { + "start": { + "line": 4, + "column": 4 + }, + "end": { + "line": 4, + "column": 25 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 35, + "end": 51, + "loc": { + "start": { + "line": 4, + "column": 8 + }, + "end": { + "line": 4, + "column": 24 + } + }, + "id": { + "type": "Identifier", + "start": 35, + "end": 39, + "loc": { + "start": { + "line": 4, + "column": 8 + }, + "end": { + "line": 4, + "column": 12 + }, + "identifierName": "prop" + }, + "name": "prop" + }, + "init": { + "type": "MemberExpression", + "start": 42, + "end": 51, + "loc": { + "start": { + "line": 4, + "column": 15 + }, + "end": { + "line": 4, + "column": 24 + } + }, + "object": { + "type": "Identifier", + "start": 42, + "end": 45, + "loc": { + "start": { + "line": 4, + "column": 15 + }, + "end": { + "line": 4, + "column": 18 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "property": { + "type": "PrivateName", + "start": 46, + "end": 51, + "loc": { + "start": { + "line": 4, + "column": 19 + }, + "end": { + "line": 4, + "column": 24 + } + }, + "id": { + "type": "Identifier", + "start": 47, + "end": 51, + "loc": { + "start": { + "line": 4, + "column": 20 + }, + "end": { + "line": 4, + "column": 24 + }, + "identifierName": "priv" + }, + "name": "priv" + } + }, + "computed": false + } + } + ], + "kind": "var" + } + ], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-properties/undeclared-top-level/input.js b/packages/babel-parser/test/fixtures/experimental/class-private-properties/undeclared-top-level/input.js new file mode 100644 index 000000000000..10607b89b6db --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-properties/undeclared-top-level/input.js @@ -0,0 +1 @@ +var prop = foo.#priv; \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-properties/undeclared-top-level/options.json b/packages/babel-parser/test/fixtures/experimental/class-private-properties/undeclared-top-level/options.json new file mode 100644 index 000000000000..1ca5069a3a2f --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-properties/undeclared-top-level/options.json @@ -0,0 +1,5 @@ +{ + "plugins": [ + "classPrivateProperties" + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-properties/undeclared-top-level/output.json b/packages/babel-parser/test/fixtures/experimental/class-private-properties/undeclared-top-level/output.json new file mode 100644 index 000000000000..88c45d101fa8 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-properties/undeclared-top-level/output.json @@ -0,0 +1,153 @@ +{ + "type": "File", + "start": 0, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "errors": [ + "SyntaxError: Private name #priv is not defined (1:15)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 0, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 4, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "id": { + "type": "Identifier", + "start": 4, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 8 + }, + "identifierName": "prop" + }, + "name": "prop" + }, + "init": { + "type": "MemberExpression", + "start": 11, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "object": { + "type": "Identifier", + "start": 11, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "property": { + "type": "PrivateName", + "start": 15, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "id": { + "type": "Identifier", + "start": 16, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 20 + }, + "identifierName": "priv" + }, + "name": "priv" + } + }, + "computed": false + } + } + ], + "kind": "var" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-properties/arguments-in-arrow-function/options.json b/packages/babel-parser/test/fixtures/experimental/class-properties/arguments-in-arrow-function/options.json index a567b19a72cb..9c27576d4ad0 100644 --- a/packages/babel-parser/test/fixtures/experimental/class-properties/arguments-in-arrow-function/options.json +++ b/packages/babel-parser/test/fixtures/experimental/class-properties/arguments-in-arrow-function/options.json @@ -1,4 +1,3 @@ { - "plugins": ["classProperties"], - "throws": "'arguments' is not allowed in class field initializer (3:16)" + "plugins": ["classProperties"] } diff --git a/packages/babel-parser/test/fixtures/experimental/class-properties/arguments-in-arrow-function/output.json b/packages/babel-parser/test/fixtures/experimental/class-properties/arguments-in-arrow-function/output.json new file mode 100644 index 000000000000..7cd90e6e9021 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-properties/arguments-in-arrow-function/output.json @@ -0,0 +1,211 @@ +{ + "type": "File", + "start": 0, + "end": 60, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "errors": [ + "SyntaxError: 'arguments' is not allowed in class field initializer (3:16)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 60, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 60, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 11 + }, + "identifierName": "fn" + }, + "name": "fn" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 14, + "end": 60, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "body": [ + { + "type": "ClassDeclaration", + "start": 18, + "end": 58, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 4, + "column": 3 + } + }, + "id": { + "type": "Identifier", + "start": 24, + "end": 25, + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 9 + }, + "identifierName": "A" + }, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 26, + "end": 58, + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 4, + "column": 3 + } + }, + "body": [ + { + "type": "ClassProperty", + "start": 32, + "end": 54, + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 26 + } + }, + "static": false, + "key": { + "type": "Identifier", + "start": 32, + "end": 35, + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 7 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "computed": false, + "value": { + "type": "ArrowFunctionExpression", + "start": 38, + "end": 53, + "loc": { + "start": { + "line": 3, + "column": 10 + }, + "end": { + "line": 3, + "column": 25 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "Identifier", + "start": 44, + "end": 53, + "loc": { + "start": { + "line": 3, + "column": 16 + }, + "end": { + "line": 3, + "column": 25 + }, + "identifierName": "arguments" + }, + "name": "arguments" + } + } + } + ] + } + } + ], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-properties/arguments-in-nested-class-decorator-call-expression/input.js b/packages/babel-parser/test/fixtures/experimental/class-properties/arguments-in-nested-class-decorator-call-expression/input.js new file mode 100644 index 000000000000..4594b01a45b6 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-properties/arguments-in-nested-class-decorator-call-expression/input.js @@ -0,0 +1,5 @@ +function fn() { + class A { + foo = class B { @bar(arguments) foo }; + } +} diff --git a/packages/babel-parser/test/fixtures/experimental/class-properties/arguments-in-nested-class-decorator-call-expression/options.json b/packages/babel-parser/test/fixtures/experimental/class-properties/arguments-in-nested-class-decorator-call-expression/options.json new file mode 100644 index 000000000000..4ee4c944603d --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-properties/arguments-in-nested-class-decorator-call-expression/options.json @@ -0,0 +1,6 @@ +{ + "plugins": [ + "classProperties", + ["decorators", { "decoratorsBeforeExport": false }] + ] +} diff --git a/packages/babel-parser/test/fixtures/experimental/class-properties/arguments-in-nested-class-decorator-call-expression/output.json b/packages/babel-parser/test/fixtures/experimental/class-properties/arguments-in-nested-class-decorator-call-expression/output.json new file mode 100644 index 000000000000..deb781226e7f --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-properties/arguments-in-nested-class-decorator-call-expression/output.json @@ -0,0 +1,328 @@ +{ + "type": "File", + "start": 0, + "end": 76, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "errors": [ + "SyntaxError: 'arguments' is not allowed in class field initializer (3:25)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 76, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 76, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 11 + }, + "identifierName": "fn" + }, + "name": "fn" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 14, + "end": 76, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "body": [ + { + "type": "ClassDeclaration", + "start": 18, + "end": 74, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 4, + "column": 3 + } + }, + "id": { + "type": "Identifier", + "start": 24, + "end": 25, + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 9 + }, + "identifierName": "A" + }, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 26, + "end": 74, + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 4, + "column": 3 + } + }, + "body": [ + { + "type": "ClassProperty", + "start": 32, + "end": 70, + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 42 + } + }, + "static": false, + "key": { + "type": "Identifier", + "start": 32, + "end": 35, + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 7 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "computed": false, + "value": { + "type": "ClassExpression", + "start": 38, + "end": 69, + "loc": { + "start": { + "line": 3, + "column": 10 + }, + "end": { + "line": 3, + "column": 41 + } + }, + "id": { + "type": "Identifier", + "start": 44, + "end": 45, + "loc": { + "start": { + "line": 3, + "column": 16 + }, + "end": { + "line": 3, + "column": 17 + }, + "identifierName": "B" + }, + "name": "B" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 46, + "end": 69, + "loc": { + "start": { + "line": 3, + "column": 18 + }, + "end": { + "line": 3, + "column": 41 + } + }, + "body": [ + { + "type": "ClassProperty", + "start": 48, + "end": 67, + "loc": { + "start": { + "line": 3, + "column": 20 + }, + "end": { + "line": 3, + "column": 39 + } + }, + "decorators": [ + { + "type": "Decorator", + "start": 48, + "end": 63, + "loc": { + "start": { + "line": 3, + "column": 20 + }, + "end": { + "line": 3, + "column": 35 + } + }, + "expression": { + "type": "CallExpression", + "start": 49, + "end": 63, + "loc": { + "start": { + "line": 3, + "column": 21 + }, + "end": { + "line": 3, + "column": 35 + } + }, + "callee": { + "type": "Identifier", + "start": 49, + "end": 52, + "loc": { + "start": { + "line": 3, + "column": 21 + }, + "end": { + "line": 3, + "column": 24 + }, + "identifierName": "bar" + }, + "name": "bar" + }, + "arguments": [ + { + "type": "Identifier", + "start": 53, + "end": 62, + "loc": { + "start": { + "line": 3, + "column": 25 + }, + "end": { + "line": 3, + "column": 34 + }, + "identifierName": "arguments" + }, + "name": "arguments" + } + ] + } + } + ], + "static": false, + "key": { + "type": "Identifier", + "start": 64, + "end": 67, + "loc": { + "start": { + "line": 3, + "column": 36 + }, + "end": { + "line": 3, + "column": 39 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "computed": false, + "value": null + } + ] + } + } + } + ] + } + } + ], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-properties/arguments-in-nested-class/input.js b/packages/babel-parser/test/fixtures/experimental/class-properties/arguments-in-nested-class/input.js new file mode 100644 index 000000000000..5bcc6b3ee5fa --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-properties/arguments-in-nested-class/input.js @@ -0,0 +1,5 @@ +function fn() { + class A { + foo = class B { bar() { arguments } }; + } +} diff --git a/packages/babel-parser/test/fixtures/experimental/class-properties/arguments-in-nested-class/options.json b/packages/babel-parser/test/fixtures/experimental/class-properties/arguments-in-nested-class/options.json new file mode 100644 index 000000000000..9c27576d4ad0 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-properties/arguments-in-nested-class/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["classProperties"] +} diff --git a/packages/babel-parser/test/fixtures/experimental/class-properties/arguments-in-nested-class/output.json b/packages/babel-parser/test/fixtures/experimental/class-properties/arguments-in-nested-class/output.json new file mode 100644 index 000000000000..107a090b5e92 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-properties/arguments-in-nested-class/output.json @@ -0,0 +1,311 @@ +{ + "type": "File", + "start": 0, + "end": 76, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 76, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 76, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 11 + }, + "identifierName": "fn" + }, + "name": "fn" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 14, + "end": 76, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "body": [ + { + "type": "ClassDeclaration", + "start": 18, + "end": 74, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 4, + "column": 3 + } + }, + "id": { + "type": "Identifier", + "start": 24, + "end": 25, + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 9 + }, + "identifierName": "A" + }, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 26, + "end": 74, + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 4, + "column": 3 + } + }, + "body": [ + { + "type": "ClassProperty", + "start": 32, + "end": 70, + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 42 + } + }, + "static": false, + "key": { + "type": "Identifier", + "start": 32, + "end": 35, + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 7 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "computed": false, + "value": { + "type": "ClassExpression", + "start": 38, + "end": 69, + "loc": { + "start": { + "line": 3, + "column": 10 + }, + "end": { + "line": 3, + "column": 41 + } + }, + "id": { + "type": "Identifier", + "start": 44, + "end": 45, + "loc": { + "start": { + "line": 3, + "column": 16 + }, + "end": { + "line": 3, + "column": 17 + }, + "identifierName": "B" + }, + "name": "B" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 46, + "end": 69, + "loc": { + "start": { + "line": 3, + "column": 18 + }, + "end": { + "line": 3, + "column": 41 + } + }, + "body": [ + { + "type": "ClassMethod", + "start": 48, + "end": 67, + "loc": { + "start": { + "line": 3, + "column": 20 + }, + "end": { + "line": 3, + "column": 39 + } + }, + "static": false, + "key": { + "type": "Identifier", + "start": 48, + "end": 51, + "loc": { + "start": { + "line": 3, + "column": 20 + }, + "end": { + "line": 3, + "column": 23 + }, + "identifierName": "bar" + }, + "name": "bar" + }, + "computed": false, + "kind": "method", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 54, + "end": 67, + "loc": { + "start": { + "line": 3, + "column": 26 + }, + "end": { + "line": 3, + "column": 39 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 56, + "end": 65, + "loc": { + "start": { + "line": 3, + "column": 28 + }, + "end": { + "line": 3, + "column": 37 + } + }, + "expression": { + "type": "Identifier", + "start": 56, + "end": 65, + "loc": { + "start": { + "line": 3, + "column": 28 + }, + "end": { + "line": 3, + "column": 37 + }, + "identifierName": "arguments" + }, + "name": "arguments" + } + } + ], + "directives": [] + } + } + ] + } + } + } + ] + } + } + ], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-properties/arguments/options.json b/packages/babel-parser/test/fixtures/experimental/class-properties/arguments/options.json index e79a44db0bef..9c27576d4ad0 100644 --- a/packages/babel-parser/test/fixtures/experimental/class-properties/arguments/options.json +++ b/packages/babel-parser/test/fixtures/experimental/class-properties/arguments/options.json @@ -1,4 +1,3 @@ { - "plugins": ["classProperties"], - "throws": "'arguments' is not allowed in class field initializer (3:10)" + "plugins": ["classProperties"] } diff --git a/packages/babel-parser/test/fixtures/experimental/class-properties/arguments/output.json b/packages/babel-parser/test/fixtures/experimental/class-properties/arguments/output.json new file mode 100644 index 000000000000..f2522558f086 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-properties/arguments/output.json @@ -0,0 +1,192 @@ +{ + "type": "File", + "start": 0, + "end": 54, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "errors": [ + "SyntaxError: 'arguments' is not allowed in class field initializer (3:10)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 54, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 54, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 11 + }, + "identifierName": "fn" + }, + "name": "fn" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 14, + "end": 54, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "body": [ + { + "type": "ClassDeclaration", + "start": 18, + "end": 52, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 4, + "column": 3 + } + }, + "id": { + "type": "Identifier", + "start": 24, + "end": 25, + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 9 + }, + "identifierName": "A" + }, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 26, + "end": 52, + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 4, + "column": 3 + } + }, + "body": [ + { + "type": "ClassProperty", + "start": 32, + "end": 48, + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 20 + } + }, + "static": false, + "key": { + "type": "Identifier", + "start": 32, + "end": 35, + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 7 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "computed": false, + "value": { + "type": "Identifier", + "start": 38, + "end": 47, + "loc": { + "start": { + "line": 3, + "column": 10 + }, + "end": { + "line": 3, + "column": 19 + }, + "identifierName": "arguments" + }, + "name": "arguments" + } + } + ] + } + } + ], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-properties/await-in-async-in-class-property/input.js b/packages/babel-parser/test/fixtures/experimental/class-properties/await-in-async-in-class-property/input.js new file mode 100644 index 000000000000..388ae60d9f00 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-properties/await-in-async-in-class-property/input.js @@ -0,0 +1,3 @@ +class C { + p = async () => await + 42; +} diff --git a/packages/babel-parser/test/fixtures/experimental/class-properties/await-in-async-in-class-property/options.json b/packages/babel-parser/test/fixtures/experimental/class-properties/await-in-async-in-class-property/options.json new file mode 100644 index 000000000000..9c27576d4ad0 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-properties/await-in-async-in-class-property/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["classProperties"] +} diff --git a/packages/babel-parser/test/fixtures/experimental/class-properties/await-in-async-in-class-property/output.json b/packages/babel-parser/test/fixtures/experimental/class-properties/await-in-async-in-class-property/output.json new file mode 100644 index 000000000000..0031d27b4529 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-properties/await-in-async-in-class-property/output.json @@ -0,0 +1,190 @@ +{ + "type": "File", + "start": 0, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "C" + }, + "name": "C" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 8, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": [ + { + "type": "ClassProperty", + "start": 12, + "end": 39, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 29 + } + }, + "static": false, + "key": { + "type": "Identifier", + "start": 12, + "end": 13, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 3 + }, + "identifierName": "p" + }, + "name": "p" + }, + "computed": false, + "value": { + "type": "ArrowFunctionExpression", + "start": 16, + "end": 38, + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 28 + } + }, + "id": null, + "generator": false, + "async": true, + "params": [], + "body": { + "type": "AwaitExpression", + "start": 28, + "end": 38, + "loc": { + "start": { + "line": 2, + "column": 18 + }, + "end": { + "line": 2, + "column": 28 + } + }, + "argument": { + "type": "UnaryExpression", + "start": 34, + "end": 38, + "loc": { + "start": { + "line": 2, + "column": 24 + }, + "end": { + "line": 2, + "column": 28 + } + }, + "operator": "+", + "prefix": true, + "argument": { + "type": "NumericLiteral", + "start": 36, + "end": 38, + "loc": { + "start": { + "line": 2, + "column": 26 + }, + "end": { + "line": 2, + "column": 28 + } + }, + "extra": { + "rawValue": 42, + "raw": "42" + }, + "value": 42 + } + } + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-properties/await-in-class-property-in-async/input.js b/packages/babel-parser/test/fixtures/experimental/class-properties/await-in-class-property-in-async/input.js new file mode 100644 index 000000000000..84a94bd55ed8 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-properties/await-in-class-property-in-async/input.js @@ -0,0 +1,6 @@ +async () => { + class C { + // here await is an identifier reference + p = await + 42; + } +} diff --git a/packages/babel-parser/test/fixtures/experimental/class-properties/await-in-class-property-in-async/options.json b/packages/babel-parser/test/fixtures/experimental/class-properties/await-in-class-property-in-async/options.json new file mode 100644 index 000000000000..9c27576d4ad0 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-properties/await-in-class-property-in-async/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["classProperties"] +} diff --git a/packages/babel-parser/test/fixtures/experimental/class-properties/await-in-class-property-in-async/output.json b/packages/babel-parser/test/fixtures/experimental/class-properties/await-in-class-property-in-async/output.json new file mode 100644 index 000000000000..34bc34826eca --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-properties/await-in-class-property-in-async/output.json @@ -0,0 +1,260 @@ +{ + "type": "File", + "start": 0, + "end": 96, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 6, + "column": 1 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 96, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 6, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 96, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 6, + "column": 1 + } + }, + "expression": { + "type": "ArrowFunctionExpression", + "start": 0, + "end": 96, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 6, + "column": 1 + } + }, + "id": null, + "generator": false, + "async": true, + "params": [], + "body": { + "type": "BlockStatement", + "start": 12, + "end": 96, + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 6, + "column": 1 + } + }, + "body": [ + { + "type": "ClassDeclaration", + "start": 16, + "end": 94, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 5, + "column": 3 + } + }, + "id": { + "type": "Identifier", + "start": 22, + "end": 23, + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 9 + }, + "identifierName": "C" + }, + "name": "C" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 24, + "end": 94, + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 5, + "column": 3 + } + }, + "body": [ + { + "type": "ClassProperty", + "start": 75, + "end": 90, + "loc": { + "start": { + "line": 4, + "column": 4 + }, + "end": { + "line": 4, + "column": 19 + } + }, + "static": false, + "key": { + "type": "Identifier", + "start": 75, + "end": 76, + "loc": { + "start": { + "line": 4, + "column": 4 + }, + "end": { + "line": 4, + "column": 5 + }, + "identifierName": "p" + }, + "name": "p" + }, + "computed": false, + "value": { + "type": "BinaryExpression", + "start": 79, + "end": 89, + "loc": { + "start": { + "line": 4, + "column": 8 + }, + "end": { + "line": 4, + "column": 18 + } + }, + "left": { + "type": "Identifier", + "start": 79, + "end": 84, + "loc": { + "start": { + "line": 4, + "column": 8 + }, + "end": { + "line": 4, + "column": 13 + }, + "identifierName": "await" + }, + "name": "await" + }, + "operator": "+", + "right": { + "type": "NumericLiteral", + "start": 87, + "end": 89, + "loc": { + "start": { + "line": 4, + "column": 16 + }, + "end": { + "line": 4, + "column": 18 + } + }, + "extra": { + "rawValue": 42, + "raw": "42" + }, + "value": 42 + } + }, + "leadingComments": [ + { + "type": "CommentLine", + "value": " here await is an identifier reference", + "start": 30, + "end": 70, + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 44 + } + } + } + ] + } + ] + } + } + ], + "directives": [] + } + } + } + ], + "directives": [] + }, + "comments": [ + { + "type": "CommentLine", + "value": " here await is an identifier reference", + "start": 30, + "end": 70, + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 44 + } + } + } + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-properties/new-target-invalid/options.json b/packages/babel-parser/test/fixtures/experimental/class-properties/new-target-invalid/options.json index 8d36a47b9f64..9c27576d4ad0 100644 --- a/packages/babel-parser/test/fixtures/experimental/class-properties/new-target-invalid/options.json +++ b/packages/babel-parser/test/fixtures/experimental/class-properties/new-target-invalid/options.json @@ -1,4 +1,3 @@ { - "plugins": ["classProperties"], - "throws": "new.target can only be used in functions or class properties (1:8)" + "plugins": ["classProperties"] } diff --git a/packages/babel-parser/test/fixtures/experimental/class-properties/new-target-invalid/output.json b/packages/babel-parser/test/fixtures/experimental/class-properties/new-target-invalid/output.json new file mode 100644 index 000000000000..a44ee2efc222 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-properties/new-target-invalid/output.json @@ -0,0 +1,137 @@ +{ + "type": "File", + "start": 0, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "errors": [ + "SyntaxError: new.target can only be used in functions or class properties (1:8)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 0, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 4, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "id": { + "type": "Identifier", + "start": 4, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + }, + "identifierName": "x" + }, + "name": "x" + }, + "init": { + "type": "MetaProperty", + "start": 8, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "meta": { + "type": "Identifier", + "start": 8, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 11 + }, + "identifierName": "new" + }, + "name": "new" + }, + "property": { + "type": "Identifier", + "start": 12, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 18 + }, + "identifierName": "target" + }, + "name": "target" + } + } + } + ], + "kind": "var" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-properties/no-ctor-2/options.json b/packages/babel-parser/test/fixtures/experimental/class-properties/no-ctor-2/options.json index 9884529d32d7..9c27576d4ad0 100644 --- a/packages/babel-parser/test/fixtures/experimental/class-properties/no-ctor-2/options.json +++ b/packages/babel-parser/test/fixtures/experimental/class-properties/no-ctor-2/options.json @@ -1,4 +1,3 @@ { - "throws": "Classes may not have a non-static field named 'constructor' (2:2)", "plugins": ["classProperties"] } diff --git a/packages/babel-parser/test/fixtures/experimental/class-properties/no-ctor-2/output.json b/packages/babel-parser/test/fixtures/experimental/class-properties/no-ctor-2/output.json new file mode 100644 index 000000000000..0678d1917926 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-properties/no-ctor-2/output.json @@ -0,0 +1,179 @@ +{ + "type": "File", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Classes may not have a field named 'constructor' (2:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 9 + }, + "identifierName": "Foo" + }, + "name": "Foo" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 10, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "body": [ + { + "type": "ClassProperty", + "start": 14, + "end": 25, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 13 + } + }, + "static": false, + "key": { + "type": "Identifier", + "start": 14, + "end": 25, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 13 + }, + "identifierName": "constructor" + }, + "name": "constructor" + }, + "computed": false, + "value": null + }, + { + "type": "ClassMethod", + "start": 28, + "end": 34, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 8 + } + }, + "static": false, + "kind": "method", + "key": { + "type": "Identifier", + "start": 29, + "end": 30, + "loc": { + "start": { + "line": 3, + "column": 3 + }, + "end": { + "line": 3, + "column": 4 + }, + "identifierName": "x" + }, + "name": "x" + }, + "computed": false, + "id": null, + "generator": true, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 32, + "end": 34, + "loc": { + "start": { + "line": 3, + "column": 6 + }, + "end": { + "line": 3, + "column": 8 + } + }, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-properties/no-ctor/options.json b/packages/babel-parser/test/fixtures/experimental/class-properties/no-ctor/options.json index 9884529d32d7..9c27576d4ad0 100644 --- a/packages/babel-parser/test/fixtures/experimental/class-properties/no-ctor/options.json +++ b/packages/babel-parser/test/fixtures/experimental/class-properties/no-ctor/options.json @@ -1,4 +1,3 @@ { - "throws": "Classes may not have a non-static field named 'constructor' (2:2)", "plugins": ["classProperties"] } diff --git a/packages/babel-parser/test/fixtures/experimental/class-properties/no-ctor/output.json b/packages/babel-parser/test/fixtures/experimental/class-properties/no-ctor/output.json new file mode 100644 index 000000000000..2a969d61e76e --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-properties/no-ctor/output.json @@ -0,0 +1,123 @@ +{ + "type": "File", + "start": 0, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Classes may not have a field named 'constructor' (2:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 9 + }, + "identifierName": "Foo" + }, + "name": "Foo" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 10, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": [ + { + "type": "ClassProperty", + "start": 14, + "end": 25, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 13 + } + }, + "static": false, + "key": { + "type": "Identifier", + "start": 14, + "end": 25, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 13 + }, + "identifierName": "constructor" + }, + "name": "constructor" + }, + "computed": false, + "value": null + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-properties/no-static-prototype-2/options.json b/packages/babel-parser/test/fixtures/experimental/class-properties/no-static-prototype-2/options.json index 5bde2716ebdd..9c27576d4ad0 100644 --- a/packages/babel-parser/test/fixtures/experimental/class-properties/no-static-prototype-2/options.json +++ b/packages/babel-parser/test/fixtures/experimental/class-properties/no-static-prototype-2/options.json @@ -1,4 +1,3 @@ { - "throws": "Classes may not have static property named prototype (2:9)", "plugins": ["classProperties"] } diff --git a/packages/babel-parser/test/fixtures/experimental/class-properties/no-static-prototype-2/output.json b/packages/babel-parser/test/fixtures/experimental/class-properties/no-static-prototype-2/output.json new file mode 100644 index 000000000000..975df8dd8199 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-properties/no-static-prototype-2/output.json @@ -0,0 +1,179 @@ +{ + "type": "File", + "start": 0, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Classes may not have static property named prototype (2:9)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 9 + }, + "identifierName": "Foo" + }, + "name": "Foo" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 10, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "body": [ + { + "type": "ClassProperty", + "start": 14, + "end": 30, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 18 + } + }, + "static": true, + "key": { + "type": "Identifier", + "start": 21, + "end": 30, + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 18 + }, + "identifierName": "prototype" + }, + "name": "prototype" + }, + "computed": false, + "value": null + }, + { + "type": "ClassMethod", + "start": 33, + "end": 39, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 8 + } + }, + "static": false, + "kind": "method", + "key": { + "type": "Identifier", + "start": 34, + "end": 35, + "loc": { + "start": { + "line": 3, + "column": 3 + }, + "end": { + "line": 3, + "column": 4 + }, + "identifierName": "x" + }, + "name": "x" + }, + "computed": false, + "id": null, + "generator": true, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 37, + "end": 39, + "loc": { + "start": { + "line": 3, + "column": 6 + }, + "end": { + "line": 3, + "column": 8 + } + }, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-properties/no-static-prototype/options.json b/packages/babel-parser/test/fixtures/experimental/class-properties/no-static-prototype/options.json index 5bde2716ebdd..9c27576d4ad0 100644 --- a/packages/babel-parser/test/fixtures/experimental/class-properties/no-static-prototype/options.json +++ b/packages/babel-parser/test/fixtures/experimental/class-properties/no-static-prototype/options.json @@ -1,4 +1,3 @@ { - "throws": "Classes may not have static property named prototype (2:9)", "plugins": ["classProperties"] } diff --git a/packages/babel-parser/test/fixtures/experimental/class-properties/no-static-prototype/output.json b/packages/babel-parser/test/fixtures/experimental/class-properties/no-static-prototype/output.json new file mode 100644 index 000000000000..fb3005664209 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-properties/no-static-prototype/output.json @@ -0,0 +1,123 @@ +{ + "type": "File", + "start": 0, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Classes may not have static property named prototype (2:9)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 9 + }, + "identifierName": "Foo" + }, + "name": "Foo" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 10, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": [ + { + "type": "ClassProperty", + "start": 14, + "end": 30, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 18 + } + }, + "static": true, + "key": { + "type": "Identifier", + "start": 21, + "end": 30, + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 18 + }, + "identifierName": "prototype" + }, + "name": "prototype" + }, + "computed": false, + "value": null + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-properties/static-field-named-constructor/input.js b/packages/babel-parser/test/fixtures/experimental/class-properties/static-field-named-constructor/input.js new file mode 100644 index 000000000000..d9180dcec0cc --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-properties/static-field-named-constructor/input.js @@ -0,0 +1,3 @@ +class Foo { + static constructor; +} diff --git a/packages/babel-parser/test/fixtures/experimental/class-properties/static-field-named-constructor/options.json b/packages/babel-parser/test/fixtures/experimental/class-properties/static-field-named-constructor/options.json new file mode 100644 index 000000000000..9c27576d4ad0 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-properties/static-field-named-constructor/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["classProperties"] +} diff --git a/packages/babel-parser/test/fixtures/experimental/class-properties/static-field-named-constructor/output.json b/packages/babel-parser/test/fixtures/experimental/class-properties/static-field-named-constructor/output.json new file mode 100644 index 000000000000..74fd91c747c5 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-properties/static-field-named-constructor/output.json @@ -0,0 +1,123 @@ +{ + "type": "File", + "start": 0, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Classes may not have a field named 'constructor' (2:11)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 9 + }, + "identifierName": "Foo" + }, + "name": "Foo" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 10, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": [ + { + "type": "ClassProperty", + "start": 16, + "end": 35, + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 23 + } + }, + "static": true, + "key": { + "type": "Identifier", + "start": 23, + "end": 34, + "loc": { + "start": { + "line": 2, + "column": 11 + }, + "end": { + "line": 2, + "column": 22 + }, + "identifierName": "constructor" + }, + "name": "constructor" + }, + "computed": false, + "value": null + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-properties/super-call/options.json b/packages/babel-parser/test/fixtures/experimental/class-properties/super-call/options.json index e8d509e27740..9c27576d4ad0 100644 --- a/packages/babel-parser/test/fixtures/experimental/class-properties/super-call/options.json +++ b/packages/babel-parser/test/fixtures/experimental/class-properties/super-call/options.json @@ -1,4 +1,3 @@ { - "plugins": ["classProperties"], - "throws": "super() is only valid inside a class constructor of a subclass. Maybe a typo in the method name ('constructor') or not extending another class? (4:12)" + "plugins": ["classProperties"] } diff --git a/packages/babel-parser/test/fixtures/experimental/class-properties/super-call/output.json b/packages/babel-parser/test/fixtures/experimental/class-properties/super-call/output.json new file mode 100644 index 000000000000..987d1eef5055 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-properties/super-call/output.json @@ -0,0 +1,292 @@ +{ + "type": "File", + "start": 0, + "end": 94, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 7, + "column": 1 + } + }, + "errors": [ + "SyntaxError: super() is only valid inside a class constructor of a subclass. Maybe a typo in the method name ('constructor') or not extending another class? (4:12)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 94, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 7, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 94, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 7, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "A" + }, + "name": "A" + }, + "superClass": { + "type": "Identifier", + "start": 16, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + }, + "identifierName": "B" + }, + "name": "B" + }, + "body": { + "type": "ClassBody", + "start": 18, + "end": 94, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 7, + "column": 1 + } + }, + "body": [ + { + "type": "ClassMethod", + "start": 22, + "end": 92, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 6, + "column": 3 + } + }, + "static": false, + "key": { + "type": "Identifier", + "start": 22, + "end": 33, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 13 + }, + "identifierName": "constructor" + }, + "name": "constructor" + }, + "computed": false, + "kind": "constructor", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 36, + "end": 92, + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 6, + "column": 3 + } + }, + "body": [ + { + "type": "ClassDeclaration", + "start": 42, + "end": 88, + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 5, + "column": 5 + } + }, + "id": { + "type": "Identifier", + "start": 48, + "end": 49, + "loc": { + "start": { + "line": 3, + "column": 10 + }, + "end": { + "line": 3, + "column": 11 + }, + "identifierName": "C" + }, + "name": "C" + }, + "superClass": { + "type": "Identifier", + "start": 58, + "end": 59, + "loc": { + "start": { + "line": 3, + "column": 20 + }, + "end": { + "line": 3, + "column": 21 + }, + "identifierName": "D" + }, + "name": "D" + }, + "body": { + "type": "ClassBody", + "start": 60, + "end": 88, + "loc": { + "start": { + "line": 3, + "column": 22 + }, + "end": { + "line": 5, + "column": 5 + } + }, + "body": [ + { + "type": "ClassProperty", + "start": 68, + "end": 82, + "loc": { + "start": { + "line": 4, + "column": 6 + }, + "end": { + "line": 4, + "column": 20 + } + }, + "static": false, + "key": { + "type": "Identifier", + "start": 68, + "end": 71, + "loc": { + "start": { + "line": 4, + "column": 6 + }, + "end": { + "line": 4, + "column": 9 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "computed": false, + "value": { + "type": "CallExpression", + "start": 74, + "end": 81, + "loc": { + "start": { + "line": 4, + "column": 12 + }, + "end": { + "line": 4, + "column": 19 + } + }, + "callee": { + "type": "Super", + "start": 74, + "end": 79, + "loc": { + "start": { + "line": 4, + "column": 12 + }, + "end": { + "line": 4, + "column": 17 + } + } + }, + "arguments": [] + } + } + ] + } + } + ], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-properties/super-inside-function/options.json b/packages/babel-parser/test/fixtures/experimental/class-properties/super-inside-function/options.json index 386c2968e7b0..9c27576d4ad0 100644 --- a/packages/babel-parser/test/fixtures/experimental/class-properties/super-inside-function/options.json +++ b/packages/babel-parser/test/fixtures/experimental/class-properties/super-inside-function/options.json @@ -1,4 +1,3 @@ { - "plugins": ["classProperties"], - "throws": "super is only allowed in object methods and classes (3:4)" + "plugins": ["classProperties"] } diff --git a/packages/babel-parser/test/fixtures/experimental/class-properties/super-inside-function/output.json b/packages/babel-parser/test/fixtures/experimental/class-properties/super-inside-function/output.json new file mode 100644 index 000000000000..b129c88406f6 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-properties/super-inside-function/output.json @@ -0,0 +1,254 @@ +{ + "type": "File", + "start": 0, + "end": 54, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "errors": [ + "SyntaxError: super is only allowed in object methods and classes (3:4)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 54, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 54, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "A" + }, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 8, + "end": 54, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "body": [ + { + "type": "ClassProperty", + "start": 12, + "end": 52, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 4, + "column": 3 + } + }, + "static": false, + "key": { + "type": "Identifier", + "start": 12, + "end": 15, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 5 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "computed": false, + "value": { + "type": "FunctionExpression", + "start": 18, + "end": 52, + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 4, + "column": 3 + } + }, + "id": { + "type": "Identifier", + "start": 27, + "end": 29, + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 19 + }, + "identifierName": "fn" + }, + "name": "fn" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 32, + "end": 52, + "loc": { + "start": { + "line": 2, + "column": 22 + }, + "end": { + "line": 4, + "column": 3 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 38, + "end": 48, + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 14 + } + }, + "expression": { + "type": "CallExpression", + "start": 38, + "end": 47, + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 13 + } + }, + "callee": { + "type": "MemberExpression", + "start": 38, + "end": 45, + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 11 + } + }, + "object": { + "type": "Super", + "start": 38, + "end": 43, + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 9 + } + } + }, + "property": { + "type": "Identifier", + "start": 44, + "end": 45, + "loc": { + "start": { + "line": 3, + "column": 10 + }, + "end": { + "line": 3, + "column": 11 + }, + "identifierName": "x" + }, + "name": "x" + }, + "computed": false + }, + "arguments": [] + } + } + ], + "directives": [] + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/decorators-2/decoratorsBeforeExport-export-default-decorated-expression-without-parens/options.json b/packages/babel-parser/test/fixtures/experimental/decorators-2/decoratorsBeforeExport-export-default-decorated-expression-without-parens/options.json index 39592e4eb294..0845f9c79e6c 100644 --- a/packages/babel-parser/test/fixtures/experimental/decorators-2/decoratorsBeforeExport-export-default-decorated-expression-without-parens/options.json +++ b/packages/babel-parser/test/fixtures/experimental/decorators-2/decoratorsBeforeExport-export-default-decorated-expression-without-parens/options.json @@ -1,5 +1,11 @@ { - "sourceType": "module", - "plugins": [["decorators", { "decoratorsBeforeExport": true }]], - "throws": "Decorators must be placed *before* the 'export' keyword. You can set the 'decoratorsBeforeExport' option to false to use the 'export @decorator class {}' syntax (1:15)" + "plugins": [ + [ + "decorators", + { + "decoratorsBeforeExport": true + } + ] + ], + "sourceType": "module" } diff --git a/packages/babel-parser/test/fixtures/experimental/decorators-2/decoratorsBeforeExport-export-default-decorated-expression-without-parens/output.json b/packages/babel-parser/test/fixtures/experimental/decorators-2/decoratorsBeforeExport-export-default-decorated-expression-without-parens/output.json new file mode 100644 index 000000000000..2ac3ce6a5954 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/decorators-2/decoratorsBeforeExport-export-default-decorated-expression-without-parens/output.json @@ -0,0 +1,136 @@ +{ + "type": "File", + "start": 0, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 38 + } + }, + "errors": [ + "SyntaxError: Decorators must be placed *before* the 'export' keyword. You can set the 'decoratorsBeforeExport' option to false to use the 'export @decorator class {}' syntax (1:15)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 38 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExportDefaultDeclaration", + "start": 0, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 38 + } + }, + "declaration": { + "type": "ClassDeclaration", + "start": 15, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 38 + } + }, + "decorators": [ + { + "type": "Decorator", + "start": 15, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "expression": { + "type": "Identifier", + "start": 16, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 25 + }, + "identifierName": "decorator" + }, + "name": "decorator" + } + } + ], + "id": { + "type": "Identifier", + "start": 32, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 35 + }, + "identifierName": "Foo" + }, + "name": "Foo" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 36, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 36 + }, + "end": { + "line": 1, + "column": 38 + } + }, + "body": [] + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/decorators-2/no-class-method-parameter/options.json b/packages/babel-parser/test/fixtures/experimental/decorators-2/no-class-method-parameter/options.json deleted file mode 100644 index 7b4e6dc626ae..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/decorators-2/no-class-method-parameter/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Stage 2 decorators cannot be used to decorate parameters (2:14)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/decorators-2/no-class-method-parameter/output.json b/packages/babel-parser/test/fixtures/experimental/decorators-2/no-class-method-parameter/output.json new file mode 100644 index 000000000000..9f8814a38f61 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/decorators-2/no-class-method-parameter/output.json @@ -0,0 +1,196 @@ +{ + "type": "File", + "start": 0, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Stage 2 decorators cannot be used to decorate parameters (2:14)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 9 + }, + "identifierName": "Foo" + }, + "name": "Foo" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 10, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": [ + { + "type": "ClassMethod", + "start": 14, + "end": 36, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 24 + } + }, + "static": false, + "key": { + "type": "Identifier", + "start": 14, + "end": 25, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 13 + }, + "identifierName": "constructor" + }, + "name": "constructor" + }, + "computed": false, + "kind": "constructor", + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 31, + "end": 32, + "loc": { + "start": { + "line": 2, + "column": 19 + }, + "end": { + "line": 2, + "column": 20 + }, + "identifierName": "x" + }, + "name": "x", + "decorators": [ + { + "type": "Decorator", + "start": 26, + "end": 30, + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 18 + } + }, + "expression": { + "type": "Identifier", + "start": 27, + "end": 30, + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 18 + }, + "identifierName": "foo" + }, + "name": "foo" + } + } + ] + } + ], + "body": { + "type": "BlockStatement", + "start": 34, + "end": 36, + "loc": { + "start": { + "line": 2, + "column": 22 + }, + "end": { + "line": 2, + "column": 24 + } + }, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/decorators-2/no-constructor-decorators/options.json b/packages/babel-parser/test/fixtures/experimental/decorators-2/no-constructor-decorators/options.json deleted file mode 100644 index a26ed7cacb84..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/decorators-2/no-constructor-decorators/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "You can't attach decorators to a class constructor (2:2)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/decorators-2/no-constructor-decorators/output.json b/packages/babel-parser/test/fixtures/experimental/decorators-2/no-constructor-decorators/output.json new file mode 100644 index 000000000000..084e74570676 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/decorators-2/no-constructor-decorators/output.json @@ -0,0 +1,178 @@ +{ + "type": "File", + "start": 0, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Decorators can't be used with a constructor. Did you mean '@dec class { ... }'? (2:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 9 + }, + "identifierName": "Foo" + }, + "name": "Foo" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 10, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "body": [ + { + "type": "ClassMethod", + "start": 14, + "end": 36, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 3, + "column": 17 + } + }, + "decorators": [ + { + "type": "Decorator", + "start": 14, + "end": 18, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 6 + } + }, + "expression": { + "type": "Identifier", + "start": 15, + "end": 18, + "loc": { + "start": { + "line": 2, + "column": 3 + }, + "end": { + "line": 2, + "column": 6 + }, + "identifierName": "abc" + }, + "name": "abc" + } + } + ], + "static": false, + "key": { + "type": "Identifier", + "start": 21, + "end": 32, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 13 + }, + "identifierName": "constructor" + }, + "name": "constructor" + }, + "computed": false, + "kind": "constructor", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 34, + "end": 36, + "loc": { + "start": { + "line": 3, + "column": 15 + }, + "end": { + "line": 3, + "column": 17 + } + }, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/decorators-2/no-export-decorators-on-class/options.json b/packages/babel-parser/test/fixtures/experimental/decorators-2/no-export-decorators-on-class/options.json index cb54fc794402..2104ca43283f 100644 --- a/packages/babel-parser/test/fixtures/experimental/decorators-2/no-export-decorators-on-class/options.json +++ b/packages/babel-parser/test/fixtures/experimental/decorators-2/no-export-decorators-on-class/options.json @@ -1,4 +1,3 @@ { - "sourceType": "module", - "throws": "Using the export keyword between a decorator and a class is not allowed. Please use `export @dec class` instead. (2:0)" + "sourceType": "module" } diff --git a/packages/babel-parser/test/fixtures/experimental/decorators-2/no-export-decorators-on-class/output.json b/packages/babel-parser/test/fixtures/experimental/decorators-2/no-export-decorators-on-class/output.json new file mode 100644 index 000000000000..733e482e120a --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/decorators-2/no-export-decorators-on-class/output.json @@ -0,0 +1,120 @@ +{ + "type": "File", + "start": 0, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 23 + } + }, + "errors": [ + "SyntaxError: Using the export keyword between a decorator and a class is not allowed. Please use `export @dec class` instead. (2:0)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 23 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExportDefaultDeclaration", + "start": 5, + "end": 28, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 23 + } + }, + "declaration": { + "type": "ClassDeclaration", + "start": 0, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 23 + } + }, + "decorators": [ + { + "type": "Decorator", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "expression": { + "type": "Identifier", + "start": 1, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 4 + }, + "identifierName": "foo" + }, + "name": "foo" + } + } + ], + "id": null, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 26, + "end": 28, + "loc": { + "start": { + "line": 2, + "column": 21 + }, + "end": { + "line": 2, + "column": 23 + } + }, + "body": [] + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/decorators-2/no-function-parameters/options.json b/packages/babel-parser/test/fixtures/experimental/decorators-2/no-function-parameters/options.json deleted file mode 100644 index 6637fc7f8345..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/decorators-2/no-function-parameters/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Stage 2 decorators cannot be used to decorate parameters (1:14)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/decorators-2/no-function-parameters/output.json b/packages/babel-parser/test/fixtures/experimental/decorators-2/no-function-parameters/output.json new file mode 100644 index 000000000000..ec6b85a88a6b --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/decorators-2/no-function-parameters/output.json @@ -0,0 +1,142 @@ +{ + "type": "File", + "start": 0, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "errors": [ + "SyntaxError: Stage 2 decorators cannot be used to decorate parameters (1:14)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 13 + }, + "identifierName": "func" + }, + "name": "func" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 19, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + }, + "identifierName": "x" + }, + "name": "x", + "decorators": [ + { + "type": "Decorator", + "start": 14, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "expression": { + "type": "Identifier", + "start": 15, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 18 + }, + "identifierName": "foo" + }, + "name": "foo" + } + } + ] + } + ], + "body": { + "type": "BlockStatement", + "start": 22, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "body": [], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/decorators-2/no-object-method-parameters/options.json b/packages/babel-parser/test/fixtures/experimental/decorators-2/no-object-method-parameters/options.json deleted file mode 100644 index b1730696933e..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/decorators-2/no-object-method-parameters/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Stage 2 decorators cannot be used to decorate parameters (2:9)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/decorators-2/no-object-method-parameters/output.json b/packages/babel-parser/test/fixtures/experimental/decorators-2/no-object-method-parameters/output.json new file mode 100644 index 000000000000..2819428d5aef --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/decorators-2/no-object-method-parameters/output.json @@ -0,0 +1,213 @@ +{ + "type": "File", + "start": 0, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 2 + } + }, + "errors": [ + "SyntaxError: Stage 2 decorators cannot be used to decorate parameters (2:9)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 2 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 0, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 2 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 4, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 4, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "obj" + }, + "name": "obj" + }, + "init": { + "type": "ObjectExpression", + "start": 10, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "properties": [ + { + "type": "ObjectMethod", + "start": 14, + "end": 31, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 19 + } + }, + "method": true, + "key": { + "type": "Identifier", + "start": 14, + "end": 20, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 8 + }, + "identifierName": "method" + }, + "name": "method" + }, + "computed": false, + "kind": "method", + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 26, + "end": 27, + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 15 + }, + "identifierName": "x" + }, + "name": "x", + "decorators": [ + { + "type": "Decorator", + "start": 21, + "end": 25, + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 13 + } + }, + "expression": { + "type": "Identifier", + "start": 22, + "end": 25, + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 13 + }, + "identifierName": "foo" + }, + "name": "foo" + } + } + ] + } + ], + "body": { + "type": "BlockStatement", + "start": 29, + "end": 31, + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 19 + } + }, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "kind": "var" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/decorators-2/no-object-methods/options.json b/packages/babel-parser/test/fixtures/experimental/decorators-2/no-object-methods/options.json index 7dd4ed9e2837..cab2cc563643 100644 --- a/packages/babel-parser/test/fixtures/experimental/decorators-2/no-object-methods/options.json +++ b/packages/babel-parser/test/fixtures/experimental/decorators-2/no-object-methods/options.json @@ -1,3 +1,10 @@ { - "throws": "Stage 2 decorators disallow object literal property decorators (2:2)" + "plugins": [ + [ + "decorators", + { + "decoratorsBeforeExport": false + } + ] + ] } diff --git a/packages/babel-parser/test/fixtures/experimental/decorators-2/no-object-methods/output.json b/packages/babel-parser/test/fixtures/experimental/decorators-2/no-object-methods/output.json new file mode 100644 index 000000000000..e50713954be0 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/decorators-2/no-object-methods/output.json @@ -0,0 +1,195 @@ +{ + "type": "File", + "start": 0, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Stage 2 decorators disallow object literal property decorators (2:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 0, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 4, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 4, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + }, + "identifierName": "o" + }, + "name": "o" + }, + "init": { + "type": "ObjectExpression", + "start": 8, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "properties": [ + { + "type": "ObjectMethod", + "start": 19, + "end": 30, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 4, + "column": 3 + } + }, + "decorators": [ + { + "type": "Decorator", + "start": 12, + "end": 16, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 6 + } + }, + "expression": { + "type": "Identifier", + "start": 13, + "end": 16, + "loc": { + "start": { + "line": 2, + "column": 3 + }, + "end": { + "line": 2, + "column": 6 + }, + "identifierName": "baz" + }, + "name": "baz" + } + } + ], + "method": true, + "key": { + "type": "Identifier", + "start": 19, + "end": 22, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 5 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "computed": false, + "kind": "method", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 25, + "end": 30, + "loc": { + "start": { + "line": 3, + "column": 8 + }, + "end": { + "line": 4, + "column": 3 + } + }, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "kind": "var" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/decorators/no-constructor-decorators/options.json b/packages/babel-parser/test/fixtures/experimental/decorators/no-constructor-decorators/options.json deleted file mode 100644 index a26ed7cacb84..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/decorators/no-constructor-decorators/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "You can't attach decorators to a class constructor (2:2)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/decorators/no-constructor-decorators/output.json b/packages/babel-parser/test/fixtures/experimental/decorators/no-constructor-decorators/output.json new file mode 100644 index 000000000000..084e74570676 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/decorators/no-constructor-decorators/output.json @@ -0,0 +1,178 @@ +{ + "type": "File", + "start": 0, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Decorators can't be used with a constructor. Did you mean '@dec class { ... }'? (2:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 9 + }, + "identifierName": "Foo" + }, + "name": "Foo" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 10, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "body": [ + { + "type": "ClassMethod", + "start": 14, + "end": 36, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 3, + "column": 17 + } + }, + "decorators": [ + { + "type": "Decorator", + "start": 14, + "end": 18, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 6 + } + }, + "expression": { + "type": "Identifier", + "start": 15, + "end": 18, + "loc": { + "start": { + "line": 2, + "column": 3 + }, + "end": { + "line": 2, + "column": 6 + }, + "identifierName": "abc" + }, + "name": "abc" + } + } + ], + "static": false, + "key": { + "type": "Identifier", + "start": 21, + "end": 32, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 13 + }, + "identifierName": "constructor" + }, + "name": "constructor" + }, + "computed": false, + "kind": "constructor", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 34, + "end": 36, + "loc": { + "start": { + "line": 3, + "column": 15 + }, + "end": { + "line": 3, + "column": 17 + } + }, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/dynamic-import/direct-calls-only/options.json b/packages/babel-parser/test/fixtures/experimental/dynamic-import/direct-calls-only/options.json deleted file mode 100644 index 599298db4614..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/dynamic-import/direct-calls-only/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Dynamic imports require a parameter: import('a.js') (2:9)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/dynamic-import/invalid-arguments-spread/options.json b/packages/babel-parser/test/fixtures/experimental/dynamic-import/invalid-arguments-spread/options.json deleted file mode 100644 index c4e1e2ffeb50..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/dynamic-import/invalid-arguments-spread/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "... is not allowed in import() (1:7)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/dynamic-import/invalid-lone-import/input.js b/packages/babel-parser/test/fixtures/experimental/dynamic-import/invalid-lone-import/input.js new file mode 100644 index 000000000000..477eec265426 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/dynamic-import/invalid-lone-import/input.js @@ -0,0 +1 @@ +(import) diff --git a/packages/babel-parser/test/fixtures/experimental/dynamic-import/options.json b/packages/babel-parser/test/fixtures/experimental/dynamic-import/invalid-lone-import/options.json similarity index 100% rename from packages/babel-parser/test/fixtures/experimental/dynamic-import/options.json rename to packages/babel-parser/test/fixtures/experimental/dynamic-import/invalid-lone-import/options.json diff --git a/packages/babel-parser/test/fixtures/experimental/dynamic-import/invalid-lone-import/output.json b/packages/babel-parser/test/fixtures/experimental/dynamic-import/invalid-lone-import/output.json new file mode 100644 index 000000000000..fe56e0811a5a --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/dynamic-import/invalid-lone-import/output.json @@ -0,0 +1,72 @@ +{ + "type": "File", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "errors": [ + "SyntaxError: import can only be used in import() or import.meta (1:1)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "expression": { + "type": "Import", + "start": 1, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "extra": { + "parenthesized": true, + "parenStart": 0 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/dynamic-import/invalid-new/options.json b/packages/babel-parser/test/fixtures/experimental/dynamic-import/invalid-new/options.json deleted file mode 100644 index 26e64ffc5d96..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/dynamic-import/invalid-new/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Cannot use new with import(...) (1:4)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/dynamic-import/invalid-trailing-comma/options.json b/packages/babel-parser/test/fixtures/experimental/dynamic-import/invalid-trailing-comma/options.json deleted file mode 100644 index 770750c7f91f..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/dynamic-import/invalid-trailing-comma/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Trailing comma is disallowed inside import(...) arguments (1:13)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/dynamic-import/multiple-args/options.json b/packages/babel-parser/test/fixtures/experimental/dynamic-import/multiple-args/options.json deleted file mode 100644 index 95a99c52ae49..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/dynamic-import/multiple-args/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "import() requires exactly one argument (1:0)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/dynamic-import/no-args/options.json b/packages/babel-parser/test/fixtures/experimental/dynamic-import/no-args/options.json deleted file mode 100644 index 95a99c52ae49..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/dynamic-import/no-args/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "import() requires exactly one argument (1:0)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/dynamic-import/no-plugin/options.json b/packages/babel-parser/test/fixtures/experimental/dynamic-import/no-plugin/options.json deleted file mode 100644 index 8036724beed2..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/dynamic-import/no-plugin/options.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "throws": "This experimental syntax requires enabling the parser plugin: 'dynamicImport' (1:0)", - "plugins": [] -} diff --git a/packages/babel-parser/test/fixtures/experimental/dynamic-import/parses-module/input.js b/packages/babel-parser/test/fixtures/experimental/dynamic-import/parses-module/input.js deleted file mode 100644 index b49ee994b11f..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/dynamic-import/parses-module/input.js +++ /dev/null @@ -1 +0,0 @@ -import('test.js'); diff --git a/packages/babel-parser/test/fixtures/experimental/export-extensions/default-and-ns/options.json b/packages/babel-parser/test/fixtures/experimental/export-extensions/default-and-ns/options.json index 3bb54891b474..fb17f33a28b5 100644 --- a/packages/babel-parser/test/fixtures/experimental/export-extensions/default-and-ns/options.json +++ b/packages/babel-parser/test/fixtures/experimental/export-extensions/default-and-ns/options.json @@ -1,4 +1,4 @@ { - "plugins": ["exportDefaultFrom", "exportNamespaceFrom"], + "plugins": ["exportDefaultFrom"], "sourceType": "module" } diff --git a/packages/babel-parser/test/fixtures/experimental/export-extensions/ns-and-named/options.json b/packages/babel-parser/test/fixtures/experimental/export-extensions/ns-and-named/options.json deleted file mode 100644 index efa6c457adc3..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/export-extensions/ns-and-named/options.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "sourceType": "module", - "plugins": ["exportNamespaceFrom"] -} diff --git a/packages/babel-parser/test/fixtures/experimental/export-extensions/ns-default/options.json b/packages/babel-parser/test/fixtures/experimental/export-extensions/ns-default/options.json deleted file mode 100644 index e32f18023916..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/export-extensions/ns-default/options.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "plugins": ["exportNamespaceFrom"], - "sourceType": "module" -} diff --git a/packages/babel-parser/test/fixtures/experimental/export-extensions/ns/input.js b/packages/babel-parser/test/fixtures/experimental/export-extensions/ns/input.js deleted file mode 100644 index 27357f4758f9..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/export-extensions/ns/input.js +++ /dev/null @@ -1 +0,0 @@ -export * as A from 'test'; diff --git a/packages/babel-parser/test/fixtures/experimental/export-extensions/ns/options.json b/packages/babel-parser/test/fixtures/experimental/export-extensions/ns/options.json deleted file mode 100644 index e32f18023916..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/export-extensions/ns/options.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "plugins": ["exportNamespaceFrom"], - "sourceType": "module" -} diff --git a/packages/babel-parser/test/fixtures/experimental/import-meta/error-in-script/options.json b/packages/babel-parser/test/fixtures/experimental/import-meta/error-in-script/options.json index eb1e545759e8..7442e09e1f56 100644 --- a/packages/babel-parser/test/fixtures/experimental/import-meta/error-in-script/options.json +++ b/packages/babel-parser/test/fixtures/experimental/import-meta/error-in-script/options.json @@ -1,5 +1,4 @@ { - "throws": "import.meta may appear only with 'sourceType: \"module\"' (1:10)", - "plugins": ["dynamicImport", "importMeta"], + "plugins": ["importMeta"], "sourceType": "script" } diff --git a/packages/babel-parser/test/fixtures/experimental/import-meta/error-in-script/output.json b/packages/babel-parser/test/fixtures/experimental/import-meta/error-in-script/output.json new file mode 100644 index 000000000000..12e01e17c23c --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/import-meta/error-in-script/output.json @@ -0,0 +1,137 @@ +{ + "type": "File", + "start": 0, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "errors": [ + "SyntaxError: import.meta may appear only with 'sourceType: \"module\"' (1:10)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 0, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 6, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "x" + }, + "name": "x" + }, + "init": { + "type": "MetaProperty", + "start": 10, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "meta": { + "type": "Identifier", + "start": 10, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 16 + }, + "identifierName": "import" + }, + "name": "import" + }, + "property": { + "type": "Identifier", + "start": 17, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 21 + }, + "identifierName": "meta" + }, + "name": "meta" + } + } + } + ], + "kind": "const" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/import-meta/no-other-prop-names/options.json b/packages/babel-parser/test/fixtures/experimental/import-meta/no-other-prop-names/options.json index 97ba83ec465d..a6638b6528c1 100644 --- a/packages/babel-parser/test/fixtures/experimental/import-meta/no-other-prop-names/options.json +++ b/packages/babel-parser/test/fixtures/experimental/import-meta/no-other-prop-names/options.json @@ -1,5 +1,4 @@ { - "throws": "The only valid meta property for import is import.meta (1:7)", "sourceType": "module", - "plugins": ["dynamicImport", "importMeta"] + "plugins": ["importMeta"] } diff --git a/packages/babel-parser/test/fixtures/experimental/import-meta/no-other-prop-names/output.json b/packages/babel-parser/test/fixtures/experimental/import-meta/no-other-prop-names/output.json new file mode 100644 index 000000000000..9b2370d8c3ec --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/import-meta/no-other-prop-names/output.json @@ -0,0 +1,102 @@ +{ + "type": "File", + "start": 0, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "errors": [ + "SyntaxError: The only valid meta property for import is import.meta (1:7)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "expression": { + "type": "MetaProperty", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "meta": { + "type": "Identifier", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + }, + "identifierName": "import" + }, + "name": "import" + }, + "property": { + "type": "Identifier", + "start": 7, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "notMeta" + }, + "name": "notMeta" + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/import-meta/not-assignable/options.json b/packages/babel-parser/test/fixtures/experimental/import-meta/not-assignable/options.json index 647ad9f65dee..a6638b6528c1 100644 --- a/packages/babel-parser/test/fixtures/experimental/import-meta/not-assignable/options.json +++ b/packages/babel-parser/test/fixtures/experimental/import-meta/not-assignable/options.json @@ -1,5 +1,4 @@ { - "throws": "Invalid left-hand side in assignment expression (1:0)", "sourceType": "module", - "plugins": ["dynamicImport", "importMeta"] + "plugins": ["importMeta"] } diff --git a/packages/babel-parser/test/fixtures/experimental/import-meta/not-assignable/output.json b/packages/babel-parser/test/fixtures/experimental/import-meta/not-assignable/output.json new file mode 100644 index 000000000000..7610536beafc --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/import-meta/not-assignable/output.json @@ -0,0 +1,134 @@ +{ + "type": "File", + "start": 0, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "errors": [ + "SyntaxError: Invalid left-hand side in assignment expression (1:0)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 0, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "operator": "=", + "left": { + "type": "MetaProperty", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "meta": { + "type": "Identifier", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + }, + "identifierName": "import" + }, + "name": "import" + }, + "property": { + "type": "Identifier", + "start": 7, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 11 + }, + "identifierName": "meta" + }, + "name": "meta" + } + }, + "right": { + "type": "BooleanLiteral", + "start": 14, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "value": true + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/import-meta/valid-in-module/options.json b/packages/babel-parser/test/fixtures/experimental/import-meta/valid-in-module/options.json index be1070ffed9d..a6638b6528c1 100644 --- a/packages/babel-parser/test/fixtures/experimental/import-meta/valid-in-module/options.json +++ b/packages/babel-parser/test/fixtures/experimental/import-meta/valid-in-module/options.json @@ -1,4 +1,4 @@ { "sourceType": "module", - "plugins": ["dynamicImport", "importMeta"] + "plugins": ["importMeta"] } diff --git a/packages/babel-parser/test/fixtures/experimental/logical-assignment-operator/qq-equals-no-null-coalesce-plugin/input.js b/packages/babel-parser/test/fixtures/experimental/logical-assignment-operator/qq-equals-no-null-coalesce-plugin/input.js deleted file mode 100644 index dcf876b17411..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/logical-assignment-operator/qq-equals-no-null-coalesce-plugin/input.js +++ /dev/null @@ -1,2 +0,0 @@ -a ??= b; -obj.a ??= b; diff --git a/packages/babel-parser/test/fixtures/experimental/logical-assignment-operator/qq-equals-no-null-coalesce-plugin/options.json b/packages/babel-parser/test/fixtures/experimental/logical-assignment-operator/qq-equals-no-null-coalesce-plugin/options.json deleted file mode 100644 index 3cb238ee4af0..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/logical-assignment-operator/qq-equals-no-null-coalesce-plugin/options.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "plugins": ["logicalAssignment"], - "throws": "This experimental syntax requires enabling the parser plugin: 'nullishCoalescingOperator' (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/logical-assignment-operator/qq-equals-no-plugin/options.json b/packages/babel-parser/test/fixtures/experimental/logical-assignment-operator/qq-equals-no-plugin/options.json index f5e977775daf..64389a45889e 100644 --- a/packages/babel-parser/test/fixtures/experimental/logical-assignment-operator/qq-equals-no-plugin/options.json +++ b/packages/babel-parser/test/fixtures/experimental/logical-assignment-operator/qq-equals-no-plugin/options.json @@ -1,4 +1,3 @@ { - "plugins": ["nullishCoalescingOperator"], "throws": "This experimental syntax requires enabling the parser plugin: 'logicalAssignment' (1:2)" } diff --git a/packages/babel-parser/test/fixtures/experimental/logical-assignment-operator/qq-equals/options.json b/packages/babel-parser/test/fixtures/experimental/logical-assignment-operator/qq-equals/options.json index 6b07062568e2..5041dbb19f81 100644 --- a/packages/babel-parser/test/fixtures/experimental/logical-assignment-operator/qq-equals/options.json +++ b/packages/babel-parser/test/fixtures/experimental/logical-assignment-operator/qq-equals/options.json @@ -1,3 +1,3 @@ { - "plugins": ["logicalAssignment", "nullishCoalescingOperator"] + "plugins": ["logicalAssignment"] } diff --git a/packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/and-nullish/input.js b/packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/and-nullish/input.js deleted file mode 100644 index 2b0c8c8ff80a..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/and-nullish/input.js +++ /dev/null @@ -1 +0,0 @@ -a && b ?? c; diff --git a/packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/and-nullish/options.json b/packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/and-nullish/options.json deleted file mode 100644 index 1bb4736991a4..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/and-nullish/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "plugins": ["nullishCoalescingOperator"] -} diff --git a/packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/and-nullish/output.json b/packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/and-nullish/output.json deleted file mode 100644 index 779d2ccfbcc8..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/and-nullish/output.json +++ /dev/null @@ -1,133 +0,0 @@ -{ - "type": "File", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "program": { - "type": "Program", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "sourceType": "script", - "interpreter": null, - "body": [ - { - "type": "ExpressionStatement", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "expression": { - "type": "LogicalExpression", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "left": { - "type": "LogicalExpression", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "left": { - "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "a" - }, - "name": "a" - }, - "operator": "&&", - "right": { - "type": "Identifier", - "start": 5, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - }, - "identifierName": "b" - }, - "name": "b" - } - }, - "operator": "??", - "right": { - "type": "Identifier", - "start": 10, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "c" - }, - "name": "c" - } - } - } - ], - "directives": [] - } -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/associativity/options.json b/packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/associativity/options.json deleted file mode 100644 index 1bb4736991a4..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/associativity/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "plugins": ["nullishCoalescingOperator"] -} diff --git a/packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/expression/options.json b/packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/expression/options.json deleted file mode 100644 index 1bb4736991a4..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/expression/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "plugins": ["nullishCoalescingOperator"] -} diff --git a/packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/multiline/options.json b/packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/multiline/options.json deleted file mode 100644 index 1bb4736991a4..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/multiline/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "plugins": ["nullishCoalescingOperator"] -} diff --git a/packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/no-plugin-error/input.js b/packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/no-plugin-error/input.js deleted file mode 100644 index ea99cb192c79..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/no-plugin-error/input.js +++ /dev/null @@ -1 +0,0 @@ -foo ?? 1; diff --git a/packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/no-plugin-error/options.json b/packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/no-plugin-error/options.json deleted file mode 100644 index 9ae9a3d8a5d1..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/no-plugin-error/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "This experimental syntax requires enabling the parser plugin: 'nullishCoalescingOperator' (1:4)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/nullish-and/options.json b/packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/nullish-and/options.json deleted file mode 100644 index 1bb4736991a4..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/nullish-and/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "plugins": ["nullishCoalescingOperator"] -} diff --git a/packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/nullish-and/output.json b/packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/nullish-and/output.json deleted file mode 100644 index 2e4c3bf5553f..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/nullish-and/output.json +++ /dev/null @@ -1,133 +0,0 @@ -{ - "type": "File", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "program": { - "type": "Program", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "sourceType": "script", - "interpreter": null, - "body": [ - { - "type": "ExpressionStatement", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "expression": { - "type": "LogicalExpression", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "left": { - "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "a" - }, - "name": "a" - }, - "operator": "??", - "right": { - "type": "LogicalExpression", - "start": 5, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "left": { - "type": "Identifier", - "start": 5, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - }, - "identifierName": "b" - }, - "name": "b" - }, - "operator": "&&", - "right": { - "type": "Identifier", - "start": 10, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "c" - }, - "name": "c" - } - } - } - } - ], - "directives": [] - } -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/nullish-or/input.js b/packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/nullish-or/input.js deleted file mode 100644 index 40ec9c39d17f..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/nullish-or/input.js +++ /dev/null @@ -1 +0,0 @@ -a ?? b || c; diff --git a/packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/nullish-or/options.json b/packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/nullish-or/options.json deleted file mode 100644 index 1bb4736991a4..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/nullish-or/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "plugins": ["nullishCoalescingOperator"] -} diff --git a/packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/nullish-or/output.json b/packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/nullish-or/output.json deleted file mode 100644 index 5ab0fcc1a530..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/nullish-or/output.json +++ /dev/null @@ -1,133 +0,0 @@ -{ - "type": "File", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "program": { - "type": "Program", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "sourceType": "script", - "interpreter": null, - "body": [ - { - "type": "ExpressionStatement", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "expression": { - "type": "LogicalExpression", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "left": { - "type": "LogicalExpression", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "left": { - "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "a" - }, - "name": "a" - }, - "operator": "??", - "right": { - "type": "Identifier", - "start": 5, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - }, - "identifierName": "b" - }, - "name": "b" - } - }, - "operator": "||", - "right": { - "type": "Identifier", - "start": 10, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "c" - }, - "name": "c" - } - } - } - ], - "directives": [] - } -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/or-nullish/input.js b/packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/or-nullish/input.js deleted file mode 100644 index b74eae4c99e2..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/or-nullish/input.js +++ /dev/null @@ -1 +0,0 @@ -a || b ?? c; diff --git a/packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/or-nullish/options.json b/packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/or-nullish/options.json deleted file mode 100644 index 1bb4736991a4..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/or-nullish/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "plugins": ["nullishCoalescingOperator"] -} diff --git a/packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/or-nullish/output.json b/packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/or-nullish/output.json deleted file mode 100644 index 0db4055d3a89..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/or-nullish/output.json +++ /dev/null @@ -1,133 +0,0 @@ -{ - "type": "File", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "program": { - "type": "Program", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "sourceType": "script", - "interpreter": null, - "body": [ - { - "type": "ExpressionStatement", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "expression": { - "type": "LogicalExpression", - "start": 0, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "left": { - "type": "LogicalExpression", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "left": { - "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "a" - }, - "name": "a" - }, - "operator": "||", - "right": { - "type": "Identifier", - "start": 5, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - }, - "identifierName": "b" - }, - "name": "b" - } - }, - "operator": "??", - "right": { - "type": "Identifier", - "start": 10, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "c" - }, - "name": "c" - } - } - } - ], - "directives": [] - } -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/with-pipeline/options.json b/packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/with-pipeline/options.json deleted file mode 100644 index 790c3f234b5c..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/with-pipeline/options.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "plugins": [ - "nullishCoalescingOperator", - ["pipelineOperator", { "proposal": "minimal" }] - ] -} diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-0/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-0/options.json deleted file mode 100644 index 27e4acfa8f65..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-0/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:1)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-0/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-0/output.json new file mode 100644 index 000000000000..bed1899ddc7e --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-0/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start": 0, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:1)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 0, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "extra": { + "rawValue": 1, + "raw": "1_" + }, + "value": 1 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-1/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-1/options.json deleted file mode 100644 index 477511a87822..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-1/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:3)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-1/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-1/output.json new file mode 100644 index 000000000000..c1dac7764035 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-1/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:3)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "extra": { + "rawValue": 11, + "raw": "1_1_" + }, + "value": 11 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-10/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-10/options.json deleted file mode 100644 index a65e1ff322a7..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-10/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:5)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-10/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-10/output.json new file mode 100644 index 000000000000..6839504edf6c --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-10/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:5)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "extra": { + "rawValue": 17, + "raw": "0x1_1_" + }, + "value": 17 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-100/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-100/options.json deleted file mode 100644 index 8cb6bf4866a3..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-100/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:2)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-100/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-100/output.json new file mode 100644 index 000000000000..c7f4877e2059 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-100/output.json @@ -0,0 +1,75 @@ +{ + "type": "File", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 1, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "extra": { + "rawValue": 1, + "raw": "1_", + "parenthesized": true, + "parenStart": 0 + }, + "value": 1 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-101/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-101/options.json deleted file mode 100644 index 91c5decd9c42..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-101/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:4)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-101/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-101/output.json new file mode 100644 index 000000000000..1b343c302559 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-101/output.json @@ -0,0 +1,75 @@ +{ + "type": "File", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:4)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 1, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "extra": { + "rawValue": 11, + "raw": "1_1_", + "parenthesized": true, + "parenStart": 0 + }, + "value": 11 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-102/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-102/options.json deleted file mode 100644 index 91c5decd9c42..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-102/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:4)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-102/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-102/output.json new file mode 100644 index 000000000000..2ab61fd7bb04 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-102/output.json @@ -0,0 +1,76 @@ +{ + "type": "File", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:4)", + "SyntaxError: A numeric separator is only allowed between two digits (1:5)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 1, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "extra": { + "rawValue": 11, + "raw": "1_1__", + "parenthesized": true, + "parenStart": 0 + }, + "value": 11 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-103/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-103/options.json deleted file mode 100644 index 8cb6bf4866a3..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-103/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:2)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-103/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-103/output.json new file mode 100644 index 000000000000..e799ede442c5 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-103/output.json @@ -0,0 +1,76 @@ +{ + "type": "File", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:2)", + "SyntaxError: A numeric separator is only allowed between two digits (1:3)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 1, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "extra": { + "rawValue": 11, + "raw": "1__1", + "parenthesized": true, + "parenStart": 0 + }, + "value": 11 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-104/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-104/options.json deleted file mode 100644 index 91c5decd9c42..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-104/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:4)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-104/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-104/output.json new file mode 100644 index 000000000000..7eef10ad862b --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-104/output.json @@ -0,0 +1,75 @@ +{ + "type": "File", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:4)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 1, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "extra": { + "rawValue": 11.11, + "raw": "1_1_.1_1", + "parenthesized": true, + "parenStart": 0 + }, + "value": 11.11 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-105/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-105/options.json deleted file mode 100644 index a65e1ff322a7..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-105/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:5)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-105/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-105/output.json new file mode 100644 index 000000000000..5a3cc58cada8 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-105/output.json @@ -0,0 +1,75 @@ +{ + "type": "File", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:5)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 1, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "extra": { + "rawValue": 11.11, + "raw": "1_1._1_1", + "parenthesized": true, + "parenStart": 0 + }, + "value": 11.11 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-106/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-106/options.json deleted file mode 100644 index 9c49308645fd..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-106/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:6)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-106/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-106/output.json new file mode 100644 index 000000000000..45e0aecd2129 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-106/output.json @@ -0,0 +1,75 @@ +{ + "type": "File", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:6)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 1, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "extra": { + "rawValue": 111, + "raw": "1_1.1_e1", + "parenthesized": true, + "parenStart": 0 + }, + "value": 111 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-107/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-107/options.json deleted file mode 100644 index 9c49308645fd..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-107/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:6)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-107/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-107/output.json new file mode 100644 index 000000000000..73400bf8fd10 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-107/output.json @@ -0,0 +1,75 @@ +{ + "type": "File", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:6)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 1, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "extra": { + "rawValue": 111, + "raw": "1_1.1_E1", + "parenthesized": true, + "parenStart": 0 + }, + "value": 111 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-108/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-108/options.json deleted file mode 100644 index badcb4c1b655..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-108/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:7)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-108/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-108/output.json new file mode 100644 index 000000000000..6c6aa937ac70 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-108/output.json @@ -0,0 +1,75 @@ +{ + "type": "File", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:7)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 1, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "extra": { + "rawValue": 111, + "raw": "1_1.1e_1", + "parenthesized": true, + "parenStart": 0 + }, + "value": 111 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-109/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-109/options.json deleted file mode 100644 index badcb4c1b655..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-109/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:7)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-109/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-109/output.json new file mode 100644 index 000000000000..a646828811ea --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-109/output.json @@ -0,0 +1,75 @@ +{ + "type": "File", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:7)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 1, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "extra": { + "rawValue": 111, + "raw": "1_1.1E_1", + "parenthesized": true, + "parenStart": 0 + }, + "value": 111 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-11/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-11/options.json deleted file mode 100644 index a65e1ff322a7..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-11/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:5)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-11/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-11/output.json new file mode 100644 index 000000000000..0a1b0a11038e --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-11/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:5)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "extra": { + "rawValue": 161, + "raw": "0xa_1_" + }, + "value": 161 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-110/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-110/options.json deleted file mode 100644 index 9c49308645fd..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-110/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:6)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-110/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-110/output.json new file mode 100644 index 000000000000..34647c6e63c9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-110/output.json @@ -0,0 +1,75 @@ +{ + "type": "File", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:6)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 1, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "extra": { + "rawValue": 17, + "raw": "0x1_1_", + "parenthesized": true, + "parenStart": 0 + }, + "value": 17 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-111/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-111/options.json deleted file mode 100644 index 9c49308645fd..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-111/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:6)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-111/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-111/output.json new file mode 100644 index 000000000000..e33208bf5970 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-111/output.json @@ -0,0 +1,75 @@ +{ + "type": "File", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:6)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 1, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "extra": { + "rawValue": 161, + "raw": "0xa_1_", + "parenthesized": true, + "parenStart": 0 + }, + "value": 161 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-112/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-112/options.json deleted file mode 100644 index 477511a87822..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-112/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:3)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-112/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-112/output.json new file mode 100644 index 000000000000..48e2d915883b --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-112/output.json @@ -0,0 +1,75 @@ +{ + "type": "File", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:3)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 1, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "extra": { + "rawValue": 161, + "raw": "0x_a_1", + "parenthesized": true, + "parenStart": 0 + }, + "value": 161 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-113/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-113/options.json deleted file mode 100644 index 477511a87822..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-113/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:3)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-113/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-113/output.json new file mode 100644 index 000000000000..af714540b44f --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-113/output.json @@ -0,0 +1,77 @@ +{ + "type": "File", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:3)", + "SyntaxError: A numeric separator is only allowed between two digits (1:4)", + "SyntaxError: A numeric separator is only allowed between two digits (1:8)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 1, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "extra": { + "rawValue": 17, + "raw": "0x__1_1_", + "parenthesized": true, + "parenStart": 0 + }, + "value": 17 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-114/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-114/options.json deleted file mode 100644 index 477511a87822..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-114/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:3)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-114/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-114/output.json new file mode 100644 index 000000000000..151f29fb87dc --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-114/output.json @@ -0,0 +1,77 @@ +{ + "type": "File", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:3)", + "SyntaxError: A numeric separator is only allowed between two digits (1:5)", + "SyntaxError: A numeric separator is only allowed between two digits (1:6)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 1, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "extra": { + "rawValue": 17, + "raw": "0x_1__1", + "parenthesized": true, + "parenStart": 0 + }, + "value": 17 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-115/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-115/options.json deleted file mode 100644 index 477511a87822..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-115/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:3)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-115/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-115/output.json new file mode 100644 index 000000000000..3ec08e9eab54 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-115/output.json @@ -0,0 +1,76 @@ +{ + "type": "File", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:3)", + "SyntaxError: A numeric separator is only allowed between two digits (1:7)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 1, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "extra": { + "rawValue": 17, + "raw": "0x_1_1_", + "parenthesized": true, + "parenStart": 0 + }, + "value": 17 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-116/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-116/options.json deleted file mode 100644 index 477511a87822..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-116/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:3)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-116/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-116/output.json new file mode 100644 index 000000000000..b79700fd396f --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-116/output.json @@ -0,0 +1,75 @@ +{ + "type": "File", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:3)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 1, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "extra": { + "rawValue": 9, + "raw": "0o_1_1", + "parenthesized": true, + "parenStart": 0 + }, + "value": 9 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-117/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-117/options.json deleted file mode 100644 index 477511a87822..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-117/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:3)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-117/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-117/output.json new file mode 100644 index 000000000000..c0bcbc71a47a --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-117/output.json @@ -0,0 +1,75 @@ +{ + "type": "File", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:3)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 1, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "extra": { + "rawValue": 9, + "raw": "0o_11", + "parenthesized": true, + "parenStart": 0 + }, + "value": 9 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-118/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-118/options.json deleted file mode 100644 index 477511a87822..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-118/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:3)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-118/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-118/output.json new file mode 100644 index 000000000000..00976d92c50f --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-118/output.json @@ -0,0 +1,76 @@ +{ + "type": "File", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:3)", + "SyntaxError: A numeric separator is only allowed between two digits (1:8)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 1, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "extra": { + "rawValue": 9, + "raw": "0o_01_1_", + "parenthesized": true, + "parenStart": 0 + }, + "value": 9 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-119/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-119/options.json deleted file mode 100644 index 477511a87822..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-119/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:3)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-119/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-119/output.json new file mode 100644 index 000000000000..1858a06292b1 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-119/output.json @@ -0,0 +1,75 @@ +{ + "type": "File", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:3)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 1, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "extra": { + "rawValue": 3, + "raw": "0b_0_1_1", + "parenthesized": true, + "parenStart": 0 + }, + "value": 3 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-12/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-12/options.json deleted file mode 100644 index 8cb6bf4866a3..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-12/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:2)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-12/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-12/output.json new file mode 100644 index 000000000000..a3ac3d5828d0 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-12/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "extra": { + "rawValue": 161, + "raw": "0x_a_1" + }, + "value": 161 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-120/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-120/options.json deleted file mode 100644 index 477511a87822..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-120/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:3)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-120/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-120/output.json new file mode 100644 index 000000000000..0b18241bc1c5 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-120/output.json @@ -0,0 +1,76 @@ +{ + "type": "File", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:3)", + "SyntaxError: A numeric separator is only allowed between two digits (1:8)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 1, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "extra": { + "rawValue": 3, + "raw": "0b_01_1_", + "parenthesized": true, + "parenStart": 0 + }, + "value": 3 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-121/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-121/options.json deleted file mode 100644 index badcb4c1b655..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-121/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:7)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-121/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-121/output.json new file mode 100644 index 000000000000..c478966220d4 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-121/output.json @@ -0,0 +1,75 @@ +{ + "type": "File", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:7)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 1, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "extra": { + "rawValue": 3, + "raw": "0b01_1_", + "parenthesized": true, + "parenStart": 0 + }, + "value": 3 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-122/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-122/options.json deleted file mode 100644 index 9c49308645fd..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-122/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:6)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-122/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-122/output.json new file mode 100644 index 000000000000..3c73b3979a52 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-122/output.json @@ -0,0 +1,75 @@ +{ + "type": "File", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:6)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 1, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "extra": { + "rawValue": 9, + "raw": "0o1_1_", + "parenthesized": true, + "parenStart": 0 + }, + "value": 9 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-123/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-123/options.json deleted file mode 100644 index 477511a87822..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-123/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:3)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-123/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-123/output.json new file mode 100644 index 000000000000..7b4538c88e9c --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-123/output.json @@ -0,0 +1,76 @@ +{ + "type": "File", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:3)", + "SyntaxError: A numeric separator is only allowed between two digits (1:7)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 1, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "extra": { + "rawValue": 9, + "raw": "0o_1_1_", + "parenthesized": true, + "parenStart": 0 + }, + "value": 9 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-124/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-124/options.json deleted file mode 100644 index 8cb6bf4866a3..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-124/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:2)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-124/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-124/output.json new file mode 100644 index 000000000000..55f03701d9db --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-124/output.json @@ -0,0 +1,91 @@ +{ + "type": "File", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "BlockStatement", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 1, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 1, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "extra": { + "rawValue": 1, + "raw": "1_" + }, + "value": 1 + } + } + ], + "directives": [] + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-125/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-125/options.json deleted file mode 100644 index 91c5decd9c42..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-125/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:4)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-125/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-125/output.json new file mode 100644 index 000000000000..4c87cc2b22a7 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-125/output.json @@ -0,0 +1,91 @@ +{ + "type": "File", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:4)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "BlockStatement", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 1, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 1, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "extra": { + "rawValue": 11, + "raw": "1_1_" + }, + "value": 11 + } + } + ], + "directives": [] + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-126/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-126/options.json deleted file mode 100644 index 91c5decd9c42..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-126/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:4)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-126/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-126/output.json new file mode 100644 index 000000000000..65bec6bcbd60 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-126/output.json @@ -0,0 +1,92 @@ +{ + "type": "File", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:4)", + "SyntaxError: A numeric separator is only allowed between two digits (1:5)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "BlockStatement", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 1, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 1, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "extra": { + "rawValue": 11, + "raw": "1_1__" + }, + "value": 11 + } + } + ], + "directives": [] + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-127/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-127/options.json deleted file mode 100644 index 8cb6bf4866a3..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-127/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:2)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-127/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-127/output.json new file mode 100644 index 000000000000..740a870e3ad3 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-127/output.json @@ -0,0 +1,92 @@ +{ + "type": "File", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:2)", + "SyntaxError: A numeric separator is only allowed between two digits (1:3)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "BlockStatement", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 1, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 1, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "extra": { + "rawValue": 11, + "raw": "1__1" + }, + "value": 11 + } + } + ], + "directives": [] + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-128/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-128/options.json deleted file mode 100644 index 91c5decd9c42..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-128/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:4)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-128/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-128/output.json new file mode 100644 index 000000000000..8b3ea170250c --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-128/output.json @@ -0,0 +1,91 @@ +{ + "type": "File", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:4)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "BlockStatement", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 1, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 1, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "extra": { + "rawValue": 11.11, + "raw": "1_1_.1_1" + }, + "value": 11.11 + } + } + ], + "directives": [] + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-129/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-129/options.json deleted file mode 100644 index a65e1ff322a7..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-129/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:5)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-129/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-129/output.json new file mode 100644 index 000000000000..a30df38017e0 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-129/output.json @@ -0,0 +1,91 @@ +{ + "type": "File", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:5)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "BlockStatement", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 1, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 1, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "extra": { + "rawValue": 11.11, + "raw": "1_1._1_1" + }, + "value": 11.11 + } + } + ], + "directives": [] + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-13/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-13/options.json deleted file mode 100644 index 8cb6bf4866a3..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-13/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:2)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-13/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-13/output.json new file mode 100644 index 000000000000..78257d308a98 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-13/output.json @@ -0,0 +1,75 @@ +{ + "type": "File", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:2)", + "SyntaxError: A numeric separator is only allowed between two digits (1:3)", + "SyntaxError: A numeric separator is only allowed between two digits (1:7)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "extra": { + "rawValue": 17, + "raw": "0x__1_1_" + }, + "value": 17 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-130/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-130/options.json deleted file mode 100644 index 9c49308645fd..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-130/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:6)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-130/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-130/output.json new file mode 100644 index 000000000000..a3ea6fad2e5a --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-130/output.json @@ -0,0 +1,91 @@ +{ + "type": "File", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:6)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "BlockStatement", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 1, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 1, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "extra": { + "rawValue": 111, + "raw": "1_1.1_e1" + }, + "value": 111 + } + } + ], + "directives": [] + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-131/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-131/options.json deleted file mode 100644 index 9c49308645fd..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-131/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:6)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-131/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-131/output.json new file mode 100644 index 000000000000..6461d8dba2bd --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-131/output.json @@ -0,0 +1,91 @@ +{ + "type": "File", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:6)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "BlockStatement", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 1, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 1, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "extra": { + "rawValue": 111, + "raw": "1_1.1_E1" + }, + "value": 111 + } + } + ], + "directives": [] + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-132/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-132/options.json deleted file mode 100644 index badcb4c1b655..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-132/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:7)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-132/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-132/output.json new file mode 100644 index 000000000000..d27ae3b4fadf --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-132/output.json @@ -0,0 +1,91 @@ +{ + "type": "File", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:7)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "BlockStatement", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 1, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 1, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "extra": { + "rawValue": 111, + "raw": "1_1.1e_1" + }, + "value": 111 + } + } + ], + "directives": [] + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-133/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-133/options.json deleted file mode 100644 index badcb4c1b655..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-133/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:7)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-133/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-133/output.json new file mode 100644 index 000000000000..ee4395d21f55 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-133/output.json @@ -0,0 +1,91 @@ +{ + "type": "File", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:7)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "BlockStatement", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 1, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 1, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "extra": { + "rawValue": 111, + "raw": "1_1.1E_1" + }, + "value": 111 + } + } + ], + "directives": [] + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-134/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-134/options.json deleted file mode 100644 index 9c49308645fd..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-134/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:6)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-134/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-134/output.json new file mode 100644 index 000000000000..29dc70b2487f --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-134/output.json @@ -0,0 +1,91 @@ +{ + "type": "File", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:6)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "BlockStatement", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 1, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 1, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "extra": { + "rawValue": 17, + "raw": "0x1_1_" + }, + "value": 17 + } + } + ], + "directives": [] + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-135/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-135/options.json deleted file mode 100644 index 9c49308645fd..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-135/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:6)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-135/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-135/output.json new file mode 100644 index 000000000000..f08afb905eac --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-135/output.json @@ -0,0 +1,91 @@ +{ + "type": "File", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:6)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "BlockStatement", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 1, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 1, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "extra": { + "rawValue": 161, + "raw": "0xa_1_" + }, + "value": 161 + } + } + ], + "directives": [] + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-136/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-136/options.json deleted file mode 100644 index 477511a87822..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-136/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:3)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-136/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-136/output.json new file mode 100644 index 000000000000..2507a579d6de --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-136/output.json @@ -0,0 +1,91 @@ +{ + "type": "File", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:3)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "BlockStatement", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 1, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 1, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "extra": { + "rawValue": 161, + "raw": "0x_a_1" + }, + "value": 161 + } + } + ], + "directives": [] + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-137/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-137/options.json deleted file mode 100644 index 477511a87822..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-137/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:3)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-137/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-137/output.json new file mode 100644 index 000000000000..89afd3efde35 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-137/output.json @@ -0,0 +1,93 @@ +{ + "type": "File", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:3)", + "SyntaxError: A numeric separator is only allowed between two digits (1:4)", + "SyntaxError: A numeric separator is only allowed between two digits (1:8)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "BlockStatement", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 1, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 1, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "extra": { + "rawValue": 17, + "raw": "0x__1_1_" + }, + "value": 17 + } + } + ], + "directives": [] + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-138/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-138/options.json deleted file mode 100644 index 477511a87822..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-138/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:3)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-138/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-138/output.json new file mode 100644 index 000000000000..8cad1428818e --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-138/output.json @@ -0,0 +1,93 @@ +{ + "type": "File", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:3)", + "SyntaxError: A numeric separator is only allowed between two digits (1:5)", + "SyntaxError: A numeric separator is only allowed between two digits (1:6)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "BlockStatement", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 1, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 1, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "extra": { + "rawValue": 17, + "raw": "0x_1__1" + }, + "value": 17 + } + } + ], + "directives": [] + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-139/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-139/options.json deleted file mode 100644 index 477511a87822..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-139/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:3)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-139/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-139/output.json new file mode 100644 index 000000000000..9d86aac2191a --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-139/output.json @@ -0,0 +1,92 @@ +{ + "type": "File", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:3)", + "SyntaxError: A numeric separator is only allowed between two digits (1:7)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "BlockStatement", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 1, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 1, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "extra": { + "rawValue": 17, + "raw": "0x_1_1_" + }, + "value": 17 + } + } + ], + "directives": [] + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-14/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-14/options.json deleted file mode 100644 index 8cb6bf4866a3..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-14/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:2)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-14/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-14/output.json new file mode 100644 index 000000000000..477b3c1f3cf4 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-14/output.json @@ -0,0 +1,75 @@ +{ + "type": "File", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:2)", + "SyntaxError: A numeric separator is only allowed between two digits (1:4)", + "SyntaxError: A numeric separator is only allowed between two digits (1:5)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "extra": { + "rawValue": 17, + "raw": "0x_1__1" + }, + "value": 17 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-140/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-140/options.json deleted file mode 100644 index 477511a87822..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-140/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:3)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-140/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-140/output.json new file mode 100644 index 000000000000..73b694a6656c --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-140/output.json @@ -0,0 +1,91 @@ +{ + "type": "File", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:3)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "BlockStatement", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 1, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 1, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "extra": { + "rawValue": 9, + "raw": "0o_1_1" + }, + "value": 9 + } + } + ], + "directives": [] + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-141/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-141/options.json deleted file mode 100644 index 477511a87822..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-141/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:3)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-141/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-141/output.json new file mode 100644 index 000000000000..3e602cf8e35b --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-141/output.json @@ -0,0 +1,91 @@ +{ + "type": "File", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:3)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "BlockStatement", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 1, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 1, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "extra": { + "rawValue": 9, + "raw": "0o_11" + }, + "value": 9 + } + } + ], + "directives": [] + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-142/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-142/options.json deleted file mode 100644 index 477511a87822..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-142/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:3)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-142/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-142/output.json new file mode 100644 index 000000000000..7b96b478be97 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-142/output.json @@ -0,0 +1,92 @@ +{ + "type": "File", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:3)", + "SyntaxError: A numeric separator is only allowed between two digits (1:8)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "BlockStatement", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 1, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 1, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "extra": { + "rawValue": 9, + "raw": "0o_01_1_" + }, + "value": 9 + } + } + ], + "directives": [] + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-143/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-143/options.json deleted file mode 100644 index 477511a87822..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-143/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:3)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-143/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-143/output.json new file mode 100644 index 000000000000..bd3c89e95560 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-143/output.json @@ -0,0 +1,91 @@ +{ + "type": "File", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:3)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "BlockStatement", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 1, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 1, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "extra": { + "rawValue": 3, + "raw": "0b_0_1_1" + }, + "value": 3 + } + } + ], + "directives": [] + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-144/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-144/options.json deleted file mode 100644 index 477511a87822..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-144/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:3)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-144/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-144/output.json new file mode 100644 index 000000000000..df4e4858faae --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-144/output.json @@ -0,0 +1,92 @@ +{ + "type": "File", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:3)", + "SyntaxError: A numeric separator is only allowed between two digits (1:8)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "BlockStatement", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 1, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 1, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "extra": { + "rawValue": 3, + "raw": "0b_01_1_" + }, + "value": 3 + } + } + ], + "directives": [] + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-145/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-145/options.json deleted file mode 100644 index badcb4c1b655..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-145/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:7)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-145/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-145/output.json new file mode 100644 index 000000000000..f9203546d16c --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-145/output.json @@ -0,0 +1,91 @@ +{ + "type": "File", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:7)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "BlockStatement", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 1, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 1, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "extra": { + "rawValue": 3, + "raw": "0b01_1_" + }, + "value": 3 + } + } + ], + "directives": [] + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-146/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-146/options.json deleted file mode 100644 index 9c49308645fd..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-146/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:6)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-146/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-146/output.json new file mode 100644 index 000000000000..3138ed92346a --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-146/output.json @@ -0,0 +1,91 @@ +{ + "type": "File", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:6)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "BlockStatement", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 1, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 1, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "extra": { + "rawValue": 9, + "raw": "0o1_1_" + }, + "value": 9 + } + } + ], + "directives": [] + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-147/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-147/options.json deleted file mode 100644 index 477511a87822..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-147/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:3)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-147/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-147/output.json new file mode 100644 index 000000000000..5cd647c2bf7d --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-147/output.json @@ -0,0 +1,92 @@ +{ + "type": "File", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:3)", + "SyntaxError: A numeric separator is only allowed between two digits (1:7)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "BlockStatement", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 1, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 1, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "extra": { + "rawValue": 9, + "raw": "0o_1_1_" + }, + "value": 9 + } + } + ], + "directives": [] + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-15/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-15/options.json deleted file mode 100644 index 8cb6bf4866a3..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-15/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:2)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-15/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-15/output.json new file mode 100644 index 000000000000..a43596db0e4e --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-15/output.json @@ -0,0 +1,74 @@ +{ + "type": "File", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:2)", + "SyntaxError: A numeric separator is only allowed between two digits (1:6)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "extra": { + "rawValue": 17, + "raw": "0x_1_1_" + }, + "value": 17 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-16/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-16/options.json deleted file mode 100644 index 8cb6bf4866a3..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-16/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:2)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-16/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-16/output.json new file mode 100644 index 000000000000..c6b51546660e --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-16/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "extra": { + "rawValue": 9, + "raw": "0o_1_1" + }, + "value": 9 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-17/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-17/options.json deleted file mode 100644 index 8cb6bf4866a3..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-17/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:2)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-17/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-17/output.json new file mode 100644 index 000000000000..4788bc887407 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-17/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "extra": { + "rawValue": 9, + "raw": "0o_11" + }, + "value": 9 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-18/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-18/options.json deleted file mode 100644 index 8cb6bf4866a3..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-18/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:2)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-18/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-18/output.json new file mode 100644 index 000000000000..e797620a329e --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-18/output.json @@ -0,0 +1,74 @@ +{ + "type": "File", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:2)", + "SyntaxError: A numeric separator is only allowed between two digits (1:7)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "extra": { + "rawValue": 9, + "raw": "0o_01_1_" + }, + "value": 9 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-19/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-19/options.json deleted file mode 100644 index 8cb6bf4866a3..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-19/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:2)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-19/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-19/output.json new file mode 100644 index 000000000000..509fa7be5376 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-19/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "extra": { + "rawValue": 3, + "raw": "0b_0_1_1" + }, + "value": 3 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-2/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-2/options.json deleted file mode 100644 index 477511a87822..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-2/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:3)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-2/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-2/output.json new file mode 100644 index 000000000000..71b523cdc3f5 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-2/output.json @@ -0,0 +1,74 @@ +{ + "type": "File", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:3)", + "SyntaxError: A numeric separator is only allowed between two digits (1:4)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "extra": { + "rawValue": 11, + "raw": "1_1__" + }, + "value": 11 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-20/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-20/options.json deleted file mode 100644 index 8cb6bf4866a3..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-20/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:2)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-20/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-20/output.json new file mode 100644 index 000000000000..386c54cac8e1 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-20/output.json @@ -0,0 +1,74 @@ +{ + "type": "File", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:2)", + "SyntaxError: A numeric separator is only allowed between two digits (1:7)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "extra": { + "rawValue": 3, + "raw": "0b_01_1_" + }, + "value": 3 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-21/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-21/options.json deleted file mode 100644 index 9c49308645fd..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-21/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:6)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-21/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-21/output.json new file mode 100644 index 000000000000..99329263441c --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-21/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:6)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "extra": { + "rawValue": 3, + "raw": "0b01_1_" + }, + "value": 3 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-22/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-22/options.json deleted file mode 100644 index a65e1ff322a7..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-22/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:5)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-22/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-22/output.json new file mode 100644 index 000000000000..031ce3f9fcf2 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-22/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:5)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "extra": { + "rawValue": 9, + "raw": "0o1_1_" + }, + "value": 9 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-23/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-23/options.json deleted file mode 100644 index 8cb6bf4866a3..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-23/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:2)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-23/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-23/output.json new file mode 100644 index 000000000000..cf60b4557bd1 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-23/output.json @@ -0,0 +1,74 @@ +{ + "type": "File", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:2)", + "SyntaxError: A numeric separator is only allowed between two digits (1:6)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "extra": { + "rawValue": 9, + "raw": "0o_1_1_" + }, + "value": 9 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-25/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-25/options.json deleted file mode 100644 index 91c5decd9c42..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-25/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:4)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-25/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-25/output.json new file mode 100644 index 000000000000..0de8505e1170 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-25/output.json @@ -0,0 +1,74 @@ +{ + "type": "File", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:4)", + "SyntaxError: Expected number in radix 8 (1:5)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "extra": { + "rawValue": 8, + "raw": "0o01_8" + }, + "value": 8 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-26/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-26/options.json deleted file mode 100644 index 7f37dbb4686b..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-26/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Expected number in radix 2 (1:2)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-26/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-26/output.json new file mode 100644 index 000000000000..ab45a08cb897 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-26/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "errors": [ + "SyntaxError: Expected number in radix 2 (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "extra": { + "rawValue": 1, + "raw": "0b2_1" + }, + "value": 1 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-27/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-27/options.json index fab06a453d2f..ee18527964e7 100644 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-27/options.json +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-27/options.json @@ -1 +1,3 @@ -{ "throws": "Expected number in radix 16 (1:2)" } +{ + "throws": "Identifier directly after number (1:2)" +} diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-28/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-28/options.json deleted file mode 100644 index 27e4acfa8f65..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-28/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:1)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-28/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-28/output.json new file mode 100644 index 000000000000..22352b5f300f --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-28/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:1)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 0, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "extra": { + "rawValue": 1, + "raw": "1_" + }, + "value": 1 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-29/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-29/options.json deleted file mode 100644 index 477511a87822..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-29/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:3)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-29/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-29/output.json new file mode 100644 index 000000000000..109e14677751 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-29/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:3)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "extra": { + "rawValue": 11, + "raw": "1_1_" + }, + "value": 11 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-3/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-3/options.json deleted file mode 100644 index 27e4acfa8f65..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-3/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:1)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-3/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-3/output.json new file mode 100644 index 000000000000..39f6afe910ec --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-3/output.json @@ -0,0 +1,74 @@ +{ + "type": "File", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:1)", + "SyntaxError: A numeric separator is only allowed between two digits (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "extra": { + "rawValue": 11, + "raw": "1__1" + }, + "value": 11 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-30/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-30/options.json deleted file mode 100644 index 477511a87822..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-30/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:3)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-30/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-30/output.json new file mode 100644 index 000000000000..422bdd6c6384 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-30/output.json @@ -0,0 +1,74 @@ +{ + "type": "File", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:3)", + "SyntaxError: A numeric separator is only allowed between two digits (1:4)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "extra": { + "rawValue": 11, + "raw": "1_1__" + }, + "value": 11 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-31/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-31/options.json deleted file mode 100644 index 27e4acfa8f65..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-31/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:1)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-31/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-31/output.json new file mode 100644 index 000000000000..4cf178b2082e --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-31/output.json @@ -0,0 +1,74 @@ +{ + "type": "File", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:1)", + "SyntaxError: A numeric separator is only allowed between two digits (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "extra": { + "rawValue": 11, + "raw": "1__1" + }, + "value": 11 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-32/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-32/options.json deleted file mode 100644 index 477511a87822..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-32/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:3)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-32/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-32/output.json new file mode 100644 index 000000000000..3ac121a5eece --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-32/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:3)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "extra": { + "rawValue": 11.11, + "raw": "1_1_.1_1" + }, + "value": 11.11 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-33/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-33/options.json deleted file mode 100644 index 91c5decd9c42..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-33/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:4)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-33/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-33/output.json new file mode 100644 index 000000000000..4e344f6fd3bf --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-33/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:4)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "extra": { + "rawValue": 11.11, + "raw": "1_1._1_1" + }, + "value": 11.11 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-34/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-34/options.json deleted file mode 100644 index a65e1ff322a7..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-34/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:5)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-34/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-34/output.json new file mode 100644 index 000000000000..d8a2a2deda67 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-34/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:5)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "extra": { + "rawValue": 111, + "raw": "1_1.1_e1" + }, + "value": 111 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-35/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-35/options.json deleted file mode 100644 index a65e1ff322a7..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-35/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:5)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-35/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-35/output.json new file mode 100644 index 000000000000..0b63b9681805 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-35/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:5)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "extra": { + "rawValue": 111, + "raw": "1_1.1_E1" + }, + "value": 111 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-36/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-36/options.json deleted file mode 100644 index 9c49308645fd..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-36/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:6)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-36/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-36/output.json new file mode 100644 index 000000000000..6a9efc69296c --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-36/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:6)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "extra": { + "rawValue": 111, + "raw": "1_1.1e_1" + }, + "value": 111 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-37/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-37/options.json deleted file mode 100644 index 9c49308645fd..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-37/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:6)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-37/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-37/output.json new file mode 100644 index 000000000000..f68c59283508 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-37/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:6)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "extra": { + "rawValue": 111, + "raw": "1_1.1E_1" + }, + "value": 111 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-38/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-38/options.json deleted file mode 100644 index a65e1ff322a7..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-38/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:5)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-38/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-38/output.json new file mode 100644 index 000000000000..0c35b0296649 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-38/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:5)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "extra": { + "rawValue": 17, + "raw": "0x1_1_" + }, + "value": 17 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-39/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-39/options.json deleted file mode 100644 index a65e1ff322a7..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-39/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:5)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-39/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-39/output.json new file mode 100644 index 000000000000..8076713df223 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-39/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:5)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "extra": { + "rawValue": 161, + "raw": "0xa_1_" + }, + "value": 161 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-4/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-4/options.json deleted file mode 100644 index 477511a87822..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-4/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:3)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-4/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-4/output.json new file mode 100644 index 000000000000..ad70ca6fc270 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-4/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:3)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "extra": { + "rawValue": 11.11, + "raw": "1_1_.1_1" + }, + "value": 11.11 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-40/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-40/options.json deleted file mode 100644 index 8cb6bf4866a3..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-40/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:2)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-40/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-40/output.json new file mode 100644 index 000000000000..31bfeccc15a7 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-40/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "extra": { + "rawValue": 161, + "raw": "0x_a_1" + }, + "value": 161 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-41/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-41/options.json deleted file mode 100644 index 8cb6bf4866a3..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-41/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:2)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-41/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-41/output.json new file mode 100644 index 000000000000..ca8eaf7c7c31 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-41/output.json @@ -0,0 +1,75 @@ +{ + "type": "File", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:2)", + "SyntaxError: A numeric separator is only allowed between two digits (1:3)", + "SyntaxError: A numeric separator is only allowed between two digits (1:7)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "extra": { + "rawValue": 17, + "raw": "0x__1_1_" + }, + "value": 17 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-42/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-42/options.json deleted file mode 100644 index 8cb6bf4866a3..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-42/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:2)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-42/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-42/output.json new file mode 100644 index 000000000000..689560a3bb3c --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-42/output.json @@ -0,0 +1,75 @@ +{ + "type": "File", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:2)", + "SyntaxError: A numeric separator is only allowed between two digits (1:4)", + "SyntaxError: A numeric separator is only allowed between two digits (1:5)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "extra": { + "rawValue": 17, + "raw": "0x_1__1" + }, + "value": 17 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-43/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-43/options.json deleted file mode 100644 index 8cb6bf4866a3..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-43/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:2)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-43/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-43/output.json new file mode 100644 index 000000000000..b92b88fa4a19 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-43/output.json @@ -0,0 +1,74 @@ +{ + "type": "File", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:2)", + "SyntaxError: A numeric separator is only allowed between two digits (1:6)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "extra": { + "rawValue": 17, + "raw": "0x_1_1_" + }, + "value": 17 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-44/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-44/options.json deleted file mode 100644 index 8cb6bf4866a3..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-44/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:2)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-44/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-44/output.json new file mode 100644 index 000000000000..9487edc545b8 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-44/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "extra": { + "rawValue": 9, + "raw": "0o_1_1" + }, + "value": 9 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-45/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-45/options.json deleted file mode 100644 index 8cb6bf4866a3..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-45/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:2)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-45/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-45/output.json new file mode 100644 index 000000000000..1c39ba7a1d72 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-45/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "extra": { + "rawValue": 9, + "raw": "0o_11" + }, + "value": 9 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-46/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-46/options.json deleted file mode 100644 index 8cb6bf4866a3..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-46/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:2)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-46/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-46/output.json new file mode 100644 index 000000000000..2890e46ca71d --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-46/output.json @@ -0,0 +1,74 @@ +{ + "type": "File", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:2)", + "SyntaxError: A numeric separator is only allowed between two digits (1:7)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "extra": { + "rawValue": 9, + "raw": "0o_01_1_" + }, + "value": 9 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-47/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-47/options.json deleted file mode 100644 index 8cb6bf4866a3..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-47/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:2)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-47/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-47/output.json new file mode 100644 index 000000000000..6de8c77bf903 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-47/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "extra": { + "rawValue": 3, + "raw": "0b_0_1_1" + }, + "value": 3 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-48/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-48/options.json deleted file mode 100644 index 8cb6bf4866a3..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-48/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:2)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-48/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-48/output.json new file mode 100644 index 000000000000..ae93a109760c --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-48/output.json @@ -0,0 +1,74 @@ +{ + "type": "File", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:2)", + "SyntaxError: A numeric separator is only allowed between two digits (1:7)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "extra": { + "rawValue": 3, + "raw": "0b_01_1_" + }, + "value": 3 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-49/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-49/options.json deleted file mode 100644 index 9c49308645fd..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-49/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:6)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-49/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-49/output.json new file mode 100644 index 000000000000..fdede7a21ac0 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-49/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:6)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "extra": { + "rawValue": 3, + "raw": "0b01_1_" + }, + "value": 3 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-5/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-5/options.json deleted file mode 100644 index 91c5decd9c42..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-5/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:4)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-5/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-5/output.json new file mode 100644 index 000000000000..ae808dbc99cf --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-5/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:4)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "extra": { + "rawValue": 11.11, + "raw": "1_1._1_1" + }, + "value": 11.11 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-50/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-50/options.json deleted file mode 100644 index a65e1ff322a7..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-50/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:5)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-50/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-50/output.json new file mode 100644 index 000000000000..784d1a34983e --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-50/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:5)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "extra": { + "rawValue": 9, + "raw": "0o1_1_" + }, + "value": 9 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-51/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-51/options.json deleted file mode 100644 index 8cb6bf4866a3..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-51/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:2)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-51/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-51/output.json new file mode 100644 index 000000000000..678bccf4fa1e --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-51/output.json @@ -0,0 +1,74 @@ +{ + "type": "File", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:2)", + "SyntaxError: A numeric separator is only allowed between two digits (1:6)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "extra": { + "rawValue": 9, + "raw": "0o_1_1_" + }, + "value": 9 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-52/input.js b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-52/input.js index b6b4f448099d..475f52e0eb50 100644 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-52/input.js +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-52/input.js @@ -1 +1 @@ -1_, +1_, 0 diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-52/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-52/options.json deleted file mode 100644 index 27e4acfa8f65..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-52/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:1)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-52/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-52/output.json new file mode 100644 index 000000000000..2c53bf532cbd --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-52/output.json @@ -0,0 +1,110 @@ +{ + "type": "File", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:1)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "expression": { + "type": "SequenceExpression", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "expressions": [ + { + "type": "NumericLiteral", + "start": 0, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "extra": { + "rawValue": 1, + "raw": "1_" + }, + "value": 1 + }, + { + "type": "NumericLiteral", + "start": 4, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-53/input.js b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-53/input.js index 4b8047ea34a5..ce3480ab5810 100644 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-53/input.js +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-53/input.js @@ -1 +1 @@ -1_1_, +1_1_, 0 diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-53/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-53/options.json deleted file mode 100644 index 477511a87822..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-53/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:3)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-53/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-53/output.json new file mode 100644 index 000000000000..f3956eac0884 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-53/output.json @@ -0,0 +1,110 @@ +{ + "type": "File", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:3)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "expression": { + "type": "SequenceExpression", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "expressions": [ + { + "type": "NumericLiteral", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "extra": { + "rawValue": 11, + "raw": "1_1_" + }, + "value": 11 + }, + { + "type": "NumericLiteral", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-54/input.js b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-54/input.js index cac8642d14e7..be4906c68d09 100644 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-54/input.js +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-54/input.js @@ -1 +1 @@ -1_1__, +1_1__, 0 diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-54/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-54/options.json deleted file mode 100644 index 477511a87822..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-54/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:3)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-54/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-54/output.json new file mode 100644 index 000000000000..fa8e18cac1a1 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-54/output.json @@ -0,0 +1,111 @@ +{ + "type": "File", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:3)", + "SyntaxError: A numeric separator is only allowed between two digits (1:4)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "expression": { + "type": "SequenceExpression", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "expressions": [ + { + "type": "NumericLiteral", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "extra": { + "rawValue": 11, + "raw": "1_1__" + }, + "value": 11 + }, + { + "type": "NumericLiteral", + "start": 7, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-55/input.js b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-55/input.js index a9051bb2db71..10191f1bd355 100644 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-55/input.js +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-55/input.js @@ -1 +1 @@ -1__1, +1__1, 0 diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-55/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-55/options.json deleted file mode 100644 index 27e4acfa8f65..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-55/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:1)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-55/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-55/output.json new file mode 100644 index 000000000000..d2ac83f6572e --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-55/output.json @@ -0,0 +1,111 @@ +{ + "type": "File", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:1)", + "SyntaxError: A numeric separator is only allowed between two digits (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "expression": { + "type": "SequenceExpression", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "expressions": [ + { + "type": "NumericLiteral", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "extra": { + "rawValue": 11, + "raw": "1__1" + }, + "value": 11 + }, + { + "type": "NumericLiteral", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-56/input.js b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-56/input.js index 7213755d0f38..be9c6e14d226 100644 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-56/input.js +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-56/input.js @@ -1 +1 @@ -1_1_.1_1, +1_1_.1_1, 0 diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-56/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-56/options.json deleted file mode 100644 index 477511a87822..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-56/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:3)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-56/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-56/output.json new file mode 100644 index 000000000000..154d9a6f4641 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-56/output.json @@ -0,0 +1,110 @@ +{ + "type": "File", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:3)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "expression": { + "type": "SequenceExpression", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "expressions": [ + { + "type": "NumericLiteral", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "extra": { + "rawValue": 11.11, + "raw": "1_1_.1_1" + }, + "value": 11.11 + }, + { + "type": "NumericLiteral", + "start": 10, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-57/input.js b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-57/input.js index db8717756d2a..e2a13541725e 100644 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-57/input.js +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-57/input.js @@ -1 +1 @@ -1_1._1_1, +1_1._1_1, 0 diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-57/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-57/options.json deleted file mode 100644 index 91c5decd9c42..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-57/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:4)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-57/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-57/output.json new file mode 100644 index 000000000000..6e462c0e07d4 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-57/output.json @@ -0,0 +1,110 @@ +{ + "type": "File", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:4)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "expression": { + "type": "SequenceExpression", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "expressions": [ + { + "type": "NumericLiteral", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "extra": { + "rawValue": 11.11, + "raw": "1_1._1_1" + }, + "value": 11.11 + }, + { + "type": "NumericLiteral", + "start": 10, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-58/input.js b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-58/input.js index 5e5e356da976..49539d8e1686 100644 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-58/input.js +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-58/input.js @@ -1 +1 @@ -1_1.1_e1, +1_1.1_e1, 0 diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-58/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-58/options.json deleted file mode 100644 index a65e1ff322a7..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-58/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:5)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-58/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-58/output.json new file mode 100644 index 000000000000..95a795d633b6 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-58/output.json @@ -0,0 +1,110 @@ +{ + "type": "File", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:5)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "expression": { + "type": "SequenceExpression", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "expressions": [ + { + "type": "NumericLiteral", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "extra": { + "rawValue": 111, + "raw": "1_1.1_e1" + }, + "value": 111 + }, + { + "type": "NumericLiteral", + "start": 10, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-59/input.js b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-59/input.js index b07556e6d95e..b06fd2edbbc4 100644 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-59/input.js +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-59/input.js @@ -1 +1 @@ -1_1.1_E1, +1_1.1_E1, 0 diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-59/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-59/options.json deleted file mode 100644 index a65e1ff322a7..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-59/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:5)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-59/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-59/output.json new file mode 100644 index 000000000000..51953305e0c8 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-59/output.json @@ -0,0 +1,110 @@ +{ + "type": "File", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:5)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "expression": { + "type": "SequenceExpression", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "expressions": [ + { + "type": "NumericLiteral", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "extra": { + "rawValue": 111, + "raw": "1_1.1_E1" + }, + "value": 111 + }, + { + "type": "NumericLiteral", + "start": 10, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-6/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-6/options.json deleted file mode 100644 index a65e1ff322a7..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-6/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:5)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-6/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-6/output.json new file mode 100644 index 000000000000..d0b1538b39dc --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-6/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:5)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "extra": { + "rawValue": 111, + "raw": "1_1.1_e1" + }, + "value": 111 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-60/input.js b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-60/input.js index 0186dfaccb82..61f6290af574 100644 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-60/input.js +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-60/input.js @@ -1 +1 @@ -1_1.1e_1, +1_1.1e_1, 0 diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-60/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-60/options.json deleted file mode 100644 index 9c49308645fd..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-60/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:6)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-60/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-60/output.json new file mode 100644 index 000000000000..a394466973f3 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-60/output.json @@ -0,0 +1,110 @@ +{ + "type": "File", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:6)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "expression": { + "type": "SequenceExpression", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "expressions": [ + { + "type": "NumericLiteral", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "extra": { + "rawValue": 111, + "raw": "1_1.1e_1" + }, + "value": 111 + }, + { + "type": "NumericLiteral", + "start": 10, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-61/input.js b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-61/input.js index 85594dea3099..026cf8e40d3a 100644 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-61/input.js +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-61/input.js @@ -1 +1 @@ -1_1.1E_1, +1_1.1E_1, 0 diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-61/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-61/options.json deleted file mode 100644 index 9c49308645fd..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-61/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:6)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-61/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-61/output.json new file mode 100644 index 000000000000..36605277710f --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-61/output.json @@ -0,0 +1,110 @@ +{ + "type": "File", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:6)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "expression": { + "type": "SequenceExpression", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "expressions": [ + { + "type": "NumericLiteral", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "extra": { + "rawValue": 111, + "raw": "1_1.1E_1" + }, + "value": 111 + }, + { + "type": "NumericLiteral", + "start": 10, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-62/input.js b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-62/input.js index e0ed0c98f626..b34d9ea95a4d 100644 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-62/input.js +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-62/input.js @@ -1 +1 @@ -0x1_1_, +0x1_1_, 0 diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-62/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-62/options.json deleted file mode 100644 index a65e1ff322a7..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-62/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:5)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-62/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-62/output.json new file mode 100644 index 000000000000..347125ca2b1d --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-62/output.json @@ -0,0 +1,110 @@ +{ + "type": "File", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:5)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "expression": { + "type": "SequenceExpression", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "expressions": [ + { + "type": "NumericLiteral", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "extra": { + "rawValue": 17, + "raw": "0x1_1_" + }, + "value": 17 + }, + { + "type": "NumericLiteral", + "start": 8, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-63/input.js b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-63/input.js index d1b793f8dfed..28a917a7aca3 100644 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-63/input.js +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-63/input.js @@ -1 +1 @@ -0xa_1_, +0xa_1_, 0 diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-63/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-63/options.json deleted file mode 100644 index a65e1ff322a7..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-63/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:5)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-63/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-63/output.json new file mode 100644 index 000000000000..ac06aae7f847 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-63/output.json @@ -0,0 +1,110 @@ +{ + "type": "File", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:5)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "expression": { + "type": "SequenceExpression", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "expressions": [ + { + "type": "NumericLiteral", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "extra": { + "rawValue": 161, + "raw": "0xa_1_" + }, + "value": 161 + }, + { + "type": "NumericLiteral", + "start": 8, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-64/input.js b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-64/input.js index e5543066d000..8e1c3c4399a1 100644 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-64/input.js +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-64/input.js @@ -1 +1 @@ -0x_a_1, +0x_a_1, 0 diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-64/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-64/options.json deleted file mode 100644 index 8cb6bf4866a3..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-64/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:2)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-64/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-64/output.json new file mode 100644 index 000000000000..a70fc4a0fa0f --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-64/output.json @@ -0,0 +1,110 @@ +{ + "type": "File", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "expression": { + "type": "SequenceExpression", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "expressions": [ + { + "type": "NumericLiteral", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "extra": { + "rawValue": 161, + "raw": "0x_a_1" + }, + "value": 161 + }, + { + "type": "NumericLiteral", + "start": 8, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-65/input.js b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-65/input.js index 68e6a0d63fea..d8039a473eb0 100644 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-65/input.js +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-65/input.js @@ -1 +1 @@ -0x__1_1_, +0x__1_1_, 0 diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-65/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-65/options.json deleted file mode 100644 index 8cb6bf4866a3..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-65/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:2)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-65/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-65/output.json new file mode 100644 index 000000000000..b75b68e18c5f --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-65/output.json @@ -0,0 +1,112 @@ +{ + "type": "File", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:2)", + "SyntaxError: A numeric separator is only allowed between two digits (1:3)", + "SyntaxError: A numeric separator is only allowed between two digits (1:7)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "expression": { + "type": "SequenceExpression", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "expressions": [ + { + "type": "NumericLiteral", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "extra": { + "rawValue": 17, + "raw": "0x__1_1_" + }, + "value": 17 + }, + { + "type": "NumericLiteral", + "start": 10, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-66/input.js b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-66/input.js index fd959c9609a9..3853dd5ba743 100644 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-66/input.js +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-66/input.js @@ -1 +1 @@ -0x_1__1, +0x_1__1, 0 diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-66/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-66/options.json deleted file mode 100644 index 8cb6bf4866a3..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-66/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:2)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-66/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-66/output.json new file mode 100644 index 000000000000..7ddf567a2967 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-66/output.json @@ -0,0 +1,112 @@ +{ + "type": "File", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:2)", + "SyntaxError: A numeric separator is only allowed between two digits (1:4)", + "SyntaxError: A numeric separator is only allowed between two digits (1:5)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "expression": { + "type": "SequenceExpression", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "expressions": [ + { + "type": "NumericLiteral", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "extra": { + "rawValue": 17, + "raw": "0x_1__1" + }, + "value": 17 + }, + { + "type": "NumericLiteral", + "start": 9, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-67/input.js b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-67/input.js index dc2301a00ea7..90213eb4c896 100644 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-67/input.js +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-67/input.js @@ -1 +1 @@ -0x_1_1_, +0x_1_1_, 0 diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-67/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-67/options.json deleted file mode 100644 index 8cb6bf4866a3..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-67/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:2)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-67/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-67/output.json new file mode 100644 index 000000000000..849bdb6de9a8 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-67/output.json @@ -0,0 +1,111 @@ +{ + "type": "File", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:2)", + "SyntaxError: A numeric separator is only allowed between two digits (1:6)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "expression": { + "type": "SequenceExpression", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "expressions": [ + { + "type": "NumericLiteral", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "extra": { + "rawValue": 17, + "raw": "0x_1_1_" + }, + "value": 17 + }, + { + "type": "NumericLiteral", + "start": 9, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-68/input.js b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-68/input.js index 3a7f53b8dc81..56f62d261b65 100644 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-68/input.js +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-68/input.js @@ -1 +1 @@ -0o_1_1, +0o_1_1, 0 diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-68/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-68/options.json deleted file mode 100644 index 8cb6bf4866a3..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-68/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:2)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-68/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-68/output.json new file mode 100644 index 000000000000..112bef72c91a --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-68/output.json @@ -0,0 +1,110 @@ +{ + "type": "File", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "expression": { + "type": "SequenceExpression", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "expressions": [ + { + "type": "NumericLiteral", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "extra": { + "rawValue": 9, + "raw": "0o_1_1" + }, + "value": 9 + }, + { + "type": "NumericLiteral", + "start": 8, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-69/input.js b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-69/input.js index ed870aa937cd..fe56d1a3c36d 100644 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-69/input.js +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-69/input.js @@ -1 +1 @@ -0o_11, +0o_11, 0 diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-69/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-69/options.json deleted file mode 100644 index 8cb6bf4866a3..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-69/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:2)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-69/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-69/output.json new file mode 100644 index 000000000000..e702d612d243 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-69/output.json @@ -0,0 +1,110 @@ +{ + "type": "File", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "expression": { + "type": "SequenceExpression", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "expressions": [ + { + "type": "NumericLiteral", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "extra": { + "rawValue": 9, + "raw": "0o_11" + }, + "value": 9 + }, + { + "type": "NumericLiteral", + "start": 7, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-7/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-7/options.json deleted file mode 100644 index a65e1ff322a7..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-7/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:5)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-7/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-7/output.json new file mode 100644 index 000000000000..13d9caf030b8 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-7/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:5)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "extra": { + "rawValue": 111, + "raw": "1_1.1_E1" + }, + "value": 111 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-70/input.js b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-70/input.js index e9fcb15ff998..d395282140ef 100644 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-70/input.js +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-70/input.js @@ -1 +1 @@ -0o_01_1_, +0o_01_1_, 0 diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-70/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-70/options.json deleted file mode 100644 index 8cb6bf4866a3..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-70/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:2)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-70/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-70/output.json new file mode 100644 index 000000000000..5f86cf161b9a --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-70/output.json @@ -0,0 +1,111 @@ +{ + "type": "File", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:2)", + "SyntaxError: A numeric separator is only allowed between two digits (1:7)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "expression": { + "type": "SequenceExpression", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "expressions": [ + { + "type": "NumericLiteral", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "extra": { + "rawValue": 9, + "raw": "0o_01_1_" + }, + "value": 9 + }, + { + "type": "NumericLiteral", + "start": 10, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-71/input.js b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-71/input.js index 86cc54d9ed2d..4f5cb5c1e06b 100644 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-71/input.js +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-71/input.js @@ -1 +1 @@ -0b_0_1_1, +0b_0_1_1, 0 diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-71/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-71/options.json deleted file mode 100644 index 8cb6bf4866a3..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-71/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:2)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-71/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-71/output.json new file mode 100644 index 000000000000..5ce3d7e5f1db --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-71/output.json @@ -0,0 +1,110 @@ +{ + "type": "File", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "expression": { + "type": "SequenceExpression", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "expressions": [ + { + "type": "NumericLiteral", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "extra": { + "rawValue": 3, + "raw": "0b_0_1_1" + }, + "value": 3 + }, + { + "type": "NumericLiteral", + "start": 10, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-72/input.js b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-72/input.js index 0c52a13346c0..1589fddd67c3 100644 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-72/input.js +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-72/input.js @@ -1 +1 @@ -0b_01_1_, +0b_01_1_, 0 diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-72/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-72/options.json deleted file mode 100644 index 8cb6bf4866a3..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-72/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:2)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-72/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-72/output.json new file mode 100644 index 000000000000..3364a2a11b7b --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-72/output.json @@ -0,0 +1,111 @@ +{ + "type": "File", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:2)", + "SyntaxError: A numeric separator is only allowed between two digits (1:7)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "expression": { + "type": "SequenceExpression", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "expressions": [ + { + "type": "NumericLiteral", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "extra": { + "rawValue": 3, + "raw": "0b_01_1_" + }, + "value": 3 + }, + { + "type": "NumericLiteral", + "start": 10, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-73/input.js b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-73/input.js index 95c45fd025be..c730763e66fa 100644 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-73/input.js +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-73/input.js @@ -1 +1 @@ -0b01_1_, +0b01_1_, 0 diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-73/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-73/options.json deleted file mode 100644 index 9c49308645fd..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-73/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:6)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-73/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-73/output.json new file mode 100644 index 000000000000..77046a4ee17f --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-73/output.json @@ -0,0 +1,110 @@ +{ + "type": "File", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:6)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "expression": { + "type": "SequenceExpression", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "expressions": [ + { + "type": "NumericLiteral", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "extra": { + "rawValue": 3, + "raw": "0b01_1_" + }, + "value": 3 + }, + { + "type": "NumericLiteral", + "start": 9, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-74/input.js b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-74/input.js index 58ff35dd6c36..3a3aa0484726 100644 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-74/input.js +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-74/input.js @@ -1 +1 @@ -0o1_1_, +0o1_1_, 0 diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-74/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-74/options.json deleted file mode 100644 index a65e1ff322a7..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-74/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:5)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-74/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-74/output.json new file mode 100644 index 000000000000..fdc0933003a0 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-74/output.json @@ -0,0 +1,110 @@ +{ + "type": "File", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:5)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "expression": { + "type": "SequenceExpression", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "expressions": [ + { + "type": "NumericLiteral", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "extra": { + "rawValue": 9, + "raw": "0o1_1_" + }, + "value": 9 + }, + { + "type": "NumericLiteral", + "start": 8, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-75/input.js b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-75/input.js index bd44d425a6fa..a4d36757d478 100644 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-75/input.js +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-75/input.js @@ -1 +1 @@ -0o_1_1_, +0o_1_1_, 0 diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-75/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-75/options.json deleted file mode 100644 index 8cb6bf4866a3..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-75/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:2)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-75/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-75/output.json new file mode 100644 index 000000000000..7f14d41f530d --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-75/output.json @@ -0,0 +1,111 @@ +{ + "type": "File", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:2)", + "SyntaxError: A numeric separator is only allowed between two digits (1:6)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "expression": { + "type": "SequenceExpression", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "expressions": [ + { + "type": "NumericLiteral", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "extra": { + "rawValue": 9, + "raw": "0o_1_1_" + }, + "value": 9 + }, + { + "type": "NumericLiteral", + "start": 9, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-76/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-76/options.json deleted file mode 100644 index 8cb6bf4866a3..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-76/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:2)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-76/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-76/output.json new file mode 100644 index 000000000000..f505cbb81666 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-76/output.json @@ -0,0 +1,90 @@ +{ + "type": "File", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "expression": { + "type": "ArrayExpression", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "elements": [ + { + "type": "NumericLiteral", + "start": 1, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "extra": { + "rawValue": 1, + "raw": "1_" + }, + "value": 1 + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-77/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-77/options.json deleted file mode 100644 index 91c5decd9c42..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-77/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:4)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-77/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-77/output.json new file mode 100644 index 000000000000..2648664f298c --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-77/output.json @@ -0,0 +1,90 @@ +{ + "type": "File", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:4)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "expression": { + "type": "ArrayExpression", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "elements": [ + { + "type": "NumericLiteral", + "start": 1, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "extra": { + "rawValue": 11, + "raw": "1_1_" + }, + "value": 11 + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-78/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-78/options.json deleted file mode 100644 index 91c5decd9c42..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-78/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:4)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-78/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-78/output.json new file mode 100644 index 000000000000..a270c2420610 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-78/output.json @@ -0,0 +1,91 @@ +{ + "type": "File", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:4)", + "SyntaxError: A numeric separator is only allowed between two digits (1:5)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "expression": { + "type": "ArrayExpression", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "elements": [ + { + "type": "NumericLiteral", + "start": 1, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "extra": { + "rawValue": 11, + "raw": "1_1__" + }, + "value": 11 + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-79/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-79/options.json deleted file mode 100644 index 8cb6bf4866a3..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-79/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:2)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-79/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-79/output.json new file mode 100644 index 000000000000..650a98a4cbff --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-79/output.json @@ -0,0 +1,91 @@ +{ + "type": "File", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:2)", + "SyntaxError: A numeric separator is only allowed between two digits (1:3)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "expression": { + "type": "ArrayExpression", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "elements": [ + { + "type": "NumericLiteral", + "start": 1, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "extra": { + "rawValue": 11, + "raw": "1__1" + }, + "value": 11 + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-8/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-8/options.json deleted file mode 100644 index 9c49308645fd..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-8/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:6)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-8/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-8/output.json new file mode 100644 index 000000000000..037c60cbef6f --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-8/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:6)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "extra": { + "rawValue": 111, + "raw": "1_1.1e_1" + }, + "value": 111 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-80/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-80/options.json deleted file mode 100644 index 91c5decd9c42..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-80/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:4)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-80/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-80/output.json new file mode 100644 index 000000000000..1410809bebec --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-80/output.json @@ -0,0 +1,90 @@ +{ + "type": "File", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:4)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "expression": { + "type": "ArrayExpression", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "elements": [ + { + "type": "NumericLiteral", + "start": 1, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "extra": { + "rawValue": 11.11, + "raw": "1_1_.1_1" + }, + "value": 11.11 + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-81/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-81/options.json deleted file mode 100644 index a65e1ff322a7..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-81/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:5)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-81/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-81/output.json new file mode 100644 index 000000000000..5ac0337bfe64 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-81/output.json @@ -0,0 +1,90 @@ +{ + "type": "File", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:5)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "expression": { + "type": "ArrayExpression", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "elements": [ + { + "type": "NumericLiteral", + "start": 1, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "extra": { + "rawValue": 11.11, + "raw": "1_1._1_1" + }, + "value": 11.11 + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-82/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-82/options.json deleted file mode 100644 index 9c49308645fd..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-82/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:6)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-82/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-82/output.json new file mode 100644 index 000000000000..417003e07eaa --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-82/output.json @@ -0,0 +1,90 @@ +{ + "type": "File", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:6)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "expression": { + "type": "ArrayExpression", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "elements": [ + { + "type": "NumericLiteral", + "start": 1, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "extra": { + "rawValue": 111, + "raw": "1_1.1_e1" + }, + "value": 111 + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-83/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-83/options.json deleted file mode 100644 index 9c49308645fd..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-83/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:6)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-83/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-83/output.json new file mode 100644 index 000000000000..9aa4e5c834d8 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-83/output.json @@ -0,0 +1,90 @@ +{ + "type": "File", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:6)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "expression": { + "type": "ArrayExpression", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "elements": [ + { + "type": "NumericLiteral", + "start": 1, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "extra": { + "rawValue": 111, + "raw": "1_1.1_E1" + }, + "value": 111 + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-84/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-84/options.json deleted file mode 100644 index badcb4c1b655..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-84/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:7)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-84/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-84/output.json new file mode 100644 index 000000000000..859e6d5d5325 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-84/output.json @@ -0,0 +1,90 @@ +{ + "type": "File", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:7)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "expression": { + "type": "ArrayExpression", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "elements": [ + { + "type": "NumericLiteral", + "start": 1, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "extra": { + "rawValue": 111, + "raw": "1_1.1e_1" + }, + "value": 111 + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-85/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-85/options.json deleted file mode 100644 index badcb4c1b655..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-85/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:7)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-85/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-85/output.json new file mode 100644 index 000000000000..5020300be097 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-85/output.json @@ -0,0 +1,90 @@ +{ + "type": "File", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:7)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "expression": { + "type": "ArrayExpression", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "elements": [ + { + "type": "NumericLiteral", + "start": 1, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "extra": { + "rawValue": 111, + "raw": "1_1.1E_1" + }, + "value": 111 + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-86/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-86/options.json deleted file mode 100644 index 9c49308645fd..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-86/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:6)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-86/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-86/output.json new file mode 100644 index 000000000000..3f132f054796 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-86/output.json @@ -0,0 +1,90 @@ +{ + "type": "File", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:6)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "expression": { + "type": "ArrayExpression", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "elements": [ + { + "type": "NumericLiteral", + "start": 1, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "extra": { + "rawValue": 17, + "raw": "0x1_1_" + }, + "value": 17 + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-87/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-87/options.json deleted file mode 100644 index 9c49308645fd..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-87/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:6)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-87/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-87/output.json new file mode 100644 index 000000000000..173a126235b1 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-87/output.json @@ -0,0 +1,90 @@ +{ + "type": "File", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:6)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "expression": { + "type": "ArrayExpression", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "elements": [ + { + "type": "NumericLiteral", + "start": 1, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "extra": { + "rawValue": 161, + "raw": "0xa_1_" + }, + "value": 161 + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-88/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-88/options.json deleted file mode 100644 index 477511a87822..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-88/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:3)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-88/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-88/output.json new file mode 100644 index 000000000000..4f7277b6d914 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-88/output.json @@ -0,0 +1,90 @@ +{ + "type": "File", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:3)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "expression": { + "type": "ArrayExpression", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "elements": [ + { + "type": "NumericLiteral", + "start": 1, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "extra": { + "rawValue": 161, + "raw": "0x_a_1" + }, + "value": 161 + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-89/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-89/options.json deleted file mode 100644 index 477511a87822..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-89/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:3)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-89/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-89/output.json new file mode 100644 index 000000000000..1e5f3a747c34 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-89/output.json @@ -0,0 +1,92 @@ +{ + "type": "File", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:3)", + "SyntaxError: A numeric separator is only allowed between two digits (1:4)", + "SyntaxError: A numeric separator is only allowed between two digits (1:8)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "expression": { + "type": "ArrayExpression", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "elements": [ + { + "type": "NumericLiteral", + "start": 1, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "extra": { + "rawValue": 17, + "raw": "0x__1_1_" + }, + "value": 17 + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-9/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-9/options.json deleted file mode 100644 index 9c49308645fd..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-9/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:6)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-9/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-9/output.json new file mode 100644 index 000000000000..ea1d5804721a --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-9/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:6)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "extra": { + "rawValue": 111, + "raw": "1_1.1E_1" + }, + "value": 111 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-90/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-90/options.json deleted file mode 100644 index 477511a87822..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-90/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:3)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-90/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-90/output.json new file mode 100644 index 000000000000..9723cfbd4fda --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-90/output.json @@ -0,0 +1,92 @@ +{ + "type": "File", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:3)", + "SyntaxError: A numeric separator is only allowed between two digits (1:5)", + "SyntaxError: A numeric separator is only allowed between two digits (1:6)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "expression": { + "type": "ArrayExpression", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "elements": [ + { + "type": "NumericLiteral", + "start": 1, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "extra": { + "rawValue": 17, + "raw": "0x_1__1" + }, + "value": 17 + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-91/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-91/options.json deleted file mode 100644 index 477511a87822..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-91/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:3)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-91/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-91/output.json new file mode 100644 index 000000000000..e802a59e0737 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-91/output.json @@ -0,0 +1,91 @@ +{ + "type": "File", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:3)", + "SyntaxError: A numeric separator is only allowed between two digits (1:7)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "expression": { + "type": "ArrayExpression", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "elements": [ + { + "type": "NumericLiteral", + "start": 1, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "extra": { + "rawValue": 17, + "raw": "0x_1_1_" + }, + "value": 17 + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-92/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-92/options.json deleted file mode 100644 index 477511a87822..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-92/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:3)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-92/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-92/output.json new file mode 100644 index 000000000000..ffc792a8db4d --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-92/output.json @@ -0,0 +1,90 @@ +{ + "type": "File", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:3)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "expression": { + "type": "ArrayExpression", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "elements": [ + { + "type": "NumericLiteral", + "start": 1, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "extra": { + "rawValue": 9, + "raw": "0o_1_1" + }, + "value": 9 + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-93/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-93/options.json deleted file mode 100644 index 477511a87822..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-93/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:3)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-93/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-93/output.json new file mode 100644 index 000000000000..583643ac786d --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-93/output.json @@ -0,0 +1,90 @@ +{ + "type": "File", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:3)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "expression": { + "type": "ArrayExpression", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "elements": [ + { + "type": "NumericLiteral", + "start": 1, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "extra": { + "rawValue": 9, + "raw": "0o_11" + }, + "value": 9 + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-94/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-94/options.json deleted file mode 100644 index 477511a87822..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-94/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:3)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-94/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-94/output.json new file mode 100644 index 000000000000..71984f0f6d53 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-94/output.json @@ -0,0 +1,91 @@ +{ + "type": "File", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:3)", + "SyntaxError: A numeric separator is only allowed between two digits (1:8)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "expression": { + "type": "ArrayExpression", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "elements": [ + { + "type": "NumericLiteral", + "start": 1, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "extra": { + "rawValue": 9, + "raw": "0o_01_1_" + }, + "value": 9 + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-95/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-95/options.json deleted file mode 100644 index 477511a87822..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-95/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:3)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-95/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-95/output.json new file mode 100644 index 000000000000..92169c50ab72 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-95/output.json @@ -0,0 +1,90 @@ +{ + "type": "File", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:3)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "expression": { + "type": "ArrayExpression", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "elements": [ + { + "type": "NumericLiteral", + "start": 1, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "extra": { + "rawValue": 3, + "raw": "0b_0_1_1" + }, + "value": 3 + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-96/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-96/options.json deleted file mode 100644 index 477511a87822..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-96/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:3)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-96/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-96/output.json new file mode 100644 index 000000000000..8775652f6e4e --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-96/output.json @@ -0,0 +1,91 @@ +{ + "type": "File", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:3)", + "SyntaxError: A numeric separator is only allowed between two digits (1:8)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "expression": { + "type": "ArrayExpression", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "elements": [ + { + "type": "NumericLiteral", + "start": 1, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "extra": { + "rawValue": 3, + "raw": "0b_01_1_" + }, + "value": 3 + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-97/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-97/options.json deleted file mode 100644 index badcb4c1b655..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-97/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:7)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-97/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-97/output.json new file mode 100644 index 000000000000..8427ff4fefb2 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-97/output.json @@ -0,0 +1,90 @@ +{ + "type": "File", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:7)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "expression": { + "type": "ArrayExpression", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "elements": [ + { + "type": "NumericLiteral", + "start": 1, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "extra": { + "rawValue": 3, + "raw": "0b01_1_" + }, + "value": 3 + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-98/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-98/options.json deleted file mode 100644 index 9c49308645fd..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-98/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:6)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-98/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-98/output.json new file mode 100644 index 000000000000..ab96b90e5fb1 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-98/output.json @@ -0,0 +1,90 @@ +{ + "type": "File", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:6)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "expression": { + "type": "ArrayExpression", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "elements": [ + { + "type": "NumericLiteral", + "start": 1, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "extra": { + "rawValue": 9, + "raw": "0o1_1_" + }, + "value": 9 + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-99/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-99/options.json deleted file mode 100644 index 477511a87822..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-99/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:3)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-99/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-99/output.json new file mode 100644 index 000000000000..a3925ad6c8e8 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-99/output.json @@ -0,0 +1,91 @@ +{ + "type": "File", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:3)", + "SyntaxError: A numeric separator is only allowed between two digits (1:7)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "expression": { + "type": "ArrayExpression", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "elements": [ + { + "type": "NumericLiteral", + "start": 1, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "extra": { + "rawValue": 9, + "raw": "0o_1_1_" + }, + "value": 9 + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-hex/input.js b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-hex/input.js new file mode 100644 index 000000000000..4027187fe79d --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-hex/input.js @@ -0,0 +1 @@ +"\x1_0"; diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-hex/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-hex/options.json new file mode 100644 index 000000000000..d6659f4863e6 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-hex/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["bigInt", "numericSeparator"] +} diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-hex/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-hex/output.json new file mode 100644 index 000000000000..f47a3612a995 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-hex/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "errors": [ + "SyntaxError: Numeric separators are not allowed inside unicode escape sequences or hex escape sequences (1:4)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [], + "directives": [ + { + "type": "Directive", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "value": "\\x1_0", + "extra": { + "raw": "\"\\x1_0\"", + "rawValue": "\\x1_0" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-leading-zero/input.js b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-leading-zero/input.js new file mode 100644 index 000000000000..cf0bdcda2ea0 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-leading-zero/input.js @@ -0,0 +1 @@ +0_8 \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-leading-zero/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-leading-zero/options.json new file mode 100644 index 000000000000..d6659f4863e6 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-leading-zero/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["bigInt", "numericSeparator"] +} diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-leading-zero/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-leading-zero/output.json new file mode 100644 index 000000000000..b9271342b1f5 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-leading-zero/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "errors": [ + "SyntaxError: Numeric separator can not be used after leading 0 (1:1)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "extra": { + "rawValue": 8, + "raw": "0_8" + }, + "value": 8 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-legacy-octal-literal/input.js b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-legacy-octal-literal/input.js new file mode 100644 index 000000000000..909c1baacf29 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-legacy-octal-literal/input.js @@ -0,0 +1 @@ +00_0 \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-legacy-octal-literal/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-legacy-octal-literal/options.json new file mode 100644 index 000000000000..d6659f4863e6 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-legacy-octal-literal/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["bigInt", "numericSeparator"] +} diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-legacy-octal-literal/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-legacy-octal-literal/output.json new file mode 100644 index 000000000000..9677b88e4b27 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-legacy-octal-literal/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "errors": [ + "SyntaxError: Numeric separator can not be used after leading 0 (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "extra": { + "rawValue": 0, + "raw": "00_0" + }, + "value": 0 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-non-octal-decimal-int/input.js b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-non-octal-decimal-int/input.js new file mode 100644 index 000000000000..50e4a5af8a70 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-non-octal-decimal-int/input.js @@ -0,0 +1 @@ +08_0n \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-non-octal-decimal-int/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-non-octal-decimal-int/options.json new file mode 100644 index 000000000000..d6659f4863e6 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-non-octal-decimal-int/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["bigInt", "numericSeparator"] +} diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-non-octal-decimal-int/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-non-octal-decimal-int/output.json new file mode 100644 index 000000000000..da24fe2bdd7d --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-non-octal-decimal-int/output.json @@ -0,0 +1,74 @@ +{ + "type": "File", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "errors": [ + "SyntaxError: Numeric separator can not be used after leading 0 (1:2)", + "SyntaxError: Invalid BigIntLiteral (1:0)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "expression": { + "type": "BigIntLiteral", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "extra": { + "rawValue": "080", + "raw": "08_0n" + }, + "value": "080" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-unicode-2/input.js b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-unicode-2/input.js new file mode 100644 index 000000000000..7d45889c6dec --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-unicode-2/input.js @@ -0,0 +1 @@ +"\u12_34" diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-unicode-2/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-unicode-2/options.json new file mode 100644 index 000000000000..d6659f4863e6 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-unicode-2/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["bigInt", "numericSeparator"] +} diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-unicode-2/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-unicode-2/output.json new file mode 100644 index 000000000000..b3d5564b9494 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-unicode-2/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "errors": [ + "SyntaxError: Numeric separators are not allowed inside unicode escape sequences or hex escape sequences (1:5)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [], + "directives": [ + { + "type": "Directive", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "value": "\\u12_34", + "extra": { + "raw": "\"\\u12_34\"", + "rawValue": "\\u12_34" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-unicode/input.js b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-unicode/input.js new file mode 100644 index 000000000000..e670fc0c3264 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-unicode/input.js @@ -0,0 +1 @@ +"\u{1F_639}" diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-unicode/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-unicode/options.json new file mode 100644 index 000000000000..d6659f4863e6 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-unicode/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["bigInt", "numericSeparator"] +} diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-unicode/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-unicode/output.json new file mode 100644 index 000000000000..e30a6e6b7370 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-unicode/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "errors": [ + "SyntaxError: Numeric separators are not allowed inside unicode escape sequences or hex escape sequences (1:6)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [], + "directives": [ + { + "type": "Directive", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "value": "\\u{1F_639}", + "extra": { + "raw": "\"\\u{1F_639}\"", + "rawValue": "\\u{1F_639}" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/options.json index 7832463eea97..d6659f4863e6 100644 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/options.json +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/options.json @@ -1,3 +1,3 @@ { - "plugins": ["numericSeparator"] + "plugins": ["bigInt", "numericSeparator"] } diff --git a/packages/babel-parser/test/fixtures/experimental/optional-chaining/class-contructor-call/options.json b/packages/babel-parser/test/fixtures/experimental/optional-chaining/class-contructor-call/options.json deleted file mode 100644 index ed5e3c16bf68..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/optional-chaining/class-contructor-call/options.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "plugins": ["optionalChaining"], - "throws": "constructors in/after an Optional Chain are not allowed (1:10)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/optional-chaining/conditional-decimal/options.json b/packages/babel-parser/test/fixtures/experimental/optional-chaining/conditional-decimal/options.json deleted file mode 100644 index fd201c1bdb02..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/optional-chaining/conditional-decimal/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "plugins": ["optionalChaining"] -} diff --git a/packages/babel-parser/test/fixtures/experimental/optional-chaining/function-call/options.json b/packages/babel-parser/test/fixtures/experimental/optional-chaining/function-call/options.json deleted file mode 100644 index fd201c1bdb02..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/optional-chaining/function-call/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "plugins": ["optionalChaining"] -} diff --git a/packages/babel-parser/test/fixtures/experimental/optional-chaining/member-access-bracket/options.json b/packages/babel-parser/test/fixtures/experimental/optional-chaining/member-access-bracket/options.json deleted file mode 100644 index fd201c1bdb02..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/optional-chaining/member-access-bracket/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "plugins": ["optionalChaining"] -} diff --git a/packages/babel-parser/test/fixtures/experimental/optional-chaining/member-access/options.json b/packages/babel-parser/test/fixtures/experimental/optional-chaining/member-access/options.json deleted file mode 100644 index fd201c1bdb02..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/optional-chaining/member-access/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "plugins": ["optionalChaining"] -} diff --git a/packages/babel-parser/test/fixtures/experimental/optional-chaining/optioanl-chain-expression/options.json b/packages/babel-parser/test/fixtures/experimental/optional-chaining/optioanl-chain-expression/options.json deleted file mode 100644 index fd201c1bdb02..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/optional-chaining/optioanl-chain-expression/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "plugins": ["optionalChaining"] -} diff --git a/packages/babel-parser/test/fixtures/experimental/optional-chaining/optional-constructor/options.json b/packages/babel-parser/test/fixtures/experimental/optional-chaining/optional-constructor/options.json deleted file mode 100644 index 10cef4d48073..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/optional-chaining/optional-constructor/options.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "plugins": ["optionalChaining"], - "throws": "constructors in/after an Optional Chain are not allowed (1:7)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/optional-chaining/optional-super-property-class/options.json b/packages/babel-parser/test/fixtures/experimental/optional-chaining/optional-super-property-class/options.json deleted file mode 100644 index 86849e8c464a..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/optional-chaining/optional-super-property-class/options.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "plugins": ["optionalChaining"], - "throws": "Unexpected token (3:20)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/optional-chaining/optional-super-property/options.json b/packages/babel-parser/test/fixtures/experimental/optional-chaining/optional-super-property/options.json deleted file mode 100644 index 86849e8c464a..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/optional-chaining/optional-super-property/options.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "plugins": ["optionalChaining"], - "throws": "Unexpected token (3:20)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/optional-chaining/optional-tagged-template-literals/options.json b/packages/babel-parser/test/fixtures/experimental/optional-chaining/optional-tagged-template-literals/options.json deleted file mode 100644 index 631741b044e0..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/optional-chaining/optional-tagged-template-literals/options.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "plugins": ["optionalChaining"], - "throws": "Tagged Template Literals are not allowed in optionalChain (1:0)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/optional-chaining/parenthised-chain/options.json b/packages/babel-parser/test/fixtures/experimental/optional-chaining/parenthised-chain/options.json deleted file mode 100644 index fd201c1bdb02..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/optional-chaining/parenthised-chain/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "plugins": ["optionalChaining"] -} diff --git a/packages/babel-parser/test/fixtures/experimental/optional-chaining/separated-chaining/options.json b/packages/babel-parser/test/fixtures/experimental/optional-chaining/separated-chaining/options.json deleted file mode 100644 index fd201c1bdb02..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/optional-chaining/separated-chaining/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "plugins": ["optionalChaining"] -} diff --git a/packages/babel-parser/test/fixtures/experimental/optional-chaining/super-method-class/options.json b/packages/babel-parser/test/fixtures/experimental/optional-chaining/super-method-class/options.json deleted file mode 100644 index fd201c1bdb02..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/optional-chaining/super-method-class/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "plugins": ["optionalChaining"] -} diff --git a/packages/babel-parser/test/fixtures/experimental/partial-application/in-SuperCall/options.json b/packages/babel-parser/test/fixtures/experimental/partial-application/in-SuperCall/options.json index 58192a87fd99..87414aef43de 100644 --- a/packages/babel-parser/test/fixtures/experimental/partial-application/in-SuperCall/options.json +++ b/packages/babel-parser/test/fixtures/experimental/partial-application/in-SuperCall/options.json @@ -1,4 +1,3 @@ { - "plugins": ["partialApplication"], - "throws": "Unexpected argument placeholder (3:16)" + "plugins": ["partialApplication"] } diff --git a/packages/babel-parser/test/fixtures/experimental/partial-application/in-SuperCall/output.json b/packages/babel-parser/test/fixtures/experimental/partial-application/in-SuperCall/output.json new file mode 100644 index 000000000000..14f531a7e147 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/partial-application/in-SuperCall/output.json @@ -0,0 +1,390 @@ +{ + "type": "File", + "start": 0, + "end": 86, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 6, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Unexpected argument placeholder (3:16)", + "SyntaxError: Unexpected argument placeholder (3:19)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 86, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 6, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 86, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 6, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 9 + }, + "identifierName": "Foo" + }, + "name": "Foo" + }, + "superClass": { + "type": "Identifier", + "start": 18, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 21 + }, + "identifierName": "Bar" + }, + "name": "Bar" + }, + "body": { + "type": "ClassBody", + "start": 22, + "end": 86, + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 6, + "column": 1 + } + }, + "body": [ + { + "type": "ClassMethod", + "start": 26, + "end": 84, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 5, + "column": 3 + } + }, + "static": false, + "key": { + "type": "Identifier", + "start": 26, + "end": 37, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 13 + }, + "identifierName": "constructor" + }, + "name": "constructor" + }, + "computed": false, + "kind": "constructor", + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 38, + "end": 39, + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 15 + }, + "identifierName": "x" + }, + "name": "x" + } + ], + "body": { + "type": "BlockStatement", + "start": 40, + "end": 84, + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 5, + "column": 3 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 46, + "end": 64, + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 22 + } + }, + "expression": { + "type": "CallExpression", + "start": 46, + "end": 63, + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 21 + } + }, + "callee": { + "type": "Super", + "start": 46, + "end": 51, + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 9 + } + } + }, + "arguments": [ + { + "type": "Identifier", + "start": 52, + "end": 53, + "loc": { + "start": { + "line": 3, + "column": 10 + }, + "end": { + "line": 3, + "column": 11 + }, + "identifierName": "x" + }, + "name": "x" + }, + { + "type": "NumericLiteral", + "start": 55, + "end": 56, + "loc": { + "start": { + "line": 3, + "column": 13 + }, + "end": { + "line": 3, + "column": 14 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + }, + { + "type": "ArgumentPlaceholder", + "start": 58, + "end": 59, + "loc": { + "start": { + "line": 3, + "column": 16 + }, + "end": { + "line": 3, + "column": 17 + } + } + }, + { + "type": "ArgumentPlaceholder", + "start": 61, + "end": 62, + "loc": { + "start": { + "line": 3, + "column": 19 + }, + "end": { + "line": 3, + "column": 20 + } + } + } + ] + } + }, + { + "type": "ExpressionStatement", + "start": 69, + "end": 80, + "loc": { + "start": { + "line": 4, + "column": 4 + }, + "end": { + "line": 4, + "column": 15 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 69, + "end": 79, + "loc": { + "start": { + "line": 4, + "column": 4 + }, + "end": { + "line": 4, + "column": 14 + } + }, + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 69, + "end": 75, + "loc": { + "start": { + "line": 4, + "column": 4 + }, + "end": { + "line": 4, + "column": 10 + } + }, + "object": { + "type": "ThisExpression", + "start": 69, + "end": 73, + "loc": { + "start": { + "line": 4, + "column": 4 + }, + "end": { + "line": 4, + "column": 8 + } + } + }, + "property": { + "type": "Identifier", + "start": 74, + "end": 75, + "loc": { + "start": { + "line": 4, + "column": 9 + }, + "end": { + "line": 4, + "column": 10 + }, + "identifierName": "x" + }, + "name": "x" + }, + "computed": false + }, + "right": { + "type": "Identifier", + "start": 78, + "end": 79, + "loc": { + "start": { + "line": 4, + "column": 13 + }, + "end": { + "line": 4, + "column": 14 + }, + "identifierName": "x" + }, + "name": "x" + } + } + } + ], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/partial-application/in-new/options.json b/packages/babel-parser/test/fixtures/experimental/partial-application/in-new/options.json index 3b09c84c03eb..87414aef43de 100644 --- a/packages/babel-parser/test/fixtures/experimental/partial-application/in-new/options.json +++ b/packages/babel-parser/test/fixtures/experimental/partial-application/in-new/options.json @@ -1,4 +1,3 @@ { - "plugins": ["partialApplication"], - "throws": "Unexpected argument placeholder (1:11)" + "plugins": ["partialApplication"] } diff --git a/packages/babel-parser/test/fixtures/experimental/partial-application/in-new/output.json b/packages/babel-parser/test/fixtures/experimental/partial-application/in-new/output.json new file mode 100644 index 000000000000..d12380e4820c --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/partial-application/in-new/output.json @@ -0,0 +1,155 @@ +{ + "type": "File", + "start": 0, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "errors": [ + "SyntaxError: Unexpected argument placeholder (1:11)", + "SyntaxError: Unexpected argument placeholder (1:17)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "expression": { + "type": "NewExpression", + "start": 0, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "callee": { + "type": "Identifier", + "start": 4, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "bar" + }, + "name": "bar" + }, + "arguments": [ + { + "type": "Identifier", + "start": 8, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + }, + "identifierName": "x" + }, + "name": "x" + }, + { + "type": "ArgumentPlaceholder", + "start": 11, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "NumericLiteral", + "start": 14, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "extra": { + "rawValue": 2, + "raw": "2" + }, + "value": 2 + }, + { + "type": "ArgumentPlaceholder", + "start": 17, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-bare-style,-head-with-topic-reference-pair/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-bare-style,-head-with-topic-reference-pair/options.json index cc2c16a778e7..279df0af85ba 100644 --- a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-bare-style,-head-with-topic-reference-pair/options.json +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-bare-style,-head-with-topic-reference-pair/options.json @@ -1,4 +1,10 @@ { - "plugins": [["pipelineOperator", { "proposal": "smart" }]], - "throws": "Pipeline head should not be a comma-separated sequence expression (1:0)" + "plugins": [ + [ + "pipelineOperator", + { + "proposal": "smart" + } + ] + ] } diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-bare-style,-head-with-topic-reference-pair/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-bare-style,-head-with-topic-reference-pair/output.json new file mode 100644 index 000000000000..b06186702668 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-bare-style,-head-with-topic-reference-pair/output.json @@ -0,0 +1,162 @@ +{ + "type": "File", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "errors": [ + "SyntaxError: Pipeline head should not be a comma-separated sequence expression (1:0)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "expression": { + "type": "BinaryExpression", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "left": { + "type": "SequenceExpression", + "start": 1, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "expressions": [ + { + "type": "NumericLiteral", + "start": 1, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + }, + { + "type": "NumericLiteral", + "start": 4, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "extra": { + "rawValue": 2, + "raw": "2" + }, + "value": 2 + } + ], + "extra": { + "parenthesized": true, + "parenStart": 0 + } + }, + "operator": "|>", + "right": { + "type": "PipelineBareFunction", + "start": 10, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "callee": { + "type": "Identifier", + "start": 10, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + }, + "identifierName": "f" + }, + "name": "f" + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-nested-pipelines,-topic-style-with-arrow-function-with-bare-style,-no-outer-topic-reference/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-nested-pipelines,-topic-style-with-arrow-function-with-bare-style,-no-outer-topic-reference/options.json index d2b32f77521a..17e4e327bbad 100644 --- a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-nested-pipelines,-topic-style-with-arrow-function-with-bare-style,-no-outer-topic-reference/options.json +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-nested-pipelines,-topic-style-with-arrow-function-with-bare-style,-no-outer-topic-reference/options.json @@ -1,4 +1,3 @@ { - "plugins": [["pipelineOperator", { "proposal": "smart" }]], - "throws": "Pipeline is in topic style but does not use topic reference (1:5)" + "plugins": [["pipelineOperator", { "proposal": "smart" }]] } diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-nested-pipelines,-topic-style-with-arrow-function-with-bare-style,-no-outer-topic-reference/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-nested-pipelines,-topic-style-with-arrow-function-with-bare-style,-no-outer-topic-reference/output.json new file mode 100644 index 000000000000..9aceb13325af --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-nested-pipelines,-topic-style-with-arrow-function-with-bare-style,-no-outer-topic-reference/output.json @@ -0,0 +1,207 @@ +{ + "type": "File", + "start": 0, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "errors": [ + "SyntaxError: Pipeline is in topic style but does not use topic reference (1:5)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "expression": { + "type": "BinaryExpression", + "start": 0, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "left": { + "type": "Identifier", + "start": 0, + "end": 1, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + }, + "identifierName": "x" + }, + "name": "x" + }, + "operator": "|>", + "right": { + "type": "PipelineTopicExpression", + "start": 5, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "expression": { + "type": "ArrowFunctionExpression", + "start": 6, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "$" + }, + "name": "$" + } + ], + "body": { + "type": "BinaryExpression", + "start": 11, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "left": { + "type": "Identifier", + "start": 11, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + }, + "identifierName": "$" + }, + "name": "$" + }, + "operator": "|>", + "right": { + "type": "PipelineBareFunction", + "start": 16, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "callee": { + "type": "Identifier", + "start": 16, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + }, + "identifierName": "f" + }, + "name": "f" + } + } + }, + "extra": { + "parenthesized": true, + "parenStart": 5 + } + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-nested-pipelines,-topic-style-with-arrow-function-with-topic-style,-no-inner-topic-reference/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-nested-pipelines,-topic-style-with-arrow-function-with-topic-style,-no-inner-topic-reference/options.json index e9eab6b46fe9..17e4e327bbad 100644 --- a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-nested-pipelines,-topic-style-with-arrow-function-with-topic-style,-no-inner-topic-reference/options.json +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-nested-pipelines,-topic-style-with-arrow-function-with-topic-style,-no-inner-topic-reference/options.json @@ -1,4 +1,3 @@ { - "plugins": [["pipelineOperator", { "proposal": "smart" }]], - "throws": "Pipeline is in topic style but does not use topic reference (1:16)" + "plugins": [["pipelineOperator", { "proposal": "smart" }]] } diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-nested-pipelines,-topic-style-with-arrow-function-with-topic-style,-no-inner-topic-reference/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-nested-pipelines,-topic-style-with-arrow-function-with-topic-style,-no-inner-topic-reference/output.json new file mode 100644 index 000000000000..a4b95926f362 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-nested-pipelines,-topic-style-with-arrow-function-with-topic-style,-no-inner-topic-reference/output.json @@ -0,0 +1,241 @@ +{ + "type": "File", + "start": 0, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "errors": [ + "SyntaxError: Pipeline is in topic style but does not use topic reference (1:16)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "expression": { + "type": "BinaryExpression", + "start": 0, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "left": { + "type": "Identifier", + "start": 0, + "end": 1, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + }, + "identifierName": "x" + }, + "name": "x" + }, + "operator": "|>", + "right": { + "type": "PipelineTopicExpression", + "start": 5, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "expression": { + "type": "ArrowFunctionExpression", + "start": 6, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "$" + }, + "name": "$" + } + ], + "body": { + "type": "BinaryExpression", + "start": 11, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "left": { + "type": "PipelinePrimaryTopicReference", + "start": 11, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + "operator": "|>", + "right": { + "type": "PipelineTopicExpression", + "start": 16, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "expression": { + "type": "BinaryExpression", + "start": 16, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "left": { + "type": "Identifier", + "start": 16, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + }, + "identifierName": "$" + }, + "name": "$" + }, + "operator": "+", + "right": { + "type": "NumericLiteral", + "start": 20, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + } + }, + "extra": { + "parenthesized": true, + "parenStart": 5 + } + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-nested-pipelines,-topic-style-with-arrow-function-with-topic-style,-no-outer-topic-reference/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-nested-pipelines,-topic-style-with-arrow-function-with-topic-style,-no-outer-topic-reference/options.json index d2b32f77521a..17e4e327bbad 100644 --- a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-nested-pipelines,-topic-style-with-arrow-function-with-topic-style,-no-outer-topic-reference/options.json +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-nested-pipelines,-topic-style-with-arrow-function-with-topic-style,-no-outer-topic-reference/options.json @@ -1,4 +1,3 @@ { - "plugins": [["pipelineOperator", { "proposal": "smart" }]], - "throws": "Pipeline is in topic style but does not use topic reference (1:5)" + "plugins": [["pipelineOperator", { "proposal": "smart" }]] } diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-nested-pipelines,-topic-style-with-arrow-function-with-topic-style,-no-outer-topic-reference/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-nested-pipelines,-topic-style-with-arrow-function-with-topic-style,-no-outer-topic-reference/output.json new file mode 100644 index 000000000000..257c98280e2e --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-nested-pipelines,-topic-style-with-arrow-function-with-topic-style,-no-outer-topic-reference/output.json @@ -0,0 +1,205 @@ +{ + "type": "File", + "start": 0, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "errors": [ + "SyntaxError: Pipeline is in topic style but does not use topic reference (1:5)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "expression": { + "type": "BinaryExpression", + "start": 0, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "left": { + "type": "Identifier", + "start": 0, + "end": 1, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + }, + "identifierName": "x" + }, + "name": "x" + }, + "operator": "|>", + "right": { + "type": "PipelineTopicExpression", + "start": 5, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "expression": { + "type": "ArrowFunctionExpression", + "start": 6, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "$" + }, + "name": "$" + } + ], + "body": { + "type": "BinaryExpression", + "start": 11, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "left": { + "type": "Identifier", + "start": 11, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + }, + "identifierName": "$" + }, + "name": "$" + }, + "operator": "|>", + "right": { + "type": "PipelineTopicExpression", + "start": 16, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "expression": { + "type": "PipelinePrimaryTopicReference", + "start": 16, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + } + } + }, + "extra": { + "parenthesized": true, + "parenStart": 5 + } + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-nested-pipelines,-topic-style-with-inner-topic-style,-no-inner-topic-reference/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-nested-pipelines,-topic-style-with-inner-topic-style,-no-inner-topic-reference/options.json index bdf0547df8f9..17e4e327bbad 100644 --- a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-nested-pipelines,-topic-style-with-inner-topic-style,-no-inner-topic-reference/options.json +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-nested-pipelines,-topic-style-with-inner-topic-style,-no-inner-topic-reference/options.json @@ -1,4 +1,3 @@ { - "plugins": [["pipelineOperator", { "proposal": "smart" }]], - "throws": "Pipeline is in topic style but does not use topic reference (1:11)" + "plugins": [["pipelineOperator", { "proposal": "smart" }]] } diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-nested-pipelines,-topic-style-with-inner-topic-style,-no-inner-topic-reference/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-nested-pipelines,-topic-style-with-inner-topic-style,-no-inner-topic-reference/output.json new file mode 100644 index 000000000000..5644ff01406b --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-nested-pipelines,-topic-style-with-inner-topic-style,-no-inner-topic-reference/output.json @@ -0,0 +1,184 @@ +{ + "type": "File", + "start": 0, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "errors": [ + "SyntaxError: Pipeline is in topic style but does not use topic reference (1:11)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "expression": { + "type": "BinaryExpression", + "start": 0, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "left": { + "type": "Identifier", + "start": 0, + "end": 1, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + }, + "identifierName": "x" + }, + "name": "x" + }, + "operator": "|>", + "right": { + "type": "PipelineTopicExpression", + "start": 5, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "expression": { + "type": "BinaryExpression", + "start": 6, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "left": { + "type": "PipelinePrimaryTopicReference", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "operator": "|>", + "right": { + "type": "PipelineTopicExpression", + "start": 11, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "expression": { + "type": "CallExpression", + "start": 11, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "callee": { + "type": "Identifier", + "start": 11, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + }, + "identifierName": "f" + }, + "name": "f" + }, + "arguments": [] + } + }, + "extra": { + "parenthesized": true, + "parenStart": 5 + } + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-nested-pipelines,-topic-style-with-inner-topic-style,-no-outer-topic-reference/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-nested-pipelines,-topic-style-with-inner-topic-style,-no-outer-topic-reference/options.json index d2b32f77521a..17e4e327bbad 100644 --- a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-nested-pipelines,-topic-style-with-inner-topic-style,-no-outer-topic-reference/options.json +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-nested-pipelines,-topic-style-with-inner-topic-style,-no-outer-topic-reference/options.json @@ -1,4 +1,3 @@ { - "plugins": [["pipelineOperator", { "proposal": "smart" }]], - "throws": "Pipeline is in topic style but does not use topic reference (1:5)" + "plugins": [["pipelineOperator", { "proposal": "smart" }]] } diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-nested-pipelines,-topic-style-with-inner-topic-style,-no-outer-topic-reference/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-nested-pipelines,-topic-style-with-inner-topic-style,-no-outer-topic-reference/output.json new file mode 100644 index 000000000000..f274dbc1ad48 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-nested-pipelines,-topic-style-with-inner-topic-style,-no-outer-topic-reference/output.json @@ -0,0 +1,170 @@ +{ + "type": "File", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "errors": [ + "SyntaxError: Pipeline is in topic style but does not use topic reference (1:5)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "expression": { + "type": "BinaryExpression", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "left": { + "type": "Identifier", + "start": 0, + "end": 1, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + }, + "identifierName": "x" + }, + "name": "x" + }, + "operator": "|>", + "right": { + "type": "PipelineTopicExpression", + "start": 5, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "expression": { + "type": "BinaryExpression", + "start": 6, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "left": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "$" + }, + "name": "$" + }, + "operator": "|>", + "right": { + "type": "PipelineBareFunction", + "start": 11, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "callee": { + "type": "Identifier", + "start": 11, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + }, + "identifierName": "f" + }, + "name": "f" + } + }, + "extra": { + "parenthesized": true, + "parenStart": 5 + } + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-sequence-style,-body-with-topic-reference-pair-followed-by-bare-style-pipeline-body/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-sequence-style,-body-with-topic-reference-pair-followed-by-bare-style-pipeline-body/options.json index fe3873ecc67f..279df0af85ba 100644 --- a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-sequence-style,-body-with-topic-reference-pair-followed-by-bare-style-pipeline-body/options.json +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-sequence-style,-body-with-topic-reference-pair-followed-by-bare-style-pipeline-body/options.json @@ -1,4 +1,10 @@ { - "plugins": [["pipelineOperator", { "proposal": "smart" }]], - "throws": "Pipeline body may not be a comma-separated sequence expression (1:6)" + "plugins": [ + [ + "pipelineOperator", + { + "proposal": "smart" + } + ] + ] } diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-sequence-style,-body-with-topic-reference-pair-followed-by-bare-style-pipeline-body/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-sequence-style,-body-with-topic-reference-pair-followed-by-bare-style-pipeline-body/output.json new file mode 100644 index 000000000000..b0b8ec5955df --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-sequence-style,-body-with-topic-reference-pair-followed-by-bare-style-pipeline-body/output.json @@ -0,0 +1,203 @@ +{ + "type": "File", + "start": 0, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "errors": [ + "SyntaxError: Pipeline body may not be a comma-separated sequence expression (1:6)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "expression": { + "type": "BinaryExpression", + "start": 0, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "left": { + "type": "BinaryExpression", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "left": { + "type": "NumericLiteral", + "start": 0, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "extra": { + "rawValue": 10, + "raw": "10" + }, + "value": 10 + }, + "operator": "|>", + "right": { + "type": "PipelineTopicExpression", + "start": 6, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "expression": { + "type": "SequenceExpression", + "start": 7, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "expressions": [ + { + "type": "PipelinePrimaryTopicReference", + "start": 7, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "PipelinePrimaryTopicReference", + "start": 10, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + } + ], + "extra": { + "parenthesized": true, + "parenStart": 6 + } + } + } + }, + "operator": "|>", + "right": { + "type": "PipelineBareFunction", + "start": 16, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "callee": { + "type": "Identifier", + "start": 16, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + }, + "identifierName": "h" + }, + "name": "h" + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-sequence-style,-body-with-topic-reference-pair-then-end/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-sequence-style,-body-with-topic-reference-pair-then-end/options.json index fe3873ecc67f..279df0af85ba 100644 --- a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-sequence-style,-body-with-topic-reference-pair-then-end/options.json +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-sequence-style,-body-with-topic-reference-pair-then-end/options.json @@ -1,4 +1,10 @@ { - "plugins": [["pipelineOperator", { "proposal": "smart" }]], - "throws": "Pipeline body may not be a comma-separated sequence expression (1:6)" + "plugins": [ + [ + "pipelineOperator", + { + "proposal": "smart" + } + ] + ] } diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-sequence-style,-body-with-topic-reference-pair-then-end/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-sequence-style,-body-with-topic-reference-pair-then-end/output.json new file mode 100644 index 000000000000..89c673d0bc0c --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-sequence-style,-body-with-topic-reference-pair-then-end/output.json @@ -0,0 +1,155 @@ +{ + "type": "File", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "errors": [ + "SyntaxError: Pipeline body may not be a comma-separated sequence expression (1:6)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "expression": { + "type": "BinaryExpression", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "left": { + "type": "NumericLiteral", + "start": 0, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "extra": { + "rawValue": 10, + "raw": "10" + }, + "value": 10 + }, + "operator": "|>", + "right": { + "type": "PipelineTopicExpression", + "start": 6, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "expression": { + "type": "SequenceExpression", + "start": 7, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "expressions": [ + { + "type": "PipelinePrimaryTopicReference", + "start": 7, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "PipelinePrimaryTopicReference", + "start": 10, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + } + ], + "extra": { + "parenthesized": true, + "parenStart": 6 + } + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-computed,-no-topic-reference/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-computed,-no-topic-reference/options.json index 7a4451381c91..17e4e327bbad 100644 --- a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-computed,-no-topic-reference/options.json +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-computed,-no-topic-reference/options.json @@ -1,4 +1,3 @@ { - "plugins": [["pipelineOperator", { "proposal": "smart" }]], - "throws": "Pipeline is in topic style but does not use topic reference (1:9)" + "plugins": [["pipelineOperator", { "proposal": "smart" }]] } diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-computed,-no-topic-reference/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-computed,-no-topic-reference/output.json new file mode 100644 index 000000000000..feca14ebaf5b --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-computed,-no-topic-reference/output.json @@ -0,0 +1,151 @@ +{ + "type": "File", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "errors": [ + "SyntaxError: Pipeline is in topic style but does not use topic reference (1:9)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "expression": { + "type": "BinaryExpression", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "left": { + "type": "Identifier", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + }, + "identifierName": "value" + }, + "name": "value" + }, + "operator": "|>", + "right": { + "type": "PipelineTopicExpression", + "start": 9, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "expression": { + "type": "MemberExpression", + "start": 9, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "object": { + "type": "Identifier", + "start": 9, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + }, + "identifierName": "a" + }, + "name": "a" + }, + "property": { + "type": "Identifier", + "start": 11, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + }, + "identifierName": "b" + }, + "name": "b" + }, + "computed": true + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-no-topic-reference,-addition/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-no-topic-reference,-addition/options.json index 7a4451381c91..17e4e327bbad 100644 --- a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-no-topic-reference,-addition/options.json +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-no-topic-reference,-addition/options.json @@ -1,4 +1,3 @@ { - "plugins": [["pipelineOperator", { "proposal": "smart" }]], - "throws": "Pipeline is in topic style but does not use topic reference (1:9)" + "plugins": [["pipelineOperator", { "proposal": "smart" }]] } diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-no-topic-reference,-addition/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-no-topic-reference,-addition/output.json new file mode 100644 index 000000000000..c1399c71afa2 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-no-topic-reference,-addition/output.json @@ -0,0 +1,151 @@ +{ + "type": "File", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "errors": [ + "SyntaxError: Pipeline is in topic style but does not use topic reference (1:9)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "expression": { + "type": "BinaryExpression", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "left": { + "type": "Identifier", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + }, + "identifierName": "value" + }, + "name": "value" + }, + "operator": "|>", + "right": { + "type": "PipelineTopicExpression", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "expression": { + "type": "BinaryExpression", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "left": { + "type": "Identifier", + "start": 9, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + }, + "identifierName": "a" + }, + "name": "a" + }, + "operator": "+", + "right": { + "type": "Identifier", + "start": 13, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "b" + }, + "name": "b" + } + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-no-topic-reference,-class-expression/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-no-topic-reference,-class-expression/options.json index 7a4451381c91..17e4e327bbad 100644 --- a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-no-topic-reference,-class-expression/options.json +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-no-topic-reference,-class-expression/options.json @@ -1,4 +1,3 @@ { - "plugins": [["pipelineOperator", { "proposal": "smart" }]], - "throws": "Pipeline is in topic style but does not use topic reference (1:9)" + "plugins": [["pipelineOperator", { "proposal": "smart" }]] } diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-no-topic-reference,-class-expression/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-no-topic-reference,-class-expression/output.json new file mode 100644 index 000000000000..da79f8d294e8 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-no-topic-reference,-class-expression/output.json @@ -0,0 +1,134 @@ +{ + "type": "File", + "start": 0, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "errors": [ + "SyntaxError: Pipeline is in topic style but does not use topic reference (1:9)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "expression": { + "type": "BinaryExpression", + "start": 0, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "left": { + "type": "Identifier", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + }, + "identifierName": "value" + }, + "name": "value" + }, + "operator": "|>", + "right": { + "type": "PipelineTopicExpression", + "start": 9, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "expression": { + "type": "ClassExpression", + "start": 9, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "id": null, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 15, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "body": [] + } + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-no-topic-reference,-function-expression/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-no-topic-reference,-function-expression/options.json index 7a4451381c91..17e4e327bbad 100644 --- a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-no-topic-reference,-function-expression/options.json +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-no-topic-reference,-function-expression/options.json @@ -1,4 +1,3 @@ { - "plugins": [["pipelineOperator", { "proposal": "smart" }]], - "throws": "Pipeline is in topic style but does not use topic reference (1:9)" + "plugins": [["pipelineOperator", { "proposal": "smart" }]] } diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-no-topic-reference,-function-expression/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-no-topic-reference,-function-expression/output.json new file mode 100644 index 000000000000..63e37b46042d --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-no-topic-reference,-function-expression/output.json @@ -0,0 +1,172 @@ +{ + "type": "File", + "start": 0, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "errors": [ + "SyntaxError: Pipeline is in topic style but does not use topic reference (1:9)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "expression": { + "type": "BinaryExpression", + "start": 0, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "left": { + "type": "Identifier", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + }, + "identifierName": "value" + }, + "name": "value" + }, + "operator": "|>", + "right": { + "type": "PipelineTopicExpression", + "start": 9, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "expression": { + "type": "FunctionExpression", + "start": 9, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 19, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + }, + "identifierName": "x" + }, + "name": "x" + } + ], + "body": { + "type": "BlockStatement", + "start": 22, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "body": [ + { + "type": "ReturnStatement", + "start": 24, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "argument": null + } + ], + "directives": [] + } + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-unbound-topic,-do-expression,-do-while-loop,-outer-topic-reference-in-loop-body/input.js b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-unbound-topic,-do-expression,-do-while-loop,-outer-topic-reference-in-loop-body/input.js index c1005576b7d5..8b34c84f521f 100644 --- a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-unbound-topic,-do-expression,-do-while-loop,-outer-topic-reference-in-loop-body/input.js +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-unbound-topic,-do-expression,-do-while-loop,-outer-topic-reference-in-loop-body/input.js @@ -1 +1 @@ -value |> do { do x += # while (x < 50); } +value |> do { do x += #; while (x < 50); } diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-unbound-topic,-do-expression,-do-while-loop,-outer-topic-reference-in-loop-body/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-unbound-topic,-do-expression,-do-while-loop,-outer-topic-reference-in-loop-body/options.json index 3b7a52d71cf7..edb7679c6a74 100644 --- a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-unbound-topic,-do-expression,-do-while-loop,-outer-topic-reference-in-loop-body/options.json +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-unbound-topic,-do-expression,-do-while-loop,-outer-topic-reference-in-loop-body/options.json @@ -1,4 +1,3 @@ { - "plugins": [["pipelineOperator", { "proposal": "smart" }], "doExpressions"], - "throws": "Topic reference was used in a lexical context without topic binding (1:22)" + "plugins": [["pipelineOperator", { "proposal": "smart" }], "doExpressions"] } diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-unbound-topic,-do-expression,-do-while-loop,-outer-topic-reference-in-loop-body/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-unbound-topic,-do-expression,-do-while-loop,-outer-topic-reference-in-loop-body/output.json new file mode 100644 index 000000000000..95125a326a21 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-unbound-topic,-do-expression,-do-while-loop,-outer-topic-reference-in-loop-body/output.json @@ -0,0 +1,266 @@ +{ + "type": "File", + "start": 0, + "end": 42, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 42 + } + }, + "errors": [ + "SyntaxError: Topic reference was used in a lexical context without topic binding (1:22)", + "SyntaxError: Pipeline is in topic style but does not use topic reference (1:9)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 42, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 42 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 42, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 42 + } + }, + "expression": { + "type": "BinaryExpression", + "start": 0, + "end": 42, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 42 + } + }, + "left": { + "type": "Identifier", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + }, + "identifierName": "value" + }, + "name": "value" + }, + "operator": "|>", + "right": { + "type": "PipelineTopicExpression", + "start": 9, + "end": 42, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 42 + } + }, + "expression": { + "type": "DoExpression", + "start": 9, + "end": 42, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 42 + } + }, + "body": { + "type": "BlockStatement", + "start": 12, + "end": 42, + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 42 + } + }, + "body": [ + { + "type": "DoWhileStatement", + "start": 14, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 40 + } + }, + "body": { + "type": "ExpressionStatement", + "start": 17, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 17, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "operator": "+=", + "left": { + "type": "Identifier", + "start": 17, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + }, + "identifierName": "x" + }, + "name": "x" + }, + "right": { + "type": "PipelinePrimaryTopicReference", + "start": 22, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + } + } + } + }, + "test": { + "type": "BinaryExpression", + "start": 32, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 38 + } + }, + "left": { + "type": "Identifier", + "start": 32, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 33 + }, + "identifierName": "x" + }, + "name": "x" + }, + "operator": "<", + "right": { + "type": "NumericLiteral", + "start": 36, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 36 + }, + "end": { + "line": 1, + "column": 38 + } + }, + "extra": { + "rawValue": 50, + "raw": "50" + }, + "value": 50 + } + } + } + ], + "directives": [] + } + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-unbound-topic,-do-expression,-for-await-of-loop,-outer-topic-reference-in-loop-body/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-unbound-topic,-do-expression,-for-await-of-loop,-outer-topic-reference-in-loop-body/options.json index d117d235099d..680f780892b7 100644 --- a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-unbound-topic,-do-expression,-for-await-of-loop,-outer-topic-reference-in-loop-body/options.json +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-unbound-topic,-do-expression,-for-await-of-loop,-outer-topic-reference-in-loop-body/options.json @@ -3,6 +3,5 @@ ["pipelineOperator", { "proposal": "smart" }], "doExpressions", "asyncGenerators" - ], - "throws": "Topic reference was used in a lexical context without topic binding (2:48)" + ] } diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-unbound-topic,-do-expression,-for-await-of-loop,-outer-topic-reference-in-loop-body/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-unbound-topic,-do-expression,-for-await-of-loop,-outer-topic-reference-in-loop-body/output.json new file mode 100644 index 000000000000..372a871e8b7b --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-unbound-topic,-do-expression,-for-await-of-loop,-outer-topic-reference-in-loop-body/output.json @@ -0,0 +1,302 @@ +{ + "type": "File", + "start": 0, + "end": 77, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Topic reference was used in a lexical context without topic binding (2:48)", + "SyntaxError: Pipeline is in topic style but does not use topic reference (2:11)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 77, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 77, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 15, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 17 + }, + "identifierName": "af" + }, + "name": "af" + }, + "generator": false, + "async": true, + "params": [], + "body": { + "type": "BlockStatement", + "start": 21, + "end": 77, + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 25, + "end": 75, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 52 + } + }, + "expression": { + "type": "BinaryExpression", + "start": 25, + "end": 75, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 52 + } + }, + "left": { + "type": "Identifier", + "start": 25, + "end": 30, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 7 + }, + "identifierName": "value" + }, + "name": "value" + }, + "operator": "|>", + "right": { + "type": "PipelineTopicExpression", + "start": 34, + "end": 75, + "loc": { + "start": { + "line": 2, + "column": 11 + }, + "end": { + "line": 2, + "column": 52 + } + }, + "expression": { + "type": "DoExpression", + "start": 34, + "end": 75, + "loc": { + "start": { + "line": 2, + "column": 11 + }, + "end": { + "line": 2, + "column": 52 + } + }, + "body": { + "type": "BlockStatement", + "start": 37, + "end": 75, + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 52 + } + }, + "body": [ + { + "type": "ForOfStatement", + "start": 39, + "end": 73, + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 50 + } + }, + "await": true, + "left": { + "type": "VariableDeclaration", + "start": 50, + "end": 57, + "loc": { + "start": { + "line": 2, + "column": 27 + }, + "end": { + "line": 2, + "column": 34 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 56, + "end": 57, + "loc": { + "start": { + "line": 2, + "column": 33 + }, + "end": { + "line": 2, + "column": 34 + } + }, + "id": { + "type": "Identifier", + "start": 56, + "end": 57, + "loc": { + "start": { + "line": 2, + "column": 33 + }, + "end": { + "line": 2, + "column": 34 + }, + "identifierName": "e" + }, + "name": "e" + }, + "init": null + } + ], + "kind": "const" + }, + "right": { + "type": "Identifier", + "start": 61, + "end": 69, + "loc": { + "start": { + "line": 2, + "column": 38 + }, + "end": { + "line": 2, + "column": 46 + }, + "identifierName": "sequence" + }, + "name": "sequence" + }, + "body": { + "type": "ExpressionStatement", + "start": 71, + "end": 73, + "loc": { + "start": { + "line": 2, + "column": 48 + }, + "end": { + "line": 2, + "column": 50 + } + }, + "expression": { + "type": "PipelinePrimaryTopicReference", + "start": 71, + "end": 72, + "loc": { + "start": { + "line": 2, + "column": 48 + }, + "end": { + "line": 2, + "column": 49 + } + } + } + } + } + ], + "directives": [] + } + } + } + } + } + ], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-unbound-topic,-do-expression,-for-classic-loop,-outer-topic-reference-in-loop-body/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-unbound-topic,-do-expression,-for-classic-loop,-outer-topic-reference-in-loop-body/options.json index 35e8658a93da..edb7679c6a74 100644 --- a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-unbound-topic,-do-expression,-for-classic-loop,-outer-topic-reference-in-loop-body/options.json +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-unbound-topic,-do-expression,-for-classic-loop,-outer-topic-reference-in-loop-body/options.json @@ -1,4 +1,3 @@ { - "plugins": [["pipelineOperator", { "proposal": "smart" }], "doExpressions"], - "throws": "Topic reference was used in a lexical context without topic binding (1:45)" + "plugins": [["pipelineOperator", { "proposal": "smart" }], "doExpressions"] } diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-unbound-topic,-do-expression,-for-classic-loop,-outer-topic-reference-in-loop-body/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-unbound-topic,-do-expression,-for-classic-loop,-outer-topic-reference-in-loop-body/output.json new file mode 100644 index 000000000000..58ca8064b581 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-unbound-topic,-do-expression,-for-classic-loop,-outer-topic-reference-in-loop-body/output.json @@ -0,0 +1,353 @@ +{ + "type": "File", + "start": 0, + "end": 49, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 49 + } + }, + "errors": [ + "SyntaxError: Topic reference was used in a lexical context without topic binding (1:45)", + "SyntaxError: Pipeline is in topic style but does not use topic reference (1:9)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 49, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 49 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 49, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 49 + } + }, + "expression": { + "type": "BinaryExpression", + "start": 0, + "end": 49, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 49 + } + }, + "left": { + "type": "Identifier", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + }, + "identifierName": "value" + }, + "name": "value" + }, + "operator": "|>", + "right": { + "type": "PipelineTopicExpression", + "start": 9, + "end": 49, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 49 + } + }, + "expression": { + "type": "DoExpression", + "start": 9, + "end": 49, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 49 + } + }, + "body": { + "type": "BlockStatement", + "start": 12, + "end": 49, + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 49 + } + }, + "body": [ + { + "type": "ForStatement", + "start": 14, + "end": 47, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 47 + } + }, + "init": { + "type": "VariableDeclaration", + "start": 19, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 23, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "id": { + "type": "Identifier", + "start": 23, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + }, + "identifierName": "i" + }, + "name": "i" + }, + "init": { + "type": "NumericLiteral", + "start": 27, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + } + ], + "kind": "let" + }, + "test": { + "type": "BinaryExpression", + "start": 30, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "left": { + "type": "Identifier", + "start": 30, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 31 + }, + "identifierName": "i" + }, + "name": "i" + }, + "operator": "<", + "right": { + "type": "Identifier", + "start": 34, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 34 + }, + "end": { + "line": 1, + "column": 35 + }, + "identifierName": "n" + }, + "name": "n" + } + }, + "update": { + "type": "AssignmentExpression", + "start": 37, + "end": 43, + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 43 + } + }, + "operator": "+=", + "left": { + "type": "Identifier", + "start": 37, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 38 + }, + "identifierName": "i" + }, + "name": "i" + }, + "right": { + "type": "NumericLiteral", + "start": 42, + "end": 43, + "loc": { + "start": { + "line": 1, + "column": 42 + }, + "end": { + "line": 1, + "column": 43 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + }, + "body": { + "type": "ExpressionStatement", + "start": 45, + "end": 47, + "loc": { + "start": { + "line": 1, + "column": 45 + }, + "end": { + "line": 1, + "column": 47 + } + }, + "expression": { + "type": "PipelinePrimaryTopicReference", + "start": 45, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 45 + }, + "end": { + "line": 1, + "column": 46 + } + } + } + } + } + ], + "directives": [] + } + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-unbound-topic,-do-expression,-for-in-loop,-outer-topic-reference-in-loop-body/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-unbound-topic,-do-expression,-for-in-loop,-outer-topic-reference-in-loop-body/options.json index 6e8b4a6f0d95..edb7679c6a74 100644 --- a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-unbound-topic,-do-expression,-for-in-loop,-outer-topic-reference-in-loop-body/options.json +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-unbound-topic,-do-expression,-for-in-loop,-outer-topic-reference-in-loop-body/options.json @@ -1,4 +1,3 @@ { - "plugins": [["pipelineOperator", { "proposal": "smart" }], "doExpressions"], - "throws": "Topic reference was used in a lexical context without topic binding (1:32)" + "plugins": [["pipelineOperator", { "proposal": "smart" }], "doExpressions"] } diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-unbound-topic,-do-expression,-for-in-loop,-outer-topic-reference-in-loop-body/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-unbound-topic,-do-expression,-for-in-loop,-outer-topic-reference-in-loop-body/output.json new file mode 100644 index 000000000000..6f197479125e --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-unbound-topic,-do-expression,-for-in-loop,-outer-topic-reference-in-loop-body/output.json @@ -0,0 +1,214 @@ +{ + "type": "File", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "errors": [ + "SyntaxError: Topic reference was used in a lexical context without topic binding (1:32)", + "SyntaxError: Pipeline is in topic style but does not use topic reference (1:9)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "expression": { + "type": "BinaryExpression", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "left": { + "type": "Identifier", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + }, + "identifierName": "value" + }, + "name": "value" + }, + "operator": "|>", + "right": { + "type": "PipelineTopicExpression", + "start": 9, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "expression": { + "type": "DoExpression", + "start": 9, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "body": { + "type": "BlockStatement", + "start": 12, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "body": [ + { + "type": "ForInStatement", + "start": 14, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "left": { + "type": "Identifier", + "start": 19, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + }, + "identifierName": "e" + }, + "name": "e" + }, + "right": { + "type": "Identifier", + "start": 24, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 30 + }, + "identifierName": "object" + }, + "name": "object" + }, + "body": { + "type": "ExpressionStatement", + "start": 32, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "expression": { + "type": "PipelinePrimaryTopicReference", + "start": 32, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 33 + } + } + } + } + } + ], + "directives": [] + } + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-unbound-topic,-do-expression,-for-of-loop,-outer-topic-reference-in-loop-body/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-unbound-topic,-do-expression,-for-of-loop,-outer-topic-reference-in-loop-body/options.json index a3707cc91710..edb7679c6a74 100644 --- a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-unbound-topic,-do-expression,-for-of-loop,-outer-topic-reference-in-loop-body/options.json +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-unbound-topic,-do-expression,-for-of-loop,-outer-topic-reference-in-loop-body/options.json @@ -1,4 +1,3 @@ { - "plugins": [["pipelineOperator", { "proposal": "smart" }], "doExpressions"], - "throws": "Topic reference was used in a lexical context without topic binding (1:34)" + "plugins": [["pipelineOperator", { "proposal": "smart" }], "doExpressions"] } diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-unbound-topic,-do-expression,-for-of-loop,-outer-topic-reference-in-loop-body/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-unbound-topic,-do-expression,-for-of-loop,-outer-topic-reference-in-loop-body/output.json new file mode 100644 index 000000000000..b4bdcb7bcd7d --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-unbound-topic,-do-expression,-for-of-loop,-outer-topic-reference-in-loop-body/output.json @@ -0,0 +1,215 @@ +{ + "type": "File", + "start": 0, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 38 + } + }, + "errors": [ + "SyntaxError: Topic reference was used in a lexical context without topic binding (1:34)", + "SyntaxError: Pipeline is in topic style but does not use topic reference (1:9)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 38 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 38 + } + }, + "expression": { + "type": "BinaryExpression", + "start": 0, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 38 + } + }, + "left": { + "type": "Identifier", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + }, + "identifierName": "value" + }, + "name": "value" + }, + "operator": "|>", + "right": { + "type": "PipelineTopicExpression", + "start": 9, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 38 + } + }, + "expression": { + "type": "DoExpression", + "start": 9, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 38 + } + }, + "body": { + "type": "BlockStatement", + "start": 12, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 38 + } + }, + "body": [ + { + "type": "ForOfStatement", + "start": 14, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "await": false, + "left": { + "type": "Identifier", + "start": 19, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + }, + "identifierName": "e" + }, + "name": "e" + }, + "right": { + "type": "Identifier", + "start": 24, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 32 + }, + "identifierName": "sequence" + }, + "name": "sequence" + }, + "body": { + "type": "ExpressionStatement", + "start": 34, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 34 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "expression": { + "type": "PipelinePrimaryTopicReference", + "start": 34, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 34 + }, + "end": { + "line": 1, + "column": 35 + } + } + } + } + } + ], + "directives": [] + } + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-unbound-topic,-do-expression,-try-statement,-outer-topic-reference-in-catch-clause/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-unbound-topic,-do-expression,-try-statement,-outer-topic-reference-in-catch-clause/options.json index 0f40a90d2204..edb7679c6a74 100644 --- a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-unbound-topic,-do-expression,-try-statement,-outer-topic-reference-in-catch-clause/options.json +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-unbound-topic,-do-expression,-try-statement,-outer-topic-reference-in-catch-clause/options.json @@ -1,4 +1,3 @@ { - "plugins": [["pipelineOperator", { "proposal": "smart" }], "doExpressions"], - "throws": "Topic reference was used in a lexical context without topic binding (3:32)" + "plugins": [["pipelineOperator", { "proposal": "smart" }], "doExpressions"] } diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-unbound-topic,-do-expression,-try-statement,-outer-topic-reference-in-catch-clause/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-unbound-topic,-do-expression,-try-statement,-outer-topic-reference-in-catch-clause/output.json new file mode 100644 index 000000000000..f168982f9d91 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-unbound-topic,-do-expression,-try-statement,-outer-topic-reference-in-catch-clause/output.json @@ -0,0 +1,412 @@ +{ + "type": "File", + "start": 0, + "end": 78, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Topic reference was used in a lexical context without topic binding (3:32)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 78, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 78, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "expression": { + "type": "BinaryExpression", + "start": 0, + "end": 78, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "left": { + "type": "Identifier", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + }, + "identifierName": "value" + }, + "name": "value" + }, + "operator": "|>", + "right": { + "type": "PipelineTopicExpression", + "start": 9, + "end": 78, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "expression": { + "type": "DoExpression", + "start": 9, + "end": 78, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "body": { + "type": "BlockStatement", + "start": 12, + "end": 78, + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "body": [ + { + "type": "TryStatement", + "start": 16, + "end": 76, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 3, + "column": 37 + } + }, + "block": { + "type": "BlockStatement", + "start": 20, + "end": 38, + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 24 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 22, + "end": 36, + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 22 + } + }, + "expression": { + "type": "CallExpression", + "start": 22, + "end": 35, + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 21 + } + }, + "callee": { + "type": "MemberExpression", + "start": 22, + "end": 32, + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 18 + } + }, + "object": { + "type": "Identifier", + "start": 22, + "end": 26, + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 12 + }, + "identifierName": "JSON" + }, + "name": "JSON" + }, + "property": { + "type": "Identifier", + "start": 27, + "end": 32, + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 18 + }, + "identifierName": "parse" + }, + "name": "parse" + }, + "computed": false + }, + "arguments": [ + { + "type": "PipelinePrimaryTopicReference", + "start": 33, + "end": 34, + "loc": { + "start": { + "line": 2, + "column": 19 + }, + "end": { + "line": 2, + "column": 20 + } + } + } + ] + } + } + ], + "directives": [] + }, + "handler": { + "type": "CatchClause", + "start": 41, + "end": 76, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 37 + } + }, + "param": { + "type": "Identifier", + "start": 48, + "end": 53, + "loc": { + "start": { + "line": 3, + "column": 9 + }, + "end": { + "line": 3, + "column": 14 + }, + "identifierName": "error" + }, + "name": "error" + }, + "body": { + "type": "BlockStatement", + "start": 55, + "end": 76, + "loc": { + "start": { + "line": 3, + "column": 16 + }, + "end": { + "line": 3, + "column": 37 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 57, + "end": 74, + "loc": { + "start": { + "line": 3, + "column": 18 + }, + "end": { + "line": 3, + "column": 35 + } + }, + "expression": { + "type": "CallExpression", + "start": 57, + "end": 73, + "loc": { + "start": { + "line": 3, + "column": 18 + }, + "end": { + "line": 3, + "column": 34 + } + }, + "callee": { + "type": "MemberExpression", + "start": 57, + "end": 70, + "loc": { + "start": { + "line": 3, + "column": 18 + }, + "end": { + "line": 3, + "column": 31 + } + }, + "object": { + "type": "Identifier", + "start": 57, + "end": 64, + "loc": { + "start": { + "line": 3, + "column": 18 + }, + "end": { + "line": 3, + "column": 25 + }, + "identifierName": "console" + }, + "name": "console" + }, + "property": { + "type": "Identifier", + "start": 65, + "end": 70, + "loc": { + "start": { + "line": 3, + "column": 26 + }, + "end": { + "line": 3, + "column": 31 + }, + "identifierName": "error" + }, + "name": "error" + }, + "computed": false + }, + "arguments": [ + { + "type": "PipelinePrimaryTopicReference", + "start": 71, + "end": 72, + "loc": { + "start": { + "line": 3, + "column": 32 + }, + "end": { + "line": 3, + "column": 33 + } + } + } + ] + } + } + ], + "directives": [] + } + }, + "finalizer": null + } + ], + "directives": [] + } + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-unbound-topic,-do-expression,-while-loop,-outer-topic-reference-in-loop-body/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-unbound-topic,-do-expression,-while-loop,-outer-topic-reference-in-loop-body/options.json index a3707cc91710..edb7679c6a74 100644 --- a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-unbound-topic,-do-expression,-while-loop,-outer-topic-reference-in-loop-body/options.json +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-unbound-topic,-do-expression,-while-loop,-outer-topic-reference-in-loop-body/options.json @@ -1,4 +1,3 @@ { - "plugins": [["pipelineOperator", { "proposal": "smart" }], "doExpressions"], - "throws": "Topic reference was used in a lexical context without topic binding (1:34)" + "plugins": [["pipelineOperator", { "proposal": "smart" }], "doExpressions"] } diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-unbound-topic,-do-expression,-while-loop,-outer-topic-reference-in-loop-body/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-unbound-topic,-do-expression,-while-loop,-outer-topic-reference-in-loop-body/output.json new file mode 100644 index 000000000000..899a06650593 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-unbound-topic,-do-expression,-while-loop,-outer-topic-reference-in-loop-body/output.json @@ -0,0 +1,266 @@ +{ + "type": "File", + "start": 0, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 38 + } + }, + "errors": [ + "SyntaxError: Topic reference was used in a lexical context without topic binding (1:34)", + "SyntaxError: Pipeline is in topic style but does not use topic reference (1:9)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 38 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 38 + } + }, + "expression": { + "type": "BinaryExpression", + "start": 0, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 38 + } + }, + "left": { + "type": "Identifier", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + }, + "identifierName": "value" + }, + "name": "value" + }, + "operator": "|>", + "right": { + "type": "PipelineTopicExpression", + "start": 9, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 38 + } + }, + "expression": { + "type": "DoExpression", + "start": 9, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 38 + } + }, + "body": { + "type": "BlockStatement", + "start": 12, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 38 + } + }, + "body": [ + { + "type": "WhileStatement", + "start": 14, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "test": { + "type": "BinaryExpression", + "start": 21, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "left": { + "type": "Identifier", + "start": 21, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + }, + "identifierName": "x" + }, + "name": "x" + }, + "operator": "<", + "right": { + "type": "NumericLiteral", + "start": 25, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "extra": { + "rawValue": 50, + "raw": "50" + }, + "value": 50 + } + }, + "body": { + "type": "ExpressionStatement", + "start": 29, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 29, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "operator": "+=", + "left": { + "type": "Identifier", + "start": 29, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 30 + }, + "identifierName": "x" + }, + "name": "x" + }, + "right": { + "type": "PipelinePrimaryTopicReference", + "start": 34, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 34 + }, + "end": { + "line": 1, + "column": 35 + } + } + } + } + } + } + ], + "directives": [] + } + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-unbound-topic,-do-expression,-with-statement,-outer-topic-reference-in-with-body/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-unbound-topic,-do-expression,-with-statement,-outer-topic-reference-in-with-body/options.json index fee1ffebc044..edb7679c6a74 100644 --- a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-unbound-topic,-do-expression,-with-statement,-outer-topic-reference-in-with-body/options.json +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-unbound-topic,-do-expression,-with-statement,-outer-topic-reference-in-with-body/options.json @@ -1,4 +1,3 @@ { - "plugins": [["pipelineOperator", { "proposal": "smart" }], "doExpressions"], - "throws": "Topic reference was used in a lexical context without topic binding (1:24)" + "plugins": [["pipelineOperator", { "proposal": "smart" }], "doExpressions"] } diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-unbound-topic,-do-expression,-with-statement,-outer-topic-reference-in-with-body/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-unbound-topic,-do-expression,-with-statement,-outer-topic-reference-in-with-body/output.json new file mode 100644 index 000000000000..a185b5983604 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-unbound-topic,-do-expression,-with-statement,-outer-topic-reference-in-with-body/output.json @@ -0,0 +1,196 @@ +{ + "type": "File", + "start": 0, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "errors": [ + "SyntaxError: Topic reference was used in a lexical context without topic binding (1:24)", + "SyntaxError: Pipeline is in topic style but does not use topic reference (1:9)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "expression": { + "type": "BinaryExpression", + "start": 0, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "left": { + "type": "Identifier", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + }, + "identifierName": "value" + }, + "name": "value" + }, + "operator": "|>", + "right": { + "type": "PipelineTopicExpression", + "start": 9, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "expression": { + "type": "DoExpression", + "start": 9, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "body": { + "type": "BlockStatement", + "start": 12, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "body": [ + { + "type": "WithStatement", + "start": 14, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "object": { + "type": "ObjectExpression", + "start": 20, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "properties": [] + }, + "body": { + "type": "ExpressionStatement", + "start": 24, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "expression": { + "type": "PipelinePrimaryTopicReference", + "start": 24, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 + } + } + } + } + } + ], + "directives": [] + } + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-unbound-topic,-inner-class-in-pipeline-body/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-unbound-topic,-inner-class-in-pipeline-body/options.json index 6401af97db12..17e4e327bbad 100644 --- a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-unbound-topic,-inner-class-in-pipeline-body/options.json +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-unbound-topic,-inner-class-in-pipeline-body/options.json @@ -1,4 +1,3 @@ { - "plugins": [["pipelineOperator", { "proposal": "smart" }]], - "throws": "Topic reference was used in a lexical context without topic binding (1:39)" + "plugins": [["pipelineOperator", { "proposal": "smart" }]] } diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-unbound-topic,-inner-class-in-pipeline-body/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-unbound-topic,-inner-class-in-pipeline-body/output.json new file mode 100644 index 000000000000..64fb49d7358b --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-unbound-topic,-inner-class-in-pipeline-body/output.json @@ -0,0 +1,287 @@ +{ + "type": "File", + "start": 0, + "end": 45, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 45 + } + }, + "errors": [ + "SyntaxError: Topic reference was used in a lexical context without topic binding (1:39)", + "SyntaxError: Pipeline is in topic style but does not use topic reference (1:5)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 45, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 45 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 45, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 45 + } + }, + "expression": { + "type": "BinaryExpression", + "start": 0, + "end": 45, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 45 + } + }, + "left": { + "type": "Identifier", + "start": 0, + "end": 1, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + }, + "identifierName": "x" + }, + "name": "x" + }, + "operator": "|>", + "right": { + "type": "PipelineTopicExpression", + "start": 5, + "end": 45, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 45 + } + }, + "expression": { + "type": "ClassExpression", + "start": 5, + "end": 45, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 45 + } + }, + "id": null, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 11, + "end": 45, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 45 + } + }, + "body": [ + { + "type": "ClassMethod", + "start": 13, + "end": 43, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 43 + } + }, + "static": false, + "key": { + "type": "Identifier", + "start": 13, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 24 + }, + "identifierName": "constructor" + }, + "name": "constructor" + }, + "computed": false, + "kind": "constructor", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 28, + "end": 43, + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 43 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 30, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 41 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 30, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 40 + } + }, + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 30, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "object": { + "type": "ThisExpression", + "start": 30, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 34 + } + } + }, + "property": { + "type": "Identifier", + "start": 35, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 35 + }, + "end": { + "line": 1, + "column": 36 + }, + "identifierName": "x" + }, + "name": "x" + }, + "computed": false + }, + "right": { + "type": "PipelinePrimaryTopicReference", + "start": 39, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 39 + }, + "end": { + "line": 1, + "column": 40 + } + } + } + } + } + ], + "directives": [] + } + } + ] + } + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-unbound-topic,-inner-function-in-pipeline-body/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-unbound-topic,-inner-function-in-pipeline-body/options.json index e6731253189f..17e4e327bbad 100644 --- a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-unbound-topic,-inner-function-in-pipeline-body/options.json +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-unbound-topic,-inner-function-in-pipeline-body/options.json @@ -1,4 +1,3 @@ { - "plugins": [["pipelineOperator", { "proposal": "smart" }]], - "throws": "Topic reference was used in a lexical context without topic binding (1:19)" + "plugins": [["pipelineOperator", { "proposal": "smart" }]] } diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-unbound-topic,-inner-function-in-pipeline-body/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-unbound-topic,-inner-function-in-pipeline-body/output.json new file mode 100644 index 000000000000..df16ab34e48b --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-unbound-topic,-inner-function-in-pipeline-body/output.json @@ -0,0 +1,169 @@ +{ + "type": "File", + "start": 0, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "errors": [ + "SyntaxError: Topic reference was used in a lexical context without topic binding (1:19)", + "SyntaxError: Pipeline is in topic style but does not use topic reference (1:5)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "expression": { + "type": "BinaryExpression", + "start": 0, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "left": { + "type": "Identifier", + "start": 0, + "end": 1, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + }, + "identifierName": "x" + }, + "name": "x" + }, + "operator": "|>", + "right": { + "type": "PipelineTopicExpression", + "start": 5, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "expression": { + "type": "FunctionExpression", + "start": 5, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 19, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "expression": { + "type": "PipelinePrimaryTopicReference", + "start": 19, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + } + } + } + ], + "directives": [] + } + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-unbound-topic,-pipeline-head-in-inner-function-in-pipeline-body/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-unbound-topic,-pipeline-head-in-inner-function-in-pipeline-body/options.json index e6731253189f..17e4e327bbad 100644 --- a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-unbound-topic,-pipeline-head-in-inner-function-in-pipeline-body/options.json +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-unbound-topic,-pipeline-head-in-inner-function-in-pipeline-body/options.json @@ -1,4 +1,3 @@ { - "plugins": [["pipelineOperator", { "proposal": "smart" }]], - "throws": "Topic reference was used in a lexical context without topic binding (1:19)" + "plugins": [["pipelineOperator", { "proposal": "smart" }]] } diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-unbound-topic,-pipeline-head-in-inner-function-in-pipeline-body/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-unbound-topic,-pipeline-head-in-inner-function-in-pipeline-body/output.json new file mode 100644 index 000000000000..0023723944ac --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-unbound-topic,-pipeline-head-in-inner-function-in-pipeline-body/output.json @@ -0,0 +1,215 @@ +{ + "type": "File", + "start": 0, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "errors": [ + "SyntaxError: Topic reference was used in a lexical context without topic binding (1:19)", + "SyntaxError: Pipeline is in topic style but does not use topic reference (1:5)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "expression": { + "type": "BinaryExpression", + "start": 0, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "left": { + "type": "Identifier", + "start": 0, + "end": 1, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + }, + "identifierName": "x" + }, + "name": "x" + }, + "operator": "|>", + "right": { + "type": "PipelineTopicExpression", + "start": 5, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "expression": { + "type": "FunctionExpression", + "start": 5, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 19, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "expression": { + "type": "BinaryExpression", + "start": 19, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "left": { + "type": "PipelinePrimaryTopicReference", + "start": 19, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + "operator": "|>", + "right": { + "type": "PipelineTopicExpression", + "start": 24, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "expression": { + "type": "PipelinePrimaryTopicReference", + "start": 24, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 + } + } + } + } + } + } + ], + "directives": [] + } + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/1/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/1/options.json deleted file mode 100644 index fd4da953a419..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/1/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/1/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/1/output.json new file mode 100644 index 000000000000..f2d99c02f8f3 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/1/output.json @@ -0,0 +1,91 @@ +{ + "type": "File", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "expression": { + "type": "TemplateLiteral", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "expressions": [], + "quasis": [ + { + "type": "TemplateElement", + "start": 1, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "value": { + "raw": "\\01", + "cooked": null + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/10/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/10/options.json deleted file mode 100644 index fd4da953a419..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/10/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/10/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/10/output.json new file mode 100644 index 000000000000..84ac3db2b3e5 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/10/output.json @@ -0,0 +1,132 @@ +{ + "type": "File", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "expression": { + "type": "TemplateLiteral", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "expressions": [ + { + "type": "NumericLiteral", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + ], + "quasis": [ + { + "type": "TemplateElement", + "start": 1, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "value": { + "raw": "\\xg", + "cooked": null + }, + "tail": false + }, + { + "type": "TemplateElement", + "start": 8, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "value": { + "raw": "right", + "cooked": "right" + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/11/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/11/options.json deleted file mode 100644 index 27524e2b1f49..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/11/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:10)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/11/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/11/output.json new file mode 100644 index 000000000000..ad1bda1a1fbc --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/11/output.json @@ -0,0 +1,132 @@ +{ + "type": "File", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:10)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "expression": { + "type": "TemplateLiteral", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "expressions": [ + { + "type": "NumericLiteral", + "start": 7, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + ], + "quasis": [ + { + "type": "TemplateElement", + "start": 1, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "value": { + "raw": "left", + "cooked": "left" + }, + "tail": false + }, + { + "type": "TemplateElement", + "start": 9, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "value": { + "raw": "\\xg", + "cooked": null + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/12/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/12/options.json deleted file mode 100644 index 27524e2b1f49..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/12/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:10)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/12/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/12/output.json new file mode 100644 index 000000000000..5c60a91a9482 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/12/output.json @@ -0,0 +1,172 @@ +{ + "type": "File", + "start": 0, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:10)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "expression": { + "type": "TemplateLiteral", + "start": 0, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "expressions": [ + { + "type": "NumericLiteral", + "start": 7, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + }, + { + "type": "NumericLiteral", + "start": 14, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + ], + "quasis": [ + { + "type": "TemplateElement", + "start": 1, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "value": { + "raw": "left", + "cooked": "left" + }, + "tail": false + }, + { + "type": "TemplateElement", + "start": 9, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "value": { + "raw": "\\xg", + "cooked": null + }, + "tail": false + }, + { + "type": "TemplateElement", + "start": 16, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "value": { + "raw": "right", + "cooked": "right" + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/13/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/13/options.json deleted file mode 100644 index fd4da953a419..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/13/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/13/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/13/output.json new file mode 100644 index 000000000000..76b845845cea --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/13/output.json @@ -0,0 +1,91 @@ +{ + "type": "File", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "expression": { + "type": "TemplateLiteral", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "expressions": [], + "quasis": [ + { + "type": "TemplateElement", + "start": 1, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "value": { + "raw": "\\xAg", + "cooked": null + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/14/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/14/options.json deleted file mode 100644 index fd4da953a419..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/14/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/14/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/14/output.json new file mode 100644 index 000000000000..6dd7932c623a --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/14/output.json @@ -0,0 +1,132 @@ +{ + "type": "File", + "start": 0, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "expression": { + "type": "TemplateLiteral", + "start": 0, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "expressions": [ + { + "type": "NumericLiteral", + "start": 7, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + ], + "quasis": [ + { + "type": "TemplateElement", + "start": 1, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "value": { + "raw": "\\xAg", + "cooked": null + }, + "tail": false + }, + { + "type": "TemplateElement", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "value": { + "raw": "right", + "cooked": "right" + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/15/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/15/options.json deleted file mode 100644 index 27524e2b1f49..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/15/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:10)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/15/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/15/output.json new file mode 100644 index 000000000000..46ca5191adb2 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/15/output.json @@ -0,0 +1,132 @@ +{ + "type": "File", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:10)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "expression": { + "type": "TemplateLiteral", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "expressions": [ + { + "type": "NumericLiteral", + "start": 7, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + ], + "quasis": [ + { + "type": "TemplateElement", + "start": 1, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "value": { + "raw": "left", + "cooked": "left" + }, + "tail": false + }, + { + "type": "TemplateElement", + "start": 9, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "value": { + "raw": "\\xAg", + "cooked": null + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/16/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/16/options.json deleted file mode 100644 index 27524e2b1f49..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/16/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:10)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/16/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/16/output.json new file mode 100644 index 000000000000..b050c973d652 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/16/output.json @@ -0,0 +1,172 @@ +{ + "type": "File", + "start": 0, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:10)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "expression": { + "type": "TemplateLiteral", + "start": 0, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "expressions": [ + { + "type": "NumericLiteral", + "start": 7, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + }, + { + "type": "NumericLiteral", + "start": 15, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + ], + "quasis": [ + { + "type": "TemplateElement", + "start": 1, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "value": { + "raw": "left", + "cooked": "left" + }, + "tail": false + }, + { + "type": "TemplateElement", + "start": 9, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "value": { + "raw": "\\xAg", + "cooked": null + }, + "tail": false + }, + { + "type": "TemplateElement", + "start": 17, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "value": { + "raw": "right", + "cooked": "right" + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/17/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/17/options.json deleted file mode 100644 index fd4da953a419..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/17/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/17/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/17/output.json new file mode 100644 index 000000000000..5876338e6e3c --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/17/output.json @@ -0,0 +1,91 @@ +{ + "type": "File", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "expression": { + "type": "TemplateLiteral", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "expressions": [], + "quasis": [ + { + "type": "TemplateElement", + "start": 1, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "value": { + "raw": "\\u0", + "cooked": null + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/18/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/18/options.json deleted file mode 100644 index fd4da953a419..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/18/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/18/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/18/output.json new file mode 100644 index 000000000000..ab51dae8c74a --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/18/output.json @@ -0,0 +1,132 @@ +{ + "type": "File", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "expression": { + "type": "TemplateLiteral", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "expressions": [ + { + "type": "NumericLiteral", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + ], + "quasis": [ + { + "type": "TemplateElement", + "start": 1, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "value": { + "raw": "\\u0", + "cooked": null + }, + "tail": false + }, + { + "type": "TemplateElement", + "start": 8, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "value": { + "raw": "right", + "cooked": "right" + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/19/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/19/options.json deleted file mode 100644 index 27524e2b1f49..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/19/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:10)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/19/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/19/output.json new file mode 100644 index 000000000000..7e0fe1f7af88 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/19/output.json @@ -0,0 +1,132 @@ +{ + "type": "File", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:10)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "expression": { + "type": "TemplateLiteral", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "expressions": [ + { + "type": "NumericLiteral", + "start": 7, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + ], + "quasis": [ + { + "type": "TemplateElement", + "start": 1, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "value": { + "raw": "left", + "cooked": "left" + }, + "tail": false + }, + { + "type": "TemplateElement", + "start": 9, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "value": { + "raw": "\\u0", + "cooked": null + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/2/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/2/options.json deleted file mode 100644 index fd4da953a419..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/2/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/2/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/2/output.json new file mode 100644 index 000000000000..05034cfa43af --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/2/output.json @@ -0,0 +1,132 @@ +{ + "type": "File", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "expression": { + "type": "TemplateLiteral", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "expressions": [ + { + "type": "NumericLiteral", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + ], + "quasis": [ + { + "type": "TemplateElement", + "start": 1, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "value": { + "raw": "\\01", + "cooked": null + }, + "tail": false + }, + { + "type": "TemplateElement", + "start": 8, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "value": { + "raw": "right", + "cooked": "right" + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/20/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/20/options.json deleted file mode 100644 index 27524e2b1f49..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/20/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:10)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/20/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/20/output.json new file mode 100644 index 000000000000..4daf639555aa --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/20/output.json @@ -0,0 +1,172 @@ +{ + "type": "File", + "start": 0, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:10)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "expression": { + "type": "TemplateLiteral", + "start": 0, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "expressions": [ + { + "type": "NumericLiteral", + "start": 7, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + }, + { + "type": "NumericLiteral", + "start": 14, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + ], + "quasis": [ + { + "type": "TemplateElement", + "start": 1, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "value": { + "raw": "left", + "cooked": "left" + }, + "tail": false + }, + { + "type": "TemplateElement", + "start": 9, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "value": { + "raw": "\\u0", + "cooked": null + }, + "tail": false + }, + { + "type": "TemplateElement", + "start": 16, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "value": { + "raw": "right", + "cooked": "right" + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/21/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/21/options.json deleted file mode 100644 index fd4da953a419..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/21/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/21/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/21/output.json new file mode 100644 index 000000000000..93487dccb244 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/21/output.json @@ -0,0 +1,91 @@ +{ + "type": "File", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "expression": { + "type": "TemplateLiteral", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "expressions": [], + "quasis": [ + { + "type": "TemplateElement", + "start": 1, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "value": { + "raw": "\\u0g", + "cooked": null + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/22/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/22/options.json deleted file mode 100644 index fd4da953a419..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/22/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/22/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/22/output.json new file mode 100644 index 000000000000..d90c680f758c --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/22/output.json @@ -0,0 +1,132 @@ +{ + "type": "File", + "start": 0, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "expression": { + "type": "TemplateLiteral", + "start": 0, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "expressions": [ + { + "type": "NumericLiteral", + "start": 7, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + ], + "quasis": [ + { + "type": "TemplateElement", + "start": 1, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "value": { + "raw": "\\u0g", + "cooked": null + }, + "tail": false + }, + { + "type": "TemplateElement", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "value": { + "raw": "right", + "cooked": "right" + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/23/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/23/options.json deleted file mode 100644 index 27524e2b1f49..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/23/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:10)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/23/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/23/output.json new file mode 100644 index 000000000000..11b9589834ce --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/23/output.json @@ -0,0 +1,132 @@ +{ + "type": "File", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:10)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "expression": { + "type": "TemplateLiteral", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "expressions": [ + { + "type": "NumericLiteral", + "start": 7, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + ], + "quasis": [ + { + "type": "TemplateElement", + "start": 1, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "value": { + "raw": "left", + "cooked": "left" + }, + "tail": false + }, + { + "type": "TemplateElement", + "start": 9, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "value": { + "raw": "\\u0g", + "cooked": null + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/24/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/24/options.json deleted file mode 100644 index 27524e2b1f49..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/24/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:10)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/24/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/24/output.json new file mode 100644 index 000000000000..aef068ff0dcb --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/24/output.json @@ -0,0 +1,172 @@ +{ + "type": "File", + "start": 0, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:10)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "expression": { + "type": "TemplateLiteral", + "start": 0, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "expressions": [ + { + "type": "NumericLiteral", + "start": 7, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + }, + { + "type": "NumericLiteral", + "start": 15, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + ], + "quasis": [ + { + "type": "TemplateElement", + "start": 1, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "value": { + "raw": "left", + "cooked": "left" + }, + "tail": false + }, + { + "type": "TemplateElement", + "start": 9, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "value": { + "raw": "\\u0g", + "cooked": null + }, + "tail": false + }, + { + "type": "TemplateElement", + "start": 17, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "value": { + "raw": "right", + "cooked": "right" + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/25/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/25/options.json deleted file mode 100644 index fd4da953a419..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/25/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/25/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/25/output.json new file mode 100644 index 000000000000..83c602cde696 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/25/output.json @@ -0,0 +1,91 @@ +{ + "type": "File", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "expression": { + "type": "TemplateLiteral", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "expressions": [], + "quasis": [ + { + "type": "TemplateElement", + "start": 1, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "value": { + "raw": "\\u00g", + "cooked": null + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/26/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/26/options.json deleted file mode 100644 index fd4da953a419..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/26/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/26/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/26/output.json new file mode 100644 index 000000000000..b775d5821aeb --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/26/output.json @@ -0,0 +1,132 @@ +{ + "type": "File", + "start": 0, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "expression": { + "type": "TemplateLiteral", + "start": 0, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "expressions": [ + { + "type": "NumericLiteral", + "start": 8, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + ], + "quasis": [ + { + "type": "TemplateElement", + "start": 1, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "value": { + "raw": "\\u00g", + "cooked": null + }, + "tail": false + }, + { + "type": "TemplateElement", + "start": 10, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "value": { + "raw": "right", + "cooked": "right" + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/27/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/27/options.json deleted file mode 100644 index 27524e2b1f49..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/27/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:10)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/27/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/27/output.json new file mode 100644 index 000000000000..7bfe8f7bc378 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/27/output.json @@ -0,0 +1,132 @@ +{ + "type": "File", + "start": 0, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:10)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "expression": { + "type": "TemplateLiteral", + "start": 0, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "expressions": [ + { + "type": "NumericLiteral", + "start": 7, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + ], + "quasis": [ + { + "type": "TemplateElement", + "start": 1, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "value": { + "raw": "left", + "cooked": "left" + }, + "tail": false + }, + { + "type": "TemplateElement", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "value": { + "raw": "\\u00g", + "cooked": null + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/28/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/28/options.json deleted file mode 100644 index 27524e2b1f49..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/28/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:10)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/28/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/28/output.json new file mode 100644 index 000000000000..b148595b1c8c --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/28/output.json @@ -0,0 +1,172 @@ +{ + "type": "File", + "start": 0, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:10)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "expression": { + "type": "TemplateLiteral", + "start": 0, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "expressions": [ + { + "type": "NumericLiteral", + "start": 7, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + }, + { + "type": "NumericLiteral", + "start": 16, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + ], + "quasis": [ + { + "type": "TemplateElement", + "start": 1, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "value": { + "raw": "left", + "cooked": "left" + }, + "tail": false + }, + { + "type": "TemplateElement", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "value": { + "raw": "\\u00g", + "cooked": null + }, + "tail": false + }, + { + "type": "TemplateElement", + "start": 18, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "value": { + "raw": "right", + "cooked": "right" + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/29/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/29/options.json deleted file mode 100644 index fd4da953a419..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/29/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/29/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/29/output.json new file mode 100644 index 000000000000..b0e6a55f8b9d --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/29/output.json @@ -0,0 +1,91 @@ +{ + "type": "File", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "expression": { + "type": "TemplateLiteral", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "expressions": [], + "quasis": [ + { + "type": "TemplateElement", + "start": 1, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "value": { + "raw": "\\u000g", + "cooked": null + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/3/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/3/options.json deleted file mode 100644 index 27524e2b1f49..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/3/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:10)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/3/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/3/output.json new file mode 100644 index 000000000000..0d3190ef7f95 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/3/output.json @@ -0,0 +1,132 @@ +{ + "type": "File", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:10)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "expression": { + "type": "TemplateLiteral", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "expressions": [ + { + "type": "NumericLiteral", + "start": 7, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + ], + "quasis": [ + { + "type": "TemplateElement", + "start": 1, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "value": { + "raw": "left", + "cooked": "left" + }, + "tail": false + }, + { + "type": "TemplateElement", + "start": 9, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "value": { + "raw": "\\01", + "cooked": null + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/30/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/30/options.json deleted file mode 100644 index fd4da953a419..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/30/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/30/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/30/output.json new file mode 100644 index 000000000000..a7b5e0bd1bfd --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/30/output.json @@ -0,0 +1,132 @@ +{ + "type": "File", + "start": 0, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "expression": { + "type": "TemplateLiteral", + "start": 0, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "expressions": [ + { + "type": "NumericLiteral", + "start": 9, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + ], + "quasis": [ + { + "type": "TemplateElement", + "start": 1, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "value": { + "raw": "\\u000g", + "cooked": null + }, + "tail": false + }, + { + "type": "TemplateElement", + "start": 11, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "value": { + "raw": "right", + "cooked": "right" + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/31/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/31/options.json deleted file mode 100644 index 27524e2b1f49..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/31/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:10)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/31/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/31/output.json new file mode 100644 index 000000000000..ac3a71555369 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/31/output.json @@ -0,0 +1,132 @@ +{ + "type": "File", + "start": 0, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:10)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "expression": { + "type": "TemplateLiteral", + "start": 0, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "expressions": [ + { + "type": "NumericLiteral", + "start": 7, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + ], + "quasis": [ + { + "type": "TemplateElement", + "start": 1, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "value": { + "raw": "left", + "cooked": "left" + }, + "tail": false + }, + { + "type": "TemplateElement", + "start": 9, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "value": { + "raw": "\\u000g", + "cooked": null + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/32/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/32/options.json deleted file mode 100644 index 27524e2b1f49..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/32/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:10)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/32/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/32/output.json new file mode 100644 index 000000000000..5163754673d0 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/32/output.json @@ -0,0 +1,172 @@ +{ + "type": "File", + "start": 0, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:10)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "expression": { + "type": "TemplateLiteral", + "start": 0, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "expressions": [ + { + "type": "NumericLiteral", + "start": 7, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + }, + { + "type": "NumericLiteral", + "start": 17, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + ], + "quasis": [ + { + "type": "TemplateElement", + "start": 1, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "value": { + "raw": "left", + "cooked": "left" + }, + "tail": false + }, + { + "type": "TemplateElement", + "start": 9, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "value": { + "raw": "\\u000g", + "cooked": null + }, + "tail": false + }, + { + "type": "TemplateElement", + "start": 19, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "value": { + "raw": "right", + "cooked": "right" + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/33/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/33/options.json deleted file mode 100644 index fd4da953a419..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/33/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/33/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/33/output.json new file mode 100644 index 000000000000..2273b5e141cf --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/33/output.json @@ -0,0 +1,91 @@ +{ + "type": "File", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "expression": { + "type": "TemplateLiteral", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "expressions": [], + "quasis": [ + { + "type": "TemplateElement", + "start": 1, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "value": { + "raw": "\\u{}", + "cooked": null + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/34/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/34/options.json deleted file mode 100644 index fd4da953a419..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/34/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/34/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/34/output.json new file mode 100644 index 000000000000..fecd37e4b169 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/34/output.json @@ -0,0 +1,132 @@ +{ + "type": "File", + "start": 0, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "expression": { + "type": "TemplateLiteral", + "start": 0, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "expressions": [ + { + "type": "NumericLiteral", + "start": 7, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + ], + "quasis": [ + { + "type": "TemplateElement", + "start": 1, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "value": { + "raw": "\\u{}", + "cooked": null + }, + "tail": false + }, + { + "type": "TemplateElement", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "value": { + "raw": "right", + "cooked": "right" + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/35/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/35/options.json deleted file mode 100644 index 27524e2b1f49..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/35/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:10)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/35/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/35/output.json new file mode 100644 index 000000000000..83150d31dec6 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/35/output.json @@ -0,0 +1,132 @@ +{ + "type": "File", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:10)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "expression": { + "type": "TemplateLiteral", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "expressions": [ + { + "type": "NumericLiteral", + "start": 7, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + ], + "quasis": [ + { + "type": "TemplateElement", + "start": 1, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "value": { + "raw": "left", + "cooked": "left" + }, + "tail": false + }, + { + "type": "TemplateElement", + "start": 9, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "value": { + "raw": "\\u{}", + "cooked": null + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/36/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/36/options.json deleted file mode 100644 index 27524e2b1f49..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/36/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:10)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/36/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/36/output.json new file mode 100644 index 000000000000..f5d1e7ad2ec7 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/36/output.json @@ -0,0 +1,172 @@ +{ + "type": "File", + "start": 0, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:10)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "expression": { + "type": "TemplateLiteral", + "start": 0, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "expressions": [ + { + "type": "NumericLiteral", + "start": 7, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + }, + { + "type": "NumericLiteral", + "start": 15, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + ], + "quasis": [ + { + "type": "TemplateElement", + "start": 1, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "value": { + "raw": "left", + "cooked": "left" + }, + "tail": false + }, + { + "type": "TemplateElement", + "start": 9, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "value": { + "raw": "\\u{}", + "cooked": null + }, + "tail": false + }, + { + "type": "TemplateElement", + "start": 17, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "value": { + "raw": "right", + "cooked": "right" + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/37/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/37/options.json deleted file mode 100644 index fd4da953a419..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/37/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/37/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/37/output.json new file mode 100644 index 000000000000..1f51bd46894e --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/37/output.json @@ -0,0 +1,91 @@ +{ + "type": "File", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "expression": { + "type": "TemplateLiteral", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "expressions": [], + "quasis": [ + { + "type": "TemplateElement", + "start": 1, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "value": { + "raw": "\\u{-0}", + "cooked": null + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/38/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/38/options.json deleted file mode 100644 index fd4da953a419..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/38/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/38/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/38/output.json new file mode 100644 index 000000000000..2654eccc8ca8 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/38/output.json @@ -0,0 +1,132 @@ +{ + "type": "File", + "start": 0, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "expression": { + "type": "TemplateLiteral", + "start": 0, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "expressions": [ + { + "type": "NumericLiteral", + "start": 9, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + ], + "quasis": [ + { + "type": "TemplateElement", + "start": 1, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "value": { + "raw": "\\u{-0}", + "cooked": null + }, + "tail": false + }, + { + "type": "TemplateElement", + "start": 11, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "value": { + "raw": "right", + "cooked": "right" + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/39/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/39/options.json deleted file mode 100644 index 27524e2b1f49..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/39/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:10)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/39/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/39/output.json new file mode 100644 index 000000000000..b3b301d701b4 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/39/output.json @@ -0,0 +1,132 @@ +{ + "type": "File", + "start": 0, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:10)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "expression": { + "type": "TemplateLiteral", + "start": 0, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "expressions": [ + { + "type": "NumericLiteral", + "start": 7, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + ], + "quasis": [ + { + "type": "TemplateElement", + "start": 1, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "value": { + "raw": "left", + "cooked": "left" + }, + "tail": false + }, + { + "type": "TemplateElement", + "start": 9, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "value": { + "raw": "\\u{-0}", + "cooked": null + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/4/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/4/options.json deleted file mode 100644 index 27524e2b1f49..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/4/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:10)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/4/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/4/output.json new file mode 100644 index 000000000000..1d30df1fa402 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/4/output.json @@ -0,0 +1,172 @@ +{ + "type": "File", + "start": 0, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:10)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "expression": { + "type": "TemplateLiteral", + "start": 0, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "expressions": [ + { + "type": "NumericLiteral", + "start": 7, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + }, + { + "type": "NumericLiteral", + "start": 14, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + ], + "quasis": [ + { + "type": "TemplateElement", + "start": 1, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "value": { + "raw": "left", + "cooked": "left" + }, + "tail": false + }, + { + "type": "TemplateElement", + "start": 9, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "value": { + "raw": "\\01", + "cooked": null + }, + "tail": false + }, + { + "type": "TemplateElement", + "start": 16, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "value": { + "raw": "right", + "cooked": "right" + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/40/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/40/options.json deleted file mode 100644 index 27524e2b1f49..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/40/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:10)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/40/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/40/output.json new file mode 100644 index 000000000000..124c7c8c9d41 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/40/output.json @@ -0,0 +1,172 @@ +{ + "type": "File", + "start": 0, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:10)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "expression": { + "type": "TemplateLiteral", + "start": 0, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "expressions": [ + { + "type": "NumericLiteral", + "start": 7, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + }, + { + "type": "NumericLiteral", + "start": 17, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + ], + "quasis": [ + { + "type": "TemplateElement", + "start": 1, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "value": { + "raw": "left", + "cooked": "left" + }, + "tail": false + }, + { + "type": "TemplateElement", + "start": 9, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "value": { + "raw": "\\u{-0}", + "cooked": null + }, + "tail": false + }, + { + "type": "TemplateElement", + "start": 19, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "value": { + "raw": "right", + "cooked": "right" + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/41/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/41/options.json deleted file mode 100644 index fd4da953a419..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/41/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/41/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/41/output.json new file mode 100644 index 000000000000..e22b35045789 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/41/output.json @@ -0,0 +1,91 @@ +{ + "type": "File", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "expression": { + "type": "TemplateLiteral", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "expressions": [], + "quasis": [ + { + "type": "TemplateElement", + "start": 1, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "value": { + "raw": "\\u{g}", + "cooked": null + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/42/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/42/options.json deleted file mode 100644 index fd4da953a419..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/42/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/42/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/42/output.json new file mode 100644 index 000000000000..e25755bdf0c5 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/42/output.json @@ -0,0 +1,132 @@ +{ + "type": "File", + "start": 0, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "expression": { + "type": "TemplateLiteral", + "start": 0, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "expressions": [ + { + "type": "NumericLiteral", + "start": 8, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + ], + "quasis": [ + { + "type": "TemplateElement", + "start": 1, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "value": { + "raw": "\\u{g}", + "cooked": null + }, + "tail": false + }, + { + "type": "TemplateElement", + "start": 10, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "value": { + "raw": "right", + "cooked": "right" + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/43/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/43/options.json deleted file mode 100644 index 27524e2b1f49..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/43/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:10)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/43/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/43/output.json new file mode 100644 index 000000000000..3dfeb7480fa4 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/43/output.json @@ -0,0 +1,132 @@ +{ + "type": "File", + "start": 0, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:10)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "expression": { + "type": "TemplateLiteral", + "start": 0, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "expressions": [ + { + "type": "NumericLiteral", + "start": 7, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + ], + "quasis": [ + { + "type": "TemplateElement", + "start": 1, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "value": { + "raw": "left", + "cooked": "left" + }, + "tail": false + }, + { + "type": "TemplateElement", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "value": { + "raw": "\\u{g}", + "cooked": null + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/44/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/44/options.json deleted file mode 100644 index 27524e2b1f49..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/44/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:10)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/44/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/44/output.json new file mode 100644 index 000000000000..8da7d9e51bdf --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/44/output.json @@ -0,0 +1,172 @@ +{ + "type": "File", + "start": 0, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:10)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "expression": { + "type": "TemplateLiteral", + "start": 0, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "expressions": [ + { + "type": "NumericLiteral", + "start": 7, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + }, + { + "type": "NumericLiteral", + "start": 16, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + ], + "quasis": [ + { + "type": "TemplateElement", + "start": 1, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "value": { + "raw": "left", + "cooked": "left" + }, + "tail": false + }, + { + "type": "TemplateElement", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "value": { + "raw": "\\u{g}", + "cooked": null + }, + "tail": false + }, + { + "type": "TemplateElement", + "start": 18, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "value": { + "raw": "right", + "cooked": "right" + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/45/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/45/options.json deleted file mode 100644 index fd4da953a419..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/45/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/45/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/45/output.json new file mode 100644 index 000000000000..07b00d61949a --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/45/output.json @@ -0,0 +1,91 @@ +{ + "type": "File", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "expression": { + "type": "TemplateLiteral", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "expressions": [], + "quasis": [ + { + "type": "TemplateElement", + "start": 1, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "value": { + "raw": "\\u{", + "cooked": null + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/46/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/46/options.json deleted file mode 100644 index fd4da953a419..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/46/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/46/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/46/output.json new file mode 100644 index 000000000000..b03d29b7821a --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/46/output.json @@ -0,0 +1,132 @@ +{ + "type": "File", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "expression": { + "type": "TemplateLiteral", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "expressions": [ + { + "type": "NumericLiteral", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + ], + "quasis": [ + { + "type": "TemplateElement", + "start": 1, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "value": { + "raw": "\\u{", + "cooked": null + }, + "tail": false + }, + { + "type": "TemplateElement", + "start": 8, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "value": { + "raw": "right", + "cooked": "right" + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/47/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/47/options.json deleted file mode 100644 index 27524e2b1f49..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/47/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:10)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/47/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/47/output.json new file mode 100644 index 000000000000..dab814bd833d --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/47/output.json @@ -0,0 +1,132 @@ +{ + "type": "File", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:10)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "expression": { + "type": "TemplateLiteral", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "expressions": [ + { + "type": "NumericLiteral", + "start": 7, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + ], + "quasis": [ + { + "type": "TemplateElement", + "start": 1, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "value": { + "raw": "left", + "cooked": "left" + }, + "tail": false + }, + { + "type": "TemplateElement", + "start": 9, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "value": { + "raw": "\\u{", + "cooked": null + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/48/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/48/options.json deleted file mode 100644 index 27524e2b1f49..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/48/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:10)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/48/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/48/output.json new file mode 100644 index 000000000000..28b0d47818c9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/48/output.json @@ -0,0 +1,172 @@ +{ + "type": "File", + "start": 0, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:10)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "expression": { + "type": "TemplateLiteral", + "start": 0, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "expressions": [ + { + "type": "NumericLiteral", + "start": 7, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + }, + { + "type": "NumericLiteral", + "start": 14, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + ], + "quasis": [ + { + "type": "TemplateElement", + "start": 1, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "value": { + "raw": "left", + "cooked": "left" + }, + "tail": false + }, + { + "type": "TemplateElement", + "start": 9, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "value": { + "raw": "\\u{", + "cooked": null + }, + "tail": false + }, + { + "type": "TemplateElement", + "start": 16, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "value": { + "raw": "right", + "cooked": "right" + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/49/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/49/options.json deleted file mode 100644 index fd4da953a419..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/49/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/49/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/49/output.json new file mode 100644 index 000000000000..0c1f9bcd5045 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/49/output.json @@ -0,0 +1,91 @@ +{ + "type": "File", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "expression": { + "type": "TemplateLiteral", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "expressions": [], + "quasis": [ + { + "type": "TemplateElement", + "start": 1, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "value": { + "raw": "\\u{\\\\", + "cooked": null + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/5/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/5/options.json deleted file mode 100644 index fd4da953a419..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/5/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/5/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/5/output.json new file mode 100644 index 000000000000..6ce800288f9a --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/5/output.json @@ -0,0 +1,91 @@ +{ + "type": "File", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "expression": { + "type": "TemplateLiteral", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "expressions": [], + "quasis": [ + { + "type": "TemplateElement", + "start": 1, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "value": { + "raw": "\\1", + "cooked": null + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/50/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/50/options.json deleted file mode 100644 index fd4da953a419..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/50/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/50/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/50/output.json new file mode 100644 index 000000000000..2e283e2f77c8 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/50/output.json @@ -0,0 +1,132 @@ +{ + "type": "File", + "start": 0, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "expression": { + "type": "TemplateLiteral", + "start": 0, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "expressions": [ + { + "type": "NumericLiteral", + "start": 8, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + ], + "quasis": [ + { + "type": "TemplateElement", + "start": 1, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "value": { + "raw": "\\u{\\\\", + "cooked": null + }, + "tail": false + }, + { + "type": "TemplateElement", + "start": 10, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "value": { + "raw": "right", + "cooked": "right" + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/51/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/51/options.json deleted file mode 100644 index 27524e2b1f49..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/51/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:10)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/51/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/51/output.json new file mode 100644 index 000000000000..151b718a43f4 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/51/output.json @@ -0,0 +1,132 @@ +{ + "type": "File", + "start": 0, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:10)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "expression": { + "type": "TemplateLiteral", + "start": 0, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "expressions": [ + { + "type": "NumericLiteral", + "start": 7, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + ], + "quasis": [ + { + "type": "TemplateElement", + "start": 1, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "value": { + "raw": "left", + "cooked": "left" + }, + "tail": false + }, + { + "type": "TemplateElement", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "value": { + "raw": "\\u{\\\\", + "cooked": null + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/52/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/52/options.json deleted file mode 100644 index 27524e2b1f49..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/52/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:10)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/52/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/52/output.json new file mode 100644 index 000000000000..0ca0c69ed03d --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/52/output.json @@ -0,0 +1,172 @@ +{ + "type": "File", + "start": 0, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:10)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "expression": { + "type": "TemplateLiteral", + "start": 0, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "expressions": [ + { + "type": "NumericLiteral", + "start": 7, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + }, + { + "type": "NumericLiteral", + "start": 16, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + ], + "quasis": [ + { + "type": "TemplateElement", + "start": 1, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "value": { + "raw": "left", + "cooked": "left" + }, + "tail": false + }, + { + "type": "TemplateElement", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "value": { + "raw": "\\u{\\\\", + "cooked": null + }, + "tail": false + }, + { + "type": "TemplateElement", + "start": 18, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "value": { + "raw": "right", + "cooked": "right" + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/53/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/53/options.json deleted file mode 100644 index fd4da953a419..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/53/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/53/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/53/output.json new file mode 100644 index 000000000000..eb1dc9edcf28 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/53/output.json @@ -0,0 +1,91 @@ +{ + "type": "File", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "expression": { + "type": "TemplateLiteral", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "expressions": [], + "quasis": [ + { + "type": "TemplateElement", + "start": 1, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "value": { + "raw": "\\u{\\`", + "cooked": null + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/54/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/54/options.json deleted file mode 100644 index fd4da953a419..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/54/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/54/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/54/output.json new file mode 100644 index 000000000000..a0df02ed0394 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/54/output.json @@ -0,0 +1,132 @@ +{ + "type": "File", + "start": 0, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "expression": { + "type": "TemplateLiteral", + "start": 0, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "expressions": [ + { + "type": "NumericLiteral", + "start": 8, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + ], + "quasis": [ + { + "type": "TemplateElement", + "start": 1, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "value": { + "raw": "\\u{\\`", + "cooked": null + }, + "tail": false + }, + { + "type": "TemplateElement", + "start": 10, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "value": { + "raw": "right", + "cooked": "right" + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/55/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/55/options.json deleted file mode 100644 index 27524e2b1f49..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/55/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:10)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/55/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/55/output.json new file mode 100644 index 000000000000..b757f165c1ee --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/55/output.json @@ -0,0 +1,132 @@ +{ + "type": "File", + "start": 0, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:10)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "expression": { + "type": "TemplateLiteral", + "start": 0, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "expressions": [ + { + "type": "NumericLiteral", + "start": 7, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + ], + "quasis": [ + { + "type": "TemplateElement", + "start": 1, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "value": { + "raw": "left", + "cooked": "left" + }, + "tail": false + }, + { + "type": "TemplateElement", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "value": { + "raw": "\\u{\\`", + "cooked": null + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/56/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/56/options.json deleted file mode 100644 index 27524e2b1f49..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/56/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:10)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/56/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/56/output.json new file mode 100644 index 000000000000..8ee240a36baf --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/56/output.json @@ -0,0 +1,172 @@ +{ + "type": "File", + "start": 0, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:10)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "expression": { + "type": "TemplateLiteral", + "start": 0, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "expressions": [ + { + "type": "NumericLiteral", + "start": 7, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + }, + { + "type": "NumericLiteral", + "start": 16, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + ], + "quasis": [ + { + "type": "TemplateElement", + "start": 1, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "value": { + "raw": "left", + "cooked": "left" + }, + "tail": false + }, + { + "type": "TemplateElement", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "value": { + "raw": "\\u{\\`", + "cooked": null + }, + "tail": false + }, + { + "type": "TemplateElement", + "start": 18, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "value": { + "raw": "right", + "cooked": "right" + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/57/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/57/options.json deleted file mode 100644 index fd4da953a419..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/57/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/57/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/57/output.json new file mode 100644 index 000000000000..1450743b5caa --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/57/output.json @@ -0,0 +1,91 @@ +{ + "type": "File", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "expression": { + "type": "TemplateLiteral", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "expressions": [], + "quasis": [ + { + "type": "TemplateElement", + "start": 1, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "value": { + "raw": "\\u{0", + "cooked": null + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/58/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/58/options.json deleted file mode 100644 index fd4da953a419..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/58/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/58/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/58/output.json new file mode 100644 index 000000000000..24b6f69d7f38 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/58/output.json @@ -0,0 +1,132 @@ +{ + "type": "File", + "start": 0, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "expression": { + "type": "TemplateLiteral", + "start": 0, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "expressions": [ + { + "type": "NumericLiteral", + "start": 7, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + ], + "quasis": [ + { + "type": "TemplateElement", + "start": 1, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "value": { + "raw": "\\u{0", + "cooked": null + }, + "tail": false + }, + { + "type": "TemplateElement", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "value": { + "raw": "right", + "cooked": "right" + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/59/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/59/options.json deleted file mode 100644 index 27524e2b1f49..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/59/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:10)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/59/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/59/output.json new file mode 100644 index 000000000000..26af843c60e5 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/59/output.json @@ -0,0 +1,132 @@ +{ + "type": "File", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:10)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "expression": { + "type": "TemplateLiteral", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "expressions": [ + { + "type": "NumericLiteral", + "start": 7, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + ], + "quasis": [ + { + "type": "TemplateElement", + "start": 1, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "value": { + "raw": "left", + "cooked": "left" + }, + "tail": false + }, + { + "type": "TemplateElement", + "start": 9, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "value": { + "raw": "\\u{0", + "cooked": null + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/6/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/6/options.json deleted file mode 100644 index fd4da953a419..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/6/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/6/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/6/output.json new file mode 100644 index 000000000000..cf4eef5577aa --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/6/output.json @@ -0,0 +1,132 @@ +{ + "type": "File", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "expression": { + "type": "TemplateLiteral", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "expressions": [ + { + "type": "NumericLiteral", + "start": 5, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + ], + "quasis": [ + { + "type": "TemplateElement", + "start": 1, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "value": { + "raw": "\\1", + "cooked": null + }, + "tail": false + }, + { + "type": "TemplateElement", + "start": 7, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "value": { + "raw": "right", + "cooked": "right" + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/60/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/60/options.json deleted file mode 100644 index 27524e2b1f49..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/60/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:10)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/60/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/60/output.json new file mode 100644 index 000000000000..ad94447a587d --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/60/output.json @@ -0,0 +1,172 @@ +{ + "type": "File", + "start": 0, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:10)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "expression": { + "type": "TemplateLiteral", + "start": 0, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "expressions": [ + { + "type": "NumericLiteral", + "start": 7, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + }, + { + "type": "NumericLiteral", + "start": 15, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + ], + "quasis": [ + { + "type": "TemplateElement", + "start": 1, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "value": { + "raw": "left", + "cooked": "left" + }, + "tail": false + }, + { + "type": "TemplateElement", + "start": 9, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "value": { + "raw": "\\u{0", + "cooked": null + }, + "tail": false + }, + { + "type": "TemplateElement", + "start": 17, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "value": { + "raw": "right", + "cooked": "right" + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/61/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/61/options.json deleted file mode 100644 index fd4da953a419..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/61/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/61/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/61/output.json new file mode 100644 index 000000000000..c1f7f255feb4 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/61/output.json @@ -0,0 +1,91 @@ +{ + "type": "File", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "expression": { + "type": "TemplateLiteral", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "expressions": [], + "quasis": [ + { + "type": "TemplateElement", + "start": 1, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "value": { + "raw": "\\u{\\u{0}", + "cooked": null + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/62/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/62/options.json deleted file mode 100644 index fd4da953a419..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/62/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/62/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/62/output.json new file mode 100644 index 000000000000..5782d9c9baef --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/62/output.json @@ -0,0 +1,132 @@ +{ + "type": "File", + "start": 0, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "expression": { + "type": "TemplateLiteral", + "start": 0, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "expressions": [ + { + "type": "NumericLiteral", + "start": 11, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + ], + "quasis": [ + { + "type": "TemplateElement", + "start": 1, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "value": { + "raw": "\\u{\\u{0}", + "cooked": null + }, + "tail": false + }, + { + "type": "TemplateElement", + "start": 13, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "value": { + "raw": "right", + "cooked": "right" + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/63/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/63/options.json deleted file mode 100644 index 27524e2b1f49..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/63/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:10)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/63/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/63/output.json new file mode 100644 index 000000000000..2c3d41a7a407 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/63/output.json @@ -0,0 +1,132 @@ +{ + "type": "File", + "start": 0, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:10)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "expression": { + "type": "TemplateLiteral", + "start": 0, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "expressions": [ + { + "type": "NumericLiteral", + "start": 7, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + ], + "quasis": [ + { + "type": "TemplateElement", + "start": 1, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "value": { + "raw": "left", + "cooked": "left" + }, + "tail": false + }, + { + "type": "TemplateElement", + "start": 9, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "value": { + "raw": "\\u{\\u{0}", + "cooked": null + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/64/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/64/options.json deleted file mode 100644 index 27524e2b1f49..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/64/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:10)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/64/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/64/output.json new file mode 100644 index 000000000000..4dccbdb5cd3d --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/64/output.json @@ -0,0 +1,172 @@ +{ + "type": "File", + "start": 0, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:10)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "expression": { + "type": "TemplateLiteral", + "start": 0, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "expressions": [ + { + "type": "NumericLiteral", + "start": 7, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + }, + { + "type": "NumericLiteral", + "start": 19, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + ], + "quasis": [ + { + "type": "TemplateElement", + "start": 1, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "value": { + "raw": "left", + "cooked": "left" + }, + "tail": false + }, + { + "type": "TemplateElement", + "start": 9, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "value": { + "raw": "\\u{\\u{0}", + "cooked": null + }, + "tail": false + }, + { + "type": "TemplateElement", + "start": 21, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "value": { + "raw": "right", + "cooked": "right" + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/65/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/65/options.json deleted file mode 100644 index fd4da953a419..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/65/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/65/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/65/output.json new file mode 100644 index 000000000000..ae5fba46a8cd --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/65/output.json @@ -0,0 +1,91 @@ +{ + "type": "File", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "expression": { + "type": "TemplateLiteral", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "expressions": [], + "quasis": [ + { + "type": "TemplateElement", + "start": 1, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "value": { + "raw": "\\u{110000}", + "cooked": null + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/66/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/66/options.json deleted file mode 100644 index fd4da953a419..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/66/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/66/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/66/output.json new file mode 100644 index 000000000000..ea93f11c4126 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/66/output.json @@ -0,0 +1,132 @@ +{ + "type": "File", + "start": 0, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "expression": { + "type": "TemplateLiteral", + "start": 0, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "expressions": [ + { + "type": "NumericLiteral", + "start": 13, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + ], + "quasis": [ + { + "type": "TemplateElement", + "start": 1, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "value": { + "raw": "\\u{110000}", + "cooked": null + }, + "tail": false + }, + { + "type": "TemplateElement", + "start": 15, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "value": { + "raw": "right", + "cooked": "right" + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/67/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/67/options.json deleted file mode 100644 index 27524e2b1f49..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/67/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:10)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/67/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/67/output.json new file mode 100644 index 000000000000..a37b45899de0 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/67/output.json @@ -0,0 +1,132 @@ +{ + "type": "File", + "start": 0, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:10)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "expression": { + "type": "TemplateLiteral", + "start": 0, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "expressions": [ + { + "type": "NumericLiteral", + "start": 7, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + ], + "quasis": [ + { + "type": "TemplateElement", + "start": 1, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "value": { + "raw": "left", + "cooked": "left" + }, + "tail": false + }, + { + "type": "TemplateElement", + "start": 9, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "value": { + "raw": "\\u{110000}", + "cooked": null + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/68/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/68/options.json deleted file mode 100644 index 27524e2b1f49..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/68/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:10)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/68/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/68/output.json new file mode 100644 index 000000000000..22154057933d --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/68/output.json @@ -0,0 +1,172 @@ +{ + "type": "File", + "start": 0, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:10)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "expression": { + "type": "TemplateLiteral", + "start": 0, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "expressions": [ + { + "type": "NumericLiteral", + "start": 7, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + }, + { + "type": "NumericLiteral", + "start": 21, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + ], + "quasis": [ + { + "type": "TemplateElement", + "start": 1, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "value": { + "raw": "left", + "cooked": "left" + }, + "tail": false + }, + { + "type": "TemplateElement", + "start": 9, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "value": { + "raw": "\\u{110000}", + "cooked": null + }, + "tail": false + }, + { + "type": "TemplateElement", + "start": 23, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "value": { + "raw": "right", + "cooked": "right" + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/7/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/7/options.json deleted file mode 100644 index 27524e2b1f49..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/7/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:10)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/7/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/7/output.json new file mode 100644 index 000000000000..ce27b82a7d1e --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/7/output.json @@ -0,0 +1,132 @@ +{ + "type": "File", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:10)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "expression": { + "type": "TemplateLiteral", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "expressions": [ + { + "type": "NumericLiteral", + "start": 7, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + ], + "quasis": [ + { + "type": "TemplateElement", + "start": 1, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "value": { + "raw": "left", + "cooked": "left" + }, + "tail": false + }, + { + "type": "TemplateElement", + "start": 9, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "value": { + "raw": "\\1", + "cooked": null + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/8/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/8/options.json deleted file mode 100644 index 27524e2b1f49..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/8/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:10)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/8/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/8/output.json new file mode 100644 index 000000000000..81d9e807fc24 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/8/output.json @@ -0,0 +1,172 @@ +{ + "type": "File", + "start": 0, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:10)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "expression": { + "type": "TemplateLiteral", + "start": 0, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "expressions": [ + { + "type": "NumericLiteral", + "start": 7, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + }, + { + "type": "NumericLiteral", + "start": 13, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + ], + "quasis": [ + { + "type": "TemplateElement", + "start": 1, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "value": { + "raw": "left", + "cooked": "left" + }, + "tail": false + }, + { + "type": "TemplateElement", + "start": 9, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "value": { + "raw": "\\1", + "cooked": null + }, + "tail": false + }, + { + "type": "TemplateElement", + "start": 15, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "value": { + "raw": "right", + "cooked": "right" + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/9/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/9/options.json deleted file mode 100644 index fd4da953a419..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/9/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/9/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/9/output.json new file mode 100644 index 000000000000..67d2c1d0b2d0 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/9/output.json @@ -0,0 +1,91 @@ +{ + "type": "File", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "expression": { + "type": "TemplateLiteral", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "expressions": [], + "quasis": [ + { + "type": "TemplateElement", + "start": 1, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "value": { + "raw": "\\xg", + "cooked": null + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/top-level-await/export-default/input.js b/packages/babel-parser/test/fixtures/experimental/top-level-await/export-default/input.js new file mode 100644 index 000000000000..fd1dbe08b03f --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/top-level-await/export-default/input.js @@ -0,0 +1 @@ +export default await 0; \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/top-level-await/export-default/options.json b/packages/babel-parser/test/fixtures/experimental/top-level-await/export-default/options.json new file mode 100644 index 000000000000..aadc3411ae9b --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/top-level-await/export-default/options.json @@ -0,0 +1,4 @@ +{ + "plugins": ["topLevelAwait"], + "sourceType": "module" +} diff --git a/packages/babel-parser/test/fixtures/experimental/top-level-await/export-default/output.json b/packages/babel-parser/test/fixtures/experimental/top-level-await/export-default/output.json new file mode 100644 index 000000000000..81e260bd12b2 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/top-level-await/export-default/output.json @@ -0,0 +1,85 @@ +{ + "type": "File", + "start": 0, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExportDefaultDeclaration", + "start": 0, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "declaration": { + "type": "AwaitExpression", + "start": 15, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "argument": { + "type": "NumericLiteral", + "start": 21, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/top-level-await/for-await-module/input.js b/packages/babel-parser/test/fixtures/experimental/top-level-await/for-await-module/input.js new file mode 100644 index 000000000000..ac76014a6f83 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/top-level-await/for-await-module/input.js @@ -0,0 +1 @@ +for await (const a of b); \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/top-level-await/for-await-module/options.json b/packages/babel-parser/test/fixtures/experimental/top-level-await/for-await-module/options.json new file mode 100644 index 000000000000..aadc3411ae9b --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/top-level-await/for-await-module/options.json @@ -0,0 +1,4 @@ +{ + "plugins": ["topLevelAwait"], + "sourceType": "module" +} diff --git a/packages/babel-parser/test/fixtures/experimental/top-level-await/for-await-module/output.json b/packages/babel-parser/test/fixtures/experimental/top-level-await/for-await-module/output.json new file mode 100644 index 000000000000..42be5c156ae8 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/top-level-await/for-await-module/output.json @@ -0,0 +1,134 @@ +{ + "type": "File", + "start": 0, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ForOfStatement", + "start": 0, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "await": true, + "left": { + "type": "VariableDeclaration", + "start": 11, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 17, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "id": { + "type": "Identifier", + "start": 17, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + }, + "identifierName": "a" + }, + "name": "a" + }, + "init": null + } + ], + "kind": "const" + }, + "right": { + "type": "Identifier", + "start": 22, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + }, + "identifierName": "b" + }, + "name": "b" + }, + "body": { + "type": "EmptyStatement", + "start": 24, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/top-level-await/for-await-script/input.js b/packages/babel-parser/test/fixtures/experimental/top-level-await/for-await-script/input.js new file mode 100644 index 000000000000..ac76014a6f83 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/top-level-await/for-await-script/input.js @@ -0,0 +1 @@ +for await (const a of b); \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/top-level-await/for-await-script/options.json b/packages/babel-parser/test/fixtures/experimental/top-level-await/for-await-script/options.json new file mode 100644 index 000000000000..ad8783d13faa --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/top-level-await/for-await-script/options.json @@ -0,0 +1,5 @@ +{ + "plugins": ["topLevelAwait"], + "sourceType": "script", + "throws": "Unexpected token, expected \"(\" (1:4)" +} diff --git a/packages/babel-parser/test/fixtures/experimental/top-level-await/inside-arrow/input.js b/packages/babel-parser/test/fixtures/experimental/top-level-await/inside-arrow/input.js new file mode 100644 index 000000000000..bde15d37c8ca --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/top-level-await/inside-arrow/input.js @@ -0,0 +1 @@ +() => await 0; diff --git a/packages/babel-parser/test/fixtures/experimental/top-level-await/inside-arrow/options.json b/packages/babel-parser/test/fixtures/experimental/top-level-await/inside-arrow/options.json new file mode 100644 index 000000000000..64cfc06e5014 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/top-level-await/inside-arrow/options.json @@ -0,0 +1,6 @@ +{ + "plugins": ["topLevelAwait"], + "sourceType": "module", + "errorRecovery": false, + "throws": "Can not use keyword 'await' outside an async function (1:6)" +} diff --git a/packages/babel-parser/test/fixtures/experimental/top-level-await/inside-block/input.js b/packages/babel-parser/test/fixtures/experimental/top-level-await/inside-block/input.js new file mode 100644 index 000000000000..f264b0344b3b --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/top-level-await/inside-block/input.js @@ -0,0 +1,3 @@ +if (true) { + await 0; +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/top-level-await/inside-block/options.json b/packages/babel-parser/test/fixtures/experimental/top-level-await/inside-block/options.json new file mode 100644 index 000000000000..aadc3411ae9b --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/top-level-await/inside-block/options.json @@ -0,0 +1,4 @@ +{ + "plugins": ["topLevelAwait"], + "sourceType": "module" +} diff --git a/packages/babel-parser/test/fixtures/experimental/top-level-await/inside-block/output.json b/packages/babel-parser/test/fixtures/experimental/top-level-await/inside-block/output.json new file mode 100644 index 000000000000..b70dffe352c1 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/top-level-await/inside-block/output.json @@ -0,0 +1,135 @@ +{ + "type": "File", + "start": 0, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "IfStatement", + "start": 0, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "test": { + "type": "BooleanLiteral", + "start": 4, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "value": true + }, + "consequent": { + "type": "BlockStatement", + "start": 10, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 14, + "end": 22, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 10 + } + }, + "expression": { + "type": "AwaitExpression", + "start": 14, + "end": 21, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 9 + } + }, + "argument": { + "type": "NumericLiteral", + "start": 20, + "end": 21, + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 9 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + } + } + ], + "directives": [] + }, + "alternate": null + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/top-level-await/inside-class-property/input.js b/packages/babel-parser/test/fixtures/experimental/top-level-await/inside-class-property/input.js new file mode 100644 index 000000000000..d17e57ee1081 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/top-level-await/inside-class-property/input.js @@ -0,0 +1,3 @@ +export class C { + p = await 0; +} diff --git a/packages/babel-parser/test/fixtures/experimental/top-level-await/inside-class-property/options.json b/packages/babel-parser/test/fixtures/experimental/top-level-await/inside-class-property/options.json new file mode 100644 index 000000000000..0688c012b357 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/top-level-await/inside-class-property/options.json @@ -0,0 +1,8 @@ +{ + "plugins": [ + "topLevelAwait", + "classProperties" + ], + "sourceType": "module", + "throws": "Unexpected token, expected \";\" (2:12)" +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/top-level-await/inside-function/input.js b/packages/babel-parser/test/fixtures/experimental/top-level-await/inside-function/input.js new file mode 100644 index 000000000000..ced447b77235 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/top-level-await/inside-function/input.js @@ -0,0 +1,3 @@ +function fn() { + await 0; +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/top-level-await/inside-function/options.json b/packages/babel-parser/test/fixtures/experimental/top-level-await/inside-function/options.json new file mode 100644 index 000000000000..8eade50d15b5 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/top-level-await/inside-function/options.json @@ -0,0 +1,6 @@ +{ + "plugins": ["topLevelAwait"], + "sourceType": "module", + "errorRecovery": false, + "throws": "Can not use keyword 'await' outside an async function (2:2)" +} diff --git a/packages/babel-parser/test/fixtures/experimental/top-level-await/top-level-module/input.js b/packages/babel-parser/test/fixtures/experimental/top-level-await/top-level-module/input.js new file mode 100644 index 000000000000..d8ddd6c0ad0b --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/top-level-await/top-level-module/input.js @@ -0,0 +1 @@ +await 0; \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/top-level-await/top-level-module/options.json b/packages/babel-parser/test/fixtures/experimental/top-level-await/top-level-module/options.json new file mode 100644 index 000000000000..aadc3411ae9b --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/top-level-await/top-level-module/options.json @@ -0,0 +1,4 @@ +{ + "plugins": ["topLevelAwait"], + "sourceType": "module" +} diff --git a/packages/babel-parser/test/fixtures/experimental/top-level-await/top-level-module/output.json b/packages/babel-parser/test/fixtures/experimental/top-level-await/top-level-module/output.json new file mode 100644 index 000000000000..02ef8ffabf64 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/top-level-await/top-level-module/output.json @@ -0,0 +1,85 @@ +{ + "type": "File", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "expression": { + "type": "AwaitExpression", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "argument": { + "type": "NumericLiteral", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/top-level-await/top-level-script/input.js b/packages/babel-parser/test/fixtures/experimental/top-level-await/top-level-script/input.js new file mode 100644 index 000000000000..d8ddd6c0ad0b --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/top-level-await/top-level-script/input.js @@ -0,0 +1 @@ +await 0; \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/top-level-await/top-level-script/options.json b/packages/babel-parser/test/fixtures/experimental/top-level-await/top-level-script/options.json new file mode 100644 index 000000000000..c9dc6113fea3 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/top-level-await/top-level-script/options.json @@ -0,0 +1,5 @@ +{ + "plugins": ["topLevelAwait"], + "sourceType": "script", + "throws": "Unexpected token, expected \";\" (1:6)" +} diff --git a/packages/babel-parser/test/fixtures/experimental/top-level-await/unambiguous-ambiguous-allowAwaitOutsideFunction/input.js b/packages/babel-parser/test/fixtures/experimental/top-level-await/unambiguous-ambiguous-allowAwaitOutsideFunction/input.js new file mode 100644 index 000000000000..1fa05e429c67 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/top-level-await/unambiguous-ambiguous-allowAwaitOutsideFunction/input.js @@ -0,0 +1,7 @@ +await 0 + +await + 0 +await - 0 +await ( 0 ) +await [ 0 ] +await / 0 /u diff --git a/packages/babel-parser/test/fixtures/experimental/top-level-await/unambiguous-ambiguous-allowAwaitOutsideFunction/options.json b/packages/babel-parser/test/fixtures/experimental/top-level-await/unambiguous-ambiguous-allowAwaitOutsideFunction/options.json new file mode 100644 index 000000000000..aceca10c3d74 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/top-level-await/unambiguous-ambiguous-allowAwaitOutsideFunction/options.json @@ -0,0 +1,5 @@ +{ + "plugins": ["topLevelAwait"], + "sourceType": "unambiguous", + "allowAwaitOutsideFunction": true +} diff --git a/packages/babel-parser/test/fixtures/experimental/top-level-await/unambiguous-ambiguous-allowAwaitOutsideFunction/output.json b/packages/babel-parser/test/fixtures/experimental/top-level-await/unambiguous-ambiguous-allowAwaitOutsideFunction/output.json new file mode 100644 index 000000000000..76e30779fc90 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/top-level-await/unambiguous-ambiguous-allowAwaitOutsideFunction/output.json @@ -0,0 +1,388 @@ +{ + "type": "File", + "start": 0, + "end": 65, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 7, + "column": 12 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 65, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 7, + "column": 12 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "expression": { + "type": "AwaitExpression", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "argument": { + "type": "NumericLiteral", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + } + }, + { + "type": "ExpressionStatement", + "start": 9, + "end": 18, + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 9 + } + }, + "expression": { + "type": "AwaitExpression", + "start": 9, + "end": 18, + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 9 + } + }, + "argument": { + "type": "UnaryExpression", + "start": 15, + "end": 18, + "loc": { + "start": { + "line": 3, + "column": 6 + }, + "end": { + "line": 3, + "column": 9 + } + }, + "operator": "+", + "prefix": true, + "argument": { + "type": "NumericLiteral", + "start": 17, + "end": 18, + "loc": { + "start": { + "line": 3, + "column": 8 + }, + "end": { + "line": 3, + "column": 9 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + } + } + }, + { + "type": "ExpressionStatement", + "start": 19, + "end": 28, + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 4, + "column": 9 + } + }, + "expression": { + "type": "AwaitExpression", + "start": 19, + "end": 28, + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 4, + "column": 9 + } + }, + "argument": { + "type": "UnaryExpression", + "start": 25, + "end": 28, + "loc": { + "start": { + "line": 4, + "column": 6 + }, + "end": { + "line": 4, + "column": 9 + } + }, + "operator": "-", + "prefix": true, + "argument": { + "type": "NumericLiteral", + "start": 27, + "end": 28, + "loc": { + "start": { + "line": 4, + "column": 8 + }, + "end": { + "line": 4, + "column": 9 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + } + } + }, + { + "type": "ExpressionStatement", + "start": 29, + "end": 40, + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 5, + "column": 11 + } + }, + "expression": { + "type": "AwaitExpression", + "start": 29, + "end": 40, + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 5, + "column": 11 + } + }, + "argument": { + "type": "NumericLiteral", + "start": 37, + "end": 38, + "loc": { + "start": { + "line": 5, + "column": 8 + }, + "end": { + "line": 5, + "column": 9 + } + }, + "extra": { + "rawValue": 0, + "raw": "0", + "parenthesized": true, + "parenStart": 35 + }, + "value": 0 + } + } + }, + { + "type": "ExpressionStatement", + "start": 41, + "end": 52, + "loc": { + "start": { + "line": 6, + "column": 0 + }, + "end": { + "line": 6, + "column": 11 + } + }, + "expression": { + "type": "AwaitExpression", + "start": 41, + "end": 52, + "loc": { + "start": { + "line": 6, + "column": 0 + }, + "end": { + "line": 6, + "column": 11 + } + }, + "argument": { + "type": "ArrayExpression", + "start": 47, + "end": 52, + "loc": { + "start": { + "line": 6, + "column": 6 + }, + "end": { + "line": 6, + "column": 11 + } + }, + "elements": [ + { + "type": "NumericLiteral", + "start": 49, + "end": 50, + "loc": { + "start": { + "line": 6, + "column": 8 + }, + "end": { + "line": 6, + "column": 9 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + ] + } + } + }, + { + "type": "ExpressionStatement", + "start": 53, + "end": 65, + "loc": { + "start": { + "line": 7, + "column": 0 + }, + "end": { + "line": 7, + "column": 12 + } + }, + "expression": { + "type": "AwaitExpression", + "start": 53, + "end": 65, + "loc": { + "start": { + "line": 7, + "column": 0 + }, + "end": { + "line": 7, + "column": 12 + } + }, + "argument": { + "type": "RegExpLiteral", + "start": 59, + "end": 65, + "loc": { + "start": { + "line": 7, + "column": 6 + }, + "end": { + "line": 7, + "column": 12 + } + }, + "extra": { + "raw": "/ 0 /u" + }, + "pattern": " 0 ", + "flags": "u" + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/top-level-await/unambiguous-ambiguous-modulo/input.js b/packages/babel-parser/test/fixtures/experimental/top-level-await/unambiguous-ambiguous-modulo/input.js new file mode 100644 index 000000000000..735a0162b362 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/top-level-await/unambiguous-ambiguous-modulo/input.js @@ -0,0 +1 @@ +await %x(0) \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/top-level-await/unambiguous-ambiguous-modulo/options.json b/packages/babel-parser/test/fixtures/experimental/top-level-await/unambiguous-ambiguous-modulo/options.json new file mode 100644 index 000000000000..2503b82adf74 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/top-level-await/unambiguous-ambiguous-modulo/options.json @@ -0,0 +1,4 @@ +{ + "plugins": ["topLevelAwait"], + "sourceType": "unambiguous" +} diff --git a/packages/babel-parser/test/fixtures/experimental/top-level-await/unambiguous-ambiguous-modulo/output.json b/packages/babel-parser/test/fixtures/experimental/top-level-await/unambiguous-ambiguous-modulo/output.json new file mode 100644 index 000000000000..5805e3195560 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/top-level-await/unambiguous-ambiguous-modulo/output.json @@ -0,0 +1,137 @@ +{ + "type": "File", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "expression": { + "type": "BinaryExpression", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "left": { + "type": "Identifier", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + }, + "identifierName": "await" + }, + "name": "await" + }, + "operator": "%", + "right": { + "type": "CallExpression", + "start": 7, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "callee": { + "type": "Identifier", + "start": 7, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + }, + "identifierName": "x" + }, + "name": "x" + }, + "arguments": [ + { + "type": "NumericLiteral", + "start": 9, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + ] + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/top-level-await/unambiguous-ambiguous-script/input.js b/packages/babel-parser/test/fixtures/experimental/top-level-await/unambiguous-ambiguous-script/input.js new file mode 100644 index 000000000000..9fac4af0f0aa --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/top-level-await/unambiguous-ambiguous-script/input.js @@ -0,0 +1,8 @@ +await +0 + +await + 0 +await - 0 +await ( 0 ) +await [ 0 ] +await / 0 /u diff --git a/packages/babel-parser/test/fixtures/experimental/top-level-await/unambiguous-ambiguous-script/options.json b/packages/babel-parser/test/fixtures/experimental/top-level-await/unambiguous-ambiguous-script/options.json new file mode 100644 index 000000000000..2503b82adf74 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/top-level-await/unambiguous-ambiguous-script/options.json @@ -0,0 +1,4 @@ +{ + "plugins": ["topLevelAwait"], + "sourceType": "unambiguous" +} diff --git a/packages/babel-parser/test/fixtures/experimental/top-level-await/unambiguous-ambiguous-script/output.json b/packages/babel-parser/test/fixtures/experimental/top-level-await/unambiguous-ambiguous-script/output.json new file mode 100644 index 000000000000..76a211cbb464 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/top-level-await/unambiguous-ambiguous-script/output.json @@ -0,0 +1,476 @@ +{ + "type": "File", + "start": 0, + "end": 65, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 8, + "column": 12 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 65, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 8, + "column": 12 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "expression": { + "type": "Identifier", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + }, + "identifierName": "await" + }, + "name": "await" + } + }, + { + "type": "ExpressionStatement", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 1 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 1 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + }, + { + "type": "ExpressionStatement", + "start": 9, + "end": 18, + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 4, + "column": 9 + } + }, + "expression": { + "type": "BinaryExpression", + "start": 9, + "end": 18, + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 4, + "column": 9 + } + }, + "left": { + "type": "Identifier", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 4, + "column": 5 + }, + "identifierName": "await" + }, + "name": "await" + }, + "operator": "+", + "right": { + "type": "NumericLiteral", + "start": 17, + "end": 18, + "loc": { + "start": { + "line": 4, + "column": 8 + }, + "end": { + "line": 4, + "column": 9 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + } + }, + { + "type": "ExpressionStatement", + "start": 19, + "end": 28, + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 5, + "column": 9 + } + }, + "expression": { + "type": "BinaryExpression", + "start": 19, + "end": 28, + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 5, + "column": 9 + } + }, + "left": { + "type": "Identifier", + "start": 19, + "end": 24, + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 5, + "column": 5 + }, + "identifierName": "await" + }, + "name": "await" + }, + "operator": "-", + "right": { + "type": "NumericLiteral", + "start": 27, + "end": 28, + "loc": { + "start": { + "line": 5, + "column": 8 + }, + "end": { + "line": 5, + "column": 9 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + } + }, + { + "type": "ExpressionStatement", + "start": 29, + "end": 40, + "loc": { + "start": { + "line": 6, + "column": 0 + }, + "end": { + "line": 6, + "column": 11 + } + }, + "expression": { + "type": "CallExpression", + "start": 29, + "end": 40, + "loc": { + "start": { + "line": 6, + "column": 0 + }, + "end": { + "line": 6, + "column": 11 + } + }, + "callee": { + "type": "Identifier", + "start": 29, + "end": 34, + "loc": { + "start": { + "line": 6, + "column": 0 + }, + "end": { + "line": 6, + "column": 5 + }, + "identifierName": "await" + }, + "name": "await" + }, + "arguments": [ + { + "type": "NumericLiteral", + "start": 37, + "end": 38, + "loc": { + "start": { + "line": 6, + "column": 8 + }, + "end": { + "line": 6, + "column": 9 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + ] + } + }, + { + "type": "ExpressionStatement", + "start": 41, + "end": 52, + "loc": { + "start": { + "line": 7, + "column": 0 + }, + "end": { + "line": 7, + "column": 11 + } + }, + "expression": { + "type": "MemberExpression", + "start": 41, + "end": 52, + "loc": { + "start": { + "line": 7, + "column": 0 + }, + "end": { + "line": 7, + "column": 11 + } + }, + "object": { + "type": "Identifier", + "start": 41, + "end": 46, + "loc": { + "start": { + "line": 7, + "column": 0 + }, + "end": { + "line": 7, + "column": 5 + }, + "identifierName": "await" + }, + "name": "await" + }, + "property": { + "type": "NumericLiteral", + "start": 49, + "end": 50, + "loc": { + "start": { + "line": 7, + "column": 8 + }, + "end": { + "line": 7, + "column": 9 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + }, + "computed": true + } + }, + { + "type": "ExpressionStatement", + "start": 53, + "end": 65, + "loc": { + "start": { + "line": 8, + "column": 0 + }, + "end": { + "line": 8, + "column": 12 + } + }, + "expression": { + "type": "BinaryExpression", + "start": 53, + "end": 65, + "loc": { + "start": { + "line": 8, + "column": 0 + }, + "end": { + "line": 8, + "column": 12 + } + }, + "left": { + "type": "BinaryExpression", + "start": 53, + "end": 62, + "loc": { + "start": { + "line": 8, + "column": 0 + }, + "end": { + "line": 8, + "column": 9 + } + }, + "left": { + "type": "Identifier", + "start": 53, + "end": 58, + "loc": { + "start": { + "line": 8, + "column": 0 + }, + "end": { + "line": 8, + "column": 5 + }, + "identifierName": "await" + }, + "name": "await" + }, + "operator": "/", + "right": { + "type": "NumericLiteral", + "start": 61, + "end": 62, + "loc": { + "start": { + "line": 8, + "column": 8 + }, + "end": { + "line": 8, + "column": 9 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + }, + "operator": "/", + "right": { + "type": "Identifier", + "start": 64, + "end": 65, + "loc": { + "start": { + "line": 8, + "column": 11 + }, + "end": { + "line": 8, + "column": 12 + }, + "identifierName": "u" + }, + "name": "u" + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/top-level-await/unambiguous-ambiguous-v8intrinsinc/input.js b/packages/babel-parser/test/fixtures/experimental/top-level-await/unambiguous-ambiguous-v8intrinsinc/input.js new file mode 100644 index 000000000000..735a0162b362 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/top-level-await/unambiguous-ambiguous-v8intrinsinc/input.js @@ -0,0 +1 @@ +await %x(0) \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/top-level-await/unambiguous-ambiguous-v8intrinsinc/options.json b/packages/babel-parser/test/fixtures/experimental/top-level-await/unambiguous-ambiguous-v8intrinsinc/options.json new file mode 100644 index 000000000000..6732f5f2f093 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/top-level-await/unambiguous-ambiguous-v8intrinsinc/options.json @@ -0,0 +1,4 @@ +{ + "plugins": ["topLevelAwait", "v8intrinsic"], + "sourceType": "unambiguous" +} diff --git a/packages/babel-parser/test/fixtures/experimental/top-level-await/unambiguous-ambiguous-v8intrinsinc/output.json b/packages/babel-parser/test/fixtures/experimental/top-level-await/unambiguous-ambiguous-v8intrinsinc/output.json new file mode 100644 index 000000000000..5805e3195560 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/top-level-await/unambiguous-ambiguous-v8intrinsinc/output.json @@ -0,0 +1,137 @@ +{ + "type": "File", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "expression": { + "type": "BinaryExpression", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "left": { + "type": "Identifier", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + }, + "identifierName": "await" + }, + "name": "await" + }, + "operator": "%", + "right": { + "type": "CallExpression", + "start": 7, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "callee": { + "type": "Identifier", + "start": 7, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + }, + "identifierName": "x" + }, + "name": "x" + }, + "arguments": [ + { + "type": "NumericLiteral", + "start": 9, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + ] + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/top-level-await/unambiguous-module/input.js b/packages/babel-parser/test/fixtures/experimental/top-level-await/unambiguous-module/input.js new file mode 100644 index 000000000000..1fa05e429c67 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/top-level-await/unambiguous-module/input.js @@ -0,0 +1,7 @@ +await 0 + +await + 0 +await - 0 +await ( 0 ) +await [ 0 ] +await / 0 /u diff --git a/packages/babel-parser/test/fixtures/experimental/top-level-await/unambiguous-module/options.json b/packages/babel-parser/test/fixtures/experimental/top-level-await/unambiguous-module/options.json new file mode 100644 index 000000000000..2503b82adf74 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/top-level-await/unambiguous-module/options.json @@ -0,0 +1,4 @@ +{ + "plugins": ["topLevelAwait"], + "sourceType": "unambiguous" +} diff --git a/packages/babel-parser/test/fixtures/experimental/top-level-await/unambiguous-module/output.json b/packages/babel-parser/test/fixtures/experimental/top-level-await/unambiguous-module/output.json new file mode 100644 index 000000000000..18617474f20a --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/top-level-await/unambiguous-module/output.json @@ -0,0 +1,388 @@ +{ + "type": "File", + "start": 0, + "end": 65, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 7, + "column": 12 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 65, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 7, + "column": 12 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "expression": { + "type": "AwaitExpression", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "argument": { + "type": "NumericLiteral", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + } + }, + { + "type": "ExpressionStatement", + "start": 9, + "end": 18, + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 9 + } + }, + "expression": { + "type": "AwaitExpression", + "start": 9, + "end": 18, + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 9 + } + }, + "argument": { + "type": "UnaryExpression", + "start": 15, + "end": 18, + "loc": { + "start": { + "line": 3, + "column": 6 + }, + "end": { + "line": 3, + "column": 9 + } + }, + "operator": "+", + "prefix": true, + "argument": { + "type": "NumericLiteral", + "start": 17, + "end": 18, + "loc": { + "start": { + "line": 3, + "column": 8 + }, + "end": { + "line": 3, + "column": 9 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + } + } + }, + { + "type": "ExpressionStatement", + "start": 19, + "end": 28, + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 4, + "column": 9 + } + }, + "expression": { + "type": "AwaitExpression", + "start": 19, + "end": 28, + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 4, + "column": 9 + } + }, + "argument": { + "type": "UnaryExpression", + "start": 25, + "end": 28, + "loc": { + "start": { + "line": 4, + "column": 6 + }, + "end": { + "line": 4, + "column": 9 + } + }, + "operator": "-", + "prefix": true, + "argument": { + "type": "NumericLiteral", + "start": 27, + "end": 28, + "loc": { + "start": { + "line": 4, + "column": 8 + }, + "end": { + "line": 4, + "column": 9 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + } + } + }, + { + "type": "ExpressionStatement", + "start": 29, + "end": 40, + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 5, + "column": 11 + } + }, + "expression": { + "type": "AwaitExpression", + "start": 29, + "end": 40, + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 5, + "column": 11 + } + }, + "argument": { + "type": "NumericLiteral", + "start": 37, + "end": 38, + "loc": { + "start": { + "line": 5, + "column": 8 + }, + "end": { + "line": 5, + "column": 9 + } + }, + "extra": { + "rawValue": 0, + "raw": "0", + "parenthesized": true, + "parenStart": 35 + }, + "value": 0 + } + } + }, + { + "type": "ExpressionStatement", + "start": 41, + "end": 52, + "loc": { + "start": { + "line": 6, + "column": 0 + }, + "end": { + "line": 6, + "column": 11 + } + }, + "expression": { + "type": "AwaitExpression", + "start": 41, + "end": 52, + "loc": { + "start": { + "line": 6, + "column": 0 + }, + "end": { + "line": 6, + "column": 11 + } + }, + "argument": { + "type": "ArrayExpression", + "start": 47, + "end": 52, + "loc": { + "start": { + "line": 6, + "column": 6 + }, + "end": { + "line": 6, + "column": 11 + } + }, + "elements": [ + { + "type": "NumericLiteral", + "start": 49, + "end": 50, + "loc": { + "start": { + "line": 6, + "column": 8 + }, + "end": { + "line": 6, + "column": 9 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + ] + } + } + }, + { + "type": "ExpressionStatement", + "start": 53, + "end": 65, + "loc": { + "start": { + "line": 7, + "column": 0 + }, + "end": { + "line": 7, + "column": 12 + } + }, + "expression": { + "type": "AwaitExpression", + "start": 53, + "end": 65, + "loc": { + "start": { + "line": 7, + "column": 0 + }, + "end": { + "line": 7, + "column": 12 + } + }, + "argument": { + "type": "RegExpLiteral", + "start": 59, + "end": 65, + "loc": { + "start": { + "line": 7, + "column": 6 + }, + "end": { + "line": 7, + "column": 12 + } + }, + "extra": { + "raw": "/ 0 /u" + }, + "pattern": " 0 ", + "flags": "u" + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/classes/constructor-override-with-class-prop-plugin/options.json b/packages/babel-parser/test/fixtures/flow/classes/constructor-override-with-class-prop-plugin/options.json index 3c8f72c90062..192d7042e2c8 100644 --- a/packages/babel-parser/test/fixtures/flow/classes/constructor-override-with-class-prop-plugin/options.json +++ b/packages/babel-parser/test/fixtures/flow/classes/constructor-override-with-class-prop-plugin/options.json @@ -1,3 +1,4 @@ { + "sourceType": "module", "plugins": ["jsx", "flow", "classProperties"] } diff --git a/packages/babel-parser/test/fixtures/flow/classes/constructor-override-with-class-prop-plugin/output.json b/packages/babel-parser/test/fixtures/flow/classes/constructor-override-with-class-prop-plugin/output.json index 38c7d603748f..3d9ad56d93cd 100644 --- a/packages/babel-parser/test/fixtures/flow/classes/constructor-override-with-class-prop-plugin/output.json +++ b/packages/babel-parser/test/fixtures/flow/classes/constructor-override-with-class-prop-plugin/output.json @@ -12,6 +12,9 @@ "column": 1 } }, + "errors": [ + "SyntaxError: Classes may not have a field named 'constructor' (2:2)" + ], "program": { "type": "Program", "start": 0, diff --git a/packages/babel-parser/test/fixtures/flow/comment/12-line-comment-nested-invalid/options.json b/packages/babel-parser/test/fixtures/flow/comment/12-line-comment-nested-invalid/options.json deleted file mode 100644 index 9a7e0e3402af..000000000000 --- a/packages/babel-parser/test/fixtures/flow/comment/12-line-comment-nested-invalid/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unterminated flow-comment (1:13)" -} diff --git a/packages/babel-parser/test/fixtures/flow/comment/12-line-comment-nested-invalid/output.json b/packages/babel-parser/test/fixtures/flow/comment/12-line-comment-nested-invalid/output.json new file mode 100644 index 000000000000..bd82aabe61e4 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/comment/12-line-comment-nested-invalid/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "errors": [ + "SyntaxError: Unterminated flow-comment (1:13)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [], + "directives": [], + "innerComments": [ + { + "type": "CommentLine", + "value": "asd */", + "start": 5, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 13 + } + } + } + ] + }, + "comments": [ + { + "type": "CommentLine", + "value": "asd */", + "start": 5, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 13 + } + } + } + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/declare-export/export-star-as/options.json b/packages/babel-parser/test/fixtures/flow/declare-export/export-star-as/options.json index acd5b34be46d..698e7668500f 100644 --- a/packages/babel-parser/test/fixtures/flow/declare-export/export-star-as/options.json +++ b/packages/babel-parser/test/fixtures/flow/declare-export/export-star-as/options.json @@ -1,3 +1,3 @@ { - "plugins": ["jsx", "flow", "exportNamespaceFrom"] + "plugins": ["jsx", "flow"] } diff --git a/packages/babel-parser/test/fixtures/flow/declare-module/invalid-commonjs-module/options.json b/packages/babel-parser/test/fixtures/flow/declare-module/invalid-commonjs-module/options.json deleted file mode 100644 index adfde3236356..000000000000 --- a/packages/babel-parser/test/fixtures/flow/declare-module/invalid-commonjs-module/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Found both `declare module.exports` and `declare export` in the same module. Modules can only have 1 since they are either an ES module or they are a CommonJS module (1:55)" -} diff --git a/packages/babel-parser/test/fixtures/flow/declare-module/invalid-commonjs-module/output.json b/packages/babel-parser/test/fixtures/flow/declare-module/invalid-commonjs-module/output.json new file mode 100644 index 000000000000..43cb8ee092f2 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/declare-module/invalid-commonjs-module/output.json @@ -0,0 +1,214 @@ +{ + "type": "File", + "start": 0, + "end": 87, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 87 + } + }, + "errors": [ + "SyntaxError: Found both `declare module.exports` and `declare export` in the same module. Modules can only have 1 since they are either an ES module or they are a CommonJS module (1:55)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 87, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 87 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "DeclareModule", + "start": 0, + "end": 87, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 87 + } + }, + "id": { + "type": "StringLiteral", + "start": 15, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "extra": { + "rawValue": "foo", + "raw": "\"foo\"" + }, + "value": "foo" + }, + "body": { + "type": "BlockStatement", + "start": 21, + "end": 87, + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 87 + } + }, + "body": [ + { + "type": "DeclareModuleExports", + "start": 23, + "end": 54, + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 54 + } + }, + "typeAnnotation": { + "type": "TypeAnnotation", + "start": 45, + "end": 53, + "loc": { + "start": { + "line": 1, + "column": 45 + }, + "end": { + "line": 1, + "column": 53 + } + }, + "typeAnnotation": { + "type": "NumberTypeAnnotation", + "start": 47, + "end": 53, + "loc": { + "start": { + "line": 1, + "column": 47 + }, + "end": { + "line": 1, + "column": 53 + } + } + } + } + }, + { + "type": "DeclareExportDeclaration", + "start": 55, + "end": 84, + "loc": { + "start": { + "line": 1, + "column": 55 + }, + "end": { + "line": 1, + "column": 84 + } + }, + "declaration": { + "type": "DeclareVariable", + "start": 70, + "end": 84, + "loc": { + "start": { + "line": 1, + "column": 70 + }, + "end": { + "line": 1, + "column": 84 + } + }, + "id": { + "type": "Identifier", + "start": 74, + "end": 83, + "loc": { + "start": { + "line": 1, + "column": 74 + }, + "end": { + "line": 1, + "column": 83 + }, + "identifierName": "a" + }, + "name": "a", + "typeAnnotation": { + "type": "TypeAnnotation", + "start": 75, + "end": 83, + "loc": { + "start": { + "line": 1, + "column": 75 + }, + "end": { + "line": 1, + "column": 83 + } + }, + "typeAnnotation": { + "type": "NumberTypeAnnotation", + "start": 77, + "end": 83, + "loc": { + "start": { + "line": 1, + "column": 77 + }, + "end": { + "line": 1, + "column": 83 + } + } + } + } + } + }, + "default": false + } + ] + }, + "kind": "ES" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/declare-module/invalid-es-module/options.json b/packages/babel-parser/test/fixtures/flow/declare-module/invalid-es-module/options.json deleted file mode 100644 index b40239a5609c..000000000000 --- a/packages/babel-parser/test/fixtures/flow/declare-module/invalid-es-module/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Found both `declare module.exports` and `declare export` in the same module. Modules can only have 1 since they are either an ES module or they are a CommonJS module (1:53)" -} diff --git a/packages/babel-parser/test/fixtures/flow/declare-module/invalid-es-module/output.json b/packages/babel-parser/test/fixtures/flow/declare-module/invalid-es-module/output.json new file mode 100644 index 000000000000..536157fab722 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/declare-module/invalid-es-module/output.json @@ -0,0 +1,214 @@ +{ + "type": "File", + "start": 0, + "end": 86, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 86 + } + }, + "errors": [ + "SyntaxError: Found both `declare module.exports` and `declare export` in the same module. Modules can only have 1 since they are either an ES module or they are a CommonJS module (1:53)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 86, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 86 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "DeclareModule", + "start": 0, + "end": 86, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 86 + } + }, + "id": { + "type": "StringLiteral", + "start": 15, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "extra": { + "rawValue": "foo", + "raw": "\"foo\"" + }, + "value": "foo" + }, + "body": { + "type": "BlockStatement", + "start": 21, + "end": 86, + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 86 + } + }, + "body": [ + { + "type": "DeclareExportDeclaration", + "start": 23, + "end": 52, + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 52 + } + }, + "declaration": { + "type": "DeclareVariable", + "start": 38, + "end": 52, + "loc": { + "start": { + "line": 1, + "column": 38 + }, + "end": { + "line": 1, + "column": 52 + } + }, + "id": { + "type": "Identifier", + "start": 42, + "end": 51, + "loc": { + "start": { + "line": 1, + "column": 42 + }, + "end": { + "line": 1, + "column": 51 + }, + "identifierName": "a" + }, + "name": "a", + "typeAnnotation": { + "type": "TypeAnnotation", + "start": 43, + "end": 51, + "loc": { + "start": { + "line": 1, + "column": 43 + }, + "end": { + "line": 1, + "column": 51 + } + }, + "typeAnnotation": { + "type": "NumberTypeAnnotation", + "start": 45, + "end": 51, + "loc": { + "start": { + "line": 1, + "column": 45 + }, + "end": { + "line": 1, + "column": 51 + } + } + } + } + } + }, + "default": false + }, + { + "type": "DeclareModuleExports", + "start": 53, + "end": 84, + "loc": { + "start": { + "line": 1, + "column": 53 + }, + "end": { + "line": 1, + "column": 84 + } + }, + "typeAnnotation": { + "type": "TypeAnnotation", + "start": 75, + "end": 83, + "loc": { + "start": { + "line": 1, + "column": 75 + }, + "end": { + "line": 1, + "column": 83 + } + }, + "typeAnnotation": { + "type": "NumberTypeAnnotation", + "start": 77, + "end": 83, + "loc": { + "start": { + "line": 1, + "column": 77 + }, + "end": { + "line": 1, + "column": 83 + } + } + } + } + } + ] + }, + "kind": "CommonJS" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/declare-module/invalid-import/options.json b/packages/babel-parser/test/fixtures/flow/declare-module/invalid-import/options.json deleted file mode 100644 index c237bb99a73b..000000000000 --- a/packages/babel-parser/test/fixtures/flow/declare-module/invalid-import/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Imports within a `declare module` body must always be `import type` or `import typeof` (1:21)" -} diff --git a/packages/babel-parser/test/fixtures/flow/declare-module/invalid-import/output.json b/packages/babel-parser/test/fixtures/flow/declare-module/invalid-import/output.json new file mode 100644 index 000000000000..2d33b963c778 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/declare-module/invalid-import/output.json @@ -0,0 +1,161 @@ +{ + "type": "File", + "start": 0, + "end": 42, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 42 + } + }, + "errors": [ + "SyntaxError: Imports within a `declare module` body must always be `import type` or `import typeof` (1:21)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 42, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 42 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "DeclareModule", + "start": 0, + "end": 42, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 42 + } + }, + "id": { + "type": "StringLiteral", + "start": 15, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "extra": { + "rawValue": "M", + "raw": "\"M\"" + }, + "value": "M" + }, + "body": { + "type": "BlockStatement", + "start": 19, + "end": 42, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 42 + } + }, + "body": [ + { + "type": "ImportDeclaration", + "start": 21, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 40 + } + }, + "specifiers": [ + { + "type": "ImportDefaultSpecifier", + "start": 28, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "local": { + "type": "Identifier", + "start": 28, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 29 + }, + "identifierName": "T" + }, + "name": "T" + } + } + ], + "importKind": "value", + "source": { + "type": "StringLiteral", + "start": 35, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 35 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "extra": { + "rawValue": "TM", + "raw": "\"TM\"" + }, + "value": "TM" + } + } + ] + }, + "kind": "CommonJS" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/declare-module/invalid-module-in-module/options.json b/packages/babel-parser/test/fixtures/flow/declare-module/invalid-module-in-module/options.json deleted file mode 100644 index cd823bd7c4e0..000000000000 --- a/packages/babel-parser/test/fixtures/flow/declare-module/invalid-module-in-module/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "`declare module` cannot be used inside another `declare module` (1:27)" -} diff --git a/packages/babel-parser/test/fixtures/flow/declare-module/invalid-module-in-module/output.json b/packages/babel-parser/test/fixtures/flow/declare-module/invalid-module-in-module/output.json new file mode 100644 index 000000000000..0a3fe70d8611 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/declare-module/invalid-module-in-module/output.json @@ -0,0 +1,137 @@ +{ + "type": "File", + "start": 0, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 40 + } + }, + "errors": [ + "SyntaxError: `declare module` cannot be used inside another `declare module` (1:27)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 40 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "DeclareModule", + "start": 0, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 40 + } + }, + "id": { + "type": "Identifier", + "start": 15, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + }, + "identifierName": "A" + }, + "name": "A" + }, + "body": { + "type": "BlockStatement", + "start": 17, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 40 + } + }, + "body": [ + { + "type": "DeclareModule", + "start": 19, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 38 + } + }, + "id": { + "type": "Identifier", + "start": 34, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 34 + }, + "end": { + "line": 1, + "column": 35 + }, + "identifierName": "B" + }, + "name": "B" + }, + "body": { + "type": "BlockStatement", + "start": 36, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 36 + }, + "end": { + "line": 1, + "column": 38 + } + }, + "body": [] + }, + "kind": "CommonJS" + } + ] + }, + "kind": "CommonJS" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/declare-module/invalid-multiple-commonjs/options.json b/packages/babel-parser/test/fixtures/flow/declare-module/invalid-multiple-commonjs/options.json deleted file mode 100644 index 1520d766b062..000000000000 --- a/packages/babel-parser/test/fixtures/flow/declare-module/invalid-multiple-commonjs/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Duplicate `declare module.exports` statement (1:55)" -} diff --git a/packages/babel-parser/test/fixtures/flow/declare-module/invalid-multiple-commonjs/output.json b/packages/babel-parser/test/fixtures/flow/declare-module/invalid-multiple-commonjs/output.json new file mode 100644 index 000000000000..4339f6dbf5c6 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/declare-module/invalid-multiple-commonjs/output.json @@ -0,0 +1,181 @@ +{ + "type": "File", + "start": 0, + "end": 88, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 88 + } + }, + "errors": [ + "SyntaxError: Duplicate `declare module.exports` statement (1:55)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 88, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 88 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "DeclareModule", + "start": 0, + "end": 88, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 88 + } + }, + "id": { + "type": "StringLiteral", + "start": 15, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "extra": { + "rawValue": "foo", + "raw": "\"foo\"" + }, + "value": "foo" + }, + "body": { + "type": "BlockStatement", + "start": 21, + "end": 88, + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 88 + } + }, + "body": [ + { + "type": "DeclareModuleExports", + "start": 23, + "end": 54, + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 54 + } + }, + "typeAnnotation": { + "type": "TypeAnnotation", + "start": 45, + "end": 53, + "loc": { + "start": { + "line": 1, + "column": 45 + }, + "end": { + "line": 1, + "column": 53 + } + }, + "typeAnnotation": { + "type": "StringTypeAnnotation", + "start": 47, + "end": 53, + "loc": { + "start": { + "line": 1, + "column": 47 + }, + "end": { + "line": 1, + "column": 53 + } + } + } + } + }, + { + "type": "DeclareModuleExports", + "start": 55, + "end": 86, + "loc": { + "start": { + "line": 1, + "column": 55 + }, + "end": { + "line": 1, + "column": 86 + } + }, + "typeAnnotation": { + "type": "TypeAnnotation", + "start": 77, + "end": 85, + "loc": { + "start": { + "line": 1, + "column": 77 + }, + "end": { + "line": 1, + "column": 85 + } + }, + "typeAnnotation": { + "type": "NumberTypeAnnotation", + "start": 79, + "end": 85, + "loc": { + "start": { + "line": 1, + "column": 79 + }, + "end": { + "line": 1, + "column": 85 + } + } + } + } + } + ] + }, + "kind": "CommonJS" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/boolean-explicit/input.js b/packages/babel-parser/test/fixtures/flow/enum-declaration/boolean-explicit/input.js new file mode 100644 index 000000000000..7b63f4eb2962 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/boolean-explicit/input.js @@ -0,0 +1,4 @@ +enum E of boolean { + A = true, + B = false, +} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/boolean-explicit/output.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/boolean-explicit/output.json new file mode 100644 index 000000000000..b3c3ca8679ba --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/boolean-explicit/output.json @@ -0,0 +1,181 @@ +{ + "type": "File", + "start": 0, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "EnumDeclaration", + "start": 0, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 5, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + }, + "identifierName": "E" + }, + "name": "E" + }, + "body": { + "type": "EnumBooleanBody", + "start": 7, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "explicitType": true, + "members": [ + { + "type": "EnumBooleanMember", + "start": 22, + "end": 30, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 10 + } + }, + "id": { + "type": "Identifier", + "start": 22, + "end": 23, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 3 + }, + "identifierName": "A" + }, + "name": "A" + }, + "init": { + "type": "BooleanLiteral", + "start": 26, + "end": 30, + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 10 + } + }, + "value": true + } + }, + { + "type": "EnumBooleanMember", + "start": 34, + "end": 43, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 11 + } + }, + "id": { + "type": "Identifier", + "start": 34, + "end": 35, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 3 + }, + "identifierName": "B" + }, + "name": "B" + }, + "init": { + "type": "BooleanLiteral", + "start": 38, + "end": 43, + "loc": { + "start": { + "line": 3, + "column": 6 + }, + "end": { + "line": 3, + "column": 11 + } + }, + "value": false + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/boolean-implicit/input.js b/packages/babel-parser/test/fixtures/flow/enum-declaration/boolean-implicit/input.js new file mode 100644 index 000000000000..6ab49ea7b2b8 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/boolean-implicit/input.js @@ -0,0 +1,4 @@ +enum E { + A = true, + B = false, +} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/boolean-implicit/output.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/boolean-implicit/output.json new file mode 100644 index 000000000000..13f9c5e69ba3 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/boolean-implicit/output.json @@ -0,0 +1,181 @@ +{ + "type": "File", + "start": 0, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "EnumDeclaration", + "start": 0, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 5, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + }, + "identifierName": "E" + }, + "name": "E" + }, + "body": { + "type": "EnumBooleanBody", + "start": 7, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "explicitType": false, + "members": [ + { + "type": "EnumBooleanMember", + "start": 11, + "end": 19, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 10 + } + }, + "id": { + "type": "Identifier", + "start": 11, + "end": 12, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 3 + }, + "identifierName": "A" + }, + "name": "A" + }, + "init": { + "type": "BooleanLiteral", + "start": 15, + "end": 19, + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 10 + } + }, + "value": true + } + }, + { + "type": "EnumBooleanMember", + "start": 23, + "end": 32, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 11 + } + }, + "id": { + "type": "Identifier", + "start": 23, + "end": 24, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 3 + }, + "identifierName": "B" + }, + "name": "B" + }, + "init": { + "type": "BooleanLiteral", + "start": 27, + "end": 32, + "loc": { + "start": { + "line": 3, + "column": 6 + }, + "end": { + "line": 3, + "column": 11 + } + }, + "value": false + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/boolean-member-not-initialized-explicit/input.js b/packages/babel-parser/test/fixtures/flow/enum-declaration/boolean-member-not-initialized-explicit/input.js new file mode 100644 index 000000000000..4fecb537fb2e --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/boolean-member-not-initialized-explicit/input.js @@ -0,0 +1,3 @@ +enum E of boolean { + A, +} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/boolean-member-not-initialized-explicit/options.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/boolean-member-not-initialized-explicit/options.json new file mode 100644 index 000000000000..53fd48c051cb --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/boolean-member-not-initialized-explicit/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["flow", { "enums": true }]] +} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/boolean-member-not-initialized-explicit/output.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/boolean-member-not-initialized-explicit/output.json new file mode 100644 index 000000000000..20ba8ebd29c7 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/boolean-member-not-initialized-explicit/output.json @@ -0,0 +1,87 @@ +{ + "type": "File", + "start": 0, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Boolean enum members need to be initialized. Use either `A = true,` or `A = false,` in enum `E`. (2:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "EnumDeclaration", + "start": 0, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 5, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + }, + "identifierName": "E" + }, + "name": "E" + }, + "body": { + "type": "EnumBooleanBody", + "start": 7, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "explicitType": true, + "members": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/boolean-member-not-initialized-implicit/input.js b/packages/babel-parser/test/fixtures/flow/enum-declaration/boolean-member-not-initialized-implicit/input.js new file mode 100644 index 000000000000..73704345dc4b --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/boolean-member-not-initialized-implicit/input.js @@ -0,0 +1,4 @@ +enum E { + A, + B = true, +} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/boolean-member-not-initialized-implicit/options.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/boolean-member-not-initialized-implicit/options.json new file mode 100644 index 000000000000..53fd48c051cb --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/boolean-member-not-initialized-implicit/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["flow", { "enums": true }]] +} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/boolean-member-not-initialized-implicit/output.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/boolean-member-not-initialized-implicit/output.json new file mode 100644 index 000000000000..689d03caa301 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/boolean-member-not-initialized-implicit/output.json @@ -0,0 +1,136 @@ +{ + "type": "File", + "start": 0, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Boolean enum members need to be initialized. Use either `A = true,` or `A = false,` in enum `E`. (2:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "EnumDeclaration", + "start": 0, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 5, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + }, + "identifierName": "E" + }, + "name": "E" + }, + "body": { + "type": "EnumBooleanBody", + "start": 7, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "explicitType": false, + "members": [ + { + "type": "EnumBooleanMember", + "start": 16, + "end": 24, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 10 + } + }, + "id": { + "type": "Identifier", + "start": 16, + "end": 17, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 3 + }, + "identifierName": "B" + }, + "name": "B" + }, + "init": { + "type": "BooleanLiteral", + "start": 20, + "end": 24, + "loc": { + "start": { + "line": 3, + "column": 6 + }, + "end": { + "line": 3, + "column": 10 + } + }, + "value": true + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/duplicate-member-name/input.js b/packages/babel-parser/test/fixtures/flow/enum-declaration/duplicate-member-name/input.js new file mode 100644 index 000000000000..c9fde50253ac --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/duplicate-member-name/input.js @@ -0,0 +1,4 @@ +enum E { + A, + A, +} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/duplicate-member-name/options.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/duplicate-member-name/options.json new file mode 100644 index 000000000000..53fd48c051cb --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/duplicate-member-name/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["flow", { "enums": true }]] +} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/duplicate-member-name/output.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/duplicate-member-name/output.json new file mode 100644 index 000000000000..0d9e8720f89e --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/duplicate-member-name/output.json @@ -0,0 +1,152 @@ +{ + "type": "File", + "start": 0, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Enum member names need to be unique, but the name `A` has already been used before in enum `E`. (3:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "EnumDeclaration", + "start": 0, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 5, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + }, + "identifierName": "E" + }, + "name": "E" + }, + "body": { + "type": "EnumStringBody", + "start": 7, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "explicitType": false, + "members": [ + { + "type": "EnumDefaultedMember", + "start": 11, + "end": 12, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 3 + } + }, + "id": { + "type": "Identifier", + "start": 11, + "end": 12, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 3 + }, + "identifierName": "A" + }, + "name": "A" + } + }, + { + "type": "EnumDefaultedMember", + "start": 16, + "end": 17, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 3 + } + }, + "id": { + "type": "Identifier", + "start": 16, + "end": 17, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 3 + }, + "identifierName": "A" + }, + "name": "A" + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/empty/input.js b/packages/babel-parser/test/fixtures/flow/enum-declaration/empty/input.js new file mode 100644 index 000000000000..714f607bf333 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/empty/input.js @@ -0,0 +1 @@ +enum E { } diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/empty/output.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/empty/output.json new file mode 100644 index 000000000000..c01edfa2f344 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/empty/output.json @@ -0,0 +1,84 @@ +{ + "type": "File", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "EnumDeclaration", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "id": { + "type": "Identifier", + "start": 5, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + }, + "identifierName": "E" + }, + "name": "E" + }, + "body": { + "type": "EnumStringBody", + "start": 7, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "explicitType": false, + "members": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/end-of-file/input.js b/packages/babel-parser/test/fixtures/flow/enum-declaration/end-of-file/input.js new file mode 100644 index 000000000000..e3caefb45c49 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/end-of-file/input.js @@ -0,0 +1 @@ +enum diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/end-of-file/options.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/end-of-file/options.json new file mode 100644 index 000000000000..030f339842d5 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/end-of-file/options.json @@ -0,0 +1,4 @@ +{ + "plugins": [["flow", { "enums": true }]], + "throws": "Unexpected token (1:4)" +} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/enum-name/input.js b/packages/babel-parser/test/fixtures/flow/enum-declaration/enum-name/input.js new file mode 100644 index 000000000000..8d057902fa7e --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/enum-name/input.js @@ -0,0 +1,2 @@ +enum type { +} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/enum-name/output.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/enum-name/output.json new file mode 100644 index 000000000000..00a5c58dd9e0 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/enum-name/output.json @@ -0,0 +1,84 @@ +{ + "type": "File", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 1 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "EnumDeclaration", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 5, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 9 + }, + "identifierName": "type" + }, + "name": "type" + }, + "body": { + "type": "EnumStringBody", + "start": 10, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 2, + "column": 1 + } + }, + "explicitType": false, + "members": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/export/input.js b/packages/babel-parser/test/fixtures/flow/enum-declaration/export/input.js new file mode 100644 index 000000000000..ebdc5a4a8bb8 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/export/input.js @@ -0,0 +1,3 @@ +export enum A {} + +export default enum B {} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/export/options.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/export/options.json new file mode 100644 index 000000000000..9d3b4fdaaa37 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/export/options.json @@ -0,0 +1,4 @@ +{ + "plugins": [["flow", { "enums": true }]], + "sourceType": "module" +} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/export/output.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/export/output.json new file mode 100644 index 000000000000..a62f9a9beb46 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/export/output.json @@ -0,0 +1,166 @@ +{ + "type": "File", + "start": 0, + "end": 42, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 24 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 42, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 24 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExportNamedDeclaration", + "start": 0, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "specifiers": [], + "source": null, + "exportKind": "value", + "declaration": { + "type": "EnumDeclaration", + "start": 7, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "id": { + "type": "Identifier", + "start": 12, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + }, + "identifierName": "A" + }, + "name": "A" + }, + "body": { + "type": "EnumStringBody", + "start": 14, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "explicitType": false, + "members": [] + } + } + }, + { + "type": "ExportDefaultDeclaration", + "start": 18, + "end": 42, + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 24 + } + }, + "declaration": { + "type": "EnumDeclaration", + "start": 33, + "end": 42, + "loc": { + "start": { + "line": 3, + "column": 15 + }, + "end": { + "line": 3, + "column": 24 + } + }, + "id": { + "type": "Identifier", + "start": 38, + "end": 39, + "loc": { + "start": { + "line": 3, + "column": 20 + }, + "end": { + "line": 3, + "column": 21 + }, + "identifierName": "B" + }, + "name": "B" + }, + "body": { + "type": "EnumStringBody", + "start": 40, + "end": 42, + "loc": { + "start": { + "line": 3, + "column": 22 + }, + "end": { + "line": 3, + "column": 24 + } + }, + "explicitType": false, + "members": [] + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/inconsistent-member-values-majority-defaulted/input.js b/packages/babel-parser/test/fixtures/flow/enum-declaration/inconsistent-member-values-majority-defaulted/input.js new file mode 100644 index 000000000000..5a639f107119 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/inconsistent-member-values-majority-defaulted/input.js @@ -0,0 +1,5 @@ +enum E { + A, + B, + C = 3, +} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/inconsistent-member-values-majority-defaulted/options.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/inconsistent-member-values-majority-defaulted/options.json new file mode 100644 index 000000000000..53fd48c051cb --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/inconsistent-member-values-majority-defaulted/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["flow", { "enums": true }]] +} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/inconsistent-member-values-majority-defaulted/output.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/inconsistent-member-values-majority-defaulted/output.json new file mode 100644 index 000000000000..e572b98f4ddf --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/inconsistent-member-values-majority-defaulted/output.json @@ -0,0 +1,87 @@ +{ + "type": "File", + "start": 0, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Enum `E` has inconsistent member initializers. Either use no initializers, or consistently use literals (either booleans, numbers, or strings) for all member initializers. (1:5)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "EnumDeclaration", + "start": 0, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 5, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + }, + "identifierName": "E" + }, + "name": "E" + }, + "body": { + "type": "EnumStringBody", + "start": 7, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "explicitType": false, + "members": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/inconsistent-member-values-mixed-initializers/input.js b/packages/babel-parser/test/fixtures/flow/enum-declaration/inconsistent-member-values-mixed-initializers/input.js new file mode 100644 index 000000000000..b0b10ec4d43a --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/inconsistent-member-values-mixed-initializers/input.js @@ -0,0 +1,4 @@ +enum E { + A = 1, + B = true, +} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/inconsistent-member-values-mixed-initializers/options.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/inconsistent-member-values-mixed-initializers/options.json new file mode 100644 index 000000000000..53fd48c051cb --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/inconsistent-member-values-mixed-initializers/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["flow", { "enums": true }]] +} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/inconsistent-member-values-mixed-initializers/output.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/inconsistent-member-values-mixed-initializers/output.json new file mode 100644 index 000000000000..fc89707351ee --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/inconsistent-member-values-mixed-initializers/output.json @@ -0,0 +1,87 @@ +{ + "type": "File", + "start": 0, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Enum `E` has inconsistent member initializers. Either use no initializers, or consistently use literals (either booleans, numbers, or strings) for all member initializers. (1:5)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "EnumDeclaration", + "start": 0, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 5, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + }, + "identifierName": "E" + }, + "name": "E" + }, + "body": { + "type": "EnumStringBody", + "start": 7, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "explicitType": false, + "members": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-explicit-type-expression/input.js b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-explicit-type-expression/input.js new file mode 100644 index 000000000000..e3353ef78879 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-explicit-type-expression/input.js @@ -0,0 +1,2 @@ +enum E of [] { +} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-explicit-type-expression/options.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-explicit-type-expression/options.json new file mode 100644 index 000000000000..9916e88639b9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-explicit-type-expression/options.json @@ -0,0 +1,4 @@ +{ + "plugins": [["flow", { "enums": true }]], + "throws": "Supplied enum type is not valid. Use one of `boolean`, `number`, `string`, or `symbol` in enum `E`. (1:10)" +} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-explicit-type-identifier/input.js b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-explicit-type-identifier/input.js new file mode 100644 index 000000000000..25bbeb7024e8 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-explicit-type-identifier/input.js @@ -0,0 +1,2 @@ +enum E of xxx { +} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-explicit-type-identifier/options.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-explicit-type-identifier/options.json new file mode 100644 index 000000000000..53fd48c051cb --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-explicit-type-identifier/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["flow", { "enums": true }]] +} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-explicit-type-identifier/output.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-explicit-type-identifier/output.json new file mode 100644 index 000000000000..c8665a0f248d --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-explicit-type-identifier/output.json @@ -0,0 +1,87 @@ +{ + "type": "File", + "start": 0, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Enum type `xxx` is not valid. Use one of `boolean`, `number`, `string`, or `symbol` in enum `E`. (1:14)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "EnumDeclaration", + "start": 0, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 5, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + }, + "identifierName": "E" + }, + "name": "E" + }, + "body": { + "type": "EnumStringBody", + "start": 7, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 2, + "column": 1 + } + }, + "explicitType": false, + "members": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-boolean-explicit-string/input.js b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-boolean-explicit-string/input.js new file mode 100644 index 000000000000..31e79ef9f119 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-boolean-explicit-string/input.js @@ -0,0 +1,3 @@ +enum E of string { + A = true, +} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-boolean-explicit-string/options.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-boolean-explicit-string/options.json new file mode 100644 index 000000000000..53fd48c051cb --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-boolean-explicit-string/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["flow", { "enums": true }]] +} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-boolean-explicit-string/output.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-boolean-explicit-string/output.json new file mode 100644 index 000000000000..8ee139f5c47c --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-boolean-explicit-string/output.json @@ -0,0 +1,87 @@ +{ + "type": "File", + "start": 0, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Enum `E` has type `string`, so the initializer of `A` needs to be a string literal. (2:6)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "EnumDeclaration", + "start": 0, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 5, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + }, + "identifierName": "E" + }, + "name": "E" + }, + "body": { + "type": "EnumStringBody", + "start": 7, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "explicitType": true, + "members": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-expression-explicit-boolean/input.js b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-expression-explicit-boolean/input.js new file mode 100644 index 000000000000..d4f1afa92f09 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-expression-explicit-boolean/input.js @@ -0,0 +1,3 @@ +enum E of boolean { + A = 1 + 2, +} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-expression-explicit-boolean/options.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-expression-explicit-boolean/options.json new file mode 100644 index 000000000000..14ed173defa0 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-expression-explicit-boolean/options.json @@ -0,0 +1,4 @@ +{ + "plugins": [["flow", { "enums": true }]], + "throws": "Enum `E` has type `boolean`, so the initializer of `A` needs to be a boolean literal. (2:6)" +} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-expression-explicit-number/input.js b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-expression-explicit-number/input.js new file mode 100644 index 000000000000..a6f7ed2152c2 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-expression-explicit-number/input.js @@ -0,0 +1,3 @@ +enum E of number { + A = 1 + 2, +} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-expression-explicit-number/options.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-expression-explicit-number/options.json new file mode 100644 index 000000000000..7a8a81f75442 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-expression-explicit-number/options.json @@ -0,0 +1,4 @@ +{ + "plugins": [["flow", { "enums": true }]], + "throws": "Enum `E` has type `number`, so the initializer of `A` needs to be a number literal. (2:6)" +} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-expression-explicit-string/input.js b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-expression-explicit-string/input.js new file mode 100644 index 000000000000..704efcf615b5 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-expression-explicit-string/input.js @@ -0,0 +1,3 @@ +enum E of string { + A = 1 + 2, +} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-expression-explicit-string/options.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-expression-explicit-string/options.json new file mode 100644 index 000000000000..1587909dd62e --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-expression-explicit-string/options.json @@ -0,0 +1,4 @@ +{ + "plugins": [["flow", { "enums": true }]], + "throws": "Enum `E` has type `string`, so the initializer of `A` needs to be a string literal. (2:6)" +} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-expression-explicit-symbol/input.js b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-expression-explicit-symbol/input.js new file mode 100644 index 000000000000..d4acb6dfd235 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-expression-explicit-symbol/input.js @@ -0,0 +1,3 @@ +enum E of symbol { + A = 1 + 2, +} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-expression-explicit-symbol/options.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-expression-explicit-symbol/options.json new file mode 100644 index 000000000000..e9b2692f126a --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-expression-explicit-symbol/options.json @@ -0,0 +1,4 @@ +{ + "plugins": [["flow", { "enums": true }]], + "throws": "Symbol enum members cannot be initialized. Use `A,` in enum `E`. (2:6)" +} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-expression-implicit/input.js b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-expression-implicit/input.js new file mode 100644 index 000000000000..bed31f7fdc1c --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-expression-implicit/input.js @@ -0,0 +1,3 @@ +enum E { + A = 1 + 2, +} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-expression-implicit/options.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-expression-implicit/options.json new file mode 100644 index 000000000000..282f44e03ab4 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-expression-implicit/options.json @@ -0,0 +1,4 @@ +{ + "plugins": [["flow", { "enums": true }]], + "throws": "The enum member initializer for `A` needs to be a literal (either a boolean, number, or string) in enum `E`. (2:6)" +} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-literal-explicit-symbol/input.js b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-literal-explicit-symbol/input.js new file mode 100644 index 000000000000..dc8429b75342 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-literal-explicit-symbol/input.js @@ -0,0 +1,3 @@ +enum E of symbol { + A = 1, +} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-literal-explicit-symbol/options.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-literal-explicit-symbol/options.json new file mode 100644 index 000000000000..53fd48c051cb --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-literal-explicit-symbol/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["flow", { "enums": true }]] +} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-literal-explicit-symbol/output.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-literal-explicit-symbol/output.json new file mode 100644 index 000000000000..8c2e7e69ab33 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-literal-explicit-symbol/output.json @@ -0,0 +1,86 @@ +{ + "type": "File", + "start": 0, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Symbol enum members cannot be initialized. Use `A,` in enum `E`. (2:6)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "EnumDeclaration", + "start": 0, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 5, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + }, + "identifierName": "E" + }, + "name": "E" + }, + "body": { + "type": "EnumSymbolBody", + "start": 7, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "members": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-number-explicit-boolean/input.js b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-number-explicit-boolean/input.js new file mode 100644 index 000000000000..81e1097efdd9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-number-explicit-boolean/input.js @@ -0,0 +1,3 @@ +enum E of boolean { + A = 1, +} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-number-explicit-boolean/options.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-number-explicit-boolean/options.json new file mode 100644 index 000000000000..53fd48c051cb --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-number-explicit-boolean/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["flow", { "enums": true }]] +} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-number-explicit-boolean/output.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-number-explicit-boolean/output.json new file mode 100644 index 000000000000..ac17cf909b1c --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-number-explicit-boolean/output.json @@ -0,0 +1,87 @@ +{ + "type": "File", + "start": 0, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Enum `E` has type `boolean`, so the initializer of `A` needs to be a boolean literal. (2:6)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "EnumDeclaration", + "start": 0, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 5, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + }, + "identifierName": "E" + }, + "name": "E" + }, + "body": { + "type": "EnumBooleanBody", + "start": 7, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "explicitType": true, + "members": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-number-explicit-string/input.js b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-number-explicit-string/input.js new file mode 100644 index 000000000000..708914906e1d --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-number-explicit-string/input.js @@ -0,0 +1,3 @@ +enum E of string { + A = 1, +} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-number-explicit-string/options.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-number-explicit-string/options.json new file mode 100644 index 000000000000..53fd48c051cb --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-number-explicit-string/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["flow", { "enums": true }]] +} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-number-explicit-string/output.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-number-explicit-string/output.json new file mode 100644 index 000000000000..5dbb2447870d --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-number-explicit-string/output.json @@ -0,0 +1,87 @@ +{ + "type": "File", + "start": 0, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Enum `E` has type `string`, so the initializer of `A` needs to be a string literal. (2:6)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "EnumDeclaration", + "start": 0, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 5, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + }, + "identifierName": "E" + }, + "name": "E" + }, + "body": { + "type": "EnumStringBody", + "start": 7, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "explicitType": true, + "members": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-parenthesized/input.js b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-parenthesized/input.js new file mode 100644 index 000000000000..92cc2012d905 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-parenthesized/input.js @@ -0,0 +1,3 @@ +enum E { + A = (1), +} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-parenthesized/options.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-parenthesized/options.json new file mode 100644 index 000000000000..282f44e03ab4 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-parenthesized/options.json @@ -0,0 +1,4 @@ +{ + "plugins": [["flow", { "enums": true }]], + "throws": "The enum member initializer for `A` needs to be a literal (either a boolean, number, or string) in enum `E`. (2:6)" +} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-string-explicit-boolean/input.js b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-string-explicit-boolean/input.js new file mode 100644 index 000000000000..86674e7f2053 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-string-explicit-boolean/input.js @@ -0,0 +1,3 @@ +enum E of boolean { + A = "hi", +} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-string-explicit-boolean/options.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-string-explicit-boolean/options.json new file mode 100644 index 000000000000..53fd48c051cb --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-string-explicit-boolean/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["flow", { "enums": true }]] +} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-string-explicit-boolean/output.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-string-explicit-boolean/output.json new file mode 100644 index 000000000000..73b86a84e35a --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-string-explicit-boolean/output.json @@ -0,0 +1,87 @@ +{ + "type": "File", + "start": 0, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Enum `E` has type `boolean`, so the initializer of `A` needs to be a boolean literal. (2:6)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "EnumDeclaration", + "start": 0, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 5, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + }, + "identifierName": "E" + }, + "name": "E" + }, + "body": { + "type": "EnumBooleanBody", + "start": 7, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "explicitType": true, + "members": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-string-explicit-number/input.js b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-string-explicit-number/input.js new file mode 100644 index 000000000000..5b0a7937af0a --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-string-explicit-number/input.js @@ -0,0 +1,3 @@ +enum E of number { + A = "hi", +} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-string-explicit-number/options.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-string-explicit-number/options.json new file mode 100644 index 000000000000..53fd48c051cb --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-string-explicit-number/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["flow", { "enums": true }]] +} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-string-explicit-number/output.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-string-explicit-number/output.json new file mode 100644 index 000000000000..15e121566e51 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-string-explicit-number/output.json @@ -0,0 +1,87 @@ +{ + "type": "File", + "start": 0, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Enum `E` has type `number`, so the initializer of `A` needs to be a number literal. (2:6)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "EnumDeclaration", + "start": 0, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 5, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + }, + "identifierName": "E" + }, + "name": "E" + }, + "body": { + "type": "EnumNumberBody", + "start": 7, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "explicitType": true, + "members": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-name/input.js b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-name/input.js new file mode 100644 index 000000000000..3604a85bb2d4 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-name/input.js @@ -0,0 +1,4 @@ +enum E { + foo, + bar, +} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-name/options.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-name/options.json new file mode 100644 index 000000000000..53fd48c051cb --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-name/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["flow", { "enums": true }]] +} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-name/output.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-name/output.json new file mode 100644 index 000000000000..9c80943ab347 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-name/output.json @@ -0,0 +1,153 @@ +{ + "type": "File", + "start": 0, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Enum member names cannot start with lowercase 'a' through 'z'. Instead of using `foo`, consider using `Foo`, in enum `E`. (2:2)", + "SyntaxError: Enum member names cannot start with lowercase 'a' through 'z'. Instead of using `bar`, consider using `Bar`, in enum `E`. (3:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "EnumDeclaration", + "start": 0, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 5, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + }, + "identifierName": "E" + }, + "name": "E" + }, + "body": { + "type": "EnumStringBody", + "start": 7, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "explicitType": false, + "members": [ + { + "type": "EnumDefaultedMember", + "start": 11, + "end": 14, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 5 + } + }, + "id": { + "type": "Identifier", + "start": 11, + "end": 14, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 5 + }, + "identifierName": "foo" + }, + "name": "foo" + } + }, + { + "type": "EnumDefaultedMember", + "start": 18, + "end": 21, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 5 + } + }, + "id": { + "type": "Identifier", + "start": 18, + "end": 21, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 5 + }, + "identifierName": "bar" + }, + "name": "bar" + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/no-trailing-comma/input.js b/packages/babel-parser/test/fixtures/flow/enum-declaration/no-trailing-comma/input.js new file mode 100644 index 000000000000..228a928299de --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/no-trailing-comma/input.js @@ -0,0 +1,3 @@ +enum E { + A +} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/no-trailing-comma/output.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/no-trailing-comma/output.json new file mode 100644 index 000000000000..fd6f4450b1a6 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/no-trailing-comma/output.json @@ -0,0 +1,117 @@ +{ + "type": "File", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "EnumDeclaration", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 5, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + }, + "identifierName": "E" + }, + "name": "E" + }, + "body": { + "type": "EnumStringBody", + "start": 7, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "explicitType": false, + "members": [ + { + "type": "EnumDefaultedMember", + "start": 11, + "end": 12, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 3 + } + }, + "id": { + "type": "Identifier", + "start": 11, + "end": 12, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 3 + }, + "identifierName": "A" + }, + "name": "A" + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/number-explicit/input.js b/packages/babel-parser/test/fixtures/flow/enum-declaration/number-explicit/input.js new file mode 100644 index 000000000000..f597c5898aa0 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/number-explicit/input.js @@ -0,0 +1,4 @@ +enum E of number { + A = 1, + B = 2, +} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/number-explicit/output.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/number-explicit/output.json new file mode 100644 index 000000000000..e03f6e9712bd --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/number-explicit/output.json @@ -0,0 +1,189 @@ +{ + "type": "File", + "start": 0, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "EnumDeclaration", + "start": 0, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 5, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + }, + "identifierName": "E" + }, + "name": "E" + }, + "body": { + "type": "EnumNumberBody", + "start": 7, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "explicitType": true, + "members": [ + { + "type": "EnumNumberMember", + "start": 21, + "end": 26, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 7 + } + }, + "id": { + "type": "Identifier", + "start": 21, + "end": 22, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 3 + }, + "identifierName": "A" + }, + "name": "A" + }, + "init": { + "type": "NumericLiteral", + "start": 25, + "end": 26, + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 7 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + }, + { + "type": "EnumNumberMember", + "start": 30, + "end": 35, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 7 + } + }, + "id": { + "type": "Identifier", + "start": 30, + "end": 31, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 3 + }, + "identifierName": "B" + }, + "name": "B" + }, + "init": { + "type": "NumericLiteral", + "start": 34, + "end": 35, + "loc": { + "start": { + "line": 3, + "column": 6 + }, + "end": { + "line": 3, + "column": 7 + } + }, + "extra": { + "rawValue": 2, + "raw": "2" + }, + "value": 2 + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/number-implicit/input.js b/packages/babel-parser/test/fixtures/flow/enum-declaration/number-implicit/input.js new file mode 100644 index 000000000000..1b99bb7ff34a --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/number-implicit/input.js @@ -0,0 +1,4 @@ +enum E { + A = 1, + B = 2, +} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/number-implicit/output.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/number-implicit/output.json new file mode 100644 index 000000000000..9a2f18345cd2 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/number-implicit/output.json @@ -0,0 +1,189 @@ +{ + "type": "File", + "start": 0, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "EnumDeclaration", + "start": 0, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 5, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + }, + "identifierName": "E" + }, + "name": "E" + }, + "body": { + "type": "EnumNumberBody", + "start": 7, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "explicitType": false, + "members": [ + { + "type": "EnumNumberMember", + "start": 11, + "end": 16, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 7 + } + }, + "id": { + "type": "Identifier", + "start": 11, + "end": 12, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 3 + }, + "identifierName": "A" + }, + "name": "A" + }, + "init": { + "type": "NumericLiteral", + "start": 15, + "end": 16, + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 7 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + }, + { + "type": "EnumNumberMember", + "start": 20, + "end": 25, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 7 + } + }, + "id": { + "type": "Identifier", + "start": 20, + "end": 21, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 3 + }, + "identifierName": "B" + }, + "name": "B" + }, + "init": { + "type": "NumericLiteral", + "start": 24, + "end": 25, + "loc": { + "start": { + "line": 3, + "column": 6 + }, + "end": { + "line": 3, + "column": 7 + } + }, + "extra": { + "rawValue": 2, + "raw": "2" + }, + "value": 2 + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/number-member-not-initialized-explicit/input.js b/packages/babel-parser/test/fixtures/flow/enum-declaration/number-member-not-initialized-explicit/input.js new file mode 100644 index 000000000000..7f4f9cb05bbf --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/number-member-not-initialized-explicit/input.js @@ -0,0 +1,3 @@ +enum E of number { + A, +} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/number-member-not-initialized-explicit/options.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/number-member-not-initialized-explicit/options.json new file mode 100644 index 000000000000..53fd48c051cb --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/number-member-not-initialized-explicit/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["flow", { "enums": true }]] +} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/number-member-not-initialized-explicit/output.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/number-member-not-initialized-explicit/output.json new file mode 100644 index 000000000000..399366269eef --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/number-member-not-initialized-explicit/output.json @@ -0,0 +1,87 @@ +{ + "type": "File", + "start": 0, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Number enum members need to be initialized, e.g. `A = 1` in enum `E`. (2:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "EnumDeclaration", + "start": 0, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 5, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + }, + "identifierName": "E" + }, + "name": "E" + }, + "body": { + "type": "EnumNumberBody", + "start": 7, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "explicitType": true, + "members": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/number-member-not-initialized-implicit/input.js b/packages/babel-parser/test/fixtures/flow/enum-declaration/number-member-not-initialized-implicit/input.js new file mode 100644 index 000000000000..a435e44e3da9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/number-member-not-initialized-implicit/input.js @@ -0,0 +1,4 @@ +enum E { + A, + B = 1, +} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/number-member-not-initialized-implicit/options.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/number-member-not-initialized-implicit/options.json new file mode 100644 index 000000000000..53fd48c051cb --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/number-member-not-initialized-implicit/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["flow", { "enums": true }]] +} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/number-member-not-initialized-implicit/output.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/number-member-not-initialized-implicit/output.json new file mode 100644 index 000000000000..f2277d9ffcc8 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/number-member-not-initialized-implicit/output.json @@ -0,0 +1,140 @@ +{ + "type": "File", + "start": 0, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Number enum members need to be initialized, e.g. `A = 1` in enum `E`. (2:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "EnumDeclaration", + "start": 0, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 5, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + }, + "identifierName": "E" + }, + "name": "E" + }, + "body": { + "type": "EnumNumberBody", + "start": 7, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "explicitType": false, + "members": [ + { + "type": "EnumNumberMember", + "start": 16, + "end": 21, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 7 + } + }, + "id": { + "type": "Identifier", + "start": 16, + "end": 17, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 3 + }, + "identifierName": "B" + }, + "name": "B" + }, + "init": { + "type": "NumericLiteral", + "start": 20, + "end": 21, + "loc": { + "start": { + "line": 3, + "column": 6 + }, + "end": { + "line": 3, + "column": 7 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/options.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/options.json new file mode 100644 index 000000000000..53fd48c051cb --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["flow", { "enums": true }]] +} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/reserved-word-enum-name/input.js b/packages/babel-parser/test/fixtures/flow/enum-declaration/reserved-word-enum-name/input.js new file mode 100644 index 000000000000..95350dba2f86 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/reserved-word-enum-name/input.js @@ -0,0 +1,2 @@ +enum class { +} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/reserved-word-enum-name/options.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/reserved-word-enum-name/options.json new file mode 100644 index 000000000000..53fd48c051cb --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/reserved-word-enum-name/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["flow", { "enums": true }]] +} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/reserved-word-enum-name/output.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/reserved-word-enum-name/output.json new file mode 100644 index 000000000000..57e3c5d82dcd --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/reserved-word-enum-name/output.json @@ -0,0 +1,87 @@ +{ + "type": "File", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Unexpected keyword 'class' (1:5)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "EnumDeclaration", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 5, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 10 + }, + "identifierName": "class" + }, + "name": "class" + }, + "body": { + "type": "EnumStringBody", + "start": 11, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 2, + "column": 1 + } + }, + "explicitType": false, + "members": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/string-explicit-defaulted/input.js b/packages/babel-parser/test/fixtures/flow/enum-declaration/string-explicit-defaulted/input.js new file mode 100644 index 000000000000..0d3f7fed8378 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/string-explicit-defaulted/input.js @@ -0,0 +1,4 @@ +enum E of string { + A, + B, +} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/string-explicit-defaulted/output.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/string-explicit-defaulted/output.json new file mode 100644 index 000000000000..4efdf8e46049 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/string-explicit-defaulted/output.json @@ -0,0 +1,149 @@ +{ + "type": "File", + "start": 0, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "EnumDeclaration", + "start": 0, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 5, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + }, + "identifierName": "E" + }, + "name": "E" + }, + "body": { + "type": "EnumStringBody", + "start": 7, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "explicitType": true, + "members": [ + { + "type": "EnumDefaultedMember", + "start": 21, + "end": 22, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 3 + } + }, + "id": { + "type": "Identifier", + "start": 21, + "end": 22, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 3 + }, + "identifierName": "A" + }, + "name": "A" + } + }, + { + "type": "EnumDefaultedMember", + "start": 26, + "end": 27, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 3 + } + }, + "id": { + "type": "Identifier", + "start": 26, + "end": 27, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 3 + }, + "identifierName": "B" + }, + "name": "B" + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/string-explicit-initialized/input.js b/packages/babel-parser/test/fixtures/flow/enum-declaration/string-explicit-initialized/input.js new file mode 100644 index 000000000000..4d27120ac56a --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/string-explicit-initialized/input.js @@ -0,0 +1,4 @@ +enum E of string { + A = "a", + B = "b", +} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/string-explicit-initialized/output.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/string-explicit-initialized/output.json new file mode 100644 index 000000000000..2e9c91c109ff --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/string-explicit-initialized/output.json @@ -0,0 +1,189 @@ +{ + "type": "File", + "start": 0, + "end": 42, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 42, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "EnumDeclaration", + "start": 0, + "end": 42, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 5, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + }, + "identifierName": "E" + }, + "name": "E" + }, + "body": { + "type": "EnumStringBody", + "start": 7, + "end": 42, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "explicitType": true, + "members": [ + { + "type": "EnumStringMember", + "start": 21, + "end": 28, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 9 + } + }, + "id": { + "type": "Identifier", + "start": 21, + "end": 22, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 3 + }, + "identifierName": "A" + }, + "name": "A" + }, + "init": { + "type": "StringLiteral", + "start": 25, + "end": 28, + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 9 + } + }, + "extra": { + "rawValue": "a", + "raw": "\"a\"" + }, + "value": "a" + } + }, + { + "type": "EnumStringMember", + "start": 32, + "end": 39, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 9 + } + }, + "id": { + "type": "Identifier", + "start": 32, + "end": 33, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 3 + }, + "identifierName": "B" + }, + "name": "B" + }, + "init": { + "type": "StringLiteral", + "start": 36, + "end": 39, + "loc": { + "start": { + "line": 3, + "column": 6 + }, + "end": { + "line": 3, + "column": 9 + } + }, + "extra": { + "rawValue": "b", + "raw": "\"b\"" + }, + "value": "b" + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/string-implicit-defaulted/input.js b/packages/babel-parser/test/fixtures/flow/enum-declaration/string-implicit-defaulted/input.js new file mode 100644 index 000000000000..b74648fd612c --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/string-implicit-defaulted/input.js @@ -0,0 +1,4 @@ +enum E { + A, + B, +} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/string-implicit-defaulted/output.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/string-implicit-defaulted/output.json new file mode 100644 index 000000000000..28842c5fd477 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/string-implicit-defaulted/output.json @@ -0,0 +1,149 @@ +{ + "type": "File", + "start": 0, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "EnumDeclaration", + "start": 0, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 5, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + }, + "identifierName": "E" + }, + "name": "E" + }, + "body": { + "type": "EnumStringBody", + "start": 7, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "explicitType": false, + "members": [ + { + "type": "EnumDefaultedMember", + "start": 11, + "end": 12, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 3 + } + }, + "id": { + "type": "Identifier", + "start": 11, + "end": 12, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 3 + }, + "identifierName": "A" + }, + "name": "A" + } + }, + { + "type": "EnumDefaultedMember", + "start": 16, + "end": 17, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 3 + } + }, + "id": { + "type": "Identifier", + "start": 16, + "end": 17, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 3 + }, + "identifierName": "B" + }, + "name": "B" + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/string-implicit-initialized/input.js b/packages/babel-parser/test/fixtures/flow/enum-declaration/string-implicit-initialized/input.js new file mode 100644 index 000000000000..d1b1c29fc8a8 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/string-implicit-initialized/input.js @@ -0,0 +1,4 @@ +enum E { + A = "a", + B = "b", +} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/string-implicit-initialized/output.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/string-implicit-initialized/output.json new file mode 100644 index 000000000000..1680f3f2cc51 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/string-implicit-initialized/output.json @@ -0,0 +1,189 @@ +{ + "type": "File", + "start": 0, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "EnumDeclaration", + "start": 0, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 5, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + }, + "identifierName": "E" + }, + "name": "E" + }, + "body": { + "type": "EnumStringBody", + "start": 7, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "explicitType": false, + "members": [ + { + "type": "EnumStringMember", + "start": 11, + "end": 18, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 9 + } + }, + "id": { + "type": "Identifier", + "start": 11, + "end": 12, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 3 + }, + "identifierName": "A" + }, + "name": "A" + }, + "init": { + "type": "StringLiteral", + "start": 15, + "end": 18, + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 9 + } + }, + "extra": { + "rawValue": "a", + "raw": "\"a\"" + }, + "value": "a" + } + }, + { + "type": "EnumStringMember", + "start": 22, + "end": 29, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 9 + } + }, + "id": { + "type": "Identifier", + "start": 22, + "end": 23, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 3 + }, + "identifierName": "B" + }, + "name": "B" + }, + "init": { + "type": "StringLiteral", + "start": 26, + "end": 29, + "loc": { + "start": { + "line": 3, + "column": 6 + }, + "end": { + "line": 3, + "column": 9 + } + }, + "extra": { + "rawValue": "b", + "raw": "\"b\"" + }, + "value": "b" + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/string-member-inconsistently-initialized-majority-defaulted/input.js b/packages/babel-parser/test/fixtures/flow/enum-declaration/string-member-inconsistently-initialized-majority-defaulted/input.js new file mode 100644 index 000000000000..279605f466c4 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/string-member-inconsistently-initialized-majority-defaulted/input.js @@ -0,0 +1,5 @@ +enum E of string { + A = "a", + B, + C, +} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/string-member-inconsistently-initialized-majority-defaulted/options.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/string-member-inconsistently-initialized-majority-defaulted/options.json new file mode 100644 index 000000000000..53fd48c051cb --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/string-member-inconsistently-initialized-majority-defaulted/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["flow", { "enums": true }]] +} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/string-member-inconsistently-initialized-majority-defaulted/output.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/string-member-inconsistently-initialized-majority-defaulted/output.json new file mode 100644 index 000000000000..b5a5dc4951a9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/string-member-inconsistently-initialized-majority-defaulted/output.json @@ -0,0 +1,152 @@ +{ + "type": "File", + "start": 0, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "errors": [ + "SyntaxError: String enum members need to consistently either all use initializers, or use no initializers, in enum `E`. (2:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "EnumDeclaration", + "start": 0, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 5, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + }, + "identifierName": "E" + }, + "name": "E" + }, + "body": { + "type": "EnumStringBody", + "start": 7, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "explicitType": true, + "members": [ + { + "type": "EnumDefaultedMember", + "start": 32, + "end": 33, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 3 + } + }, + "id": { + "type": "Identifier", + "start": 32, + "end": 33, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 3 + }, + "identifierName": "B" + }, + "name": "B" + } + }, + { + "type": "EnumDefaultedMember", + "start": 37, + "end": 38, + "loc": { + "start": { + "line": 4, + "column": 2 + }, + "end": { + "line": 4, + "column": 3 + } + }, + "id": { + "type": "Identifier", + "start": 37, + "end": 38, + "loc": { + "start": { + "line": 4, + "column": 2 + }, + "end": { + "line": 4, + "column": 3 + }, + "identifierName": "C" + }, + "name": "C" + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/string-member-inconsistently-initialized-majority-initialized/input.js b/packages/babel-parser/test/fixtures/flow/enum-declaration/string-member-inconsistently-initialized-majority-initialized/input.js new file mode 100644 index 000000000000..e8db50effe4d --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/string-member-inconsistently-initialized-majority-initialized/input.js @@ -0,0 +1,5 @@ +enum E of string { + A, + B = "b", + C = "c", +} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/string-member-inconsistently-initialized-majority-initialized/options.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/string-member-inconsistently-initialized-majority-initialized/options.json new file mode 100644 index 000000000000..53fd48c051cb --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/string-member-inconsistently-initialized-majority-initialized/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["flow", { "enums": true }]] +} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/string-member-inconsistently-initialized-majority-initialized/output.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/string-member-inconsistently-initialized-majority-initialized/output.json new file mode 100644 index 000000000000..19e00f8d51c7 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/string-member-inconsistently-initialized-majority-initialized/output.json @@ -0,0 +1,192 @@ +{ + "type": "File", + "start": 0, + "end": 47, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "errors": [ + "SyntaxError: String enum members need to consistently either all use initializers, or use no initializers, in enum `E`. (2:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 47, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "EnumDeclaration", + "start": 0, + "end": 47, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 5, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + }, + "identifierName": "E" + }, + "name": "E" + }, + "body": { + "type": "EnumStringBody", + "start": 7, + "end": 47, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "explicitType": true, + "members": [ + { + "type": "EnumStringMember", + "start": 26, + "end": 33, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 9 + } + }, + "id": { + "type": "Identifier", + "start": 26, + "end": 27, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 3 + }, + "identifierName": "B" + }, + "name": "B" + }, + "init": { + "type": "StringLiteral", + "start": 30, + "end": 33, + "loc": { + "start": { + "line": 3, + "column": 6 + }, + "end": { + "line": 3, + "column": 9 + } + }, + "extra": { + "rawValue": "b", + "raw": "\"b\"" + }, + "value": "b" + } + }, + { + "type": "EnumStringMember", + "start": 37, + "end": 44, + "loc": { + "start": { + "line": 4, + "column": 2 + }, + "end": { + "line": 4, + "column": 9 + } + }, + "id": { + "type": "Identifier", + "start": 37, + "end": 38, + "loc": { + "start": { + "line": 4, + "column": 2 + }, + "end": { + "line": 4, + "column": 3 + }, + "identifierName": "C" + }, + "name": "C" + }, + "init": { + "type": "StringLiteral", + "start": 41, + "end": 44, + "loc": { + "start": { + "line": 4, + "column": 6 + }, + "end": { + "line": 4, + "column": 9 + } + }, + "extra": { + "rawValue": "c", + "raw": "\"c\"" + }, + "value": "c" + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/symbol/input.js b/packages/babel-parser/test/fixtures/flow/enum-declaration/symbol/input.js new file mode 100644 index 000000000000..26e5377f5e71 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/symbol/input.js @@ -0,0 +1,4 @@ +enum E of symbol { + A, + B, +} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/symbol/output.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/symbol/output.json new file mode 100644 index 000000000000..b93b653940b8 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/symbol/output.json @@ -0,0 +1,148 @@ +{ + "type": "File", + "start": 0, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "EnumDeclaration", + "start": 0, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 5, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + }, + "identifierName": "E" + }, + "name": "E" + }, + "body": { + "type": "EnumSymbolBody", + "start": 7, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "members": [ + { + "type": "EnumDefaultedMember", + "start": 21, + "end": 22, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 3 + } + }, + "id": { + "type": "Identifier", + "start": 21, + "end": 22, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 3 + }, + "identifierName": "A" + }, + "name": "A" + } + }, + { + "type": "EnumDefaultedMember", + "start": 26, + "end": 27, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 3 + } + }, + "id": { + "type": "Identifier", + "start": 26, + "end": 27, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 3 + }, + "identifierName": "B" + }, + "name": "B" + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_disallowed_in_non_objects1/options.json b/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_disallowed_in_non_objects1/options.json index c9188366d4e8..2104ca43283f 100644 --- a/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_disallowed_in_non_objects1/options.json +++ b/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_disallowed_in_non_objects1/options.json @@ -1,5 +1,3 @@ { - "sourceType": "module", - "plugins": ["jsx", "flow"], - "throws": "Spread operator cannot appear in class or interface definitions (3:2)" + "sourceType": "module" } diff --git a/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_disallowed_in_non_objects1/output.json b/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_disallowed_in_non_objects1/output.json new file mode 100644 index 000000000000..f896b9fffbcb --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_disallowed_in_non_objects1/output.json @@ -0,0 +1,130 @@ +{ + "type": "File", + "start": 0, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Explicit inexact syntax cannot appear in class or interface definitions (3:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "DeclareClass", + "start": 8, + "end": 34, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 22, + "end": 23, + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 15 + }, + "identifierName": "A" + }, + "name": "A" + }, + "typeParameters": null, + "extends": [], + "implements": [], + "mixins": [], + "body": { + "type": "ObjectTypeAnnotation", + "start": 24, + "end": 34, + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "callProperties": [], + "properties": [], + "indexers": [], + "internalSlots": [], + "exact": false + }, + "leadingComments": [ + { + "type": "CommentLine", + "value": "@flow", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } + } + ] + } + ], + "directives": [] + }, + "comments": [ + { + "type": "CommentLine", + "value": "@flow", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } + } + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_disallowed_in_non_objects2/options.json b/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_disallowed_in_non_objects2/options.json index 658f8c434773..2104ca43283f 100644 --- a/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_disallowed_in_non_objects2/options.json +++ b/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_disallowed_in_non_objects2/options.json @@ -1,5 +1,3 @@ { - "sourceType": "module", - "plugins": ["jsx", "flow"], - "throws": "Spread operator cannot appear in class or interface definitions (4:2)" + "sourceType": "module" } diff --git a/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_disallowed_in_non_objects2/output.json b/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_disallowed_in_non_objects2/output.json new file mode 100644 index 000000000000..6a0edc43c316 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_disallowed_in_non_objects2/output.json @@ -0,0 +1,184 @@ +{ + "type": "File", + "start": 0, + "end": 49, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Explicit inexact syntax cannot appear in class or interface definitions (4:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 49, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "DeclareClass", + "start": 8, + "end": 49, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 22, + "end": 23, + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 15 + }, + "identifierName": "B" + }, + "name": "B" + }, + "typeParameters": null, + "extends": [], + "implements": [], + "mixins": [], + "body": { + "type": "ObjectTypeAnnotation", + "start": 24, + "end": 49, + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "callProperties": [], + "properties": [ + { + "type": "ObjectTypeProperty", + "start": 28, + "end": 39, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 13 + } + }, + "key": { + "type": "Identifier", + "start": 28, + "end": 31, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 5 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "static": false, + "proto": false, + "kind": "init", + "method": false, + "value": { + "type": "NumberTypeAnnotation", + "start": 33, + "end": 39, + "loc": { + "start": { + "line": 3, + "column": 7 + }, + "end": { + "line": 3, + "column": 13 + } + } + }, + "variance": null, + "optional": false + } + ], + "indexers": [], + "internalSlots": [], + "exact": false + }, + "leadingComments": [ + { + "type": "CommentLine", + "value": "@flow", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } + } + ] + } + ], + "directives": [] + }, + "comments": [ + { + "type": "CommentLine", + "value": "@flow", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } + } + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_disallowed_in_non_objects3/options.json b/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_disallowed_in_non_objects3/options.json index c9188366d4e8..d822c40fbba2 100644 --- a/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_disallowed_in_non_objects3/options.json +++ b/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_disallowed_in_non_objects3/options.json @@ -1,5 +1,4 @@ { "sourceType": "module", - "plugins": ["jsx", "flow"], - "throws": "Spread operator cannot appear in class or interface definitions (3:2)" + "plugins": ["jsx", "flow"] } diff --git a/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_disallowed_in_non_objects3/output.json b/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_disallowed_in_non_objects3/output.json new file mode 100644 index 000000000000..7fa5b4a0b07f --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_disallowed_in_non_objects3/output.json @@ -0,0 +1,185 @@ +{ + "type": "File", + "start": 0, + "end": 49, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Explicit inexact syntax cannot appear in class or interface definitions (3:2)", + "SyntaxError: Explicit inexact syntax must appear at the end of an inexact object (3:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 49, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "DeclareClass", + "start": 8, + "end": 49, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 22, + "end": 23, + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 15 + }, + "identifierName": "C" + }, + "name": "C" + }, + "typeParameters": null, + "extends": [], + "implements": [], + "mixins": [], + "body": { + "type": "ObjectTypeAnnotation", + "start": 24, + "end": 49, + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "callProperties": [], + "properties": [ + { + "type": "ObjectTypeProperty", + "start": 35, + "end": 46, + "loc": { + "start": { + "line": 4, + "column": 2 + }, + "end": { + "line": 4, + "column": 13 + } + }, + "key": { + "type": "Identifier", + "start": 35, + "end": 38, + "loc": { + "start": { + "line": 4, + "column": 2 + }, + "end": { + "line": 4, + "column": 5 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "static": false, + "proto": false, + "kind": "init", + "method": false, + "value": { + "type": "NumberTypeAnnotation", + "start": 40, + "end": 46, + "loc": { + "start": { + "line": 4, + "column": 7 + }, + "end": { + "line": 4, + "column": 13 + } + } + }, + "variance": null, + "optional": false + } + ], + "indexers": [], + "internalSlots": [], + "exact": false + }, + "leadingComments": [ + { + "type": "CommentLine", + "value": "@flow", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } + } + ] + } + ], + "directives": [] + }, + "comments": [ + { + "type": "CommentLine", + "value": "@flow", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } + } + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_disallowed_in_non_objects4/options.json b/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_disallowed_in_non_objects4/options.json index 658f8c434773..d822c40fbba2 100644 --- a/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_disallowed_in_non_objects4/options.json +++ b/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_disallowed_in_non_objects4/options.json @@ -1,5 +1,4 @@ { "sourceType": "module", - "plugins": ["jsx", "flow"], - "throws": "Spread operator cannot appear in class or interface definitions (4:2)" + "plugins": ["jsx", "flow"] } diff --git a/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_disallowed_in_non_objects4/output.json b/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_disallowed_in_non_objects4/output.json new file mode 100644 index 000000000000..224a0566437c --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_disallowed_in_non_objects4/output.json @@ -0,0 +1,238 @@ +{ + "type": "File", + "start": 0, + "end": 64, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 6, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Explicit inexact syntax cannot appear in class or interface definitions (4:2)", + "SyntaxError: Explicit inexact syntax must appear at the end of an inexact object (4:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 64, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 6, + "column": 1 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "DeclareClass", + "start": 8, + "end": 64, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 6, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 22, + "end": 23, + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 15 + }, + "identifierName": "D" + }, + "name": "D" + }, + "typeParameters": null, + "extends": [], + "implements": [], + "mixins": [], + "body": { + "type": "ObjectTypeAnnotation", + "start": 24, + "end": 64, + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 6, + "column": 1 + } + }, + "callProperties": [], + "properties": [ + { + "type": "ObjectTypeProperty", + "start": 28, + "end": 39, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 13 + } + }, + "key": { + "type": "Identifier", + "start": 28, + "end": 31, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 5 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "static": false, + "proto": false, + "kind": "init", + "method": false, + "value": { + "type": "NumberTypeAnnotation", + "start": 33, + "end": 39, + "loc": { + "start": { + "line": 3, + "column": 7 + }, + "end": { + "line": 3, + "column": 13 + } + } + }, + "variance": null, + "optional": false + }, + { + "type": "ObjectTypeProperty", + "start": 50, + "end": 61, + "loc": { + "start": { + "line": 5, + "column": 2 + }, + "end": { + "line": 5, + "column": 13 + } + }, + "key": { + "type": "Identifier", + "start": 50, + "end": 53, + "loc": { + "start": { + "line": 5, + "column": 2 + }, + "end": { + "line": 5, + "column": 5 + }, + "identifierName": "bar" + }, + "name": "bar" + }, + "static": false, + "proto": false, + "kind": "init", + "method": false, + "value": { + "type": "NumberTypeAnnotation", + "start": 55, + "end": 61, + "loc": { + "start": { + "line": 5, + "column": 7 + }, + "end": { + "line": 5, + "column": 13 + } + } + }, + "variance": null, + "optional": false + } + ], + "indexers": [], + "internalSlots": [], + "exact": false + }, + "leadingComments": [ + { + "type": "CommentLine", + "value": "@flow", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } + } + ] + } + ], + "directives": [] + }, + "comments": [ + { + "type": "CommentLine", + "value": "@flow", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } + } + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_disallowed_in_non_objects5/options.json b/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_disallowed_in_non_objects5/options.json deleted file mode 100644 index 658f8c434773..000000000000 --- a/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_disallowed_in_non_objects5/options.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "sourceType": "module", - "plugins": ["jsx", "flow"], - "throws": "Spread operator cannot appear in class or interface definitions (4:2)" -} diff --git a/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_disallowed_in_non_objects5/output.json b/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_disallowed_in_non_objects5/output.json new file mode 100644 index 000000000000..0f4fe47c8e64 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_disallowed_in_non_objects5/output.json @@ -0,0 +1,184 @@ +{ + "type": "File", + "start": 0, + "end": 45, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Explicit inexact syntax cannot appear in class or interface definitions (4:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 45, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "InterfaceDeclaration", + "start": 8, + "end": 45, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 18, + "end": 19, + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 11 + }, + "identifierName": "F" + }, + "name": "F" + }, + "typeParameters": null, + "extends": [], + "implements": [], + "mixins": [], + "body": { + "type": "ObjectTypeAnnotation", + "start": 20, + "end": 45, + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "callProperties": [], + "properties": [ + { + "type": "ObjectTypeProperty", + "start": 24, + "end": 35, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 13 + } + }, + "key": { + "type": "Identifier", + "start": 24, + "end": 27, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 5 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "static": false, + "proto": false, + "kind": "init", + "method": false, + "value": { + "type": "NumberTypeAnnotation", + "start": 29, + "end": 35, + "loc": { + "start": { + "line": 3, + "column": 7 + }, + "end": { + "line": 3, + "column": 13 + } + } + }, + "variance": null, + "optional": false + } + ], + "indexers": [], + "internalSlots": [], + "exact": false + }, + "leadingComments": [ + { + "type": "CommentLine", + "value": "@flow", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } + } + ] + } + ], + "directives": [] + }, + "comments": [ + { + "type": "CommentLine", + "value": "@flow", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } + } + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_disallowed_in_non_objects6/options.json b/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_disallowed_in_non_objects6/options.json index c9188366d4e8..d822c40fbba2 100644 --- a/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_disallowed_in_non_objects6/options.json +++ b/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_disallowed_in_non_objects6/options.json @@ -1,5 +1,4 @@ { "sourceType": "module", - "plugins": ["jsx", "flow"], - "throws": "Spread operator cannot appear in class or interface definitions (3:2)" + "plugins": ["jsx", "flow"] } diff --git a/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_disallowed_in_non_objects6/output.json b/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_disallowed_in_non_objects6/output.json new file mode 100644 index 000000000000..685bd5b4d17e --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_disallowed_in_non_objects6/output.json @@ -0,0 +1,185 @@ +{ + "type": "File", + "start": 0, + "end": 45, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Explicit inexact syntax cannot appear in class or interface definitions (3:2)", + "SyntaxError: Explicit inexact syntax must appear at the end of an inexact object (3:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 45, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "InterfaceDeclaration", + "start": 8, + "end": 45, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 18, + "end": 19, + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 11 + }, + "identifierName": "G" + }, + "name": "G" + }, + "typeParameters": null, + "extends": [], + "implements": [], + "mixins": [], + "body": { + "type": "ObjectTypeAnnotation", + "start": 20, + "end": 45, + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "callProperties": [], + "properties": [ + { + "type": "ObjectTypeProperty", + "start": 31, + "end": 42, + "loc": { + "start": { + "line": 4, + "column": 2 + }, + "end": { + "line": 4, + "column": 13 + } + }, + "key": { + "type": "Identifier", + "start": 31, + "end": 34, + "loc": { + "start": { + "line": 4, + "column": 2 + }, + "end": { + "line": 4, + "column": 5 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "static": false, + "proto": false, + "kind": "init", + "method": false, + "value": { + "type": "NumberTypeAnnotation", + "start": 36, + "end": 42, + "loc": { + "start": { + "line": 4, + "column": 7 + }, + "end": { + "line": 4, + "column": 13 + } + } + }, + "variance": null, + "optional": false + } + ], + "indexers": [], + "internalSlots": [], + "exact": false + }, + "leadingComments": [ + { + "type": "CommentLine", + "value": "@flow", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } + } + ] + } + ], + "directives": [] + }, + "comments": [ + { + "type": "CommentLine", + "value": "@flow", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } + } + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_disallowed_in_non_objects7/options.json b/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_disallowed_in_non_objects7/options.json index 658f8c434773..d822c40fbba2 100644 --- a/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_disallowed_in_non_objects7/options.json +++ b/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_disallowed_in_non_objects7/options.json @@ -1,5 +1,4 @@ { "sourceType": "module", - "plugins": ["jsx", "flow"], - "throws": "Spread operator cannot appear in class or interface definitions (4:2)" + "plugins": ["jsx", "flow"] } diff --git a/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_disallowed_in_non_objects7/output.json b/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_disallowed_in_non_objects7/output.json new file mode 100644 index 000000000000..37b85349439d --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_disallowed_in_non_objects7/output.json @@ -0,0 +1,238 @@ +{ + "type": "File", + "start": 0, + "end": 60, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 6, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Explicit inexact syntax cannot appear in class or interface definitions (4:2)", + "SyntaxError: Explicit inexact syntax must appear at the end of an inexact object (4:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 60, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 6, + "column": 1 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "InterfaceDeclaration", + "start": 8, + "end": 60, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 6, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 18, + "end": 19, + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 11 + }, + "identifierName": "H" + }, + "name": "H" + }, + "typeParameters": null, + "extends": [], + "implements": [], + "mixins": [], + "body": { + "type": "ObjectTypeAnnotation", + "start": 20, + "end": 60, + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 6, + "column": 1 + } + }, + "callProperties": [], + "properties": [ + { + "type": "ObjectTypeProperty", + "start": 24, + "end": 35, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 13 + } + }, + "key": { + "type": "Identifier", + "start": 24, + "end": 27, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 5 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "static": false, + "proto": false, + "kind": "init", + "method": false, + "value": { + "type": "NumberTypeAnnotation", + "start": 29, + "end": 35, + "loc": { + "start": { + "line": 3, + "column": 7 + }, + "end": { + "line": 3, + "column": 13 + } + } + }, + "variance": null, + "optional": false + }, + { + "type": "ObjectTypeProperty", + "start": 46, + "end": 57, + "loc": { + "start": { + "line": 5, + "column": 2 + }, + "end": { + "line": 5, + "column": 13 + } + }, + "key": { + "type": "Identifier", + "start": 46, + "end": 49, + "loc": { + "start": { + "line": 5, + "column": 2 + }, + "end": { + "line": 5, + "column": 5 + }, + "identifierName": "bar" + }, + "name": "bar" + }, + "static": false, + "proto": false, + "kind": "init", + "method": false, + "value": { + "type": "NumberTypeAnnotation", + "start": 51, + "end": 57, + "loc": { + "start": { + "line": 5, + "column": 7 + }, + "end": { + "line": 5, + "column": 13 + } + } + }, + "variance": null, + "optional": false + } + ], + "indexers": [], + "internalSlots": [], + "exact": false + }, + "leadingComments": [ + { + "type": "CommentLine", + "value": "@flow", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } + } + ] + } + ], + "directives": [] + }, + "comments": [ + { + "type": "CommentLine", + "value": "@flow", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } + } + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_forbidden_in_exact/options.json b/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_forbidden_in_exact/options.json index 49936ac94990..d822c40fbba2 100644 --- a/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_forbidden_in_exact/options.json +++ b/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_forbidden_in_exact/options.json @@ -1,5 +1,4 @@ { "sourceType": "module", - "plugins": ["jsx", "flow"], - "throws": "Explicit inexact syntax cannot appear inside an explicit exact object type (2:29)" + "plugins": ["jsx", "flow"] } diff --git a/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_forbidden_in_exact/output.json b/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_forbidden_in_exact/output.json new file mode 100644 index 000000000000..98ff5ceeead4 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_forbidden_in_exact/output.json @@ -0,0 +1,182 @@ +{ + "type": "File", + "start": 0, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 31 + } + }, + "errors": [ + "SyntaxError: Explicit inexact syntax cannot appear inside an explicit exact object type (2:25)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 31 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "TypeAlias", + "start": 8, + "end": 39, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 31 + } + }, + "id": { + "type": "Identifier", + "start": 13, + "end": 14, + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 6 + }, + "identifierName": "T" + }, + "name": "T" + }, + "typeParameters": null, + "right": { + "type": "ObjectTypeAnnotation", + "start": 17, + "end": 39, + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 31 + } + }, + "callProperties": [], + "properties": [ + { + "type": "ObjectTypeProperty", + "start": 20, + "end": 31, + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 23 + } + }, + "key": { + "type": "Identifier", + "start": 20, + "end": 23, + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 15 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "static": false, + "proto": false, + "kind": "init", + "method": false, + "value": { + "type": "NumberTypeAnnotation", + "start": 25, + "end": 31, + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 23 + } + } + }, + "variance": null, + "optional": false + } + ], + "indexers": [], + "internalSlots": [], + "exact": true, + "inexact": true + }, + "leadingComments": [ + { + "type": "CommentLine", + "value": "@flow", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } + } + ] + } + ], + "directives": [] + }, + "comments": [ + { + "type": "CommentLine", + "value": "@flow", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } + } + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_must_appear_last/options.json b/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_must_appear_last/options.json index ebb74417a527..d822c40fbba2 100644 --- a/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_must_appear_last/options.json +++ b/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_must_appear_last/options.json @@ -1,5 +1,4 @@ { "sourceType": "module", - "plugins": ["jsx", "flow"], - "throws": "Explicit inexact syntax must appear at the end of an inexact object (2:15)" + "plugins": ["jsx", "flow"] } diff --git a/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_must_appear_last/output.json b/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_must_appear_last/output.json new file mode 100644 index 000000000000..24b9575138dc --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_must_appear_last/output.json @@ -0,0 +1,182 @@ +{ + "type": "File", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 28 + } + }, + "errors": [ + "SyntaxError: Explicit inexact syntax must appear at the end of an inexact object (2:10)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 28 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "TypeAlias", + "start": 8, + "end": 36, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 28 + } + }, + "id": { + "type": "Identifier", + "start": 13, + "end": 14, + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 6 + }, + "identifierName": "T" + }, + "name": "T" + }, + "typeParameters": null, + "right": { + "type": "ObjectTypeAnnotation", + "start": 17, + "end": 35, + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 27 + } + }, + "callProperties": [], + "properties": [ + { + "type": "ObjectTypeProperty", + "start": 23, + "end": 34, + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 26 + } + }, + "key": { + "type": "Identifier", + "start": 23, + "end": 26, + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 18 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "static": false, + "proto": false, + "kind": "init", + "method": false, + "value": { + "type": "NumberTypeAnnotation", + "start": 28, + "end": 34, + "loc": { + "start": { + "line": 2, + "column": 20 + }, + "end": { + "line": 2, + "column": 26 + } + } + }, + "variance": null, + "optional": false + } + ], + "indexers": [], + "internalSlots": [], + "exact": false, + "inexact": true + }, + "leadingComments": [ + { + "type": "CommentLine", + "value": "@flow", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } + } + ] + } + ], + "directives": [] + }, + "comments": [ + { + "type": "CommentLine", + "value": "@flow", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } + } + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_object_invalid1/options.json b/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_object_invalid1/options.json index 6d703769bf61..d822c40fbba2 100644 --- a/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_object_invalid1/options.json +++ b/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_object_invalid1/options.json @@ -1,5 +1,4 @@ { "sourceType": "module", - "plugins": ["jsx", "flow"], - "throws": "Explicit inexact syntax must appear at the end of an inexact object (2:26)" + "plugins": ["jsx", "flow"] } diff --git a/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_object_invalid1/output.json b/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_object_invalid1/output.json new file mode 100644 index 000000000000..8efbd4b84fe9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_object_invalid1/output.json @@ -0,0 +1,235 @@ +{ + "type": "File", + "start": 0, + "end": 45, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 37 + } + }, + "errors": [ + "SyntaxError: Explicit inexact syntax must appear at the end of an inexact object (2:21)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 45, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 37 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "TypeAlias", + "start": 8, + "end": 45, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 37 + } + }, + "id": { + "type": "Identifier", + "start": 13, + "end": 14, + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 6 + }, + "identifierName": "T" + }, + "name": "T" + }, + "typeParameters": null, + "right": { + "type": "ObjectTypeAnnotation", + "start": 17, + "end": 44, + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 36 + } + }, + "callProperties": [], + "properties": [ + { + "type": "ObjectTypeProperty", + "start": 18, + "end": 27, + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 19 + } + }, + "key": { + "type": "Identifier", + "start": 18, + "end": 19, + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 11 + }, + "identifierName": "x" + }, + "name": "x" + }, + "static": false, + "proto": false, + "kind": "init", + "method": false, + "value": { + "type": "NumberTypeAnnotation", + "start": 21, + "end": 27, + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 19 + } + } + }, + "variance": null, + "optional": false + }, + { + "type": "ObjectTypeProperty", + "start": 34, + "end": 43, + "loc": { + "start": { + "line": 2, + "column": 26 + }, + "end": { + "line": 2, + "column": 35 + } + }, + "key": { + "type": "Identifier", + "start": 34, + "end": 35, + "loc": { + "start": { + "line": 2, + "column": 26 + }, + "end": { + "line": 2, + "column": 27 + }, + "identifierName": "y" + }, + "name": "y" + }, + "static": false, + "proto": false, + "kind": "init", + "method": false, + "value": { + "type": "NumberTypeAnnotation", + "start": 37, + "end": 43, + "loc": { + "start": { + "line": 2, + "column": 29 + }, + "end": { + "line": 2, + "column": 35 + } + } + }, + "variance": null, + "optional": false + } + ], + "indexers": [], + "internalSlots": [], + "exact": false, + "inexact": true + }, + "leadingComments": [ + { + "type": "CommentLine", + "value": "@flow", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } + } + ] + } + ], + "directives": [] + }, + "comments": [ + { + "type": "CommentLine", + "value": "@flow", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } + } + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_object_invalid2/options.json b/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_object_invalid2/options.json index 6d703769bf61..d822c40fbba2 100644 --- a/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_object_invalid2/options.json +++ b/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_object_invalid2/options.json @@ -1,5 +1,4 @@ { "sourceType": "module", - "plugins": ["jsx", "flow"], - "throws": "Explicit inexact syntax must appear at the end of an inexact object (2:26)" + "plugins": ["jsx", "flow"] } diff --git a/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_object_invalid2/output.json b/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_object_invalid2/output.json new file mode 100644 index 000000000000..fe5b3ee400f9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_object_invalid2/output.json @@ -0,0 +1,182 @@ +{ + "type": "File", + "start": 0, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 31 + } + }, + "errors": [ + "SyntaxError: Explicit inexact syntax must appear at the end of an inexact object (2:21)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 31 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "TypeAlias", + "start": 8, + "end": 39, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 31 + } + }, + "id": { + "type": "Identifier", + "start": 13, + "end": 14, + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 6 + }, + "identifierName": "U" + }, + "name": "U" + }, + "typeParameters": null, + "right": { + "type": "ObjectTypeAnnotation", + "start": 17, + "end": 38, + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 30 + } + }, + "callProperties": [], + "properties": [ + { + "type": "ObjectTypeProperty", + "start": 18, + "end": 27, + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 19 + } + }, + "key": { + "type": "Identifier", + "start": 18, + "end": 19, + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 11 + }, + "identifierName": "x" + }, + "name": "x" + }, + "static": false, + "proto": false, + "kind": "init", + "method": false, + "value": { + "type": "NumberTypeAnnotation", + "start": 21, + "end": 27, + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 19 + } + } + }, + "variance": null, + "optional": false + } + ], + "indexers": [], + "internalSlots": [], + "exact": false, + "inexact": true + }, + "leadingComments": [ + { + "type": "CommentLine", + "value": "@flow", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } + } + ] + } + ], + "directives": [] + }, + "comments": [ + { + "type": "CommentLine", + "value": "@flow", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } + } + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_object_invalid3/options.json b/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_object_invalid3/options.json index 6d703769bf61..d822c40fbba2 100644 --- a/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_object_invalid3/options.json +++ b/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_object_invalid3/options.json @@ -1,5 +1,4 @@ { "sourceType": "module", - "plugins": ["jsx", "flow"], - "throws": "Explicit inexact syntax must appear at the end of an inexact object (2:26)" + "plugins": ["jsx", "flow"] } diff --git a/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_object_invalid3/output.json b/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_object_invalid3/output.json new file mode 100644 index 000000000000..0bedbf8f82e4 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_object_invalid3/output.json @@ -0,0 +1,230 @@ +{ + "type": "File", + "start": 0, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 32 + } + }, + "errors": [ + "SyntaxError: Explicit inexact syntax must appear at the end of an inexact object (2:21)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 32 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "TypeAlias", + "start": 8, + "end": 40, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 32 + } + }, + "id": { + "type": "Identifier", + "start": 13, + "end": 14, + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 6 + }, + "identifierName": "V" + }, + "name": "V" + }, + "typeParameters": null, + "right": { + "type": "ObjectTypeAnnotation", + "start": 17, + "end": 39, + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 31 + } + }, + "callProperties": [], + "properties": [ + { + "type": "ObjectTypeProperty", + "start": 18, + "end": 27, + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 19 + } + }, + "key": { + "type": "Identifier", + "start": 18, + "end": 19, + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 11 + }, + "identifierName": "x" + }, + "name": "x" + }, + "static": false, + "proto": false, + "kind": "init", + "method": false, + "value": { + "type": "NumberTypeAnnotation", + "start": 21, + "end": 27, + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 19 + } + } + }, + "variance": null, + "optional": false + }, + { + "type": "ObjectTypeSpreadProperty", + "start": 34, + "end": 38, + "loc": { + "start": { + "line": 2, + "column": 26 + }, + "end": { + "line": 2, + "column": 30 + } + }, + "argument": { + "type": "GenericTypeAnnotation", + "start": 37, + "end": 38, + "loc": { + "start": { + "line": 2, + "column": 29 + }, + "end": { + "line": 2, + "column": 30 + } + }, + "typeParameters": null, + "id": { + "type": "Identifier", + "start": 37, + "end": 38, + "loc": { + "start": { + "line": 2, + "column": 29 + }, + "end": { + "line": 2, + "column": 30 + }, + "identifierName": "X" + }, + "name": "X" + } + } + } + ], + "indexers": [], + "internalSlots": [], + "exact": false, + "inexact": true + }, + "leadingComments": [ + { + "type": "CommentLine", + "value": "@flow", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } + } + ] + } + ], + "directives": [] + }, + "comments": [ + { + "type": "CommentLine", + "value": "@flow", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } + } + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/interface-types/extends-multiple-reserved-invalid-1/input.js b/packages/babel-parser/test/fixtures/flow/interface-types/extends-multiple-reserved-invalid-1/input.js new file mode 100644 index 000000000000..d37bc775f75f --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/interface-types/extends-multiple-reserved-invalid-1/input.js @@ -0,0 +1,2 @@ +// @flow +interface I extends X, bool {} diff --git a/packages/babel-parser/test/fixtures/flow/interface-types/extends-multiple-reserved-invalid-1/output.json b/packages/babel-parser/test/fixtures/flow/interface-types/extends-multiple-reserved-invalid-1/output.json new file mode 100644 index 000000000000..70c296fe6e65 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/interface-types/extends-multiple-reserved-invalid-1/output.json @@ -0,0 +1,197 @@ +{ + "type": "File", + "start": 0, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 30 + } + }, + "errors": [ + "SyntaxError: Unexpected reserved type bool (2:23)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 30 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "InterfaceDeclaration", + "start": 9, + "end": 39, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 30 + } + }, + "id": { + "type": "Identifier", + "start": 19, + "end": 20, + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 11 + }, + "identifierName": "I" + }, + "name": "I" + }, + "typeParameters": null, + "extends": [ + { + "type": "InterfaceExtends", + "start": 29, + "end": 30, + "loc": { + "start": { + "line": 2, + "column": 20 + }, + "end": { + "line": 2, + "column": 21 + } + }, + "id": { + "type": "Identifier", + "start": 29, + "end": 30, + "loc": { + "start": { + "line": 2, + "column": 20 + }, + "end": { + "line": 2, + "column": 21 + }, + "identifierName": "X" + }, + "name": "X" + }, + "typeParameters": null + }, + { + "type": "InterfaceExtends", + "start": 32, + "end": 36, + "loc": { + "start": { + "line": 2, + "column": 23 + }, + "end": { + "line": 2, + "column": 27 + } + }, + "id": { + "type": "Identifier", + "start": 32, + "end": 36, + "loc": { + "start": { + "line": 2, + "column": 23 + }, + "end": { + "line": 2, + "column": 27 + }, + "identifierName": "bool" + }, + "name": "bool" + }, + "typeParameters": null + } + ], + "implements": [], + "mixins": [], + "body": { + "type": "ObjectTypeAnnotation", + "start": 37, + "end": 39, + "loc": { + "start": { + "line": 2, + "column": 28 + }, + "end": { + "line": 2, + "column": 30 + } + }, + "callProperties": [], + "properties": [], + "indexers": [], + "internalSlots": [], + "exact": false + }, + "leadingComments": [ + { + "type": "CommentLine", + "value": " @flow", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } + } + ] + } + ], + "directives": [] + }, + "comments": [ + { + "type": "CommentLine", + "value": " @flow", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } + } + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/interface-types/extends-multiple-reserved-invalid-2/input.js b/packages/babel-parser/test/fixtures/flow/interface-types/extends-multiple-reserved-invalid-2/input.js new file mode 100644 index 000000000000..9aaf187a6099 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/interface-types/extends-multiple-reserved-invalid-2/input.js @@ -0,0 +1,2 @@ +// @flow +interface I extends X, bool.m {} diff --git a/packages/babel-parser/test/fixtures/flow/interface-types/extends-multiple-reserved-invalid-2/output.json b/packages/babel-parser/test/fixtures/flow/interface-types/extends-multiple-reserved-invalid-2/output.json new file mode 100644 index 000000000000..40dc56861aa6 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/interface-types/extends-multiple-reserved-invalid-2/output.json @@ -0,0 +1,229 @@ +{ + "type": "File", + "start": 0, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 32 + } + }, + "errors": [ + "SyntaxError: Unexpected reserved type bool (2:23)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 32 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "InterfaceDeclaration", + "start": 9, + "end": 41, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 32 + } + }, + "id": { + "type": "Identifier", + "start": 19, + "end": 20, + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 11 + }, + "identifierName": "I" + }, + "name": "I" + }, + "typeParameters": null, + "extends": [ + { + "type": "InterfaceExtends", + "start": 29, + "end": 30, + "loc": { + "start": { + "line": 2, + "column": 20 + }, + "end": { + "line": 2, + "column": 21 + } + }, + "id": { + "type": "Identifier", + "start": 29, + "end": 30, + "loc": { + "start": { + "line": 2, + "column": 20 + }, + "end": { + "line": 2, + "column": 21 + }, + "identifierName": "X" + }, + "name": "X" + }, + "typeParameters": null + }, + { + "type": "InterfaceExtends", + "start": 32, + "end": 38, + "loc": { + "start": { + "line": 2, + "column": 23 + }, + "end": { + "line": 2, + "column": 29 + } + }, + "id": { + "type": "QualifiedTypeIdentifier", + "start": 32, + "end": 38, + "loc": { + "start": { + "line": 2, + "column": 23 + }, + "end": { + "line": 2, + "column": 29 + } + }, + "qualification": { + "type": "Identifier", + "start": 32, + "end": 36, + "loc": { + "start": { + "line": 2, + "column": 23 + }, + "end": { + "line": 2, + "column": 27 + }, + "identifierName": "bool" + }, + "name": "bool" + }, + "id": { + "type": "Identifier", + "start": 37, + "end": 38, + "loc": { + "start": { + "line": 2, + "column": 28 + }, + "end": { + "line": 2, + "column": 29 + }, + "identifierName": "m" + }, + "name": "m" + } + }, + "typeParameters": null + } + ], + "implements": [], + "mixins": [], + "body": { + "type": "ObjectTypeAnnotation", + "start": 39, + "end": 41, + "loc": { + "start": { + "line": 2, + "column": 30 + }, + "end": { + "line": 2, + "column": 32 + } + }, + "callProperties": [], + "properties": [], + "indexers": [], + "internalSlots": [], + "exact": false + }, + "leadingComments": [ + { + "type": "CommentLine", + "value": " @flow", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } + } + ] + } + ], + "directives": [] + }, + "comments": [ + { + "type": "CommentLine", + "value": " @flow", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } + } + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/interface-types/extends-reserved-invalid-1/input.js b/packages/babel-parser/test/fixtures/flow/interface-types/extends-reserved-invalid-1/input.js new file mode 100644 index 000000000000..63a11d3bd272 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/interface-types/extends-reserved-invalid-1/input.js @@ -0,0 +1,2 @@ +// @flow +interface I extends bool {} diff --git a/packages/babel-parser/test/fixtures/flow/interface-types/extends-reserved-invalid-1/output.json b/packages/babel-parser/test/fixtures/flow/interface-types/extends-reserved-invalid-1/output.json new file mode 100644 index 000000000000..4506002f7efb --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/interface-types/extends-reserved-invalid-1/output.json @@ -0,0 +1,164 @@ +{ + "type": "File", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 27 + } + }, + "errors": [ + "SyntaxError: Unexpected reserved type bool (2:20)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 27 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "InterfaceDeclaration", + "start": 9, + "end": 36, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 27 + } + }, + "id": { + "type": "Identifier", + "start": 19, + "end": 20, + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 11 + }, + "identifierName": "I" + }, + "name": "I" + }, + "typeParameters": null, + "extends": [ + { + "type": "InterfaceExtends", + "start": 29, + "end": 33, + "loc": { + "start": { + "line": 2, + "column": 20 + }, + "end": { + "line": 2, + "column": 24 + } + }, + "id": { + "type": "Identifier", + "start": 29, + "end": 33, + "loc": { + "start": { + "line": 2, + "column": 20 + }, + "end": { + "line": 2, + "column": 24 + }, + "identifierName": "bool" + }, + "name": "bool" + }, + "typeParameters": null + } + ], + "implements": [], + "mixins": [], + "body": { + "type": "ObjectTypeAnnotation", + "start": 34, + "end": 36, + "loc": { + "start": { + "line": 2, + "column": 25 + }, + "end": { + "line": 2, + "column": 27 + } + }, + "callProperties": [], + "properties": [], + "indexers": [], + "internalSlots": [], + "exact": false + }, + "leadingComments": [ + { + "type": "CommentLine", + "value": " @flow", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } + } + ] + } + ], + "directives": [] + }, + "comments": [ + { + "type": "CommentLine", + "value": " @flow", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } + } + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/interface-types/extends-reserved-invalid-2/input.js b/packages/babel-parser/test/fixtures/flow/interface-types/extends-reserved-invalid-2/input.js new file mode 100644 index 000000000000..594e6b7b78b6 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/interface-types/extends-reserved-invalid-2/input.js @@ -0,0 +1,2 @@ +// @flow +interface I extends bool.m {} diff --git a/packages/babel-parser/test/fixtures/flow/interface-types/extends-reserved-invalid-2/output.json b/packages/babel-parser/test/fixtures/flow/interface-types/extends-reserved-invalid-2/output.json new file mode 100644 index 000000000000..159c921ca347 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/interface-types/extends-reserved-invalid-2/output.json @@ -0,0 +1,196 @@ +{ + "type": "File", + "start": 0, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 29 + } + }, + "errors": [ + "SyntaxError: Unexpected reserved type bool (2:20)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 29 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "InterfaceDeclaration", + "start": 9, + "end": 38, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 29 + } + }, + "id": { + "type": "Identifier", + "start": 19, + "end": 20, + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 11 + }, + "identifierName": "I" + }, + "name": "I" + }, + "typeParameters": null, + "extends": [ + { + "type": "InterfaceExtends", + "start": 29, + "end": 35, + "loc": { + "start": { + "line": 2, + "column": 20 + }, + "end": { + "line": 2, + "column": 26 + } + }, + "id": { + "type": "QualifiedTypeIdentifier", + "start": 29, + "end": 35, + "loc": { + "start": { + "line": 2, + "column": 20 + }, + "end": { + "line": 2, + "column": 26 + } + }, + "qualification": { + "type": "Identifier", + "start": 29, + "end": 33, + "loc": { + "start": { + "line": 2, + "column": 20 + }, + "end": { + "line": 2, + "column": 24 + }, + "identifierName": "bool" + }, + "name": "bool" + }, + "id": { + "type": "Identifier", + "start": 34, + "end": 35, + "loc": { + "start": { + "line": 2, + "column": 25 + }, + "end": { + "line": 2, + "column": 26 + }, + "identifierName": "m" + }, + "name": "m" + } + }, + "typeParameters": null + } + ], + "implements": [], + "mixins": [], + "body": { + "type": "ObjectTypeAnnotation", + "start": 36, + "end": 38, + "loc": { + "start": { + "line": 2, + "column": 27 + }, + "end": { + "line": 2, + "column": 29 + } + }, + "callProperties": [], + "properties": [], + "indexers": [], + "internalSlots": [], + "exact": false + }, + "leadingComments": [ + { + "type": "CommentLine", + "value": " @flow", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } + } + ] + } + ], + "directives": [] + }, + "comments": [ + { + "type": "CommentLine", + "value": " @flow", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } + } + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/interfaces-module-and-script/id-reserved-type-invalid/options.json b/packages/babel-parser/test/fixtures/flow/interfaces-module-and-script/id-reserved-type-invalid/options.json deleted file mode 100644 index b945b9a0a123..000000000000 --- a/packages/babel-parser/test/fixtures/flow/interfaces-module-and-script/id-reserved-type-invalid/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Cannot overwrite reserved type string (1:10)" -} diff --git a/packages/babel-parser/test/fixtures/flow/interfaces-module-and-script/id-reserved-type-invalid/output.json b/packages/babel-parser/test/fixtures/flow/interfaces-module-and-script/id-reserved-type-invalid/output.json new file mode 100644 index 000000000000..b4b12c31dccb --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/interfaces-module-and-script/id-reserved-type-invalid/output.json @@ -0,0 +1,94 @@ +{ + "type": "File", + "start": 0, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "errors": [ + "SyntaxError: Cannot overwrite reserved type string (1:10)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "InterfaceDeclaration", + "start": 0, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "id": { + "type": "Identifier", + "start": 10, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 16 + }, + "identifierName": "string" + }, + "name": "string" + }, + "typeParameters": null, + "extends": [], + "implements": [], + "mixins": [], + "body": { + "type": "ObjectTypeAnnotation", + "start": 17, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "callProperties": [], + "properties": [], + "indexers": [], + "internalSlots": [], + "exact": false + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/interfaces-module-and-script/implements-exports/input.js b/packages/babel-parser/test/fixtures/flow/interfaces-module-and-script/implements-exports/input.js new file mode 100644 index 000000000000..6e0495a39c96 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/interfaces-module-and-script/implements-exports/input.js @@ -0,0 +1,3 @@ +interface Foo {} + +export type { Foo } \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/interfaces-module-and-script/implements-exports/output.json b/packages/babel-parser/test/fixtures/flow/interfaces-module-and-script/implements-exports/output.json new file mode 100644 index 000000000000..15c57d370772 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/interfaces-module-and-script/implements-exports/output.json @@ -0,0 +1,160 @@ +{ + "type": "File", + "start": 0, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 19 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 19 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "InterfaceDeclaration", + "start": 0, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "id": { + "type": "Identifier", + "start": 10, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 13 + }, + "identifierName": "Foo" + }, + "name": "Foo" + }, + "typeParameters": null, + "extends": [], + "implements": [], + "mixins": [], + "body": { + "type": "ObjectTypeAnnotation", + "start": 14, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "callProperties": [], + "properties": [], + "indexers": [], + "internalSlots": [], + "exact": false + } + }, + { + "type": "ExportNamedDeclaration", + "start": 18, + "end": 37, + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 19 + } + }, + "specifiers": [ + { + "type": "ExportSpecifier", + "start": 32, + "end": 35, + "loc": { + "start": { + "line": 3, + "column": 14 + }, + "end": { + "line": 3, + "column": 17 + } + }, + "local": { + "type": "Identifier", + "start": 32, + "end": 35, + "loc": { + "start": { + "line": 3, + "column": 14 + }, + "end": { + "line": 3, + "column": 17 + }, + "identifierName": "Foo" + }, + "name": "Foo" + }, + "exported": { + "type": "Identifier", + "start": 32, + "end": 35, + "loc": { + "start": { + "line": 3, + "column": 14 + }, + "end": { + "line": 3, + "column": 17 + }, + "identifierName": "Foo" + }, + "name": "Foo" + } + } + ], + "source": null, + "exportKind": "type", + "declaration": null + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/interfaces-module-and-script/implements-reserved-type-invalid-2/input.js b/packages/babel-parser/test/fixtures/flow/interfaces-module-and-script/implements-reserved-type-invalid-2/input.js new file mode 100644 index 000000000000..9feacceb06ec --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/interfaces-module-and-script/implements-reserved-type-invalid-2/input.js @@ -0,0 +1 @@ +class Foo implements Bar, string {} diff --git a/packages/babel-parser/test/fixtures/flow/interfaces-module-and-script/implements-reserved-type-invalid-2/output.json b/packages/babel-parser/test/fixtures/flow/interfaces-module-and-script/implements-reserved-type-invalid-2/output.json new file mode 100644 index 000000000000..7d3d5d229515 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/interfaces-module-and-script/implements-reserved-type-invalid-2/output.json @@ -0,0 +1,155 @@ +{ + "type": "File", + "start": 0, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "errors": [ + "SyntaxError: Unexpected reserved type string (1:26)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 9 + }, + "identifierName": "Foo" + }, + "name": "Foo" + }, + "superClass": null, + "implements": [ + { + "type": "ClassImplements", + "start": 21, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "id": { + "type": "Identifier", + "start": 21, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 24 + }, + "identifierName": "Bar" + }, + "name": "Bar" + }, + "typeParameters": null + }, + { + "type": "ClassImplements", + "start": 26, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "id": { + "type": "Identifier", + "start": 26, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 32 + }, + "identifierName": "string" + }, + "name": "string" + }, + "typeParameters": null + } + ], + "body": { + "type": "ClassBody", + "start": 33, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "body": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/interfaces-module-and-script/implements-reserved-type-invalid/options.json b/packages/babel-parser/test/fixtures/flow/interfaces-module-and-script/implements-reserved-type-invalid/options.json deleted file mode 100644 index 7aecee1ff0ae..000000000000 --- a/packages/babel-parser/test/fixtures/flow/interfaces-module-and-script/implements-reserved-type-invalid/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Cannot overwrite reserved type string (1:21)" -} diff --git a/packages/babel-parser/test/fixtures/flow/interfaces-module-and-script/implements-reserved-type-invalid/output.json b/packages/babel-parser/test/fixtures/flow/interfaces-module-and-script/implements-reserved-type-invalid/output.json new file mode 100644 index 000000000000..c29716887979 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/interfaces-module-and-script/implements-reserved-type-invalid/output.json @@ -0,0 +1,122 @@ +{ + "type": "File", + "start": 0, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "errors": [ + "SyntaxError: Unexpected reserved type string (1:21)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 9 + }, + "identifierName": "Foo" + }, + "name": "Foo" + }, + "superClass": null, + "implements": [ + { + "type": "ClassImplements", + "start": 21, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "id": { + "type": "Identifier", + "start": 21, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 27 + }, + "identifierName": "string" + }, + "name": "string" + }, + "typeParameters": null + } + ], + "body": { + "type": "ClassBody", + "start": 28, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "body": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/iterator/03/options.json b/packages/babel-parser/test/fixtures/flow/iterator/03/options.json deleted file mode 100644 index 7bad2fe143ae..000000000000 --- a/packages/babel-parser/test/fixtures/flow/iterator/03/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid identifier @@asyncIterator (1:19)" -} diff --git a/packages/babel-parser/test/fixtures/flow/iterator/03/output.json b/packages/babel-parser/test/fixtures/flow/iterator/03/output.json new file mode 100644 index 000000000000..cac241733955 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/iterator/03/output.json @@ -0,0 +1,89 @@ +{ + "type": "File", + "start": 0, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "errors": [ + "SyntaxError: Invalid identifier @@asyncIterator (1:19)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 0, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 4, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "id": { + "type": "Identifier", + "start": 4, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 19 + }, + "identifierName": "@@asyncIterator" + }, + "name": "@@asyncIterator" + }, + "init": null + } + ], + "kind": "var" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/iterator/04/options.json b/packages/babel-parser/test/fixtures/flow/iterator/04/options.json deleted file mode 100644 index ae3871cf99a0..000000000000 --- a/packages/babel-parser/test/fixtures/flow/iterator/04/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid identifier @@iterator (1:14)" -} diff --git a/packages/babel-parser/test/fixtures/flow/iterator/04/output.json b/packages/babel-parser/test/fixtures/flow/iterator/04/output.json new file mode 100644 index 000000000000..e86fe7ccc7a0 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/iterator/04/output.json @@ -0,0 +1,89 @@ +{ + "type": "File", + "start": 0, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "errors": [ + "SyntaxError: Invalid identifier @@iterator (1:14)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 0, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 4, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "id": { + "type": "Identifier", + "start": 4, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "@@iterator" + }, + "name": "@@iterator" + }, + "init": null + } + ], + "kind": "var" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/iterator/05/options.json b/packages/babel-parser/test/fixtures/flow/iterator/05/options.json deleted file mode 100644 index 9d235ec74a06..000000000000 --- a/packages/babel-parser/test/fixtures/flow/iterator/05/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid identifier @@asyncIterator (2:17)" -} diff --git a/packages/babel-parser/test/fixtures/flow/iterator/05/output.json b/packages/babel-parser/test/fixtures/flow/iterator/05/output.json new file mode 100644 index 000000000000..a5e29cf34dc2 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/iterator/05/output.json @@ -0,0 +1,144 @@ +{ + "type": "File", + "start": 0, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Invalid identifier @@asyncIterator (2:17)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "T" + }, + "name": "T" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 8, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": [ + { + "type": "ClassMethod", + "start": 12, + "end": 31, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 21 + } + }, + "static": false, + "key": { + "type": "Identifier", + "start": 12, + "end": 27, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 17 + }, + "identifierName": "@@asyncIterator" + }, + "name": "@@asyncIterator" + }, + "computed": false, + "kind": "method", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 29, + "end": 31, + "loc": { + "start": { + "line": 2, + "column": 19 + }, + "end": { + "line": 2, + "column": 21 + } + }, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/iterator/06/options.json b/packages/babel-parser/test/fixtures/flow/iterator/06/options.json deleted file mode 100644 index 515a2cba19f8..000000000000 --- a/packages/babel-parser/test/fixtures/flow/iterator/06/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid identifier @@iterator (2:12)" -} diff --git a/packages/babel-parser/test/fixtures/flow/iterator/06/output.json b/packages/babel-parser/test/fixtures/flow/iterator/06/output.json new file mode 100644 index 000000000000..08e5603a221c --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/iterator/06/output.json @@ -0,0 +1,144 @@ +{ + "type": "File", + "start": 0, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Invalid identifier @@iterator (2:12)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "T" + }, + "name": "T" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 8, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": [ + { + "type": "ClassMethod", + "start": 12, + "end": 26, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 16 + } + }, + "static": false, + "key": { + "type": "Identifier", + "start": 12, + "end": 22, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 12 + }, + "identifierName": "@@iterator" + }, + "name": "@@iterator" + }, + "computed": false, + "kind": "method", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 24, + "end": 26, + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 16 + } + }, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/iterator/07/options.json b/packages/babel-parser/test/fixtures/flow/iterator/07/options.json deleted file mode 100644 index 4c1f323d1622..000000000000 --- a/packages/babel-parser/test/fixtures/flow/iterator/07/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid identifier @@iterator (1:15)" -} diff --git a/packages/babel-parser/test/fixtures/flow/iterator/07/output.json b/packages/babel-parser/test/fixtures/flow/iterator/07/output.json new file mode 100644 index 000000000000..60d612821347 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/iterator/07/output.json @@ -0,0 +1,86 @@ +{ + "type": "File", + "start": 0, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "errors": [ + "SyntaxError: Invalid identifier @@iterator (1:15)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "TypeAlias", + "start": 0, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "id": { + "type": "Identifier", + "start": 5, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 15 + }, + "identifierName": "@@iterator" + }, + "name": "@@iterator" + }, + "typeParameters": null, + "right": { + "type": "NumberTypeAnnotation", + "start": 18, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 24 + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/iterator/08/options.json b/packages/babel-parser/test/fixtures/flow/iterator/08/options.json deleted file mode 100644 index 3efa2ffcd0a1..000000000000 --- a/packages/babel-parser/test/fixtures/flow/iterator/08/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid identifier @@asyncIterator (1:20)" -} diff --git a/packages/babel-parser/test/fixtures/flow/iterator/08/output.json b/packages/babel-parser/test/fixtures/flow/iterator/08/output.json new file mode 100644 index 000000000000..3994f46fa03e --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/iterator/08/output.json @@ -0,0 +1,86 @@ +{ + "type": "File", + "start": 0, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "errors": [ + "SyntaxError: Invalid identifier @@asyncIterator (1:20)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "TypeAlias", + "start": 0, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "id": { + "type": "Identifier", + "start": 5, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 20 + }, + "identifierName": "@@asyncIterator" + }, + "name": "@@asyncIterator" + }, + "typeParameters": null, + "right": { + "type": "NumberTypeAnnotation", + "start": 23, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 29 + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/iterator/09/options.json b/packages/babel-parser/test/fixtures/flow/iterator/09/options.json deleted file mode 100644 index 515a2cba19f8..000000000000 --- a/packages/babel-parser/test/fixtures/flow/iterator/09/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid identifier @@iterator (2:12)" -} diff --git a/packages/babel-parser/test/fixtures/flow/iterator/09/output.json b/packages/babel-parser/test/fixtures/flow/iterator/09/output.json new file mode 100644 index 000000000000..95c09f5b7c60 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/iterator/09/output.json @@ -0,0 +1,161 @@ +{ + "type": "File", + "start": 0, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Invalid identifier @@iterator (2:12)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 0, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 4, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 4, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + }, + "identifierName": "x" + }, + "name": "x" + }, + "init": { + "type": "ObjectExpression", + "start": 8, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "properties": [ + { + "type": "ObjectMethod", + "start": 12, + "end": 27, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 17 + } + }, + "method": true, + "key": { + "type": "Identifier", + "start": 12, + "end": 22, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 12 + }, + "identifierName": "@@iterator" + }, + "name": "@@iterator" + }, + "computed": false, + "kind": "method", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 25, + "end": 27, + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 17 + } + }, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "kind": "let" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/iterator/10/options.json b/packages/babel-parser/test/fixtures/flow/iterator/10/options.json deleted file mode 100644 index 9d235ec74a06..000000000000 --- a/packages/babel-parser/test/fixtures/flow/iterator/10/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid identifier @@asyncIterator (2:17)" -} diff --git a/packages/babel-parser/test/fixtures/flow/iterator/10/output.json b/packages/babel-parser/test/fixtures/flow/iterator/10/output.json new file mode 100644 index 000000000000..9e58c564ebbf --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/iterator/10/output.json @@ -0,0 +1,161 @@ +{ + "type": "File", + "start": 0, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Invalid identifier @@asyncIterator (2:17)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 0, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 4, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 4, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + }, + "identifierName": "x" + }, + "name": "x" + }, + "init": { + "type": "ObjectExpression", + "start": 8, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "properties": [ + { + "type": "ObjectMethod", + "start": 12, + "end": 32, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 22 + } + }, + "method": true, + "key": { + "type": "Identifier", + "start": 12, + "end": 27, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 17 + }, + "identifierName": "@@asyncIterator" + }, + "name": "@@asyncIterator" + }, + "computed": false, + "kind": "method", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 30, + "end": 32, + "loc": { + "start": { + "line": 2, + "column": 20 + }, + "end": { + "line": 2, + "column": 22 + } + }, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "kind": "let" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/iterator/11/options.json b/packages/babel-parser/test/fixtures/flow/iterator/11/options.json deleted file mode 100644 index 248b8a4d9d0a..000000000000 --- a/packages/babel-parser/test/fixtures/flow/iterator/11/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid identifier @@random (2:10)" -} diff --git a/packages/babel-parser/test/fixtures/flow/iterator/11/output.json b/packages/babel-parser/test/fixtures/flow/iterator/11/output.json new file mode 100644 index 000000000000..b43086a4226b --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/iterator/11/output.json @@ -0,0 +1,161 @@ +{ + "type": "File", + "start": 0, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Invalid identifier @@random (2:10)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 0, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 4, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 4, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + }, + "identifierName": "x" + }, + "name": "x" + }, + "init": { + "type": "ObjectExpression", + "start": 8, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "properties": [ + { + "type": "ObjectMethod", + "start": 12, + "end": 25, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 15 + } + }, + "method": true, + "key": { + "type": "Identifier", + "start": 12, + "end": 20, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 10 + }, + "identifierName": "@@random" + }, + "name": "@@random" + }, + "computed": false, + "kind": "method", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 23, + "end": 25, + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 15 + } + }, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "kind": "let" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/multiple-declarations/class/input.js b/packages/babel-parser/test/fixtures/flow/multiple-declarations/class/input.js new file mode 100644 index 000000000000..fa5ff14cb9be --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/multiple-declarations/class/input.js @@ -0,0 +1,2 @@ +declare class C1 {} +class C1 {} diff --git a/packages/babel-parser/test/fixtures/flow/multiple-declarations/class/options.json b/packages/babel-parser/test/fixtures/flow/multiple-declarations/class/options.json new file mode 100644 index 000000000000..d822c40fbba2 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/multiple-declarations/class/options.json @@ -0,0 +1,4 @@ +{ + "sourceType": "module", + "plugins": ["jsx", "flow"] +} diff --git a/packages/babel-parser/test/fixtures/flow/multiple-declarations/class/output.json b/packages/babel-parser/test/fixtures/flow/multiple-declarations/class/output.json new file mode 100644 index 000000000000..c350f1ed1904 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/multiple-declarations/class/output.json @@ -0,0 +1,143 @@ +{ + "type": "File", + "start": 0, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 11 + } + }, + "errors": [ + "SyntaxError: Identifier 'C1' has already been declared (2:6)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 11 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "DeclareClass", + "start": 0, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "id": { + "type": "Identifier", + "start": 14, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 16 + }, + "identifierName": "C1" + }, + "name": "C1" + }, + "typeParameters": null, + "extends": [], + "implements": [], + "mixins": [], + "body": { + "type": "ObjectTypeAnnotation", + "start": 17, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "callProperties": [], + "properties": [], + "indexers": [], + "internalSlots": [], + "exact": false + } + }, + { + "type": "ClassDeclaration", + "start": 20, + "end": 31, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 11 + } + }, + "id": { + "type": "Identifier", + "start": 26, + "end": 28, + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 8 + }, + "identifierName": "C1" + }, + "name": "C1" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 29, + "end": 31, + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 11 + } + }, + "body": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/multiple-declarations/declare-class/input.js b/packages/babel-parser/test/fixtures/flow/multiple-declarations/declare-class/input.js new file mode 100644 index 000000000000..d9470b0fd596 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/multiple-declarations/declare-class/input.js @@ -0,0 +1,6 @@ +declare class C1{} +declare class C1{} + +declare module M1 { + declare class C1 {} +} diff --git a/packages/babel-parser/test/fixtures/flow/multiple-declarations/declare-class/output.json b/packages/babel-parser/test/fixtures/flow/multiple-declarations/declare-class/output.json new file mode 100644 index 000000000000..149ca744eb22 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/multiple-declarations/declare-class/output.json @@ -0,0 +1,253 @@ +{ + "type": "File", + "start": 0, + "end": 82, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 6, + "column": 1 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 82, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 6, + "column": 1 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "DeclareClass", + "start": 0, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "id": { + "type": "Identifier", + "start": 14, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 16 + }, + "identifierName": "C1" + }, + "name": "C1" + }, + "typeParameters": null, + "extends": [], + "implements": [], + "mixins": [], + "body": { + "type": "ObjectTypeAnnotation", + "start": 16, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "callProperties": [], + "properties": [], + "indexers": [], + "internalSlots": [], + "exact": false + } + }, + { + "type": "DeclareClass", + "start": 19, + "end": 37, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 18 + } + }, + "id": { + "type": "Identifier", + "start": 33, + "end": 35, + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 16 + }, + "identifierName": "C1" + }, + "name": "C1" + }, + "typeParameters": null, + "extends": [], + "implements": [], + "mixins": [], + "body": { + "type": "ObjectTypeAnnotation", + "start": 35, + "end": 37, + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 18 + } + }, + "callProperties": [], + "properties": [], + "indexers": [], + "internalSlots": [], + "exact": false + } + }, + { + "type": "DeclareModule", + "start": 39, + "end": 82, + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 6, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 54, + "end": 56, + "loc": { + "start": { + "line": 4, + "column": 15 + }, + "end": { + "line": 4, + "column": 17 + }, + "identifierName": "M1" + }, + "name": "M1" + }, + "body": { + "type": "BlockStatement", + "start": 57, + "end": 82, + "loc": { + "start": { + "line": 4, + "column": 18 + }, + "end": { + "line": 6, + "column": 1 + } + }, + "body": [ + { + "type": "DeclareClass", + "start": 61, + "end": 80, + "loc": { + "start": { + "line": 5, + "column": 2 + }, + "end": { + "line": 5, + "column": 21 + } + }, + "id": { + "type": "Identifier", + "start": 75, + "end": 77, + "loc": { + "start": { + "line": 5, + "column": 16 + }, + "end": { + "line": 5, + "column": 18 + }, + "identifierName": "C1" + }, + "name": "C1" + }, + "typeParameters": null, + "extends": [], + "implements": [], + "mixins": [], + "body": { + "type": "ObjectTypeAnnotation", + "start": 78, + "end": 80, + "loc": { + "start": { + "line": 5, + "column": 19 + }, + "end": { + "line": 5, + "column": 21 + } + }, + "callProperties": [], + "properties": [], + "indexers": [], + "internalSlots": [], + "exact": false + } + } + ] + }, + "kind": "CommonJS" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/multiple-declarations/declare-function/input.js b/packages/babel-parser/test/fixtures/flow/multiple-declarations/declare-function/input.js new file mode 100644 index 000000000000..fb98eb970189 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/multiple-declarations/declare-function/input.js @@ -0,0 +1,3 @@ +declare function F1(): void +declare function F1(): void +function F1() {} diff --git a/packages/babel-parser/test/fixtures/flow/multiple-declarations/declare-function/output.json b/packages/babel-parser/test/fixtures/flow/multiple-declarations/declare-function/output.json new file mode 100644 index 000000000000..ad507ae14079 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/multiple-declarations/declare-function/output.json @@ -0,0 +1,249 @@ +{ + "type": "File", + "start": 0, + "end": 72, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 16 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 72, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 16 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "DeclareFunction", + "start": 0, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "id": { + "type": "Identifier", + "start": 17, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 27 + }, + "identifierName": "F1" + }, + "name": "F1", + "typeAnnotation": { + "type": "TypeAnnotation", + "start": 19, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "typeAnnotation": { + "type": "FunctionTypeAnnotation", + "start": 19, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "typeParameters": null, + "params": [], + "rest": null, + "returnType": { + "type": "VoidTypeAnnotation", + "start": 23, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 27 + } + } + } + } + } + }, + "predicate": null + }, + { + "type": "DeclareFunction", + "start": 28, + "end": 55, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 27 + } + }, + "id": { + "type": "Identifier", + "start": 45, + "end": 55, + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 27 + }, + "identifierName": "F1" + }, + "name": "F1", + "typeAnnotation": { + "type": "TypeAnnotation", + "start": 47, + "end": 55, + "loc": { + "start": { + "line": 2, + "column": 19 + }, + "end": { + "line": 2, + "column": 27 + } + }, + "typeAnnotation": { + "type": "FunctionTypeAnnotation", + "start": 47, + "end": 55, + "loc": { + "start": { + "line": 2, + "column": 19 + }, + "end": { + "line": 2, + "column": 27 + } + }, + "typeParameters": null, + "params": [], + "rest": null, + "returnType": { + "type": "VoidTypeAnnotation", + "start": 51, + "end": 55, + "loc": { + "start": { + "line": 2, + "column": 23 + }, + "end": { + "line": 2, + "column": 27 + } + } + } + } + } + }, + "predicate": null + }, + { + "type": "FunctionDeclaration", + "start": 56, + "end": 72, + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 16 + } + }, + "id": { + "type": "Identifier", + "start": 65, + "end": 67, + "loc": { + "start": { + "line": 3, + "column": 9 + }, + "end": { + "line": 3, + "column": 11 + }, + "identifierName": "F1" + }, + "name": "F1" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 70, + "end": 72, + "loc": { + "start": { + "line": 3, + "column": 14 + }, + "end": { + "line": 3, + "column": 16 + } + }, + "body": [], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/multiple-declarations/declare-var/input.js b/packages/babel-parser/test/fixtures/flow/multiple-declarations/declare-var/input.js new file mode 100644 index 000000000000..21b4f11b204c --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/multiple-declarations/declare-var/input.js @@ -0,0 +1,3 @@ +declare var V1; +declare var V1; +var V1; diff --git a/packages/babel-parser/test/fixtures/flow/multiple-declarations/declare-var/output.json b/packages/babel-parser/test/fixtures/flow/multiple-declarations/declare-var/output.json new file mode 100644 index 000000000000..b96badb7fe54 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/multiple-declarations/declare-var/output.json @@ -0,0 +1,150 @@ +{ + "type": "File", + "start": 0, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 7 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 7 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "DeclareVariable", + "start": 0, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "id": { + "type": "Identifier", + "start": 12, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "V1" + }, + "name": "V1" + } + }, + { + "type": "DeclareVariable", + "start": 16, + "end": 31, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 15 + } + }, + "id": { + "type": "Identifier", + "start": 28, + "end": 30, + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 14 + }, + "identifierName": "V1" + }, + "name": "V1" + } + }, + { + "type": "VariableDeclaration", + "start": 32, + "end": 39, + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 7 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 36, + "end": 38, + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 6 + } + }, + "id": { + "type": "Identifier", + "start": 36, + "end": 38, + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 6 + }, + "identifierName": "V1" + }, + "name": "V1" + }, + "init": null + } + ], + "kind": "var" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/multiple-declarations/interface/input.js b/packages/babel-parser/test/fixtures/flow/multiple-declarations/interface/input.js new file mode 100644 index 000000000000..bca93948ce50 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/multiple-declarations/interface/input.js @@ -0,0 +1,2 @@ +interface I {}; +interface I {}; diff --git a/packages/babel-parser/test/fixtures/flow/multiple-declarations/interface/options.json b/packages/babel-parser/test/fixtures/flow/multiple-declarations/interface/options.json new file mode 100644 index 000000000000..d822c40fbba2 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/multiple-declarations/interface/options.json @@ -0,0 +1,4 @@ +{ + "sourceType": "module", + "plugins": ["jsx", "flow"] +} diff --git a/packages/babel-parser/test/fixtures/flow/multiple-declarations/interface/output.json b/packages/babel-parser/test/fixtures/flow/multiple-declarations/interface/output.json new file mode 100644 index 000000000000..823ca9be9eac --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/multiple-declarations/interface/output.json @@ -0,0 +1,180 @@ +{ + "type": "File", + "start": 0, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 15 + } + }, + "errors": [ + "SyntaxError: Identifier 'I' has already been declared (2:10)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 15 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "InterfaceDeclaration", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "id": { + "type": "Identifier", + "start": 10, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + }, + "identifierName": "I" + }, + "name": "I" + }, + "typeParameters": null, + "extends": [], + "implements": [], + "mixins": [], + "body": { + "type": "ObjectTypeAnnotation", + "start": 12, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "callProperties": [], + "properties": [], + "indexers": [], + "internalSlots": [], + "exact": false + } + }, + { + "type": "EmptyStatement", + "start": 14, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "InterfaceDeclaration", + "start": 16, + "end": 30, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "id": { + "type": "Identifier", + "start": 26, + "end": 27, + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 11 + }, + "identifierName": "I" + }, + "name": "I" + }, + "typeParameters": null, + "extends": [], + "implements": [], + "mixins": [], + "body": { + "type": "ObjectTypeAnnotation", + "start": 28, + "end": 30, + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "callProperties": [], + "properties": [], + "indexers": [], + "internalSlots": [], + "exact": false + } + }, + { + "type": "EmptyStatement", + "start": 30, + "end": 31, + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 15 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/multiple-declarations/type/input.js b/packages/babel-parser/test/fixtures/flow/multiple-declarations/type/input.js new file mode 100644 index 000000000000..273aa1c7176c --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/multiple-declarations/type/input.js @@ -0,0 +1,2 @@ +type T1 = string; +type T1 = number; diff --git a/packages/babel-parser/test/fixtures/flow/multiple-declarations/type/options.json b/packages/babel-parser/test/fixtures/flow/multiple-declarations/type/options.json new file mode 100644 index 000000000000..d822c40fbba2 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/multiple-declarations/type/options.json @@ -0,0 +1,4 @@ +{ + "sourceType": "module", + "plugins": ["jsx", "flow"] +} diff --git a/packages/babel-parser/test/fixtures/flow/multiple-declarations/type/output.json b/packages/babel-parser/test/fixtures/flow/multiple-declarations/type/output.json new file mode 100644 index 000000000000..080077918fd1 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/multiple-declarations/type/output.json @@ -0,0 +1,134 @@ +{ + "type": "File", + "start": 0, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 17 + } + }, + "errors": [ + "SyntaxError: Identifier 'T1' has already been declared (2:5)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 17 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "TypeAlias", + "start": 0, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "id": { + "type": "Identifier", + "start": 5, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "T1" + }, + "name": "T1" + }, + "typeParameters": null, + "right": { + "type": "StringTypeAnnotation", + "start": 10, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 16 + } + } + } + }, + { + "type": "TypeAlias", + "start": 18, + "end": 35, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 17 + } + }, + "id": { + "type": "Identifier", + "start": 23, + "end": 25, + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 7 + }, + "identifierName": "T1" + }, + "name": "T1" + }, + "typeParameters": null, + "right": { + "type": "NumberTypeAnnotation", + "start": 28, + "end": 34, + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 16 + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/object-types/invalid-getter-param-count-rest/options.json b/packages/babel-parser/test/fixtures/flow/object-types/invalid-getter-param-count-rest/options.json deleted file mode 100644 index 65bc24a66fcd..000000000000 --- a/packages/babel-parser/test/fixtures/flow/object-types/invalid-getter-param-count-rest/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "getter must not have any formal parameters (2:2)" -} diff --git a/packages/babel-parser/test/fixtures/flow/object-types/invalid-getter-param-count-rest/output.json b/packages/babel-parser/test/fixtures/flow/object-types/invalid-getter-param-count-rest/output.json new file mode 100644 index 000000000000..efdc8832124e --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/object-types/invalid-getter-param-count-rest/output.json @@ -0,0 +1,212 @@ +{ + "type": "File", + "start": 0, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "errors": [ + "SyntaxError: getter must not have any formal parameters (2:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "TypeAlias", + "start": 0, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 5, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + }, + "identifierName": "B" + }, + "name": "B" + }, + "typeParameters": null, + "right": { + "type": "ObjectTypeAnnotation", + "start": 9, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "callProperties": [], + "properties": [ + { + "type": "ObjectTypeProperty", + "start": 13, + "end": 34, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 23 + } + }, + "key": { + "type": "Identifier", + "start": 17, + "end": 18, + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 7 + }, + "identifierName": "a" + }, + "name": "a" + }, + "static": false, + "proto": false, + "kind": "get", + "method": true, + "value": { + "type": "FunctionTypeAnnotation", + "start": 13, + "end": 34, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 23 + } + }, + "params": [], + "rest": { + "type": "FunctionTypeParam", + "start": 22, + "end": 25, + "loc": { + "start": { + "line": 2, + "column": 11 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "name": null, + "optional": false, + "typeAnnotation": { + "type": "GenericTypeAnnotation", + "start": 22, + "end": 25, + "loc": { + "start": { + "line": 2, + "column": 11 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "typeParameters": null, + "id": { + "type": "Identifier", + "start": 22, + "end": 25, + "loc": { + "start": { + "line": 2, + "column": 11 + }, + "end": { + "line": 2, + "column": 14 + }, + "identifierName": "foo" + }, + "name": "foo" + } + } + }, + "typeParameters": null, + "returnType": { + "type": "NumberTypeAnnotation", + "start": 28, + "end": 34, + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 23 + } + } + } + }, + "optional": false + } + ], + "indexers": [], + "internalSlots": [], + "exact": false, + "inexact": false + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/object-types/invalid-getter-param-count/options.json b/packages/babel-parser/test/fixtures/flow/object-types/invalid-getter-param-count/options.json deleted file mode 100644 index 65bc24a66fcd..000000000000 --- a/packages/babel-parser/test/fixtures/flow/object-types/invalid-getter-param-count/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "getter must not have any formal parameters (2:2)" -} diff --git a/packages/babel-parser/test/fixtures/flow/object-types/invalid-getter-param-count/output.json b/packages/babel-parser/test/fixtures/flow/object-types/invalid-getter-param-count/output.json new file mode 100644 index 000000000000..66bd6ed1baf2 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/object-types/invalid-getter-param-count/output.json @@ -0,0 +1,212 @@ +{ + "type": "File", + "start": 0, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "errors": [ + "SyntaxError: getter must not have any formal parameters (2:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "TypeAlias", + "start": 0, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 5, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + }, + "identifierName": "B" + }, + "name": "B" + }, + "typeParameters": null, + "right": { + "type": "ObjectTypeAnnotation", + "start": 9, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "callProperties": [], + "properties": [ + { + "type": "ObjectTypeProperty", + "start": 13, + "end": 38, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 27 + } + }, + "key": { + "type": "Identifier", + "start": 17, + "end": 18, + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 7 + }, + "identifierName": "a" + }, + "name": "a" + }, + "static": false, + "proto": false, + "kind": "get", + "method": true, + "value": { + "type": "FunctionTypeAnnotation", + "start": 13, + "end": 38, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 27 + } + }, + "params": [ + { + "type": "FunctionTypeParam", + "start": 19, + "end": 29, + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 18 + } + }, + "name": { + "type": "Identifier", + "start": 19, + "end": 22, + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 11 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "optional": false, + "typeAnnotation": { + "type": "NumberTypeAnnotation", + "start": 23, + "end": 29, + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 18 + } + } + } + } + ], + "rest": null, + "typeParameters": null, + "returnType": { + "type": "NumberTypeAnnotation", + "start": 32, + "end": 38, + "loc": { + "start": { + "line": 2, + "column": 21 + }, + "end": { + "line": 2, + "column": 27 + } + } + } + }, + "optional": false + } + ], + "indexers": [], + "internalSlots": [], + "exact": false, + "inexact": false + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/object-types/invalid-setter-param-count/options.json b/packages/babel-parser/test/fixtures/flow/object-types/invalid-setter-param-count/options.json deleted file mode 100644 index 6a1567782202..000000000000 --- a/packages/babel-parser/test/fixtures/flow/object-types/invalid-setter-param-count/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "setter must have exactly one formal parameter (2:2)" -} diff --git a/packages/babel-parser/test/fixtures/flow/object-types/invalid-setter-param-count/output.json b/packages/babel-parser/test/fixtures/flow/object-types/invalid-setter-param-count/output.json new file mode 100644 index 000000000000..b79f9a52c897 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/object-types/invalid-setter-param-count/output.json @@ -0,0 +1,163 @@ +{ + "type": "File", + "start": 0, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "errors": [ + "SyntaxError: setter must have exactly one formal parameter (2:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "TypeAlias", + "start": 0, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 5, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + }, + "identifierName": "B" + }, + "name": "B" + }, + "typeParameters": null, + "right": { + "type": "ObjectTypeAnnotation", + "start": 9, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "callProperties": [], + "properties": [ + { + "type": "ObjectTypeProperty", + "start": 13, + "end": 26, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 15 + } + }, + "key": { + "type": "Identifier", + "start": 17, + "end": 18, + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 7 + }, + "identifierName": "a" + }, + "name": "a" + }, + "static": false, + "proto": false, + "kind": "set", + "method": true, + "value": { + "type": "FunctionTypeAnnotation", + "start": 13, + "end": 26, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 15 + } + }, + "params": [], + "rest": null, + "typeParameters": null, + "returnType": { + "type": "VoidTypeAnnotation", + "start": 22, + "end": 26, + "loc": { + "start": { + "line": 2, + "column": 11 + }, + "end": { + "line": 2, + "column": 15 + } + } + } + }, + "optional": false + } + ], + "indexers": [], + "internalSlots": [], + "exact": false, + "inexact": false + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/object-types/invalid-setter-param-type/options.json b/packages/babel-parser/test/fixtures/flow/object-types/invalid-setter-param-type/options.json deleted file mode 100644 index 15ce6a4c5a51..000000000000 --- a/packages/babel-parser/test/fixtures/flow/object-types/invalid-setter-param-type/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "setter function argument must not be a rest parameter (2:2)" -} diff --git a/packages/babel-parser/test/fixtures/flow/object-types/invalid-setter-param-type/output.json b/packages/babel-parser/test/fixtures/flow/object-types/invalid-setter-param-type/output.json new file mode 100644 index 000000000000..5171dbc8a45f --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/object-types/invalid-setter-param-type/output.json @@ -0,0 +1,212 @@ +{ + "type": "File", + "start": 0, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "errors": [ + "SyntaxError: setter function argument must not be a rest parameter (2:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "TypeAlias", + "start": 0, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 5, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + }, + "identifierName": "B" + }, + "name": "B" + }, + "typeParameters": null, + "right": { + "type": "ObjectTypeAnnotation", + "start": 9, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "callProperties": [], + "properties": [ + { + "type": "ObjectTypeProperty", + "start": 13, + "end": 30, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 19 + } + }, + "key": { + "type": "Identifier", + "start": 17, + "end": 18, + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 7 + }, + "identifierName": "a" + }, + "name": "a" + }, + "static": false, + "proto": false, + "kind": "set", + "method": true, + "value": { + "type": "FunctionTypeAnnotation", + "start": 13, + "end": 30, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 19 + } + }, + "params": [], + "rest": { + "type": "FunctionTypeParam", + "start": 22, + "end": 23, + "loc": { + "start": { + "line": 2, + "column": 11 + }, + "end": { + "line": 2, + "column": 12 + } + }, + "name": null, + "optional": false, + "typeAnnotation": { + "type": "GenericTypeAnnotation", + "start": 22, + "end": 23, + "loc": { + "start": { + "line": 2, + "column": 11 + }, + "end": { + "line": 2, + "column": 12 + } + }, + "typeParameters": null, + "id": { + "type": "Identifier", + "start": 22, + "end": 23, + "loc": { + "start": { + "line": 2, + "column": 11 + }, + "end": { + "line": 2, + "column": 12 + }, + "identifierName": "w" + }, + "name": "w" + } + } + }, + "typeParameters": null, + "returnType": { + "type": "VoidTypeAnnotation", + "start": 26, + "end": 30, + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 19 + } + } + } + }, + "optional": false + } + ], + "indexers": [], + "internalSlots": [], + "exact": false, + "inexact": false + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/opaque-type-alias/reserved-type-invalid/options.json b/packages/babel-parser/test/fixtures/flow/opaque-type-alias/reserved-type-invalid/options.json deleted file mode 100644 index 0c2cdd4d777c..000000000000 --- a/packages/babel-parser/test/fixtures/flow/opaque-type-alias/reserved-type-invalid/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Cannot overwrite reserved type string (1:12)" -} diff --git a/packages/babel-parser/test/fixtures/flow/opaque-type-alias/reserved-type-invalid/output.json b/packages/babel-parser/test/fixtures/flow/opaque-type-alias/reserved-type-invalid/output.json new file mode 100644 index 000000000000..bc568d5767be --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/opaque-type-alias/reserved-type-invalid/output.json @@ -0,0 +1,87 @@ +{ + "type": "File", + "start": 0, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "errors": [ + "SyntaxError: Cannot overwrite reserved type string (1:12)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "OpaqueType", + "start": 0, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "id": { + "type": "Identifier", + "start": 12, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 18 + }, + "identifierName": "string" + }, + "name": "string" + }, + "typeParameters": null, + "supertype": null, + "impltype": { + "type": "NumberTypeAnnotation", + "start": 21, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 27 + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/optional-type/6/options.json b/packages/babel-parser/test/fixtures/flow/optional-type/6/options.json deleted file mode 100644 index fb2831d6188b..000000000000 --- a/packages/babel-parser/test/fixtures/flow/optional-type/6/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "A binding pattern parameter cannot be optional in an implementation signature. (1:11)" -} diff --git a/packages/babel-parser/test/fixtures/flow/optional-type/6/output.json b/packages/babel-parser/test/fixtures/flow/optional-type/6/output.json new file mode 100644 index 000000000000..3ef0fdc07d93 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/optional-type/6/output.json @@ -0,0 +1,124 @@ +{ + "type": "File", + "start": 0, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "errors": [ + "SyntaxError: A binding pattern parameter cannot be optional in an implementation signature. (1:11)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + }, + "identifierName": "f" + }, + "name": "f" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "ArrayPattern", + "start": 11, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "elements": [], + "optional": true + }, + { + "type": "ObjectPattern", + "start": 16, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "properties": [] + } + ], + "body": { + "type": "BlockStatement", + "start": 20, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "body": [], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/predicates/4/options.json b/packages/babel-parser/test/fixtures/flow/predicates/4/options.json deleted file mode 100644 index cec83fa54fba..000000000000 --- a/packages/babel-parser/test/fixtures/flow/predicates/4/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected token, expected \";\" (1:18)" -} diff --git a/packages/babel-parser/test/fixtures/flow/predicates/4/output.json b/packages/babel-parser/test/fixtures/flow/predicates/4/output.json new file mode 100644 index 000000000000..e1e9eeffbc7b --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/predicates/4/output.json @@ -0,0 +1,241 @@ +{ + "type": "File", + "start": 0, + "end": 54, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 54 + } + }, + "errors": [ + "SyntaxError: Spaces between ´%´ and ´checks´ are not allowed here. (1:20)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 54, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 54 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 0, + "end": 54, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 54 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 4, + "end": 53, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 53 + } + }, + "id": { + "type": "Identifier", + "start": 4, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + }, + "identifierName": "f" + }, + "name": "f" + }, + "init": { + "type": "ArrowFunctionExpression", + "start": 8, + "end": 53, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 53 + } + }, + "predicate": { + "type": "InferredPredicate", + "start": 20, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 28 + } + } + }, + "returnType": null, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 9, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 17 + }, + "identifierName": "x" + }, + "name": "x", + "typeAnnotation": { + "type": "TypeAnnotation", + "start": 10, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "typeAnnotation": { + "type": "MixedTypeAnnotation", + "start": 12, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 17 + } + } + } + } + } + ], + "body": { + "type": "BinaryExpression", + "start": 32, + "end": 53, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 53 + } + }, + "left": { + "type": "UnaryExpression", + "start": 32, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 40 + } + }, + "operator": "typeof", + "prefix": true, + "argument": { + "type": "Identifier", + "start": 39, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 39 + }, + "end": { + "line": 1, + "column": 40 + }, + "identifierName": "x" + }, + "name": "x" + } + }, + "operator": "===", + "right": { + "type": "StringLiteral", + "start": 45, + "end": 53, + "loc": { + "start": { + "line": 1, + "column": 45 + }, + "end": { + "line": 1, + "column": 53 + } + }, + "extra": { + "rawValue": "string", + "raw": "\"string\"" + }, + "value": "string" + } + } + } + } + ], + "kind": "var" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/predicates/5/options.json b/packages/babel-parser/test/fixtures/flow/predicates/5/options.json deleted file mode 100644 index dbdc7697ac5b..000000000000 --- a/packages/babel-parser/test/fixtures/flow/predicates/5/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Spaces between ´%´ and ´checks´ are not allowed here. (1:17)" -} diff --git a/packages/babel-parser/test/fixtures/flow/predicates/5/output.json b/packages/babel-parser/test/fixtures/flow/predicates/5/output.json new file mode 100644 index 000000000000..0d7a47afacfd --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/predicates/5/output.json @@ -0,0 +1,210 @@ +{ + "type": "File", + "start": 0, + "end": 61, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Spaces between ´%´ and ´checks´ are not allowed here. (1:17)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 61, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 61, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 12 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 13, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "x" + }, + "name": "x" + } + ], + "predicate": { + "type": "InferredPredicate", + "start": 17, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + "returnType": null, + "body": { + "type": "BlockStatement", + "start": 26, + "end": 61, + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": [ + { + "type": "ReturnStatement", + "start": 30, + "end": 59, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 31 + } + }, + "argument": { + "type": "BinaryExpression", + "start": 37, + "end": 58, + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 30 + } + }, + "left": { + "type": "UnaryExpression", + "start": 37, + "end": 45, + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 17 + } + }, + "operator": "typeof", + "prefix": true, + "argument": { + "type": "Identifier", + "start": 44, + "end": 45, + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 17 + }, + "identifierName": "x" + }, + "name": "x" + } + }, + "operator": "===", + "right": { + "type": "StringLiteral", + "start": 50, + "end": 58, + "loc": { + "start": { + "line": 2, + "column": 22 + }, + "end": { + "line": 2, + "column": 30 + } + }, + "extra": { + "rawValue": "string", + "raw": "\"string\"" + }, + "value": "string" + } + } + } + ], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/regression/arrow-in-ternary-with-param-type-and-return-type-like/input.js b/packages/babel-parser/test/fixtures/flow/regression/arrow-in-ternary-with-param-type-and-return-type-like/input.js new file mode 100644 index 000000000000..1f0c3e33482c --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/regression/arrow-in-ternary-with-param-type-and-return-type-like/input.js @@ -0,0 +1,2 @@ +test + ? (x: T): U => y diff --git a/packages/babel-parser/test/fixtures/flow/regression/arrow-in-ternary-with-param-type-and-return-type-like/output.json b/packages/babel-parser/test/fixtures/flow/regression/arrow-in-ternary-with-param-type-and-return-type-like/output.json new file mode 100644 index 000000000000..3c80e21673a6 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/regression/arrow-in-ternary-with-param-type-and-return-type-like/output.json @@ -0,0 +1,220 @@ +{ + "type": "File", + "start": 0, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 18 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 18 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 18 + } + }, + "expression": { + "type": "ConditionalExpression", + "start": 0, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 18 + } + }, + "test": { + "type": "Identifier", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + }, + "identifierName": "test" + }, + "name": "test" + }, + "consequent": { + "type": "TypeCastExpression", + "start": 10, + "end": 14, + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 9 + } + }, + "expression": { + "type": "Identifier", + "start": 10, + "end": 11, + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 6 + }, + "identifierName": "x" + }, + "name": "x" + }, + "typeAnnotation": { + "type": "TypeAnnotation", + "start": 11, + "end": 14, + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 9 + } + }, + "typeAnnotation": { + "type": "GenericTypeAnnotation", + "start": 13, + "end": 14, + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 9 + } + }, + "typeParameters": null, + "id": { + "type": "Identifier", + "start": 13, + "end": 14, + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 9 + }, + "identifierName": "T" + }, + "name": "T" + } + } + }, + "extra": { + "parenthesized": true, + "parenStart": 9 + } + }, + "alternate": { + "type": "ArrowFunctionExpression", + "start": 17, + "end": 23, + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 18 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 17, + "end": 18, + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 13 + }, + "identifierName": "U" + }, + "name": "U" + } + ], + "body": { + "type": "Identifier", + "start": 22, + "end": 23, + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 18 + }, + "identifierName": "y" + }, + "name": "y" + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/regression/arrow-in-ternary-with-param-type-and-return-type/input.js b/packages/babel-parser/test/fixtures/flow/regression/arrow-in-ternary-with-param-type-and-return-type/input.js new file mode 100644 index 000000000000..a36f5ca0c5d8 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/regression/arrow-in-ternary-with-param-type-and-return-type/input.js @@ -0,0 +1,3 @@ +test + ? (x: T): U => y + : z \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/regression/arrow-in-ternary-with-param-type-and-return-type/output.json b/packages/babel-parser/test/fixtures/flow/regression/arrow-in-ternary-with-param-type-and-return-type/output.json new file mode 100644 index 000000000000..6be59ef645aa --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/regression/arrow-in-ternary-with-param-type-and-return-type/output.json @@ -0,0 +1,250 @@ +{ + "type": "File", + "start": 0, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 5 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 5 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 5 + } + }, + "expression": { + "type": "ConditionalExpression", + "start": 0, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 5 + } + }, + "test": { + "type": "Identifier", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + }, + "identifierName": "test" + }, + "name": "test" + }, + "consequent": { + "type": "ArrowFunctionExpression", + "start": 9, + "end": 23, + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 18 + } + }, + "predicate": null, + "returnType": { + "type": "TypeAnnotation", + "start": 15, + "end": 18, + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 13 + } + }, + "typeAnnotation": { + "type": "GenericTypeAnnotation", + "start": 17, + "end": 18, + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 13 + } + }, + "typeParameters": null, + "id": { + "type": "Identifier", + "start": 17, + "end": 18, + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 13 + }, + "identifierName": "U" + }, + "name": "U" + } + } + }, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 10, + "end": 14, + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 9 + }, + "identifierName": "x" + }, + "name": "x", + "typeAnnotation": { + "type": "TypeAnnotation", + "start": 11, + "end": 14, + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 9 + } + }, + "typeAnnotation": { + "type": "GenericTypeAnnotation", + "start": 13, + "end": 14, + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 9 + } + }, + "typeParameters": null, + "id": { + "type": "Identifier", + "start": 13, + "end": 14, + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 9 + }, + "identifierName": "T" + }, + "name": "T" + } + } + } + } + ], + "body": { + "type": "Identifier", + "start": 22, + "end": 23, + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 18 + }, + "identifierName": "y" + }, + "name": "y" + } + }, + "alternate": { + "type": "Identifier", + "start": 28, + "end": 29, + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 5 + }, + "identifierName": "z" + }, + "name": "z" + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/regression/issue-10044/input.js b/packages/babel-parser/test/fixtures/flow/regression/issue-10044/input.js new file mode 100644 index 000000000000..4d3e8c48a837 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/regression/issue-10044/input.js @@ -0,0 +1,8 @@ +declare class C1 {} +declare interface I1 {} +declare type T1 = number; + +interface I2 {} +type T2 = number; + +export type { C1, I1, I2, T1, T2 } diff --git a/packages/babel-parser/test/fixtures/flow/regression/issue-10044/output.json b/packages/babel-parser/test/fixtures/flow/regression/issue-10044/output.json new file mode 100644 index 000000000000..5df63e757a77 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/regression/issue-10044/output.json @@ -0,0 +1,564 @@ +{ + "type": "File", + "start": 0, + "end": 140, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 8, + "column": 34 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 140, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 8, + "column": 34 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "DeclareClass", + "start": 0, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "id": { + "type": "Identifier", + "start": 14, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 16 + }, + "identifierName": "C1" + }, + "name": "C1" + }, + "typeParameters": null, + "extends": [], + "implements": [], + "mixins": [], + "body": { + "type": "ObjectTypeAnnotation", + "start": 17, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "callProperties": [], + "properties": [], + "indexers": [], + "internalSlots": [], + "exact": false + } + }, + { + "type": "DeclareInterface", + "start": 20, + "end": 43, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 23 + } + }, + "id": { + "type": "Identifier", + "start": 38, + "end": 40, + "loc": { + "start": { + "line": 2, + "column": 18 + }, + "end": { + "line": 2, + "column": 20 + }, + "identifierName": "I1" + }, + "name": "I1" + }, + "typeParameters": null, + "extends": [], + "implements": [], + "mixins": [], + "body": { + "type": "ObjectTypeAnnotation", + "start": 41, + "end": 43, + "loc": { + "start": { + "line": 2, + "column": 21 + }, + "end": { + "line": 2, + "column": 23 + } + }, + "callProperties": [], + "properties": [], + "indexers": [], + "internalSlots": [], + "exact": false + } + }, + { + "type": "DeclareTypeAlias", + "start": 44, + "end": 69, + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 25 + } + }, + "id": { + "type": "Identifier", + "start": 57, + "end": 59, + "loc": { + "start": { + "line": 3, + "column": 13 + }, + "end": { + "line": 3, + "column": 15 + }, + "identifierName": "T1" + }, + "name": "T1" + }, + "typeParameters": null, + "right": { + "type": "NumberTypeAnnotation", + "start": 62, + "end": 68, + "loc": { + "start": { + "line": 3, + "column": 18 + }, + "end": { + "line": 3, + "column": 24 + } + } + } + }, + { + "type": "InterfaceDeclaration", + "start": 71, + "end": 86, + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 5, + "column": 15 + } + }, + "id": { + "type": "Identifier", + "start": 81, + "end": 83, + "loc": { + "start": { + "line": 5, + "column": 10 + }, + "end": { + "line": 5, + "column": 12 + }, + "identifierName": "I2" + }, + "name": "I2" + }, + "typeParameters": null, + "extends": [], + "implements": [], + "mixins": [], + "body": { + "type": "ObjectTypeAnnotation", + "start": 84, + "end": 86, + "loc": { + "start": { + "line": 5, + "column": 13 + }, + "end": { + "line": 5, + "column": 15 + } + }, + "callProperties": [], + "properties": [], + "indexers": [], + "internalSlots": [], + "exact": false + } + }, + { + "type": "TypeAlias", + "start": 87, + "end": 104, + "loc": { + "start": { + "line": 6, + "column": 0 + }, + "end": { + "line": 6, + "column": 17 + } + }, + "id": { + "type": "Identifier", + "start": 92, + "end": 94, + "loc": { + "start": { + "line": 6, + "column": 5 + }, + "end": { + "line": 6, + "column": 7 + }, + "identifierName": "T2" + }, + "name": "T2" + }, + "typeParameters": null, + "right": { + "type": "NumberTypeAnnotation", + "start": 97, + "end": 103, + "loc": { + "start": { + "line": 6, + "column": 10 + }, + "end": { + "line": 6, + "column": 16 + } + } + } + }, + { + "type": "ExportNamedDeclaration", + "start": 106, + "end": 140, + "loc": { + "start": { + "line": 8, + "column": 0 + }, + "end": { + "line": 8, + "column": 34 + } + }, + "specifiers": [ + { + "type": "ExportSpecifier", + "start": 120, + "end": 122, + "loc": { + "start": { + "line": 8, + "column": 14 + }, + "end": { + "line": 8, + "column": 16 + } + }, + "local": { + "type": "Identifier", + "start": 120, + "end": 122, + "loc": { + "start": { + "line": 8, + "column": 14 + }, + "end": { + "line": 8, + "column": 16 + }, + "identifierName": "C1" + }, + "name": "C1" + }, + "exported": { + "type": "Identifier", + "start": 120, + "end": 122, + "loc": { + "start": { + "line": 8, + "column": 14 + }, + "end": { + "line": 8, + "column": 16 + }, + "identifierName": "C1" + }, + "name": "C1" + } + }, + { + "type": "ExportSpecifier", + "start": 124, + "end": 126, + "loc": { + "start": { + "line": 8, + "column": 18 + }, + "end": { + "line": 8, + "column": 20 + } + }, + "local": { + "type": "Identifier", + "start": 124, + "end": 126, + "loc": { + "start": { + "line": 8, + "column": 18 + }, + "end": { + "line": 8, + "column": 20 + }, + "identifierName": "I1" + }, + "name": "I1" + }, + "exported": { + "type": "Identifier", + "start": 124, + "end": 126, + "loc": { + "start": { + "line": 8, + "column": 18 + }, + "end": { + "line": 8, + "column": 20 + }, + "identifierName": "I1" + }, + "name": "I1" + } + }, + { + "type": "ExportSpecifier", + "start": 128, + "end": 130, + "loc": { + "start": { + "line": 8, + "column": 22 + }, + "end": { + "line": 8, + "column": 24 + } + }, + "local": { + "type": "Identifier", + "start": 128, + "end": 130, + "loc": { + "start": { + "line": 8, + "column": 22 + }, + "end": { + "line": 8, + "column": 24 + }, + "identifierName": "I2" + }, + "name": "I2" + }, + "exported": { + "type": "Identifier", + "start": 128, + "end": 130, + "loc": { + "start": { + "line": 8, + "column": 22 + }, + "end": { + "line": 8, + "column": 24 + }, + "identifierName": "I2" + }, + "name": "I2" + } + }, + { + "type": "ExportSpecifier", + "start": 132, + "end": 134, + "loc": { + "start": { + "line": 8, + "column": 26 + }, + "end": { + "line": 8, + "column": 28 + } + }, + "local": { + "type": "Identifier", + "start": 132, + "end": 134, + "loc": { + "start": { + "line": 8, + "column": 26 + }, + "end": { + "line": 8, + "column": 28 + }, + "identifierName": "T1" + }, + "name": "T1" + }, + "exported": { + "type": "Identifier", + "start": 132, + "end": 134, + "loc": { + "start": { + "line": 8, + "column": 26 + }, + "end": { + "line": 8, + "column": 28 + }, + "identifierName": "T1" + }, + "name": "T1" + } + }, + { + "type": "ExportSpecifier", + "start": 136, + "end": 138, + "loc": { + "start": { + "line": 8, + "column": 30 + }, + "end": { + "line": 8, + "column": 32 + } + }, + "local": { + "type": "Identifier", + "start": 136, + "end": 138, + "loc": { + "start": { + "line": 8, + "column": 30 + }, + "end": { + "line": 8, + "column": 32 + }, + "identifierName": "T2" + }, + "name": "T2" + }, + "exported": { + "type": "Identifier", + "start": 136, + "end": 138, + "loc": { + "start": { + "line": 8, + "column": 30 + }, + "end": { + "line": 8, + "column": 32 + }, + "identifierName": "T2" + }, + "name": "T2" + } + } + ], + "source": null, + "exportKind": "type", + "declaration": null + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/regression/issue-10314/input.js b/packages/babel-parser/test/fixtures/flow/regression/issue-10314/input.js new file mode 100644 index 000000000000..3c830a898f38 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/regression/issue-10314/input.js @@ -0,0 +1,3 @@ +// @flow + +true ? async.waterfall() : null; diff --git a/packages/babel-parser/test/fixtures/flow/regression/issue-10314/output.json b/packages/babel-parser/test/fixtures/flow/regression/issue-10314/output.json new file mode 100644 index 000000000000..3742c1bbf74d --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/regression/issue-10314/output.json @@ -0,0 +1,198 @@ +{ + "type": "File", + "start": 0, + "end": 42, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 32 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 42, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 32 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 10, + "end": 42, + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 32 + } + }, + "expression": { + "type": "ConditionalExpression", + "start": 10, + "end": 41, + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 31 + } + }, + "test": { + "type": "BooleanLiteral", + "start": 10, + "end": 14, + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 4 + } + }, + "value": true + }, + "consequent": { + "type": "CallExpression", + "start": 17, + "end": 34, + "loc": { + "start": { + "line": 3, + "column": 7 + }, + "end": { + "line": 3, + "column": 24 + } + }, + "callee": { + "type": "MemberExpression", + "start": 17, + "end": 32, + "loc": { + "start": { + "line": 3, + "column": 7 + }, + "end": { + "line": 3, + "column": 22 + } + }, + "object": { + "type": "Identifier", + "start": 17, + "end": 22, + "loc": { + "start": { + "line": 3, + "column": 7 + }, + "end": { + "line": 3, + "column": 12 + }, + "identifierName": "async" + }, + "name": "async" + }, + "property": { + "type": "Identifier", + "start": 23, + "end": 32, + "loc": { + "start": { + "line": 3, + "column": 13 + }, + "end": { + "line": 3, + "column": 22 + }, + "identifierName": "waterfall" + }, + "name": "waterfall" + }, + "computed": false + }, + "arguments": [] + }, + "alternate": { + "type": "NullLiteral", + "start": 37, + "end": 41, + "loc": { + "start": { + "line": 3, + "column": 27 + }, + "end": { + "line": 3, + "column": 31 + } + } + } + }, + "leadingComments": [ + { + "type": "CommentLine", + "value": " @flow", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } + } + ] + } + ], + "directives": [] + }, + "comments": [ + { + "type": "CommentLine", + "value": " @flow", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } + } + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/regression/issue-58-ambiguous/options.json b/packages/babel-parser/test/fixtures/flow/regression/issue-58-ambiguous/options.json index 49dc6c3d5a6a..abfcf6f44eba 100644 --- a/packages/babel-parser/test/fixtures/flow/regression/issue-58-ambiguous/options.json +++ b/packages/babel-parser/test/fixtures/flow/regression/issue-58-ambiguous/options.json @@ -1,3 +1,3 @@ { - "throws": "Ambiguous expression: wrap the arrow functions in parentheses to disambiguate. (4:4)" + "throws": "Unexpected token, expected \":\" (4:27)" } diff --git a/packages/babel-parser/test/fixtures/flow/regression/issue-58-failing-1/options.json b/packages/babel-parser/test/fixtures/flow/regression/issue-58-failing-1/options.json deleted file mode 100644 index 215199590424..000000000000 --- a/packages/babel-parser/test/fixtures/flow/regression/issue-58-failing-1/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid left-hand side in arrow function parameters (2:11)" -} diff --git a/packages/babel-parser/test/fixtures/flow/regression/issue-58-failing-1/output.json b/packages/babel-parser/test/fixtures/flow/regression/issue-58-failing-1/output.json new file mode 100644 index 000000000000..598107b6493b --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/regression/issue-58-failing-1/output.json @@ -0,0 +1,233 @@ +{ + "type": "File", + "start": 0, + "end": 67, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 24 + } + }, + "errors": [ + "SyntaxError: Binding invalid left-hand side in function parameter list (2:11)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 67, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 24 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 43, + "end": 67, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 24 + } + }, + "expression": { + "type": "ConditionalExpression", + "start": 43, + "end": 66, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 23 + } + }, + "test": { + "type": "Identifier", + "start": 43, + "end": 44, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 1 + }, + "identifierName": "a" + }, + "name": "a" + }, + "consequent": { + "type": "Identifier", + "start": 48, + "end": 49, + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 6 + }, + "identifierName": "b" + }, + "name": "b", + "extra": { + "parenthesized": true, + "parenStart": 47 + } + }, + "alternate": { + "type": "ArrowFunctionExpression", + "start": 53, + "end": 66, + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 23 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "ArrowFunctionExpression", + "start": 54, + "end": 60, + "loc": { + "start": { + "line": 2, + "column": 11 + }, + "end": { + "line": 2, + "column": 17 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 54, + "end": 55, + "loc": { + "start": { + "line": 2, + "column": 11 + }, + "end": { + "line": 2, + "column": 12 + }, + "identifierName": "c" + }, + "name": "c" + } + ], + "body": { + "type": "Identifier", + "start": 59, + "end": 60, + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 17 + }, + "identifierName": "d" + }, + "name": "d" + } + } + ], + "body": { + "type": "Identifier", + "start": 65, + "end": 66, + "loc": { + "start": { + "line": 2, + "column": 22 + }, + "end": { + "line": 2, + "column": 23 + }, + "identifierName": "e" + }, + "name": "e" + } + } + }, + "leadingComments": [ + { + "type": "CommentLine", + "value": " Function which looks like a return type", + "start": 0, + "end": 42, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 42 + } + } + } + ] + } + ], + "directives": [] + }, + "comments": [ + { + "type": "CommentLine", + "value": " Function which looks like a return type", + "start": 0, + "end": 42, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 42 + } + } + } + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/regression/issue-58-failing-2/options.json b/packages/babel-parser/test/fixtures/flow/regression/issue-58-failing-2/options.json deleted file mode 100644 index 36a678e0e538..000000000000 --- a/packages/babel-parser/test/fixtures/flow/regression/issue-58-failing-2/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid left-hand side in arrow function parameters (2:8)" -} diff --git a/packages/babel-parser/test/fixtures/flow/regression/issue-58-failing-2/output.json b/packages/babel-parser/test/fixtures/flow/regression/issue-58-failing-2/output.json new file mode 100644 index 000000000000..c65e342557c3 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/regression/issue-58-failing-2/output.json @@ -0,0 +1,353 @@ +{ + "type": "File", + "start": 0, + "end": 83, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 36 + } + }, + "errors": [ + "SyntaxError: Binding invalid left-hand side in function parameter list (2:8)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 83, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 36 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 47, + "end": 83, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 36 + } + }, + "expression": { + "type": "ConditionalExpression", + "start": 47, + "end": 82, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 35 + } + }, + "test": { + "type": "Identifier", + "start": 47, + "end": 48, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 1 + }, + "identifierName": "a" + }, + "name": "a" + }, + "consequent": { + "type": "ArrowFunctionExpression", + "start": 51, + "end": 73, + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 26 + } + }, + "predicate": null, + "returnType": { + "type": "TypeAnnotation", + "start": 63, + "end": 66, + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 19 + } + }, + "typeAnnotation": { + "type": "GenericTypeAnnotation", + "start": 65, + "end": 66, + "loc": { + "start": { + "line": 2, + "column": 18 + }, + "end": { + "line": 2, + "column": 19 + } + }, + "typeParameters": null, + "id": { + "type": "Identifier", + "start": 65, + "end": 66, + "loc": { + "start": { + "line": 2, + "column": 18 + }, + "end": { + "line": 2, + "column": 19 + }, + "identifierName": "d" + }, + "name": "d" + } + } + }, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "ArrowFunctionExpression", + "start": 55, + "end": 61, + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 55, + "end": 56, + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 9 + }, + "identifierName": "b" + }, + "name": "b" + } + ], + "body": { + "type": "Identifier", + "start": 60, + "end": 61, + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 14 + }, + "identifierName": "c" + }, + "name": "c" + } + } + ], + "body": { + "type": "Identifier", + "start": 71, + "end": 72, + "loc": { + "start": { + "line": 2, + "column": 24 + }, + "end": { + "line": 2, + "column": 25 + }, + "identifierName": "e" + }, + "name": "e", + "extra": { + "parenthesized": true, + "parenStart": 70 + } + }, + "typeParameters": { + "type": "TypeParameterDeclaration", + "start": 51, + "end": 54, + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 7 + } + }, + "params": [ + { + "type": "TypeParameter", + "start": 52, + "end": 53, + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 6 + } + }, + "name": "T", + "variance": null + } + ] + } + }, + "alternate": { + "type": "ArrowFunctionExpression", + "start": 76, + "end": 82, + "loc": { + "start": { + "line": 2, + "column": 29 + }, + "end": { + "line": 2, + "column": 35 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 76, + "end": 77, + "loc": { + "start": { + "line": 2, + "column": 29 + }, + "end": { + "line": 2, + "column": 30 + }, + "identifierName": "f" + }, + "name": "f" + } + ], + "body": { + "type": "Identifier", + "start": 81, + "end": 82, + "loc": { + "start": { + "line": 2, + "column": 34 + }, + "end": { + "line": 2, + "column": 35 + }, + "identifierName": "g" + }, + "name": "g" + } + } + }, + "leadingComments": [ + { + "type": "CommentLine", + "value": " Invalid LHS parameter after type parameters", + "start": 0, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 46 + } + } + } + ] + } + ], + "directives": [] + }, + "comments": [ + { + "type": "CommentLine", + "value": " Invalid LHS parameter after type parameters", + "start": 0, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 46 + } + } + } + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/regression/issue-58-failing-3/options.json b/packages/babel-parser/test/fixtures/flow/regression/issue-58-failing-3/options.json deleted file mode 100644 index 2fc0696df35a..000000000000 --- a/packages/babel-parser/test/fixtures/flow/regression/issue-58-failing-3/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid left-hand side in arrow function parameters (2:5)" -} diff --git a/packages/babel-parser/test/fixtures/flow/regression/issue-58-failing-3/output.json b/packages/babel-parser/test/fixtures/flow/regression/issue-58-failing-3/output.json new file mode 100644 index 000000000000..ae2fe29bafc4 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/regression/issue-58-failing-3/output.json @@ -0,0 +1,270 @@ +{ + "type": "File", + "start": 0, + "end": 76, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 29 + } + }, + "errors": [ + "SyntaxError: Binding invalid left-hand side in function parameter list (2:5)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 76, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 29 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 47, + "end": 76, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 29 + } + }, + "expression": { + "type": "ConditionalExpression", + "start": 47, + "end": 75, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 28 + } + }, + "test": { + "type": "Identifier", + "start": 47, + "end": 48, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 1 + }, + "identifierName": "a" + }, + "name": "a" + }, + "consequent": { + "type": "ArrowFunctionExpression", + "start": 51, + "end": 66, + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 19 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "ArrowFunctionExpression", + "start": 52, + "end": 58, + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 11 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 52, + "end": 53, + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 6 + }, + "identifierName": "b" + }, + "name": "b" + } + ], + "body": { + "type": "Identifier", + "start": 57, + "end": 58, + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 11 + }, + "identifierName": "c" + }, + "name": "c" + } + } + ], + "body": { + "type": "Identifier", + "start": 64, + "end": 65, + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 18 + }, + "identifierName": "e" + }, + "name": "e", + "extra": { + "parenthesized": true, + "parenStart": 63 + } + } + }, + "alternate": { + "type": "ArrowFunctionExpression", + "start": 69, + "end": 75, + "loc": { + "start": { + "line": 2, + "column": 22 + }, + "end": { + "line": 2, + "column": 28 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 69, + "end": 70, + "loc": { + "start": { + "line": 2, + "column": 22 + }, + "end": { + "line": 2, + "column": 23 + }, + "identifierName": "f" + }, + "name": "f" + } + ], + "body": { + "type": "Identifier", + "start": 74, + "end": 75, + "loc": { + "start": { + "line": 2, + "column": 27 + }, + "end": { + "line": 2, + "column": 28 + }, + "identifierName": "g" + }, + "name": "g" + } + } + }, + "leadingComments": [ + { + "type": "CommentLine", + "value": " Invalid LHS parameter after type parameters", + "start": 0, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 46 + } + } + } + ] + } + ], + "directives": [] + }, + "comments": [ + { + "type": "CommentLine", + "value": " Invalid LHS parameter after type parameters", + "start": 0, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 46 + } + } + } + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/regression/issue-58-failing-4/options.json b/packages/babel-parser/test/fixtures/flow/regression/issue-58-failing-4/options.json deleted file mode 100644 index 215199590424..000000000000 --- a/packages/babel-parser/test/fixtures/flow/regression/issue-58-failing-4/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid left-hand side in arrow function parameters (2:11)" -} diff --git a/packages/babel-parser/test/fixtures/flow/regression/issue-58-failing-4/output.json b/packages/babel-parser/test/fixtures/flow/regression/issue-58-failing-4/output.json new file mode 100644 index 000000000000..2479192b7877 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/regression/issue-58-failing-4/output.json @@ -0,0 +1,270 @@ +{ + "type": "File", + "start": 0, + "end": 60, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 35 + } + }, + "errors": [ + "SyntaxError: Binding invalid left-hand side in function parameter list (2:11)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 60, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 35 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 25, + "end": 60, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 35 + } + }, + "expression": { + "type": "ConditionalExpression", + "start": 25, + "end": 59, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 34 + } + }, + "test": { + "type": "Identifier", + "start": 25, + "end": 26, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 1 + }, + "identifierName": "a" + }, + "name": "a" + }, + "consequent": { + "type": "ArrowFunctionExpression", + "start": 29, + "end": 50, + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 25 + } + }, + "id": null, + "generator": false, + "async": true, + "params": [ + { + "type": "ArrowFunctionExpression", + "start": 36, + "end": 42, + "loc": { + "start": { + "line": 2, + "column": 11 + }, + "end": { + "line": 2, + "column": 17 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 36, + "end": 37, + "loc": { + "start": { + "line": 2, + "column": 11 + }, + "end": { + "line": 2, + "column": 12 + }, + "identifierName": "b" + }, + "name": "b" + } + ], + "body": { + "type": "Identifier", + "start": 41, + "end": 42, + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 17 + }, + "identifierName": "c" + }, + "name": "c" + } + } + ], + "body": { + "type": "Identifier", + "start": 48, + "end": 49, + "loc": { + "start": { + "line": 2, + "column": 23 + }, + "end": { + "line": 2, + "column": 24 + }, + "identifierName": "d" + }, + "name": "d", + "extra": { + "parenthesized": true, + "parenStart": 47 + } + } + }, + "alternate": { + "type": "ArrowFunctionExpression", + "start": 53, + "end": 59, + "loc": { + "start": { + "line": 2, + "column": 28 + }, + "end": { + "line": 2, + "column": 34 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 53, + "end": 54, + "loc": { + "start": { + "line": 2, + "column": 28 + }, + "end": { + "line": 2, + "column": 29 + }, + "identifierName": "f" + }, + "name": "f" + } + ], + "body": { + "type": "Identifier", + "start": 58, + "end": 59, + "loc": { + "start": { + "line": 2, + "column": 33 + }, + "end": { + "line": 2, + "column": 34 + }, + "identifierName": "g" + }, + "name": "g" + } + } + }, + "leadingComments": [ + { + "type": "CommentLine", + "value": " Invalid LHS parameter", + "start": 0, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + } + } + ] + } + ], + "directives": [] + }, + "comments": [ + { + "type": "CommentLine", + "value": " Invalid LHS parameter", + "start": 0, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + } + } + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/scope/.dupl-decl-const-declare-class/options.json b/packages/babel-parser/test/fixtures/flow/scope/.dupl-decl-const-declare-class/options.json deleted file mode 100644 index 4a1b4e5c5cd4..000000000000 --- a/packages/babel-parser/test/fixtures/flow/scope/.dupl-decl-const-declare-class/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'A' has already been declared (2:14)" -} diff --git a/packages/babel-parser/test/fixtures/flow/scope/.dupl-decl-const-declare-interface/options.json b/packages/babel-parser/test/fixtures/flow/scope/.dupl-decl-const-declare-interface/options.json deleted file mode 100644 index 187fea591b95..000000000000 --- a/packages/babel-parser/test/fixtures/flow/scope/.dupl-decl-const-declare-interface/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'A' has already been declared (2:18)" -} diff --git a/packages/babel-parser/test/fixtures/flow/scope/.dupl-decl-const-interface/options.json b/packages/babel-parser/test/fixtures/flow/scope/.dupl-decl-const-interface/options.json deleted file mode 100644 index 04242bd1565b..000000000000 --- a/packages/babel-parser/test/fixtures/flow/scope/.dupl-decl-const-interface/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'A' has already been declared (2:10)" -} diff --git a/packages/babel-parser/test/fixtures/flow/scope/.dupl-decl-declare-class-declare-interface/options.json b/packages/babel-parser/test/fixtures/flow/scope/.dupl-decl-declare-class-declare-interface/options.json deleted file mode 100644 index 187fea591b95..000000000000 --- a/packages/babel-parser/test/fixtures/flow/scope/.dupl-decl-declare-class-declare-interface/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'A' has already been declared (2:18)" -} diff --git a/packages/babel-parser/test/fixtures/flow/scope/.dupl-decl-declare-func-declare-var/options.json b/packages/babel-parser/test/fixtures/flow/scope/.dupl-decl-declare-func-declare-var/options.json deleted file mode 100644 index 81dc2c90799f..000000000000 --- a/packages/babel-parser/test/fixtures/flow/scope/.dupl-decl-declare-func-declare-var/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'A' has already been declared (2:12)" -} diff --git a/packages/babel-parser/test/fixtures/flow/scope/.dupl-decl-declare-func-func/options.json b/packages/babel-parser/test/fixtures/flow/scope/.dupl-decl-declare-func-func/options.json deleted file mode 100644 index 5f6027f8dd3b..000000000000 --- a/packages/babel-parser/test/fixtures/flow/scope/.dupl-decl-declare-func-func/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'A' has already been declared (2:9)" -} diff --git a/packages/babel-parser/test/fixtures/flow/scope/.dupl-decl-declare-func-let/options.json b/packages/babel-parser/test/fixtures/flow/scope/.dupl-decl-declare-func-let/options.json deleted file mode 100644 index b6ff3a4b0987..000000000000 --- a/packages/babel-parser/test/fixtures/flow/scope/.dupl-decl-declare-func-let/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'A' has already been declared (2:4)" -} diff --git a/packages/babel-parser/test/fixtures/flow/scope/.dupl-decl-declare-interface-declare-class/options.json b/packages/babel-parser/test/fixtures/flow/scope/.dupl-decl-declare-interface-declare-class/options.json deleted file mode 100644 index 4a1b4e5c5cd4..000000000000 --- a/packages/babel-parser/test/fixtures/flow/scope/.dupl-decl-declare-interface-declare-class/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'A' has already been declared (2:14)" -} diff --git a/packages/babel-parser/test/fixtures/flow/scope/.dupl-decl-declare-var-let/options.json b/packages/babel-parser/test/fixtures/flow/scope/.dupl-decl-declare-var-let/options.json deleted file mode 100644 index b6ff3a4b0987..000000000000 --- a/packages/babel-parser/test/fixtures/flow/scope/.dupl-decl-declare-var-let/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'A' has already been declared (2:4)" -} diff --git a/packages/babel-parser/test/fixtures/flow/scope/.dupl-decl-interface-interface/options.json b/packages/babel-parser/test/fixtures/flow/scope/.dupl-decl-interface-interface/options.json deleted file mode 100644 index 04242bd1565b..000000000000 --- a/packages/babel-parser/test/fixtures/flow/scope/.dupl-decl-interface-interface/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'A' has already been declared (2:10)" -} diff --git a/packages/babel-parser/test/fixtures/flow/scope/.dupl-decl-let-declare-class/options.json b/packages/babel-parser/test/fixtures/flow/scope/.dupl-decl-let-declare-class/options.json deleted file mode 100644 index 4a1b4e5c5cd4..000000000000 --- a/packages/babel-parser/test/fixtures/flow/scope/.dupl-decl-let-declare-class/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'A' has already been declared (2:14)" -} diff --git a/packages/babel-parser/test/fixtures/flow/scope/.dupl-decl-let-declare-interface/options.json b/packages/babel-parser/test/fixtures/flow/scope/.dupl-decl-let-declare-interface/options.json deleted file mode 100644 index 187fea591b95..000000000000 --- a/packages/babel-parser/test/fixtures/flow/scope/.dupl-decl-let-declare-interface/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'A' has already been declared (2:18)" -} diff --git a/packages/babel-parser/test/fixtures/flow/scope/.dupl-decl-let-interface/options.json b/packages/babel-parser/test/fixtures/flow/scope/.dupl-decl-let-interface/options.json deleted file mode 100644 index 04242bd1565b..000000000000 --- a/packages/babel-parser/test/fixtures/flow/scope/.dupl-decl-let-interface/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'A' has already been declared (2:10)" -} diff --git a/packages/babel-parser/test/fixtures/flow/scope/.dupl-decl-type-interface/options.json b/packages/babel-parser/test/fixtures/flow/scope/.dupl-decl-type-interface/options.json deleted file mode 100644 index 04242bd1565b..000000000000 --- a/packages/babel-parser/test/fixtures/flow/scope/.dupl-decl-type-interface/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'A' has already been declared (2:10)" -} diff --git a/packages/babel-parser/test/fixtures/flow/scope/.dupl-decl-var-declare-class/options.json b/packages/babel-parser/test/fixtures/flow/scope/.dupl-decl-var-declare-class/options.json deleted file mode 100644 index 4a1b4e5c5cd4..000000000000 --- a/packages/babel-parser/test/fixtures/flow/scope/.dupl-decl-var-declare-class/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'A' has already been declared (2:14)" -} diff --git a/packages/babel-parser/test/fixtures/flow/scope/.dupl-decl-var-declare-interface/options.json b/packages/babel-parser/test/fixtures/flow/scope/.dupl-decl-var-declare-interface/options.json deleted file mode 100644 index 187fea591b95..000000000000 --- a/packages/babel-parser/test/fixtures/flow/scope/.dupl-decl-var-declare-interface/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'A' has already been declared (2:18)" -} diff --git a/packages/babel-parser/test/fixtures/flow/scope/.dupl-decl-var-interface/options.json b/packages/babel-parser/test/fixtures/flow/scope/.dupl-decl-var-interface/options.json deleted file mode 100644 index 04242bd1565b..000000000000 --- a/packages/babel-parser/test/fixtures/flow/scope/.dupl-decl-var-interface/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'A' has already been declared (2:10)" -} diff --git a/packages/babel-parser/test/fixtures/flow/scope/.dupl-decl-const-declare-class/input.js b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-const-declare-class/input.js similarity index 100% rename from packages/babel-parser/test/fixtures/flow/scope/.dupl-decl-const-declare-class/input.js rename to packages/babel-parser/test/fixtures/flow/scope/dupl-decl-const-declare-class/input.js diff --git a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-const-declare-class/options.json b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-const-declare-class/options.json new file mode 100644 index 000000000000..d822c40fbba2 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-const-declare-class/options.json @@ -0,0 +1,4 @@ +{ + "sourceType": "module", + "plugins": ["jsx", "flow"] +} diff --git a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-const-declare-class/output.json b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-const-declare-class/output.json new file mode 100644 index 000000000000..a5fb057eb10c --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-const-declare-class/output.json @@ -0,0 +1,164 @@ +{ + "type": "File", + "start": 0, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 18 + } + }, + "errors": [ + "SyntaxError: Identifier 'A' has already been declared (2:14)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 18 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 6, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "A" + }, + "name": "A" + }, + "init": { + "type": "NumericLiteral", + "start": 10, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + ], + "kind": "const" + }, + { + "type": "DeclareClass", + "start": 13, + "end": 31, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 18 + } + }, + "id": { + "type": "Identifier", + "start": 27, + "end": 28, + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 15 + }, + "identifierName": "A" + }, + "name": "A" + }, + "typeParameters": null, + "extends": [], + "implements": [], + "mixins": [], + "body": { + "type": "ObjectTypeAnnotation", + "start": 29, + "end": 31, + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 18 + } + }, + "callProperties": [], + "properties": [], + "indexers": [], + "internalSlots": [], + "exact": false + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/scope/.dupl-decl-const-declare-interface/input.js b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-const-declare-interface/input.js similarity index 100% rename from packages/babel-parser/test/fixtures/flow/scope/.dupl-decl-const-declare-interface/input.js rename to packages/babel-parser/test/fixtures/flow/scope/dupl-decl-const-declare-interface/input.js diff --git a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-const-declare-interface/options.json b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-const-declare-interface/options.json new file mode 100644 index 000000000000..d822c40fbba2 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-const-declare-interface/options.json @@ -0,0 +1,4 @@ +{ + "sourceType": "module", + "plugins": ["jsx", "flow"] +} diff --git a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-const-declare-interface/output.json b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-const-declare-interface/output.json new file mode 100644 index 000000000000..93ec46f9bc31 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-const-declare-interface/output.json @@ -0,0 +1,164 @@ +{ + "type": "File", + "start": 0, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 22 + } + }, + "errors": [ + "SyntaxError: Identifier 'A' has already been declared (2:18)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 22 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 6, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "A" + }, + "name": "A" + }, + "init": { + "type": "NumericLiteral", + "start": 10, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + ], + "kind": "const" + }, + { + "type": "DeclareInterface", + "start": 13, + "end": 35, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 22 + } + }, + "id": { + "type": "Identifier", + "start": 31, + "end": 32, + "loc": { + "start": { + "line": 2, + "column": 18 + }, + "end": { + "line": 2, + "column": 19 + }, + "identifierName": "A" + }, + "name": "A" + }, + "typeParameters": null, + "extends": [], + "implements": [], + "mixins": [], + "body": { + "type": "ObjectTypeAnnotation", + "start": 33, + "end": 35, + "loc": { + "start": { + "line": 2, + "column": 20 + }, + "end": { + "line": 2, + "column": 22 + } + }, + "callProperties": [], + "properties": [], + "indexers": [], + "internalSlots": [], + "exact": false + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/scope/.dupl-decl-const-interface/input.js b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-const-interface/input.js similarity index 100% rename from packages/babel-parser/test/fixtures/flow/scope/.dupl-decl-const-interface/input.js rename to packages/babel-parser/test/fixtures/flow/scope/dupl-decl-const-interface/input.js diff --git a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-const-interface/options.json b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-const-interface/options.json new file mode 100644 index 000000000000..d822c40fbba2 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-const-interface/options.json @@ -0,0 +1,4 @@ +{ + "sourceType": "module", + "plugins": ["jsx", "flow"] +} diff --git a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-const-interface/output.json b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-const-interface/output.json new file mode 100644 index 000000000000..9de1cc4338cf --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-const-interface/output.json @@ -0,0 +1,164 @@ +{ + "type": "File", + "start": 0, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "errors": [ + "SyntaxError: Identifier 'A' has already been declared (2:10)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 6, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "A" + }, + "name": "A" + }, + "init": { + "type": "NumericLiteral", + "start": 10, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + ], + "kind": "const" + }, + { + "type": "InterfaceDeclaration", + "start": 13, + "end": 27, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "id": { + "type": "Identifier", + "start": 23, + "end": 24, + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 11 + }, + "identifierName": "A" + }, + "name": "A" + }, + "typeParameters": null, + "extends": [], + "implements": [], + "mixins": [], + "body": { + "type": "ObjectTypeAnnotation", + "start": 25, + "end": 27, + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "callProperties": [], + "properties": [], + "indexers": [], + "internalSlots": [], + "exact": false + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-const-opaque-type/options.json b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-const-opaque-type/options.json deleted file mode 100644 index 81dc2c90799f..000000000000 --- a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-const-opaque-type/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'A' has already been declared (2:12)" -} diff --git a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-const-opaque-type/output.json b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-const-opaque-type/output.json new file mode 100644 index 000000000000..7b807528c3b9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-const-opaque-type/output.json @@ -0,0 +1,163 @@ +{ + "type": "File", + "start": 0, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 19 + } + }, + "errors": [ + "SyntaxError: Identifier 'A' has already been declared (2:12)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 19 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 6, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "A" + }, + "name": "A" + }, + "init": { + "type": "NumericLiteral", + "start": 10, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + ], + "kind": "const" + }, + { + "type": "OpaqueType", + "start": 13, + "end": 32, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 19 + } + }, + "id": { + "type": "Identifier", + "start": 25, + "end": 26, + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 13 + }, + "identifierName": "A" + }, + "name": "A" + }, + "typeParameters": null, + "supertype": null, + "impltype": { + "type": "ObjectTypeAnnotation", + "start": 29, + "end": 31, + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 18 + } + }, + "callProperties": [], + "properties": [], + "indexers": [], + "internalSlots": [], + "exact": false, + "inexact": false + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-const-type/options.json b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-const-type/options.json deleted file mode 100644 index 1eed93f49a0e..000000000000 --- a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-const-type/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'A' has already been declared (2:5)" -} diff --git a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-const-type/output.json b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-const-type/output.json new file mode 100644 index 000000000000..a69cbb049a89 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-const-type/output.json @@ -0,0 +1,162 @@ +{ + "type": "File", + "start": 0, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 12 + } + }, + "errors": [ + "SyntaxError: Identifier 'A' has already been declared (2:5)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 12 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 6, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "A" + }, + "name": "A" + }, + "init": { + "type": "NumericLiteral", + "start": 10, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + ], + "kind": "const" + }, + { + "type": "TypeAlias", + "start": 13, + "end": 25, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 12 + } + }, + "id": { + "type": "Identifier", + "start": 18, + "end": 19, + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 6 + }, + "identifierName": "A" + }, + "name": "A" + }, + "typeParameters": null, + "right": { + "type": "ObjectTypeAnnotation", + "start": 22, + "end": 24, + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 11 + } + }, + "callProperties": [], + "properties": [], + "indexers": [], + "internalSlots": [], + "exact": false, + "inexact": false + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/scope/.dupl-decl-declare-class-declare-class/input.js b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-declare-class-declare-class/input.js similarity index 100% rename from packages/babel-parser/test/fixtures/flow/scope/.dupl-decl-declare-class-declare-class/input.js rename to packages/babel-parser/test/fixtures/flow/scope/dupl-decl-declare-class-declare-class/input.js diff --git a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-declare-class-declare-class/output.json b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-declare-class-declare-class/output.json new file mode 100644 index 000000000000..25358ef97ae7 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-declare-class-declare-class/output.json @@ -0,0 +1,147 @@ +{ + "type": "File", + "start": 0, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 18 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 18 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "DeclareClass", + "start": 0, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "id": { + "type": "Identifier", + "start": 14, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + }, + "identifierName": "A" + }, + "name": "A" + }, + "typeParameters": null, + "extends": [], + "implements": [], + "mixins": [], + "body": { + "type": "ObjectTypeAnnotation", + "start": 16, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "callProperties": [], + "properties": [], + "indexers": [], + "internalSlots": [], + "exact": false + } + }, + { + "type": "DeclareClass", + "start": 19, + "end": 37, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 18 + } + }, + "id": { + "type": "Identifier", + "start": 33, + "end": 34, + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 15 + }, + "identifierName": "A" + }, + "name": "A" + }, + "typeParameters": null, + "extends": [], + "implements": [], + "mixins": [], + "body": { + "type": "ObjectTypeAnnotation", + "start": 35, + "end": 37, + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 18 + } + }, + "callProperties": [], + "properties": [], + "indexers": [], + "internalSlots": [], + "exact": false + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/scope/.dupl-decl-declare-class-declare-interface/input.js b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-declare-class-declare-interface/input.js similarity index 100% rename from packages/babel-parser/test/fixtures/flow/scope/.dupl-decl-declare-class-declare-interface/input.js rename to packages/babel-parser/test/fixtures/flow/scope/dupl-decl-declare-class-declare-interface/input.js diff --git a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-declare-class-declare-interface/options.json b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-declare-class-declare-interface/options.json new file mode 100644 index 000000000000..d822c40fbba2 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-declare-class-declare-interface/options.json @@ -0,0 +1,4 @@ +{ + "sourceType": "module", + "plugins": ["jsx", "flow"] +} diff --git a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-declare-class-declare-interface/output.json b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-declare-class-declare-interface/output.json new file mode 100644 index 000000000000..a5e92908c53a --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-declare-class-declare-interface/output.json @@ -0,0 +1,150 @@ +{ + "type": "File", + "start": 0, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 22 + } + }, + "errors": [ + "SyntaxError: Identifier 'A' has already been declared (2:18)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 22 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "DeclareClass", + "start": 0, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "id": { + "type": "Identifier", + "start": 14, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + }, + "identifierName": "A" + }, + "name": "A" + }, + "typeParameters": null, + "extends": [], + "implements": [], + "mixins": [], + "body": { + "type": "ObjectTypeAnnotation", + "start": 16, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "callProperties": [], + "properties": [], + "indexers": [], + "internalSlots": [], + "exact": false + } + }, + { + "type": "DeclareInterface", + "start": 19, + "end": 41, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 22 + } + }, + "id": { + "type": "Identifier", + "start": 37, + "end": 38, + "loc": { + "start": { + "line": 2, + "column": 18 + }, + "end": { + "line": 2, + "column": 19 + }, + "identifierName": "A" + }, + "name": "A" + }, + "typeParameters": null, + "extends": [], + "implements": [], + "mixins": [], + "body": { + "type": "ObjectTypeAnnotation", + "start": 39, + "end": 41, + "loc": { + "start": { + "line": 2, + "column": 20 + }, + "end": { + "line": 2, + "column": 22 + } + }, + "callProperties": [], + "properties": [], + "indexers": [], + "internalSlots": [], + "exact": false + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/scope/.dupl-decl-declare-func-declare-func/input.js b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-declare-func-declare-func/input.js similarity index 100% rename from packages/babel-parser/test/fixtures/flow/scope/.dupl-decl-declare-func-declare-func/input.js rename to packages/babel-parser/test/fixtures/flow/scope/dupl-decl-declare-func-declare-func/input.js diff --git a/packages/babel-parser/test/fixtures/flow/scope/.dupl-decl-declare-func-declare-func/output.json b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-declare-func-declare-func/output.json similarity index 100% rename from packages/babel-parser/test/fixtures/flow/scope/.dupl-decl-declare-func-declare-func/output.json rename to packages/babel-parser/test/fixtures/flow/scope/dupl-decl-declare-func-declare-func/output.json diff --git a/packages/babel-parser/test/fixtures/flow/scope/.dupl-decl-declare-func-declare-var/input.js b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-declare-func-declare-var/input.js similarity index 100% rename from packages/babel-parser/test/fixtures/flow/scope/.dupl-decl-declare-func-declare-var/input.js rename to packages/babel-parser/test/fixtures/flow/scope/dupl-decl-declare-func-declare-var/input.js diff --git a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-declare-func-declare-var/output.json b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-declare-func-declare-var/output.json new file mode 100644 index 000000000000..5e5c135d5908 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-declare-func-declare-var/output.json @@ -0,0 +1,178 @@ +{ + "type": "File", + "start": 0, + "end": 50, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 22 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 50, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 22 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "DeclareFunction", + "start": 0, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "id": { + "type": "Identifier", + "start": 17, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 26 + }, + "identifierName": "A" + }, + "name": "A", + "typeAnnotation": { + "type": "TypeAnnotation", + "start": 18, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "typeAnnotation": { + "type": "FunctionTypeAnnotation", + "start": 18, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "typeParameters": null, + "params": [], + "rest": null, + "returnType": { + "type": "VoidTypeAnnotation", + "start": 22, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 26 + } + } + } + } + } + }, + "predicate": null + }, + { + "type": "DeclareVariable", + "start": 28, + "end": 50, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 22 + } + }, + "id": { + "type": "Identifier", + "start": 40, + "end": 49, + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 21 + }, + "identifierName": "A" + }, + "name": "A", + "typeAnnotation": { + "type": "TypeAnnotation", + "start": 41, + "end": 49, + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 21 + } + }, + "typeAnnotation": { + "type": "NumberTypeAnnotation", + "start": 43, + "end": 49, + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 21 + } + } + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/scope/.dupl-decl-declare-func-func/input.js b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-declare-func-func/input.js similarity index 100% rename from packages/babel-parser/test/fixtures/flow/scope/.dupl-decl-declare-func-func/input.js rename to packages/babel-parser/test/fixtures/flow/scope/dupl-decl-declare-func-func/input.js diff --git a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-declare-func-func/options.json b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-declare-func-func/options.json new file mode 100644 index 000000000000..d822c40fbba2 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-declare-func-func/options.json @@ -0,0 +1,4 @@ +{ + "sourceType": "module", + "plugins": ["jsx", "flow"] +} diff --git a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-declare-func-func/output.json b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-declare-func-func/output.json new file mode 100644 index 000000000000..44114ec35913 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-declare-func-func/output.json @@ -0,0 +1,168 @@ +{ + "type": "File", + "start": 0, + "end": 43, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 15 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 43, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 15 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "DeclareFunction", + "start": 0, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "id": { + "type": "Identifier", + "start": 17, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 26 + }, + "identifierName": "A" + }, + "name": "A", + "typeAnnotation": { + "type": "TypeAnnotation", + "start": 18, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "typeAnnotation": { + "type": "FunctionTypeAnnotation", + "start": 18, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "typeParameters": null, + "params": [], + "rest": null, + "returnType": { + "type": "VoidTypeAnnotation", + "start": 22, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 26 + } + } + } + } + } + }, + "predicate": null + }, + { + "type": "FunctionDeclaration", + "start": 28, + "end": 43, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 15 + } + }, + "id": { + "type": "Identifier", + "start": 37, + "end": 38, + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 10 + }, + "identifierName": "A" + }, + "name": "A" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 41, + "end": 43, + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 15 + } + }, + "body": [], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/scope/.dupl-decl-declare-interface-declare-class/input.js b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-declare-interface-declare-class/input.js similarity index 100% rename from packages/babel-parser/test/fixtures/flow/scope/.dupl-decl-declare-interface-declare-class/input.js rename to packages/babel-parser/test/fixtures/flow/scope/dupl-decl-declare-interface-declare-class/input.js diff --git a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-declare-interface-declare-class/options.json b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-declare-interface-declare-class/options.json new file mode 100644 index 000000000000..d822c40fbba2 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-declare-interface-declare-class/options.json @@ -0,0 +1,4 @@ +{ + "sourceType": "module", + "plugins": ["jsx", "flow"] +} diff --git a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-declare-interface-declare-class/output.json b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-declare-interface-declare-class/output.json new file mode 100644 index 000000000000..b2a4c51e2bc0 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-declare-interface-declare-class/output.json @@ -0,0 +1,150 @@ +{ + "type": "File", + "start": 0, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 18 + } + }, + "errors": [ + "SyntaxError: Identifier 'A' has already been declared (2:14)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 18 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "DeclareInterface", + "start": 0, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "id": { + "type": "Identifier", + "start": 18, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + }, + "identifierName": "A" + }, + "name": "A" + }, + "typeParameters": null, + "extends": [], + "implements": [], + "mixins": [], + "body": { + "type": "ObjectTypeAnnotation", + "start": 20, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "callProperties": [], + "properties": [], + "indexers": [], + "internalSlots": [], + "exact": false + } + }, + { + "type": "DeclareClass", + "start": 23, + "end": 41, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 18 + } + }, + "id": { + "type": "Identifier", + "start": 37, + "end": 38, + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 15 + }, + "identifierName": "A" + }, + "name": "A" + }, + "typeParameters": null, + "extends": [], + "implements": [], + "mixins": [], + "body": { + "type": "ObjectTypeAnnotation", + "start": 39, + "end": 41, + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 18 + } + }, + "callProperties": [], + "properties": [], + "indexers": [], + "internalSlots": [], + "exact": false + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/scope/.dupl-decl-declare-var-declare-var/input.js b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-declare-var-declare-var/input.js similarity index 100% rename from packages/babel-parser/test/fixtures/flow/scope/.dupl-decl-declare-var-declare-var/input.js rename to packages/babel-parser/test/fixtures/flow/scope/dupl-decl-declare-var-declare-var/input.js diff --git a/packages/babel-parser/test/fixtures/flow/scope/.dupl-decl-declare-var-declare-var/output.json b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-declare-var-declare-var/output.json similarity index 100% rename from packages/babel-parser/test/fixtures/flow/scope/.dupl-decl-declare-var-declare-var/output.json rename to packages/babel-parser/test/fixtures/flow/scope/dupl-decl-declare-var-declare-var/output.json diff --git a/packages/babel-parser/test/fixtures/flow/scope/.dupl-decl-declare-var-let/input.js b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-declare-var-let/input.js similarity index 100% rename from packages/babel-parser/test/fixtures/flow/scope/.dupl-decl-declare-var-let/input.js rename to packages/babel-parser/test/fixtures/flow/scope/dupl-decl-declare-var-let/input.js diff --git a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-declare-var-let/options.json b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-declare-var-let/options.json new file mode 100644 index 000000000000..d822c40fbba2 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-declare-var-let/options.json @@ -0,0 +1,4 @@ +{ + "sourceType": "module", + "plugins": ["jsx", "flow"] +} diff --git a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-declare-var-let/output.json b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-declare-var-let/output.json new file mode 100644 index 000000000000..8389c568e814 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-declare-var-let/output.json @@ -0,0 +1,151 @@ +{ + "type": "File", + "start": 0, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 6 + } + }, + "errors": [ + "SyntaxError: Identifier 'A' has already been declared (2:4)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 6 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "DeclareVariable", + "start": 0, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "id": { + "type": "Identifier", + "start": 12, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 21 + }, + "identifierName": "A" + }, + "name": "A", + "typeAnnotation": { + "type": "TypeAnnotation", + "start": 13, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "typeAnnotation": { + "type": "NumberTypeAnnotation", + "start": 15, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 21 + } + } + } + } + } + }, + { + "type": "VariableDeclaration", + "start": 23, + "end": 29, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 6 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 27, + "end": 28, + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 5 + } + }, + "id": { + "type": "Identifier", + "start": 27, + "end": 28, + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 5 + }, + "identifierName": "A" + }, + "name": "A" + }, + "init": null + } + ], + "kind": "let" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/scope/.dupl-decl-interface-interface/input.js b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-interface-interface/input.js similarity index 100% rename from packages/babel-parser/test/fixtures/flow/scope/.dupl-decl-interface-interface/input.js rename to packages/babel-parser/test/fixtures/flow/scope/dupl-decl-interface-interface/input.js diff --git a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-interface-interface/options.json b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-interface-interface/options.json new file mode 100644 index 000000000000..d822c40fbba2 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-interface-interface/options.json @@ -0,0 +1,4 @@ +{ + "sourceType": "module", + "plugins": ["jsx", "flow"] +} diff --git a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-interface-interface/output.json b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-interface-interface/output.json new file mode 100644 index 000000000000..d79d846383cf --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-interface-interface/output.json @@ -0,0 +1,150 @@ +{ + "type": "File", + "start": 0, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "errors": [ + "SyntaxError: Identifier 'A' has already been declared (2:10)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "InterfaceDeclaration", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "id": { + "type": "Identifier", + "start": 10, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + }, + "identifierName": "A" + }, + "name": "A" + }, + "typeParameters": null, + "extends": [], + "implements": [], + "mixins": [], + "body": { + "type": "ObjectTypeAnnotation", + "start": 12, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "callProperties": [], + "properties": [], + "indexers": [], + "internalSlots": [], + "exact": false + } + }, + { + "type": "InterfaceDeclaration", + "start": 15, + "end": 29, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "id": { + "type": "Identifier", + "start": 25, + "end": 26, + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 11 + }, + "identifierName": "A" + }, + "name": "A" + }, + "typeParameters": null, + "extends": [], + "implements": [], + "mixins": [], + "body": { + "type": "ObjectTypeAnnotation", + "start": 27, + "end": 29, + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "callProperties": [], + "properties": [], + "indexers": [], + "internalSlots": [], + "exact": false + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/scope/.dupl-decl-let-declare-class/input.js b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-let-declare-class/input.js similarity index 100% rename from packages/babel-parser/test/fixtures/flow/scope/.dupl-decl-let-declare-class/input.js rename to packages/babel-parser/test/fixtures/flow/scope/dupl-decl-let-declare-class/input.js diff --git a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-let-declare-class/options.json b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-let-declare-class/options.json new file mode 100644 index 000000000000..d822c40fbba2 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-let-declare-class/options.json @@ -0,0 +1,4 @@ +{ + "sourceType": "module", + "plugins": ["jsx", "flow"] +} diff --git a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-let-declare-class/output.json b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-let-declare-class/output.json new file mode 100644 index 000000000000..2dbdc1e727c2 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-let-declare-class/output.json @@ -0,0 +1,164 @@ +{ + "type": "File", + "start": 0, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 18 + } + }, + "errors": [ + "SyntaxError: Identifier 'A' has already been declared (2:14)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 18 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 4, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "id": { + "type": "Identifier", + "start": 4, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + }, + "identifierName": "A" + }, + "name": "A" + }, + "init": { + "type": "NumericLiteral", + "start": 8, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + ], + "kind": "let" + }, + { + "type": "DeclareClass", + "start": 11, + "end": 29, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 18 + } + }, + "id": { + "type": "Identifier", + "start": 25, + "end": 26, + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 15 + }, + "identifierName": "A" + }, + "name": "A" + }, + "typeParameters": null, + "extends": [], + "implements": [], + "mixins": [], + "body": { + "type": "ObjectTypeAnnotation", + "start": 27, + "end": 29, + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 18 + } + }, + "callProperties": [], + "properties": [], + "indexers": [], + "internalSlots": [], + "exact": false + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/scope/.dupl-decl-let-declare-interface/input.js b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-let-declare-interface/input.js similarity index 100% rename from packages/babel-parser/test/fixtures/flow/scope/.dupl-decl-let-declare-interface/input.js rename to packages/babel-parser/test/fixtures/flow/scope/dupl-decl-let-declare-interface/input.js diff --git a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-let-declare-interface/options.json b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-let-declare-interface/options.json new file mode 100644 index 000000000000..d822c40fbba2 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-let-declare-interface/options.json @@ -0,0 +1,4 @@ +{ + "sourceType": "module", + "plugins": ["jsx", "flow"] +} diff --git a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-let-declare-interface/output.json b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-let-declare-interface/output.json new file mode 100644 index 000000000000..a13ba7dc082c --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-let-declare-interface/output.json @@ -0,0 +1,164 @@ +{ + "type": "File", + "start": 0, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 22 + } + }, + "errors": [ + "SyntaxError: Identifier 'A' has already been declared (2:18)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 22 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 4, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "id": { + "type": "Identifier", + "start": 4, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + }, + "identifierName": "A" + }, + "name": "A" + }, + "init": { + "type": "NumericLiteral", + "start": 8, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + ], + "kind": "let" + }, + { + "type": "DeclareInterface", + "start": 11, + "end": 33, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 22 + } + }, + "id": { + "type": "Identifier", + "start": 29, + "end": 30, + "loc": { + "start": { + "line": 2, + "column": 18 + }, + "end": { + "line": 2, + "column": 19 + }, + "identifierName": "A" + }, + "name": "A" + }, + "typeParameters": null, + "extends": [], + "implements": [], + "mixins": [], + "body": { + "type": "ObjectTypeAnnotation", + "start": 31, + "end": 33, + "loc": { + "start": { + "line": 2, + "column": 20 + }, + "end": { + "line": 2, + "column": 22 + } + }, + "callProperties": [], + "properties": [], + "indexers": [], + "internalSlots": [], + "exact": false + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/scope/.dupl-decl-let-interface/input.js b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-let-interface/input.js similarity index 100% rename from packages/babel-parser/test/fixtures/flow/scope/.dupl-decl-let-interface/input.js rename to packages/babel-parser/test/fixtures/flow/scope/dupl-decl-let-interface/input.js diff --git a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-let-interface/options.json b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-let-interface/options.json new file mode 100644 index 000000000000..d822c40fbba2 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-let-interface/options.json @@ -0,0 +1,4 @@ +{ + "sourceType": "module", + "plugins": ["jsx", "flow"] +} diff --git a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-let-interface/output.json b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-let-interface/output.json new file mode 100644 index 000000000000..a8dc40e08d4c --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-let-interface/output.json @@ -0,0 +1,164 @@ +{ + "type": "File", + "start": 0, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "errors": [ + "SyntaxError: Identifier 'A' has already been declared (2:10)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 4, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "id": { + "type": "Identifier", + "start": 4, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + }, + "identifierName": "A" + }, + "name": "A" + }, + "init": { + "type": "NumericLiteral", + "start": 8, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + ], + "kind": "let" + }, + { + "type": "InterfaceDeclaration", + "start": 11, + "end": 25, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "id": { + "type": "Identifier", + "start": 21, + "end": 22, + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 11 + }, + "identifierName": "A" + }, + "name": "A" + }, + "typeParameters": null, + "extends": [], + "implements": [], + "mixins": [], + "body": { + "type": "ObjectTypeAnnotation", + "start": 23, + "end": 25, + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "callProperties": [], + "properties": [], + "indexers": [], + "internalSlots": [], + "exact": false + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-let-opaque-type/options.json b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-let-opaque-type/options.json deleted file mode 100644 index 81dc2c90799f..000000000000 --- a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-let-opaque-type/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'A' has already been declared (2:12)" -} diff --git a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-let-opaque-type/output.json b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-let-opaque-type/output.json new file mode 100644 index 000000000000..07a5a53fbc08 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-let-opaque-type/output.json @@ -0,0 +1,163 @@ +{ + "type": "File", + "start": 0, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 19 + } + }, + "errors": [ + "SyntaxError: Identifier 'A' has already been declared (2:12)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 19 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 4, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "id": { + "type": "Identifier", + "start": 4, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + }, + "identifierName": "A" + }, + "name": "A" + }, + "init": { + "type": "NumericLiteral", + "start": 8, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + ], + "kind": "let" + }, + { + "type": "OpaqueType", + "start": 11, + "end": 30, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 19 + } + }, + "id": { + "type": "Identifier", + "start": 23, + "end": 24, + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 13 + }, + "identifierName": "A" + }, + "name": "A" + }, + "typeParameters": null, + "supertype": null, + "impltype": { + "type": "ObjectTypeAnnotation", + "start": 27, + "end": 29, + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 18 + } + }, + "callProperties": [], + "properties": [], + "indexers": [], + "internalSlots": [], + "exact": false, + "inexact": false + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-let-type/options.json b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-let-type/options.json deleted file mode 100644 index 1eed93f49a0e..000000000000 --- a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-let-type/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'A' has already been declared (2:5)" -} diff --git a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-let-type/output.json b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-let-type/output.json new file mode 100644 index 000000000000..6833e37c4de1 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-let-type/output.json @@ -0,0 +1,162 @@ +{ + "type": "File", + "start": 0, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 12 + } + }, + "errors": [ + "SyntaxError: Identifier 'A' has already been declared (2:5)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 12 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 4, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "id": { + "type": "Identifier", + "start": 4, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + }, + "identifierName": "A" + }, + "name": "A" + }, + "init": { + "type": "NumericLiteral", + "start": 8, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + ], + "kind": "let" + }, + { + "type": "TypeAlias", + "start": 11, + "end": 23, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 12 + } + }, + "id": { + "type": "Identifier", + "start": 16, + "end": 17, + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 6 + }, + "identifierName": "A" + }, + "name": "A" + }, + "typeParameters": null, + "right": { + "type": "ObjectTypeAnnotation", + "start": 20, + "end": 22, + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 11 + } + }, + "callProperties": [], + "properties": [], + "indexers": [], + "internalSlots": [], + "exact": false, + "inexact": false + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-opaque-type-const/options.json b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-opaque-type-const/options.json deleted file mode 100644 index 336686170eb0..000000000000 --- a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-opaque-type-const/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'A' has already been declared (2:6)" -} diff --git a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-opaque-type-const/output.json b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-opaque-type-const/output.json new file mode 100644 index 000000000000..b374e2bcebd9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-opaque-type-const/output.json @@ -0,0 +1,163 @@ +{ + "type": "File", + "start": 0, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 12 + } + }, + "errors": [ + "SyntaxError: Identifier 'A' has already been declared (2:6)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 12 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "OpaqueType", + "start": 0, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "id": { + "type": "Identifier", + "start": 12, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + }, + "identifierName": "A" + }, + "name": "A" + }, + "typeParameters": null, + "supertype": null, + "impltype": { + "type": "ObjectTypeAnnotation", + "start": 16, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "callProperties": [], + "properties": [], + "indexers": [], + "internalSlots": [], + "exact": false, + "inexact": false + } + }, + { + "type": "VariableDeclaration", + "start": 20, + "end": 32, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 12 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 26, + "end": 31, + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 11 + } + }, + "id": { + "type": "Identifier", + "start": 26, + "end": 27, + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 7 + }, + "identifierName": "A" + }, + "name": "A" + }, + "init": { + "type": "NumericLiteral", + "start": 30, + "end": 31, + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 11 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + ], + "kind": "const" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-opaque-type-let/options.json b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-opaque-type-let/options.json deleted file mode 100644 index b6ff3a4b0987..000000000000 --- a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-opaque-type-let/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'A' has already been declared (2:4)" -} diff --git a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-opaque-type-let/output.json b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-opaque-type-let/output.json new file mode 100644 index 000000000000..9f326dfe3e5e --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-opaque-type-let/output.json @@ -0,0 +1,163 @@ +{ + "type": "File", + "start": 0, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 10 + } + }, + "errors": [ + "SyntaxError: Identifier 'A' has already been declared (2:4)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 10 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "OpaqueType", + "start": 0, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "id": { + "type": "Identifier", + "start": 12, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + }, + "identifierName": "A" + }, + "name": "A" + }, + "typeParameters": null, + "supertype": null, + "impltype": { + "type": "ObjectTypeAnnotation", + "start": 16, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "callProperties": [], + "properties": [], + "indexers": [], + "internalSlots": [], + "exact": false, + "inexact": false + } + }, + { + "type": "VariableDeclaration", + "start": 20, + "end": 30, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 10 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 24, + "end": 29, + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 9 + } + }, + "id": { + "type": "Identifier", + "start": 24, + "end": 25, + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 5 + }, + "identifierName": "A" + }, + "name": "A" + }, + "init": { + "type": "NumericLiteral", + "start": 28, + "end": 29, + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 9 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + ], + "kind": "let" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-opaque-type-opaque-type/options.json b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-opaque-type-opaque-type/options.json deleted file mode 100644 index 81dc2c90799f..000000000000 --- a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-opaque-type-opaque-type/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'A' has already been declared (2:12)" -} diff --git a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-opaque-type-opaque-type/output.json b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-opaque-type-opaque-type/output.json new file mode 100644 index 000000000000..86b98af15006 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-opaque-type-opaque-type/output.json @@ -0,0 +1,148 @@ +{ + "type": "File", + "start": 0, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 19 + } + }, + "errors": [ + "SyntaxError: Identifier 'A' has already been declared (2:12)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 19 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "OpaqueType", + "start": 0, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "id": { + "type": "Identifier", + "start": 12, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + }, + "identifierName": "A" + }, + "name": "A" + }, + "typeParameters": null, + "supertype": null, + "impltype": { + "type": "ObjectTypeAnnotation", + "start": 16, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "callProperties": [], + "properties": [], + "indexers": [], + "internalSlots": [], + "exact": false, + "inexact": false + } + }, + { + "type": "OpaqueType", + "start": 20, + "end": 39, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 19 + } + }, + "id": { + "type": "Identifier", + "start": 32, + "end": 33, + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 13 + }, + "identifierName": "A" + }, + "name": "A" + }, + "typeParameters": null, + "supertype": null, + "impltype": { + "type": "ObjectTypeAnnotation", + "start": 36, + "end": 38, + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 18 + } + }, + "callProperties": [], + "properties": [], + "indexers": [], + "internalSlots": [], + "exact": false, + "inexact": false + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-opaque-type-type/options.json b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-opaque-type-type/options.json deleted file mode 100644 index 1eed93f49a0e..000000000000 --- a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-opaque-type-type/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'A' has already been declared (2:5)" -} diff --git a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-opaque-type-type/output.json b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-opaque-type-type/output.json new file mode 100644 index 000000000000..76300249f569 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-opaque-type-type/output.json @@ -0,0 +1,147 @@ +{ + "type": "File", + "start": 0, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 12 + } + }, + "errors": [ + "SyntaxError: Identifier 'A' has already been declared (2:5)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 12 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "OpaqueType", + "start": 0, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "id": { + "type": "Identifier", + "start": 12, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + }, + "identifierName": "A" + }, + "name": "A" + }, + "typeParameters": null, + "supertype": null, + "impltype": { + "type": "ObjectTypeAnnotation", + "start": 16, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "callProperties": [], + "properties": [], + "indexers": [], + "internalSlots": [], + "exact": false, + "inexact": false + } + }, + { + "type": "TypeAlias", + "start": 20, + "end": 32, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 12 + } + }, + "id": { + "type": "Identifier", + "start": 25, + "end": 26, + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 6 + }, + "identifierName": "A" + }, + "name": "A" + }, + "typeParameters": null, + "right": { + "type": "ObjectTypeAnnotation", + "start": 29, + "end": 31, + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 11 + } + }, + "callProperties": [], + "properties": [], + "indexers": [], + "internalSlots": [], + "exact": false, + "inexact": false + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-opaque-type-var/options.json b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-opaque-type-var/options.json deleted file mode 100644 index b6ff3a4b0987..000000000000 --- a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-opaque-type-var/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'A' has already been declared (2:4)" -} diff --git a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-opaque-type-var/output.json b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-opaque-type-var/output.json new file mode 100644 index 000000000000..b5b462a59cf5 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-opaque-type-var/output.json @@ -0,0 +1,163 @@ +{ + "type": "File", + "start": 0, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 10 + } + }, + "errors": [ + "SyntaxError: Identifier 'A' has already been declared (2:4)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 10 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "OpaqueType", + "start": 0, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "id": { + "type": "Identifier", + "start": 12, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + }, + "identifierName": "A" + }, + "name": "A" + }, + "typeParameters": null, + "supertype": null, + "impltype": { + "type": "ObjectTypeAnnotation", + "start": 16, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "callProperties": [], + "properties": [], + "indexers": [], + "internalSlots": [], + "exact": false, + "inexact": false + } + }, + { + "type": "VariableDeclaration", + "start": 20, + "end": 30, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 10 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 24, + "end": 29, + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 9 + } + }, + "id": { + "type": "Identifier", + "start": 24, + "end": 25, + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 5 + }, + "identifierName": "A" + }, + "name": "A" + }, + "init": { + "type": "NumericLiteral", + "start": 28, + "end": 29, + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 9 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + ], + "kind": "var" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-type-const/options.json b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-type-const/options.json deleted file mode 100644 index 336686170eb0..000000000000 --- a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-type-const/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'A' has already been declared (2:6)" -} diff --git a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-type-const/output.json b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-type-const/output.json new file mode 100644 index 000000000000..916e60eaa94a --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-type-const/output.json @@ -0,0 +1,162 @@ +{ + "type": "File", + "start": 0, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 12 + } + }, + "errors": [ + "SyntaxError: Identifier 'A' has already been declared (2:6)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 12 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "TypeAlias", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "id": { + "type": "Identifier", + "start": 5, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + }, + "identifierName": "A" + }, + "name": "A" + }, + "typeParameters": null, + "right": { + "type": "ObjectTypeAnnotation", + "start": 9, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "callProperties": [], + "properties": [], + "indexers": [], + "internalSlots": [], + "exact": false, + "inexact": false + } + }, + { + "type": "VariableDeclaration", + "start": 13, + "end": 25, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 12 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 19, + "end": 24, + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 11 + } + }, + "id": { + "type": "Identifier", + "start": 19, + "end": 20, + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 7 + }, + "identifierName": "A" + }, + "name": "A" + }, + "init": { + "type": "NumericLiteral", + "start": 23, + "end": 24, + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 11 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + ], + "kind": "const" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/scope/.dupl-decl-type-interface/input.js b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-type-interface/input.js similarity index 100% rename from packages/babel-parser/test/fixtures/flow/scope/.dupl-decl-type-interface/input.js rename to packages/babel-parser/test/fixtures/flow/scope/dupl-decl-type-interface/input.js diff --git a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-type-interface/options.json b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-type-interface/options.json new file mode 100644 index 000000000000..d822c40fbba2 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-type-interface/options.json @@ -0,0 +1,4 @@ +{ + "sourceType": "module", + "plugins": ["jsx", "flow"] +} diff --git a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-type-interface/output.json b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-type-interface/output.json new file mode 100644 index 000000000000..0aa57e51c3ff --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-type-interface/output.json @@ -0,0 +1,142 @@ +{ + "type": "File", + "start": 0, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "errors": [ + "SyntaxError: Identifier 'A' has already been declared (2:10)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "TypeAlias", + "start": 0, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "id": { + "type": "Identifier", + "start": 5, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + }, + "identifierName": "A" + }, + "name": "A" + }, + "typeParameters": null, + "right": { + "type": "NumberTypeAnnotation", + "start": 9, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 15 + } + } + } + }, + { + "type": "InterfaceDeclaration", + "start": 17, + "end": 31, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "id": { + "type": "Identifier", + "start": 27, + "end": 28, + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 11 + }, + "identifierName": "A" + }, + "name": "A" + }, + "typeParameters": null, + "extends": [], + "implements": [], + "mixins": [], + "body": { + "type": "ObjectTypeAnnotation", + "start": 29, + "end": 31, + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "callProperties": [], + "properties": [], + "indexers": [], + "internalSlots": [], + "exact": false + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-type-let/options.json b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-type-let/options.json deleted file mode 100644 index b6ff3a4b0987..000000000000 --- a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-type-let/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'A' has already been declared (2:4)" -} diff --git a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-type-let/output.json b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-type-let/output.json new file mode 100644 index 000000000000..6e394ffbcda1 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-type-let/output.json @@ -0,0 +1,162 @@ +{ + "type": "File", + "start": 0, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 10 + } + }, + "errors": [ + "SyntaxError: Identifier 'A' has already been declared (2:4)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 10 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "TypeAlias", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "id": { + "type": "Identifier", + "start": 5, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + }, + "identifierName": "A" + }, + "name": "A" + }, + "typeParameters": null, + "right": { + "type": "ObjectTypeAnnotation", + "start": 9, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "callProperties": [], + "properties": [], + "indexers": [], + "internalSlots": [], + "exact": false, + "inexact": false + } + }, + { + "type": "VariableDeclaration", + "start": 13, + "end": 23, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 10 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 17, + "end": 22, + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 9 + } + }, + "id": { + "type": "Identifier", + "start": 17, + "end": 18, + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 5 + }, + "identifierName": "A" + }, + "name": "A" + }, + "init": { + "type": "NumericLiteral", + "start": 21, + "end": 22, + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 9 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + ], + "kind": "let" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-type-opaque-type/options.json b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-type-opaque-type/options.json deleted file mode 100644 index 81dc2c90799f..000000000000 --- a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-type-opaque-type/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'A' has already been declared (2:12)" -} diff --git a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-type-opaque-type/output.json b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-type-opaque-type/output.json new file mode 100644 index 000000000000..95d0b22f7cfd --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-type-opaque-type/output.json @@ -0,0 +1,147 @@ +{ + "type": "File", + "start": 0, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 19 + } + }, + "errors": [ + "SyntaxError: Identifier 'A' has already been declared (2:12)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 19 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "TypeAlias", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "id": { + "type": "Identifier", + "start": 5, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + }, + "identifierName": "A" + }, + "name": "A" + }, + "typeParameters": null, + "right": { + "type": "ObjectTypeAnnotation", + "start": 9, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "callProperties": [], + "properties": [], + "indexers": [], + "internalSlots": [], + "exact": false, + "inexact": false + } + }, + { + "type": "OpaqueType", + "start": 13, + "end": 32, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 19 + } + }, + "id": { + "type": "Identifier", + "start": 25, + "end": 26, + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 13 + }, + "identifierName": "A" + }, + "name": "A" + }, + "typeParameters": null, + "supertype": null, + "impltype": { + "type": "ObjectTypeAnnotation", + "start": 29, + "end": 31, + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 18 + } + }, + "callProperties": [], + "properties": [], + "indexers": [], + "internalSlots": [], + "exact": false, + "inexact": false + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-type-type/options.json b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-type-type/options.json deleted file mode 100644 index 1eed93f49a0e..000000000000 --- a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-type-type/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'A' has already been declared (2:5)" -} diff --git a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-type-type/output.json b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-type-type/output.json new file mode 100644 index 000000000000..09c73482f8f1 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-type-type/output.json @@ -0,0 +1,146 @@ +{ + "type": "File", + "start": 0, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 12 + } + }, + "errors": [ + "SyntaxError: Identifier 'A' has already been declared (2:5)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 12 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "TypeAlias", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "id": { + "type": "Identifier", + "start": 5, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + }, + "identifierName": "A" + }, + "name": "A" + }, + "typeParameters": null, + "right": { + "type": "ObjectTypeAnnotation", + "start": 9, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "callProperties": [], + "properties": [], + "indexers": [], + "internalSlots": [], + "exact": false, + "inexact": false + } + }, + { + "type": "TypeAlias", + "start": 13, + "end": 25, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 12 + } + }, + "id": { + "type": "Identifier", + "start": 18, + "end": 19, + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 6 + }, + "identifierName": "A" + }, + "name": "A" + }, + "typeParameters": null, + "right": { + "type": "ObjectTypeAnnotation", + "start": 22, + "end": 24, + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 11 + } + }, + "callProperties": [], + "properties": [], + "indexers": [], + "internalSlots": [], + "exact": false, + "inexact": false + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-type-var/options.json b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-type-var/options.json deleted file mode 100644 index b6ff3a4b0987..000000000000 --- a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-type-var/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'A' has already been declared (2:4)" -} diff --git a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-type-var/output.json b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-type-var/output.json new file mode 100644 index 000000000000..52626b852e33 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-type-var/output.json @@ -0,0 +1,162 @@ +{ + "type": "File", + "start": 0, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 10 + } + }, + "errors": [ + "SyntaxError: Identifier 'A' has already been declared (2:4)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 10 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "TypeAlias", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "id": { + "type": "Identifier", + "start": 5, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + }, + "identifierName": "A" + }, + "name": "A" + }, + "typeParameters": null, + "right": { + "type": "ObjectTypeAnnotation", + "start": 9, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "callProperties": [], + "properties": [], + "indexers": [], + "internalSlots": [], + "exact": false, + "inexact": false + } + }, + { + "type": "VariableDeclaration", + "start": 13, + "end": 23, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 10 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 17, + "end": 22, + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 9 + } + }, + "id": { + "type": "Identifier", + "start": 17, + "end": 18, + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 5 + }, + "identifierName": "A" + }, + "name": "A" + }, + "init": { + "type": "NumericLiteral", + "start": 21, + "end": 22, + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 9 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + ], + "kind": "var" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/scope/.dupl-decl-var-declare-interface/input.js b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-var-declare-interface/input.js similarity index 100% rename from packages/babel-parser/test/fixtures/flow/scope/.dupl-decl-var-declare-interface/input.js rename to packages/babel-parser/test/fixtures/flow/scope/dupl-decl-var-declare-interface/input.js diff --git a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-var-declare-interface/options.json b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-var-declare-interface/options.json new file mode 100644 index 000000000000..d822c40fbba2 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-var-declare-interface/options.json @@ -0,0 +1,4 @@ +{ + "sourceType": "module", + "plugins": ["jsx", "flow"] +} diff --git a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-var-declare-interface/output.json b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-var-declare-interface/output.json new file mode 100644 index 000000000000..f60940e178bf --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-var-declare-interface/output.json @@ -0,0 +1,164 @@ +{ + "type": "File", + "start": 0, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 22 + } + }, + "errors": [ + "SyntaxError: Identifier 'A' has already been declared (2:18)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 22 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 4, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "id": { + "type": "Identifier", + "start": 4, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + }, + "identifierName": "A" + }, + "name": "A" + }, + "init": { + "type": "NumericLiteral", + "start": 8, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + ], + "kind": "var" + }, + { + "type": "DeclareInterface", + "start": 11, + "end": 33, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 22 + } + }, + "id": { + "type": "Identifier", + "start": 29, + "end": 30, + "loc": { + "start": { + "line": 2, + "column": 18 + }, + "end": { + "line": 2, + "column": 19 + }, + "identifierName": "A" + }, + "name": "A" + }, + "typeParameters": null, + "extends": [], + "implements": [], + "mixins": [], + "body": { + "type": "ObjectTypeAnnotation", + "start": 31, + "end": 33, + "loc": { + "start": { + "line": 2, + "column": 20 + }, + "end": { + "line": 2, + "column": 22 + } + }, + "callProperties": [], + "properties": [], + "indexers": [], + "internalSlots": [], + "exact": false + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/scope/.dupl-decl-var-interface/input.js b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-var-interface/input.js similarity index 100% rename from packages/babel-parser/test/fixtures/flow/scope/.dupl-decl-var-interface/input.js rename to packages/babel-parser/test/fixtures/flow/scope/dupl-decl-var-interface/input.js diff --git a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-var-interface/options.json b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-var-interface/options.json new file mode 100644 index 000000000000..d822c40fbba2 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-var-interface/options.json @@ -0,0 +1,4 @@ +{ + "sourceType": "module", + "plugins": ["jsx", "flow"] +} diff --git a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-var-interface/output.json b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-var-interface/output.json new file mode 100644 index 000000000000..271c66e47dd7 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-var-interface/output.json @@ -0,0 +1,164 @@ +{ + "type": "File", + "start": 0, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "errors": [ + "SyntaxError: Identifier 'A' has already been declared (2:10)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 4, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "id": { + "type": "Identifier", + "start": 4, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + }, + "identifierName": "A" + }, + "name": "A" + }, + "init": { + "type": "NumericLiteral", + "start": 8, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + ], + "kind": "var" + }, + { + "type": "InterfaceDeclaration", + "start": 11, + "end": 25, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "id": { + "type": "Identifier", + "start": 21, + "end": 22, + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 11 + }, + "identifierName": "A" + }, + "name": "A" + }, + "typeParameters": null, + "extends": [], + "implements": [], + "mixins": [], + "body": { + "type": "ObjectTypeAnnotation", + "start": 23, + "end": 25, + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "callProperties": [], + "properties": [], + "indexers": [], + "internalSlots": [], + "exact": false + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-var-opaque-type/options.json b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-var-opaque-type/options.json deleted file mode 100644 index 81dc2c90799f..000000000000 --- a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-var-opaque-type/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'A' has already been declared (2:12)" -} diff --git a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-var-opaque-type/output.json b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-var-opaque-type/output.json new file mode 100644 index 000000000000..d41f91a9d947 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-var-opaque-type/output.json @@ -0,0 +1,163 @@ +{ + "type": "File", + "start": 0, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 19 + } + }, + "errors": [ + "SyntaxError: Identifier 'A' has already been declared (2:12)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 19 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 4, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "id": { + "type": "Identifier", + "start": 4, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + }, + "identifierName": "A" + }, + "name": "A" + }, + "init": { + "type": "NumericLiteral", + "start": 8, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + ], + "kind": "var" + }, + { + "type": "OpaqueType", + "start": 11, + "end": 30, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 19 + } + }, + "id": { + "type": "Identifier", + "start": 23, + "end": 24, + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 13 + }, + "identifierName": "A" + }, + "name": "A" + }, + "typeParameters": null, + "supertype": null, + "impltype": { + "type": "ObjectTypeAnnotation", + "start": 27, + "end": 29, + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 18 + } + }, + "callProperties": [], + "properties": [], + "indexers": [], + "internalSlots": [], + "exact": false, + "inexact": false + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-var-type/options.json b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-var-type/options.json deleted file mode 100644 index 1eed93f49a0e..000000000000 --- a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-var-type/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'A' has already been declared (2:5)" -} diff --git a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-var-type/output.json b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-var-type/output.json new file mode 100644 index 000000000000..4f1dcc135976 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-var-type/output.json @@ -0,0 +1,162 @@ +{ + "type": "File", + "start": 0, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 12 + } + }, + "errors": [ + "SyntaxError: Identifier 'A' has already been declared (2:5)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 12 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 4, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "id": { + "type": "Identifier", + "start": 4, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + }, + "identifierName": "A" + }, + "name": "A" + }, + "init": { + "type": "NumericLiteral", + "start": 8, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + ], + "kind": "var" + }, + { + "type": "TypeAlias", + "start": 11, + "end": 23, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 12 + } + }, + "id": { + "type": "Identifier", + "start": 16, + "end": 17, + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 6 + }, + "identifierName": "A" + }, + "name": "A" + }, + "typeParameters": null, + "right": { + "type": "ObjectTypeAnnotation", + "start": 20, + "end": 22, + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 11 + } + }, + "callProperties": [], + "properties": [], + "indexers": [], + "internalSlots": [], + "exact": false, + "inexact": false + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/tuples/3/output.json b/packages/babel-parser/test/fixtures/flow/tuples/3/output.json index 2c61f6b164a0..dada487fe124 100644 --- a/packages/babel-parser/test/fixtures/flow/tuples/3/output.json +++ b/packages/babel-parser/test/fixtures/flow/tuples/3/output.json @@ -157,7 +157,10 @@ }, "value": 123 } - ] + ], + "extra": { + "trailingComma": 24 + } } } ], diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/131/options.json b/packages/babel-parser/test/fixtures/flow/type-annotations/131/options.json deleted file mode 100644 index 50bea8a5db27..000000000000 --- a/packages/babel-parser/test/fixtures/flow/type-annotations/131/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Cannot overwrite reserved type number (1:5)" -} diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/131/output.json b/packages/babel-parser/test/fixtures/flow/type-annotations/131/output.json new file mode 100644 index 000000000000..ef2bc17e2d96 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/type-annotations/131/output.json @@ -0,0 +1,86 @@ +{ + "type": "File", + "start": 0, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "errors": [ + "SyntaxError: Cannot overwrite reserved type number (1:5)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "TypeAlias", + "start": 0, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "id": { + "type": "Identifier", + "start": 5, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 11 + }, + "identifierName": "number" + }, + "name": "number" + }, + "typeParameters": null, + "right": { + "type": "StringTypeAnnotation", + "start": 14, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 20 + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/132/options.json b/packages/babel-parser/test/fixtures/flow/type-annotations/132/options.json deleted file mode 100644 index 257d651b33e2..000000000000 --- a/packages/babel-parser/test/fixtures/flow/type-annotations/132/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Cannot overwrite reserved type number (1:9)" -} diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/132/output.json b/packages/babel-parser/test/fixtures/flow/type-annotations/132/output.json new file mode 100644 index 000000000000..042dd3afd3b4 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/type-annotations/132/output.json @@ -0,0 +1,119 @@ +{ + "type": "File", + "start": 0, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "errors": [ + "SyntaxError: Unexpected reserved type number (1:9)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "TypeAlias", + "start": 0, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "id": { + "type": "Identifier", + "start": 5, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 8 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "typeParameters": { + "type": "TypeParameterDeclaration", + "start": 8, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "params": [ + { + "type": "TypeParameter", + "start": 9, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "name": "number", + "variance": null + } + ] + }, + "right": { + "type": "StringTypeAnnotation", + "start": 19, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 25 + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/133/options.json b/packages/babel-parser/test/fixtures/flow/type-annotations/133/options.json deleted file mode 100644 index 2c7a5836d8bc..000000000000 --- a/packages/babel-parser/test/fixtures/flow/type-annotations/133/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Cannot overwrite reserved type string (1:11)" -} diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/133/output.json b/packages/babel-parser/test/fixtures/flow/type-annotations/133/output.json new file mode 100644 index 000000000000..08cb55525e09 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/type-annotations/133/output.json @@ -0,0 +1,236 @@ +{ + "type": "File", + "start": 0, + "end": 53, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Unexpected reserved type string (1:11)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 53, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 53, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + }, + "identifierName": "a" + }, + "name": "a" + }, + "generator": false, + "async": false, + "typeParameters": { + "type": "TypeParameterDeclaration", + "start": 10, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "params": [ + { + "type": "TypeParameter", + "start": 11, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "name": "string", + "variance": null + } + ] + }, + "params": [ + { + "type": "Identifier", + "start": 19, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 28 + }, + "identifierName": "x" + }, + "name": "x", + "typeAnnotation": { + "type": "TypeAnnotation", + "start": 20, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "typeAnnotation": { + "type": "StringTypeAnnotation", + "start": 22, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 28 + } + } + } + } + } + ], + "predicate": null, + "returnType": { + "type": "TypeAnnotation", + "start": 29, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "typeAnnotation": { + "type": "StringTypeAnnotation", + "start": 31, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 31 + }, + "end": { + "line": 1, + "column": 37 + } + } + } + }, + "body": { + "type": "BlockStatement", + "start": 38, + "end": 53, + "loc": { + "start": { + "line": 1, + "column": 38 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": [ + { + "type": "ReturnStatement", + "start": 42, + "end": 51, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 11 + } + }, + "argument": { + "type": "Identifier", + "start": 49, + "end": 50, + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 10 + }, + "identifierName": "x" + }, + "name": "x" + } + } + ], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/134/options.json b/packages/babel-parser/test/fixtures/flow/type-annotations/134/options.json deleted file mode 100644 index 396a14ca22d4..000000000000 --- a/packages/babel-parser/test/fixtures/flow/type-annotations/134/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Cannot overwrite reserved type bool (1:13)" -} diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/134/output.json b/packages/babel-parser/test/fixtures/flow/type-annotations/134/output.json new file mode 100644 index 000000000000..c88abb4a585c --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/type-annotations/134/output.json @@ -0,0 +1,86 @@ +{ + "type": "File", + "start": 0, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "errors": [ + "SyntaxError: Cannot overwrite reserved type bool (1:13)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "DeclareTypeAlias", + "start": 0, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "id": { + "type": "Identifier", + "start": 13, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 17 + }, + "identifierName": "bool" + }, + "name": "bool" + }, + "typeParameters": null, + "right": { + "type": "AnyTypeAnnotation", + "start": 20, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 23 + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/137/options.json b/packages/babel-parser/test/fixtures/flow/type-annotations/137/options.json deleted file mode 100644 index 786acad32af0..000000000000 --- a/packages/babel-parser/test/fixtures/flow/type-annotations/137/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Spread operator cannot appear in class or interface definitions (2:1)" -} diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/137/output.json b/packages/babel-parser/test/fixtures/flow/type-annotations/137/output.json new file mode 100644 index 000000000000..2e33b31f6c8f --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/type-annotations/137/output.json @@ -0,0 +1,140 @@ +{ + "type": "File", + "start": 0, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 2 + } + }, + "errors": [ + "SyntaxError: Spread operator cannot appear in class or interface definitions (2:1)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 2 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "InterfaceDeclaration", + "start": 0, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 10, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + }, + "identifierName": "A" + }, + "name": "A" + }, + "typeParameters": null, + "extends": [], + "implements": [], + "mixins": [], + "body": { + "type": "ObjectTypeAnnotation", + "start": 12, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "callProperties": [], + "properties": [ + { + "type": "ObjectTypeSpreadProperty", + "start": 15, + "end": 21, + "loc": { + "start": { + "line": 2, + "column": 1 + }, + "end": { + "line": 2, + "column": 7 + } + }, + "argument": { + "type": "AnyTypeAnnotation", + "start": 18, + "end": 21, + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 7 + } + } + } + } + ], + "indexers": [], + "internalSlots": [], + "exact": false + } + }, + { + "type": "EmptyStatement", + "start": 24, + "end": 25, + "loc": { + "start": { + "line": 3, + "column": 1 + }, + "end": { + "line": 3, + "column": 2 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/139/options.json b/packages/babel-parser/test/fixtures/flow/type-annotations/139/options.json deleted file mode 100644 index 2b0782bcbc3e..000000000000 --- a/packages/babel-parser/test/fixtures/flow/type-annotations/139/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Spread properties cannot have variance (3:1)" -} diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/139/output.json b/packages/babel-parser/test/fixtures/flow/type-annotations/139/output.json new file mode 100644 index 000000000000..6d1756ac6212 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/type-annotations/139/output.json @@ -0,0 +1,190 @@ +{ + "type": "File", + "start": 0, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 2 + } + }, + "errors": [ + "SyntaxError: Spread properties cannot have variance (3:1)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 2 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "A" + }, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 8, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "body": [] + } + }, + { + "type": "TypeAlias", + "start": 11, + "end": 31, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 4, + "column": 2 + } + }, + "id": { + "type": "Identifier", + "start": 16, + "end": 17, + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 6 + }, + "identifierName": "C" + }, + "name": "C" + }, + "typeParameters": null, + "right": { + "type": "ObjectTypeAnnotation", + "start": 20, + "end": 30, + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "callProperties": [], + "properties": [ + { + "type": "ObjectTypeSpreadProperty", + "start": 23, + "end": 28, + "loc": { + "start": { + "line": 3, + "column": 1 + }, + "end": { + "line": 3, + "column": 6 + } + }, + "argument": { + "type": "GenericTypeAnnotation", + "start": 27, + "end": 28, + "loc": { + "start": { + "line": 3, + "column": 5 + }, + "end": { + "line": 3, + "column": 6 + } + }, + "typeParameters": null, + "id": { + "type": "Identifier", + "start": 27, + "end": 28, + "loc": { + "start": { + "line": 3, + "column": 5 + }, + "end": { + "line": 3, + "column": 6 + }, + "identifierName": "A" + }, + "name": "A" + } + } + } + ], + "indexers": [], + "internalSlots": [], + "exact": false, + "inexact": false + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/typeof-reserved-invalid-1/input.js b/packages/babel-parser/test/fixtures/flow/type-annotations/typeof-reserved-invalid-1/input.js new file mode 100644 index 000000000000..57a78fa5a789 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/type-annotations/typeof-reserved-invalid-1/input.js @@ -0,0 +1,2 @@ +// @flow +const x: typeof interface = "hi"; diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/typeof-reserved-invalid-1/options.json b/packages/babel-parser/test/fixtures/flow/type-annotations/typeof-reserved-invalid-1/options.json new file mode 100644 index 000000000000..077518333db1 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/type-annotations/typeof-reserved-invalid-1/options.json @@ -0,0 +1,5 @@ +{ + "sourceType": "module", + "plugins": ["jsx", "flow"], + "throws": "Unexpected token, expected \"{\" (2:26)" +} diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/typeof-reserved-invalid-2/input.js b/packages/babel-parser/test/fixtures/flow/type-annotations/typeof-reserved-invalid-2/input.js new file mode 100644 index 000000000000..292205253049 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/type-annotations/typeof-reserved-invalid-2/input.js @@ -0,0 +1,2 @@ +// @flow +const x: typeof type.interface = "hi"; diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/typeof-reserved-invalid-2/output.json b/packages/babel-parser/test/fixtures/flow/type-annotations/typeof-reserved-invalid-2/output.json new file mode 100644 index 000000000000..58a7471e980c --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/type-annotations/typeof-reserved-invalid-2/output.json @@ -0,0 +1,239 @@ +{ + "type": "File", + "start": 0, + "end": 47, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 38 + } + }, + "errors": [ + "SyntaxError: Unexpected reserved type interface (2:21)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 47, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 38 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 9, + "end": 47, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 38 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 15, + "end": 46, + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 37 + } + }, + "id": { + "type": "Identifier", + "start": 15, + "end": 39, + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 30 + }, + "identifierName": "x" + }, + "name": "x", + "typeAnnotation": { + "type": "TypeAnnotation", + "start": 16, + "end": 39, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 30 + } + }, + "typeAnnotation": { + "type": "TypeofTypeAnnotation", + "start": 18, + "end": 39, + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 30 + } + }, + "argument": { + "type": "GenericTypeAnnotation", + "start": 25, + "end": 39, + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 30 + } + }, + "typeParameters": null, + "id": { + "type": "QualifiedTypeIdentifier", + "start": 25, + "end": 39, + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 30 + } + }, + "qualification": { + "type": "Identifier", + "start": 25, + "end": 29, + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 20 + }, + "identifierName": "type" + }, + "name": "type" + }, + "id": { + "type": "Identifier", + "start": 30, + "end": 39, + "loc": { + "start": { + "line": 2, + "column": 21 + }, + "end": { + "line": 2, + "column": 30 + }, + "identifierName": "interface" + }, + "name": "interface" + } + } + } + } + } + }, + "init": { + "type": "StringLiteral", + "start": 42, + "end": 46, + "loc": { + "start": { + "line": 2, + "column": 33 + }, + "end": { + "line": 2, + "column": 37 + } + }, + "extra": { + "rawValue": "hi", + "raw": "\"hi\"" + }, + "value": "hi" + } + } + ], + "kind": "const", + "leadingComments": [ + { + "type": "CommentLine", + "value": " @flow", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } + } + ] + } + ], + "directives": [] + }, + "comments": [ + { + "type": "CommentLine", + "value": " @flow", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } + } + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/typeof-reserved-invalid-3/input.js b/packages/babel-parser/test/fixtures/flow/type-annotations/typeof-reserved-invalid-3/input.js new file mode 100644 index 000000000000..018cfae79c6b --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/type-annotations/typeof-reserved-invalid-3/input.js @@ -0,0 +1,2 @@ +// @flow +const x: typeof stuff.number = "hi"; diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/typeof-reserved-invalid-3/output.json b/packages/babel-parser/test/fixtures/flow/type-annotations/typeof-reserved-invalid-3/output.json new file mode 100644 index 000000000000..8b8eb4bb5a32 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/type-annotations/typeof-reserved-invalid-3/output.json @@ -0,0 +1,239 @@ +{ + "type": "File", + "start": 0, + "end": 45, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 36 + } + }, + "errors": [ + "SyntaxError: Unexpected reserved type number (2:22)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 45, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 36 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 9, + "end": 45, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 36 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 15, + "end": 44, + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 35 + } + }, + "id": { + "type": "Identifier", + "start": 15, + "end": 37, + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 28 + }, + "identifierName": "x" + }, + "name": "x", + "typeAnnotation": { + "type": "TypeAnnotation", + "start": 16, + "end": 37, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 28 + } + }, + "typeAnnotation": { + "type": "TypeofTypeAnnotation", + "start": 18, + "end": 37, + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 28 + } + }, + "argument": { + "type": "GenericTypeAnnotation", + "start": 25, + "end": 37, + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 28 + } + }, + "typeParameters": null, + "id": { + "type": "QualifiedTypeIdentifier", + "start": 25, + "end": 37, + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 28 + } + }, + "qualification": { + "type": "Identifier", + "start": 25, + "end": 30, + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 21 + }, + "identifierName": "stuff" + }, + "name": "stuff" + }, + "id": { + "type": "Identifier", + "start": 31, + "end": 37, + "loc": { + "start": { + "line": 2, + "column": 22 + }, + "end": { + "line": 2, + "column": 28 + }, + "identifierName": "number" + }, + "name": "number" + } + } + } + } + } + }, + "init": { + "type": "StringLiteral", + "start": 40, + "end": 44, + "loc": { + "start": { + "line": 2, + "column": 31 + }, + "end": { + "line": 2, + "column": 35 + } + }, + "extra": { + "rawValue": "hi", + "raw": "\"hi\"" + }, + "value": "hi" + } + } + ], + "kind": "const", + "leadingComments": [ + { + "type": "CommentLine", + "value": " @flow", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } + } + ] + } + ], + "directives": [] + }, + "comments": [ + { + "type": "CommentLine", + "value": " @flow", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } + } + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/typeof-reserved-invalid-4/input.js b/packages/babel-parser/test/fixtures/flow/type-annotations/typeof-reserved-invalid-4/input.js new file mode 100644 index 000000000000..01212f07ac93 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/type-annotations/typeof-reserved-invalid-4/input.js @@ -0,0 +1,2 @@ +// @flow +const x: typeof static = "hi"; diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/typeof-reserved-invalid-4/output.json b/packages/babel-parser/test/fixtures/flow/type-annotations/typeof-reserved-invalid-4/output.json new file mode 100644 index 000000000000..9236c950f3be --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/type-annotations/typeof-reserved-invalid-4/output.json @@ -0,0 +1,207 @@ +{ + "type": "File", + "start": 0, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 30 + } + }, + "errors": [ + "SyntaxError: Unexpected reserved word 'static' (2:16)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 30 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 9, + "end": 39, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 30 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 15, + "end": 38, + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 29 + } + }, + "id": { + "type": "Identifier", + "start": 15, + "end": 31, + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 22 + }, + "identifierName": "x" + }, + "name": "x", + "typeAnnotation": { + "type": "TypeAnnotation", + "start": 16, + "end": 31, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 22 + } + }, + "typeAnnotation": { + "type": "TypeofTypeAnnotation", + "start": 18, + "end": 31, + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 22 + } + }, + "argument": { + "type": "GenericTypeAnnotation", + "start": 25, + "end": 31, + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 22 + } + }, + "typeParameters": null, + "id": { + "type": "Identifier", + "start": 25, + "end": 31, + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 22 + }, + "identifierName": "static" + }, + "name": "static" + } + } + } + } + }, + "init": { + "type": "StringLiteral", + "start": 34, + "end": 38, + "loc": { + "start": { + "line": 2, + "column": 25 + }, + "end": { + "line": 2, + "column": 29 + } + }, + "extra": { + "rawValue": "hi", + "raw": "\"hi\"" + }, + "value": "hi" + } + } + ], + "kind": "const", + "leadingComments": [ + { + "type": "CommentLine", + "value": " @flow", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } + } + ] + } + ], + "directives": [] + }, + "comments": [ + { + "type": "CommentLine", + "value": " @flow", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } + } + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/typeof-reserved-invalid-5/input.js b/packages/babel-parser/test/fixtures/flow/type-annotations/typeof-reserved-invalid-5/input.js new file mode 100644 index 000000000000..8c14711e1d8e --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/type-annotations/typeof-reserved-invalid-5/input.js @@ -0,0 +1,2 @@ +// @flow +const x: typeof typeof = "hi"; diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/typeof-reserved-invalid-5/options.json b/packages/babel-parser/test/fixtures/flow/type-annotations/typeof-reserved-invalid-5/options.json new file mode 100644 index 000000000000..a06d10b640b8 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/type-annotations/typeof-reserved-invalid-5/options.json @@ -0,0 +1,5 @@ +{ + "sourceType": "module", + "plugins": ["jsx", "flow"], + "throws": "Unexpected token (2:23)" +} diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/typeof-reserved-invalid-6/input.js b/packages/babel-parser/test/fixtures/flow/type-annotations/typeof-reserved-invalid-6/input.js new file mode 100644 index 000000000000..1c47c611a6d7 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/type-annotations/typeof-reserved-invalid-6/input.js @@ -0,0 +1,2 @@ +// @flow +const x: typeof d.i\u{6e}terface = "hi"; diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/typeof-reserved-invalid-6/output.json b/packages/babel-parser/test/fixtures/flow/type-annotations/typeof-reserved-invalid-6/output.json new file mode 100644 index 000000000000..25467cae1b2d --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/type-annotations/typeof-reserved-invalid-6/output.json @@ -0,0 +1,239 @@ +{ + "type": "File", + "start": 0, + "end": 49, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 40 + } + }, + "errors": [ + "SyntaxError: Unexpected reserved type interface (2:18)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 49, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 40 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 9, + "end": 49, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 40 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 15, + "end": 48, + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 39 + } + }, + "id": { + "type": "Identifier", + "start": 15, + "end": 41, + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 32 + }, + "identifierName": "x" + }, + "name": "x", + "typeAnnotation": { + "type": "TypeAnnotation", + "start": 16, + "end": 41, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 32 + } + }, + "typeAnnotation": { + "type": "TypeofTypeAnnotation", + "start": 18, + "end": 41, + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 32 + } + }, + "argument": { + "type": "GenericTypeAnnotation", + "start": 25, + "end": 41, + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 32 + } + }, + "typeParameters": null, + "id": { + "type": "QualifiedTypeIdentifier", + "start": 25, + "end": 41, + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 32 + } + }, + "qualification": { + "type": "Identifier", + "start": 25, + "end": 26, + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 17 + }, + "identifierName": "d" + }, + "name": "d" + }, + "id": { + "type": "Identifier", + "start": 27, + "end": 41, + "loc": { + "start": { + "line": 2, + "column": 18 + }, + "end": { + "line": 2, + "column": 32 + }, + "identifierName": "interface" + }, + "name": "interface" + } + } + } + } + } + }, + "init": { + "type": "StringLiteral", + "start": 44, + "end": 48, + "loc": { + "start": { + "line": 2, + "column": 35 + }, + "end": { + "line": 2, + "column": 39 + } + }, + "extra": { + "rawValue": "hi", + "raw": "\"hi\"" + }, + "value": "hi" + } + } + ], + "kind": "const", + "leadingComments": [ + { + "type": "CommentLine", + "value": " @flow", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } + } + ] + } + ], + "directives": [] + }, + "comments": [ + { + "type": "CommentLine", + "value": " @flow", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } + } + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/typeof-reserved-valid/input.js b/packages/babel-parser/test/fixtures/flow/type-annotations/typeof-reserved-valid/input.js new file mode 100644 index 000000000000..f96ff8f65234 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/type-annotations/typeof-reserved-valid/input.js @@ -0,0 +1,15 @@ +// @flow +const a: typeof default = "hi"; +const b: typeof stuff.default = "hi"; + +const c: typeof any = "hi"; +const d: typeof bool = "hi"; +const e: typeof boolean = "hi"; +const f: typeof empty = "hi"; +const g: typeof false = "hi"; +const h: typeof mixed = "hi"; +const i: typeof null = "hi"; +const j: typeof number = "hi"; +const k: typeof string = "hi"; +const l: typeof true = "hi"; +const m: typeof void = "hi"; diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/typeof-reserved-valid/output.json b/packages/babel-parser/test/fixtures/flow/type-annotations/typeof-reserved-valid/output.json new file mode 100644 index 000000000000..5ef43efe2bd1 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/type-annotations/typeof-reserved-valid/output.json @@ -0,0 +1,1620 @@ +{ + "type": "File", + "start": 0, + "end": 407, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 15, + "column": 28 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 407, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 15, + "column": 28 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 9, + "end": 40, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 31 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 15, + "end": 39, + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 30 + } + }, + "id": { + "type": "Identifier", + "start": 15, + "end": 32, + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 23 + }, + "identifierName": "a" + }, + "name": "a", + "typeAnnotation": { + "type": "TypeAnnotation", + "start": 16, + "end": 32, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 23 + } + }, + "typeAnnotation": { + "type": "TypeofTypeAnnotation", + "start": 18, + "end": 32, + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 23 + } + }, + "argument": { + "type": "Identifier", + "start": 25, + "end": 32, + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 23 + }, + "identifierName": "default" + }, + "name": "default" + } + } + } + }, + "init": { + "type": "StringLiteral", + "start": 35, + "end": 39, + "loc": { + "start": { + "line": 2, + "column": 26 + }, + "end": { + "line": 2, + "column": 30 + } + }, + "extra": { + "rawValue": "hi", + "raw": "\"hi\"" + }, + "value": "hi" + } + } + ], + "kind": "const", + "leadingComments": [ + { + "type": "CommentLine", + "value": " @flow", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } + } + ] + }, + { + "type": "VariableDeclaration", + "start": 41, + "end": 78, + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 37 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 47, + "end": 77, + "loc": { + "start": { + "line": 3, + "column": 6 + }, + "end": { + "line": 3, + "column": 36 + } + }, + "id": { + "type": "Identifier", + "start": 47, + "end": 70, + "loc": { + "start": { + "line": 3, + "column": 6 + }, + "end": { + "line": 3, + "column": 29 + }, + "identifierName": "b" + }, + "name": "b", + "typeAnnotation": { + "type": "TypeAnnotation", + "start": 48, + "end": 70, + "loc": { + "start": { + "line": 3, + "column": 7 + }, + "end": { + "line": 3, + "column": 29 + } + }, + "typeAnnotation": { + "type": "TypeofTypeAnnotation", + "start": 50, + "end": 70, + "loc": { + "start": { + "line": 3, + "column": 9 + }, + "end": { + "line": 3, + "column": 29 + } + }, + "argument": { + "type": "GenericTypeAnnotation", + "start": 57, + "end": 70, + "loc": { + "start": { + "line": 3, + "column": 16 + }, + "end": { + "line": 3, + "column": 29 + } + }, + "typeParameters": null, + "id": { + "type": "QualifiedTypeIdentifier", + "start": 57, + "end": 70, + "loc": { + "start": { + "line": 3, + "column": 16 + }, + "end": { + "line": 3, + "column": 29 + } + }, + "qualification": { + "type": "Identifier", + "start": 57, + "end": 62, + "loc": { + "start": { + "line": 3, + "column": 16 + }, + "end": { + "line": 3, + "column": 21 + }, + "identifierName": "stuff" + }, + "name": "stuff" + }, + "id": { + "type": "Identifier", + "start": 63, + "end": 70, + "loc": { + "start": { + "line": 3, + "column": 22 + }, + "end": { + "line": 3, + "column": 29 + }, + "identifierName": "default" + }, + "name": "default" + } + } + } + } + } + }, + "init": { + "type": "StringLiteral", + "start": 73, + "end": 77, + "loc": { + "start": { + "line": 3, + "column": 32 + }, + "end": { + "line": 3, + "column": 36 + } + }, + "extra": { + "rawValue": "hi", + "raw": "\"hi\"" + }, + "value": "hi" + } + } + ], + "kind": "const" + }, + { + "type": "VariableDeclaration", + "start": 80, + "end": 107, + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 5, + "column": 27 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 86, + "end": 106, + "loc": { + "start": { + "line": 5, + "column": 6 + }, + "end": { + "line": 5, + "column": 26 + } + }, + "id": { + "type": "Identifier", + "start": 86, + "end": 99, + "loc": { + "start": { + "line": 5, + "column": 6 + }, + "end": { + "line": 5, + "column": 19 + }, + "identifierName": "c" + }, + "name": "c", + "typeAnnotation": { + "type": "TypeAnnotation", + "start": 87, + "end": 99, + "loc": { + "start": { + "line": 5, + "column": 7 + }, + "end": { + "line": 5, + "column": 19 + } + }, + "typeAnnotation": { + "type": "TypeofTypeAnnotation", + "start": 89, + "end": 99, + "loc": { + "start": { + "line": 5, + "column": 9 + }, + "end": { + "line": 5, + "column": 19 + } + }, + "argument": { + "type": "AnyTypeAnnotation", + "start": 96, + "end": 99, + "loc": { + "start": { + "line": 5, + "column": 16 + }, + "end": { + "line": 5, + "column": 19 + } + } + } + } + } + }, + "init": { + "type": "StringLiteral", + "start": 102, + "end": 106, + "loc": { + "start": { + "line": 5, + "column": 22 + }, + "end": { + "line": 5, + "column": 26 + } + }, + "extra": { + "rawValue": "hi", + "raw": "\"hi\"" + }, + "value": "hi" + } + } + ], + "kind": "const" + }, + { + "type": "VariableDeclaration", + "start": 108, + "end": 136, + "loc": { + "start": { + "line": 6, + "column": 0 + }, + "end": { + "line": 6, + "column": 28 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 114, + "end": 135, + "loc": { + "start": { + "line": 6, + "column": 6 + }, + "end": { + "line": 6, + "column": 27 + } + }, + "id": { + "type": "Identifier", + "start": 114, + "end": 128, + "loc": { + "start": { + "line": 6, + "column": 6 + }, + "end": { + "line": 6, + "column": 20 + }, + "identifierName": "d" + }, + "name": "d", + "typeAnnotation": { + "type": "TypeAnnotation", + "start": 115, + "end": 128, + "loc": { + "start": { + "line": 6, + "column": 7 + }, + "end": { + "line": 6, + "column": 20 + } + }, + "typeAnnotation": { + "type": "TypeofTypeAnnotation", + "start": 117, + "end": 128, + "loc": { + "start": { + "line": 6, + "column": 9 + }, + "end": { + "line": 6, + "column": 20 + } + }, + "argument": { + "type": "BooleanTypeAnnotation", + "start": 124, + "end": 128, + "loc": { + "start": { + "line": 6, + "column": 16 + }, + "end": { + "line": 6, + "column": 20 + } + } + } + } + } + }, + "init": { + "type": "StringLiteral", + "start": 131, + "end": 135, + "loc": { + "start": { + "line": 6, + "column": 23 + }, + "end": { + "line": 6, + "column": 27 + } + }, + "extra": { + "rawValue": "hi", + "raw": "\"hi\"" + }, + "value": "hi" + } + } + ], + "kind": "const" + }, + { + "type": "VariableDeclaration", + "start": 137, + "end": 168, + "loc": { + "start": { + "line": 7, + "column": 0 + }, + "end": { + "line": 7, + "column": 31 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 143, + "end": 167, + "loc": { + "start": { + "line": 7, + "column": 6 + }, + "end": { + "line": 7, + "column": 30 + } + }, + "id": { + "type": "Identifier", + "start": 143, + "end": 160, + "loc": { + "start": { + "line": 7, + "column": 6 + }, + "end": { + "line": 7, + "column": 23 + }, + "identifierName": "e" + }, + "name": "e", + "typeAnnotation": { + "type": "TypeAnnotation", + "start": 144, + "end": 160, + "loc": { + "start": { + "line": 7, + "column": 7 + }, + "end": { + "line": 7, + "column": 23 + } + }, + "typeAnnotation": { + "type": "TypeofTypeAnnotation", + "start": 146, + "end": 160, + "loc": { + "start": { + "line": 7, + "column": 9 + }, + "end": { + "line": 7, + "column": 23 + } + }, + "argument": { + "type": "BooleanTypeAnnotation", + "start": 153, + "end": 160, + "loc": { + "start": { + "line": 7, + "column": 16 + }, + "end": { + "line": 7, + "column": 23 + } + } + } + } + } + }, + "init": { + "type": "StringLiteral", + "start": 163, + "end": 167, + "loc": { + "start": { + "line": 7, + "column": 26 + }, + "end": { + "line": 7, + "column": 30 + } + }, + "extra": { + "rawValue": "hi", + "raw": "\"hi\"" + }, + "value": "hi" + } + } + ], + "kind": "const" + }, + { + "type": "VariableDeclaration", + "start": 169, + "end": 198, + "loc": { + "start": { + "line": 8, + "column": 0 + }, + "end": { + "line": 8, + "column": 29 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 175, + "end": 197, + "loc": { + "start": { + "line": 8, + "column": 6 + }, + "end": { + "line": 8, + "column": 28 + } + }, + "id": { + "type": "Identifier", + "start": 175, + "end": 190, + "loc": { + "start": { + "line": 8, + "column": 6 + }, + "end": { + "line": 8, + "column": 21 + }, + "identifierName": "f" + }, + "name": "f", + "typeAnnotation": { + "type": "TypeAnnotation", + "start": 176, + "end": 190, + "loc": { + "start": { + "line": 8, + "column": 7 + }, + "end": { + "line": 8, + "column": 21 + } + }, + "typeAnnotation": { + "type": "TypeofTypeAnnotation", + "start": 178, + "end": 190, + "loc": { + "start": { + "line": 8, + "column": 9 + }, + "end": { + "line": 8, + "column": 21 + } + }, + "argument": { + "type": "EmptyTypeAnnotation", + "start": 185, + "end": 190, + "loc": { + "start": { + "line": 8, + "column": 16 + }, + "end": { + "line": 8, + "column": 21 + } + } + } + } + } + }, + "init": { + "type": "StringLiteral", + "start": 193, + "end": 197, + "loc": { + "start": { + "line": 8, + "column": 24 + }, + "end": { + "line": 8, + "column": 28 + } + }, + "extra": { + "rawValue": "hi", + "raw": "\"hi\"" + }, + "value": "hi" + } + } + ], + "kind": "const" + }, + { + "type": "VariableDeclaration", + "start": 199, + "end": 228, + "loc": { + "start": { + "line": 9, + "column": 0 + }, + "end": { + "line": 9, + "column": 29 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 205, + "end": 227, + "loc": { + "start": { + "line": 9, + "column": 6 + }, + "end": { + "line": 9, + "column": 28 + } + }, + "id": { + "type": "Identifier", + "start": 205, + "end": 220, + "loc": { + "start": { + "line": 9, + "column": 6 + }, + "end": { + "line": 9, + "column": 21 + }, + "identifierName": "g" + }, + "name": "g", + "typeAnnotation": { + "type": "TypeAnnotation", + "start": 206, + "end": 220, + "loc": { + "start": { + "line": 9, + "column": 7 + }, + "end": { + "line": 9, + "column": 21 + } + }, + "typeAnnotation": { + "type": "TypeofTypeAnnotation", + "start": 208, + "end": 220, + "loc": { + "start": { + "line": 9, + "column": 9 + }, + "end": { + "line": 9, + "column": 21 + } + }, + "argument": { + "type": "BooleanLiteralTypeAnnotation", + "start": 215, + "end": 220, + "loc": { + "start": { + "line": 9, + "column": 16 + }, + "end": { + "line": 9, + "column": 21 + } + }, + "value": false + } + } + } + }, + "init": { + "type": "StringLiteral", + "start": 223, + "end": 227, + "loc": { + "start": { + "line": 9, + "column": 24 + }, + "end": { + "line": 9, + "column": 28 + } + }, + "extra": { + "rawValue": "hi", + "raw": "\"hi\"" + }, + "value": "hi" + } + } + ], + "kind": "const" + }, + { + "type": "VariableDeclaration", + "start": 229, + "end": 258, + "loc": { + "start": { + "line": 10, + "column": 0 + }, + "end": { + "line": 10, + "column": 29 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 235, + "end": 257, + "loc": { + "start": { + "line": 10, + "column": 6 + }, + "end": { + "line": 10, + "column": 28 + } + }, + "id": { + "type": "Identifier", + "start": 235, + "end": 250, + "loc": { + "start": { + "line": 10, + "column": 6 + }, + "end": { + "line": 10, + "column": 21 + }, + "identifierName": "h" + }, + "name": "h", + "typeAnnotation": { + "type": "TypeAnnotation", + "start": 236, + "end": 250, + "loc": { + "start": { + "line": 10, + "column": 7 + }, + "end": { + "line": 10, + "column": 21 + } + }, + "typeAnnotation": { + "type": "TypeofTypeAnnotation", + "start": 238, + "end": 250, + "loc": { + "start": { + "line": 10, + "column": 9 + }, + "end": { + "line": 10, + "column": 21 + } + }, + "argument": { + "type": "MixedTypeAnnotation", + "start": 245, + "end": 250, + "loc": { + "start": { + "line": 10, + "column": 16 + }, + "end": { + "line": 10, + "column": 21 + } + } + } + } + } + }, + "init": { + "type": "StringLiteral", + "start": 253, + "end": 257, + "loc": { + "start": { + "line": 10, + "column": 24 + }, + "end": { + "line": 10, + "column": 28 + } + }, + "extra": { + "rawValue": "hi", + "raw": "\"hi\"" + }, + "value": "hi" + } + } + ], + "kind": "const" + }, + { + "type": "VariableDeclaration", + "start": 259, + "end": 287, + "loc": { + "start": { + "line": 11, + "column": 0 + }, + "end": { + "line": 11, + "column": 28 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 265, + "end": 286, + "loc": { + "start": { + "line": 11, + "column": 6 + }, + "end": { + "line": 11, + "column": 27 + } + }, + "id": { + "type": "Identifier", + "start": 265, + "end": 279, + "loc": { + "start": { + "line": 11, + "column": 6 + }, + "end": { + "line": 11, + "column": 20 + }, + "identifierName": "i" + }, + "name": "i", + "typeAnnotation": { + "type": "TypeAnnotation", + "start": 266, + "end": 279, + "loc": { + "start": { + "line": 11, + "column": 7 + }, + "end": { + "line": 11, + "column": 20 + } + }, + "typeAnnotation": { + "type": "TypeofTypeAnnotation", + "start": 268, + "end": 279, + "loc": { + "start": { + "line": 11, + "column": 9 + }, + "end": { + "line": 11, + "column": 20 + } + }, + "argument": { + "type": "NullLiteralTypeAnnotation", + "start": 275, + "end": 279, + "loc": { + "start": { + "line": 11, + "column": 16 + }, + "end": { + "line": 11, + "column": 20 + } + } + } + } + } + }, + "init": { + "type": "StringLiteral", + "start": 282, + "end": 286, + "loc": { + "start": { + "line": 11, + "column": 23 + }, + "end": { + "line": 11, + "column": 27 + } + }, + "extra": { + "rawValue": "hi", + "raw": "\"hi\"" + }, + "value": "hi" + } + } + ], + "kind": "const" + }, + { + "type": "VariableDeclaration", + "start": 288, + "end": 318, + "loc": { + "start": { + "line": 12, + "column": 0 + }, + "end": { + "line": 12, + "column": 30 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 294, + "end": 317, + "loc": { + "start": { + "line": 12, + "column": 6 + }, + "end": { + "line": 12, + "column": 29 + } + }, + "id": { + "type": "Identifier", + "start": 294, + "end": 310, + "loc": { + "start": { + "line": 12, + "column": 6 + }, + "end": { + "line": 12, + "column": 22 + }, + "identifierName": "j" + }, + "name": "j", + "typeAnnotation": { + "type": "TypeAnnotation", + "start": 295, + "end": 310, + "loc": { + "start": { + "line": 12, + "column": 7 + }, + "end": { + "line": 12, + "column": 22 + } + }, + "typeAnnotation": { + "type": "TypeofTypeAnnotation", + "start": 297, + "end": 310, + "loc": { + "start": { + "line": 12, + "column": 9 + }, + "end": { + "line": 12, + "column": 22 + } + }, + "argument": { + "type": "NumberTypeAnnotation", + "start": 304, + "end": 310, + "loc": { + "start": { + "line": 12, + "column": 16 + }, + "end": { + "line": 12, + "column": 22 + } + } + } + } + } + }, + "init": { + "type": "StringLiteral", + "start": 313, + "end": 317, + "loc": { + "start": { + "line": 12, + "column": 25 + }, + "end": { + "line": 12, + "column": 29 + } + }, + "extra": { + "rawValue": "hi", + "raw": "\"hi\"" + }, + "value": "hi" + } + } + ], + "kind": "const" + }, + { + "type": "VariableDeclaration", + "start": 319, + "end": 349, + "loc": { + "start": { + "line": 13, + "column": 0 + }, + "end": { + "line": 13, + "column": 30 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 325, + "end": 348, + "loc": { + "start": { + "line": 13, + "column": 6 + }, + "end": { + "line": 13, + "column": 29 + } + }, + "id": { + "type": "Identifier", + "start": 325, + "end": 341, + "loc": { + "start": { + "line": 13, + "column": 6 + }, + "end": { + "line": 13, + "column": 22 + }, + "identifierName": "k" + }, + "name": "k", + "typeAnnotation": { + "type": "TypeAnnotation", + "start": 326, + "end": 341, + "loc": { + "start": { + "line": 13, + "column": 7 + }, + "end": { + "line": 13, + "column": 22 + } + }, + "typeAnnotation": { + "type": "TypeofTypeAnnotation", + "start": 328, + "end": 341, + "loc": { + "start": { + "line": 13, + "column": 9 + }, + "end": { + "line": 13, + "column": 22 + } + }, + "argument": { + "type": "StringTypeAnnotation", + "start": 335, + "end": 341, + "loc": { + "start": { + "line": 13, + "column": 16 + }, + "end": { + "line": 13, + "column": 22 + } + } + } + } + } + }, + "init": { + "type": "StringLiteral", + "start": 344, + "end": 348, + "loc": { + "start": { + "line": 13, + "column": 25 + }, + "end": { + "line": 13, + "column": 29 + } + }, + "extra": { + "rawValue": "hi", + "raw": "\"hi\"" + }, + "value": "hi" + } + } + ], + "kind": "const" + }, + { + "type": "VariableDeclaration", + "start": 350, + "end": 378, + "loc": { + "start": { + "line": 14, + "column": 0 + }, + "end": { + "line": 14, + "column": 28 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 356, + "end": 377, + "loc": { + "start": { + "line": 14, + "column": 6 + }, + "end": { + "line": 14, + "column": 27 + } + }, + "id": { + "type": "Identifier", + "start": 356, + "end": 370, + "loc": { + "start": { + "line": 14, + "column": 6 + }, + "end": { + "line": 14, + "column": 20 + }, + "identifierName": "l" + }, + "name": "l", + "typeAnnotation": { + "type": "TypeAnnotation", + "start": 357, + "end": 370, + "loc": { + "start": { + "line": 14, + "column": 7 + }, + "end": { + "line": 14, + "column": 20 + } + }, + "typeAnnotation": { + "type": "TypeofTypeAnnotation", + "start": 359, + "end": 370, + "loc": { + "start": { + "line": 14, + "column": 9 + }, + "end": { + "line": 14, + "column": 20 + } + }, + "argument": { + "type": "BooleanLiteralTypeAnnotation", + "start": 366, + "end": 370, + "loc": { + "start": { + "line": 14, + "column": 16 + }, + "end": { + "line": 14, + "column": 20 + } + }, + "value": true + } + } + } + }, + "init": { + "type": "StringLiteral", + "start": 373, + "end": 377, + "loc": { + "start": { + "line": 14, + "column": 23 + }, + "end": { + "line": 14, + "column": 27 + } + }, + "extra": { + "rawValue": "hi", + "raw": "\"hi\"" + }, + "value": "hi" + } + } + ], + "kind": "const" + }, + { + "type": "VariableDeclaration", + "start": 379, + "end": 407, + "loc": { + "start": { + "line": 15, + "column": 0 + }, + "end": { + "line": 15, + "column": 28 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 385, + "end": 406, + "loc": { + "start": { + "line": 15, + "column": 6 + }, + "end": { + "line": 15, + "column": 27 + } + }, + "id": { + "type": "Identifier", + "start": 385, + "end": 399, + "loc": { + "start": { + "line": 15, + "column": 6 + }, + "end": { + "line": 15, + "column": 20 + }, + "identifierName": "m" + }, + "name": "m", + "typeAnnotation": { + "type": "TypeAnnotation", + "start": 386, + "end": 399, + "loc": { + "start": { + "line": 15, + "column": 7 + }, + "end": { + "line": 15, + "column": 20 + } + }, + "typeAnnotation": { + "type": "TypeofTypeAnnotation", + "start": 388, + "end": 399, + "loc": { + "start": { + "line": 15, + "column": 9 + }, + "end": { + "line": 15, + "column": 20 + } + }, + "argument": { + "type": "VoidTypeAnnotation", + "start": 395, + "end": 399, + "loc": { + "start": { + "line": 15, + "column": 16 + }, + "end": { + "line": 15, + "column": 20 + } + } + } + } + } + }, + "init": { + "type": "StringLiteral", + "start": 402, + "end": 406, + "loc": { + "start": { + "line": 15, + "column": 23 + }, + "end": { + "line": 15, + "column": 27 + } + }, + "extra": { + "rawValue": "hi", + "raw": "\"hi\"" + }, + "value": "hi" + } + } + ], + "kind": "const" + } + ], + "directives": [] + }, + "comments": [ + { + "type": "CommentLine", + "value": " @flow", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } + } + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/with-default-invalid/options.json b/packages/babel-parser/test/fixtures/flow/type-annotations/with-default-invalid/options.json deleted file mode 100644 index 24792311b3e9..000000000000 --- a/packages/babel-parser/test/fixtures/flow/type-annotations/with-default-invalid/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Type annotations must come before default assignments, e.g. instead of `age = 25: number` use `age: number = 25` (1:20)" -} diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/with-default-invalid/output.json b/packages/babel-parser/test/fixtures/flow/type-annotations/with-default-invalid/output.json new file mode 100644 index 000000000000..a08797bcf335 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/type-annotations/with-default-invalid/output.json @@ -0,0 +1,173 @@ +{ + "type": "File", + "start": 0, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "errors": [ + "SyntaxError: Type annotations must come before default assignments, e.g. instead of `age = 25: number` use `age: number = 25` (1:20)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + }, + "identifierName": "x" + }, + "name": "x" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "AssignmentPattern", + "start": 11, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "left": { + "type": "Identifier", + "start": 11, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "right": { + "type": "StringLiteral", + "start": 17, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "extra": { + "rawValue": "1", + "raw": "\"1\"" + }, + "value": "1" + }, + "typeAnnotation": { + "type": "TypeAnnotation", + "start": 20, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "typeAnnotation": { + "type": "StringTypeAnnotation", + "start": 22, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 28 + } + } + } + } + } + ], + "body": { + "type": "BlockStatement", + "start": 30, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "body": [], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/type-exports/star-as-from/options.json b/packages/babel-parser/test/fixtures/flow/type-exports/star-as-from/options.json index d482b18c6cff..6a0cd1358ef1 100644 --- a/packages/babel-parser/test/fixtures/flow/type-exports/star-as-from/options.json +++ b/packages/babel-parser/test/fixtures/flow/type-exports/star-as-from/options.json @@ -1,5 +1,5 @@ { "sourceType": "module", - "plugins": ["flow", "exportNamespaceFrom"], + "plugins": ["flow"], "throws": "Unexpected token (1:14)" } diff --git a/packages/babel-parser/test/fixtures/flow/type-imports/invalid-import-type-2/options.json b/packages/babel-parser/test/fixtures/flow/type-imports/invalid-import-type-2/options.json deleted file mode 100644 index 7624c4d3b99a..000000000000 --- a/packages/babel-parser/test/fixtures/flow/type-imports/invalid-import-type-2/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Cannot overwrite reserved type string (1:14)" -} diff --git a/packages/babel-parser/test/fixtures/flow/type-imports/invalid-import-type-2/output.json b/packages/babel-parser/test/fixtures/flow/type-imports/invalid-import-type-2/output.json new file mode 100644 index 000000000000..5ac98d7b46b7 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/type-imports/invalid-import-type-2/output.json @@ -0,0 +1,126 @@ +{ + "type": "File", + "start": 0, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "errors": [ + "SyntaxError: Cannot overwrite reserved type string (1:14)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ImportDeclaration", + "start": 0, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "specifiers": [ + { + "type": "ImportSpecifier", + "start": 14, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "imported": { + "type": "Identifier", + "start": 14, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 20 + }, + "identifierName": "string" + }, + "name": "string" + }, + "importKind": null, + "local": { + "type": "Identifier", + "start": 14, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 20 + }, + "identifierName": "string" + }, + "name": "string" + } + } + ], + "importKind": "type", + "source": { + "type": "StringLiteral", + "start": 28, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "extra": { + "rawValue": "foo", + "raw": "\"foo\"" + }, + "value": "foo" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/type-imports/invalid-import-type-3/options.json b/packages/babel-parser/test/fixtures/flow/type-imports/invalid-import-type-3/options.json deleted file mode 100644 index 7624c4d3b99a..000000000000 --- a/packages/babel-parser/test/fixtures/flow/type-imports/invalid-import-type-3/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Cannot overwrite reserved type string (1:14)" -} diff --git a/packages/babel-parser/test/fixtures/flow/type-imports/invalid-import-type-3/output.json b/packages/babel-parser/test/fixtures/flow/type-imports/invalid-import-type-3/output.json new file mode 100644 index 000000000000..3a1010d807fe --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/type-imports/invalid-import-type-3/output.json @@ -0,0 +1,108 @@ +{ + "type": "File", + "start": 0, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "errors": [ + "SyntaxError: Cannot overwrite reserved type string (1:14)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ImportDeclaration", + "start": 0, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "specifiers": [ + { + "type": "ImportDefaultSpecifier", + "start": 14, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "local": { + "type": "Identifier", + "start": 14, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 20 + }, + "identifierName": "string" + }, + "name": "string" + } + } + ], + "importKind": "typeof", + "source": { + "type": "StringLiteral", + "start": 26, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "extra": { + "rawValue": "foo", + "raw": "\"foo\"" + }, + "value": "foo" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/type-imports/invalid-import-type-4/options.json b/packages/babel-parser/test/fixtures/flow/type-imports/invalid-import-type-4/options.json deleted file mode 100644 index d64a5d353bf8..000000000000 --- a/packages/babel-parser/test/fixtures/flow/type-imports/invalid-import-type-4/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Cannot overwrite reserved type string (1:19)" -} diff --git a/packages/babel-parser/test/fixtures/flow/type-imports/invalid-import-type-4/output.json b/packages/babel-parser/test/fixtures/flow/type-imports/invalid-import-type-4/output.json new file mode 100644 index 000000000000..dcbca6978a12 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/type-imports/invalid-import-type-4/output.json @@ -0,0 +1,108 @@ +{ + "type": "File", + "start": 0, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "errors": [ + "SyntaxError: Cannot overwrite reserved type string (1:19)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ImportDeclaration", + "start": 0, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "specifiers": [ + { + "type": "ImportNamespaceSpecifier", + "start": 14, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "local": { + "type": "Identifier", + "start": 19, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 25 + }, + "identifierName": "string" + }, + "name": "string" + } + } + ], + "importKind": "typeof", + "source": { + "type": "StringLiteral", + "start": 31, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 31 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "extra": { + "rawValue": "foo", + "raw": "\"foo\"" + }, + "value": "foo" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/type-imports/invalid-import-type-as/options.json b/packages/babel-parser/test/fixtures/flow/type-imports/invalid-import-type-as/options.json index 5133797973d2..d822c40fbba2 100644 --- a/packages/babel-parser/test/fixtures/flow/type-imports/invalid-import-type-as/options.json +++ b/packages/babel-parser/test/fixtures/flow/type-imports/invalid-import-type-as/options.json @@ -1,3 +1,4 @@ { - "throws": "Unexpected keyword 'debugger' (1:17)" + "sourceType": "module", + "plugins": ["jsx", "flow"] } diff --git a/packages/babel-parser/test/fixtures/flow/type-imports/invalid-import-type-as/output.json b/packages/babel-parser/test/fixtures/flow/type-imports/invalid-import-type-as/output.json new file mode 100644 index 000000000000..05cc09533a23 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/type-imports/invalid-import-type-as/output.json @@ -0,0 +1,126 @@ +{ + "type": "File", + "start": 0, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "errors": [ + "SyntaxError: Unexpected keyword 'debugger' (1:17)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ImportDeclaration", + "start": 0, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "specifiers": [ + { + "type": "ImportSpecifier", + "start": 9, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "imported": { + "type": "Identifier", + "start": 9, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 13 + }, + "identifierName": "type" + }, + "name": "type" + }, + "importKind": null, + "local": { + "type": "Identifier", + "start": 17, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 25 + }, + "identifierName": "debugger" + }, + "name": "debugger" + } + } + ], + "importKind": "value", + "source": { + "type": "StringLiteral", + "start": 33, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 38 + } + }, + "extra": { + "rawValue": "foo", + "raw": "\"foo\"" + }, + "value": "foo" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/type-imports/invalid-import-type-shorthand-2/options.json b/packages/babel-parser/test/fixtures/flow/type-imports/invalid-import-type-shorthand-2/options.json deleted file mode 100644 index 036229c5b95a..000000000000 --- a/packages/babel-parser/test/fixtures/flow/type-imports/invalid-import-type-shorthand-2/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "The `type` and `typeof` keywords on named imports can only be used on regular `import` statements. It cannot be used with `import type` or `import typeof` statements (1:13)" -} diff --git a/packages/babel-parser/test/fixtures/flow/type-imports/invalid-import-type-shorthand-2/output.json b/packages/babel-parser/test/fixtures/flow/type-imports/invalid-import-type-shorthand-2/output.json new file mode 100644 index 000000000000..90585f1b4f80 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/type-imports/invalid-import-type-shorthand-2/output.json @@ -0,0 +1,126 @@ +{ + "type": "File", + "start": 0, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "errors": [ + "SyntaxError: The `type` and `typeof` keywords on named imports can only be used on regular `import` statements. It cannot be used with `import type` or `import typeof` statements (1:13)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ImportDeclaration", + "start": 0, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "specifiers": [ + { + "type": "ImportSpecifier", + "start": 13, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "imported": { + "type": "Identifier", + "start": 18, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + }, + "identifierName": "t" + }, + "name": "t" + }, + "importKind": "type", + "local": { + "type": "Identifier", + "start": 18, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + }, + "identifierName": "t" + }, + "name": "t" + } + } + ], + "importKind": "type", + "source": { + "type": "StringLiteral", + "start": 26, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "extra": { + "rawValue": "foo", + "raw": "\"foo\"" + }, + "value": "foo" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/type-imports/invalid-import-type-shorthand-3/options.json b/packages/babel-parser/test/fixtures/flow/type-imports/invalid-import-type-shorthand-3/options.json deleted file mode 100644 index e425b795f180..000000000000 --- a/packages/babel-parser/test/fixtures/flow/type-imports/invalid-import-type-shorthand-3/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Cannot overwrite reserved type string (1:16)" -} diff --git a/packages/babel-parser/test/fixtures/flow/type-imports/invalid-import-type-shorthand-3/output.json b/packages/babel-parser/test/fixtures/flow/type-imports/invalid-import-type-shorthand-3/output.json new file mode 100644 index 000000000000..4969f577a320 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/type-imports/invalid-import-type-shorthand-3/output.json @@ -0,0 +1,126 @@ +{ + "type": "File", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "errors": [ + "SyntaxError: Cannot overwrite reserved type string (1:16)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ImportDeclaration", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "specifiers": [ + { + "type": "ImportSpecifier", + "start": 9, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "imported": { + "type": "Identifier", + "start": 16, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 22 + }, + "identifierName": "string" + }, + "name": "string" + }, + "importKind": "typeof", + "local": { + "type": "Identifier", + "start": 16, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 22 + }, + "identifierName": "string" + }, + "name": "string" + } + } + ], + "importKind": "value", + "source": { + "type": "StringLiteral", + "start": 30, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "extra": { + "rawValue": "foo", + "raw": "\"foo\"" + }, + "value": "foo" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/type-imports/invalid-import-type-shorthand-4/options.json b/packages/babel-parser/test/fixtures/flow/type-imports/invalid-import-type-shorthand-4/options.json deleted file mode 100644 index 7624c4d3b99a..000000000000 --- a/packages/babel-parser/test/fixtures/flow/type-imports/invalid-import-type-shorthand-4/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Cannot overwrite reserved type string (1:14)" -} diff --git a/packages/babel-parser/test/fixtures/flow/type-imports/invalid-import-type-shorthand-4/output.json b/packages/babel-parser/test/fixtures/flow/type-imports/invalid-import-type-shorthand-4/output.json new file mode 100644 index 000000000000..2b57e99a30e7 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/type-imports/invalid-import-type-shorthand-4/output.json @@ -0,0 +1,126 @@ +{ + "type": "File", + "start": 0, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "errors": [ + "SyntaxError: Cannot overwrite reserved type string (1:14)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ImportDeclaration", + "start": 0, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "specifiers": [ + { + "type": "ImportSpecifier", + "start": 9, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "imported": { + "type": "Identifier", + "start": 14, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 20 + }, + "identifierName": "string" + }, + "name": "string" + }, + "importKind": "type", + "local": { + "type": "Identifier", + "start": 14, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 20 + }, + "identifierName": "string" + }, + "name": "string" + } + } + ], + "importKind": "value", + "source": { + "type": "StringLiteral", + "start": 28, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "extra": { + "rawValue": "foo", + "raw": "\"foo\"" + }, + "value": "foo" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/type-imports/invalid-import-type-shorthand/options.json b/packages/babel-parser/test/fixtures/flow/type-imports/invalid-import-type-shorthand/options.json deleted file mode 100644 index 7aa4274c7160..000000000000 --- a/packages/babel-parser/test/fixtures/flow/type-imports/invalid-import-type-shorthand/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "The `type` and `typeof` keywords on named imports can only be used on regular `import` statements. It cannot be used with `import type` or `import typeof` statements (1:15)" -} diff --git a/packages/babel-parser/test/fixtures/flow/type-imports/invalid-import-type-shorthand/output.json b/packages/babel-parser/test/fixtures/flow/type-imports/invalid-import-type-shorthand/output.json new file mode 100644 index 000000000000..174e856304f7 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/type-imports/invalid-import-type-shorthand/output.json @@ -0,0 +1,126 @@ +{ + "type": "File", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "errors": [ + "SyntaxError: The `type` and `typeof` keywords on named imports can only be used on regular `import` statements. It cannot be used with `import type` or `import typeof` statements (1:15)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ImportDeclaration", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "specifiers": [ + { + "type": "ImportSpecifier", + "start": 15, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "imported": { + "type": "Identifier", + "start": 22, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + }, + "identifierName": "t" + }, + "name": "t" + }, + "importKind": "typeof", + "local": { + "type": "Identifier", + "start": 22, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + }, + "identifierName": "t" + }, + "name": "t" + } + } + ], + "importKind": "typeof", + "source": { + "type": "StringLiteral", + "start": 30, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "extra": { + "rawValue": "foo", + "raw": "\"foo\"" + }, + "value": "foo" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/type-imports/invalid-import-type/options.json b/packages/babel-parser/test/fixtures/flow/type-imports/invalid-import-type/options.json deleted file mode 100644 index 0c2cdd4d777c..000000000000 --- a/packages/babel-parser/test/fixtures/flow/type-imports/invalid-import-type/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Cannot overwrite reserved type string (1:12)" -} diff --git a/packages/babel-parser/test/fixtures/flow/type-imports/invalid-import-type/output.json b/packages/babel-parser/test/fixtures/flow/type-imports/invalid-import-type/output.json new file mode 100644 index 000000000000..95872d960a5c --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/type-imports/invalid-import-type/output.json @@ -0,0 +1,108 @@ +{ + "type": "File", + "start": 0, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "errors": [ + "SyntaxError: Cannot overwrite reserved type string (1:12)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ImportDeclaration", + "start": 0, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "specifiers": [ + { + "type": "ImportDefaultSpecifier", + "start": 12, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "local": { + "type": "Identifier", + "start": 12, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 18 + }, + "identifierName": "string" + }, + "name": "string" + } + } + ], + "importKind": "type", + "source": { + "type": "StringLiteral", + "start": 24, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "extra": { + "rawValue": "foo", + "raw": "\"foo\"" + }, + "value": "foo" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/type-parameter-declaration/default-invalid-class-extends/options.json b/packages/babel-parser/test/fixtures/flow/type-parameter-declaration/default-invalid-class-extends/options.json index 6f017e5a5919..81e7a97e3f7e 100644 --- a/packages/babel-parser/test/fixtures/flow/type-parameter-declaration/default-invalid-class-extends/options.json +++ b/packages/babel-parser/test/fixtures/flow/type-parameter-declaration/default-invalid-class-extends/options.json @@ -1,3 +1,3 @@ { "throws": "Unexpected token, expected \",\" (1:20)" -} \ No newline at end of file +} diff --git a/packages/babel-parser/test/fixtures/flow/type-parameter-declaration/default-invalid-declare-func/options.json b/packages/babel-parser/test/fixtures/flow/type-parameter-declaration/default-invalid-declare-func/options.json index 161afd296dc4..4d9531c1b174 100644 --- a/packages/babel-parser/test/fixtures/flow/type-parameter-declaration/default-invalid-declare-func/options.json +++ b/packages/babel-parser/test/fixtures/flow/type-parameter-declaration/default-invalid-declare-func/options.json @@ -1,3 +1,3 @@ { "throws": "Unexpected token, expected \":\" (1:35)" -} \ No newline at end of file +} diff --git a/packages/babel-parser/test/fixtures/flow/type-parameter-declaration/default-invalid-var-type/options.json b/packages/babel-parser/test/fixtures/flow/type-parameter-declaration/default-invalid-var-type/options.json index fbfad415eebf..e3427614a192 100644 --- a/packages/babel-parser/test/fixtures/flow/type-parameter-declaration/default-invalid-var-type/options.json +++ b/packages/babel-parser/test/fixtures/flow/type-parameter-declaration/default-invalid-var-type/options.json @@ -1,3 +1,3 @@ { "throws": "Unexpected token, expected \",\" (1:15)" -} \ No newline at end of file +} diff --git a/packages/babel-parser/test/fixtures/flow/type-parameter-declaration/default-missing/options.json b/packages/babel-parser/test/fixtures/flow/type-parameter-declaration/default-missing/options.json deleted file mode 100644 index 022607b81797..000000000000 --- a/packages/babel-parser/test/fixtures/flow/type-parameter-declaration/default-missing/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Type parameter declaration needs a default, since a preceding type parameter declaration has a default. (1:28)" -} diff --git a/packages/babel-parser/test/fixtures/flow/type-parameter-declaration/default-missing/output.json b/packages/babel-parser/test/fixtures/flow/type-parameter-declaration/default-missing/output.json new file mode 100644 index 000000000000..b902d88e157e --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/type-parameter-declaration/default-missing/output.json @@ -0,0 +1,169 @@ +{ + "type": "File", + "start": 0, + "end": 43, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 43 + } + }, + "errors": [ + "SyntaxError: Type parameter declaration needs a default, since a preceding type parameter declaration has a default. (1:28)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 43, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 43 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "TypeAlias", + "start": 0, + "end": 43, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 43 + } + }, + "id": { + "type": "Identifier", + "start": 5, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + }, + "identifierName": "A" + }, + "name": "A" + }, + "typeParameters": { + "type": "TypeParameterDeclaration", + "start": 6, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 38 + } + }, + "params": [ + { + "type": "TypeParameter", + "start": 7, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "name": "HasDefault", + "variance": null, + "default": { + "type": "StringTypeAnnotation", + "start": 20, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 26 + } + } + } + }, + { + "type": "TypeParameter", + "start": 28, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "name": "NoDefault", + "variance": null + } + ] + }, + "right": { + "type": "GenericTypeAnnotation", + "start": 41, + "end": 42, + "loc": { + "start": { + "line": 1, + "column": 41 + }, + "end": { + "line": 1, + "column": 42 + } + }, + "typeParameters": null, + "id": { + "type": "Identifier", + "start": 41, + "end": 42, + "loc": { + "start": { + "line": 1, + "column": 41 + }, + "end": { + "line": 1, + "column": 42 + }, + "identifierName": "T" + }, + "name": "T" + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/type-parameter-declaration/object-method-type-param-jsx/output.json b/packages/babel-parser/test/fixtures/flow/type-parameter-declaration/object-method-type-param-jsx/output.json index 9cbc275b184b..5e5de02ff3c2 100644 --- a/packages/babel-parser/test/fixtures/flow/type-parameter-declaration/object-method-type-param-jsx/output.json +++ b/packages/babel-parser/test/fixtures/flow/type-parameter-declaration/object-method-type-param-jsx/output.json @@ -187,7 +187,6 @@ "column": 23 } }, - "attributes": [], "name": { "type": "JSXIdentifier", "start": 29, @@ -204,6 +203,7 @@ }, "name": "Foo" }, + "attributes": [], "selfClosing": true }, "closingElement": null, @@ -263,7 +263,10 @@ ] } } - ] + ], + "extra": { + "trailingComma": 39 + } } } ], diff --git a/packages/babel-parser/test/fixtures/flow/type-parameter-declaration/object-reserved-word/output.json b/packages/babel-parser/test/fixtures/flow/type-parameter-declaration/object-reserved-word/output.json index 5a8cfcc689b0..bd86fd173803 100644 --- a/packages/babel-parser/test/fixtures/flow/type-parameter-declaration/object-reserved-word/output.json +++ b/packages/babel-parser/test/fixtures/flow/type-parameter-declaration/object-reserved-word/output.json @@ -450,7 +450,10 @@ ] } } - ] + ], + "extra": { + "trailingComma": 77 + } } } ], diff --git a/packages/babel-parser/test/fixtures/flow/type-parameter-declaration/reserved-word-class-name-failure/options.json b/packages/babel-parser/test/fixtures/flow/type-parameter-declaration/reserved-word-class-name-failure/options.json index f45196d78df9..24ca50ff8791 100644 --- a/packages/babel-parser/test/fixtures/flow/type-parameter-declaration/reserved-word-class-name-failure/options.json +++ b/packages/babel-parser/test/fixtures/flow/type-parameter-declaration/reserved-word-class-name-failure/options.json @@ -1,4 +1,4 @@ { - "throws": "Unexpected keyword 'delete' (1:14)", + "sourceType": "module", "plugins": ["flow", "jsx"] } diff --git a/packages/babel-parser/test/fixtures/flow/type-parameter-declaration/reserved-word-class-name-failure/output.json b/packages/babel-parser/test/fixtures/flow/type-parameter-declaration/reserved-word-class-name-failure/output.json new file mode 100644 index 000000000000..a86c5b5aebde --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/type-parameter-declaration/reserved-word-class-name-failure/output.json @@ -0,0 +1,94 @@ +{ + "type": "File", + "start": 0, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "errors": [ + "SyntaxError: Unexpected keyword 'delete' (1:14)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "DeclareClass", + "start": 0, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "id": { + "type": "Identifier", + "start": 14, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 20 + }, + "identifierName": "delete" + }, + "name": "delete" + }, + "typeParameters": null, + "extends": [], + "implements": [], + "mixins": [], + "body": { + "type": "ObjectTypeAnnotation", + "start": 21, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "callProperties": [], + "properties": [], + "indexers": [], + "internalSlots": [], + "exact": false + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/typeapp-call/function-call-optional/options.json b/packages/babel-parser/test/fixtures/flow/typeapp-call/function-call-optional/options.json index 05e42d81055f..698e7668500f 100644 --- a/packages/babel-parser/test/fixtures/flow/typeapp-call/function-call-optional/options.json +++ b/packages/babel-parser/test/fixtures/flow/typeapp-call/function-call-optional/options.json @@ -1,3 +1,3 @@ { - "plugins": ["jsx", "flow", "optionalChaining"] + "plugins": ["jsx", "flow"] } diff --git a/packages/babel-parser/test/fixtures/flow/typeapp-call/method-call-optional/options.json b/packages/babel-parser/test/fixtures/flow/typeapp-call/method-call-optional/options.json index 05e42d81055f..698e7668500f 100644 --- a/packages/babel-parser/test/fixtures/flow/typeapp-call/method-call-optional/options.json +++ b/packages/babel-parser/test/fixtures/flow/typeapp-call/method-call-optional/options.json @@ -1,3 +1,3 @@ { - "plugins": ["jsx", "flow", "optionalChaining"] + "plugins": ["jsx", "flow"] } diff --git a/packages/babel-parser/test/fixtures/flow/typeapp-call/method-call-optional2/options.json b/packages/babel-parser/test/fixtures/flow/typeapp-call/method-call-optional2/options.json index 05e42d81055f..698e7668500f 100644 --- a/packages/babel-parser/test/fixtures/flow/typeapp-call/method-call-optional2/options.json +++ b/packages/babel-parser/test/fixtures/flow/typeapp-call/method-call-optional2/options.json @@ -1,3 +1,3 @@ { - "plugins": ["jsx", "flow", "optionalChaining"] + "plugins": ["jsx", "flow"] } diff --git a/packages/babel-parser/test/fixtures/flow/typeapp-call/underscore_is_illegal_param_instantiation_otherwise/options.json b/packages/babel-parser/test/fixtures/flow/typeapp-call/underscore_is_illegal_param_instantiation_otherwise/options.json deleted file mode 100644 index 101e77f3861c..000000000000 --- a/packages/babel-parser/test/fixtures/flow/typeapp-call/underscore_is_illegal_param_instantiation_otherwise/options.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "sourceType": "module", - "plugins": ["jsx", "flow"], - "throws": "`_` is only allowed as a type argument to call or new (2:16)" -} diff --git a/packages/babel-parser/test/fixtures/flow/typeapp-call/underscore_is_illegal_param_instantiation_otherwise/output.json b/packages/babel-parser/test/fixtures/flow/typeapp-call/underscore_is_illegal_param_instantiation_otherwise/output.json new file mode 100644 index 000000000000..297c8d177689 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/typeapp-call/underscore_is_illegal_param_instantiation_otherwise/output.json @@ -0,0 +1,241 @@ +{ + "type": "File", + "start": 0, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 22 + } + }, + "errors": [ + "SyntaxError: `_` is only allowed as a type argument to call or new (2:16)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 22 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 8, + "end": 30, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 22 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 12, + "end": 29, + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 21 + } + }, + "id": { + "type": "Identifier", + "start": 12, + "end": 25, + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 17 + }, + "identifierName": "x" + }, + "name": "x", + "typeAnnotation": { + "type": "TypeAnnotation", + "start": 13, + "end": 25, + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 17 + } + }, + "typeAnnotation": { + "type": "GenericTypeAnnotation", + "start": 15, + "end": 25, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 17 + } + }, + "typeParameters": { + "type": "TypeParameterInstantiation", + "start": 22, + "end": 25, + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 17 + } + }, + "params": [ + { + "type": "GenericTypeAnnotation", + "start": 23, + "end": 24, + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 16 + } + }, + "typeParameters": null, + "id": { + "type": "Identifier", + "start": 23, + "end": 24, + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 16 + }, + "identifierName": "_" + }, + "name": "_" + } + } + ] + }, + "id": { + "type": "Identifier", + "start": 15, + "end": 22, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 14 + }, + "identifierName": "Generic" + }, + "name": "Generic" + } + } + } + }, + "init": { + "type": "NumericLiteral", + "start": 28, + "end": 29, + "loc": { + "start": { + "line": 2, + "column": 20 + }, + "end": { + "line": 2, + "column": 21 + } + }, + "extra": { + "rawValue": 3, + "raw": "3" + }, + "value": 3 + } + } + ], + "kind": "var", + "leadingComments": [ + { + "type": "CommentLine", + "value": "@flow", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } + } + ] + } + ], + "directives": [] + }, + "comments": [ + { + "type": "CommentLine", + "value": "@flow", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } + } + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/typeapp-call/underscore_is_illegal_type_name/options.json b/packages/babel-parser/test/fixtures/flow/typeapp-call/underscore_is_illegal_type_name/options.json deleted file mode 100644 index 85a0456eceff..000000000000 --- a/packages/babel-parser/test/fixtures/flow/typeapp-call/underscore_is_illegal_type_name/options.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "sourceType": "module", - "plugins": ["jsx", "flow"], - "throws": "Cannot overwrite reserved type _ (2:5)" -} diff --git a/packages/babel-parser/test/fixtures/flow/typeapp-call/underscore_is_illegal_type_name/output.json b/packages/babel-parser/test/fixtures/flow/typeapp-call/underscore_is_illegal_type_name/output.json new file mode 100644 index 000000000000..53ac01f6fe9a --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/typeapp-call/underscore_is_illegal_type_name/output.json @@ -0,0 +1,122 @@ +{ + "type": "File", + "start": 0, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 16 + } + }, + "errors": [ + "SyntaxError: Cannot overwrite reserved type _ (2:5)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 16 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "TypeAlias", + "start": 8, + "end": 24, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 16 + } + }, + "id": { + "type": "Identifier", + "start": 13, + "end": 14, + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 6 + }, + "identifierName": "_" + }, + "name": "_" + }, + "typeParameters": null, + "right": { + "type": "NumberTypeAnnotation", + "start": 17, + "end": 23, + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 15 + } + } + }, + "leadingComments": [ + { + "type": "CommentLine", + "value": "@flow", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } + } + ] + } + ], + "directives": [] + }, + "comments": [ + { + "type": "CommentLine", + "value": "@flow", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } + } + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/typeapp-call/underscore_is_illegal_type_param_name/options.json b/packages/babel-parser/test/fixtures/flow/typeapp-call/underscore_is_illegal_type_param_name/options.json deleted file mode 100644 index 872ad2f73408..000000000000 --- a/packages/babel-parser/test/fixtures/flow/typeapp-call/underscore_is_illegal_type_param_name/options.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "sourceType": "module", - "plugins": ["jsx", "flow"], - "throws": "Cannot overwrite reserved type _ (2:13)" -} diff --git a/packages/babel-parser/test/fixtures/flow/typeapp-call/underscore_is_illegal_type_param_name/output.json b/packages/babel-parser/test/fixtures/flow/typeapp-call/underscore_is_illegal_type_param_name/output.json new file mode 100644 index 000000000000..e087eecbd2bb --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/typeapp-call/underscore_is_illegal_type_param_name/output.json @@ -0,0 +1,174 @@ +{ + "type": "File", + "start": 0, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 20 + } + }, + "errors": [ + "SyntaxError: Unexpected reserved type _ (2:13)", + "SyntaxError: `_` is only allowed as a type argument to call or new (2:19)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 20 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "TypeAlias", + "start": 8, + "end": 28, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 20 + } + }, + "id": { + "type": "Identifier", + "start": 13, + "end": 20, + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 12 + }, + "identifierName": "Generic" + }, + "name": "Generic" + }, + "typeParameters": { + "type": "TypeParameterDeclaration", + "start": 20, + "end": 23, + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 15 + } + }, + "params": [ + { + "type": "TypeParameter", + "start": 21, + "end": 22, + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "name": "_", + "variance": null + } + ] + }, + "right": { + "type": "GenericTypeAnnotation", + "start": 26, + "end": 27, + "loc": { + "start": { + "line": 2, + "column": 18 + }, + "end": { + "line": 2, + "column": 19 + } + }, + "typeParameters": null, + "id": { + "type": "Identifier", + "start": 26, + "end": 27, + "loc": { + "start": { + "line": 2, + "column": 18 + }, + "end": { + "line": 2, + "column": 19 + }, + "identifierName": "_" + }, + "name": "_" + } + }, + "leadingComments": [ + { + "type": "CommentLine", + "value": "@flow", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } + } + ] + } + ], + "directives": [] + }, + "comments": [ + { + "type": "CommentLine", + "value": "@flow", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } + } + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/typecasts/fail-in-async-optional-calls/input.js b/packages/babel-parser/test/fixtures/flow/typecasts/fail-in-async-optional-calls/input.js new file mode 100644 index 000000000000..961846976c7a --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/typecasts/fail-in-async-optional-calls/input.js @@ -0,0 +1 @@ +async?.(bar: string) => {} diff --git a/packages/babel-parser/test/fixtures/flow/typecasts/fail-in-async-optional-calls/options.json b/packages/babel-parser/test/fixtures/flow/typecasts/fail-in-async-optional-calls/options.json new file mode 100644 index 000000000000..3c7c9c589b44 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/typecasts/fail-in-async-optional-calls/options.json @@ -0,0 +1,8 @@ +{ + "sourceType": "module", + "plugins": [ + "flow", + "optionalChaining" + ], + "throws": "Unexpected token, expected \";\" (1:21)" +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/typecasts/fail-in-calls-with-one-arg/options.json b/packages/babel-parser/test/fixtures/flow/typecasts/fail-in-calls-with-one-arg/options.json deleted file mode 100644 index e4012a53ad5d..000000000000 --- a/packages/babel-parser/test/fixtures/flow/typecasts/fail-in-calls-with-one-arg/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "The type cast expression is expected to be wrapped with parenthesis (1:10)" -} diff --git a/packages/babel-parser/test/fixtures/flow/typecasts/fail-in-calls-with-one-arg/output.json b/packages/babel-parser/test/fixtures/flow/typecasts/fail-in-calls-with-one-arg/output.json new file mode 100644 index 000000000000..098b44cec651 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/typecasts/fail-in-calls-with-one-arg/output.json @@ -0,0 +1,149 @@ +{ + "type": "File", + "start": 0, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "errors": [ + "SyntaxError: The type cast expression is expected to be wrapped with parenthesis (1:10)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "expression": { + "type": "CallExpression", + "start": 0, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "callee": { + "type": "Identifier", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + }, + "identifierName": "funccall" + }, + "name": "funccall" + }, + "arguments": [ + { + "type": "TypeCastExpression", + "start": 9, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "expression": { + "type": "Identifier", + "start": 9, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + }, + "identifierName": "b" + }, + "name": "b" + }, + "typeAnnotation": { + "type": "TypeAnnotation", + "start": 10, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "typeAnnotation": { + "type": "StringTypeAnnotation", + "start": 12, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 18 + } + } + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/typecasts/fail-in-calls/options.json b/packages/babel-parser/test/fixtures/flow/typecasts/fail-in-calls/options.json deleted file mode 100644 index 3f861de320eb..000000000000 --- a/packages/babel-parser/test/fixtures/flow/typecasts/fail-in-calls/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "The type cast expression is expected to be wrapped with parenthesis (1:13)" -} diff --git a/packages/babel-parser/test/fixtures/flow/typecasts/fail-in-calls/output.json b/packages/babel-parser/test/fixtures/flow/typecasts/fail-in-calls/output.json new file mode 100644 index 000000000000..6b5b957074e0 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/typecasts/fail-in-calls/output.json @@ -0,0 +1,166 @@ +{ + "type": "File", + "start": 0, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "errors": [ + "SyntaxError: The type cast expression is expected to be wrapped with parenthesis (1:13)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "expression": { + "type": "CallExpression", + "start": 0, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "callee": { + "type": "Identifier", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + }, + "identifierName": "funccall" + }, + "name": "funccall" + }, + "arguments": [ + { + "type": "Identifier", + "start": 9, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + }, + "identifierName": "a" + }, + "name": "a" + }, + { + "type": "TypeCastExpression", + "start": 12, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "expression": { + "type": "Identifier", + "start": 12, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + }, + "identifierName": "b" + }, + "name": "b" + }, + "typeAnnotation": { + "type": "TypeAnnotation", + "start": 13, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "typeAnnotation": { + "type": "StringTypeAnnotation", + "start": 15, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 21 + } + } + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/typecasts/fail-in-optional-calls/input.js b/packages/babel-parser/test/fixtures/flow/typecasts/fail-in-optional-calls/input.js new file mode 100644 index 000000000000..14df4e2b16c7 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/typecasts/fail-in-optional-calls/input.js @@ -0,0 +1 @@ +funccall?.(a, b: string); diff --git a/packages/babel-parser/test/fixtures/flow/typecasts/fail-in-optional-calls/options.json b/packages/babel-parser/test/fixtures/flow/typecasts/fail-in-optional-calls/options.json new file mode 100644 index 000000000000..0e7765c73ae7 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/typecasts/fail-in-optional-calls/options.json @@ -0,0 +1,7 @@ +{ + "sourceType": "module", + "plugins": [ + "flow", + "optionalChaining" + ] +} diff --git a/packages/babel-parser/test/fixtures/flow/typecasts/fail-in-optional-calls/output.json b/packages/babel-parser/test/fixtures/flow/typecasts/fail-in-optional-calls/output.json new file mode 100644 index 000000000000..84fcef591c74 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/typecasts/fail-in-optional-calls/output.json @@ -0,0 +1,167 @@ +{ + "type": "File", + "start": 0, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "errors": [ + "SyntaxError: The type cast expression is expected to be wrapped with parenthesis (1:15)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "expression": { + "type": "OptionalCallExpression", + "start": 0, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "callee": { + "type": "Identifier", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + }, + "identifierName": "funccall" + }, + "name": "funccall" + }, + "optional": true, + "arguments": [ + { + "type": "Identifier", + "start": 11, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + }, + "identifierName": "a" + }, + "name": "a" + }, + { + "type": "TypeCastExpression", + "start": 14, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "expression": { + "type": "Identifier", + "start": 14, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + }, + "identifierName": "b" + }, + "name": "b" + }, + "typeAnnotation": { + "type": "TypeAnnotation", + "start": 15, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "typeAnnotation": { + "type": "StringTypeAnnotation", + "start": 17, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 23 + } + } + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/typecasts/fail-without-parens/options.json b/packages/babel-parser/test/fixtures/flow/typecasts/fail-without-parens/options.json deleted file mode 100644 index 847e987ef0af..000000000000 --- a/packages/babel-parser/test/fixtures/flow/typecasts/fail-without-parens/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "The type cast expression is expected to be wrapped with parenthesis (1:5)" -} diff --git a/packages/babel-parser/test/fixtures/flow/typecasts/fail-without-parens/output.json b/packages/babel-parser/test/fixtures/flow/typecasts/fail-without-parens/output.json new file mode 100644 index 000000000000..0e18e29a41ea --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/typecasts/fail-without-parens/output.json @@ -0,0 +1,171 @@ +{ + "type": "File", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "errors": [ + "SyntaxError: The type cast expression is expected to be wrapped with parenthesis (1:5)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "expression": { + "type": "SequenceExpression", + "start": 1, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "expressions": [ + { + "type": "Identifier", + "start": 1, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + }, + "identifierName": "A" + }, + "name": "A" + }, + { + "type": "TypeCastExpression", + "start": 4, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "expression": { + "type": "Identifier", + "start": 4, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + }, + "identifierName": "B" + }, + "name": "B" + }, + "typeAnnotation": { + "type": "TypeAnnotation", + "start": 5, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "typeAnnotation": { + "type": "GenericTypeAnnotation", + "start": 7, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "typeParameters": null, + "id": { + "type": "Identifier", + "start": 7, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + }, + "identifierName": "T" + }, + "name": "T" + } + } + } + } + ], + "extra": { + "parenthesized": true, + "parenStart": 0 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/typecasts/fails-in-array-expression-1/options.json b/packages/babel-parser/test/fixtures/flow/typecasts/fails-in-array-expression-1/options.json deleted file mode 100644 index 18cdf0d35e40..000000000000 --- a/packages/babel-parser/test/fixtures/flow/typecasts/fails-in-array-expression-1/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "The type cast expression is expected to be wrapped with parenthesis (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/flow/typecasts/fails-in-array-expression-1/output.json b/packages/babel-parser/test/fixtures/flow/typecasts/fails-in-array-expression-1/output.json new file mode 100644 index 000000000000..8170ccf4c8d9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/typecasts/fails-in-array-expression-1/output.json @@ -0,0 +1,132 @@ +{ + "type": "File", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "errors": [ + "SyntaxError: The type cast expression is expected to be wrapped with parenthesis (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "expression": { + "type": "ArrayExpression", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "elements": [ + { + "type": "TypeCastExpression", + "start": 1, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "expression": { + "type": "Identifier", + "start": 1, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + }, + "identifierName": "a" + }, + "name": "a" + }, + "typeAnnotation": { + "type": "TypeAnnotation", + "start": 2, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "typeAnnotation": { + "type": "StringTypeAnnotation", + "start": 4, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 10 + } + } + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/typecasts/fails-in-array-expression-2/options.json b/packages/babel-parser/test/fixtures/flow/typecasts/fails-in-array-expression-2/options.json deleted file mode 100644 index 624681c0d415..000000000000 --- a/packages/babel-parser/test/fixtures/flow/typecasts/fails-in-array-expression-2/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "The type cast expression is expected to be wrapped with parenthesis (1:3)" -} diff --git a/packages/babel-parser/test/fixtures/flow/typecasts/fails-in-array-expression-2/output.json b/packages/babel-parser/test/fixtures/flow/typecasts/fails-in-array-expression-2/output.json new file mode 100644 index 000000000000..c5ba396b8101 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/typecasts/fails-in-array-expression-2/output.json @@ -0,0 +1,136 @@ +{ + "type": "File", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "errors": [ + "SyntaxError: The type cast expression is expected to be wrapped with parenthesis (1:3)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "expression": { + "type": "ArrayExpression", + "start": 1, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "elements": [ + { + "type": "TypeCastExpression", + "start": 2, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "expression": { + "type": "Identifier", + "start": 2, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + }, + "identifierName": "a" + }, + "name": "a" + }, + "typeAnnotation": { + "type": "TypeAnnotation", + "start": 3, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "typeAnnotation": { + "type": "StringTypeAnnotation", + "start": 5, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 11 + } + } + } + } + } + ], + "extra": { + "parenthesized": true, + "parenStart": 0 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/typecasts/fails-in-array-expression-3/options.json b/packages/babel-parser/test/fixtures/flow/typecasts/fails-in-array-expression-3/options.json deleted file mode 100644 index 7f8da08031af..000000000000 --- a/packages/babel-parser/test/fixtures/flow/typecasts/fails-in-array-expression-3/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "The type cast expression is expected to be wrapped with parenthesis (1:7)" -} diff --git a/packages/babel-parser/test/fixtures/flow/typecasts/fails-in-array-expression-3/output.json b/packages/babel-parser/test/fixtures/flow/typecasts/fails-in-array-expression-3/output.json new file mode 100644 index 000000000000..d8bfbe9b1216 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/typecasts/fails-in-array-expression-3/output.json @@ -0,0 +1,170 @@ +{ + "type": "File", + "start": 0, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "errors": [ + "SyntaxError: The type cast expression is expected to be wrapped with parenthesis (1:7)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "expression": { + "type": "ArrayExpression", + "start": 1, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "elements": [ + { + "type": "Identifier", + "start": 2, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + }, + "identifierName": "a" + }, + "name": "a" + }, + { + "type": "ArrayExpression", + "start": 5, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "elements": [ + { + "type": "TypeCastExpression", + "start": 6, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "expression": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "b" + }, + "name": "b" + }, + "typeAnnotation": { + "type": "TypeAnnotation", + "start": 7, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "typeAnnotation": { + "type": "StringTypeAnnotation", + "start": 9, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 15 + } + } + } + } + } + ] + } + ], + "extra": { + "parenthesized": true, + "parenStart": 0 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/typecasts/fails-in-array-expression-4/options.json b/packages/babel-parser/test/fixtures/flow/typecasts/fails-in-array-expression-4/options.json deleted file mode 100644 index 23c75013dad4..000000000000 --- a/packages/babel-parser/test/fixtures/flow/typecasts/fails-in-array-expression-4/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "The type cast expression is expected to be wrapped with parenthesis (1:9)" -} diff --git a/packages/babel-parser/test/fixtures/flow/typecasts/fails-in-array-expression-4/output.json b/packages/babel-parser/test/fixtures/flow/typecasts/fails-in-array-expression-4/output.json new file mode 100644 index 000000000000..517f9d043755 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/typecasts/fails-in-array-expression-4/output.json @@ -0,0 +1,166 @@ +{ + "type": "File", + "start": 0, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "errors": [ + "SyntaxError: The type cast expression is expected to be wrapped with parenthesis (1:9)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "expression": { + "type": "CallExpression", + "start": 0, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "callee": { + "type": "Identifier", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + }, + "identifierName": "async" + }, + "name": "async" + }, + "arguments": [ + { + "type": "ArrayExpression", + "start": 7, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "elements": [ + { + "type": "TypeCastExpression", + "start": 8, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "expression": { + "type": "Identifier", + "start": 8, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + }, + "identifierName": "a" + }, + "name": "a" + }, + "typeAnnotation": { + "type": "TypeAnnotation", + "start": 9, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "typeAnnotation": { + "type": "StringTypeAnnotation", + "start": 11, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 17 + } + } + } + } + } + ] + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/typecasts/fails-in-array-expression-5/options.json b/packages/babel-parser/test/fixtures/flow/typecasts/fails-in-array-expression-5/options.json deleted file mode 100644 index 3f861de320eb..000000000000 --- a/packages/babel-parser/test/fixtures/flow/typecasts/fails-in-array-expression-5/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "The type cast expression is expected to be wrapped with parenthesis (1:13)" -} diff --git a/packages/babel-parser/test/fixtures/flow/typecasts/fails-in-array-expression-5/output.json b/packages/babel-parser/test/fixtures/flow/typecasts/fails-in-array-expression-5/output.json new file mode 100644 index 000000000000..5ae330ce23f7 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/typecasts/fails-in-array-expression-5/output.json @@ -0,0 +1,200 @@ +{ + "type": "File", + "start": 0, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "errors": [ + "SyntaxError: The type cast expression is expected to be wrapped with parenthesis (1:13)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "expression": { + "type": "CallExpression", + "start": 0, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "callee": { + "type": "Identifier", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + }, + "identifierName": "async" + }, + "name": "async" + }, + "arguments": [ + { + "type": "ArrayExpression", + "start": 7, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "elements": [ + { + "type": "Identifier", + "start": 8, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + }, + "identifierName": "a" + }, + "name": "a" + }, + { + "type": "ArrayExpression", + "start": 11, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "elements": [ + { + "type": "TypeCastExpression", + "start": 12, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "expression": { + "type": "Identifier", + "start": 12, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + }, + "identifierName": "b" + }, + "name": "b" + }, + "typeAnnotation": { + "type": "TypeAnnotation", + "start": 13, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "typeAnnotation": { + "type": "StringTypeAnnotation", + "start": 15, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 21 + } + } + } + } + } + ] + } + ] + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/jsx/errors/attribute-empty-expression/options.json b/packages/babel-parser/test/fixtures/jsx/errors/attribute-empty-expression/options.json deleted file mode 100644 index d5960e11a308..000000000000 --- a/packages/babel-parser/test/fixtures/jsx/errors/attribute-empty-expression/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "JSX attributes must only be assigned a non-empty expression (1:9)" -} diff --git a/packages/babel-parser/test/fixtures/jsx/errors/attribute-empty-expression/output.json b/packages/babel-parser/test/fixtures/jsx/errors/attribute-empty-expression/output.json new file mode 100644 index 000000000000..a58504569cb5 --- /dev/null +++ b/packages/babel-parser/test/fixtures/jsx/errors/attribute-empty-expression/output.json @@ -0,0 +1,165 @@ +{ + "type": "File", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "errors": [ + "SyntaxError: JSX attributes must only be assigned a non-empty expression (1:9)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "expression": { + "type": "JSXElement", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "openingElement": { + "type": "JSXOpeningElement", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "name": { + "type": "JSXIdentifier", + "start": 1, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "name": "foo" + }, + "attributes": [ + { + "type": "JSXAttribute", + "start": 5, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "name": { + "type": "JSXIdentifier", + "start": 5, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "name": "bar" + }, + "value": { + "type": "JSXExpressionContainer", + "start": 9, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "expression": { + "type": "JSXEmptyExpression", + "start": 10, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 10 + } + } + } + } + } + ], + "selfClosing": true + }, + "closingElement": null, + "children": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/jsx/errors/member-in-namespace-1/input.js b/packages/babel-parser/test/fixtures/jsx/errors/member-in-namespace-1/input.js new file mode 100644 index 000000000000..abb989b65a36 --- /dev/null +++ b/packages/babel-parser/test/fixtures/jsx/errors/member-in-namespace-1/input.js @@ -0,0 +1 @@ + diff --git a/packages/babel-parser/test/fixtures/jsx/errors/member-in-namespace-1/options.json b/packages/babel-parser/test/fixtures/jsx/errors/member-in-namespace-1/options.json new file mode 100644 index 000000000000..27a7b64d71d4 --- /dev/null +++ b/packages/babel-parser/test/fixtures/jsx/errors/member-in-namespace-1/options.json @@ -0,0 +1,3 @@ +{ + "throws": "Unexpected token (1:4)" +} diff --git a/packages/babel-parser/test/fixtures/jsx/errors/member-in-namespace-2/input.js b/packages/babel-parser/test/fixtures/jsx/errors/member-in-namespace-2/input.js new file mode 100644 index 000000000000..fc13a07cc754 --- /dev/null +++ b/packages/babel-parser/test/fixtures/jsx/errors/member-in-namespace-2/input.js @@ -0,0 +1 @@ + diff --git a/packages/babel-parser/test/fixtures/jsx/errors/member-in-namespace-2/options.json b/packages/babel-parser/test/fixtures/jsx/errors/member-in-namespace-2/options.json new file mode 100644 index 000000000000..27a7b64d71d4 --- /dev/null +++ b/packages/babel-parser/test/fixtures/jsx/errors/member-in-namespace-2/options.json @@ -0,0 +1,3 @@ +{ + "throws": "Unexpected token (1:4)" +} diff --git a/packages/babel-parser/test/fixtures/jsx/errors/wrong-closing-tag-fragment/options.json b/packages/babel-parser/test/fixtures/jsx/errors/wrong-closing-tag-fragment/options.json deleted file mode 100644 index 4ca478c5b41f..000000000000 --- a/packages/babel-parser/test/fixtures/jsx/errors/wrong-closing-tag-fragment/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Expected corresponding JSX closing tag for <> (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/jsx/errors/wrong-closing-tag-fragment/output.json b/packages/babel-parser/test/fixtures/jsx/errors/wrong-closing-tag-fragment/output.json new file mode 100644 index 000000000000..8a88583570c3 --- /dev/null +++ b/packages/babel-parser/test/fixtures/jsx/errors/wrong-closing-tag-fragment/output.json @@ -0,0 +1,115 @@ +{ + "type": "File", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "errors": [ + "SyntaxError: Expected corresponding JSX closing tag for <> (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "expression": { + "type": "JSXFragment", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "openingFragment": { + "type": "JSXOpeningFragment", + "start": 0, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + "closingFragment": { + "type": "JSXClosingElement", + "start": 2, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "name": { + "type": "JSXIdentifier", + "start": 4, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "name": "something" + } + }, + "children": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/jsx/errors/wrong-closing-tag/options.json b/packages/babel-parser/test/fixtures/jsx/errors/wrong-closing-tag/options.json deleted file mode 100644 index f3afda9ee91d..000000000000 --- a/packages/babel-parser/test/fixtures/jsx/errors/wrong-closing-tag/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Expected corresponding JSX closing tag for (1:5)" -} diff --git a/packages/babel-parser/test/fixtures/jsx/errors/wrong-closing-tag/output.json b/packages/babel-parser/test/fixtures/jsx/errors/wrong-closing-tag/output.json new file mode 100644 index 000000000000..29ab5696546f --- /dev/null +++ b/packages/babel-parser/test/fixtures/jsx/errors/wrong-closing-tag/output.json @@ -0,0 +1,133 @@ +{ + "type": "File", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "errors": [ + "SyntaxError: Expected corresponding JSX closing tag for (1:5)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "expression": { + "type": "JSXElement", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "openingElement": { + "type": "JSXOpeningElement", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "name": { + "type": "JSXIdentifier", + "start": 1, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "name": "Foo" + }, + "attributes": [], + "selfClosing": false + }, + "closingElement": { + "type": "JSXClosingElement", + "start": 5, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "name": { + "type": "JSXIdentifier", + "start": 7, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "name": "Bar" + } + }, + "children": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/jsx/errors/wrong-opening-tag-fragment/options.json b/packages/babel-parser/test/fixtures/jsx/errors/wrong-opening-tag-fragment/options.json deleted file mode 100644 index 25d9465b06be..000000000000 --- a/packages/babel-parser/test/fixtures/jsx/errors/wrong-opening-tag-fragment/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Expected corresponding JSX closing tag for (1:11)" -} diff --git a/packages/babel-parser/test/fixtures/jsx/errors/wrong-opening-tag-fragment/output.json b/packages/babel-parser/test/fixtures/jsx/errors/wrong-opening-tag-fragment/output.json new file mode 100644 index 000000000000..63350c9eb5d8 --- /dev/null +++ b/packages/babel-parser/test/fixtures/jsx/errors/wrong-opening-tag-fragment/output.json @@ -0,0 +1,117 @@ +{ + "type": "File", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "errors": [ + "SyntaxError: Expected corresponding JSX closing tag for (1:11)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "expression": { + "type": "JSXElement", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "openingElement": { + "type": "JSXOpeningElement", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "name": { + "type": "JSXIdentifier", + "start": 1, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "name": "something" + }, + "attributes": [], + "selfClosing": false + }, + "closingElement": { + "type": "JSXClosingFragment", + "start": 11, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + "children": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/placeholders/_errors/space-after/options.json b/packages/babel-parser/test/fixtures/placeholders/_errors/space-after/options.json index a307a35df63e..92404e501295 100644 --- a/packages/babel-parser/test/fixtures/placeholders/_errors/space-after/options.json +++ b/packages/babel-parser/test/fixtures/placeholders/_errors/space-after/options.json @@ -1,4 +1,3 @@ { - "plugins": ["placeholders"], - "throws": "Unexpected space in placeholder. (1:5)" + "plugins": ["placeholders"] } diff --git a/packages/babel-parser/test/fixtures/placeholders/_errors/space-after/output.json b/packages/babel-parser/test/fixtures/placeholders/_errors/space-after/output.json new file mode 100644 index 000000000000..4d13018c3020 --- /dev/null +++ b/packages/babel-parser/test/fixtures/placeholders/_errors/space-after/output.json @@ -0,0 +1,71 @@ +{ + "type": "File", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "errors": [ + "SyntaxError: Unexpected space in placeholder. (1:5)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "Placeholder", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "name": { + "type": "Identifier", + "start": 2, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 5 + }, + "identifierName": "FOO" + }, + "name": "FOO" + }, + "expectedNode": "Statement" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/placeholders/_errors/space-before/options.json b/packages/babel-parser/test/fixtures/placeholders/_errors/space-before/options.json index 2d76cfab7e2f..92404e501295 100644 --- a/packages/babel-parser/test/fixtures/placeholders/_errors/space-before/options.json +++ b/packages/babel-parser/test/fixtures/placeholders/_errors/space-before/options.json @@ -1,4 +1,3 @@ { - "plugins": ["placeholders"], - "throws": "Unexpected space in placeholder. (1:2)" + "plugins": ["placeholders"] } diff --git a/packages/babel-parser/test/fixtures/placeholders/_errors/space-before/output.json b/packages/babel-parser/test/fixtures/placeholders/_errors/space-before/output.json new file mode 100644 index 000000000000..0bd5ffb6bd40 --- /dev/null +++ b/packages/babel-parser/test/fixtures/placeholders/_errors/space-before/output.json @@ -0,0 +1,71 @@ +{ + "type": "File", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "errors": [ + "SyntaxError: Unexpected space in placeholder. (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "Placeholder", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "name": { + "type": "Identifier", + "start": 3, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 6 + }, + "identifierName": "FOO" + }, + "name": "FOO" + }, + "expectedNode": "Statement" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/placeholders/export/default-default-from/options.json b/packages/babel-parser/test/fixtures/placeholders/export/default-default-from/options.json index b3f883263b7b..c2396306e4fa 100644 --- a/packages/babel-parser/test/fixtures/placeholders/export/default-default-from/options.json +++ b/packages/babel-parser/test/fixtures/placeholders/export/default-default-from/options.json @@ -1,7 +1,5 @@ { - "plugins": [ - "placeholders" - ], + "plugins": ["placeholders"], "sourceType": "module", "throws": "This experimental syntax requires enabling the parser plugin: 'exportDefaultFrom' (1:7)" -} \ No newline at end of file +} diff --git a/packages/babel-parser/test/fixtures/placeholders/export/default-named-from-2/options.json b/packages/babel-parser/test/fixtures/placeholders/export/default-named-from-2/options.json index 404b94bc6cbe..9bc164c502b0 100644 --- a/packages/babel-parser/test/fixtures/placeholders/export/default-named-from-2/options.json +++ b/packages/babel-parser/test/fixtures/placeholders/export/default-named-from-2/options.json @@ -1,7 +1,5 @@ { - "plugins": [ - "placeholders" - ], + "plugins": ["placeholders"], "sourceType": "module", "throws": "This experimental syntax requires enabling the parser plugin: 'exportDefaultFrom' (1:16)" -} \ No newline at end of file +} diff --git a/packages/babel-parser/test/fixtures/placeholders/export/default-named-from-3/options.json b/packages/babel-parser/test/fixtures/placeholders/export/default-named-from-3/options.json index 404b94bc6cbe..9bc164c502b0 100644 --- a/packages/babel-parser/test/fixtures/placeholders/export/default-named-from-3/options.json +++ b/packages/babel-parser/test/fixtures/placeholders/export/default-named-from-3/options.json @@ -1,7 +1,5 @@ { - "plugins": [ - "placeholders" - ], + "plugins": ["placeholders"], "sourceType": "module", "throws": "This experimental syntax requires enabling the parser plugin: 'exportDefaultFrom' (1:16)" -} \ No newline at end of file +} diff --git a/packages/babel-parser/test/fixtures/placeholders/export/default-named-from/options.json b/packages/babel-parser/test/fixtures/placeholders/export/default-named-from/options.json index b3f883263b7b..c2396306e4fa 100644 --- a/packages/babel-parser/test/fixtures/placeholders/export/default-named-from/options.json +++ b/packages/babel-parser/test/fixtures/placeholders/export/default-named-from/options.json @@ -1,7 +1,5 @@ { - "plugins": [ - "placeholders" - ], + "plugins": ["placeholders"], "sourceType": "module", "throws": "This experimental syntax requires enabling the parser plugin: 'exportDefaultFrom' (1:7)" -} \ No newline at end of file +} diff --git a/packages/babel-parser/test/fixtures/placeholders/export/options.json b/packages/babel-parser/test/fixtures/placeholders/export/options.json index e7ff26ae7014..14a812b67661 100644 --- a/packages/babel-parser/test/fixtures/placeholders/export/options.json +++ b/packages/babel-parser/test/fixtures/placeholders/export/options.json @@ -1,4 +1,4 @@ { - "plugins": ["placeholders", "exportDefaultFrom", "exportNamespaceFrom"], + "plugins": ["placeholders", "exportDefaultFrom"], "sourceType": "module" } diff --git a/packages/babel-parser/test/fixtures/placeholders/export/star-from-2/options.json b/packages/babel-parser/test/fixtures/placeholders/export/star-from-2/options.json index 8c48e4fc0f20..986e9cefa93e 100644 --- a/packages/babel-parser/test/fixtures/placeholders/export/star-from-2/options.json +++ b/packages/babel-parser/test/fixtures/placeholders/export/star-from-2/options.json @@ -1,7 +1,4 @@ { - "plugins": [ - "placeholders" - ], - "sourceType": "module", - "throws": "This experimental syntax requires enabling the parser plugin: 'exportNamespaceFrom' (1:9)" -} \ No newline at end of file + "plugins": ["placeholders"], + "sourceType": "module" +} diff --git a/packages/babel-parser/test/fixtures/placeholders/export/star-from-2/output.json b/packages/babel-parser/test/fixtures/placeholders/export/star-from-2/output.json new file mode 100644 index 000000000000..b89f3e8dec86 --- /dev/null +++ b/packages/babel-parser/test/fixtures/placeholders/export/star-from-2/output.json @@ -0,0 +1,120 @@ +{ + "type": "File", + "start": 0, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExportNamedDeclaration", + "start": 0, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "specifiers": [ + { + "type": "ExportNamespaceSpecifier", + "start": 7, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "exported": { + "type": "Placeholder", + "start": 12, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "name": { + "type": "Identifier", + "start": 14, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 18 + }, + "identifierName": "STAR" + }, + "name": "STAR" + }, + "expectedNode": "Identifier" + } + } + ], + "source": { + "type": "StringLiteral", + "start": 26, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "extra": { + "rawValue": "file", + "raw": "\"file\"" + }, + "value": "file" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/placeholders/export/star-from-3/options.json b/packages/babel-parser/test/fixtures/placeholders/export/star-from-3/options.json index 8c48e4fc0f20..986e9cefa93e 100644 --- a/packages/babel-parser/test/fixtures/placeholders/export/star-from-3/options.json +++ b/packages/babel-parser/test/fixtures/placeholders/export/star-from-3/options.json @@ -1,7 +1,4 @@ { - "plugins": [ - "placeholders" - ], - "sourceType": "module", - "throws": "This experimental syntax requires enabling the parser plugin: 'exportNamespaceFrom' (1:9)" -} \ No newline at end of file + "plugins": ["placeholders"], + "sourceType": "module" +} diff --git a/packages/babel-parser/test/fixtures/placeholders/export/star-from-3/output.json b/packages/babel-parser/test/fixtures/placeholders/export/star-from-3/output.json new file mode 100644 index 000000000000..2391c0c770d0 --- /dev/null +++ b/packages/babel-parser/test/fixtures/placeholders/export/star-from-3/output.json @@ -0,0 +1,133 @@ +{ + "type": "File", + "start": 0, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExportNamedDeclaration", + "start": 0, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "specifiers": [ + { + "type": "ExportNamespaceSpecifier", + "start": 7, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "exported": { + "type": "Placeholder", + "start": 12, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "name": { + "type": "Identifier", + "start": 14, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 18 + }, + "identifierName": "STAR" + }, + "name": "STAR" + }, + "expectedNode": "Identifier" + } + } + ], + "source": { + "type": "Placeholder", + "start": 26, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "name": { + "type": "Identifier", + "start": 28, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 32 + }, + "identifierName": "FILE" + }, + "name": "FILE" + }, + "expectedNode": "StringLiteral" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/arrow-function/predicate-types/output.json b/packages/babel-parser/test/fixtures/typescript/arrow-function/predicate-types/output.json index e1f9142855b1..45239b7a0c11 100644 --- a/packages/babel-parser/test/fixtures/typescript/arrow-function/predicate-types/output.json +++ b/packages/babel-parser/test/fixtures/typescript/arrow-function/predicate-types/output.json @@ -73,12 +73,12 @@ }, "typeAnnotation": { "type": "TSTypePredicate", - "start": 10, + "start": 8, "end": 21, "loc": { "start": { "line": 1, - "column": 10 + "column": 8 }, "end": { "line": 1, diff --git a/packages/babel-parser/test/fixtures/typescript/assert-predicate/arrow-function/input.ts b/packages/babel-parser/test/fixtures/typescript/assert-predicate/arrow-function/input.ts new file mode 100644 index 000000000000..5989d8d4f2b4 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/assert-predicate/arrow-function/input.ts @@ -0,0 +1,3 @@ +const assert1 = (value: unknown): asserts value is string => {} +const assert2 = (value: unknown): asserts value => {} +const assert3 = (value: unknown): asserts => {} diff --git a/packages/babel-parser/test/fixtures/typescript/assert-predicate/arrow-function/output.json b/packages/babel-parser/test/fixtures/typescript/assert-predicate/arrow-function/output.json new file mode 100644 index 000000000000..f06258409292 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/assert-predicate/arrow-function/output.json @@ -0,0 +1,610 @@ +{ + "type": "File", + "start": 0, + "end": 165, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 47 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 165, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 47 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 0, + "end": 63, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 63 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 6, + "end": 63, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 63 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 13 + }, + "identifierName": "assert1" + }, + "name": "assert1" + }, + "init": { + "type": "ArrowFunctionExpression", + "start": 16, + "end": 63, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 63 + } + }, + "returnType": { + "type": "TSTypeAnnotation", + "start": 32, + "end": 57, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 57 + } + }, + "typeAnnotation": { + "type": "TSTypePredicate", + "start": 32, + "end": 57, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 57 + } + }, + "parameterName": { + "type": "Identifier", + "start": 42, + "end": 47, + "loc": { + "start": { + "line": 1, + "column": 42 + }, + "end": { + "line": 1, + "column": 47 + }, + "identifierName": "value" + }, + "name": "value" + }, + "typeAnnotation": { + "type": "TSTypeAnnotation", + "start": 51, + "end": 57, + "loc": { + "start": { + "line": 1, + "column": 51 + }, + "end": { + "line": 1, + "column": 57 + } + }, + "typeAnnotation": { + "type": "TSStringKeyword", + "start": 51, + "end": 57, + "loc": { + "start": { + "line": 1, + "column": 51 + }, + "end": { + "line": 1, + "column": 57 + } + } + } + }, + "asserts": true + } + }, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 17, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 31 + }, + "identifierName": "value" + }, + "name": "value", + "typeAnnotation": { + "type": "TSTypeAnnotation", + "start": 22, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "typeAnnotation": { + "type": "TSUnknownKeyword", + "start": 24, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 31 + } + } + } + } + } + ], + "body": { + "type": "BlockStatement", + "start": 61, + "end": 63, + "loc": { + "start": { + "line": 1, + "column": 61 + }, + "end": { + "line": 1, + "column": 63 + } + }, + "body": [], + "directives": [] + } + } + } + ], + "kind": "const" + }, + { + "type": "VariableDeclaration", + "start": 64, + "end": 117, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 53 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 70, + "end": 117, + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 53 + } + }, + "id": { + "type": "Identifier", + "start": 70, + "end": 77, + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 13 + }, + "identifierName": "assert2" + }, + "name": "assert2" + }, + "init": { + "type": "ArrowFunctionExpression", + "start": 80, + "end": 117, + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 53 + } + }, + "returnType": { + "type": "TSTypeAnnotation", + "start": 96, + "end": 111, + "loc": { + "start": { + "line": 2, + "column": 32 + }, + "end": { + "line": 2, + "column": 47 + } + }, + "typeAnnotation": { + "type": "TSTypePredicate", + "start": 96, + "end": 111, + "loc": { + "start": { + "line": 2, + "column": 32 + }, + "end": { + "line": 2, + "column": 47 + } + }, + "parameterName": { + "type": "Identifier", + "start": 106, + "end": 111, + "loc": { + "start": { + "line": 2, + "column": 42 + }, + "end": { + "line": 2, + "column": 47 + }, + "identifierName": "value" + }, + "name": "value" + }, + "asserts": true + } + }, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 81, + "end": 95, + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 31 + }, + "identifierName": "value" + }, + "name": "value", + "typeAnnotation": { + "type": "TSTypeAnnotation", + "start": 86, + "end": 95, + "loc": { + "start": { + "line": 2, + "column": 22 + }, + "end": { + "line": 2, + "column": 31 + } + }, + "typeAnnotation": { + "type": "TSUnknownKeyword", + "start": 88, + "end": 95, + "loc": { + "start": { + "line": 2, + "column": 24 + }, + "end": { + "line": 2, + "column": 31 + } + } + } + } + } + ], + "body": { + "type": "BlockStatement", + "start": 115, + "end": 117, + "loc": { + "start": { + "line": 2, + "column": 51 + }, + "end": { + "line": 2, + "column": 53 + } + }, + "body": [], + "directives": [] + } + } + } + ], + "kind": "const" + }, + { + "type": "VariableDeclaration", + "start": 118, + "end": 165, + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 47 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 124, + "end": 165, + "loc": { + "start": { + "line": 3, + "column": 6 + }, + "end": { + "line": 3, + "column": 47 + } + }, + "id": { + "type": "Identifier", + "start": 124, + "end": 131, + "loc": { + "start": { + "line": 3, + "column": 6 + }, + "end": { + "line": 3, + "column": 13 + }, + "identifierName": "assert3" + }, + "name": "assert3" + }, + "init": { + "type": "ArrowFunctionExpression", + "start": 134, + "end": 165, + "loc": { + "start": { + "line": 3, + "column": 16 + }, + "end": { + "line": 3, + "column": 47 + } + }, + "returnType": { + "type": "TSTypeAnnotation", + "start": 150, + "end": 159, + "loc": { + "start": { + "line": 3, + "column": 32 + }, + "end": { + "line": 3, + "column": 41 + } + }, + "typeAnnotation": { + "type": "TSTypeReference", + "start": 152, + "end": 159, + "loc": { + "start": { + "line": 3, + "column": 34 + }, + "end": { + "line": 3, + "column": 41 + } + }, + "typeName": { + "type": "Identifier", + "start": 152, + "end": 159, + "loc": { + "start": { + "line": 3, + "column": 34 + }, + "end": { + "line": 3, + "column": 41 + }, + "identifierName": "asserts" + }, + "name": "asserts" + } + } + }, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 135, + "end": 149, + "loc": { + "start": { + "line": 3, + "column": 17 + }, + "end": { + "line": 3, + "column": 31 + }, + "identifierName": "value" + }, + "name": "value", + "typeAnnotation": { + "type": "TSTypeAnnotation", + "start": 140, + "end": 149, + "loc": { + "start": { + "line": 3, + "column": 22 + }, + "end": { + "line": 3, + "column": 31 + } + }, + "typeAnnotation": { + "type": "TSUnknownKeyword", + "start": 142, + "end": 149, + "loc": { + "start": { + "line": 3, + "column": 24 + }, + "end": { + "line": 3, + "column": 31 + } + } + } + } + } + ], + "body": { + "type": "BlockStatement", + "start": 163, + "end": 165, + "loc": { + "start": { + "line": 3, + "column": 45 + }, + "end": { + "line": 3, + "column": 47 + } + }, + "body": [], + "directives": [] + } + } + } + ], + "kind": "const" + } + ], + "directives": [] + } +} diff --git a/packages/babel-parser/test/fixtures/typescript/assert-predicate/asserts-as-identifier/input.ts b/packages/babel-parser/test/fixtures/typescript/assert-predicate/asserts-as-identifier/input.ts new file mode 100644 index 000000000000..d5ee9a42ce01 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/assert-predicate/asserts-as-identifier/input.ts @@ -0,0 +1 @@ +declare function assertIsString(value: unknown): asserts; diff --git a/packages/babel-parser/test/fixtures/typescript/assert-predicate/asserts-as-identifier/output.json b/packages/babel-parser/test/fixtures/typescript/assert-predicate/asserts-as-identifier/output.json new file mode 100644 index 000000000000..dc6f8702bdce --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/assert-predicate/asserts-as-identifier/output.json @@ -0,0 +1,166 @@ +{ + "type": "File", + "start": 0, + "end": 57, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 57 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 57, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 57 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "TSDeclareFunction", + "start": 0, + "end": 57, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 57 + } + }, + "id": { + "type": "Identifier", + "start": 17, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 31 + }, + "identifierName": "assertIsString" + }, + "name": "assertIsString" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 32, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 46 + }, + "identifierName": "value" + }, + "name": "value", + "typeAnnotation": { + "type": "TSTypeAnnotation", + "start": 37, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 46 + } + }, + "typeAnnotation": { + "type": "TSUnknownKeyword", + "start": 39, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 39 + }, + "end": { + "line": 1, + "column": 46 + } + } + } + } + } + ], + "returnType": { + "type": "TSTypeAnnotation", + "start": 47, + "end": 56, + "loc": { + "start": { + "line": 1, + "column": 47 + }, + "end": { + "line": 1, + "column": 56 + } + }, + "typeAnnotation": { + "type": "TSTypeReference", + "start": 49, + "end": 56, + "loc": { + "start": { + "line": 1, + "column": 49 + }, + "end": { + "line": 1, + "column": 56 + } + }, + "typeName": { + "type": "Identifier", + "start": 49, + "end": 56, + "loc": { + "start": { + "line": 1, + "column": 49 + }, + "end": { + "line": 1, + "column": 56 + }, + "identifierName": "asserts" + }, + "name": "asserts" + } + } + }, + "declare": true + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/assert-predicate/asserts-this-with-predicate/input.ts b/packages/babel-parser/test/fixtures/typescript/assert-predicate/asserts-this-with-predicate/input.ts new file mode 100644 index 000000000000..cc1a550f07bb --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/assert-predicate/asserts-this-with-predicate/input.ts @@ -0,0 +1,4 @@ +class Foo { + isBar(): asserts this is Foo {} + isBaz = (): asserts this is Foo => {} +} diff --git a/packages/babel-parser/test/fixtures/typescript/assert-predicate/asserts-this-with-predicate/options.json b/packages/babel-parser/test/fixtures/typescript/assert-predicate/asserts-this-with-predicate/options.json new file mode 100644 index 000000000000..fb92dc3bde16 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/assert-predicate/asserts-this-with-predicate/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["typescript", "classProperties"] +} diff --git a/packages/babel-parser/test/fixtures/typescript/assert-predicate/asserts-this-with-predicate/output.json b/packages/babel-parser/test/fixtures/typescript/assert-predicate/asserts-this-with-predicate/output.json new file mode 100644 index 000000000000..bed7e168b396 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/assert-predicate/asserts-this-with-predicate/output.json @@ -0,0 +1,397 @@ +{ + "type": "File", + "start": 0, + "end": 87, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 87, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 87, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 9 + }, + "identifierName": "Foo" + }, + "name": "Foo" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 10, + "end": 87, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "body": [ + { + "type": "ClassMethod", + "start": 14, + "end": 45, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 33 + } + }, + "static": false, + "key": { + "type": "Identifier", + "start": 14, + "end": 19, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 7 + }, + "identifierName": "isBar" + }, + "name": "isBar" + }, + "computed": false, + "kind": "method", + "id": null, + "generator": false, + "async": false, + "params": [], + "returnType": { + "type": "TSTypeAnnotation", + "start": 21, + "end": 42, + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 30 + } + }, + "typeAnnotation": { + "type": "TSTypePredicate", + "start": 31, + "end": 42, + "loc": { + "start": { + "line": 2, + "column": 19 + }, + "end": { + "line": 2, + "column": 30 + } + }, + "parameterName": { + "type": "TSThisType", + "start": 31, + "end": 35, + "loc": { + "start": { + "line": 2, + "column": 19 + }, + "end": { + "line": 2, + "column": 23 + } + } + }, + "typeAnnotation": { + "type": "TSTypeAnnotation", + "start": 39, + "end": 42, + "loc": { + "start": { + "line": 2, + "column": 27 + }, + "end": { + "line": 2, + "column": 30 + } + }, + "typeAnnotation": { + "type": "TSTypeReference", + "start": 39, + "end": 42, + "loc": { + "start": { + "line": 2, + "column": 27 + }, + "end": { + "line": 2, + "column": 30 + } + }, + "typeName": { + "type": "Identifier", + "start": 39, + "end": 42, + "loc": { + "start": { + "line": 2, + "column": 27 + }, + "end": { + "line": 2, + "column": 30 + }, + "identifierName": "Foo" + }, + "name": "Foo" + } + } + }, + "asserts": true + } + }, + "body": { + "type": "BlockStatement", + "start": 43, + "end": 45, + "loc": { + "start": { + "line": 2, + "column": 31 + }, + "end": { + "line": 2, + "column": 33 + } + }, + "body": [], + "directives": [] + } + }, + { + "type": "ClassProperty", + "start": 48, + "end": 85, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 39 + } + }, + "static": false, + "key": { + "type": "Identifier", + "start": 48, + "end": 53, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 7 + }, + "identifierName": "isBaz" + }, + "name": "isBaz" + }, + "computed": false, + "value": { + "type": "ArrowFunctionExpression", + "start": 56, + "end": 85, + "loc": { + "start": { + "line": 3, + "column": 10 + }, + "end": { + "line": 3, + "column": 39 + } + }, + "returnType": { + "type": "TSTypeAnnotation", + "start": 58, + "end": 79, + "loc": { + "start": { + "line": 3, + "column": 12 + }, + "end": { + "line": 3, + "column": 33 + } + }, + "typeAnnotation": { + "type": "TSTypePredicate", + "start": 68, + "end": 79, + "loc": { + "start": { + "line": 3, + "column": 22 + }, + "end": { + "line": 3, + "column": 33 + } + }, + "parameterName": { + "type": "TSThisType", + "start": 68, + "end": 72, + "loc": { + "start": { + "line": 3, + "column": 22 + }, + "end": { + "line": 3, + "column": 26 + } + } + }, + "typeAnnotation": { + "type": "TSTypeAnnotation", + "start": 76, + "end": 79, + "loc": { + "start": { + "line": 3, + "column": 30 + }, + "end": { + "line": 3, + "column": 33 + } + }, + "typeAnnotation": { + "type": "TSTypeReference", + "start": 76, + "end": 79, + "loc": { + "start": { + "line": 3, + "column": 30 + }, + "end": { + "line": 3, + "column": 33 + } + }, + "typeName": { + "type": "Identifier", + "start": 76, + "end": 79, + "loc": { + "start": { + "line": 3, + "column": 30 + }, + "end": { + "line": 3, + "column": 33 + }, + "identifierName": "Foo" + }, + "name": "Foo" + } + } + }, + "asserts": true + } + }, + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 83, + "end": 85, + "loc": { + "start": { + "line": 3, + "column": 37 + }, + "end": { + "line": 3, + "column": 39 + } + }, + "body": [], + "directives": [] + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/assert-predicate/asserts-this/input.ts b/packages/babel-parser/test/fixtures/typescript/assert-predicate/asserts-this/input.ts new file mode 100644 index 000000000000..839483541d5b --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/assert-predicate/asserts-this/input.ts @@ -0,0 +1,3 @@ +class C { + m(): asserts this {}; +} diff --git a/packages/babel-parser/test/fixtures/typescript/assert-predicate/asserts-this/output.json b/packages/babel-parser/test/fixtures/typescript/assert-predicate/asserts-this/output.json new file mode 100644 index 000000000000..e9d5458c1c89 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/assert-predicate/asserts-this/output.json @@ -0,0 +1,187 @@ +{ + "type": "File", + "start": 0, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "C" + }, + "name": "C" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 8, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": [ + { + "type": "ClassMethod", + "start": 12, + "end": 32, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 22 + } + }, + "static": false, + "key": { + "type": "Identifier", + "start": 12, + "end": 13, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 3 + }, + "identifierName": "m" + }, + "name": "m" + }, + "computed": false, + "kind": "method", + "id": null, + "generator": false, + "async": false, + "params": [], + "returnType": { + "type": "TSTypeAnnotation", + "start": 15, + "end": 29, + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 19 + } + }, + "typeAnnotation": { + "type": "TSTypePredicate", + "start": 15, + "end": 29, + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 19 + } + }, + "parameterName": { + "type": "TSThisType", + "start": 25, + "end": 29, + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 19 + } + } + }, + "asserts": true + } + }, + "body": { + "type": "BlockStatement", + "start": 30, + "end": 32, + "loc": { + "start": { + "line": 2, + "column": 20 + }, + "end": { + "line": 2, + "column": 22 + } + }, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/assert-predicate/asserts-var-with-predicate/input.ts b/packages/babel-parser/test/fixtures/typescript/assert-predicate/asserts-var-with-predicate/input.ts new file mode 100644 index 000000000000..2b580e64e906 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/assert-predicate/asserts-var-with-predicate/input.ts @@ -0,0 +1,3 @@ +class C { + assertIsString(value: unknown): asserts value is string {} +} diff --git a/packages/babel-parser/test/fixtures/typescript/assert-predicate/asserts-var-with-predicate/output.json b/packages/babel-parser/test/fixtures/typescript/assert-predicate/asserts-var-with-predicate/output.json new file mode 100644 index 000000000000..f63a5e0581c3 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/assert-predicate/asserts-var-with-predicate/output.json @@ -0,0 +1,267 @@ +{ + "type": "File", + "start": 0, + "end": 72, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 72, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 72, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "C" + }, + "name": "C" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 8, + "end": 72, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": [ + { + "type": "ClassMethod", + "start": 12, + "end": 70, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 60 + } + }, + "static": false, + "key": { + "type": "Identifier", + "start": 12, + "end": 26, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 16 + }, + "identifierName": "assertIsString" + }, + "name": "assertIsString" + }, + "computed": false, + "kind": "method", + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 27, + "end": 41, + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 31 + }, + "identifierName": "value" + }, + "name": "value", + "typeAnnotation": { + "type": "TSTypeAnnotation", + "start": 32, + "end": 41, + "loc": { + "start": { + "line": 2, + "column": 22 + }, + "end": { + "line": 2, + "column": 31 + } + }, + "typeAnnotation": { + "type": "TSUnknownKeyword", + "start": 34, + "end": 41, + "loc": { + "start": { + "line": 2, + "column": 24 + }, + "end": { + "line": 2, + "column": 31 + } + } + } + } + } + ], + "returnType": { + "type": "TSTypeAnnotation", + "start": 42, + "end": 67, + "loc": { + "start": { + "line": 2, + "column": 32 + }, + "end": { + "line": 2, + "column": 57 + } + }, + "typeAnnotation": { + "type": "TSTypePredicate", + "start": 42, + "end": 67, + "loc": { + "start": { + "line": 2, + "column": 32 + }, + "end": { + "line": 2, + "column": 57 + } + }, + "parameterName": { + "type": "Identifier", + "start": 52, + "end": 57, + "loc": { + "start": { + "line": 2, + "column": 42 + }, + "end": { + "line": 2, + "column": 47 + }, + "identifierName": "value" + }, + "name": "value" + }, + "typeAnnotation": { + "type": "TSTypeAnnotation", + "start": 61, + "end": 67, + "loc": { + "start": { + "line": 2, + "column": 51 + }, + "end": { + "line": 2, + "column": 57 + } + }, + "typeAnnotation": { + "type": "TSStringKeyword", + "start": 61, + "end": 67, + "loc": { + "start": { + "line": 2, + "column": 51 + }, + "end": { + "line": 2, + "column": 57 + } + } + } + }, + "asserts": true + } + }, + "body": { + "type": "BlockStatement", + "start": 68, + "end": 70, + "loc": { + "start": { + "line": 2, + "column": 58 + }, + "end": { + "line": 2, + "column": 60 + } + }, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/assert-predicate/asserts-var/input.ts b/packages/babel-parser/test/fixtures/typescript/assert-predicate/asserts-var/input.ts new file mode 100644 index 000000000000..63613906e9fd --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/assert-predicate/asserts-var/input.ts @@ -0,0 +1 @@ +declare function assertIsString(value: unknown): asserts value; diff --git a/packages/babel-parser/test/fixtures/typescript/assert-predicate/asserts-var/output.json b/packages/babel-parser/test/fixtures/typescript/assert-predicate/asserts-var/output.json new file mode 100644 index 000000000000..62c634c7dc8e --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/assert-predicate/asserts-var/output.json @@ -0,0 +1,167 @@ +{ + "type": "File", + "start": 0, + "end": 63, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 63 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 63, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 63 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "TSDeclareFunction", + "start": 0, + "end": 63, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 63 + } + }, + "id": { + "type": "Identifier", + "start": 17, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 31 + }, + "identifierName": "assertIsString" + }, + "name": "assertIsString" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 32, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 46 + }, + "identifierName": "value" + }, + "name": "value", + "typeAnnotation": { + "type": "TSTypeAnnotation", + "start": 37, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 46 + } + }, + "typeAnnotation": { + "type": "TSUnknownKeyword", + "start": 39, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 39 + }, + "end": { + "line": 1, + "column": 46 + } + } + } + } + } + ], + "returnType": { + "type": "TSTypeAnnotation", + "start": 47, + "end": 62, + "loc": { + "start": { + "line": 1, + "column": 47 + }, + "end": { + "line": 1, + "column": 62 + } + }, + "typeAnnotation": { + "type": "TSTypePredicate", + "start": 47, + "end": 62, + "loc": { + "start": { + "line": 1, + "column": 47 + }, + "end": { + "line": 1, + "column": 62 + } + }, + "parameterName": { + "type": "Identifier", + "start": 57, + "end": 62, + "loc": { + "start": { + "line": 1, + "column": 57 + }, + "end": { + "line": 1, + "column": 62 + }, + "identifierName": "value" + }, + "name": "value" + }, + "asserts": true + } + }, + "declare": true + } + ], + "directives": [] + } +} diff --git a/packages/babel-parser/test/fixtures/typescript/assert-predicate/declare-asserts-var-with-predicate/input.ts b/packages/babel-parser/test/fixtures/typescript/assert-predicate/declare-asserts-var-with-predicate/input.ts new file mode 100644 index 000000000000..9456a5cb2e50 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/assert-predicate/declare-asserts-var-with-predicate/input.ts @@ -0,0 +1 @@ +declare function assertIsString(value: unknown): asserts value is string; diff --git a/packages/babel-parser/test/fixtures/typescript/assert-predicate/declare-asserts-var-with-predicate/output.json b/packages/babel-parser/test/fixtures/typescript/assert-predicate/declare-asserts-var-with-predicate/output.json new file mode 100644 index 000000000000..82cdaebbcf79 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/assert-predicate/declare-asserts-var-with-predicate/output.json @@ -0,0 +1,197 @@ +{ + "type": "File", + "start": 0, + "end": 73, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 73 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 73, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 73 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "TSDeclareFunction", + "start": 0, + "end": 73, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 73 + } + }, + "id": { + "type": "Identifier", + "start": 17, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 31 + }, + "identifierName": "assertIsString" + }, + "name": "assertIsString" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 32, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 46 + }, + "identifierName": "value" + }, + "name": "value", + "typeAnnotation": { + "type": "TSTypeAnnotation", + "start": 37, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 46 + } + }, + "typeAnnotation": { + "type": "TSUnknownKeyword", + "start": 39, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 39 + }, + "end": { + "line": 1, + "column": 46 + } + } + } + } + } + ], + "returnType": { + "type": "TSTypeAnnotation", + "start": 47, + "end": 72, + "loc": { + "start": { + "line": 1, + "column": 47 + }, + "end": { + "line": 1, + "column": 72 + } + }, + "typeAnnotation": { + "type": "TSTypePredicate", + "start": 47, + "end": 72, + "loc": { + "start": { + "line": 1, + "column": 47 + }, + "end": { + "line": 1, + "column": 72 + } + }, + "parameterName": { + "type": "Identifier", + "start": 57, + "end": 62, + "loc": { + "start": { + "line": 1, + "column": 57 + }, + "end": { + "line": 1, + "column": 62 + }, + "identifierName": "value" + }, + "name": "value" + }, + "typeAnnotation": { + "type": "TSTypeAnnotation", + "start": 66, + "end": 72, + "loc": { + "start": { + "line": 1, + "column": 66 + }, + "end": { + "line": 1, + "column": 72 + } + }, + "typeAnnotation": { + "type": "TSStringKeyword", + "start": 66, + "end": 72, + "loc": { + "start": { + "line": 1, + "column": 66 + }, + "end": { + "line": 1, + "column": 72 + } + } + } + }, + "asserts": true + } + }, + "declare": true + } + ], + "directives": [] + } +} diff --git a/packages/babel-parser/test/fixtures/typescript/assert-predicate/function-declaration/input.ts b/packages/babel-parser/test/fixtures/typescript/assert-predicate/function-declaration/input.ts new file mode 100644 index 000000000000..b04da8349ca2 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/assert-predicate/function-declaration/input.ts @@ -0,0 +1,3 @@ +function asserts1 (value: unknown): asserts value is string {} +function asserts2 (value: unknown): asserts value {} +function asserts3 (value: unknown): asserts {} diff --git a/packages/babel-parser/test/fixtures/typescript/assert-predicate/function-declaration/output.json b/packages/babel-parser/test/fixtures/typescript/assert-predicate/function-declaration/output.json new file mode 100644 index 000000000000..bea1caf3de2a --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/assert-predicate/function-declaration/output.json @@ -0,0 +1,508 @@ +{ + "type": "File", + "start": 0, + "end": 163, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 46 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 163, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 46 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 62, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 62 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 17 + }, + "identifierName": "asserts1" + }, + "name": "asserts1" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 19, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 33 + }, + "identifierName": "value" + }, + "name": "value", + "typeAnnotation": { + "type": "TSTypeAnnotation", + "start": 24, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "typeAnnotation": { + "type": "TSUnknownKeyword", + "start": 26, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 33 + } + } + } + } + } + ], + "returnType": { + "type": "TSTypeAnnotation", + "start": 34, + "end": 59, + "loc": { + "start": { + "line": 1, + "column": 34 + }, + "end": { + "line": 1, + "column": 59 + } + }, + "typeAnnotation": { + "type": "TSTypePredicate", + "start": 34, + "end": 59, + "loc": { + "start": { + "line": 1, + "column": 34 + }, + "end": { + "line": 1, + "column": 59 + } + }, + "parameterName": { + "type": "Identifier", + "start": 44, + "end": 49, + "loc": { + "start": { + "line": 1, + "column": 44 + }, + "end": { + "line": 1, + "column": 49 + }, + "identifierName": "value" + }, + "name": "value" + }, + "typeAnnotation": { + "type": "TSTypeAnnotation", + "start": 53, + "end": 59, + "loc": { + "start": { + "line": 1, + "column": 53 + }, + "end": { + "line": 1, + "column": 59 + } + }, + "typeAnnotation": { + "type": "TSStringKeyword", + "start": 53, + "end": 59, + "loc": { + "start": { + "line": 1, + "column": 53 + }, + "end": { + "line": 1, + "column": 59 + } + } + } + }, + "asserts": true + } + }, + "body": { + "type": "BlockStatement", + "start": 60, + "end": 62, + "loc": { + "start": { + "line": 1, + "column": 60 + }, + "end": { + "line": 1, + "column": 62 + } + }, + "body": [], + "directives": [] + } + }, + { + "type": "FunctionDeclaration", + "start": 64, + "end": 116, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 52 + } + }, + "id": { + "type": "Identifier", + "start": 73, + "end": 81, + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 17 + }, + "identifierName": "asserts2" + }, + "name": "asserts2" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 83, + "end": 97, + "loc": { + "start": { + "line": 2, + "column": 19 + }, + "end": { + "line": 2, + "column": 33 + }, + "identifierName": "value" + }, + "name": "value", + "typeAnnotation": { + "type": "TSTypeAnnotation", + "start": 88, + "end": 97, + "loc": { + "start": { + "line": 2, + "column": 24 + }, + "end": { + "line": 2, + "column": 33 + } + }, + "typeAnnotation": { + "type": "TSUnknownKeyword", + "start": 90, + "end": 97, + "loc": { + "start": { + "line": 2, + "column": 26 + }, + "end": { + "line": 2, + "column": 33 + } + } + } + } + } + ], + "returnType": { + "type": "TSTypeAnnotation", + "start": 98, + "end": 113, + "loc": { + "start": { + "line": 2, + "column": 34 + }, + "end": { + "line": 2, + "column": 49 + } + }, + "typeAnnotation": { + "type": "TSTypePredicate", + "start": 98, + "end": 113, + "loc": { + "start": { + "line": 2, + "column": 34 + }, + "end": { + "line": 2, + "column": 49 + } + }, + "parameterName": { + "type": "Identifier", + "start": 108, + "end": 113, + "loc": { + "start": { + "line": 2, + "column": 44 + }, + "end": { + "line": 2, + "column": 49 + }, + "identifierName": "value" + }, + "name": "value" + }, + "asserts": true + } + }, + "body": { + "type": "BlockStatement", + "start": 114, + "end": 116, + "loc": { + "start": { + "line": 2, + "column": 50 + }, + "end": { + "line": 2, + "column": 52 + } + }, + "body": [], + "directives": [] + } + }, + { + "type": "FunctionDeclaration", + "start": 117, + "end": 163, + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 46 + } + }, + "id": { + "type": "Identifier", + "start": 126, + "end": 134, + "loc": { + "start": { + "line": 3, + "column": 9 + }, + "end": { + "line": 3, + "column": 17 + }, + "identifierName": "asserts3" + }, + "name": "asserts3" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 136, + "end": 150, + "loc": { + "start": { + "line": 3, + "column": 19 + }, + "end": { + "line": 3, + "column": 33 + }, + "identifierName": "value" + }, + "name": "value", + "typeAnnotation": { + "type": "TSTypeAnnotation", + "start": 141, + "end": 150, + "loc": { + "start": { + "line": 3, + "column": 24 + }, + "end": { + "line": 3, + "column": 33 + } + }, + "typeAnnotation": { + "type": "TSUnknownKeyword", + "start": 143, + "end": 150, + "loc": { + "start": { + "line": 3, + "column": 26 + }, + "end": { + "line": 3, + "column": 33 + } + } + } + } + } + ], + "returnType": { + "type": "TSTypeAnnotation", + "start": 151, + "end": 160, + "loc": { + "start": { + "line": 3, + "column": 34 + }, + "end": { + "line": 3, + "column": 43 + } + }, + "typeAnnotation": { + "type": "TSTypeReference", + "start": 153, + "end": 160, + "loc": { + "start": { + "line": 3, + "column": 36 + }, + "end": { + "line": 3, + "column": 43 + } + }, + "typeName": { + "type": "Identifier", + "start": 153, + "end": 160, + "loc": { + "start": { + "line": 3, + "column": 36 + }, + "end": { + "line": 3, + "column": 43 + }, + "identifierName": "asserts" + }, + "name": "asserts" + } + } + }, + "body": { + "type": "BlockStatement", + "start": 161, + "end": 163, + "loc": { + "start": { + "line": 3, + "column": 44 + }, + "end": { + "line": 3, + "column": 46 + } + }, + "body": [], + "directives": [] + } + } + ], + "directives": [] + } +} diff --git a/packages/babel-parser/test/fixtures/typescript/assert-predicate/invalid-escaped-asserts-keyword/input.ts b/packages/babel-parser/test/fixtures/typescript/assert-predicate/invalid-escaped-asserts-keyword/input.ts new file mode 100644 index 000000000000..a89b5ad6c9fa --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/assert-predicate/invalid-escaped-asserts-keyword/input.ts @@ -0,0 +1 @@ +declare function assertIsString(value: unknown): \u{61}sserts value; diff --git a/packages/babel-parser/test/fixtures/typescript/assert-predicate/invalid-escaped-asserts-keyword/output.json b/packages/babel-parser/test/fixtures/typescript/assert-predicate/invalid-escaped-asserts-keyword/output.json new file mode 100644 index 000000000000..90484c4b93a3 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/assert-predicate/invalid-escaped-asserts-keyword/output.json @@ -0,0 +1,170 @@ +{ + "type": "File", + "start": 0, + "end": 68, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 68 + } + }, + "errors": [ + "SyntaxError: Escape sequence in keyword asserts (1:49)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 68, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 68 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "TSDeclareFunction", + "start": 0, + "end": 68, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 68 + } + }, + "id": { + "type": "Identifier", + "start": 17, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 31 + }, + "identifierName": "assertIsString" + }, + "name": "assertIsString" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 32, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 46 + }, + "identifierName": "value" + }, + "name": "value", + "typeAnnotation": { + "type": "TSTypeAnnotation", + "start": 37, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 46 + } + }, + "typeAnnotation": { + "type": "TSUnknownKeyword", + "start": 39, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 39 + }, + "end": { + "line": 1, + "column": 46 + } + } + } + } + } + ], + "returnType": { + "type": "TSTypeAnnotation", + "start": 47, + "end": 67, + "loc": { + "start": { + "line": 1, + "column": 47 + }, + "end": { + "line": 1, + "column": 67 + } + }, + "typeAnnotation": { + "type": "TSTypePredicate", + "start": 47, + "end": 67, + "loc": { + "start": { + "line": 1, + "column": 47 + }, + "end": { + "line": 1, + "column": 67 + } + }, + "parameterName": { + "type": "Identifier", + "start": 62, + "end": 67, + "loc": { + "start": { + "line": 1, + "column": 62 + }, + "end": { + "line": 1, + "column": 67 + }, + "identifierName": "value" + }, + "name": "value" + }, + "asserts": true + } + }, + "declare": true + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/cast/arrow-async-parameter-as/options.json b/packages/babel-parser/test/fixtures/typescript/cast/arrow-async-parameter-as/options.json deleted file mode 100644 index 69d91502496d..000000000000 --- a/packages/babel-parser/test/fixtures/typescript/cast/arrow-async-parameter-as/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected type cast in parameter position. (1:7)" -} diff --git a/packages/babel-parser/test/fixtures/typescript/cast/arrow-async-parameter-as/output.json b/packages/babel-parser/test/fixtures/typescript/cast/arrow-async-parameter-as/output.json new file mode 100644 index 000000000000..84bb9f048205 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/cast/arrow-async-parameter-as/output.json @@ -0,0 +1,154 @@ +{ + "type": "File", + "start": 0, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "errors": [ + "SyntaxError: Unexpected type cast in parameter position. (1:7)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "expression": { + "type": "ArrowFunctionExpression", + "start": 0, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "id": null, + "generator": false, + "async": true, + "params": [ + { + "type": "TSAsExpression", + "start": 7, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "expression": { + "type": "Identifier", + "start": 7, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + }, + "identifierName": "a" + }, + "name": "a" + }, + "typeAnnotation": { + "type": "TSTypeReference", + "start": 12, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "typeName": { + "type": "Identifier", + "start": 12, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + }, + "identifierName": "T" + }, + "name": "T" + } + } + } + ], + "body": { + "type": "BlockStatement", + "start": 18, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "body": [], + "directives": [] + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/cast/arrow-async-parameter-assertion/options.json b/packages/babel-parser/test/fixtures/typescript/cast/arrow-async-parameter-assertion/options.json deleted file mode 100644 index 69d91502496d..000000000000 --- a/packages/babel-parser/test/fixtures/typescript/cast/arrow-async-parameter-assertion/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected type cast in parameter position. (1:7)" -} diff --git a/packages/babel-parser/test/fixtures/typescript/cast/arrow-async-parameter-assertion/output.json b/packages/babel-parser/test/fixtures/typescript/cast/arrow-async-parameter-assertion/output.json new file mode 100644 index 000000000000..5825bdc4db33 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/cast/arrow-async-parameter-assertion/output.json @@ -0,0 +1,154 @@ +{ + "type": "File", + "start": 0, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "errors": [ + "SyntaxError: Unexpected type cast in parameter position. (1:7)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "expression": { + "type": "ArrowFunctionExpression", + "start": 0, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "id": null, + "generator": false, + "async": true, + "params": [ + { + "type": "TSTypeAssertion", + "start": 7, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "typeAnnotation": { + "type": "TSTypeReference", + "start": 8, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "typeName": { + "type": "Identifier", + "start": 8, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + }, + "identifierName": "T" + }, + "name": "T" + } + }, + "expression": { + "type": "Identifier", + "start": 11, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + }, + "identifierName": "a" + }, + "name": "a" + } + } + ], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "body": [], + "directives": [] + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/cast/arrow-parameter-as/options.json b/packages/babel-parser/test/fixtures/typescript/cast/arrow-parameter-as/options.json deleted file mode 100644 index b5bdba868c9f..000000000000 --- a/packages/babel-parser/test/fixtures/typescript/cast/arrow-parameter-as/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected type cast in parameter position. (1:1)" -} diff --git a/packages/babel-parser/test/fixtures/typescript/cast/arrow-parameter-as/output.json b/packages/babel-parser/test/fixtures/typescript/cast/arrow-parameter-as/output.json new file mode 100644 index 000000000000..369ec9d0eb08 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/cast/arrow-parameter-as/output.json @@ -0,0 +1,154 @@ +{ + "type": "File", + "start": 0, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "errors": [ + "SyntaxError: Unexpected type cast in parameter position. (1:1)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "expression": { + "type": "ArrowFunctionExpression", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "TSAsExpression", + "start": 1, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "expression": { + "type": "Identifier", + "start": 1, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + }, + "identifierName": "a" + }, + "name": "a" + }, + "typeAnnotation": { + "type": "TSTypeReference", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "typeName": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "T" + }, + "name": "T" + } + } + } + ], + "body": { + "type": "BlockStatement", + "start": 12, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "body": [], + "directives": [] + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/cast/arrow-parameter-assertion/options.json b/packages/babel-parser/test/fixtures/typescript/cast/arrow-parameter-assertion/options.json deleted file mode 100644 index b5bdba868c9f..000000000000 --- a/packages/babel-parser/test/fixtures/typescript/cast/arrow-parameter-assertion/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected type cast in parameter position. (1:1)" -} diff --git a/packages/babel-parser/test/fixtures/typescript/cast/arrow-parameter-assertion/output.json b/packages/babel-parser/test/fixtures/typescript/cast/arrow-parameter-assertion/output.json new file mode 100644 index 000000000000..52cb7ee9d5a9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/cast/arrow-parameter-assertion/output.json @@ -0,0 +1,154 @@ +{ + "type": "File", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "errors": [ + "SyntaxError: Unexpected type cast in parameter position. (1:1)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "expression": { + "type": "ArrowFunctionExpression", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "TSTypeAssertion", + "start": 1, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "typeAnnotation": { + "type": "TSTypeReference", + "start": 2, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "typeName": { + "type": "Identifier", + "start": 2, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + }, + "identifierName": "T" + }, + "name": "T" + } + }, + "expression": { + "type": "Identifier", + "start": 5, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + }, + "identifierName": "a" + }, + "name": "a" + } + } + ], + "body": { + "type": "BlockStatement", + "start": 11, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "body": [], + "directives": [] + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/cast/destructure-and-assign/input.ts b/packages/babel-parser/test/fixtures/typescript/cast/destructure-and-assign/input.ts new file mode 100644 index 000000000000..ece9096fb9f6 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/cast/destructure-and-assign/input.ts @@ -0,0 +1,2 @@ +[a as number] = [42]; +[a] = [42]; diff --git a/packages/babel-parser/test/fixtures/typescript/cast/destructure-and-assign/output.json b/packages/babel-parser/test/fixtures/typescript/cast/destructure-and-assign/output.json new file mode 100644 index 000000000000..d621a6cb84c1 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/cast/destructure-and-assign/output.json @@ -0,0 +1,269 @@ +{ + "type": "File", + "start": 0, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 19 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 19 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 0, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "operator": "=", + "left": { + "type": "ArrayPattern", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "elements": [ + { + "type": "Identifier", + "start": 1, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 12 + }, + "identifierName": "a" + }, + "name": "a", + "typeAnnotation": { + "type": "TSNumberKeyword", + "start": 6, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 12 + } + } + } + } + ] + }, + "right": { + "type": "ArrayExpression", + "start": 16, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "elements": [ + { + "type": "NumericLiteral", + "start": 17, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "extra": { + "rawValue": 42, + "raw": "42" + }, + "value": 42 + } + ] + } + } + }, + { + "type": "ExpressionStatement", + "start": 22, + "end": 41, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 19 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 22, + "end": 40, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 18 + } + }, + "operator": "=", + "left": { + "type": "ArrayPattern", + "start": 22, + "end": 33, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 11 + } + }, + "elements": [ + { + "type": "Identifier", + "start": 31, + "end": 30, + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 8 + }, + "identifierName": "a" + }, + "name": "a", + "typeAnnotation": { + "type": "TSNumberKeyword", + "start": 24, + "end": 30, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 8 + } + } + } + } + ] + }, + "right": { + "type": "ArrayExpression", + "start": 36, + "end": 40, + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 18 + } + }, + "elements": [ + { + "type": "NumericLiteral", + "start": 37, + "end": 39, + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 17 + } + }, + "extra": { + "rawValue": 42, + "raw": "42" + }, + "value": 42 + } + ] + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/cast/parameter-typecast/input.ts b/packages/babel-parser/test/fixtures/typescript/cast/parameter-typecast/input.ts new file mode 100644 index 000000000000..c494cc00bc39 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/cast/parameter-typecast/input.ts @@ -0,0 +1 @@ +func(a: T); diff --git a/packages/babel-parser/test/fixtures/typescript/cast/parameter-typecast/output.json b/packages/babel-parser/test/fixtures/typescript/cast/parameter-typecast/output.json new file mode 100644 index 000000000000..d815e81603d1 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/cast/parameter-typecast/output.json @@ -0,0 +1,166 @@ +{ + "type": "File", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "errors": [ + "SyntaxError: Did not expect a type annotation here. (1:5)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "expression": { + "type": "CallExpression", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "callee": { + "type": "Identifier", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + }, + "identifierName": "func" + }, + "name": "func" + }, + "arguments": [ + { + "type": "TSTypeCastExpression", + "start": 5, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "expression": { + "type": "Identifier", + "start": 5, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + }, + "identifierName": "a" + }, + "name": "a" + }, + "typeAnnotation": { + "type": "TSTypeAnnotation", + "start": 6, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "typeAnnotation": { + "type": "TSTypeReference", + "start": 8, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "typeName": { + "type": "Identifier", + "start": 8, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + }, + "identifierName": "T" + }, + "name": "T" + } + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/class/async-named-properties/input.ts b/packages/babel-parser/test/fixtures/typescript/class/async-named-properties/input.ts new file mode 100644 index 000000000000..1e0af756a626 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/class/async-named-properties/input.ts @@ -0,0 +1,4 @@ +class A { + async?(): void + async?: boolean +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/class/async-named-properties/output.json b/packages/babel-parser/test/fixtures/typescript/class/async-named-properties/output.json new file mode 100644 index 000000000000..e0ac8a5907fa --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/class/async-named-properties/output.json @@ -0,0 +1,221 @@ +{ + "type": "File", + "start": 0, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "A" + }, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 8, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "body": [ + { + "type": "TSDeclareMethod", + "start": 12, + "end": 26, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 16 + } + }, + "static": false, + "key": { + "type": "Identifier", + "start": 12, + "end": 17, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 7 + }, + "identifierName": "async" + }, + "name": "async" + }, + "computed": false, + "optional": true, + "kind": "method", + "id": null, + "generator": false, + "async": false, + "params": [], + "returnType": { + "type": "TSTypeAnnotation", + "start": 20, + "end": 26, + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 16 + } + }, + "typeAnnotation": { + "type": "TSVoidKeyword", + "start": 22, + "end": 26, + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 16 + } + } + } + } + }, + { + "type": "ClassProperty", + "start": 29, + "end": 44, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 17 + } + }, + "static": false, + "key": { + "type": "Identifier", + "start": 29, + "end": 34, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 7 + }, + "identifierName": "async" + }, + "name": "async" + }, + "computed": false, + "optional": true, + "typeAnnotation": { + "type": "TSTypeAnnotation", + "start": 35, + "end": 44, + "loc": { + "start": { + "line": 3, + "column": 8 + }, + "end": { + "line": 3, + "column": 17 + } + }, + "typeAnnotation": { + "type": "TSBooleanKeyword", + "start": 37, + "end": 44, + "loc": { + "start": { + "line": 3, + "column": 10 + }, + "end": { + "line": 3, + "column": 17 + } + } + } + }, + "value": null + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/class/async-optional-method/input.js b/packages/babel-parser/test/fixtures/typescript/class/async-optional-method/input.js new file mode 100644 index 000000000000..8081fad6e8f2 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/class/async-optional-method/input.js @@ -0,0 +1,3 @@ +class A extends B { + async method?(val: string): Promise; +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/class/async-optional-method/output.json b/packages/babel-parser/test/fixtures/typescript/class/async-optional-method/output.json new file mode 100644 index 000000000000..b2a7262f0397 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/class/async-optional-method/output.json @@ -0,0 +1,268 @@ +{ + "type": "File", + "start": 0, + "end": 66, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 66, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 66, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "A" + }, + "name": "A" + }, + "superClass": { + "type": "Identifier", + "start": 16, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + }, + "identifierName": "B" + }, + "name": "B" + }, + "body": { + "type": "ClassBody", + "start": 18, + "end": 66, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": [ + { + "type": "TSDeclareMethod", + "start": 22, + "end": 64, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 44 + } + }, + "static": false, + "key": { + "type": "Identifier", + "start": 28, + "end": 34, + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 14 + }, + "identifierName": "method" + }, + "name": "method" + }, + "computed": false, + "kind": "method", + "optional": true, + "id": null, + "generator": false, + "async": true, + "params": [ + { + "type": "Identifier", + "start": 36, + "end": 47, + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 27 + }, + "identifierName": "val" + }, + "name": "val", + "typeAnnotation": { + "type": "TSTypeAnnotation", + "start": 39, + "end": 47, + "loc": { + "start": { + "line": 2, + "column": 19 + }, + "end": { + "line": 2, + "column": 27 + } + }, + "typeAnnotation": { + "type": "TSStringKeyword", + "start": 41, + "end": 47, + "loc": { + "start": { + "line": 2, + "column": 21 + }, + "end": { + "line": 2, + "column": 27 + } + } + } + } + } + ], + "returnType": { + "type": "TSTypeAnnotation", + "start": 48, + "end": 63, + "loc": { + "start": { + "line": 2, + "column": 28 + }, + "end": { + "line": 2, + "column": 43 + } + }, + "typeAnnotation": { + "type": "TSTypeReference", + "start": 50, + "end": 63, + "loc": { + "start": { + "line": 2, + "column": 30 + }, + "end": { + "line": 2, + "column": 43 + } + }, + "typeName": { + "type": "Identifier", + "start": 50, + "end": 57, + "loc": { + "start": { + "line": 2, + "column": 30 + }, + "end": { + "line": 2, + "column": 37 + }, + "identifierName": "Promise" + }, + "name": "Promise" + }, + "typeParameters": { + "type": "TSTypeParameterInstantiation", + "start": 57, + "end": 63, + "loc": { + "start": { + "line": 2, + "column": 37 + }, + "end": { + "line": 2, + "column": 43 + } + }, + "params": [ + { + "type": "TSVoidKeyword", + "start": 58, + "end": 62, + "loc": { + "start": { + "line": 2, + "column": 38 + }, + "end": { + "line": 2, + "column": 42 + } + } + } + ] + } + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/class/declare-field-initializer/input.ts b/packages/babel-parser/test/fixtures/typescript/class/declare-field-initializer/input.ts new file mode 100644 index 000000000000..b77a17738bf5 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/class/declare-field-initializer/input.ts @@ -0,0 +1,3 @@ +class A { + declare bar: string = "test"; +} diff --git a/packages/babel-parser/test/fixtures/typescript/class/declare-field-initializer/output.json b/packages/babel-parser/test/fixtures/typescript/class/declare-field-initializer/output.json new file mode 100644 index 000000000000..fb27f3055064 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/class/declare-field-initializer/output.json @@ -0,0 +1,170 @@ +{ + "type": "File", + "start": 0, + "end": 43, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 43, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 43, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "A" + }, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 8, + "end": 43, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": [ + { + "type": "ClassProperty", + "start": 12, + "end": 41, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 31 + } + }, + "declare": true, + "static": false, + "key": { + "type": "Identifier", + "start": 20, + "end": 23, + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 13 + }, + "identifierName": "bar" + }, + "name": "bar" + }, + "computed": false, + "typeAnnotation": { + "type": "TSTypeAnnotation", + "start": 23, + "end": 31, + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 21 + } + }, + "typeAnnotation": { + "type": "TSStringKeyword", + "start": 25, + "end": 31, + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 21 + } + } + } + }, + "value": { + "type": "StringLiteral", + "start": 34, + "end": 40, + "loc": { + "start": { + "line": 2, + "column": 24 + }, + "end": { + "line": 2, + "column": 30 + } + }, + "extra": { + "rawValue": "test", + "raw": "\"test\"" + }, + "value": "test" + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/class/declare-field/input.ts b/packages/babel-parser/test/fixtures/typescript/class/declare-field/input.ts new file mode 100644 index 000000000000..a7a8b2d36280 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/class/declare-field/input.ts @@ -0,0 +1,4 @@ +class A { + declare foo; + declare bar: string; +} diff --git a/packages/babel-parser/test/fixtures/typescript/class/declare-field/output.json b/packages/babel-parser/test/fixtures/typescript/class/declare-field/output.json new file mode 100644 index 000000000000..746e2964f438 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/class/declare-field/output.json @@ -0,0 +1,187 @@ +{ + "type": "File", + "start": 0, + "end": 49, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 49, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 49, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "A" + }, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 8, + "end": 49, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "body": [ + { + "type": "ClassProperty", + "start": 12, + "end": 24, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "declare": true, + "static": false, + "key": { + "type": "Identifier", + "start": 20, + "end": 23, + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 13 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "computed": false, + "value": null + }, + { + "type": "ClassProperty", + "start": 27, + "end": 47, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 22 + } + }, + "declare": true, + "static": false, + "key": { + "type": "Identifier", + "start": 35, + "end": 38, + "loc": { + "start": { + "line": 3, + "column": 10 + }, + "end": { + "line": 3, + "column": 13 + }, + "identifierName": "bar" + }, + "name": "bar" + }, + "computed": false, + "typeAnnotation": { + "type": "TSTypeAnnotation", + "start": 38, + "end": 46, + "loc": { + "start": { + "line": 3, + "column": 13 + }, + "end": { + "line": 3, + "column": 21 + } + }, + "typeAnnotation": { + "type": "TSStringKeyword", + "start": 40, + "end": 46, + "loc": { + "start": { + "line": 3, + "column": 15 + }, + "end": { + "line": 3, + "column": 21 + } + } + } + }, + "value": null + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/class/declare-method/input.ts b/packages/babel-parser/test/fixtures/typescript/class/declare-method/input.ts new file mode 100644 index 000000000000..0e539a84a2a5 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/class/declare-method/input.ts @@ -0,0 +1,3 @@ +class A { + declare foo() {} +} diff --git a/packages/babel-parser/test/fixtures/typescript/class/declare-method/output.json b/packages/babel-parser/test/fixtures/typescript/class/declare-method/output.json new file mode 100644 index 000000000000..0219c43119d2 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/class/declare-method/output.json @@ -0,0 +1,145 @@ +{ + "type": "File", + "start": 0, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Class methods cannot have the 'declare' modifier (2:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "A" + }, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 8, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": [ + { + "type": "ClassMethod", + "start": 12, + "end": 28, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 18 + } + }, + "declare": true, + "static": false, + "key": { + "type": "Identifier", + "start": 20, + "end": 23, + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 13 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "computed": false, + "kind": "method", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 26, + "end": 28, + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 18 + } + }, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/class/extends-empty/options.json b/packages/babel-parser/test/fixtures/typescript/class/extends-empty/options.json deleted file mode 100644 index 3de0ab8596c4..000000000000 --- a/packages/babel-parser/test/fixtures/typescript/class/extends-empty/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "'extends' list cannot be empty. (1:22)" -} diff --git a/packages/babel-parser/test/fixtures/typescript/class/extends-empty/output.json b/packages/babel-parser/test/fixtures/typescript/class/extends-empty/output.json new file mode 100644 index 000000000000..0fe556a129e5 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/class/extends-empty/output.json @@ -0,0 +1,87 @@ +{ + "type": "File", + "start": 0, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 1 + } + }, + "errors": [ + "SyntaxError: 'extends' list cannot be empty. (1:22)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 1 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "TSInterfaceDeclaration", + "start": 0, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 10, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 13 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "extends": [], + "body": { + "type": "TSInterfaceBody", + "start": 22, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 2, + "column": 1 + } + }, + "body": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/class/extends-implements-empty/options.json b/packages/babel-parser/test/fixtures/typescript/class/extends-implements-empty/options.json deleted file mode 100644 index 950506446835..000000000000 --- a/packages/babel-parser/test/fixtures/typescript/class/extends-implements-empty/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "'implements' list cannot be empty. (1:33)" -} diff --git a/packages/babel-parser/test/fixtures/typescript/class/extends-implements-empty/output.json b/packages/babel-parser/test/fixtures/typescript/class/extends-implements-empty/output.json new file mode 100644 index 000000000000..a84755dbbeb5 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/class/extends-implements-empty/output.json @@ -0,0 +1,104 @@ +{ + "type": "File", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 1 + } + }, + "errors": [ + "SyntaxError: 'implements' list cannot be empty. (1:33)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 1 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 9 + }, + "identifierName": "Foo" + }, + "name": "Foo" + }, + "superClass": { + "type": "Identifier", + "start": 18, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 21 + }, + "identifierName": "Bar" + }, + "name": "Bar" + }, + "implements": [], + "body": { + "type": "ClassBody", + "start": 33, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 2, + "column": 1 + } + }, + "body": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/class/implements-empty/options.json b/packages/babel-parser/test/fixtures/typescript/class/implements-empty/options.json deleted file mode 100644 index 6751fbcc5443..000000000000 --- a/packages/babel-parser/test/fixtures/typescript/class/implements-empty/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "'implements' list cannot be empty. (1:21)" -} diff --git a/packages/babel-parser/test/fixtures/typescript/class/implements-empty/output.json b/packages/babel-parser/test/fixtures/typescript/class/implements-empty/output.json new file mode 100644 index 000000000000..bcf3445883b0 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/class/implements-empty/output.json @@ -0,0 +1,88 @@ +{ + "type": "File", + "start": 0, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 1 + } + }, + "errors": [ + "SyntaxError: 'implements' list cannot be empty. (1:21)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 1 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 9 + }, + "identifierName": "Foo" + }, + "name": "Foo" + }, + "superClass": null, + "implements": [], + "body": { + "type": "ClassBody", + "start": 21, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 2, + "column": 1 + } + }, + "body": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/class/method-readonly/options.json b/packages/babel-parser/test/fixtures/typescript/class/method-readonly/options.json deleted file mode 100644 index f7dd2e27ef2c..000000000000 --- a/packages/babel-parser/test/fixtures/typescript/class/method-readonly/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected token, expected \";\" (2:14)" -} diff --git a/packages/babel-parser/test/fixtures/typescript/class/method-readonly/output.json b/packages/babel-parser/test/fixtures/typescript/class/method-readonly/output.json new file mode 100644 index 000000000000..198e2e1cf0c9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/class/method-readonly/output.json @@ -0,0 +1,145 @@ +{ + "type": "File", + "start": 0, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Class methods cannot have the 'readonly' modifier (2:4)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "C" + }, + "name": "C" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 8, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": [ + { + "type": "ClassMethod", + "start": 14, + "end": 29, + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 19 + } + }, + "readonly": true, + "static": false, + "key": { + "type": "Identifier", + "start": 23, + "end": 24, + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 14 + }, + "identifierName": "m" + }, + "name": "m" + }, + "computed": false, + "kind": "method", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 27, + "end": 29, + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 19 + } + }, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/class/optional-async-error/input.js b/packages/babel-parser/test/fixtures/typescript/class/optional-async-error/input.js new file mode 100644 index 000000000000..01d6018a50d2 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/class/optional-async-error/input.js @@ -0,0 +1,4 @@ +class B { } +class A extends B { + async? method(val: string): Promise; +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/class/optional-async-error/options.json b/packages/babel-parser/test/fixtures/typescript/class/optional-async-error/options.json new file mode 100644 index 000000000000..03a7d3704a5b --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/class/optional-async-error/options.json @@ -0,0 +1,3 @@ +{ + "throws": "Unexpected token (3:9)" +} diff --git a/packages/babel-parser/test/fixtures/typescript/class/options.json b/packages/babel-parser/test/fixtures/typescript/class/options.json index 9f3a0c2c0ff1..fff045d3a491 100644 --- a/packages/babel-parser/test/fixtures/typescript/class/options.json +++ b/packages/babel-parser/test/fixtures/typescript/class/options.json @@ -1,4 +1,4 @@ { "sourceType": "module", - "plugins": ["typescript", "classProperties"] + "plugins": ["typescript", "classProperties", "classPrivateProperties"] } diff --git a/packages/babel-parser/test/fixtures/typescript/class/parameter-properties-binding-patterns/options.json b/packages/babel-parser/test/fixtures/typescript/class/parameter-properties-binding-patterns/options.json deleted file mode 100644 index b84b0421721a..000000000000 --- a/packages/babel-parser/test/fixtures/typescript/class/parameter-properties-binding-patterns/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "A parameter property may not be declared using a binding pattern. (2:16)" -} diff --git a/packages/babel-parser/test/fixtures/typescript/class/parameter-properties-binding-patterns/output.json b/packages/babel-parser/test/fixtures/typescript/class/parameter-properties-binding-patterns/output.json new file mode 100644 index 000000000000..9436fb7283a9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/class/parameter-properties-binding-patterns/output.json @@ -0,0 +1,177 @@ +{ + "type": "File", + "start": 0, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "errors": [ + "SyntaxError: A parameter property may not be declared using a binding pattern. (2:16)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "C" + }, + "name": "C" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 8, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": [ + { + "type": "ClassMethod", + "start": 14, + "end": 39, + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 29 + } + }, + "static": false, + "key": { + "type": "Identifier", + "start": 14, + "end": 25, + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 15 + }, + "identifierName": "constructor" + }, + "name": "constructor" + }, + "computed": false, + "kind": "constructor", + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "TSParameterProperty", + "start": 26, + "end": 35, + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 25 + } + }, + "accessibility": "public", + "parameter": { + "type": "ArrayPattern", + "start": 33, + "end": 35, + "loc": { + "start": { + "line": 2, + "column": 23 + }, + "end": { + "line": 2, + "column": 25 + } + }, + "elements": [] + } + } + ], + "body": { + "type": "BlockStatement", + "start": 37, + "end": 39, + "loc": { + "start": { + "line": 2, + "column": 27 + }, + "end": { + "line": 2, + "column": 29 + } + }, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/class/private-fields-modifier-abstract/input.ts b/packages/babel-parser/test/fixtures/typescript/class/private-fields-modifier-abstract/input.ts new file mode 100644 index 000000000000..7cf85ea5ec29 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/class/private-fields-modifier-abstract/input.ts @@ -0,0 +1,3 @@ +abstract class A { + abstract #a; +} diff --git a/packages/babel-parser/test/fixtures/typescript/class/private-fields-modifier-abstract/output.json b/packages/babel-parser/test/fixtures/typescript/class/private-fields-modifier-abstract/output.json new file mode 100644 index 000000000000..9107b0794815 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/class/private-fields-modifier-abstract/output.json @@ -0,0 +1,139 @@ +{ + "type": "File", + "start": 0, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Private elements cannot have the 'abstract' modifier. (2:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "abstract": true, + "id": { + "type": "Identifier", + "start": 15, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + }, + "identifierName": "A" + }, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 17, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": [ + { + "type": "ClassPrivateProperty", + "start": 21, + "end": 33, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "abstract": true, + "static": false, + "key": { + "type": "PrivateName", + "start": 30, + "end": 32, + "loc": { + "start": { + "line": 2, + "column": 11 + }, + "end": { + "line": 2, + "column": 13 + } + }, + "id": { + "type": "Identifier", + "start": 31, + "end": 32, + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 13 + }, + "identifierName": "a" + }, + "name": "a" + } + }, + "value": null + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/class/private-fields-modifier-private/input.ts b/packages/babel-parser/test/fixtures/typescript/class/private-fields-modifier-private/input.ts new file mode 100644 index 000000000000..a4472caceb86 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/class/private-fields-modifier-private/input.ts @@ -0,0 +1,3 @@ +class A { + private #a; +} diff --git a/packages/babel-parser/test/fixtures/typescript/class/private-fields-modifier-private/output.json b/packages/babel-parser/test/fixtures/typescript/class/private-fields-modifier-private/output.json new file mode 100644 index 000000000000..360a75b9f7a1 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/class/private-fields-modifier-private/output.json @@ -0,0 +1,138 @@ +{ + "type": "File", + "start": 0, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Private elements cannot have an accessibility modifier ('private') (2:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "A" + }, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 8, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": [ + { + "type": "ClassPrivateProperty", + "start": 12, + "end": 23, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 13 + } + }, + "accessibility": "private", + "static": false, + "key": { + "type": "PrivateName", + "start": 20, + "end": 22, + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 12 + } + }, + "id": { + "type": "Identifier", + "start": 21, + "end": 22, + "loc": { + "start": { + "line": 2, + "column": 11 + }, + "end": { + "line": 2, + "column": 12 + }, + "identifierName": "a" + }, + "name": "a" + } + }, + "value": null + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/class/private-fields-modifier-protected/input.ts b/packages/babel-parser/test/fixtures/typescript/class/private-fields-modifier-protected/input.ts new file mode 100644 index 000000000000..0f35b844a7be --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/class/private-fields-modifier-protected/input.ts @@ -0,0 +1,3 @@ +class A { + protected #a; +} diff --git a/packages/babel-parser/test/fixtures/typescript/class/private-fields-modifier-protected/output.json b/packages/babel-parser/test/fixtures/typescript/class/private-fields-modifier-protected/output.json new file mode 100644 index 000000000000..60afa0c3bc76 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/class/private-fields-modifier-protected/output.json @@ -0,0 +1,138 @@ +{ + "type": "File", + "start": 0, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Private elements cannot have an accessibility modifier ('protected') (2:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "A" + }, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 8, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": [ + { + "type": "ClassPrivateProperty", + "start": 12, + "end": 25, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 15 + } + }, + "accessibility": "protected", + "static": false, + "key": { + "type": "PrivateName", + "start": 22, + "end": 24, + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "id": { + "type": "Identifier", + "start": 23, + "end": 24, + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 14 + }, + "identifierName": "a" + }, + "name": "a" + } + }, + "value": null + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/class/private-fields-modifier-public/input.ts b/packages/babel-parser/test/fixtures/typescript/class/private-fields-modifier-public/input.ts new file mode 100644 index 000000000000..59a236000e60 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/class/private-fields-modifier-public/input.ts @@ -0,0 +1,3 @@ +class A { + public #a; +} diff --git a/packages/babel-parser/test/fixtures/typescript/class/private-fields-modifier-public/output.json b/packages/babel-parser/test/fixtures/typescript/class/private-fields-modifier-public/output.json new file mode 100644 index 000000000000..3f526e42418c --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/class/private-fields-modifier-public/output.json @@ -0,0 +1,138 @@ +{ + "type": "File", + "start": 0, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Private elements cannot have an accessibility modifier ('public') (2:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "A" + }, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 8, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": [ + { + "type": "ClassPrivateProperty", + "start": 12, + "end": 22, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 12 + } + }, + "accessibility": "public", + "static": false, + "key": { + "type": "PrivateName", + "start": 19, + "end": 21, + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 11 + } + }, + "id": { + "type": "Identifier", + "start": 20, + "end": 21, + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 11 + }, + "identifierName": "a" + }, + "name": "a" + } + }, + "value": null + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/class/private-fields-modifier-readonly/input.ts b/packages/babel-parser/test/fixtures/typescript/class/private-fields-modifier-readonly/input.ts new file mode 100644 index 000000000000..355def79b8b7 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/class/private-fields-modifier-readonly/input.ts @@ -0,0 +1,4 @@ +class A { + readonly #a; + readonly #b: string; +} diff --git a/packages/babel-parser/test/fixtures/typescript/class/private-fields-modifier-readonly/output.json b/packages/babel-parser/test/fixtures/typescript/class/private-fields-modifier-readonly/output.json new file mode 100644 index 000000000000..456ca59ae4ae --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/class/private-fields-modifier-readonly/output.json @@ -0,0 +1,215 @@ +{ + "type": "File", + "start": 0, + "end": 49, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 49, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 49, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "A" + }, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 8, + "end": 49, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "body": [ + { + "type": "ClassPrivateProperty", + "start": 12, + "end": 24, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "readonly": true, + "static": false, + "key": { + "type": "PrivateName", + "start": 21, + "end": 23, + "loc": { + "start": { + "line": 2, + "column": 11 + }, + "end": { + "line": 2, + "column": 13 + } + }, + "id": { + "type": "Identifier", + "start": 22, + "end": 23, + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 13 + }, + "identifierName": "a" + }, + "name": "a" + } + }, + "value": null + }, + { + "type": "ClassPrivateProperty", + "start": 27, + "end": 47, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 22 + } + }, + "readonly": true, + "static": false, + "key": { + "type": "PrivateName", + "start": 36, + "end": 38, + "loc": { + "start": { + "line": 3, + "column": 11 + }, + "end": { + "line": 3, + "column": 13 + } + }, + "id": { + "type": "Identifier", + "start": 37, + "end": 38, + "loc": { + "start": { + "line": 3, + "column": 12 + }, + "end": { + "line": 3, + "column": 13 + }, + "identifierName": "b" + }, + "name": "b" + } + }, + "typeAnnotation": { + "type": "TSTypeAnnotation", + "start": 38, + "end": 46, + "loc": { + "start": { + "line": 3, + "column": 13 + }, + "end": { + "line": 3, + "column": 21 + } + }, + "typeAnnotation": { + "type": "TSStringKeyword", + "start": 40, + "end": 46, + "loc": { + "start": { + "line": 3, + "column": 15 + }, + "end": { + "line": 3, + "column": 21 + } + } + } + }, + "value": null + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/class/private-fields-static/input.ts b/packages/babel-parser/test/fixtures/typescript/class/private-fields-static/input.ts new file mode 100644 index 000000000000..4725b09bea74 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/class/private-fields-static/input.ts @@ -0,0 +1,4 @@ +class A { + static #x; + static #y: string; +} diff --git a/packages/babel-parser/test/fixtures/typescript/class/private-fields-static/output.json b/packages/babel-parser/test/fixtures/typescript/class/private-fields-static/output.json new file mode 100644 index 000000000000..dcb6ab198f52 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/class/private-fields-static/output.json @@ -0,0 +1,213 @@ +{ + "type": "File", + "start": 0, + "end": 45, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 45, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 45, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "A" + }, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 8, + "end": 45, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "body": [ + { + "type": "ClassPrivateProperty", + "start": 12, + "end": 22, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 12 + } + }, + "static": true, + "key": { + "type": "PrivateName", + "start": 19, + "end": 21, + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 11 + } + }, + "id": { + "type": "Identifier", + "start": 20, + "end": 21, + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 11 + }, + "identifierName": "x" + }, + "name": "x" + } + }, + "value": null + }, + { + "type": "ClassPrivateProperty", + "start": 25, + "end": 43, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 20 + } + }, + "static": true, + "key": { + "type": "PrivateName", + "start": 32, + "end": 34, + "loc": { + "start": { + "line": 3, + "column": 9 + }, + "end": { + "line": 3, + "column": 11 + } + }, + "id": { + "type": "Identifier", + "start": 33, + "end": 34, + "loc": { + "start": { + "line": 3, + "column": 10 + }, + "end": { + "line": 3, + "column": 11 + }, + "identifierName": "y" + }, + "name": "y" + } + }, + "typeAnnotation": { + "type": "TSTypeAnnotation", + "start": 34, + "end": 42, + "loc": { + "start": { + "line": 3, + "column": 11 + }, + "end": { + "line": 3, + "column": 19 + } + }, + "typeAnnotation": { + "type": "TSStringKeyword", + "start": 36, + "end": 42, + "loc": { + "start": { + "line": 3, + "column": 13 + }, + "end": { + "line": 3, + "column": 19 + } + } + } + }, + "value": null + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/class/private-fields/input.ts b/packages/babel-parser/test/fixtures/typescript/class/private-fields/input.ts new file mode 100644 index 000000000000..30c6024e99ce --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/class/private-fields/input.ts @@ -0,0 +1,7 @@ +class A { + #a: string; + #b?; + #c?: number; + #d!; + #e!: boolean; +} diff --git a/packages/babel-parser/test/fixtures/typescript/class/private-fields/output.json b/packages/babel-parser/test/fixtures/typescript/class/private-fields/output.json new file mode 100644 index 000000000000..67a50c2c16ff --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/class/private-fields/output.json @@ -0,0 +1,424 @@ +{ + "type": "File", + "start": 0, + "end": 70, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 7, + "column": 1 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 70, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 7, + "column": 1 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 70, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 7, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "A" + }, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 8, + "end": 70, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 7, + "column": 1 + } + }, + "body": [ + { + "type": "ClassPrivateProperty", + "start": 12, + "end": 23, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 13 + } + }, + "static": false, + "key": { + "type": "PrivateName", + "start": 12, + "end": 14, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 4 + } + }, + "id": { + "type": "Identifier", + "start": 13, + "end": 14, + "loc": { + "start": { + "line": 2, + "column": 3 + }, + "end": { + "line": 2, + "column": 4 + }, + "identifierName": "a" + }, + "name": "a" + } + }, + "typeAnnotation": { + "type": "TSTypeAnnotation", + "start": 14, + "end": 22, + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 12 + } + }, + "typeAnnotation": { + "type": "TSStringKeyword", + "start": 16, + "end": 22, + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 12 + } + } + } + }, + "value": null + }, + { + "type": "ClassPrivateProperty", + "start": 26, + "end": 30, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 6 + } + }, + "static": false, + "key": { + "type": "PrivateName", + "start": 26, + "end": 28, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 4 + } + }, + "id": { + "type": "Identifier", + "start": 27, + "end": 28, + "loc": { + "start": { + "line": 3, + "column": 3 + }, + "end": { + "line": 3, + "column": 4 + }, + "identifierName": "b" + }, + "name": "b" + } + }, + "optional": true, + "value": null + }, + { + "type": "ClassPrivateProperty", + "start": 33, + "end": 45, + "loc": { + "start": { + "line": 4, + "column": 2 + }, + "end": { + "line": 4, + "column": 14 + } + }, + "static": false, + "key": { + "type": "PrivateName", + "start": 33, + "end": 35, + "loc": { + "start": { + "line": 4, + "column": 2 + }, + "end": { + "line": 4, + "column": 4 + } + }, + "id": { + "type": "Identifier", + "start": 34, + "end": 35, + "loc": { + "start": { + "line": 4, + "column": 3 + }, + "end": { + "line": 4, + "column": 4 + }, + "identifierName": "c" + }, + "name": "c" + } + }, + "optional": true, + "typeAnnotation": { + "type": "TSTypeAnnotation", + "start": 36, + "end": 44, + "loc": { + "start": { + "line": 4, + "column": 5 + }, + "end": { + "line": 4, + "column": 13 + } + }, + "typeAnnotation": { + "type": "TSNumberKeyword", + "start": 38, + "end": 44, + "loc": { + "start": { + "line": 4, + "column": 7 + }, + "end": { + "line": 4, + "column": 13 + } + } + } + }, + "value": null + }, + { + "type": "ClassPrivateProperty", + "start": 48, + "end": 52, + "loc": { + "start": { + "line": 5, + "column": 2 + }, + "end": { + "line": 5, + "column": 6 + } + }, + "static": false, + "key": { + "type": "PrivateName", + "start": 48, + "end": 50, + "loc": { + "start": { + "line": 5, + "column": 2 + }, + "end": { + "line": 5, + "column": 4 + } + }, + "id": { + "type": "Identifier", + "start": 49, + "end": 50, + "loc": { + "start": { + "line": 5, + "column": 3 + }, + "end": { + "line": 5, + "column": 4 + }, + "identifierName": "d" + }, + "name": "d" + } + }, + "definite": true, + "value": null + }, + { + "type": "ClassPrivateProperty", + "start": 55, + "end": 68, + "loc": { + "start": { + "line": 6, + "column": 2 + }, + "end": { + "line": 6, + "column": 15 + } + }, + "static": false, + "key": { + "type": "PrivateName", + "start": 55, + "end": 57, + "loc": { + "start": { + "line": 6, + "column": 2 + }, + "end": { + "line": 6, + "column": 4 + } + }, + "id": { + "type": "Identifier", + "start": 56, + "end": 57, + "loc": { + "start": { + "line": 6, + "column": 3 + }, + "end": { + "line": 6, + "column": 4 + }, + "identifierName": "e" + }, + "name": "e" + } + }, + "definite": true, + "typeAnnotation": { + "type": "TSTypeAnnotation", + "start": 58, + "end": 67, + "loc": { + "start": { + "line": 6, + "column": 5 + }, + "end": { + "line": 6, + "column": 14 + } + }, + "typeAnnotation": { + "type": "TSBooleanKeyword", + "start": 60, + "end": 67, + "loc": { + "start": { + "line": 6, + "column": 7 + }, + "end": { + "line": 6, + "column": 14 + } + } + } + }, + "value": null + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/const/reserved-word/options.json b/packages/babel-parser/test/fixtures/typescript/const/reserved-word/options.json index 93db7641c75b..2a28555f76db 100644 --- a/packages/babel-parser/test/fixtures/typescript/const/reserved-word/options.json +++ b/packages/babel-parser/test/fixtures/typescript/const/reserved-word/options.json @@ -1,3 +1,3 @@ { "throws": "Unexpected token (1:9)" -} \ No newline at end of file +} diff --git a/packages/babel-parser/test/fixtures/typescript/function/pattern-parameters/options.json b/packages/babel-parser/test/fixtures/typescript/function/pattern-parameters/options.json deleted file mode 100644 index fb2831d6188b..000000000000 --- a/packages/babel-parser/test/fixtures/typescript/function/pattern-parameters/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "A binding pattern parameter cannot be optional in an implementation signature. (1:11)" -} diff --git a/packages/babel-parser/test/fixtures/typescript/function/pattern-parameters/output.json b/packages/babel-parser/test/fixtures/typescript/function/pattern-parameters/output.json new file mode 100644 index 000000000000..3ef0fdc07d93 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/function/pattern-parameters/output.json @@ -0,0 +1,124 @@ +{ + "type": "File", + "start": 0, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "errors": [ + "SyntaxError: A binding pattern parameter cannot be optional in an implementation signature. (1:11)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + }, + "identifierName": "f" + }, + "name": "f" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "ArrayPattern", + "start": 11, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "elements": [], + "optional": true + }, + { + "type": "ObjectPattern", + "start": 16, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "properties": [] + } + ], + "body": { + "type": "BlockStatement", + "start": 20, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "body": [], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/function/predicate-types/output.json b/packages/babel-parser/test/fixtures/typescript/function/predicate-types/output.json index 85ab4987f1c2..90bae5b4ceda 100644 --- a/packages/babel-parser/test/fixtures/typescript/function/predicate-types/output.json +++ b/packages/babel-parser/test/fixtures/typescript/function/predicate-types/output.json @@ -127,12 +127,12 @@ }, "typeAnnotation": { "type": "TSTypePredicate", - "start": 20, + "start": 18, "end": 32, "loc": { "start": { "line": 1, - "column": 20 + "column": 18 }, "end": { "line": 1, @@ -302,12 +302,12 @@ }, "typeAnnotation": { "type": "TSTypePredicate", - "start": 55, + "start": 53, "end": 67, "loc": { "start": { "line": 2, - "column": 19 + "column": 17 }, "end": { "line": 2, diff --git a/packages/babel-parser/test/fixtures/typescript/import/export-named-import-require/input.ts b/packages/babel-parser/test/fixtures/typescript/import/export-named-import-require/input.ts new file mode 100644 index 000000000000..6823138bafd9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/import/export-named-import-require/input.ts @@ -0,0 +1,2 @@ +import a = require("a"); +export { a }; diff --git a/packages/babel-parser/test/fixtures/typescript/import/export-named-import-require/output.json b/packages/babel-parser/test/fixtures/typescript/import/export-named-import-require/output.json new file mode 100644 index 000000000000..4c31f00de348 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/import/export-named-import-require/output.json @@ -0,0 +1,171 @@ +{ + "type": "File", + "start": 0, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 13 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 13 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "TSImportEqualsDeclaration", + "start": 0, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "isExport": false, + "id": { + "type": "Identifier", + "start": 7, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + }, + "identifierName": "a" + }, + "name": "a" + }, + "moduleReference": { + "type": "TSExternalModuleReference", + "start": 11, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "expression": { + "type": "StringLiteral", + "start": 19, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "extra": { + "rawValue": "a", + "raw": "\"a\"" + }, + "value": "a" + } + } + }, + { + "type": "ExportNamedDeclaration", + "start": 25, + "end": 38, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 13 + } + }, + "specifiers": [ + { + "type": "ExportSpecifier", + "start": 34, + "end": 35, + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 10 + } + }, + "local": { + "type": "Identifier", + "start": 34, + "end": 35, + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 10 + }, + "identifierName": "a" + }, + "name": "a" + }, + "exported": { + "type": "Identifier", + "start": 34, + "end": 35, + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 10 + }, + "identifierName": "a" + }, + "name": "a" + } + } + ], + "source": null, + "declaration": null + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/module-namespace/top-level-await/input.ts b/packages/babel-parser/test/fixtures/typescript/module-namespace/top-level-await/input.ts new file mode 100644 index 000000000000..9302309c5933 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/module-namespace/top-level-await/input.ts @@ -0,0 +1,3 @@ +namespace N { + const x = await 42; +} diff --git a/packages/babel-parser/test/fixtures/typescript/module-namespace/top-level-await/options.json b/packages/babel-parser/test/fixtures/typescript/module-namespace/top-level-await/options.json new file mode 100644 index 000000000000..ba579946562a --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/module-namespace/top-level-await/options.json @@ -0,0 +1,8 @@ +{ + "sourceType": "module", + "plugins": [ + "typescript", + "topLevelAwait" + ], + "throws": "Unexpected token, expected \";\" (2:20)" +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/optional-chaining/type-arguments/input.ts b/packages/babel-parser/test/fixtures/typescript/optional-chaining/type-arguments/input.ts new file mode 100644 index 000000000000..731a05f63b36 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/optional-chaining/type-arguments/input.ts @@ -0,0 +1 @@ +example.inner?.greet() diff --git a/packages/babel-parser/test/fixtures/typescript/optional-chaining/type-arguments/options.json b/packages/babel-parser/test/fixtures/typescript/optional-chaining/type-arguments/options.json new file mode 100644 index 000000000000..fe9bffaa5e1a --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/optional-chaining/type-arguments/options.json @@ -0,0 +1,4 @@ +{ + "sourceType": "module", + "plugins": ["typescript"] +} diff --git a/packages/babel-parser/test/fixtures/typescript/optional-chaining/type-arguments/output.json b/packages/babel-parser/test/fixtures/typescript/optional-chaining/type-arguments/output.json new file mode 100644 index 000000000000..42f6c8b98b0e --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/optional-chaining/type-arguments/output.json @@ -0,0 +1,182 @@ +{ + "type": "File", + "start": 0, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "expression": { + "type": "OptionalCallExpression", + "start": 0, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "callee": { + "type": "OptionalMemberExpression", + "start": 0, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "object": { + "type": "MemberExpression", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "object": { + "type": "Identifier", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "example" + }, + "name": "example" + }, + "property": { + "type": "Identifier", + "start": 8, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 13 + }, + "identifierName": "inner" + }, + "name": "inner" + }, + "computed": false + }, + "property": { + "type": "Identifier", + "start": 15, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 20 + }, + "identifierName": "greet" + }, + "name": "greet" + }, + "computed": false, + "optional": true + }, + "arguments": [], + "typeParameters": { + "type": "TSTypeParameterInstantiation", + "start": 20, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "params": [ + { + "type": "TSStringKeyword", + "start": 21, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 27 + } + } + } + ] + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/scope/callable-class-ambient/input.ts b/packages/babel-parser/test/fixtures/typescript/scope/callable-class-ambient/input.ts new file mode 100644 index 000000000000..7714551a2449 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/scope/callable-class-ambient/input.ts @@ -0,0 +1,2 @@ +declare class C { } +declare function C(): void; diff --git a/packages/babel-parser/test/fixtures/typescript/scope/callable-class-ambient/output.json b/packages/babel-parser/test/fixtures/typescript/scope/callable-class-ambient/output.json new file mode 100644 index 000000000000..d62f3bba74be --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/scope/callable-class-ambient/output.json @@ -0,0 +1,151 @@ +{ + "type": "File", + "start": 0, + "end": 47, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 27 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 47, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 27 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "id": { + "type": "Identifier", + "start": 14, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + }, + "identifierName": "C" + }, + "name": "C" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 16, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "body": [] + }, + "declare": true + }, + { + "type": "TSDeclareFunction", + "start": 20, + "end": 47, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 27 + } + }, + "id": { + "type": "Identifier", + "start": 37, + "end": 38, + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 18 + }, + "identifierName": "C" + }, + "name": "C" + }, + "generator": false, + "async": false, + "params": [], + "returnType": { + "type": "TSTypeAnnotation", + "start": 40, + "end": 46, + "loc": { + "start": { + "line": 2, + "column": 20 + }, + "end": { + "line": 2, + "column": 26 + } + }, + "typeAnnotation": { + "type": "TSVoidKeyword", + "start": 42, + "end": 46, + "loc": { + "start": { + "line": 2, + "column": 22 + }, + "end": { + "line": 2, + "column": 26 + } + } + } + }, + "declare": true + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/scope/callable-class/input.ts b/packages/babel-parser/test/fixtures/typescript/scope/callable-class/input.ts new file mode 100644 index 000000000000..e54e510e93ff --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/scope/callable-class/input.ts @@ -0,0 +1,2 @@ +declare class C { } +function C() { } diff --git a/packages/babel-parser/test/fixtures/typescript/scope/callable-class/output.json b/packages/babel-parser/test/fixtures/typescript/scope/callable-class/output.json new file mode 100644 index 000000000000..205c683a029d --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/scope/callable-class/output.json @@ -0,0 +1,137 @@ +{ + "type": "File", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 16 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 16 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "declare": true, + "id": { + "type": "Identifier", + "start": 14, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + }, + "identifierName": "C" + }, + "name": "C" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 16, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "body": [] + } + }, + { + "type": "FunctionDeclaration", + "start": 20, + "end": 36, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 16 + } + }, + "id": { + "type": "Identifier", + "start": 29, + "end": 30, + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 10 + }, + "identifierName": "C" + }, + "name": "C" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 33, + "end": 36, + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 16 + } + }, + "body": [], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/scope/module-declaration-var-2/input.js b/packages/babel-parser/test/fixtures/typescript/scope/module-declaration-var-2/input.js new file mode 100644 index 000000000000..0cf66b421f31 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/scope/module-declaration-var-2/input.js @@ -0,0 +1,5 @@ +declare class foo { +} +module bar { + export var foo: any; +} diff --git a/packages/babel-parser/test/fixtures/typescript/scope/module-declaration-var-2/output.json b/packages/babel-parser/test/fixtures/typescript/scope/module-declaration-var-2/output.json new file mode 100644 index 000000000000..9bb0caf6808d --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/scope/module-declaration-var-2/output.json @@ -0,0 +1,232 @@ +{ + "type": "File", + "start": 0, + "end": 59, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 59, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 14, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 17 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 18, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 2, + "column": 1 + } + }, + "body": [] + }, + "declare": true + }, + { + "type": "TSModuleDeclaration", + "start": 22, + "end": 59, + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 29, + "end": 32, + "loc": { + "start": { + "line": 3, + "column": 7 + }, + "end": { + "line": 3, + "column": 10 + }, + "identifierName": "bar" + }, + "name": "bar" + }, + "body": { + "type": "TSModuleBlock", + "start": 33, + "end": 59, + "loc": { + "start": { + "line": 3, + "column": 11 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "body": [ + { + "type": "ExportNamedDeclaration", + "start": 37, + "end": 57, + "loc": { + "start": { + "line": 4, + "column": 2 + }, + "end": { + "line": 4, + "column": 22 + } + }, + "specifiers": [], + "source": null, + "declaration": { + "type": "VariableDeclaration", + "start": 44, + "end": 57, + "loc": { + "start": { + "line": 4, + "column": 9 + }, + "end": { + "line": 4, + "column": 22 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 48, + "end": 56, + "loc": { + "start": { + "line": 4, + "column": 13 + }, + "end": { + "line": 4, + "column": 21 + } + }, + "id": { + "type": "Identifier", + "start": 48, + "end": 56, + "loc": { + "start": { + "line": 4, + "column": 13 + }, + "end": { + "line": 4, + "column": 21 + }, + "identifierName": "foo" + }, + "name": "foo", + "typeAnnotation": { + "type": "TSTypeAnnotation", + "start": 51, + "end": 56, + "loc": { + "start": { + "line": 4, + "column": 16 + }, + "end": { + "line": 4, + "column": 21 + } + }, + "typeAnnotation": { + "type": "TSAnyKeyword", + "start": 53, + "end": 56, + "loc": { + "start": { + "line": 4, + "column": 18 + }, + "end": { + "line": 4, + "column": 21 + } + } + } + } + }, + "init": null + } + ], + "kind": "var" + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/scope/module-declaration-var/input.js b/packages/babel-parser/test/fixtures/typescript/scope/module-declaration-var/input.js new file mode 100644 index 000000000000..237ff39e1579 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/scope/module-declaration-var/input.js @@ -0,0 +1,5 @@ +declare class foo { +} +declare module 'bar' { + export var foo: any; +} diff --git a/packages/babel-parser/test/fixtures/typescript/scope/module-declaration-var/output.json b/packages/babel-parser/test/fixtures/typescript/scope/module-declaration-var/output.json new file mode 100644 index 000000000000..77f4b16a6ac7 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/scope/module-declaration-var/output.json @@ -0,0 +1,236 @@ +{ + "type": "File", + "start": 0, + "end": 69, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 69, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 14, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 17 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 18, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 2, + "column": 1 + } + }, + "body": [] + }, + "declare": true + }, + { + "type": "TSModuleDeclaration", + "start": 22, + "end": 69, + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "id": { + "type": "StringLiteral", + "start": 37, + "end": 42, + "loc": { + "start": { + "line": 3, + "column": 15 + }, + "end": { + "line": 3, + "column": 20 + } + }, + "extra": { + "rawValue": "bar", + "raw": "'bar'" + }, + "value": "bar" + }, + "body": { + "type": "TSModuleBlock", + "start": 43, + "end": 69, + "loc": { + "start": { + "line": 3, + "column": 21 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "body": [ + { + "type": "ExportNamedDeclaration", + "start": 47, + "end": 67, + "loc": { + "start": { + "line": 4, + "column": 2 + }, + "end": { + "line": 4, + "column": 22 + } + }, + "specifiers": [], + "source": null, + "declaration": { + "type": "VariableDeclaration", + "start": 54, + "end": 67, + "loc": { + "start": { + "line": 4, + "column": 9 + }, + "end": { + "line": 4, + "column": 22 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 58, + "end": 66, + "loc": { + "start": { + "line": 4, + "column": 13 + }, + "end": { + "line": 4, + "column": 21 + } + }, + "id": { + "type": "Identifier", + "start": 58, + "end": 66, + "loc": { + "start": { + "line": 4, + "column": 13 + }, + "end": { + "line": 4, + "column": 21 + }, + "identifierName": "foo" + }, + "name": "foo", + "typeAnnotation": { + "type": "TSTypeAnnotation", + "start": 61, + "end": 66, + "loc": { + "start": { + "line": 4, + "column": 16 + }, + "end": { + "line": 4, + "column": 21 + } + }, + "typeAnnotation": { + "type": "TSAnyKeyword", + "start": 63, + "end": 66, + "loc": { + "start": { + "line": 4, + "column": 18 + }, + "end": { + "line": 4, + "column": 21 + } + } + } + } + }, + "init": null + } + ], + "kind": "var" + } + } + ] + }, + "declare": true + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-class-class/options.json b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-class-class/options.json deleted file mode 100644 index 336686170eb0..000000000000 --- a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-class-class/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'A' has already been declared (2:6)" -} diff --git a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-class-class/output.json b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-class-class/output.json new file mode 100644 index 000000000000..5642df62a53c --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-class-class/output.json @@ -0,0 +1,136 @@ +{ + "type": "File", + "start": 0, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 10 + } + }, + "errors": [ + "SyntaxError: Identifier 'A' has already been declared (2:6)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 10 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "A" + }, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 8, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "body": [] + } + }, + { + "type": "ClassDeclaration", + "start": 11, + "end": 21, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 10 + } + }, + "id": { + "type": "Identifier", + "start": 17, + "end": 18, + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 7 + }, + "identifierName": "A" + }, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 19, + "end": 21, + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 10 + } + }, + "body": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-class-enum/options.json b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-class-enum/options.json deleted file mode 100644 index 1eed93f49a0e..000000000000 --- a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-class-enum/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'A' has already been declared (2:5)" -} diff --git a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-class-enum/output.json b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-class-enum/output.json new file mode 100644 index 000000000000..6d6bbe962695 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-class-enum/output.json @@ -0,0 +1,120 @@ +{ + "type": "File", + "start": 0, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 9 + } + }, + "errors": [ + "SyntaxError: Identifier 'A' has already been declared (2:5)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 9 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "A" + }, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 8, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "body": [] + } + }, + { + "type": "TSEnumDeclaration", + "start": 11, + "end": 20, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 9 + } + }, + "id": { + "type": "Identifier", + "start": 16, + "end": 17, + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 6 + }, + "identifierName": "A" + }, + "name": "A" + }, + "members": [] + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-class-type/options.json b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-class-type/options.json deleted file mode 100644 index 1eed93f49a0e..000000000000 --- a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-class-type/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'A' has already been declared (2:5)" -} diff --git a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-class-type/output.json b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-class-type/output.json new file mode 100644 index 000000000000..c6886d19470d --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-class-type/output.json @@ -0,0 +1,134 @@ +{ + "type": "File", + "start": 0, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 16 + } + }, + "errors": [ + "SyntaxError: Identifier 'A' has already been declared (2:5)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 16 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "A" + }, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 8, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "body": [] + } + }, + { + "type": "TSTypeAliasDeclaration", + "start": 11, + "end": 27, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 16 + } + }, + "id": { + "type": "Identifier", + "start": 16, + "end": 17, + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 6 + }, + "identifierName": "A" + }, + "name": "A" + }, + "typeAnnotation": { + "type": "TSNumberKeyword", + "start": 20, + "end": 26, + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 15 + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-constenum-enum/options.json b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-constenum-enum/options.json deleted file mode 100644 index ee82975e59a3..000000000000 --- a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-constenum-enum/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'X' has already been declared (2:5)" -} diff --git a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-constenum-enum/output.json b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-constenum-enum/output.json new file mode 100644 index 000000000000..b6b67ebef96c --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-constenum-enum/output.json @@ -0,0 +1,105 @@ +{ + "type": "File", + "start": 0, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 9 + } + }, + "errors": [ + "SyntaxError: Identifier 'X' has already been declared (2:5)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 9 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "TSEnumDeclaration", + "start": 0, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "const": true, + "id": { + "type": "Identifier", + "start": 11, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + }, + "identifierName": "X" + }, + "name": "X" + }, + "members": [] + }, + { + "type": "TSEnumDeclaration", + "start": 16, + "end": 25, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 9 + } + }, + "id": { + "type": "Identifier", + "start": 21, + "end": 22, + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 6 + }, + "identifierName": "X" + }, + "name": "X" + }, + "members": [] + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-enum-class/options.json b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-enum-class/options.json deleted file mode 100644 index 69462b29a995..000000000000 --- a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-enum-class/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'X' has already been declared (2:6)" -} diff --git a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-enum-class/output.json b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-enum-class/output.json new file mode 100644 index 000000000000..8518fac0e7e9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-enum-class/output.json @@ -0,0 +1,120 @@ +{ + "type": "File", + "start": 0, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 10 + } + }, + "errors": [ + "SyntaxError: Identifier 'X' has already been declared (2:6)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 10 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "TSEnumDeclaration", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "id": { + "type": "Identifier", + "start": 5, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + }, + "identifierName": "X" + }, + "name": "X" + }, + "members": [] + }, + { + "type": "ClassDeclaration", + "start": 10, + "end": 20, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 10 + } + }, + "id": { + "type": "Identifier", + "start": 16, + "end": 17, + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 7 + }, + "identifierName": "X" + }, + "name": "X" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 18, + "end": 20, + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 10 + } + }, + "body": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-enum-constenum/options.json b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-enum-constenum/options.json deleted file mode 100644 index c77fcb7927ac..000000000000 --- a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-enum-constenum/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'X' has already been declared (2:11)" -} diff --git a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-enum-constenum/output.json b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-enum-constenum/output.json new file mode 100644 index 000000000000..8a9778e36851 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-enum-constenum/output.json @@ -0,0 +1,105 @@ +{ + "type": "File", + "start": 0, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 15 + } + }, + "errors": [ + "SyntaxError: Identifier 'X' has already been declared (2:11)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 15 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "TSEnumDeclaration", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "id": { + "type": "Identifier", + "start": 5, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + }, + "identifierName": "X" + }, + "name": "X" + }, + "members": [] + }, + { + "type": "TSEnumDeclaration", + "start": 10, + "end": 25, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 15 + } + }, + "const": true, + "id": { + "type": "Identifier", + "start": 21, + "end": 22, + "loc": { + "start": { + "line": 2, + "column": 11 + }, + "end": { + "line": 2, + "column": 12 + }, + "identifierName": "X" + }, + "name": "X" + }, + "members": [] + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-enum-function/options.json b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-enum-function/options.json deleted file mode 100644 index ee47ddce75a8..000000000000 --- a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-enum-function/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'Foo' has already been declared (2:9)" -} diff --git a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-enum-function/output.json b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-enum-function/output.json new file mode 100644 index 000000000000..ab31065f580b --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-enum-function/output.json @@ -0,0 +1,123 @@ +{ + "type": "File", + "start": 0, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 17 + } + }, + "errors": [ + "SyntaxError: Identifier 'Foo' has already been declared (2:9)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 17 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "TSEnumDeclaration", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "id": { + "type": "Identifier", + "start": 5, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 8 + }, + "identifierName": "Foo" + }, + "name": "Foo" + }, + "members": [] + }, + { + "type": "FunctionDeclaration", + "start": 12, + "end": 29, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 17 + } + }, + "id": { + "type": "Identifier", + "start": 21, + "end": 24, + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 12 + }, + "identifierName": "Foo" + }, + "name": "Foo" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 27, + "end": 29, + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 17 + } + }, + "body": [], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-enum-interface/options.json b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-enum-interface/options.json deleted file mode 100644 index a5f623f4e212..000000000000 --- a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-enum-interface/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'X' has already been declared (2:10)" -} diff --git a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-enum-interface/output.json b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-enum-interface/output.json new file mode 100644 index 000000000000..80905a927dc9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-enum-interface/output.json @@ -0,0 +1,119 @@ +{ + "type": "File", + "start": 0, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "errors": [ + "SyntaxError: Identifier 'X' has already been declared (2:10)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "TSEnumDeclaration", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "id": { + "type": "Identifier", + "start": 5, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + }, + "identifierName": "X" + }, + "name": "X" + }, + "members": [] + }, + { + "type": "TSInterfaceDeclaration", + "start": 10, + "end": 24, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "id": { + "type": "Identifier", + "start": 20, + "end": 21, + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 11 + }, + "identifierName": "X" + }, + "name": "X" + }, + "body": { + "type": "TSInterfaceBody", + "start": 22, + "end": 24, + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "body": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-enum-let/options.json b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-enum-let/options.json deleted file mode 100644 index 4172f917bdb1..000000000000 --- a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-enum-let/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'Foo' has already been declared (2:4)" -} diff --git a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-enum-let/output.json b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-enum-let/output.json new file mode 100644 index 000000000000..4f8b4783578a --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-enum-let/output.json @@ -0,0 +1,122 @@ +{ + "type": "File", + "start": 0, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 8 + } + }, + "errors": [ + "SyntaxError: Identifier 'Foo' has already been declared (2:4)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 8 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "TSEnumDeclaration", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "id": { + "type": "Identifier", + "start": 5, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 8 + }, + "identifierName": "Foo" + }, + "name": "Foo" + }, + "members": [] + }, + { + "type": "VariableDeclaration", + "start": 12, + "end": 20, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 8 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 16, + "end": 19, + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 7 + } + }, + "id": { + "type": "Identifier", + "start": 16, + "end": 19, + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 7 + }, + "identifierName": "Foo" + }, + "name": "Foo" + }, + "init": null + } + ], + "kind": "let" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-enum-type/options.json b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-enum-type/options.json deleted file mode 100644 index ee82975e59a3..000000000000 --- a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-enum-type/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'X' has already been declared (2:5)" -} diff --git a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-enum-type/output.json b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-enum-type/output.json new file mode 100644 index 000000000000..e347d9e0a548 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-enum-type/output.json @@ -0,0 +1,118 @@ +{ + "type": "File", + "start": 0, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 16 + } + }, + "errors": [ + "SyntaxError: Identifier 'X' has already been declared (2:5)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 16 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "TSEnumDeclaration", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "id": { + "type": "Identifier", + "start": 5, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + }, + "identifierName": "X" + }, + "name": "X" + }, + "members": [] + }, + { + "type": "TSTypeAliasDeclaration", + "start": 10, + "end": 26, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 16 + } + }, + "id": { + "type": "Identifier", + "start": 15, + "end": 16, + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 6 + }, + "identifierName": "X" + }, + "name": "X" + }, + "typeAnnotation": { + "type": "TSNumberKeyword", + "start": 19, + "end": 25, + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 15 + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-enum-var/options.json b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-enum-var/options.json deleted file mode 100644 index 4172f917bdb1..000000000000 --- a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-enum-var/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'Foo' has already been declared (2:4)" -} diff --git a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-enum-var/output.json b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-enum-var/output.json new file mode 100644 index 000000000000..4f8b4783578a --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-enum-var/output.json @@ -0,0 +1,122 @@ +{ + "type": "File", + "start": 0, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 8 + } + }, + "errors": [ + "SyntaxError: Identifier 'Foo' has already been declared (2:4)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 8 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "TSEnumDeclaration", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "id": { + "type": "Identifier", + "start": 5, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 8 + }, + "identifierName": "Foo" + }, + "name": "Foo" + }, + "members": [] + }, + { + "type": "VariableDeclaration", + "start": 12, + "end": 20, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 8 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 16, + "end": 19, + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 7 + } + }, + "id": { + "type": "Identifier", + "start": 16, + "end": 19, + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 7 + }, + "identifierName": "Foo" + }, + "name": "Foo" + }, + "init": null + } + ], + "kind": "let" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-function-enum/options.json b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-function-enum/options.json deleted file mode 100644 index 92349410e8cf..000000000000 --- a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-function-enum/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'Foo' has already been declared (2:5)" -} diff --git a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-function-enum/output.json b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-function-enum/output.json new file mode 100644 index 000000000000..c8a1a8f8dc65 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-function-enum/output.json @@ -0,0 +1,123 @@ +{ + "type": "File", + "start": 0, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 11 + } + }, + "errors": [ + "SyntaxError: Identifier 'Foo' has already been declared (2:5)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 11 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 12 + }, + "identifierName": "Foo" + }, + "name": "Foo" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 15, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "body": [], + "directives": [] + } + }, + { + "type": "TSEnumDeclaration", + "start": 18, + "end": 29, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 11 + } + }, + "id": { + "type": "Identifier", + "start": 23, + "end": 26, + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 8 + }, + "identifierName": "Foo" + }, + "name": "Foo" + }, + "members": [] + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-import-ambient-class/input.ts b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-import-ambient-class/input.ts new file mode 100644 index 000000000000..e57fcdb01a82 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-import-ambient-class/input.ts @@ -0,0 +1,3 @@ +import Something from './somewhere.js' + +declare class Something {} diff --git a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-import-ambient-class/output.json b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-import-ambient-class/output.json new file mode 100644 index 000000000000..fe9e84eee59d --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-import-ambient-class/output.json @@ -0,0 +1,154 @@ +{ + "type": "File", + "start": 0, + "end": 66, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 26 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 66, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 26 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ImportDeclaration", + "start": 0, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 38 + } + }, + "specifiers": [ + { + "type": "ImportDefaultSpecifier", + "start": 7, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "local": { + "type": "Identifier", + "start": 7, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 16 + }, + "identifierName": "Something" + }, + "name": "Something" + } + } + ], + "source": { + "type": "StringLiteral", + "start": 22, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 38 + } + }, + "extra": { + "rawValue": "./somewhere.js", + "raw": "'./somewhere.js'" + }, + "value": "./somewhere.js" + } + }, + { + "type": "ClassDeclaration", + "start": 40, + "end": 66, + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 26 + } + }, + "declare": true, + "id": { + "type": "Identifier", + "start": 54, + "end": 63, + "loc": { + "start": { + "line": 3, + "column": 14 + }, + "end": { + "line": 3, + "column": 23 + }, + "identifierName": "Something" + }, + "name": "Something" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 64, + "end": 66, + "loc": { + "start": { + "line": 3, + "column": 24 + }, + "end": { + "line": 3, + "column": 26 + } + }, + "body": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-interface-enum/options.json b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-interface-enum/options.json deleted file mode 100644 index ee82975e59a3..000000000000 --- a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-interface-enum/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'X' has already been declared (2:5)" -} diff --git a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-interface-enum/output.json b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-interface-enum/output.json new file mode 100644 index 000000000000..63b26bca4458 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-interface-enum/output.json @@ -0,0 +1,119 @@ +{ + "type": "File", + "start": 0, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 9 + } + }, + "errors": [ + "SyntaxError: Identifier 'X' has already been declared (2:5)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 9 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "TSInterfaceDeclaration", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "id": { + "type": "Identifier", + "start": 10, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + }, + "identifierName": "X" + }, + "name": "X" + }, + "body": { + "type": "TSInterfaceBody", + "start": 12, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "body": [] + } + }, + { + "type": "TSEnumDeclaration", + "start": 15, + "end": 24, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 9 + } + }, + "id": { + "type": "Identifier", + "start": 20, + "end": 21, + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 6 + }, + "identifierName": "X" + }, + "name": "X" + }, + "members": [] + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-let-enum/options.json b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-let-enum/options.json deleted file mode 100644 index 92349410e8cf..000000000000 --- a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-let-enum/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'Foo' has already been declared (2:5)" -} diff --git a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-let-enum/output.json b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-let-enum/output.json new file mode 100644 index 000000000000..1c1cfb5c1696 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-let-enum/output.json @@ -0,0 +1,122 @@ +{ + "type": "File", + "start": 0, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 11 + } + }, + "errors": [ + "SyntaxError: Identifier 'Foo' has already been declared (2:5)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 11 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 4, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "id": { + "type": "Identifier", + "start": 4, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "Foo" + }, + "name": "Foo" + }, + "init": null + } + ], + "kind": "let" + }, + { + "type": "TSEnumDeclaration", + "start": 9, + "end": 20, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 11 + } + }, + "id": { + "type": "Identifier", + "start": 14, + "end": 17, + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 8 + }, + "identifierName": "Foo" + }, + "name": "Foo" + }, + "members": [] + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-type-class/options.json b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-type-class/options.json deleted file mode 100644 index 336686170eb0..000000000000 --- a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-type-class/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'A' has already been declared (2:6)" -} diff --git a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-type-class/output.json b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-type-class/output.json new file mode 100644 index 000000000000..3e63a0f7f298 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-type-class/output.json @@ -0,0 +1,134 @@ +{ + "type": "File", + "start": 0, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 10 + } + }, + "errors": [ + "SyntaxError: Identifier 'A' has already been declared (2:6)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 10 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "TSTypeAliasDeclaration", + "start": 0, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "id": { + "type": "Identifier", + "start": 5, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + }, + "identifierName": "A" + }, + "name": "A" + }, + "typeAnnotation": { + "type": "TSNumberKeyword", + "start": 9, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 15 + } + } + } + }, + { + "type": "ClassDeclaration", + "start": 17, + "end": 27, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 10 + } + }, + "id": { + "type": "Identifier", + "start": 23, + "end": 24, + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 7 + }, + "identifierName": "A" + }, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 25, + "end": 27, + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 10 + } + }, + "body": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-type-enum/options.json b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-type-enum/options.json deleted file mode 100644 index 1eed93f49a0e..000000000000 --- a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-type-enum/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'A' has already been declared (2:5)" -} diff --git a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-type-enum/output.json b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-type-enum/output.json new file mode 100644 index 000000000000..ba27b683a4b7 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-type-enum/output.json @@ -0,0 +1,118 @@ +{ + "type": "File", + "start": 0, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 9 + } + }, + "errors": [ + "SyntaxError: Identifier 'A' has already been declared (2:5)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 9 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "TSTypeAliasDeclaration", + "start": 0, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "id": { + "type": "Identifier", + "start": 5, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + }, + "identifierName": "A" + }, + "name": "A" + }, + "typeAnnotation": { + "type": "TSNumberKeyword", + "start": 9, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 15 + } + } + } + }, + { + "type": "TSEnumDeclaration", + "start": 17, + "end": 26, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 9 + } + }, + "id": { + "type": "Identifier", + "start": 22, + "end": 23, + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 6 + }, + "identifierName": "A" + }, + "name": "A" + }, + "members": [] + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-type-interface/options.json b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-type-interface/options.json deleted file mode 100644 index 04242bd1565b..000000000000 --- a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-type-interface/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'A' has already been declared (2:10)" -} diff --git a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-type-interface/output.json b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-type-interface/output.json new file mode 100644 index 000000000000..4983be36642d --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-type-interface/output.json @@ -0,0 +1,133 @@ +{ + "type": "File", + "start": 0, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "errors": [ + "SyntaxError: Identifier 'A' has already been declared (2:10)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "TSTypeAliasDeclaration", + "start": 0, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "id": { + "type": "Identifier", + "start": 5, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + }, + "identifierName": "A" + }, + "name": "A" + }, + "typeAnnotation": { + "type": "TSNumberKeyword", + "start": 9, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 15 + } + } + } + }, + { + "type": "TSInterfaceDeclaration", + "start": 17, + "end": 31, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "id": { + "type": "Identifier", + "start": 27, + "end": 28, + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 11 + }, + "identifierName": "A" + }, + "name": "A" + }, + "body": { + "type": "TSInterfaceBody", + "start": 29, + "end": 31, + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "body": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-type-type/options.json b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-type-type/options.json deleted file mode 100644 index 1eed93f49a0e..000000000000 --- a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-type-type/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'A' has already been declared (2:5)" -} diff --git a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-type-type/output.json b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-type-type/output.json new file mode 100644 index 000000000000..02fde75620f0 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-type-type/output.json @@ -0,0 +1,132 @@ +{ + "type": "File", + "start": 0, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 16 + } + }, + "errors": [ + "SyntaxError: Identifier 'A' has already been declared (2:5)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 16 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "TSTypeAliasDeclaration", + "start": 0, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "id": { + "type": "Identifier", + "start": 5, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + }, + "identifierName": "A" + }, + "name": "A" + }, + "typeAnnotation": { + "type": "TSNumberKeyword", + "start": 9, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 15 + } + } + } + }, + { + "type": "TSTypeAliasDeclaration", + "start": 17, + "end": 33, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 16 + } + }, + "id": { + "type": "Identifier", + "start": 22, + "end": 23, + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 6 + }, + "identifierName": "A" + }, + "name": "A" + }, + "typeAnnotation": { + "type": "TSStringKeyword", + "start": 26, + "end": 32, + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 15 + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-var-enum/options.json b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-var-enum/options.json deleted file mode 100644 index 92349410e8cf..000000000000 --- a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-var-enum/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'Foo' has already been declared (2:5)" -} diff --git a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-var-enum/output.json b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-var-enum/output.json new file mode 100644 index 000000000000..1c1cfb5c1696 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-var-enum/output.json @@ -0,0 +1,122 @@ +{ + "type": "File", + "start": 0, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 11 + } + }, + "errors": [ + "SyntaxError: Identifier 'Foo' has already been declared (2:5)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 11 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 4, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "id": { + "type": "Identifier", + "start": 4, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "Foo" + }, + "name": "Foo" + }, + "init": null + } + ], + "kind": "let" + }, + { + "type": "TSEnumDeclaration", + "start": 9, + "end": 20, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 11 + } + }, + "id": { + "type": "Identifier", + "start": 14, + "end": 17, + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 8 + }, + "identifierName": "Foo" + }, + "name": "Foo" + }, + "members": [] + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/types/literal-string-2/options.json b/packages/babel-parser/test/fixtures/typescript/types/literal-string-2/options.json deleted file mode 100644 index 3c001f6afda6..000000000000 --- a/packages/babel-parser/test/fixtures/typescript/types/literal-string-2/options.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "sourceType": "module", - "plugins": [ - "typescript" - ], - "throws": "Template literal types cannot have any substitution (1:14)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/types/literal-string-2/output.json b/packages/babel-parser/test/fixtures/typescript/types/literal-string-2/output.json new file mode 100644 index 000000000000..ee3c9e5da012 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/types/literal-string-2/output.json @@ -0,0 +1,195 @@ +{ + "type": "File", + "start": 0, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "errors": [ + "SyntaxError: Template literal types cannot have any substitution (1:14)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 0, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 4, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "id": { + "type": "Identifier", + "start": 4, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 19 + }, + "identifierName": "x" + }, + "name": "x", + "typeAnnotation": { + "type": "TSTypeAnnotation", + "start": 5, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "typeAnnotation": { + "type": "TSLiteralType", + "start": 7, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "literal": { + "type": "TemplateLiteral", + "start": 7, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "expressions": [ + { + "type": "Identifier", + "start": 14, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 17 + }, + "identifierName": "bar" + }, + "name": "bar" + } + ], + "quasis": [ + { + "type": "TemplateElement", + "start": 8, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "value": { + "raw": "foo-", + "cooked": "foo-" + }, + "tail": false + }, + { + "type": "TemplateElement", + "start": 18, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "value": { + "raw": "", + "cooked": "" + }, + "tail": true + } + ] + } + } + } + }, + "init": null + } + ], + "kind": "let" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/types/read-only-1/options.json b/packages/babel-parser/test/fixtures/typescript/types/read-only-1/options.json deleted file mode 100644 index 0a91d0015278..000000000000 --- a/packages/babel-parser/test/fixtures/typescript/types/read-only-1/options.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "sourceType": "module", - "plugins": ["typescript"], - "throws": "'readonly' type modifier is only permitted on array and tuple literal types. (1:11)" -} diff --git a/packages/babel-parser/test/fixtures/typescript/types/read-only-1/output.json b/packages/babel-parser/test/fixtures/typescript/types/read-only-1/output.json new file mode 100644 index 000000000000..ced722e79dd3 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/types/read-only-1/output.json @@ -0,0 +1,137 @@ +{ + "type": "File", + "start": 0, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "errors": [ + "SyntaxError: 'readonly' type modifier is only permitted on array and tuple literal types. (1:11)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "TSTypeAliasDeclaration", + "start": 0, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "id": { + "type": "Identifier", + "start": 5, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 8 + }, + "identifierName": "T30" + }, + "name": "T30" + }, + "typeAnnotation": { + "type": "TSTypeOperator", + "start": 11, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "operator": "readonly", + "typeAnnotation": { + "type": "TSStringKeyword", + "start": 20, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 26 + } + } + } + }, + "trailingComments": [ + { + "type": "CommentLine", + "value": " Error", + "start": 29, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 37 + } + } + } + ] + } + ], + "directives": [] + }, + "comments": [ + { + "type": "CommentLine", + "value": " Error", + "start": 29, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 37 + } + } + } + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/types/read-only-2/options.json b/packages/babel-parser/test/fixtures/typescript/types/read-only-2/options.json deleted file mode 100644 index cdb818eee9b2..000000000000 --- a/packages/babel-parser/test/fixtures/typescript/types/read-only-2/options.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "sourceType": "module", - "plugins": [ - "typescript" - ], - "throws": "'readonly' type modifier is only permitted on array and tuple literal types. (1:11)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/types/read-only-2/output.json b/packages/babel-parser/test/fixtures/typescript/types/read-only-2/output.json new file mode 100644 index 000000000000..73c4d7d4cd3f --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/types/read-only-2/output.json @@ -0,0 +1,154 @@ +{ + "type": "File", + "start": 0, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "errors": [ + "SyntaxError: 'readonly' type modifier is only permitted on array and tuple literal types. (1:11)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "TSTypeAliasDeclaration", + "start": 0, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "id": { + "type": "Identifier", + "start": 5, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 8 + }, + "identifierName": "T31" + }, + "name": "T31" + }, + "typeAnnotation": { + "type": "TSTypeOperator", + "start": 11, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "operator": "readonly", + "typeAnnotation": { + "type": "TSTypeReference", + "start": 20, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "typeName": { + "type": "Identifier", + "start": 20, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + }, + "identifierName": "T" + }, + "name": "T" + } + } + }, + "trailingComments": [ + { + "type": "CommentLine", + "value": " Error", + "start": 24, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 32 + } + } + } + ] + } + ], + "directives": [] + }, + "comments": [ + { + "type": "CommentLine", + "value": " Error", + "start": 24, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 32 + } + } + } + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/types/read-only-3/options.json b/packages/babel-parser/test/fixtures/typescript/types/read-only-3/options.json deleted file mode 100644 index cdb818eee9b2..000000000000 --- a/packages/babel-parser/test/fixtures/typescript/types/read-only-3/options.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "sourceType": "module", - "plugins": [ - "typescript" - ], - "throws": "'readonly' type modifier is only permitted on array and tuple literal types. (1:11)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/types/read-only-3/output.json b/packages/babel-parser/test/fixtures/typescript/types/read-only-3/output.json new file mode 100644 index 000000000000..8a977f1e3987 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/types/read-only-3/output.json @@ -0,0 +1,168 @@ +{ + "type": "File", + "start": 0, + "end": 48, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 48 + } + }, + "errors": [ + "SyntaxError: 'readonly' type modifier is only permitted on array and tuple literal types. (1:11)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 48, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 48 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "TSTypeAliasDeclaration", + "start": 0, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 38 + } + }, + "id": { + "type": "Identifier", + "start": 5, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 8 + }, + "identifierName": "T32" + }, + "name": "T32" + }, + "typeAnnotation": { + "type": "TSTypeOperator", + "start": 11, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "operator": "readonly", + "typeAnnotation": { + "type": "TSTypeOperator", + "start": 20, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "operator": "readonly", + "typeAnnotation": { + "type": "TSArrayType", + "start": 29, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "elementType": { + "type": "TSStringKeyword", + "start": 29, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 35 + } + } + } + } + } + }, + "trailingComments": [ + { + "type": "CommentLine", + "value": " Error", + "start": 40, + "end": 48, + "loc": { + "start": { + "line": 1, + "column": 40 + }, + "end": { + "line": 1, + "column": 48 + } + } + } + ] + } + ], + "directives": [] + }, + "comments": [ + { + "type": "CommentLine", + "value": " Error", + "start": 40, + "end": 48, + "loc": { + "start": { + "line": 1, + "column": 40 + }, + "end": { + "line": 1, + "column": 48 + } + } + } + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/types/read-only-4/options.json b/packages/babel-parser/test/fixtures/typescript/types/read-only-4/options.json deleted file mode 100644 index cdb818eee9b2..000000000000 --- a/packages/babel-parser/test/fixtures/typescript/types/read-only-4/options.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "sourceType": "module", - "plugins": [ - "typescript" - ], - "throws": "'readonly' type modifier is only permitted on array and tuple literal types. (1:11)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/types/read-only-4/output.json b/packages/babel-parser/test/fixtures/typescript/types/read-only-4/output.json new file mode 100644 index 000000000000..0e0dd2eb9f49 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/types/read-only-4/output.json @@ -0,0 +1,186 @@ +{ + "type": "File", + "start": 0, + "end": 44, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 44 + } + }, + "errors": [ + "SyntaxError: 'readonly' type modifier is only permitted on array and tuple literal types. (1:11)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 44, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 44 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "TSTypeAliasDeclaration", + "start": 0, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "id": { + "type": "Identifier", + "start": 5, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 8 + }, + "identifierName": "T33" + }, + "name": "T33" + }, + "typeAnnotation": { + "type": "TSTypeOperator", + "start": 11, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "operator": "readonly", + "typeAnnotation": { + "type": "TSTypeReference", + "start": 20, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "typeName": { + "type": "Identifier", + "start": 20, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 25 + }, + "identifierName": "Array" + }, + "name": "Array" + }, + "typeParameters": { + "type": "TSTypeParameterInstantiation", + "start": 25, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "params": [ + { + "type": "TSStringKeyword", + "start": 26, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 32 + } + } + } + ] + } + } + }, + "trailingComments": [ + { + "type": "CommentLine", + "value": " Error", + "start": 36, + "end": 44, + "loc": { + "start": { + "line": 1, + "column": 36 + }, + "end": { + "line": 1, + "column": 44 + } + } + } + ] + } + ], + "directives": [] + }, + "comments": [ + { + "type": "CommentLine", + "value": " Error", + "start": 36, + "end": 44, + "loc": { + "start": { + "line": 1, + "column": 36 + }, + "end": { + "line": 1, + "column": 44 + } + } + } + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/types/tuple-optional-invalid/options.json b/packages/babel-parser/test/fixtures/typescript/types/tuple-optional-invalid/options.json deleted file mode 100644 index 15111b29065f..000000000000 --- a/packages/babel-parser/test/fixtures/typescript/types/tuple-optional-invalid/options.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "sourceType": "module", - "plugins": ["typescript"], - "throws": "A required element cannot follow an optional element. (1:17)" -} diff --git a/packages/babel-parser/test/fixtures/typescript/types/tuple-optional-invalid/output.json b/packages/babel-parser/test/fixtures/typescript/types/tuple-optional-invalid/output.json new file mode 100644 index 000000000000..b66ac1ec7326 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/types/tuple-optional-invalid/output.json @@ -0,0 +1,166 @@ +{ + "type": "File", + "start": 0, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "errors": [ + "SyntaxError: A required element cannot follow an optional element. (1:17)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 0, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 4, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "id": { + "type": "Identifier", + "start": 4, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 24 + }, + "identifierName": "x" + }, + "name": "x", + "typeAnnotation": { + "type": "TSTypeAnnotation", + "start": 5, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "typeAnnotation": { + "type": "TSTupleType", + "start": 7, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "elementTypes": [ + { + "type": "TSOptionalType", + "start": 8, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "typeAnnotation": { + "type": "TSStringKeyword", + "start": 8, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 14 + } + } + } + }, + { + "type": "TSNumberKeyword", + "start": 17, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 23 + } + } + } + ] + } + } + }, + "init": null + } + ], + "kind": "let" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/types/tuple-rest-trailing-comma/input.ts b/packages/babel-parser/test/fixtures/typescript/types/tuple-rest-trailing-comma/input.ts new file mode 100644 index 000000000000..416732dd8c56 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/types/tuple-rest-trailing-comma/input.ts @@ -0,0 +1 @@ +let x: [string, ...string[],] diff --git a/packages/babel-parser/test/fixtures/typescript/types/tuple-rest-trailing-comma/output.json b/packages/babel-parser/test/fixtures/typescript/types/tuple-rest-trailing-comma/output.json new file mode 100644 index 000000000000..28b281a6ccdc --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/types/tuple-rest-trailing-comma/output.json @@ -0,0 +1,178 @@ +{ + "type": "File", + "start": 0, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 0, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 4, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "id": { + "type": "Identifier", + "start": 4, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 29 + }, + "identifierName": "x" + }, + "name": "x", + "typeAnnotation": { + "type": "TSTypeAnnotation", + "start": 5, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "typeAnnotation": { + "type": "TSTupleType", + "start": 7, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "elementTypes": [ + { + "type": "TSStringKeyword", + "start": 8, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "TSRestType", + "start": 16, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "typeAnnotation": { + "type": "TSArrayType", + "start": 19, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "elementType": { + "type": "TSStringKeyword", + "start": 19, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 25 + } + } + } + } + } + ] + } + } + }, + "init": null + } + ], + "kind": "let" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/variable-declarator/definite-assignment-not-allowed/options.json b/packages/babel-parser/test/fixtures/typescript/variable-declarator/definite-assignment-not-allowed/options.json index 57893e4eee56..c4c1edaca3c6 100644 --- a/packages/babel-parser/test/fixtures/typescript/variable-declarator/definite-assignment-not-allowed/options.json +++ b/packages/babel-parser/test/fixtures/typescript/variable-declarator/definite-assignment-not-allowed/options.json @@ -1,3 +1,3 @@ { - "throws": "Complex binding patterns require an initialization value (1:6)" + "throws": "Unexpected token, expected \";\" (1:6)" } diff --git a/packages/babel-parser/test/fixtures/v8intrinsic/_errors/in-bind-expression/input.js b/packages/babel-parser/test/fixtures/v8intrinsic/_errors/in-bind-expression/input.js new file mode 100644 index 000000000000..2828ef73abc6 --- /dev/null +++ b/packages/babel-parser/test/fixtures/v8intrinsic/_errors/in-bind-expression/input.js @@ -0,0 +1 @@ +::%DebugPrint(null) diff --git a/packages/babel-parser/test/fixtures/v8intrinsic/_errors/in-bind-expression/options.json b/packages/babel-parser/test/fixtures/v8intrinsic/_errors/in-bind-expression/options.json new file mode 100644 index 000000000000..f388c1ba2b25 --- /dev/null +++ b/packages/babel-parser/test/fixtures/v8intrinsic/_errors/in-bind-expression/options.json @@ -0,0 +1,4 @@ +{ + "plugins": ["v8intrinsic"], + "throws": "Unexpected token (1:0)" +} diff --git a/packages/babel-parser/test/fixtures/v8intrinsic/_errors/in-member-expression/input.js b/packages/babel-parser/test/fixtures/v8intrinsic/_errors/in-member-expression/input.js new file mode 100644 index 000000000000..11f5e1b795e5 --- /dev/null +++ b/packages/babel-parser/test/fixtures/v8intrinsic/_errors/in-member-expression/input.js @@ -0,0 +1 @@ +a.%DebugPrint(); diff --git a/packages/babel-parser/test/fixtures/v8intrinsic/_errors/in-member-expression/options.json b/packages/babel-parser/test/fixtures/v8intrinsic/_errors/in-member-expression/options.json new file mode 100644 index 000000000000..df3e3517c050 --- /dev/null +++ b/packages/babel-parser/test/fixtures/v8intrinsic/_errors/in-member-expression/options.json @@ -0,0 +1,4 @@ +{ + "plugins": ["v8intrinsic"], + "throws": "Unexpected token (1:2)" +} diff --git a/packages/babel-parser/test/fixtures/v8intrinsic/_errors/no-plugin/input.js b/packages/babel-parser/test/fixtures/v8intrinsic/_errors/no-plugin/input.js new file mode 100644 index 000000000000..3f654b116269 --- /dev/null +++ b/packages/babel-parser/test/fixtures/v8intrinsic/_errors/no-plugin/input.js @@ -0,0 +1 @@ +%DebugPrint(foo) diff --git a/packages/babel-parser/test/fixtures/v8intrinsic/_errors/no-plugin/options.json b/packages/babel-parser/test/fixtures/v8intrinsic/_errors/no-plugin/options.json new file mode 100644 index 000000000000..550f9f8667f9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/v8intrinsic/_errors/no-plugin/options.json @@ -0,0 +1,4 @@ +{ + "plugins": [], + "throws": "Unexpected token (1:0)" +} diff --git a/packages/babel-parser/test/fixtures/v8intrinsic/_errors/not-in-call-expression/input.js b/packages/babel-parser/test/fixtures/v8intrinsic/_errors/not-in-call-expression/input.js new file mode 100644 index 000000000000..1743e18ef4f1 --- /dev/null +++ b/packages/babel-parser/test/fixtures/v8intrinsic/_errors/not-in-call-expression/input.js @@ -0,0 +1,2 @@ +const i = %DebugPrint; +i(foo); diff --git a/packages/babel-parser/test/fixtures/v8intrinsic/_errors/not-in-call-expression/options.json b/packages/babel-parser/test/fixtures/v8intrinsic/_errors/not-in-call-expression/options.json new file mode 100644 index 000000000000..9f69797fc3b1 --- /dev/null +++ b/packages/babel-parser/test/fixtures/v8intrinsic/_errors/not-in-call-expression/options.json @@ -0,0 +1,4 @@ +{ + "plugins": ["v8intrinsic"], + "throws": "Unexpected token (1:10)" +} diff --git a/packages/babel-parser/test/fixtures/v8intrinsic/_errors/optional-call-expression/input.js b/packages/babel-parser/test/fixtures/v8intrinsic/_errors/optional-call-expression/input.js new file mode 100644 index 000000000000..0f2bb372f3f4 --- /dev/null +++ b/packages/babel-parser/test/fixtures/v8intrinsic/_errors/optional-call-expression/input.js @@ -0,0 +1 @@ +%DebugPrint?.(null) diff --git a/packages/babel-parser/test/fixtures/v8intrinsic/_errors/optional-call-expression/options.json b/packages/babel-parser/test/fixtures/v8intrinsic/_errors/optional-call-expression/options.json new file mode 100644 index 000000000000..f388c1ba2b25 --- /dev/null +++ b/packages/babel-parser/test/fixtures/v8intrinsic/_errors/optional-call-expression/options.json @@ -0,0 +1,4 @@ +{ + "plugins": ["v8intrinsic"], + "throws": "Unexpected token (1:0)" +} diff --git a/packages/babel-parser/test/fixtures/v8intrinsic/expression/await-expression/input.js b/packages/babel-parser/test/fixtures/v8intrinsic/expression/await-expression/input.js new file mode 100644 index 000000000000..43d5cb818781 --- /dev/null +++ b/packages/babel-parser/test/fixtures/v8intrinsic/expression/await-expression/input.js @@ -0,0 +1 @@ +async () => { await %StringParseInt("42", 10) } diff --git a/packages/babel-parser/test/fixtures/v8intrinsic/expression/await-expression/output.json b/packages/babel-parser/test/fixtures/v8intrinsic/expression/await-expression/output.json new file mode 100644 index 000000000000..417906511ce0 --- /dev/null +++ b/packages/babel-parser/test/fixtures/v8intrinsic/expression/await-expression/output.json @@ -0,0 +1,191 @@ +{ + "type": "File", + "start": 0, + "end": 47, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 47 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 47, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 47 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 47, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 47 + } + }, + "expression": { + "type": "ArrowFunctionExpression", + "start": 0, + "end": 47, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 47 + } + }, + "id": null, + "generator": false, + "async": true, + "params": [], + "body": { + "type": "BlockStatement", + "start": 12, + "end": 47, + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 47 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 14, + "end": 45, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 45 + } + }, + "expression": { + "type": "AwaitExpression", + "start": 14, + "end": 45, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 45 + } + }, + "argument": { + "type": "CallExpression", + "start": 20, + "end": 45, + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 45 + } + }, + "callee": { + "type": "V8IntrinsicIdentifier", + "start": 20, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 35 + }, + "identifierName": "StringParseInt" + }, + "name": "StringParseInt" + }, + "arguments": [ + { + "type": "StringLiteral", + "start": 36, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 36 + }, + "end": { + "line": 1, + "column": 40 + } + }, + "extra": { + "rawValue": "42", + "raw": "\"42\"" + }, + "value": "42" + }, + { + "type": "NumericLiteral", + "start": 42, + "end": 44, + "loc": { + "start": { + "line": 1, + "column": 42 + }, + "end": { + "line": 1, + "column": 44 + } + }, + "extra": { + "rawValue": 10, + "raw": "10" + }, + "value": 10 + } + ] + } + } + } + ], + "directives": [] + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/v8intrinsic/expression/call-expression/input.js b/packages/babel-parser/test/fixtures/v8intrinsic/expression/call-expression/input.js new file mode 100644 index 000000000000..3f654b116269 --- /dev/null +++ b/packages/babel-parser/test/fixtures/v8intrinsic/expression/call-expression/input.js @@ -0,0 +1 @@ +%DebugPrint(foo) diff --git a/packages/babel-parser/test/fixtures/v8intrinsic/expression/call-expression/output.json b/packages/babel-parser/test/fixtures/v8intrinsic/expression/call-expression/output.json new file mode 100644 index 000000000000..e44d316e19ce --- /dev/null +++ b/packages/babel-parser/test/fixtures/v8intrinsic/expression/call-expression/output.json @@ -0,0 +1,101 @@ +{ + "type": "File", + "start": 0, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "expression": { + "type": "CallExpression", + "start": 0, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "callee": { + "type": "V8IntrinsicIdentifier", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + }, + "identifierName": "DebugPrint" + }, + "name": "DebugPrint" + }, + "arguments": [ + { + "type": "Identifier", + "start": 12, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 15 + }, + "identifierName": "foo" + }, + "name": "foo" + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/v8intrinsic/expression/in-new-expression/input.js b/packages/babel-parser/test/fixtures/v8intrinsic/expression/in-new-expression/input.js new file mode 100644 index 000000000000..cacf4eb63800 --- /dev/null +++ b/packages/babel-parser/test/fixtures/v8intrinsic/expression/in-new-expression/input.js @@ -0,0 +1 @@ +new %DebugPrint(null); diff --git a/packages/babel-parser/test/fixtures/v8intrinsic/expression/in-new-expression/output.json b/packages/babel-parser/test/fixtures/v8intrinsic/expression/in-new-expression/output.json new file mode 100644 index 000000000000..c02efb12aecc --- /dev/null +++ b/packages/babel-parser/test/fixtures/v8intrinsic/expression/in-new-expression/output.json @@ -0,0 +1,99 @@ +{ + "type": "File", + "start": 0, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "expression": { + "type": "NewExpression", + "start": 0, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "callee": { + "type": "V8IntrinsicIdentifier", + "start": 4, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 15 + }, + "identifierName": "DebugPrint" + }, + "name": "DebugPrint" + }, + "arguments": [ + { + "type": "NullLiteral", + "start": 16, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 20 + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/v8intrinsic/expression/multiple-arguments/input.js b/packages/babel-parser/test/fixtures/v8intrinsic/expression/multiple-arguments/input.js new file mode 100644 index 000000000000..82600e018602 --- /dev/null +++ b/packages/babel-parser/test/fixtures/v8intrinsic/expression/multiple-arguments/input.js @@ -0,0 +1 @@ +%StringParseInt("42", 10); diff --git a/packages/babel-parser/test/fixtures/v8intrinsic/expression/multiple-arguments/output.json b/packages/babel-parser/test/fixtures/v8intrinsic/expression/multiple-arguments/output.json new file mode 100644 index 000000000000..3843e6652fc3 --- /dev/null +++ b/packages/babel-parser/test/fixtures/v8intrinsic/expression/multiple-arguments/output.json @@ -0,0 +1,124 @@ +{ + "type": "File", + "start": 0, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "expression": { + "type": "CallExpression", + "start": 0, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "callee": { + "type": "V8IntrinsicIdentifier", + "start": 0, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + }, + "identifierName": "StringParseInt" + }, + "name": "StringParseInt" + }, + "arguments": [ + { + "type": "StringLiteral", + "start": 16, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "extra": { + "rawValue": "42", + "raw": "\"42\"" + }, + "value": "42" + }, + { + "type": "NumericLiteral", + "start": 22, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "extra": { + "rawValue": 10, + "raw": "10" + }, + "value": 10 + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/v8intrinsic/expression/yield-expression/input.js b/packages/babel-parser/test/fixtures/v8intrinsic/expression/yield-expression/input.js new file mode 100644 index 000000000000..da2dc0b2bf49 --- /dev/null +++ b/packages/babel-parser/test/fixtures/v8intrinsic/expression/yield-expression/input.js @@ -0,0 +1,3 @@ +function *foo() { + yield %StringParseInt("42", 10) +} diff --git a/packages/babel-parser/test/fixtures/v8intrinsic/expression/yield-expression/output.json b/packages/babel-parser/test/fixtures/v8intrinsic/expression/yield-expression/output.json new file mode 100644 index 000000000000..50294da42d99 --- /dev/null +++ b/packages/babel-parser/test/fixtures/v8intrinsic/expression/yield-expression/output.json @@ -0,0 +1,193 @@ +{ + "type": "File", + "start": 0, + "end": 53, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 53, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 53, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 10, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 13 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "generator": true, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 16, + "end": 53, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 20, + "end": 51, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 33 + } + }, + "expression": { + "type": "YieldExpression", + "start": 20, + "end": 51, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 33 + } + }, + "delegate": false, + "argument": { + "type": "CallExpression", + "start": 26, + "end": 51, + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 33 + } + }, + "callee": { + "type": "V8IntrinsicIdentifier", + "start": 26, + "end": 41, + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 23 + }, + "identifierName": "StringParseInt" + }, + "name": "StringParseInt" + }, + "arguments": [ + { + "type": "StringLiteral", + "start": 42, + "end": 46, + "loc": { + "start": { + "line": 2, + "column": 24 + }, + "end": { + "line": 2, + "column": 28 + } + }, + "extra": { + "rawValue": "42", + "raw": "\"42\"" + }, + "value": "42" + }, + { + "type": "NumericLiteral", + "start": 48, + "end": 50, + "loc": { + "start": { + "line": 2, + "column": 30 + }, + "end": { + "line": 2, + "column": 32 + } + }, + "extra": { + "rawValue": 10, + "raw": "10" + }, + "value": 10 + } + ] + } + } + } + ], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/v8intrinsic/modulo/01/input.js b/packages/babel-parser/test/fixtures/v8intrinsic/modulo/01/input.js new file mode 100644 index 000000000000..72f7312444c3 --- /dev/null +++ b/packages/babel-parser/test/fixtures/v8intrinsic/modulo/01/input.js @@ -0,0 +1 @@ +foo%bar() diff --git a/packages/babel-parser/test/fixtures/v8intrinsic/modulo/01/output.json b/packages/babel-parser/test/fixtures/v8intrinsic/modulo/01/output.json new file mode 100644 index 000000000000..6233a3f2dd7d --- /dev/null +++ b/packages/babel-parser/test/fixtures/v8intrinsic/modulo/01/output.json @@ -0,0 +1,116 @@ +{ + "type": "File", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "expression": { + "type": "BinaryExpression", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "left": { + "type": "Identifier", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "operator": "%", + "right": { + "type": "CallExpression", + "start": 4, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "callee": { + "type": "Identifier", + "start": 4, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "bar" + }, + "name": "bar" + }, + "arguments": [] + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/v8intrinsic/options.json b/packages/babel-parser/test/fixtures/v8intrinsic/options.json new file mode 100644 index 000000000000..609458c2c65e --- /dev/null +++ b/packages/babel-parser/test/fixtures/v8intrinsic/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["v8intrinsic"] +} diff --git a/packages/babel-parser/test/helpers/runFixtureTests.js b/packages/babel-parser/test/helpers/runFixtureTests.js index 9e97ee46f727..0c93f7a7521d 100644 --- a/packages/babel-parser/test/helpers/runFixtureTests.js +++ b/packages/babel-parser/test/helpers/runFixtureTests.js @@ -1,3 +1,5 @@ +/* global BigInt */ + import { multiple as getFixtures } from "@babel/helper-fixtures"; import { codeFrameColumns } from "@babel/code-frame"; import fs from "fs"; @@ -5,6 +7,8 @@ import path from "path"; const rootPath = path.join(__dirname, "../../../.."); +const serialized = "$$ babel internal serialized type"; + class FixtureError extends Error { constructor(previousError, fixturePath, code) { super(previousError.message); @@ -61,7 +65,7 @@ export function runFixtureTests(fixturesPath, parseFunction) { /^.*Got error message: /, "", ); - fs.writeFileSync(fn, JSON.stringify(task.options, null, " ")); + fs.writeFileSync(fn, JSON.stringify(task.options, null, 2)); } } @@ -107,11 +111,10 @@ export function runThrowTestsWithEstree(fixturesPath, parseFunction) { } function save(test, ast) { - // Ensure that RegExp are serialized as strings - const toJSON = RegExp.prototype.toJSON; - RegExp.prototype.toJSON = RegExp.prototype.toString; - require("fs").writeFileSync(test.expect.loc, JSON.stringify(ast, null, " ")); - RegExp.prototype.toJSON = toJSON; + fs.writeFileSync( + test.expect.loc, + JSON.stringify(ast, (k, v) => serialize(v), 2), + ); } function runTest(test, parseFunction) { @@ -125,7 +128,7 @@ function runTest(test, parseFunction) { let ast; try { - ast = parseFunction(test.actual.code, opts); + ast = parseFunction(test.actual.code, { errorRecovery: true, ...opts }); } catch (err) { if (opts.throws) { if (err.message === opts.throws) { @@ -135,7 +138,7 @@ function runTest(test, parseFunction) { const fn = path.dirname(test.expect.loc) + "/options.json"; test.options = test.options || {}; test.options.throws = err.message; - fs.writeFileSync(fn, JSON.stringify(test.options, null, " ")); + fs.writeFileSync(fn, JSON.stringify(test.options, null, 2)); return; } @@ -152,6 +155,7 @@ function runTest(test, parseFunction) { } if (ast.comments && !ast.comments.length) delete ast.comments; + if (ast.errors && !ast.errors.length) delete ast.errors; if (!test.expect.code && !opts.throws && !process.env.CI) { test.expect.loc += "on"; @@ -159,6 +163,20 @@ function runTest(test, parseFunction) { } if (opts.throws) { + if (process.env.OVERWRITE) { + const fn = path.dirname(test.expect.loc) + "/options.json"; + test.options = test.options || {}; + delete test.options.throws; + const contents = JSON.stringify(test.options, null, 2); + if (contents === "{}") { + fs.unlinkSync(fn); + } else { + fs.writeFileSync(fn, JSON.stringify(test.options, null, 2)); + } + test.expect.loc += "on"; + return save(test, ast); + } + throw new Error( "Expected error message: " + opts.throws + ". But parsing succeeded.", ); @@ -174,9 +192,43 @@ function runTest(test, parseFunction) { } } +function serialize(value) { + if (typeof value === "bigint") { + return { + [serialized]: "BigInt", + value: value.toString(), + }; + } else if (value instanceof RegExp) { + return { + [serialized]: "RegExp", + source: value.source, + flags: value.flags, + }; + } else if (value instanceof Error) { + // Errors are serialized to a simple string, because are used frequently + return value.toString(); + } + return value; +} + function ppJSON(v) { - v = v instanceof RegExp ? v.toString() : v; - return JSON.stringify(v, null, 2); + if (typeof v === "bigint" || v instanceof Error || v instanceof RegExp) { + return ppJSON(serialize(v)); + } + + if (v && typeof v === "object" && v[serialized]) { + switch (v[serialized]) { + case "BigInt": + return typeof BigInt === "undefined" ? "null" : v.value + "n"; + case "RegExp": + return `/${v.source}/${v.flags}`; + } + } else if (typeof v === "string" && /^[A-Z][a-z]+Error: /.test(v)) { + // Errors are serialized to a simple string, because are used frequently + return v; + } + + return JSON.stringify(v, (k, v) => serialize(v), 2); } function addPath(str, pt) { @@ -188,7 +240,12 @@ function addPath(str, pt) { } function misMatch(exp, act) { - if (exp instanceof RegExp || act instanceof RegExp) { + if ( + act instanceof RegExp || + act instanceof Error || + typeof act === "bigint" || + (exp && typeof exp === "object" && exp[serialized]) + ) { const left = ppJSON(exp); const right = ppJSON(act); if (left !== right) return left + " !== " + right; diff --git a/packages/babel-parser/test/unit/tokenizer/types.js b/packages/babel-parser/test/unit/tokenizer/types.js new file mode 100644 index 000000000000..64a69051963b --- /dev/null +++ b/packages/babel-parser/test/unit/tokenizer/types.js @@ -0,0 +1,15 @@ +import { types } from "../../../src/tokenizer/types"; + +describe("token types", () => { + it("should check if the binOp for relational === in", () => { + expect(types.relational.binop).toEqual(types._in.binop); + }); + + it("should check if the binOp for relational === instanceOf", () => { + expect(types.relational.binop).toEqual(types._instanceof.binop); + }); + + it("should check if the binOp for in === instanceOf", () => { + expect(types._in.binop).toEqual(types._instanceof.binop); + }); +}); diff --git a/packages/babel-parser/typings/babel-parser.d.ts b/packages/babel-parser/typings/babel-parser.d.ts index 799e9e8945d1..40161080996b 100644 --- a/packages/babel-parser/typings/babel-parser.d.ts +++ b/packages/babel-parser/typings/babel-parser.d.ts @@ -106,7 +106,7 @@ export type ParserPlugin = 'dynamicImport' | 'estree' | 'exportDefaultFrom' | - 'exportNamespaceFrom' | + 'exportNamespaceFrom' | // deprecated 'flow' | 'flowComments' | 'functionBind' | @@ -123,7 +123,9 @@ export type ParserPlugin = 'pipelineOperator' | 'placeholders' | 'throwExpressions' | + 'topLevelAwait' | 'typescript' | + 'v8intrinsic' | ParserPluginWithOptions; export type ParserPluginWithOptions = diff --git a/packages/babel-plugin-external-helpers/package.json b/packages/babel-plugin-external-helpers/package.json index 7a4bd988941c..bb70f5bf0409 100644 --- a/packages/babel-plugin-external-helpers/package.json +++ b/packages/babel-plugin-external-helpers/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-external-helpers", - "version": "7.2.0", + "version": "7.8.3", "description": "This plugin contains helper functions that’ll be placed at the top of the generated code", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-external-helpers", "license": "MIT", @@ -12,13 +12,13 @@ "babel-plugin" ], "dependencies": { - "@babel/helper-plugin-utils": "^7.0.0" + "@babel/helper-plugin-utils": "^7.8.3" }, "peerDependencies": { "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.2.0", - "@babel/helper-plugin-test-runner": "^7.0.0" + "@babel/core": "^7.8.3", + "@babel/helper-plugin-test-runner": "^7.8.3" } } diff --git a/packages/babel-plugin-proposal-async-generator-functions/package.json b/packages/babel-plugin-proposal-async-generator-functions/package.json index 81db9bcc3d53..4e00ef34879f 100644 --- a/packages/babel-plugin-proposal-async-generator-functions/package.json +++ b/packages/babel-plugin-proposal-async-generator-functions/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-proposal-async-generator-functions", - "version": "7.2.0", + "version": "7.8.3", "description": "Turn async generator functions into ES2015 generators", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-proposal-async-generator-functions", "license": "MIT", @@ -12,15 +12,15 @@ "babel-plugin" ], "dependencies": { - "@babel/helper-plugin-utils": "^7.0.0", - "@babel/helper-remap-async-to-generator": "^7.1.0", - "@babel/plugin-syntax-async-generators": "^7.2.0" + "@babel/helper-plugin-utils": "^7.8.3", + "@babel/helper-remap-async-to-generator": "^7.8.3", + "@babel/plugin-syntax-async-generators": "^7.8.0" }, "peerDependencies": { "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.2.0", - "@babel/helper-plugin-test-runner": "^7.0.0" + "@babel/core": "^7.8.3", + "@babel/helper-plugin-test-runner": "^7.8.3" } } diff --git a/packages/babel-plugin-proposal-async-generator-functions/test/fixtures/yield-star/issue-9905/exec.js b/packages/babel-plugin-proposal-async-generator-functions/test/fixtures/yield-star/issue-9905/exec.js new file mode 100644 index 000000000000..a4bf16180e24 --- /dev/null +++ b/packages/babel-plugin-proposal-async-generator-functions/test/fixtures/yield-star/issue-9905/exec.js @@ -0,0 +1,20 @@ +const log = []; + +async function* func1() { + log.push(1); + yield "a"; + log.push(2); +} + +async function* func2() { + yield* func1(); + log.push(3); +} + +return (async () => { + const iterator = func2(); + await iterator.next(); + await iterator.return(); + + expect(log).toEqual([1]); +})(); \ No newline at end of file diff --git a/packages/babel-plugin-proposal-async-generator-functions/test/fixtures/yield-star/issue-9905/options.json b/packages/babel-plugin-proposal-async-generator-functions/test/fixtures/yield-star/issue-9905/options.json new file mode 100644 index 000000000000..2454c2169cf8 --- /dev/null +++ b/packages/babel-plugin-proposal-async-generator-functions/test/fixtures/yield-star/issue-9905/options.json @@ -0,0 +1,3 @@ +{ + "minNodeVersion": "8.0.0" +} diff --git a/packages/babel-plugin-proposal-async-generator-functions/test/fixtures/yield-star/options.json b/packages/babel-plugin-proposal-async-generator-functions/test/fixtures/yield-star/options.json new file mode 100644 index 000000000000..5459f727f878 --- /dev/null +++ b/packages/babel-plugin-proposal-async-generator-functions/test/fixtures/yield-star/options.json @@ -0,0 +1,10 @@ +{ + "parserOpts": { + "allowReturnOutsideFunction": true + }, + "plugins": [ + "external-helpers", + "transform-async-to-generator", + "proposal-async-generator-functions" + ] +} diff --git a/packages/babel-plugin-proposal-async-generator-functions/test/fixtures/yield-star/return-method-with-finally-multiple-parallel/exec.js b/packages/babel-plugin-proposal-async-generator-functions/test/fixtures/yield-star/return-method-with-finally-multiple-parallel/exec.js new file mode 100644 index 000000000000..1c4ef15d5d06 --- /dev/null +++ b/packages/babel-plugin-proposal-async-generator-functions/test/fixtures/yield-star/return-method-with-finally-multiple-parallel/exec.js @@ -0,0 +1,34 @@ +const log = []; + +async function* inner() { + try { + log.push(1); + yield "a"; + log.push(2); + yield "b"; + log.push(3); + } finally { + log.push(4); + yield "c"; + log.push(5); + } +} + +async function* outer() { + log.push(6); + yield* inner(); + log.push(7); +} + +return (async () => { + const iterator = outer(); + + let res = await iterator.next(); + expect(res).toEqual({ value: "a", done: false }); + expect(log).toEqual([6, 1]); + + const [res1, res2] = await Promise.all([ iterator.return("x"), iterator.return("y") ]); + expect(res1).toEqual({ value: "c", done: false }); + expect(res2).toEqual({ value: "y", done: true }); + expect(log).toEqual([6, 1, 4]); +})(); diff --git a/packages/babel-plugin-proposal-async-generator-functions/test/fixtures/yield-star/return-method-with-finally-multiple-parallel/options.json b/packages/babel-plugin-proposal-async-generator-functions/test/fixtures/yield-star/return-method-with-finally-multiple-parallel/options.json new file mode 100644 index 000000000000..2454c2169cf8 --- /dev/null +++ b/packages/babel-plugin-proposal-async-generator-functions/test/fixtures/yield-star/return-method-with-finally-multiple-parallel/options.json @@ -0,0 +1,3 @@ +{ + "minNodeVersion": "8.0.0" +} diff --git a/packages/babel-plugin-proposal-async-generator-functions/test/fixtures/yield-star/return-method-with-finally-multiple-serial/exec.js b/packages/babel-plugin-proposal-async-generator-functions/test/fixtures/yield-star/return-method-with-finally-multiple-serial/exec.js new file mode 100644 index 000000000000..84865ef6f3df --- /dev/null +++ b/packages/babel-plugin-proposal-async-generator-functions/test/fixtures/yield-star/return-method-with-finally-multiple-serial/exec.js @@ -0,0 +1,37 @@ +const log = []; + +async function* inner() { + try { + log.push(1); + yield "a"; + log.push(2); + yield "b"; + log.push(3); + } finally { + log.push(4); + yield "c"; + log.push(5); + } +} + +async function* outer() { + log.push(6); + yield* inner(); + log.push(7); +} + +return (async () => { + const iterator = outer(); + + let res = await iterator.next(); + expect(res).toEqual({ value: "a", done: false }); + expect(log).toEqual([6, 1]); + + res = await iterator.return("x"); + expect(res).toEqual({ value: "c", done: false }); + expect(log).toEqual([6, 1, 4]); + + res = await iterator.return("y"); + expect(res).toEqual({ value: "y", done: true }); + expect(log).toEqual([6, 1, 4]); +})(); diff --git a/packages/babel-plugin-proposal-async-generator-functions/test/fixtures/yield-star/return-method-with-finally-multiple-serial/options.json b/packages/babel-plugin-proposal-async-generator-functions/test/fixtures/yield-star/return-method-with-finally-multiple-serial/options.json new file mode 100644 index 000000000000..2454c2169cf8 --- /dev/null +++ b/packages/babel-plugin-proposal-async-generator-functions/test/fixtures/yield-star/return-method-with-finally-multiple-serial/options.json @@ -0,0 +1,3 @@ +{ + "minNodeVersion": "8.0.0" +} diff --git a/packages/babel-plugin-proposal-async-generator-functions/test/fixtures/yield-star/return-method-with-finally/exec.js b/packages/babel-plugin-proposal-async-generator-functions/test/fixtures/yield-star/return-method-with-finally/exec.js new file mode 100644 index 000000000000..0ef1d454a19f --- /dev/null +++ b/packages/babel-plugin-proposal-async-generator-functions/test/fixtures/yield-star/return-method-with-finally/exec.js @@ -0,0 +1,37 @@ +const log = []; + +async function* inner() { + try { + log.push(1); + yield "a"; + log.push(2); + yield "b"; + log.push(3); + } finally { + log.push(4); + yield "c"; + log.push(5); + } +} + +async function* outer() { + log.push(6); + yield* inner(); + log.push(7); +} + +return (async () => { + const iterator = outer(); + + let res = await iterator.next(); + expect(res).toEqual({ value: "a", done: false }); + expect(log).toEqual([6, 1]); + + res = await iterator.return(); + expect(res).toEqual({ value: "c", done: false }); + expect(log).toEqual([6, 1, 4]); + + res = await iterator.next(); + expect(res).toEqual({ value: undefined, done: true }); + expect(log).toEqual([6, 1, 4, 5, 7]); +})(); diff --git a/packages/babel-plugin-proposal-async-generator-functions/test/fixtures/yield-star/return-method/exec.js b/packages/babel-plugin-proposal-async-generator-functions/test/fixtures/yield-star/return-method/exec.js new file mode 100644 index 000000000000..73be9d85e495 --- /dev/null +++ b/packages/babel-plugin-proposal-async-generator-functions/test/fixtures/yield-star/return-method/exec.js @@ -0,0 +1,31 @@ +const log = []; + +async function* inner() { + log.push(1); + yield "a"; + log.push(2); + yield "b"; + log.push(3); +} + +async function* outer() { + log.push(4); + yield* inner(); + log.push(5); +} + +return (async () => { + const iterator = outer(); + + let res = await iterator.next(); + expect(res).toEqual({ value: "a", done: false }); + expect(log).toEqual([4, 1]); + + res = await iterator.return(); + expect(res).toEqual({ value: undefined, done: true }); + expect(log).toEqual([4, 1]); + + res = await iterator.next(); + expect(res).toEqual({ value: undefined, done: true }); + expect(log).toEqual([4, 1]); +})(); diff --git a/packages/babel-plugin-proposal-async-generator-functions/test/fixtures/yield-star/return-method/options.json b/packages/babel-plugin-proposal-async-generator-functions/test/fixtures/yield-star/return-method/options.json new file mode 100644 index 000000000000..2454c2169cf8 --- /dev/null +++ b/packages/babel-plugin-proposal-async-generator-functions/test/fixtures/yield-star/return-method/options.json @@ -0,0 +1,3 @@ +{ + "minNodeVersion": "8.0.0" +} diff --git a/packages/babel-plugin-proposal-async-generator-functions/test/fixtures/yield-star/throw-method-with-catch/exec.js b/packages/babel-plugin-proposal-async-generator-functions/test/fixtures/yield-star/throw-method-with-catch/exec.js new file mode 100644 index 000000000000..0859ad463e00 --- /dev/null +++ b/packages/babel-plugin-proposal-async-generator-functions/test/fixtures/yield-star/throw-method-with-catch/exec.js @@ -0,0 +1,37 @@ +const log = []; + +async function* inner() { + try { + log.push(1); + yield "a"; + log.push(2); + yield "b"; + log.push(3); + } catch (e) { + log.push(4); + yield "c"; + log.push(5); + } +} + +async function* outer() { + log.push(6); + yield* inner(); + log.push(7); +} + +return (async () => { + const iterator = outer(); + + let res = await iterator.next(); + expect(res).toEqual({ value: "a", done: false }); + expect(log).toEqual([6, 1]); + + res = await iterator.throw(new Error("TEST")); + expect(res).toEqual({ value: "c", done: false }); + expect(log).toEqual([6, 1, 4]); + + res = await iterator.next(); + expect(res).toEqual({ value: undefined, done: true }); + expect(log).toEqual([6, 1, 4, 5, 7]); +})(); diff --git a/packages/babel-plugin-proposal-async-generator-functions/test/fixtures/yield-star/throw-method-with-finally/exec.js b/packages/babel-plugin-proposal-async-generator-functions/test/fixtures/yield-star/throw-method-with-finally/exec.js new file mode 100644 index 000000000000..425a00b33f80 --- /dev/null +++ b/packages/babel-plugin-proposal-async-generator-functions/test/fixtures/yield-star/throw-method-with-finally/exec.js @@ -0,0 +1,37 @@ +const log = []; + +async function* inner() { + try { + log.push(1); + yield "a"; + log.push(2); + yield "b"; + log.push(3); + } finally { + log.push(4); + yield "c"; + log.push(5); + } +} + +async function* outer() { + log.push(6); + yield* inner(); + log.push(7); +} + +return (async () => { + const iterator = outer(); + + let res = await iterator.next(); + expect(res).toEqual({ value: "a", done: false }); + expect(log).toEqual([6, 1]); + + res = await iterator.throw(new Error("TEST")); + expect(res).toEqual({ value: "c", done: false }); + expect(log).toEqual([6, 1, 4]); + + // "yield" in finally suspended the exception for one turn + await expect(iterator.next()).rejects.toThrow(/TEST/); + expect(log).toEqual([6, 1, 4, 5]); +})(); diff --git a/packages/babel-plugin-proposal-class-properties/package.json b/packages/babel-plugin-proposal-class-properties/package.json index 9a11e1c822a6..5a41b9c537e9 100644 --- a/packages/babel-plugin-proposal-class-properties/package.json +++ b/packages/babel-plugin-proposal-class-properties/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-proposal-class-properties", - "version": "7.5.5", + "version": "7.8.3", "description": "This plugin transforms static class properties as well as properties declared with the property initializer syntax", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-proposal-class-properties", "license": "MIT", @@ -12,14 +12,14 @@ "babel-plugin" ], "dependencies": { - "@babel/helper-create-class-features-plugin": "^7.5.5", - "@babel/helper-plugin-utils": "^7.0.0" + "@babel/helper-create-class-features-plugin": "^7.8.3", + "@babel/helper-plugin-utils": "^7.8.3" }, "peerDependencies": { "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.5.5", - "@babel/helper-plugin-test-runner": "^7.0.0" + "@babel/core": "^7.8.3", + "@babel/helper-plugin-test-runner": "^7.8.3" } } diff --git a/packages/babel-plugin-proposal-class-properties/test/fixtures/decorators-legacy-interop/local-define-property/input.js b/packages/babel-plugin-proposal-class-properties/test/fixtures/decorators-legacy-interop/local-define-property/input.js new file mode 100644 index 000000000000..f939e63b3b71 --- /dev/null +++ b/packages/babel-plugin-proposal-class-properties/test/fixtures/decorators-legacy-interop/local-define-property/input.js @@ -0,0 +1,12 @@ +function dec() {} + +// Create a local function binding so babel has to change the name of the helper +function _defineProperty() {} + +class A { + @dec a; + + @dec b = 123; + + c = 456; +} diff --git a/packages/babel-plugin-proposal-class-properties/test/fixtures/decorators-legacy-interop/local-define-property/options.json b/packages/babel-plugin-proposal-class-properties/test/fixtures/decorators-legacy-interop/local-define-property/options.json new file mode 100644 index 000000000000..6f03cd7aad03 --- /dev/null +++ b/packages/babel-plugin-proposal-class-properties/test/fixtures/decorators-legacy-interop/local-define-property/options.json @@ -0,0 +1,7 @@ +{ + "plugins": [ + ["proposal-decorators", { "legacy": true }], + ["proposal-class-properties"], + "transform-classes" + ] +} diff --git a/packages/babel-plugin-proposal-class-properties/test/fixtures/decorators-legacy-interop/local-define-property/output.js b/packages/babel-plugin-proposal-class-properties/test/fixtures/decorators-legacy-interop/local-define-property/output.js new file mode 100644 index 000000000000..641307b44d0d --- /dev/null +++ b/packages/babel-plugin-proposal-class-properties/test/fixtures/decorators-legacy-interop/local-define-property/output.js @@ -0,0 +1,40 @@ +var _class, _descriptor, _descriptor2, _temp; + +function _initializerDefineProperty(target, property, descriptor, context) { if (!descriptor) return; Object.defineProperty(target, property, { enumerable: descriptor.enumerable, configurable: descriptor.configurable, writable: descriptor.writable, value: descriptor.initializer ? descriptor.initializer.call(context) : void 0 }); } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _defineProperty2(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } + +function _applyDecoratedDescriptor(target, property, decorators, descriptor, context) { var desc = {}; Object.keys(descriptor).forEach(function (key) { desc[key] = descriptor[key]; }); desc.enumerable = !!desc.enumerable; desc.configurable = !!desc.configurable; if ('value' in desc || desc.initializer) { desc.writable = true; } desc = decorators.slice().reverse().reduce(function (desc, decorator) { return decorator(target, property, desc) || desc; }, desc); if (context && desc.initializer !== void 0) { desc.value = desc.initializer ? desc.initializer.call(context) : void 0; desc.initializer = undefined; } if (desc.initializer === void 0) { Object.defineProperty(target, property, desc); desc = null; } return desc; } + +function _initializerWarningHelper(descriptor, context) { throw new Error('Decorating class property failed. Please ensure that ' + 'proposal-class-properties is enabled and runs after the decorators transform.'); } + +function dec() {} // Create a local function binding so babel has to change the name of the helper + + +function _defineProperty() {} + +let A = (_class = (_temp = function A() { + "use strict"; + + _classCallCheck(this, A); + + _initializerDefineProperty(this, "a", _descriptor, this); + + _initializerDefineProperty(this, "b", _descriptor2, this); + + _defineProperty2(this, "c", 456); +}, _temp), (_descriptor = _applyDecoratedDescriptor(_class.prototype, "a", [dec], { + configurable: true, + enumerable: true, + writable: true, + initializer: null +}), _descriptor2 = _applyDecoratedDescriptor(_class.prototype, "b", [dec], { + configurable: true, + enumerable: true, + writable: true, + initializer: function () { + return 123; + } +})), _class); diff --git a/packages/babel-plugin-proposal-class-properties/test/fixtures/decorators-legacy-interop/loose/input.js b/packages/babel-plugin-proposal-class-properties/test/fixtures/decorators-legacy-interop/loose/input.js new file mode 100644 index 000000000000..92298f2eb49b --- /dev/null +++ b/packages/babel-plugin-proposal-class-properties/test/fixtures/decorators-legacy-interop/loose/input.js @@ -0,0 +1,9 @@ +function dec() {} + +class A { + @dec a; + + @dec b = 123; + + c = 456; +} diff --git a/packages/babel-plugin-proposal-class-properties/test/fixtures/decorators-legacy-interop/loose/options.json b/packages/babel-plugin-proposal-class-properties/test/fixtures/decorators-legacy-interop/loose/options.json new file mode 100644 index 000000000000..8c831989533b --- /dev/null +++ b/packages/babel-plugin-proposal-class-properties/test/fixtures/decorators-legacy-interop/loose/options.json @@ -0,0 +1,7 @@ +{ + "plugins": [ + ["proposal-decorators", { "legacy": true }], + ["proposal-class-properties", { "loose": true }], + "transform-classes" + ] +} diff --git a/packages/babel-plugin-proposal-class-properties/test/fixtures/decorators-legacy-interop/loose/output.js b/packages/babel-plugin-proposal-class-properties/test/fixtures/decorators-legacy-interop/loose/output.js new file mode 100644 index 000000000000..0a25e2b1023c --- /dev/null +++ b/packages/babel-plugin-proposal-class-properties/test/fixtures/decorators-legacy-interop/loose/output.js @@ -0,0 +1,35 @@ +var _class, _descriptor, _descriptor2, _temp; + +function _initializerDefineProperty(target, property, descriptor, context) { if (!descriptor) return; Object.defineProperty(target, property, { enumerable: descriptor.enumerable, configurable: descriptor.configurable, writable: descriptor.writable, value: descriptor.initializer ? descriptor.initializer.call(context) : void 0 }); } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _applyDecoratedDescriptor(target, property, decorators, descriptor, context) { var desc = {}; Object.keys(descriptor).forEach(function (key) { desc[key] = descriptor[key]; }); desc.enumerable = !!desc.enumerable; desc.configurable = !!desc.configurable; if ('value' in desc || desc.initializer) { desc.writable = true; } desc = decorators.slice().reverse().reduce(function (desc, decorator) { return decorator(target, property, desc) || desc; }, desc); if (context && desc.initializer !== void 0) { desc.value = desc.initializer ? desc.initializer.call(context) : void 0; desc.initializer = undefined; } if (desc.initializer === void 0) { Object.defineProperty(target, property, desc); desc = null; } return desc; } + +function _initializerWarningHelper(descriptor, context) { throw new Error('Decorating class property failed. Please ensure that ' + 'proposal-class-properties is enabled and runs after the decorators transform.'); } + +function dec() {} + +let A = (_class = (_temp = function A() { + "use strict"; + + _classCallCheck(this, A); + + _initializerDefineProperty(this, "a", _descriptor, this); + + _initializerDefineProperty(this, "b", _descriptor2, this); + + this.c = 456; +}, _temp), (_descriptor = _applyDecoratedDescriptor(_class.prototype, "a", [dec], { + configurable: true, + enumerable: true, + writable: true, + initializer: null +}), _descriptor2 = _applyDecoratedDescriptor(_class.prototype, "b", [dec], { + configurable: true, + enumerable: true, + writable: true, + initializer: function () { + return 123; + } +})), _class); diff --git a/packages/babel-plugin-proposal-class-properties/test/fixtures/decorators-legacy-interop/strict/input.js b/packages/babel-plugin-proposal-class-properties/test/fixtures/decorators-legacy-interop/strict/input.js new file mode 100644 index 000000000000..92298f2eb49b --- /dev/null +++ b/packages/babel-plugin-proposal-class-properties/test/fixtures/decorators-legacy-interop/strict/input.js @@ -0,0 +1,9 @@ +function dec() {} + +class A { + @dec a; + + @dec b = 123; + + c = 456; +} diff --git a/packages/babel-plugin-proposal-class-properties/test/fixtures/decorators-legacy-interop/strict/options.json b/packages/babel-plugin-proposal-class-properties/test/fixtures/decorators-legacy-interop/strict/options.json new file mode 100644 index 000000000000..6f03cd7aad03 --- /dev/null +++ b/packages/babel-plugin-proposal-class-properties/test/fixtures/decorators-legacy-interop/strict/options.json @@ -0,0 +1,7 @@ +{ + "plugins": [ + ["proposal-decorators", { "legacy": true }], + ["proposal-class-properties"], + "transform-classes" + ] +} diff --git a/packages/babel-plugin-proposal-class-properties/test/fixtures/decorators-legacy-interop/strict/output.js b/packages/babel-plugin-proposal-class-properties/test/fixtures/decorators-legacy-interop/strict/output.js new file mode 100644 index 000000000000..11cce4ac923d --- /dev/null +++ b/packages/babel-plugin-proposal-class-properties/test/fixtures/decorators-legacy-interop/strict/output.js @@ -0,0 +1,37 @@ +var _class, _descriptor, _descriptor2, _temp; + +function _initializerDefineProperty(target, property, descriptor, context) { if (!descriptor) return; Object.defineProperty(target, property, { enumerable: descriptor.enumerable, configurable: descriptor.configurable, writable: descriptor.writable, value: descriptor.initializer ? descriptor.initializer.call(context) : void 0 }); } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } + +function _applyDecoratedDescriptor(target, property, decorators, descriptor, context) { var desc = {}; Object.keys(descriptor).forEach(function (key) { desc[key] = descriptor[key]; }); desc.enumerable = !!desc.enumerable; desc.configurable = !!desc.configurable; if ('value' in desc || desc.initializer) { desc.writable = true; } desc = decorators.slice().reverse().reduce(function (desc, decorator) { return decorator(target, property, desc) || desc; }, desc); if (context && desc.initializer !== void 0) { desc.value = desc.initializer ? desc.initializer.call(context) : void 0; desc.initializer = undefined; } if (desc.initializer === void 0) { Object.defineProperty(target, property, desc); desc = null; } return desc; } + +function _initializerWarningHelper(descriptor, context) { throw new Error('Decorating class property failed. Please ensure that ' + 'proposal-class-properties is enabled and runs after the decorators transform.'); } + +function dec() {} + +let A = (_class = (_temp = function A() { + "use strict"; + + _classCallCheck(this, A); + + _initializerDefineProperty(this, "a", _descriptor, this); + + _initializerDefineProperty(this, "b", _descriptor2, this); + + _defineProperty(this, "c", 456); +}, _temp), (_descriptor = _applyDecoratedDescriptor(_class.prototype, "a", [dec], { + configurable: true, + enumerable: true, + writable: true, + initializer: null +}), _descriptor2 = _applyDecoratedDescriptor(_class.prototype, "b", [dec], { + configurable: true, + enumerable: true, + writable: true, + initializer: function () { + return 123; + } +})), _class); diff --git a/packages/babel-plugin-proposal-class-properties/test/fixtures/static-property-tdz/decorator-interop/output.js b/packages/babel-plugin-proposal-class-properties/test/fixtures/static-property-tdz/decorator-interop/output.js index 2cd978b722c9..9a71c175287f 100644 --- a/packages/babel-plugin-proposal-class-properties/test/fixtures/static-property-tdz/decorator-interop/output.js +++ b/packages/babel-plugin-proposal-class-properties/test/fixtures/static-property-tdz/decorator-interop/output.js @@ -12,7 +12,7 @@ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _d function _applyDecoratedDescriptor(target, property, decorators, descriptor, context) { var desc = {}; Object.keys(descriptor).forEach(function (key) { desc[key] = descriptor[key]; }); desc.enumerable = !!desc.enumerable; desc.configurable = !!desc.configurable; if ('value' in desc || desc.initializer) { desc.writable = true; } desc = decorators.slice().reverse().reduce(function (desc, decorator) { return decorator(target, property, desc) || desc; }, desc); if (context && desc.initializer !== void 0) { desc.value = desc.initializer ? desc.initializer.call(context) : void 0; desc.initializer = undefined; } if (desc.initializer === void 0) { Object.defineProperty(target, property, desc); desc = null; } return desc; } -function _initializerWarningHelper(descriptor, context) { throw new Error('Decorating class property failed. Please ensure that ' + 'proposal-class-properties is enabled and set to use loose mode. ' + 'To use proposal-class-properties in spec mode with decorators, wait for ' + 'the next major version of decorators in stage 2.'); } +function _initializerWarningHelper(descriptor, context) { throw new Error('Decorating class property failed. Please ensure that ' + 'proposal-class-properties is enabled and runs after the decorators transform.'); } function dec() {} diff --git a/packages/babel-plugin-proposal-decorators/package.json b/packages/babel-plugin-proposal-decorators/package.json index bc14d4ebea01..38640821c184 100644 --- a/packages/babel-plugin-proposal-decorators/package.json +++ b/packages/babel-plugin-proposal-decorators/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-proposal-decorators", - "version": "7.4.4", + "version": "7.8.3", "author": "Logan Smyth ", "license": "MIT", "publishConfig": { @@ -15,15 +15,15 @@ "decorators" ], "dependencies": { - "@babel/helper-create-class-features-plugin": "^7.4.4", - "@babel/helper-plugin-utils": "^7.0.0", - "@babel/plugin-syntax-decorators": "^7.2.0" + "@babel/helper-create-class-features-plugin": "^7.8.3", + "@babel/helper-plugin-utils": "^7.8.3", + "@babel/plugin-syntax-decorators": "^7.8.3" }, "peerDependencies": { "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.4.4", - "@babel/helper-plugin-test-runner": "^7.0.0" + "@babel/core": "^7.8.3", + "@babel/helper-plugin-test-runner": "^7.8.3" } } diff --git a/packages/babel-plugin-proposal-decorators/src/transformer-legacy.js b/packages/babel-plugin-proposal-decorators/src/transformer-legacy.js index 0eb0ebdbd87a..ca23bad24824 100644 --- a/packages/babel-plugin-proposal-decorators/src/transformer-legacy.js +++ b/packages/babel-plugin-proposal-decorators/src/transformer-legacy.js @@ -237,7 +237,7 @@ export default { const replacement = decoratedClassToExpression(decl); if (replacement) { - path.replaceWithMultiple([ + const [varDeclPath] = path.replaceWithMultiple([ replacement, t.exportNamedDeclaration(null, [ t.exportSpecifier( @@ -246,6 +246,10 @@ export default { ), ]), ]); + + if (!decl.node.id) { + path.scope.registerDeclaration(varDeclPath); + } } }, ClassDeclaration(path) { @@ -277,10 +281,33 @@ export default { path.replaceWith( t.callExpression(state.addHelper("initializerDefineProperty"), [ t.cloneNode(path.get("left.object").node), - t.stringLiteral(path.get("left.property").node.name), + t.stringLiteral( + path.get("left.property").node.name || + path.get("left.property").node.value, + ), t.cloneNode(path.get("right.arguments")[0].node), t.cloneNode(path.get("right.arguments")[1].node), ]), ); }, + + CallExpression(path, state) { + if (path.node.arguments.length !== 3) return; + if (!WARNING_CALLS.has(path.node.arguments[2])) return; + + // If the class properties plugin isn't enabled, this line will add an unused helper + // to the code. It's not ideal, but it's ok since the configuration is not valid anyway. + if (path.node.callee.name !== state.addHelper("defineProperty").name) { + return; + } + + path.replaceWith( + t.callExpression(state.addHelper("initializerDefineProperty"), [ + t.cloneNode(path.get("arguments")[0].node), + t.cloneNode(path.get("arguments")[1].node), + t.cloneNode(path.get("arguments.2.arguments")[0].node), + t.cloneNode(path.get("arguments.2.arguments")[1].node), + ]), + ); + }, }; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/legacy-class-prototype-properties/string-literal-properties/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/legacy-class-prototype-properties/string-literal-properties/exec.js new file mode 100644 index 000000000000..c3e4ca274083 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/legacy-class-prototype-properties/string-literal-properties/exec.js @@ -0,0 +1,29 @@ +function dec(target, name, descriptor) { + expect(target).toBeTruthy(); + expect(typeof name).toBe("string"); + expect(typeof descriptor).toBe("object"); + + target.decoratedProps = (target.decoratedProps || []).concat([name]); + + return descriptor; +} + +class Example { + @dec "a-prop"; +} + +let inst = new Example(); + +expect(Example.prototype).toHaveProperty("decoratedProps"); +expect(inst.decoratedProps).toEqual([ + "a-prop" +]); + +expect(inst).toHaveProperty("a-prop"); +expect(inst["a-prop"]).toBeUndefined(); + +const descs = Object.getOwnPropertyDescriptors(inst); + +expect(descs["a-prop"].enumerable).toBeTruthy(); +expect(descs["a-prop"].writable).toBeTruthy(); +expect(descs["a-prop"].configurable).toBeTruthy(); diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/legacy-regression/10264/input.mjs b/packages/babel-plugin-proposal-decorators/test/fixtures/legacy-regression/10264/input.mjs new file mode 100644 index 000000000000..90ba5e106f57 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/legacy-regression/10264/input.mjs @@ -0,0 +1,4 @@ +function myDecorator(decoratee) {} + +@myDecorator +export default class {} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/legacy-regression/10264/options.json b/packages/babel-plugin-proposal-decorators/test/fixtures/legacy-regression/10264/options.json new file mode 100644 index 000000000000..ee996d3cfc6f --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/legacy-regression/10264/options.json @@ -0,0 +1,6 @@ +{ + "plugins": [ + "transform-typescript", + ["proposal-decorators", { "legacy": true }] + ] +} diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/legacy-regression/10264/output.mjs b/packages/babel-plugin-proposal-decorators/test/fixtures/legacy-regression/10264/output.mjs new file mode 100644 index 000000000000..5e99551db44a --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/legacy-regression/10264/output.mjs @@ -0,0 +1,7 @@ +var _class2; + +function myDecorator(decoratee) {} + +let _class = myDecorator(_class2 = class {}) || _class2; + +export { _class as default }; diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/transformation/async-generator-method/options.json b/packages/babel-plugin-proposal-decorators/test/fixtures/transformation/async-generator-method/options.json index a3587a401c6c..0c2c9bd2056d 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/transformation/async-generator-method/options.json +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/transformation/async-generator-method/options.json @@ -2,7 +2,6 @@ "plugins": [ ["proposal-decorators", { "decoratorsBeforeExport": false }], "proposal-class-properties", - "syntax-async-generators", ["external-helpers", { "helperVersion": "7.1.5" }] ] } diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/transformation/class-decorators-yield-await/options.json b/packages/babel-plugin-proposal-decorators/test/fixtures/transformation/class-decorators-yield-await/options.json index 7879b5a6675a..0fbe73eecd01 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/transformation/class-decorators-yield-await/options.json +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/transformation/class-decorators-yield-await/options.json @@ -7,7 +7,6 @@ { "helperVersion": "7.1.5" } - ], - "syntax-async-generators" + ] ] } diff --git a/packages/babel-plugin-proposal-do-expressions/package.json b/packages/babel-plugin-proposal-do-expressions/package.json index 8293f38f0326..caed351d0116 100644 --- a/packages/babel-plugin-proposal-do-expressions/package.json +++ b/packages/babel-plugin-proposal-do-expressions/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-proposal-do-expressions", - "version": "7.5.0", + "version": "7.8.3", "description": "Compile do expressions to ES5", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-proposal-do-expressions", "license": "MIT", @@ -12,14 +12,14 @@ "babel-plugin" ], "dependencies": { - "@babel/helper-plugin-utils": "^7.0.0", - "@babel/plugin-syntax-do-expressions": "^7.2.0" + "@babel/helper-plugin-utils": "^7.8.3", + "@babel/plugin-syntax-do-expressions": "^7.8.3" }, "peerDependencies": { "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.5.0", - "@babel/helper-plugin-test-runner": "^7.0.0" + "@babel/core": "^7.8.3", + "@babel/helper-plugin-test-runner": "^7.8.3" } } diff --git a/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/.fallthrough-multiblock/exec.js b/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/.fallthrough-multiblock/exec.js new file mode 100644 index 000000000000..3811a50b2494 --- /dev/null +++ b/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/.fallthrough-multiblock/exec.js @@ -0,0 +1,36 @@ +// `blockExpressions` before `break` is hard to deal with +// https://github.com/babel/babel/pull/10070#discussion_r296048106 +const x = (n) => do { + switch (n) { + case 0: + { "a"; } + { "b"; }; + case 1: + { "c"; } + break; + { "d"; }; + case 2: + "a"; + "b"; + case 3: + {} + { break; } + case 4: + { "d"; } + { "e"; } + case 5: + "f"; + case 6: + {} + case 7: + } +} + +expect(x(0)).toBe('c') +expect(x(1)).toBe('c') +expect(x(2)).toBeUndefined() +expect(x(3)).toBeUndefined() +expect(x(4)).toBe('f') +expect(x(5)).toBe('f') +expect(x(6)).toBeUndefined() +expect(x(7)).toBeUndefined() diff --git a/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/.fallthrough-multiblock/input.js b/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/.fallthrough-multiblock/input.js new file mode 100644 index 000000000000..adda24b703d1 --- /dev/null +++ b/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/.fallthrough-multiblock/input.js @@ -0,0 +1,25 @@ +const x = (n) => do { + switch (n) { + case 0: + { "a"; } + { "b"; }; + case 1: + { "c"; } + break; + { "d"; }; + case 2: + "a"; + "b"; + case 3: + {} + { break; } + case 4: + { "a"; } + { "b"; } + case 5: + "c"; + case 6: + {} + case 7: + } +} \ No newline at end of file diff --git a/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/declaration-before-break/input.js b/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/declaration-before-break/input.js new file mode 100644 index 000000000000..3e64d8911875 --- /dev/null +++ b/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/declaration-before-break/input.js @@ -0,0 +1,9 @@ +const x = (n) => do { + switch (n) { + case 0: + case 6: + const b = 1; + break; + default: 'bar'; + } +} diff --git a/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/declaration-before-break/output.js b/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/declaration-before-break/output.js new file mode 100644 index 000000000000..a438311f5e24 --- /dev/null +++ b/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/declaration-before-break/output.js @@ -0,0 +1,11 @@ +const x = n => function () { + switch (n) { + case 0: + case 6: + const b = 1; + return void 0; + + default: + return 'bar'; + } +}(); diff --git a/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/empty-case-block/input.js b/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/empty-case-block/input.js new file mode 100644 index 000000000000..920878526152 --- /dev/null +++ b/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/empty-case-block/input.js @@ -0,0 +1,7 @@ +const x = () => do { + switch (new Date().getDay()) { + case 0: + break; + default: "weekday 🚴" + } +} diff --git a/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/empty-case-block/output.js b/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/empty-case-block/output.js new file mode 100644 index 000000000000..15fb9f3537ff --- /dev/null +++ b/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/empty-case-block/output.js @@ -0,0 +1,9 @@ +const x = () => function () { + switch (new Date().getDay()) { + case 0: + return void 0; + + default: + return "weekday 🚴"; + } +}(); diff --git a/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/fallthrough-block-last/exec.js b/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/fallthrough-block-last/exec.js new file mode 100644 index 000000000000..395fdf6f0538 --- /dev/null +++ b/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/fallthrough-block-last/exec.js @@ -0,0 +1,26 @@ +const x = (n) => do { + switch (n) { + case 0: { + 'a'; + } + case 1: { + 'b'; + break; + } + default: { + 'd'; + } + case 2: { + 'c'; + } + case 3: + case 4: + } +} + +expect(x(0)).toBe('b'); +expect(x(1)).toBe('b'); +expect(x(2)).toBe('c'); +expect(x(3)).toBeUndefined(); +expect(x(4)).toBeUndefined(); +expect(x(5)).toBe('c'); \ No newline at end of file diff --git a/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/fallthrough-block-last/input.js b/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/fallthrough-block-last/input.js new file mode 100644 index 000000000000..e9c30a6b4550 --- /dev/null +++ b/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/fallthrough-block-last/input.js @@ -0,0 +1,19 @@ +const x = (n) => do { + switch (n) { + case 0: { + 'a'; + } + case 1: { + 'b'; + break; + } + default: { + 'd'; + } + case 2: { + 'c'; + } + case 3: + case 4: + } +} \ No newline at end of file diff --git a/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/fallthrough-block-last/output.js b/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/fallthrough-block-last/output.js new file mode 100644 index 000000000000..91f6ebcdc15c --- /dev/null +++ b/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/fallthrough-block-last/output.js @@ -0,0 +1,26 @@ +const x = n => function () { + switch (n) { + case 0: + { + 'a'; + } + + case 1: + { + return 'b'; + } + + default: + { + 'd'; + } + + case 2: + { + return 'c'; + } + + case 3: + case 4: + } +}(); diff --git a/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/fallthrough-block/exec.js b/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/fallthrough-block/exec.js new file mode 100644 index 000000000000..f9593ecc8cdb --- /dev/null +++ b/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/fallthrough-block/exec.js @@ -0,0 +1,30 @@ +const x = (n) => do { + switch (n) { + case 0: { + 'a'; + } + case 1: { + 'b'; + break; + } + case 2: { + 'c'; + break; + } + case 3: { + break; + } + case 4: { + 'd'; + 'e'; + } + default: 'f'; + } +} + +expect(x(0)).toBe('b'); +expect(x(1)).toBe('b'); +expect(x(2)).toBe('c'); +expect(x(3)).toBeUndefined(); +expect(x(4)).toBe('f'); +expect(x(5)).toBe('f'); \ No newline at end of file diff --git a/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/fallthrough-block/input.js b/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/fallthrough-block/input.js new file mode 100644 index 000000000000..768140a79198 --- /dev/null +++ b/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/fallthrough-block/input.js @@ -0,0 +1,23 @@ +const x = (n) => do { + switch (n) { + case 0: { + 'a'; + } + case 1: { + 'b'; + break; + } + case 2: { + 'c'; + break; + } + case 3: { + break; + } + case 4: { + 'd'; + 'e'; + } + default: 'f'; + } +} \ No newline at end of file diff --git a/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/fallthrough-block/output.js b/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/fallthrough-block/output.js new file mode 100644 index 000000000000..4bf150750242 --- /dev/null +++ b/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/fallthrough-block/output.js @@ -0,0 +1,30 @@ +const x = n => function () { + switch (n) { + case 0: + { + 'a'; + } + + case 1: + { + return 'b'; + } + + case 2: + { + return 'c'; + } + + case 3: + return void 0; + + case 4: + { + 'd'; + 'e'; + } + + default: + return 'f'; + } +}(); diff --git a/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/fallthrough-last/exec.js b/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/fallthrough-last/exec.js new file mode 100644 index 000000000000..f1a689aa3e1a --- /dev/null +++ b/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/fallthrough-last/exec.js @@ -0,0 +1,21 @@ +const x = (n) => do { + switch (n) { + case 0: + 'a'; + case 1: + 'b'; + break; + default: 'd'; + case 2: + 'c'; + case 3: + case 4: + } +} + +expect(x(0)).toBe('b'); +expect(x(1)).toBe('b'); +expect(x(2)).toBe('c'); +expect(x(3)).toBeUndefined(); +expect(x(4)).toBeUndefined(); +expect(x(5)).toBe('c'); \ No newline at end of file diff --git a/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/fallthrough-last/input.js b/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/fallthrough-last/input.js new file mode 100644 index 000000000000..0c432fe07022 --- /dev/null +++ b/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/fallthrough-last/input.js @@ -0,0 +1,14 @@ +const x = (n) => do { + switch (n) { + case 0: + 'a'; + case 1: + 'b'; + break; + default: 'd'; + case 2: + 'c'; + case 3: + case 4: + } +} \ No newline at end of file diff --git a/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/fallthrough-last/output.js b/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/fallthrough-last/output.js new file mode 100644 index 000000000000..85bec17a0cda --- /dev/null +++ b/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/fallthrough-last/output.js @@ -0,0 +1,18 @@ +const x = n => function () { + switch (n) { + case 0: + 'a'; + + case 1: + return 'b'; + + default: + 'd'; + + case 2: + return 'c'; + + case 3: + case 4: + } +}(); diff --git a/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/fallthrough/exec.js b/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/fallthrough/exec.js new file mode 100644 index 000000000000..6531d426eca8 --- /dev/null +++ b/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/fallthrough/exec.js @@ -0,0 +1,25 @@ +const x = (n) => do { + switch (n) { + case 0: + 'a'; + case 1: + 'b'; + break; + case 2: + 'c'; + break; + case 3: + break; + case 4: + 'd'; + 'e'; + default: 'f'; + } +} + +expect(x(0)).toBe('b'); +expect(x(1)).toBe('b'); +expect(x(2)).toBe('c'); +expect(x(3)).toBeUndefined(); +expect(x(4)).toBe('f'); +expect(x(5)).toBe('f'); diff --git a/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/fallthrough/input.js b/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/fallthrough/input.js new file mode 100644 index 000000000000..ea14170edc44 --- /dev/null +++ b/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/fallthrough/input.js @@ -0,0 +1,18 @@ +const x = (n) => do { + switch (n) { + case 0: + 'a'; + case 1: + 'b'; + break; + case 2: + 'c'; + break; + case 3: + break; + case 4: + 'd'; + 'e'; + default: 'f'; + } +} \ No newline at end of file diff --git a/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/fallthrough/output.js b/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/fallthrough/output.js new file mode 100644 index 000000000000..a006d36deea8 --- /dev/null +++ b/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/fallthrough/output.js @@ -0,0 +1,22 @@ +const x = n => function () { + switch (n) { + case 0: + 'a'; + + case 1: + return 'b'; + + case 2: + return 'c'; + + case 3: + return void 0; + + case 4: + 'd'; + 'e'; + + default: + return 'f'; + } +}(); diff --git a/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/multi-consequent-multiblock/exec.js b/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/multi-consequent-multiblock/exec.js new file mode 100644 index 000000000000..da1fb5e8764b --- /dev/null +++ b/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/multi-consequent-multiblock/exec.js @@ -0,0 +1,36 @@ +const x = (n) => do { + switch (n) { + case 0: + { "a"; } + { break; } + { "b"; }; + case 1: + { "a"; } + break; + { "b"; }; + case 2: + "a"; + { break; } + "b"; + case 3: + "a"; + { "b"; break; } + { "c"; } + case 4: + { "a"; } + { "b"; } + { "c"; break; "d" } + { "e"; break; "f" } + case 5: + { "a"; } + { break; "b"; } + { break; "c"; } + } +} + +expect(x(0)).toBe('a') +expect(x(1)).toBe('a') +expect(x(2)).toBe('a') +expect(x(3)).toBe('b') +expect(x(4)).toBe('c') +expect(x(5)).toBe('a') diff --git a/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/multi-consequent-multiblock/input.js b/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/multi-consequent-multiblock/input.js new file mode 100644 index 000000000000..f038e3b27b39 --- /dev/null +++ b/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/multi-consequent-multiblock/input.js @@ -0,0 +1,29 @@ +const x = (n) => do { + switch (n) { + case 0: + { "a"; } + { break; } + { "b"; }; + case 1: + { "a"; } + break; + { "b"; }; + case 2: + "a"; + { break; } + "b"; + case 3: + "a"; + { "b"; break; } + { "c"; } + case 4: + { "a"; } + { "b"; } + { "c"; break; "d" } + { "e"; break; "f" } + case 5: + { "a"; } + { break; "b"; } + { break; "c"; } + } +} \ No newline at end of file diff --git a/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/multi-consequent-multiblock/output.js b/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/multi-consequent-multiblock/output.js new file mode 100644 index 000000000000..a51ac54ca308 --- /dev/null +++ b/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/multi-consequent-multiblock/output.js @@ -0,0 +1,60 @@ +const x = n => function () { + switch (n) { + case 0: + { + return "a"; + } + { + "b"; + } + ; + + case 1: + { + return "a"; + } + { + "b"; + } + ; + + case 2: + return "a"; + "b"; + + case 3: + "a"; + { + return "b"; + } + { + "c"; + } + + case 4: + { + "a"; + } + { + "b"; + } + { + return "c"; + "d"; + } + { + "e"; + break; + "f"; + } + + case 5: + { + return "a"; + } + { + break; + "c"; + } + } +}(); diff --git a/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/multiple-break/exec.js b/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/multiple-break/exec.js new file mode 100644 index 000000000000..5ae85c2392e4 --- /dev/null +++ b/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/multiple-break/exec.js @@ -0,0 +1,19 @@ +const x = (n) => do { + switch (n) { + case 0: + 'a'; + break; + 'b'; + 'c'; + break; + 'd'; + case 6: + 'e'; + default: + 'f' + } +} + +expect(x(0)).toBe('a'); +expect(x(1)).toBe('f'); +expect(x(6)).toBe('f'); \ No newline at end of file diff --git a/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/multiple-break/input.js b/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/multiple-break/input.js new file mode 100644 index 000000000000..fd57351fe300 --- /dev/null +++ b/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/multiple-break/input.js @@ -0,0 +1,15 @@ +const x = (n) => do { + switch (n) { + case 0: + 'a'; + break; + 'b'; + 'c'; + break; + 'd'; + case 6: + 'e'; + default: + 'f' + } +} diff --git a/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/multiple-break/output.js b/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/multiple-break/output.js new file mode 100644 index 000000000000..36f4c4abcb8b --- /dev/null +++ b/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/multiple-break/output.js @@ -0,0 +1,16 @@ +const x = n => function () { + switch (n) { + case 0: + return 'a'; + 'b'; + 'c'; + break; + 'd'; + + case 6: + 'e'; + + default: + return 'f'; + } +}(); diff --git a/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/multiple-consequent-block/exec.js b/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/multiple-consequent-block/exec.js new file mode 100644 index 000000000000..0a2bce023197 --- /dev/null +++ b/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/multiple-consequent-block/exec.js @@ -0,0 +1,32 @@ +const x = (n) => do { + switch (n) { + case 0: { + 'a'; + break; + } + case 1: { + 'b'; + break; + 'c'; + break; + 'd'; + } + case 2: { + 'e'; + const a = 'e'; + break; + } + case 3: { + const a = 'f'; + break; + 'f'; + } + default: 'g'; + } +} + +expect(x(0)).toBe('a'); +expect(x(1)).toBe('b'); +expect(x(2)).toBeUndefined(); +expect(x(3)).toBeUndefined(); +expect(x(4)).toBe('g'); \ No newline at end of file diff --git a/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/multiple-consequent-block/input.js b/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/multiple-consequent-block/input.js new file mode 100644 index 000000000000..d859f871f276 --- /dev/null +++ b/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/multiple-consequent-block/input.js @@ -0,0 +1,27 @@ +const x = (n) => do { + switch (n) { + case 0: { + get(); + 'a'; + break; + } + case 1: { + 'b'; + break; + 'c'; + break; + 'd'; + } + case 2: { + 'e'; + const a = 'e'; + break; + } + case 3: { + const a = 'f'; + break; + 'f'; + } + default: 'g'; + } +} diff --git a/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/multiple-consequent-block/output.js b/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/multiple-consequent-block/output.js new file mode 100644 index 000000000000..b5d77d0ff7cd --- /dev/null +++ b/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/multiple-consequent-block/output.js @@ -0,0 +1,34 @@ +const x = n => function () { + switch (n) { + case 0: + { + get(); + return 'a'; + } + + case 1: + { + return 'b'; + 'c'; + break; + 'd'; + } + + case 2: + { + 'e'; + const a = 'e'; + return void 0; + } + + case 3: + { + const a = 'f'; + return void 0; + 'f'; + } + + default: + return 'g'; + } +}(); diff --git a/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/multiple-consequent/input.js b/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/multiple-consequent/input.js new file mode 100644 index 000000000000..5ef4ca35d4cc --- /dev/null +++ b/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/multiple-consequent/input.js @@ -0,0 +1,9 @@ +const x = () => do { + switch (new Date().getDay()) { + case 0: + get(); + 1+1; + break; + default: "weekday 🚴" + } +} diff --git a/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/multiple-consequent/output.js b/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/multiple-consequent/output.js new file mode 100644 index 000000000000..ad928a82a82d --- /dev/null +++ b/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/multiple-consequent/output.js @@ -0,0 +1,10 @@ +const x = () => function () { + switch (new Date().getDay()) { + case 0: + get(); + return 1 + 1; + + default: + return "weekday 🚴"; + } +}(); diff --git a/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/options.json b/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/options.json new file mode 100644 index 000000000000..96d2eb705b15 --- /dev/null +++ b/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["proposal-do-expressions"] +} diff --git a/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/single-consequent-block/exec.js b/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/single-consequent-block/exec.js new file mode 100644 index 000000000000..bfb6d498243b --- /dev/null +++ b/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/single-consequent-block/exec.js @@ -0,0 +1,13 @@ +const x = (n) => do { + switch (n) { + case 0: case 6: { + "weekend 🚵"; + break; + } + default: "weekday 🚴" + } +} + +expect(x(0)).toBe('weekend 🚵') +expect(x(1)).toBe('weekday 🚴') +expect(x(6)).toBe('weekend 🚵') \ No newline at end of file diff --git a/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/single-consequent-block/input.js b/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/single-consequent-block/input.js new file mode 100644 index 000000000000..8f41efb7ea45 --- /dev/null +++ b/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/single-consequent-block/input.js @@ -0,0 +1,9 @@ +const x = (n) => do { + switch (n) { + case 0: case 6: { + "weekend 🚵"; + break; + } + default: "weekday 🚴" + } +} diff --git a/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/single-consequent-block/output.js b/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/single-consequent-block/output.js new file mode 100644 index 000000000000..12d69e7a3448 --- /dev/null +++ b/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/single-consequent-block/output.js @@ -0,0 +1,12 @@ +const x = n => function () { + switch (n) { + case 0: + case 6: + { + return "weekend 🚵"; + } + + default: + return "weekday 🚴"; + } +}(); diff --git a/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/single-consequent/exec.js b/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/single-consequent/exec.js new file mode 100644 index 000000000000..c48058f0b36d --- /dev/null +++ b/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/single-consequent/exec.js @@ -0,0 +1,10 @@ +const x = (n) => do { + switch (n) { + case 0: case 6: "weekend 🚵"; break + default: "weekday 🚴" + } +} + +expect(x(0)).toBe('weekend 🚵') +expect(x(1)).toBe('weekday 🚴') +expect(x(6)).toBe('weekend 🚵') \ No newline at end of file diff --git a/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/single-consequent/input.js b/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/single-consequent/input.js new file mode 100644 index 000000000000..e3012915a365 --- /dev/null +++ b/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/single-consequent/input.js @@ -0,0 +1,6 @@ +const x = (n) => do { + switch (n) { + case 0: case 6: "weekend 🚵"; break + default: "weekday 🚴" + } +} diff --git a/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/single-consequent/output.js b/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/single-consequent/output.js new file mode 100644 index 000000000000..2c7f6486cefc --- /dev/null +++ b/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expression-switch-case/single-consequent/output.js @@ -0,0 +1,10 @@ +const x = n => function () { + switch (n) { + case 0: + case 6: + return "weekend 🚵"; + + default: + return "weekday 🚴"; + } +}(); diff --git a/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expressions/await/options.json b/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expressions/await/options.json index 7edb6d2fc815..2454c2169cf8 100644 --- a/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expressions/await/options.json +++ b/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expressions/await/options.json @@ -1,3 +1,3 @@ { "minNodeVersion": "8.0.0" -} \ No newline at end of file +} diff --git a/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expressions/finally-block/input.js b/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expressions/finally-block/input.js new file mode 100644 index 000000000000..8827149f32f9 --- /dev/null +++ b/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expressions/finally-block/input.js @@ -0,0 +1,9 @@ +const x = do { + try { + a(); + } catch (e) { + b(); + } finally { + c(); + } +} diff --git a/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expressions/finally-block/options.json b/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expressions/finally-block/options.json new file mode 100644 index 000000000000..116249a4f7a7 --- /dev/null +++ b/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expressions/finally-block/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["transform-block-scoping", "proposal-do-expressions"] +} diff --git a/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expressions/finally-block/output.js b/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expressions/finally-block/output.js new file mode 100644 index 000000000000..22a29ec91b8b --- /dev/null +++ b/packages/babel-plugin-proposal-do-expressions/test/fixtures/do-expressions/finally-block/output.js @@ -0,0 +1,9 @@ +var x = function () { + try { + return a(); + } catch (e) { + return b(); + } finally { + c(); + } +}(); diff --git a/packages/babel-plugin-proposal-dynamic-import/package.json b/packages/babel-plugin-proposal-dynamic-import/package.json index a691155641e4..48853a52b62a 100644 --- a/packages/babel-plugin-proposal-dynamic-import/package.json +++ b/packages/babel-plugin-proposal-dynamic-import/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-proposal-dynamic-import", - "version": "7.5.0", + "version": "7.8.3", "description": "Transform import() expressions", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-proposal-dynamic-import", "license": "MIT", @@ -12,14 +12,14 @@ "babel-plugin" ], "dependencies": { - "@babel/helper-plugin-utils": "^7.0.0", - "@babel/plugin-syntax-dynamic-import": "^7.2.0" + "@babel/helper-plugin-utils": "^7.8.3", + "@babel/plugin-syntax-dynamic-import": "^7.8.0" }, "peerDependencies": { "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.5.0", - "@babel/helper-plugin-test-runner": "^7.0.0" + "@babel/core": "^7.8.3", + "@babel/helper-plugin-test-runner": "^7.8.3" } } diff --git a/packages/babel-plugin-proposal-dynamic-import/test/fixtures/amd/missing-plugin/options.json b/packages/babel-plugin-proposal-dynamic-import/test/fixtures/amd/missing-plugin/options.json index 97137d02166f..2a0c361b6895 100644 --- a/packages/babel-plugin-proposal-dynamic-import/test/fixtures/amd/missing-plugin/options.json +++ b/packages/babel-plugin-proposal-dynamic-import/test/fixtures/amd/missing-plugin/options.json @@ -1,6 +1,5 @@ { "plugins": [ - "syntax-dynamic-import", "transform-modules-amd", "external-helpers" ] diff --git a/packages/babel-plugin-proposal-dynamic-import/test/fixtures/commonjs/exec-interop-null/exec.js b/packages/babel-plugin-proposal-dynamic-import/test/fixtures/commonjs/exec-interop-null/exec.js new file mode 100644 index 000000000000..a1d2711151d0 --- /dev/null +++ b/packages/babel-plugin-proposal-dynamic-import/test/fixtures/commonjs/exec-interop-null/exec.js @@ -0,0 +1,3 @@ +return import("./mod.js").then(({ default: def }) => { + expect(def).toBe(null); +}); diff --git a/packages/babel-plugin-proposal-dynamic-import/test/fixtures/commonjs/exec-interop-null/mod.js b/packages/babel-plugin-proposal-dynamic-import/test/fixtures/commonjs/exec-interop-null/mod.js new file mode 100644 index 000000000000..c8a9c8ebee78 --- /dev/null +++ b/packages/babel-plugin-proposal-dynamic-import/test/fixtures/commonjs/exec-interop-null/mod.js @@ -0,0 +1 @@ +module.exports = null; \ No newline at end of file diff --git a/packages/babel-plugin-proposal-dynamic-import/test/fixtures/commonjs/exec-interop-null/options.json b/packages/babel-plugin-proposal-dynamic-import/test/fixtures/commonjs/exec-interop-null/options.json new file mode 100644 index 000000000000..eeebc1a57738 --- /dev/null +++ b/packages/babel-plugin-proposal-dynamic-import/test/fixtures/commonjs/exec-interop-null/options.json @@ -0,0 +1,5 @@ +{ + "parserOpts": { + "allowReturnOutsideFunction": true + } +} diff --git a/packages/babel-plugin-proposal-dynamic-import/test/fixtures/commonjs/exec-interop-string/exec.js b/packages/babel-plugin-proposal-dynamic-import/test/fixtures/commonjs/exec-interop-string/exec.js new file mode 100644 index 000000000000..e228b3fbc3a9 --- /dev/null +++ b/packages/babel-plugin-proposal-dynamic-import/test/fixtures/commonjs/exec-interop-string/exec.js @@ -0,0 +1,3 @@ +return import("./mod.js").then(({ default: def }) => { + expect(def).toBe("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8z8BQDwAEhQGAhKmMIQAAAABJRU5ErkJggg=="); +}); diff --git a/packages/babel-plugin-proposal-dynamic-import/test/fixtures/commonjs/exec-interop-string/mod.js b/packages/babel-plugin-proposal-dynamic-import/test/fixtures/commonjs/exec-interop-string/mod.js new file mode 100644 index 000000000000..bfd0466f4c1d --- /dev/null +++ b/packages/babel-plugin-proposal-dynamic-import/test/fixtures/commonjs/exec-interop-string/mod.js @@ -0,0 +1 @@ +module.exports = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8z8BQDwAEhQGAhKmMIQAAAABJRU5ErkJggg=="; \ No newline at end of file diff --git a/packages/babel-plugin-proposal-dynamic-import/test/fixtures/commonjs/exec-interop-string/options.json b/packages/babel-plugin-proposal-dynamic-import/test/fixtures/commonjs/exec-interop-string/options.json new file mode 100644 index 000000000000..eeebc1a57738 --- /dev/null +++ b/packages/babel-plugin-proposal-dynamic-import/test/fixtures/commonjs/exec-interop-string/options.json @@ -0,0 +1,5 @@ +{ + "parserOpts": { + "allowReturnOutsideFunction": true + } +} diff --git a/packages/babel-plugin-proposal-dynamic-import/test/fixtures/commonjs/missing-plugin/options.json b/packages/babel-plugin-proposal-dynamic-import/test/fixtures/commonjs/missing-plugin/options.json index d0f7c55cbaa3..46b55e8254a8 100644 --- a/packages/babel-plugin-proposal-dynamic-import/test/fixtures/commonjs/missing-plugin/options.json +++ b/packages/babel-plugin-proposal-dynamic-import/test/fixtures/commonjs/missing-plugin/options.json @@ -1,6 +1,5 @@ { "plugins": [ - "syntax-dynamic-import", "transform-modules-commonjs", "external-helpers" ] diff --git a/packages/babel-plugin-proposal-dynamic-import/test/fixtures/systemjs/missing-plugin/options.json b/packages/babel-plugin-proposal-dynamic-import/test/fixtures/systemjs/missing-plugin/options.json index c4fe39793abd..28922079e566 100644 --- a/packages/babel-plugin-proposal-dynamic-import/test/fixtures/systemjs/missing-plugin/options.json +++ b/packages/babel-plugin-proposal-dynamic-import/test/fixtures/systemjs/missing-plugin/options.json @@ -1,6 +1,6 @@ { + "validateLogs": true, "plugins": [ - "syntax-dynamic-import", "transform-modules-systemjs", "external-helpers" ] diff --git a/packages/babel-plugin-proposal-dynamic-import/test/fixtures/systemjs/missing-plugin/stderr.txt b/packages/babel-plugin-proposal-dynamic-import/test/fixtures/systemjs/missing-plugin/stderr.txt new file mode 100644 index 000000000000..6a64047d50bc --- /dev/null +++ b/packages/babel-plugin-proposal-dynamic-import/test/fixtures/systemjs/missing-plugin/stderr.txt @@ -0,0 +1,3 @@ +WARNING: Dynamic import() transformation must be enabled using the + @babel/plugin-proposal-dynamic-import plugin. Babel 8 will + no longer transform import() without using that plugin. diff --git a/packages/babel-plugin-proposal-export-default-from/package.json b/packages/babel-plugin-proposal-export-default-from/package.json index 5062421a48ed..a6bd8e3fe4d2 100644 --- a/packages/babel-plugin-proposal-export-default-from/package.json +++ b/packages/babel-plugin-proposal-export-default-from/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-proposal-export-default-from", - "version": "7.5.2", + "version": "7.8.3", "description": "Compile export default to ES2015", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-proposal-export-default-from", "license": "MIT", @@ -12,14 +12,14 @@ "babel-plugin" ], "dependencies": { - "@babel/helper-plugin-utils": "^7.0.0", - "@babel/plugin-syntax-export-default-from": "^7.2.0" + "@babel/helper-plugin-utils": "^7.8.3", + "@babel/plugin-syntax-export-default-from": "^7.8.3" }, "peerDependencies": { "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.2.0", - "@babel/helper-plugin-test-runner": "^7.0.0" + "@babel/core": "^7.8.3", + "@babel/helper-plugin-test-runner": "^7.8.3" } } diff --git a/packages/babel-plugin-proposal-export-namespace-from/package.json b/packages/babel-plugin-proposal-export-namespace-from/package.json index 1f0081f49c38..6221a03cb80b 100644 --- a/packages/babel-plugin-proposal-export-namespace-from/package.json +++ b/packages/babel-plugin-proposal-export-namespace-from/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-proposal-export-namespace-from", - "version": "7.5.2", + "version": "7.8.3", "description": "Compile export namespace to ES2015", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-proposal-export-namespace-from", "license": "MIT", @@ -12,14 +12,14 @@ "babel-plugin" ], "dependencies": { - "@babel/helper-plugin-utils": "^7.0.0", - "@babel/plugin-syntax-export-namespace-from": "^7.2.0" + "@babel/helper-plugin-utils": "^7.8.3", + "@babel/plugin-syntax-export-namespace-from": "^7.8.3" }, "peerDependencies": { "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.2.0", - "@babel/helper-plugin-test-runner": "^7.0.0" + "@babel/core": "^7.8.3", + "@babel/helper-plugin-test-runner": "^7.8.3" } } diff --git a/packages/babel-plugin-proposal-function-bind/package.json b/packages/babel-plugin-proposal-function-bind/package.json index 177ce26ee514..d80c7d5a9227 100644 --- a/packages/babel-plugin-proposal-function-bind/package.json +++ b/packages/babel-plugin-proposal-function-bind/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-proposal-function-bind", - "version": "7.2.0", + "version": "7.8.3", "description": "Compile function bind operator to ES5", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-proposal-function-bind", "license": "MIT", @@ -12,14 +12,14 @@ "babel-plugin" ], "dependencies": { - "@babel/helper-plugin-utils": "^7.0.0", - "@babel/plugin-syntax-function-bind": "^7.2.0" + "@babel/helper-plugin-utils": "^7.8.3", + "@babel/plugin-syntax-function-bind": "^7.8.3" }, "peerDependencies": { "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.2.0", - "@babel/helper-plugin-test-runner": "^7.0.0" + "@babel/core": "^7.8.3", + "@babel/helper-plugin-test-runner": "^7.8.3" } } diff --git a/packages/babel-plugin-proposal-function-sent/package.json b/packages/babel-plugin-proposal-function-sent/package.json index 0ba394b625af..4b5fac4f6f4e 100644 --- a/packages/babel-plugin-proposal-function-sent/package.json +++ b/packages/babel-plugin-proposal-function-sent/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-proposal-function-sent", - "version": "7.5.0", + "version": "7.8.3", "description": "Compile the function.sent meta property to valid ES2015 code", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-proposal-function-sent", "license": "MIT", @@ -12,15 +12,15 @@ "babel-plugin" ], "dependencies": { - "@babel/helper-plugin-utils": "^7.0.0", - "@babel/helper-wrap-function": "^7.2.0", - "@babel/plugin-syntax-function-sent": "^7.2.0" + "@babel/helper-plugin-utils": "^7.8.3", + "@babel/helper-wrap-function": "^7.8.3", + "@babel/plugin-syntax-function-sent": "^7.8.3" }, "peerDependencies": { "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.5.0", - "@babel/helper-plugin-test-runner": "^7.0.0" + "@babel/core": "^7.8.3", + "@babel/helper-plugin-test-runner": "^7.8.3" } } diff --git a/packages/babel-plugin-proposal-function-sent/test/fixtures/generator-kinds/async-generator/output.js b/packages/babel-plugin-proposal-function-sent/test/fixtures/generator-kinds/async-generator/output.js index a05d6843d84e..8bccb5d80c6c 100644 --- a/packages/babel-plugin-proposal-function-sent/test/fixtures/generator-kinds/async-generator/output.js +++ b/packages/babel-plugin-proposal-function-sent/test/fixtures/generator-kinds/async-generator/output.js @@ -4,7 +4,7 @@ function _awaitAsyncGenerator(value) { return new _AwaitValue(value); } function _wrapAsyncGenerator(fn) { return function () { return new _AsyncGenerator(fn.apply(this, arguments)); }; } -function _AsyncGenerator(gen) { var front, back; function send(key, arg) { return new Promise(function (resolve, reject) { var request = { key: key, arg: arg, resolve: resolve, reject: reject, next: null }; if (back) { back = back.next = request; } else { front = back = request; resume(key, arg); } }); } function resume(key, arg) { try { var result = gen[key](arg); var value = result.value; var wrappedAwait = value instanceof _AwaitValue; Promise.resolve(wrappedAwait ? value.wrapped : value).then(function (arg) { if (wrappedAwait) { resume("next", arg); return; } settle(result.done ? "return" : "normal", arg); }, function (err) { resume("throw", err); }); } catch (err) { settle("throw", err); } } function settle(type, value) { switch (type) { case "return": front.resolve({ value: value, done: true }); break; case "throw": front.reject(value); break; default: front.resolve({ value: value, done: false }); break; } front = front.next; if (front) { resume(front.key, front.arg); } else { back = null; } } this._invoke = send; if (typeof gen.return !== "function") { this.return = undefined; } } +function _AsyncGenerator(gen) { var front, back; function send(key, arg) { return new Promise(function (resolve, reject) { var request = { key: key, arg: arg, resolve: resolve, reject: reject, next: null }; if (back) { back = back.next = request; } else { front = back = request; resume(key, arg); } }); } function resume(key, arg) { try { var result = gen[key](arg); var value = result.value; var wrappedAwait = value instanceof _AwaitValue; Promise.resolve(wrappedAwait ? value.wrapped : value).then(function (arg) { if (wrappedAwait) { resume(key === "return" ? "return" : "next", arg); return; } settle(result.done ? "return" : "normal", arg); }, function (err) { resume("throw", err); }); } catch (err) { settle("throw", err); } } function settle(type, value) { switch (type) { case "return": front.resolve({ value: value, done: true }); break; case "throw": front.reject(value); break; default: front.resolve({ value: value, done: false }); break; } front = front.next; if (front) { resume(front.key, front.arg); } else { back = null; } } this._invoke = send; if (typeof gen.return !== "function") { this.return = undefined; } } if (typeof Symbol === "function" && Symbol.asyncIterator) { _AsyncGenerator.prototype[Symbol.asyncIterator] = function () { return this; }; } diff --git a/packages/babel-plugin-proposal-json-strings/package.json b/packages/babel-plugin-proposal-json-strings/package.json index 421ccf784f36..01240a844c50 100644 --- a/packages/babel-plugin-proposal-json-strings/package.json +++ b/packages/babel-plugin-proposal-json-strings/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-proposal-json-strings", - "version": "7.2.0", + "version": "7.8.3", "description": "Escape U+2028 LINE SEPARATOR and U+2029 PARAGRAPH SEPARATOR in JS strings", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-proposal-json-strings", "license": "MIT", @@ -12,14 +12,14 @@ "babel-plugin" ], "dependencies": { - "@babel/helper-plugin-utils": "^7.0.0", - "@babel/plugin-syntax-json-strings": "^7.2.0" + "@babel/helper-plugin-utils": "^7.8.3", + "@babel/plugin-syntax-json-strings": "^7.8.0" }, "peerDependencies": { "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.2.0", - "@babel/helper-plugin-test-runner": "^7.0.0" + "@babel/core": "^7.8.3", + "@babel/helper-plugin-test-runner": "^7.8.3" } } diff --git a/packages/babel-plugin-proposal-logical-assignment-operators/package.json b/packages/babel-plugin-proposal-logical-assignment-operators/package.json index ee5957903079..dd252582fa38 100644 --- a/packages/babel-plugin-proposal-logical-assignment-operators/package.json +++ b/packages/babel-plugin-proposal-logical-assignment-operators/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-proposal-logical-assignment-operators", - "version": "7.2.0", + "version": "7.8.3", "description": "Transforms logical assignment operators into short-circuited assignments", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-proposal-logical-assignment-operators", "license": "MIT", @@ -12,16 +12,16 @@ "babel-plugin" ], "dependencies": { - "@babel/helper-plugin-utils": "^7.0.0", - "@babel/plugin-syntax-logical-assignment-operators": "^7.2.0" + "@babel/helper-plugin-utils": "^7.8.3", + "@babel/plugin-syntax-logical-assignment-operators": "^7.8.3" }, "peerDependencies": { "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.2.0", - "@babel/helper-plugin-test-runner": "^7.0.0", - "@babel/plugin-proposal-nullish-coalescing-operator": "^7.2.0", - "@babel/plugin-syntax-nullish-coalescing-operator": "^7.2.0" + "@babel/core": "^7.8.3", + "@babel/helper-plugin-test-runner": "^7.8.3", + "@babel/plugin-proposal-nullish-coalescing-operator": "^7.8.3", + "@babel/plugin-syntax-nullish-coalescing-operator": "^7.8.0" } } diff --git a/packages/babel-plugin-proposal-logical-assignment-operators/test/fixtures/logical-assignment/null-coalescing-without-other/options.json b/packages/babel-plugin-proposal-logical-assignment-operators/test/fixtures/logical-assignment/null-coalescing-without-other/options.json index 8507a894f763..ef8c2205db57 100644 --- a/packages/babel-plugin-proposal-logical-assignment-operators/test/fixtures/logical-assignment/null-coalescing-without-other/options.json +++ b/packages/babel-plugin-proposal-logical-assignment-operators/test/fixtures/logical-assignment/null-coalescing-without-other/options.json @@ -1,6 +1,5 @@ { "plugins": [ - "proposal-logical-assignment-operators", - "syntax-nullish-coalescing-operator" + "proposal-logical-assignment-operators" ] } diff --git a/packages/babel-plugin-proposal-nullish-coalescing-operator/package.json b/packages/babel-plugin-proposal-nullish-coalescing-operator/package.json index dd9e329c3beb..7871e5f7d579 100644 --- a/packages/babel-plugin-proposal-nullish-coalescing-operator/package.json +++ b/packages/babel-plugin-proposal-nullish-coalescing-operator/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-proposal-nullish-coalescing-operator", - "version": "7.4.4", + "version": "7.8.3", "description": "Remove nullish coalescing operator", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-proposal-nullish-coalescing-operator", "license": "MIT", @@ -12,14 +12,14 @@ "babel-plugin" ], "dependencies": { - "@babel/helper-plugin-utils": "^7.0.0", - "@babel/plugin-syntax-nullish-coalescing-operator": "^7.2.0" + "@babel/helper-plugin-utils": "^7.8.3", + "@babel/plugin-syntax-nullish-coalescing-operator": "^7.8.0" }, "peerDependencies": { "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.4.4", - "@babel/helper-plugin-test-runner": "^7.0.0" + "@babel/core": "^7.8.3", + "@babel/helper-plugin-test-runner": "^7.8.3" } } diff --git a/packages/babel-plugin-proposal-nullish-coalescing-operator/src/index.js b/packages/babel-plugin-proposal-nullish-coalescing-operator/src/index.js index 5b3c2a3a4dc3..848a6c3ee3cd 100644 --- a/packages/babel-plugin-proposal-nullish-coalescing-operator/src/index.js +++ b/packages/babel-plugin-proposal-nullish-coalescing-operator/src/index.js @@ -16,14 +16,15 @@ export default declare((api, { loose = false }) => { return; } - const ref = scope.generateUidIdentifierBasedOnNode(node.left); - scope.push({ id: ref }); - - const assignment = t.assignmentExpression( - "=", - t.cloneNode(ref), - node.left, - ); + let ref = scope.maybeGenerateMemoised(node.left); + let assignment; + // skip creating extra reference when `left` is static + if (ref === null) { + ref = node.left; + assignment = t.cloneNode(node.left); + } else { + assignment = t.assignmentExpression("=", ref, node.left); + } path.replaceWith( t.conditionalExpression( diff --git a/packages/babel-plugin-proposal-nullish-coalescing-operator/test/fixtures/nullish-coalescing/transform-in-default/input.js b/packages/babel-plugin-proposal-nullish-coalescing-operator/test/fixtures/nullish-coalescing/transform-in-default/input.js index 7c7dcae88cf4..0c13164800af 100644 --- a/packages/babel-plugin-proposal-nullish-coalescing-operator/test/fixtures/nullish-coalescing/transform-in-default/input.js +++ b/packages/babel-plugin-proposal-nullish-coalescing-operator/test/fixtures/nullish-coalescing/transform-in-default/input.js @@ -1 +1 @@ -function foo(foo, bar = foo ?? "bar") {} +function foo(foo, qux = foo.bar ?? "qux") {} diff --git a/packages/babel-plugin-proposal-nullish-coalescing-operator/test/fixtures/nullish-coalescing/transform-in-default/output.js b/packages/babel-plugin-proposal-nullish-coalescing-operator/test/fixtures/nullish-coalescing/transform-in-default/output.js index 303ed2159928..2b2f2314b366 100644 --- a/packages/babel-plugin-proposal-nullish-coalescing-operator/test/fixtures/nullish-coalescing/transform-in-default/output.js +++ b/packages/babel-plugin-proposal-nullish-coalescing-operator/test/fixtures/nullish-coalescing/transform-in-default/output.js @@ -1,3 +1,3 @@ -function foo(foo, bar = (_foo = foo) !== null && _foo !== void 0 ? _foo : "bar") { - var _foo; +function foo(foo, qux = (_foo$bar = foo.bar) !== null && _foo$bar !== void 0 ? _foo$bar : "qux") { + var _foo$bar; } diff --git a/packages/babel-plugin-proposal-nullish-coalescing-operator/test/fixtures/nullish-coalescing/transform-static-refs-in-default/input.js b/packages/babel-plugin-proposal-nullish-coalescing-operator/test/fixtures/nullish-coalescing/transform-static-refs-in-default/input.js new file mode 100644 index 000000000000..7c7dcae88cf4 --- /dev/null +++ b/packages/babel-plugin-proposal-nullish-coalescing-operator/test/fixtures/nullish-coalescing/transform-static-refs-in-default/input.js @@ -0,0 +1 @@ +function foo(foo, bar = foo ?? "bar") {} diff --git a/packages/babel-plugin-proposal-nullish-coalescing-operator/test/fixtures/nullish-coalescing/transform-static-refs-in-default/options.json b/packages/babel-plugin-proposal-nullish-coalescing-operator/test/fixtures/nullish-coalescing/transform-static-refs-in-default/options.json new file mode 100644 index 000000000000..47e490d2afcf --- /dev/null +++ b/packages/babel-plugin-proposal-nullish-coalescing-operator/test/fixtures/nullish-coalescing/transform-static-refs-in-default/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["proposal-nullish-coalescing-operator"] +} diff --git a/packages/babel-plugin-proposal-nullish-coalescing-operator/test/fixtures/nullish-coalescing/transform-static-refs-in-default/output.js b/packages/babel-plugin-proposal-nullish-coalescing-operator/test/fixtures/nullish-coalescing/transform-static-refs-in-default/output.js new file mode 100644 index 000000000000..8434439d0782 --- /dev/null +++ b/packages/babel-plugin-proposal-nullish-coalescing-operator/test/fixtures/nullish-coalescing/transform-static-refs-in-default/output.js @@ -0,0 +1 @@ +function foo(foo, bar = foo !== null && foo !== void 0 ? foo : "bar") {} diff --git a/packages/babel-plugin-proposal-nullish-coalescing-operator/test/fixtures/nullish-coalescing/transform-static-refs-in-function/input.js b/packages/babel-plugin-proposal-nullish-coalescing-operator/test/fixtures/nullish-coalescing/transform-static-refs-in-function/input.js new file mode 100644 index 000000000000..8e488a306361 --- /dev/null +++ b/packages/babel-plugin-proposal-nullish-coalescing-operator/test/fixtures/nullish-coalescing/transform-static-refs-in-function/input.js @@ -0,0 +1,3 @@ +function foo() { + var foo = this ?? {}; +} diff --git a/packages/babel-plugin-proposal-nullish-coalescing-operator/test/fixtures/nullish-coalescing/transform-static-refs-in-function/options.json b/packages/babel-plugin-proposal-nullish-coalescing-operator/test/fixtures/nullish-coalescing/transform-static-refs-in-function/options.json new file mode 100644 index 000000000000..47e490d2afcf --- /dev/null +++ b/packages/babel-plugin-proposal-nullish-coalescing-operator/test/fixtures/nullish-coalescing/transform-static-refs-in-function/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["proposal-nullish-coalescing-operator"] +} diff --git a/packages/babel-plugin-proposal-nullish-coalescing-operator/test/fixtures/nullish-coalescing/transform-static-refs-in-function/output.js b/packages/babel-plugin-proposal-nullish-coalescing-operator/test/fixtures/nullish-coalescing/transform-static-refs-in-function/output.js new file mode 100644 index 000000000000..a13ea3508a20 --- /dev/null +++ b/packages/babel-plugin-proposal-nullish-coalescing-operator/test/fixtures/nullish-coalescing/transform-static-refs-in-function/output.js @@ -0,0 +1,3 @@ +function foo() { + var foo = this !== null && this !== void 0 ? this : {}; +} diff --git a/packages/babel-plugin-proposal-numeric-separator/package.json b/packages/babel-plugin-proposal-numeric-separator/package.json index 275d2b8425a9..bea10738fce5 100644 --- a/packages/babel-plugin-proposal-numeric-separator/package.json +++ b/packages/babel-plugin-proposal-numeric-separator/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-proposal-numeric-separator", - "version": "7.2.0", + "version": "7.8.3", "description": "Remove numeric separators from Decimal, Binary, Hex and Octal literals", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-proposal-numeric-separator", "license": "MIT", @@ -12,14 +12,14 @@ "babel-plugin" ], "dependencies": { - "@babel/helper-plugin-utils": "^7.0.0", - "@babel/plugin-syntax-numeric-separator": "^7.2.0" + "@babel/helper-plugin-utils": "^7.8.3", + "@babel/plugin-syntax-numeric-separator": "^7.8.3" }, "peerDependencies": { "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.2.0", - "@babel/helper-plugin-test-runner": "^7.0.0" + "@babel/core": "^7.8.3", + "@babel/helper-plugin-test-runner": "^7.8.3" } } diff --git a/packages/babel-plugin-proposal-numeric-separator/src/index.js b/packages/babel-plugin-proposal-numeric-separator/src/index.js index 99c29d700e1b..915088dffe4b 100644 --- a/packages/babel-plugin-proposal-numeric-separator/src/index.js +++ b/packages/babel-plugin-proposal-numeric-separator/src/index.js @@ -1,30 +1,14 @@ import { declare } from "@babel/helper-plugin-utils"; import syntaxNumericSeparator from "@babel/plugin-syntax-numeric-separator"; -import { types as t } from "@babel/core"; export default declare(api => { api.assertVersion(7); - function replaceNumberArg({ node }) { - if (node.callee.name !== "Number") { - return; - } - - const arg = node.arguments[0]; - if (!t.isStringLiteral(arg)) { - return; - } - - arg.value = arg.value.replace(/_/g, ""); - } - return { name: "proposal-numeric-separator", inherits: syntaxNumericSeparator, visitor: { - CallExpression: replaceNumberArg, - NewExpression: replaceNumberArg, NumericLiteral({ node }) { const { extra } = node; if (extra && /_/.test(extra.raw)) { diff --git a/packages/babel-plugin-proposal-numeric-separator/test/fixtures/number/exec.js b/packages/babel-plugin-proposal-numeric-separator/test/fixtures/number/exec.js deleted file mode 100644 index 238c64241af4..000000000000 --- a/packages/babel-plugin-proposal-numeric-separator/test/fixtures/number/exec.js +++ /dev/null @@ -1,19 +0,0 @@ -expect(Number("1_000")).toBe(Number("1000")); -expect(Number("0xAE_BE_CE")).toBe(Number("0xAEBECE")); -expect(Number("0b1010_0001_1000_0101")).toBe(Number("0b1010000110000101")); -expect(Number("0o0_6_6_6")).toBe(Number("0o0666")); - -expect(new Number("1_000").valueOf()).toBe(new Number("1000").valueOf()); -expect(new Number("0xAE_BE_CE").valueOf()).toBe(new Number("0xAEBECE").valueOf()); -expect(new Number("0b1010_0001_1000_0101").valueOf()).toBe(new Number("0b1010000110000101").valueOf()); -expect(new Number("0o0_6_6_6").valueOf()).toBe(new Number("0o0666").valueOf()); - -expect(Number(1_000)).toBe(Number("1000")); -expect(Number(0xAE_BE_CE)).toBe(Number("0xAEBECE")); -expect(Number(0b1010_0001_1000_0101)).toBe(Number("0b1010000110000101")); -expect(Number(0o0_6_6_6)).toBe(Number("0o0666")); - -expect(new Number(1_000).valueOf()).toBe(new Number("1000").valueOf()); -expect(new Number(0xAE_BE_CE).valueOf()).toBe(new Number("0xAEBECE").valueOf()); -expect(new Number(0b1010_0001_1000_0101).valueOf()).toBe(new Number("0b1010000110000101").valueOf()); -expect(new Number(0o0_6_6_6).valueOf()).toBe(new Number("0o0666").valueOf()); diff --git a/packages/babel-plugin-proposal-numeric-separator/test/fixtures/number/options.json b/packages/babel-plugin-proposal-numeric-separator/test/fixtures/number/options.json deleted file mode 100644 index db4bf9f50d93..000000000000 --- a/packages/babel-plugin-proposal-numeric-separator/test/fixtures/number/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "plugins": ["proposal-numeric-separator"] -} diff --git a/packages/babel-plugin-proposal-object-rest-spread/package.json b/packages/babel-plugin-proposal-object-rest-spread/package.json index e2ac2b6934ad..74153d9df36e 100644 --- a/packages/babel-plugin-proposal-object-rest-spread/package.json +++ b/packages/babel-plugin-proposal-object-rest-spread/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-proposal-object-rest-spread", - "version": "7.5.5", + "version": "7.8.3", "description": "Compile object rest and spread to ES5", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-proposal-object-rest-spread", "license": "MIT", @@ -12,14 +12,14 @@ "babel-plugin" ], "dependencies": { - "@babel/helper-plugin-utils": "^7.0.0", - "@babel/plugin-syntax-object-rest-spread": "^7.2.0" + "@babel/helper-plugin-utils": "^7.8.3", + "@babel/plugin-syntax-object-rest-spread": "^7.8.0" }, "peerDependencies": { "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.5.5", - "@babel/helper-plugin-test-runner": "^7.0.0" + "@babel/core": "^7.8.3", + "@babel/helper-plugin-test-runner": "^7.8.3" } } diff --git a/packages/babel-plugin-proposal-object-rest-spread/src/index.js b/packages/babel-plugin-proposal-object-rest-spread/src/index.js index 39fcfe42a21c..7f0d2525fbed 100644 --- a/packages/babel-plugin-proposal-object-rest-spread/src/index.js +++ b/packages/babel-plugin-proposal-object-rest-spread/src/index.js @@ -30,9 +30,20 @@ export default declare((api, opts) => { function hasRestElement(path) { let foundRestElement = false; - visitRestElements(path, () => { + visitRestElements(path, restElement => { foundRestElement = true; - path.stop(); + restElement.stop(); + }); + return foundRestElement; + } + + function hasObjectPatternRestElement(path) { + let foundRestElement = false; + visitRestElements(path, restElement => { + if (restElement.parentPath.isObjectPattern()) { + foundRestElement = true; + restElement.stop(); + } }); return foundRestElement; } @@ -91,12 +102,12 @@ export default declare((api, opts) => { // replaces impure computed keys with new identifiers // and returns variable declarators of these new identifiers - function replaceImpureComputedKeys(path) { + function replaceImpureComputedKeys(properties, scope) { const impureComputedPropertyDeclarators = []; - for (const propPath of path.get("properties")) { + for (const propPath of properties) { const key = propPath.get("key"); if (propPath.node.computed && !key.isPure()) { - const name = path.scope.generateUidBasedOnNode(key.node); + const name = scope.generateUidBasedOnNode(key.node); const declarator = t.variableDeclarator(t.identifier(name), key.node); impureComputedPropertyDeclarators.push(declarator); key.replaceWith(t.identifier(name)); @@ -128,7 +139,10 @@ export default declare((api, opts) => { const restElement = t.cloneNode(last.node); last.remove(); - const impureComputedPropertyDeclarators = replaceImpureComputedKeys(path); + const impureComputedPropertyDeclarators = replaceImpureComputedKeys( + path.get("properties"), + path.scope, + ); const { keys, allLiteral } = extractNormalizedKeys(path); if (keys.length === 0) { @@ -163,9 +177,9 @@ export default declare((api, opts) => { ]; } - function replaceRestElement(parentPath, paramPath, i, numParams) { + function replaceRestElement(parentPath, paramPath) { if (paramPath.isAssignmentPattern()) { - replaceRestElement(parentPath, paramPath.get("left"), i, numParams); + replaceRestElement(parentPath, paramPath.get("left")); return; } @@ -173,7 +187,7 @@ export default declare((api, opts) => { const elements = paramPath.get("elements"); for (let i = 0; i < elements.length; i++) { - replaceRestElement(parentPath, elements[i], i, elements.length); + replaceRestElement(parentPath, elements[i]); } } @@ -200,7 +214,7 @@ export default declare((api, opts) => { Function(path) { const params = path.get("params"); for (let i = params.length - 1; i >= 0; i--) { - replaceRestElement(params[i].parentPath, params[i], i, params.length); + replaceRestElement(params[i].parentPath, params[i]); } }, // adapted from transform-destructuring/src/index.js#pushObjectRest @@ -254,18 +268,21 @@ export default declare((api, opts) => { path.findParent(path => { if (path.isObjectProperty()) { - refPropertyPath.unshift(path.node.key.name); + refPropertyPath.unshift(path); } else if (path.isVariableDeclarator()) { kind = path.parentPath.node.kind; return true; } }); - if (refPropertyPath.length) { - refPropertyPath.forEach(prop => { - ref = t.memberExpression(ref, t.identifier(prop)); - }); - } + const impureObjRefComputedDeclarators = replaceImpureComputedKeys( + refPropertyPath, + path.scope, + ); + refPropertyPath.forEach(prop => { + const { node } = prop; + ref = t.memberExpression(ref, t.cloneNode(node.key), node.computed); + }); const objectPatternPath = path.findParent(path => path.isObjectPattern(), @@ -285,6 +302,8 @@ export default declare((api, opts) => { insertionPath.insertBefore(impureComputedPropertyDeclarators); + insertionPath.insertBefore(impureObjRefComputedDeclarators); + insertionPath.insertAfter( t.variableDeclarator(argument, callExpression), ); @@ -380,8 +399,12 @@ export default declare((api, opts) => { const leftPath = path.get("left"); const left = node.left; - // for ({a, ...b} of []) {} - if (t.isObjectPattern(left) && hasRestElement(leftPath)) { + if (!hasObjectPatternRestElement(leftPath)) { + return; + } + + if (!t.isVariableDeclaration(left)) { + // for ({a, ...b} of []) {} const temp = scope.generateUidIdentifier("ref"); node.left = t.variableDeclaration("var", [ @@ -401,27 +424,54 @@ export default declare((api, opts) => { t.assignmentExpression("=", left, t.cloneNode(temp)), ), ); + } else { + // for (var {a, ...b} of []) {} + const pattern = left.declarations[0].id; - return; + const key = scope.generateUidIdentifier("ref"); + node.left = t.variableDeclaration(left.kind, [ + t.variableDeclarator(key, null), + ]); + + path.ensureBlock(); + + node.body.body.unshift( + t.variableDeclaration(node.left.kind, [ + t.variableDeclarator(pattern, t.cloneNode(key)), + ]), + ); } + }, + // [{a, ...b}] = c; + ArrayPattern(path) { + const objectPatterns = []; - if (!t.isVariableDeclaration(left)) return; + visitRestElements(path, path => { + if (!path.parentPath.isObjectPattern()) { + // Return early if the parent is not an ObjectPattern, but + // (for example) an ArrayPattern or Function, because that + // means this RestElement is an not an object property. + return; + } - const pattern = left.declarations[0].id; - if (!t.isObjectPattern(pattern)) return; + const objectPattern = path.parentPath; - const key = scope.generateUidIdentifier("ref"); - node.left = t.variableDeclaration(left.kind, [ - t.variableDeclarator(key, null), - ]); + const uid = path.scope.generateUidIdentifier("ref"); + objectPatterns.push(t.variableDeclarator(objectPattern.node, uid)); - path.ensureBlock(); + objectPattern.replaceWith(t.cloneNode(uid)); + path.skip(); + }); - node.body.body.unshift( - t.variableDeclaration(node.left.kind, [ - t.variableDeclarator(pattern, t.cloneNode(key)), - ]), - ); + if (objectPatterns.length > 0) { + const statementPath = path.getStatementParent(); + statementPath.insertAfter( + t.variableDeclaration( + statementPath.node.kind || "var", + objectPatterns, + ), + ); + } }, // var a = { ...b, ...c } ObjectExpression(path, file) { diff --git a/packages/babel-plugin-proposal-object-rest-spread/test/fixtures/object-rest/for-x-array-pattern/input.js b/packages/babel-plugin-proposal-object-rest-spread/test/fixtures/object-rest/for-x-array-pattern/input.js new file mode 100644 index 000000000000..8ab978fb9402 --- /dev/null +++ b/packages/babel-plugin-proposal-object-rest-spread/test/fixtures/object-rest/for-x-array-pattern/input.js @@ -0,0 +1,19 @@ +// ForXStatement +for (const [{a, ...b}] of []) {} +for ([{a, ...b}] of []) {} +async function a() { + for await ([{a, ...b}] of []) {} +} + +// skip +for ([{a}] in {}) {} +for ([{a}] of []) {} +async function a() { + for await ([{a}] of []) {} +} + +for ([a, ...b] in {}) {} +for ([a, ...b] of []) {} +async function a() { + for await ([a, ...b] of []) {} +} diff --git a/packages/babel-plugin-proposal-object-rest-spread/test/fixtures/object-rest/for-x-array-pattern/output.js b/packages/babel-plugin-proposal-object-rest-spread/test/fixtures/object-rest/for-x-array-pattern/output.js new file mode 100644 index 000000000000..d4b3f61d7efd --- /dev/null +++ b/packages/babel-plugin-proposal-object-rest-spread/test/fixtures/object-rest/for-x-array-pattern/output.js @@ -0,0 +1,49 @@ +// ForXStatement +for (const _ref of []) { + const [_ref2] = _ref; + const { + a + } = _ref2, + b = babelHelpers.objectWithoutProperties(_ref2, ["a"]); +} + +for (var _ref3 of []) { + [_ref4] = _ref3; + var { + a + } = _ref4, + b = babelHelpers.objectWithoutProperties(_ref4, ["a"]); +} + +async function a() { + for await (var _ref5 of []) { + [_ref6] = _ref5; + var { + a + } = _ref6, + b = babelHelpers.objectWithoutProperties(_ref6, ["a"]); + } +} // skip + + +for ([{ + a +}] in {}) {} + +for ([{ + a +}] of []) {} + +async function a() { + for await ([{ + a + }] of []) {} +} + +for ([a, ...b] in {}) {} + +for ([a, ...b] of []) {} + +async function a() { + for await ([a, ...b] of []) {} +} diff --git a/packages/babel-plugin-proposal-object-rest-spread/test/fixtures/object-rest/nested-array-2/input.js b/packages/babel-plugin-proposal-object-rest-spread/test/fixtures/object-rest/nested-array-2/input.js new file mode 100644 index 000000000000..08cf30b7ab32 --- /dev/null +++ b/packages/babel-plugin-proposal-object-rest-spread/test/fixtures/object-rest/nested-array-2/input.js @@ -0,0 +1 @@ +const [a, [{b, ...c}], {d, ...e}, [{ f, ...g}, {h: [i, {j, ...k}] }]] = x; diff --git a/packages/babel-plugin-proposal-object-rest-spread/test/fixtures/object-rest/nested-array-2/output.js b/packages/babel-plugin-proposal-object-rest-spread/test/fixtures/object-rest/nested-array-2/output.js new file mode 100644 index 000000000000..6c688a3b4bff --- /dev/null +++ b/packages/babel-plugin-proposal-object-rest-spread/test/fixtures/object-rest/nested-array-2/output.js @@ -0,0 +1,19 @@ +const [a, [_ref], _ref2, [_ref3, { + h: [i, _ref4] +}]] = x; +const { + b +} = _ref, + c = babelHelpers.objectWithoutProperties(_ref, ["b"]), + { + d +} = _ref2, + e = babelHelpers.objectWithoutProperties(_ref2, ["d"]), + { + f +} = _ref3, + g = babelHelpers.objectWithoutProperties(_ref3, ["f"]), + { + j +} = _ref4, + k = babelHelpers.objectWithoutProperties(_ref4, ["j"]); diff --git a/packages/babel-plugin-proposal-object-rest-spread/test/fixtures/object-rest/nested-array/input.js b/packages/babel-plugin-proposal-object-rest-spread/test/fixtures/object-rest/nested-array/input.js new file mode 100644 index 000000000000..0845134f7dbc --- /dev/null +++ b/packages/babel-plugin-proposal-object-rest-spread/test/fixtures/object-rest/nested-array/input.js @@ -0,0 +1,6 @@ +const [a, {b, ...c}] = x; + +let [d, {e, ...f}] = x; + +[g, {h, ...i}] = x; + diff --git a/packages/babel-plugin-proposal-object-rest-spread/test/fixtures/object-rest/nested-array/output.js b/packages/babel-plugin-proposal-object-rest-spread/test/fixtures/object-rest/nested-array/output.js new file mode 100644 index 000000000000..bd3be0a9f607 --- /dev/null +++ b/packages/babel-plugin-proposal-object-rest-spread/test/fixtures/object-rest/nested-array/output.js @@ -0,0 +1,15 @@ +const [a, _ref] = x; +const { + b +} = _ref, + c = babelHelpers.objectWithoutProperties(_ref, ["b"]); +let [d, _ref2] = x; +let { + e +} = _ref2, + f = babelHelpers.objectWithoutProperties(_ref2, ["e"]); +[g, _ref3] = x; +var { + h +} = _ref3, + i = babelHelpers.objectWithoutProperties(_ref3, ["h"]); diff --git a/packages/babel-plugin-proposal-object-rest-spread/test/fixtures/object-rest/object-ref-computed-exec/exec.js b/packages/babel-plugin-proposal-object-rest-spread/test/fixtures/object-rest/object-ref-computed-exec/exec.js new file mode 100644 index 000000000000..53012ea3f1af --- /dev/null +++ b/packages/babel-plugin-proposal-object-rest-spread/test/fixtures/object-rest/object-ref-computed-exec/exec.js @@ -0,0 +1,20 @@ +var key, x, y, z; +// impure +key = 1; +var { [key++]: { y, ...x } } = { 1: { a: 1, y: 1 } }; +expect(x).toEqual({ a: 1 }); +expect(key).toBe(2); +expect(y).toBe(1); + +// takes care of the order + +key = 1; +var { + [++key]: { y, ...rest_y }, + [++key]: { z, ...rest_z } +} = {2: { y: 2, z: 3 }, 3: { y: 2, z: 3 } }; +expect(y).toBe(2); +expect(rest_y).toEqual({z: 3}); +expect(z).toBe(3); +expect(rest_z).toEqual({ y: 2 }); +expect(key).toBe(3); diff --git a/packages/babel-plugin-proposal-object-rest-spread/test/fixtures/object-rest/object-ref-computed/input.js b/packages/babel-plugin-proposal-object-rest-spread/test/fixtures/object-rest/object-ref-computed/input.js new file mode 100644 index 000000000000..53012ea3f1af --- /dev/null +++ b/packages/babel-plugin-proposal-object-rest-spread/test/fixtures/object-rest/object-ref-computed/input.js @@ -0,0 +1,20 @@ +var key, x, y, z; +// impure +key = 1; +var { [key++]: { y, ...x } } = { 1: { a: 1, y: 1 } }; +expect(x).toEqual({ a: 1 }); +expect(key).toBe(2); +expect(y).toBe(1); + +// takes care of the order + +key = 1; +var { + [++key]: { y, ...rest_y }, + [++key]: { z, ...rest_z } +} = {2: { y: 2, z: 3 }, 3: { y: 2, z: 3 } }; +expect(y).toBe(2); +expect(rest_y).toEqual({z: 3}); +expect(z).toBe(3); +expect(rest_z).toEqual({ y: 2 }); +expect(key).toBe(3); diff --git a/packages/babel-plugin-proposal-object-rest-spread/test/fixtures/object-rest/object-ref-computed/output.js b/packages/babel-plugin-proposal-object-rest-spread/test/fixtures/object-rest/object-ref-computed/output.js new file mode 100644 index 000000000000..319a0fe18c55 --- /dev/null +++ b/packages/babel-plugin-proposal-object-rest-spread/test/fixtures/object-rest/object-ref-computed/output.js @@ -0,0 +1,62 @@ +var key, x, y, z; // impure + +key = 1; + +var _ref = key++, + { + [_ref]: { + y + } +} = { + 1: { + a: 1, + y: 1 + } +}, + x = babelHelpers.objectWithoutProperties({ + 1: { + a: 1, + y: 1 + } +}[_ref], ["y"]); + +expect(x).toEqual({ + a: 1 +}); +expect(key).toBe(2); +expect(y).toBe(1); // takes care of the order + +key = 1; + +var _$ = { + 2: { + y: 2, + z: 3 + }, + 3: { + y: 2, + z: 3 + } +}, + _ref2 = ++key, + _ref3 = ++key, + { + [_ref3]: { + y + }, + [_ref2]: { + z + } +} = _$, + rest_y = babelHelpers.objectWithoutProperties(_$[_ref3], ["y"]), + rest_z = babelHelpers.objectWithoutProperties(_$[_ref2], ["z"]); + +expect(y).toBe(2); +expect(rest_y).toEqual({ + z: 3 +}); +expect(z).toBe(3); +expect(rest_z).toEqual({ + y: 2 +}); +expect(key).toBe(3); diff --git a/packages/babel-plugin-proposal-object-rest-spread/test/fixtures/object-rest/options.json b/packages/babel-plugin-proposal-object-rest-spread/test/fixtures/object-rest/options.json index ac791b82acf2..6f9add3661d6 100644 --- a/packages/babel-plugin-proposal-object-rest-spread/test/fixtures/object-rest/options.json +++ b/packages/babel-plugin-proposal-object-rest-spread/test/fixtures/object-rest/options.json @@ -1,6 +1,5 @@ { "plugins": [ - "syntax-async-generators", "proposal-object-rest-spread", ["external-helpers", { "helperVersion": "7.1.5" }] ] diff --git a/packages/babel-plugin-proposal-object-rest-spread/test/fixtures/object-spread/assignment/output.js b/packages/babel-plugin-proposal-object-rest-spread/test/fixtures/object-spread/assignment/output.js index bca55509f8df..a1f2970a3264 100644 --- a/packages/babel-plugin-proposal-object-rest-spread/test/fixtures/object-spread/assignment/output.js +++ b/packages/babel-plugin-proposal-object-rest-spread/test/fixtures/object-spread/assignment/output.js @@ -1,6 +1,6 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } -function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } +function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } diff --git a/packages/babel-plugin-proposal-object-rest-spread/test/fixtures/object-spread/expression/output.js b/packages/babel-plugin-proposal-object-rest-spread/test/fixtures/object-spread/expression/output.js index ba0e5ad1c8e3..a172df60bd16 100644 --- a/packages/babel-plugin-proposal-object-rest-spread/test/fixtures/object-spread/expression/output.js +++ b/packages/babel-plugin-proposal-object-rest-spread/test/fixtures/object-spread/expression/output.js @@ -1,6 +1,6 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } -function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } +function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } diff --git a/packages/babel-plugin-proposal-object-rest-spread/test/fixtures/object-spread/variable-declaration/output.js b/packages/babel-plugin-proposal-object-rest-spread/test/fixtures/object-spread/variable-declaration/output.js index 1370408b8354..9fabf3047b3d 100644 --- a/packages/babel-plugin-proposal-object-rest-spread/test/fixtures/object-spread/variable-declaration/output.js +++ b/packages/babel-plugin-proposal-object-rest-spread/test/fixtures/object-spread/variable-declaration/output.js @@ -1,6 +1,6 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } -function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } +function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } diff --git a/packages/babel-plugin-proposal-optional-catch-binding/package.json b/packages/babel-plugin-proposal-optional-catch-binding/package.json index 86e80fad2678..daaf65e4e94c 100644 --- a/packages/babel-plugin-proposal-optional-catch-binding/package.json +++ b/packages/babel-plugin-proposal-optional-catch-binding/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-proposal-optional-catch-binding", - "version": "7.2.0", + "version": "7.8.3", "description": "Compile optional catch bindings", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-proposal-optional-catch-binding", "license": "MIT", @@ -12,14 +12,14 @@ "babel-plugin" ], "dependencies": { - "@babel/helper-plugin-utils": "^7.0.0", - "@babel/plugin-syntax-optional-catch-binding": "^7.2.0" + "@babel/helper-plugin-utils": "^7.8.3", + "@babel/plugin-syntax-optional-catch-binding": "^7.8.0" }, "peerDependencies": { "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.2.0", - "@babel/helper-plugin-test-runner": "^7.0.0" + "@babel/core": "^7.8.3", + "@babel/helper-plugin-test-runner": "^7.8.3" } } diff --git a/packages/babel-plugin-proposal-optional-chaining/package.json b/packages/babel-plugin-proposal-optional-chaining/package.json index fb71c57cf9a3..a39bd3c9a7a9 100644 --- a/packages/babel-plugin-proposal-optional-chaining/package.json +++ b/packages/babel-plugin-proposal-optional-chaining/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-proposal-optional-chaining", - "version": "7.2.0", + "version": "7.8.3", "description": "Transform optional chaining operators into a series of nil checks", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-proposal-optional-chaining", "license": "MIT", @@ -12,15 +12,15 @@ "babel-plugin" ], "dependencies": { - "@babel/helper-plugin-utils": "^7.0.0", - "@babel/plugin-syntax-optional-chaining": "^7.2.0" + "@babel/helper-plugin-utils": "^7.8.3", + "@babel/plugin-syntax-optional-chaining": "^7.8.0" }, "peerDependencies": { "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.2.0", - "@babel/helper-plugin-test-runner": "^7.0.0", - "@babel/plugin-transform-block-scoping": "^7.2.0" + "@babel/core": "^7.8.3", + "@babel/helper-plugin-test-runner": "^7.8.3", + "@babel/plugin-transform-block-scoping": "^7.8.3" } } diff --git a/packages/babel-plugin-proposal-optional-chaining/src/index.js b/packages/babel-plugin-proposal-optional-chaining/src/index.js index c3e324041520..6a30dc74b909 100644 --- a/packages/babel-plugin-proposal-optional-chaining/src/index.js +++ b/packages/babel-plugin-proposal-optional-chaining/src/index.js @@ -14,6 +14,7 @@ export default declare((api, options) => { visitor: { "OptionalCallExpression|OptionalMemberExpression"(path) { const { parentPath, scope } = path; + let isDeleteOperation = false; const optionals = []; let optionalPath = path; @@ -38,6 +39,7 @@ export default declare((api, options) => { let replacementPath = path; if (parentPath.isUnaryExpression({ operator: "delete" })) { replacementPath = parentPath; + isDeleteOperation = true; } for (let i = optionals.length - 1; i >= 0; i--) { const node = optionals[i]; @@ -82,6 +84,8 @@ export default declare((api, options) => { let context = scope.maybeGenerateMemoised(object); if (context) { chain.object = t.assignmentExpression("=", context, object); + } else if (t.isSuper(object)) { + context = t.thisExpression(); } else { context = object; } @@ -111,7 +115,9 @@ export default declare((api, options) => { scope.buildUndefinedNode(), ), ), - scope.buildUndefinedNode(), + isDeleteOperation + ? t.booleanLiteral(true) + : scope.buildUndefinedNode(), replacementPath.node, ), ); diff --git a/packages/babel-plugin-proposal-optional-chaining/test/fixtures/general/delete/exec.js b/packages/babel-plugin-proposal-optional-chaining/test/fixtures/general/delete/exec.js index b2ecbb0a69c0..51021b6cbdb9 100644 --- a/packages/babel-plugin-proposal-optional-chaining/test/fixtures/general/delete/exec.js +++ b/packages/babel-plugin-proposal-optional-chaining/test/fixtures/general/delete/exec.js @@ -16,7 +16,7 @@ expect(test).toBe(true); test = delete obj?.b?.b; expect(obj.b).toBeUndefined(); -expect(test).toBeUndefined(); +expect(test).toBe(true); delete obj?.a; expect(obj.a).toBeUndefined(); diff --git a/packages/babel-plugin-proposal-optional-chaining/test/fixtures/general/delete/output.js b/packages/babel-plugin-proposal-optional-chaining/test/fixtures/general/delete/output.js index 5a9498166caf..e5260f8ca9a0 100644 --- a/packages/babel-plugin-proposal-optional-chaining/test/fixtures/general/delete/output.js +++ b/packages/babel-plugin-proposal-optional-chaining/test/fixtures/general/delete/output.js @@ -7,7 +7,7 @@ const obj = { b: 0 } }; -let test = obj === null || obj === void 0 ? void 0 : (_obj$a = obj.a) === null || _obj$a === void 0 ? void 0 : delete _obj$a.b; -test = obj === null || obj === void 0 ? void 0 : delete obj.a.b; -test = obj === null || obj === void 0 ? void 0 : (_obj$b = obj.b) === null || _obj$b === void 0 ? void 0 : delete _obj$b.b; -obj === null || obj === void 0 ? void 0 : delete obj.a; +let test = obj === null || obj === void 0 ? true : (_obj$a = obj.a) === null || _obj$a === void 0 ? true : delete _obj$a.b; +test = obj === null || obj === void 0 ? true : delete obj.a.b; +test = obj === null || obj === void 0 ? true : (_obj$b = obj.b) === null || _obj$b === void 0 ? true : delete _obj$b.b; +obj === null || obj === void 0 ? true : delete obj.a; diff --git a/packages/babel-plugin-proposal-optional-chaining/test/fixtures/general/super-method-call-loose/input.js b/packages/babel-plugin-proposal-optional-chaining/test/fixtures/general/super-method-call-loose/input.js new file mode 100644 index 000000000000..445c06ab259e --- /dev/null +++ b/packages/babel-plugin-proposal-optional-chaining/test/fixtures/general/super-method-call-loose/input.js @@ -0,0 +1,12 @@ +"use strict"; +class Base { + method() { + return 'Hello!'; + } +} + +class Derived extends Base { + method() { + return super.method?.() + } +} diff --git a/packages/babel-plugin-proposal-optional-chaining/test/fixtures/general/super-method-call-loose/options.json b/packages/babel-plugin-proposal-optional-chaining/test/fixtures/general/super-method-call-loose/options.json new file mode 100644 index 000000000000..39ea3f99c7ff --- /dev/null +++ b/packages/babel-plugin-proposal-optional-chaining/test/fixtures/general/super-method-call-loose/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["proposal-optional-chaining", { "loose": true }]] +} diff --git a/packages/babel-plugin-proposal-optional-chaining/test/fixtures/general/super-method-call-loose/output.js b/packages/babel-plugin-proposal-optional-chaining/test/fixtures/general/super-method-call-loose/output.js new file mode 100644 index 000000000000..6fd3890a61aa --- /dev/null +++ b/packages/babel-plugin-proposal-optional-chaining/test/fixtures/general/super-method-call-loose/output.js @@ -0,0 +1,15 @@ +"use strict"; + +class Base { + method() { + return 'Hello!'; + } + +} + +class Derived extends Base { + method() { + return super.method == null ? void 0 : super.method(); + } + +} diff --git a/packages/babel-plugin-proposal-optional-chaining/test/fixtures/general/super-method-call/input.js b/packages/babel-plugin-proposal-optional-chaining/test/fixtures/general/super-method-call/input.js new file mode 100644 index 000000000000..445c06ab259e --- /dev/null +++ b/packages/babel-plugin-proposal-optional-chaining/test/fixtures/general/super-method-call/input.js @@ -0,0 +1,12 @@ +"use strict"; +class Base { + method() { + return 'Hello!'; + } +} + +class Derived extends Base { + method() { + return super.method?.() + } +} diff --git a/packages/babel-plugin-proposal-optional-chaining/test/fixtures/general/super-method-call/output.js b/packages/babel-plugin-proposal-optional-chaining/test/fixtures/general/super-method-call/output.js new file mode 100644 index 000000000000..891da0508e27 --- /dev/null +++ b/packages/babel-plugin-proposal-optional-chaining/test/fixtures/general/super-method-call/output.js @@ -0,0 +1,17 @@ +"use strict"; + +class Base { + method() { + return 'Hello!'; + } + +} + +class Derived extends Base { + method() { + var _super$method; + + return (_super$method = super.method) === null || _super$method === void 0 ? void 0 : _super$method.call(this); + } + +} diff --git a/packages/babel-plugin-proposal-optional-chaining/test/fixtures/regression/8354/exec.js b/packages/babel-plugin-proposal-optional-chaining/test/fixtures/regression/8354/exec.js new file mode 100644 index 000000000000..c050ed412a62 --- /dev/null +++ b/packages/babel-plugin-proposal-optional-chaining/test/fixtures/regression/8354/exec.js @@ -0,0 +1,5 @@ +const foo = undefined; +const bar = 'bar'; +const foobar = foo?.replace(`foo${bar}`, ''); + +expect(foobar).toBe(undefined); \ No newline at end of file diff --git a/packages/babel-plugin-proposal-optional-chaining/test/fixtures/regression/8354/options.json b/packages/babel-plugin-proposal-optional-chaining/test/fixtures/regression/8354/options.json new file mode 100644 index 000000000000..a172da6589bf --- /dev/null +++ b/packages/babel-plugin-proposal-optional-chaining/test/fixtures/regression/8354/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["proposal-optional-chaining", "transform-template-literals"] +} diff --git a/packages/babel-plugin-proposal-partial-application/package.json b/packages/babel-plugin-proposal-partial-application/package.json index 79303c737cc7..9fbde0b99b1b 100644 --- a/packages/babel-plugin-proposal-partial-application/package.json +++ b/packages/babel-plugin-proposal-partial-application/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-proposal-partial-application", - "version": "7.4.4", + "version": "7.8.3", "description": "Introduces a new ? token in an argument list which allows for partially applying an argument list to a call expression", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-proposal-partial-application", "license": "MIT", @@ -12,14 +12,14 @@ "babel-plugin" ], "dependencies": { - "@babel/helper-plugin-utils": "^7.0.0", - "@babel/plugin-syntax-partial-application": "^7.4.4" + "@babel/helper-plugin-utils": "^7.8.3", + "@babel/plugin-syntax-partial-application": "^7.8.3" }, "peerDependencies": { "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.4.4", - "@babel/helper-plugin-test-runner": "^7.0.0" + "@babel/core": "^7.8.3", + "@babel/helper-plugin-test-runner": "^7.8.3" } } diff --git a/packages/babel-plugin-proposal-pipeline-operator/.npmignore b/packages/babel-plugin-proposal-pipeline-operator/.npmignore new file mode 100644 index 000000000000..2b1fceba679b --- /dev/null +++ b/packages/babel-plugin-proposal-pipeline-operator/.npmignore @@ -0,0 +1,3 @@ +*.log +src +test diff --git a/packages/babel-plugin-proposal-pipeline-operator/package.json b/packages/babel-plugin-proposal-pipeline-operator/package.json index bf0b947a8e84..4c4944ba3f62 100644 --- a/packages/babel-plugin-proposal-pipeline-operator/package.json +++ b/packages/babel-plugin-proposal-pipeline-operator/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-proposal-pipeline-operator", - "version": "7.5.0", + "version": "7.8.3", "description": "Transform pipeline operator into call expressions", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-proposal-pipeline-operator", "license": "MIT", @@ -12,14 +12,14 @@ "babel-plugin" ], "dependencies": { - "@babel/helper-plugin-utils": "^7.0.0", - "@babel/plugin-syntax-pipeline-operator": "^7.5.0" + "@babel/helper-plugin-utils": "^7.8.3", + "@babel/plugin-syntax-pipeline-operator": "^7.8.3" }, "peerDependencies": { "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.5.0", - "@babel/helper-plugin-test-runner": "^7.0.0" + "@babel/core": "^7.8.3", + "@babel/helper-plugin-test-runner": "^7.8.3" } } diff --git a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/fsharp/await/options.json b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/fsharp/await/options.json index c5a39e971027..970314ed16fe 100644 --- a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/fsharp/await/options.json +++ b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/fsharp/await/options.json @@ -1,7 +1,5 @@ { - "plugins": [ - ["proposal-pipeline-operator", { "proposal": "fsharp" }] - ], + "plugins": [["proposal-pipeline-operator", { "proposal": "fsharp" }]], "parserOpts": { "allowReturnOutsideFunction": true }, diff --git a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/fsharp/options.json b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/fsharp/options.json index 4e41244cc302..d94a839f79a3 100644 --- a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/fsharp/options.json +++ b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/fsharp/options.json @@ -1,7 +1,5 @@ { - "plugins": [ - ["proposal-pipeline-operator", { "proposal": "fsharp" }] - ], + "plugins": [["proposal-pipeline-operator", { "proposal": "fsharp" }]], "parserOpts": { "allowReturnOutsideFunction": true } diff --git a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/smart/await/options.json b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/smart/await/options.json index ef8ed8865bd4..df1848815387 100644 --- a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/smart/await/options.json +++ b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/smart/await/options.json @@ -1,7 +1,5 @@ { - "plugins": [ - ["proposal-pipeline-operator", { "proposal": "smart" }] - ], + "plugins": [["proposal-pipeline-operator", { "proposal": "smart" }]], "parserOpts": { "allowReturnOutsideFunction": true }, diff --git a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/smart/options.json b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/smart/options.json index c82020184d7b..d8c03ffdf701 100644 --- a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/smart/options.json +++ b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/smart/options.json @@ -1,7 +1,5 @@ { - "plugins": [ - ["proposal-pipeline-operator", { "proposal": "smart" }] - ], + "plugins": [["proposal-pipeline-operator", { "proposal": "smart" }]], "parserOpts": { "allowReturnOutsideFunction": true } diff --git a/packages/babel-plugin-proposal-private-methods/package.json b/packages/babel-plugin-proposal-private-methods/package.json index cd9cef01e36b..62b2565034ca 100644 --- a/packages/babel-plugin-proposal-private-methods/package.json +++ b/packages/babel-plugin-proposal-private-methods/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-proposal-private-methods", - "version": "7.4.4", + "version": "7.8.3", "description": "This plugin transforms private class methods", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-proposal-private-methods", "license": "MIT", @@ -12,14 +12,14 @@ "babel-plugin" ], "dependencies": { - "@babel/helper-create-class-features-plugin": "^7.4.4", - "@babel/helper-plugin-utils": "^7.0.0" + "@babel/helper-create-class-features-plugin": "^7.8.3", + "@babel/helper-plugin-utils": "^7.8.3" }, "peerDependencies": { "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.4.4", - "@babel/helper-plugin-test-runner": "^7.0.0" + "@babel/core": "^7.8.3", + "@babel/helper-plugin-test-runner": "^7.8.3" } } diff --git a/packages/babel-plugin-proposal-private-methods/test/fixtures/accessors-loose/get-only-setter/output.js b/packages/babel-plugin-proposal-private-methods/test/fixtures/accessors-loose/get-only-setter/output.js index 05866e2142fb..9d7d52b847b8 100644 --- a/packages/babel-plugin-proposal-private-methods/test/fixtures/accessors-loose/get-only-setter/output.js +++ b/packages/babel-plugin-proposal-private-methods/test/fixtures/accessors-loose/get-only-setter/output.js @@ -1,6 +1,7 @@ class Cl { constructor() { Object.defineProperty(this, _privateFieldValue, { + get: void 0, set: _set_privateFieldValue }); Object.defineProperty(this, _privateField, { diff --git a/packages/babel-plugin-proposal-private-methods/test/fixtures/accessors-loose/set-only-getter/output.js b/packages/babel-plugin-proposal-private-methods/test/fixtures/accessors-loose/set-only-getter/output.js index 57a8789016fa..eb046676cf54 100644 --- a/packages/babel-plugin-proposal-private-methods/test/fixtures/accessors-loose/set-only-getter/output.js +++ b/packages/babel-plugin-proposal-private-methods/test/fixtures/accessors-loose/set-only-getter/output.js @@ -1,7 +1,8 @@ class Cl { constructor() { Object.defineProperty(this, _privateFieldValue, { - get: _get_privateFieldValue + get: _get_privateFieldValue, + set: void 0 }); Object.defineProperty(this, _privateField, { writable: true, diff --git a/packages/babel-plugin-proposal-private-methods/test/fixtures/accessors/get-only-setter/output.js b/packages/babel-plugin-proposal-private-methods/test/fixtures/accessors/get-only-setter/output.js index 0906668c51fe..15691ee34a50 100644 --- a/packages/babel-plugin-proposal-private-methods/test/fixtures/accessors/get-only-setter/output.js +++ b/packages/babel-plugin-proposal-private-methods/test/fixtures/accessors/get-only-setter/output.js @@ -1,6 +1,7 @@ class Cl { constructor() { _privateFieldValue.set(this, { + get: void 0, set: _set_privateFieldValue }); diff --git a/packages/babel-plugin-proposal-private-methods/test/fixtures/accessors/set-only-getter/output.js b/packages/babel-plugin-proposal-private-methods/test/fixtures/accessors/set-only-getter/output.js index 4ea497e71a17..e301c07805de 100644 --- a/packages/babel-plugin-proposal-private-methods/test/fixtures/accessors/set-only-getter/output.js +++ b/packages/babel-plugin-proposal-private-methods/test/fixtures/accessors/set-only-getter/output.js @@ -1,7 +1,8 @@ class Cl { constructor() { _privateFieldValue.set(this, { - get: _get_privateFieldValue + get: _get_privateFieldValue, + set: void 0 }); _privateField.set(this, { diff --git a/packages/babel-plugin-proposal-private-methods/test/fixtures/duplicated-names/get-get/options.json b/packages/babel-plugin-proposal-private-methods/test/fixtures/duplicated-names/get-get/options.json index 9c0ba0e4b46a..49dcfc816842 100644 --- a/packages/babel-plugin-proposal-private-methods/test/fixtures/duplicated-names/get-get/options.json +++ b/packages/babel-plugin-proposal-private-methods/test/fixtures/duplicated-names/get-get/options.json @@ -1,3 +1,3 @@ { - "throws": "Duplicate private field" + "throws": "Duplicate private name #getSet" } diff --git a/packages/babel-plugin-proposal-private-methods/test/fixtures/duplicated-names/get-method/options.json b/packages/babel-plugin-proposal-private-methods/test/fixtures/duplicated-names/get-method/options.json index 9c0ba0e4b46a..1edb048c1285 100644 --- a/packages/babel-plugin-proposal-private-methods/test/fixtures/duplicated-names/get-method/options.json +++ b/packages/babel-plugin-proposal-private-methods/test/fixtures/duplicated-names/get-method/options.json @@ -1,3 +1,3 @@ { - "throws": "Duplicate private field" + "throws": "Duplicate private name #foo" } diff --git a/packages/babel-plugin-proposal-private-methods/test/fixtures/duplicated-names/method-get/options.json b/packages/babel-plugin-proposal-private-methods/test/fixtures/duplicated-names/method-get/options.json index 9c0ba0e4b46a..1edb048c1285 100644 --- a/packages/babel-plugin-proposal-private-methods/test/fixtures/duplicated-names/method-get/options.json +++ b/packages/babel-plugin-proposal-private-methods/test/fixtures/duplicated-names/method-get/options.json @@ -1,3 +1,3 @@ { - "throws": "Duplicate private field" + "throws": "Duplicate private name #foo" } diff --git a/packages/babel-plugin-proposal-private-methods/test/fixtures/duplicated-names/method-method/options.json b/packages/babel-plugin-proposal-private-methods/test/fixtures/duplicated-names/method-method/options.json index 9c0ba0e4b46a..b3e2e5dade0d 100644 --- a/packages/babel-plugin-proposal-private-methods/test/fixtures/duplicated-names/method-method/options.json +++ b/packages/babel-plugin-proposal-private-methods/test/fixtures/duplicated-names/method-method/options.json @@ -1,3 +1,3 @@ { - "throws": "Duplicate private field" + "throws": "Duplicate private name #dank" } diff --git a/packages/babel-plugin-proposal-private-methods/test/fixtures/duplicated-names/method-set/options.json b/packages/babel-plugin-proposal-private-methods/test/fixtures/duplicated-names/method-set/options.json index 9c0ba0e4b46a..1edb048c1285 100644 --- a/packages/babel-plugin-proposal-private-methods/test/fixtures/duplicated-names/method-set/options.json +++ b/packages/babel-plugin-proposal-private-methods/test/fixtures/duplicated-names/method-set/options.json @@ -1,3 +1,3 @@ { - "throws": "Duplicate private field" + "throws": "Duplicate private name #foo" } diff --git a/packages/babel-plugin-proposal-private-methods/test/fixtures/duplicated-names/set-method/options.json b/packages/babel-plugin-proposal-private-methods/test/fixtures/duplicated-names/set-method/options.json index 9c0ba0e4b46a..1edb048c1285 100644 --- a/packages/babel-plugin-proposal-private-methods/test/fixtures/duplicated-names/set-method/options.json +++ b/packages/babel-plugin-proposal-private-methods/test/fixtures/duplicated-names/set-method/options.json @@ -1,3 +1,3 @@ { - "throws": "Duplicate private field" + "throws": "Duplicate private name #foo" } diff --git a/packages/babel-plugin-proposal-private-methods/test/fixtures/duplicated-names/set-set/options.json b/packages/babel-plugin-proposal-private-methods/test/fixtures/duplicated-names/set-set/options.json index 9c0ba0e4b46a..49dcfc816842 100644 --- a/packages/babel-plugin-proposal-private-methods/test/fixtures/duplicated-names/set-set/options.json +++ b/packages/babel-plugin-proposal-private-methods/test/fixtures/duplicated-names/set-set/options.json @@ -1,3 +1,3 @@ { - "throws": "Duplicate private field" + "throws": "Duplicate private name #getSet" } diff --git a/packages/babel-plugin-proposal-private-methods/test/fixtures/private-static-method-loose/this/output.js b/packages/babel-plugin-proposal-private-methods/test/fixtures/private-static-method-loose/this/output.js index 4a5cddf8618c..0bccfda42bec 100644 --- a/packages/babel-plugin-proposal-private-methods/test/fixtures/private-static-method-loose/this/output.js +++ b/packages/babel-plugin-proposal-private-methods/test/fixtures/private-static-method-loose/this/output.js @@ -20,6 +20,10 @@ var _getA = babelHelpers.classPrivateFieldLooseKey("getA"); var _getB = babelHelpers.classPrivateFieldLooseKey("getB"); +var _getB2 = function _getB2() { + return this.b; +}; + var _getA2 = function _getA2() { return A.a; }; @@ -27,11 +31,6 @@ var _getA2 = function _getA2() { Object.defineProperty(B, _getA, { value: _getA2 }); - -var _getB2 = function _getB2() { - return this.b; -}; - Object.defineProperty(B, _getB, { value: _getB2 }); diff --git a/packages/babel-plugin-proposal-private-methods/test/fixtures/private-static-method/this/output.js b/packages/babel-plugin-proposal-private-methods/test/fixtures/private-static-method/this/output.js index e440955ecc99..49a4f4a7c600 100644 --- a/packages/babel-plugin-proposal-private-methods/test/fixtures/private-static-method/this/output.js +++ b/packages/babel-plugin-proposal-private-methods/test/fixtures/private-static-method/this/output.js @@ -16,12 +16,12 @@ class B extends A { } -var _getA = function _getA() { - return babelHelpers.get(babelHelpers.getPrototypeOf(B), "a", this); -}; - var _getB = function _getB() { return this.b; }; +var _getA = function _getA() { + return babelHelpers.get(babelHelpers.getPrototypeOf(B), "a", this); +}; + var [getA, getB] = B.extract(); diff --git a/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors-loose/basic/exec.js b/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors-loose/basic/exec.js new file mode 100644 index 000000000000..791a59034af9 --- /dev/null +++ b/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors-loose/basic/exec.js @@ -0,0 +1,23 @@ +class Cl { + static #PRIVATE_STATIC_FIELD = "top secret string"; + + static get #privateStaticFieldValue() { + return Cl.#PRIVATE_STATIC_FIELD; + } + + static set #privateStaticFieldValue(newValue) { + Cl.#PRIVATE_STATIC_FIELD = `Updated: ${newValue}`; + } + + static getValue() { + return Cl.#privateStaticFieldValue; + } + + static setValue() { + Cl.#privateStaticFieldValue = "dank"; + } +} + +expect(Cl.getValue()).toEqual("top secret string"); +Cl.setValue(); +expect(Cl.getValue()).toEqual("Updated: dank"); \ No newline at end of file diff --git a/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors-loose/basic/input.js b/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors-loose/basic/input.js new file mode 100644 index 000000000000..c79cdbe5ff0e --- /dev/null +++ b/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors-loose/basic/input.js @@ -0,0 +1,19 @@ +class Cl { + static #PRIVATE_STATIC_FIELD = "top secret string"; + + static get #privateStaticFieldValue() { + return Cl.#PRIVATE_STATIC_FIELD; + } + + static set #privateStaticFieldValue(newValue) { + Cl.#PRIVATE_STATIC_FIELD = `Updated: ${newValue}`; + } + + static getValue() { + return Cl.#privateStaticFieldValue; + } + + static setValue() { + Cl.#privateStaticFieldValue = "dank"; + } +} \ No newline at end of file diff --git a/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors-loose/basic/output.js b/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors-loose/basic/output.js new file mode 100644 index 000000000000..83619d5323e6 --- /dev/null +++ b/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors-loose/basic/output.js @@ -0,0 +1,31 @@ +class Cl { + static getValue() { + return babelHelpers.classPrivateFieldLooseBase(Cl, _privateStaticFieldValue)[_privateStaticFieldValue]; + } + + static setValue() { + babelHelpers.classPrivateFieldLooseBase(Cl, _privateStaticFieldValue)[_privateStaticFieldValue] = "dank"; + } + +} + +var _PRIVATE_STATIC_FIELD = babelHelpers.classPrivateFieldLooseKey("PRIVATE_STATIC_FIELD"); + +var _privateStaticFieldValue = babelHelpers.classPrivateFieldLooseKey("privateStaticFieldValue"); + +var _set_privateStaticFieldValue = function (newValue) { + babelHelpers.classPrivateFieldLooseBase(Cl, _PRIVATE_STATIC_FIELD)[_PRIVATE_STATIC_FIELD] = `Updated: ${newValue}`; +}; + +var _get_privateStaticFieldValue = function () { + return babelHelpers.classPrivateFieldLooseBase(Cl, _PRIVATE_STATIC_FIELD)[_PRIVATE_STATIC_FIELD]; +}; + +Object.defineProperty(Cl, _PRIVATE_STATIC_FIELD, { + writable: true, + value: "top secret string" +}); +Object.defineProperty(Cl, _privateStaticFieldValue, { + get: _get_privateStaticFieldValue, + set: _set_privateStaticFieldValue +}); diff --git a/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors-loose/get-only-setter/exec.js b/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors-loose/get-only-setter/exec.js new file mode 100644 index 000000000000..0c14f25c0938 --- /dev/null +++ b/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors-loose/get-only-setter/exec.js @@ -0,0 +1,13 @@ +class Cl { + static #PRIVATE_STATIC_FIELD = 0; + + static set #privateStaticFieldValue(newValue) { + Cl.#PRIVATE_STATIC_FIELD = newValue; + } + + static getPrivateStaticFieldValue() { + return Cl.#privateStaticFieldValue; + } +} + +expect(Cl.getPrivateStaticFieldValue()).toBeUndefined(); \ No newline at end of file diff --git a/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors-loose/get-only-setter/input.js b/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors-loose/get-only-setter/input.js new file mode 100644 index 000000000000..ab8771074ec7 --- /dev/null +++ b/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors-loose/get-only-setter/input.js @@ -0,0 +1,11 @@ +class Cl { + static #PRIVATE_STATIC_FIELD = 0; + + static set #privateStaticFieldValue(newValue) { + Cl.#PRIVATE_STATIC_FIELD = newValue; + } + + static getPrivateStaticFieldValue() { + return Cl.#privateStaticFieldValue; + } +} \ No newline at end of file diff --git a/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors-loose/get-only-setter/output.js b/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors-loose/get-only-setter/output.js new file mode 100644 index 000000000000..adb85a9ead8c --- /dev/null +++ b/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors-loose/get-only-setter/output.js @@ -0,0 +1,23 @@ +class Cl { + static getPrivateStaticFieldValue() { + return babelHelpers.classPrivateFieldLooseBase(Cl, _privateStaticFieldValue)[_privateStaticFieldValue]; + } + +} + +var _PRIVATE_STATIC_FIELD = babelHelpers.classPrivateFieldLooseKey("PRIVATE_STATIC_FIELD"); + +var _privateStaticFieldValue = babelHelpers.classPrivateFieldLooseKey("privateStaticFieldValue"); + +var _set_privateStaticFieldValue = function (newValue) { + babelHelpers.classPrivateFieldLooseBase(Cl, _PRIVATE_STATIC_FIELD)[_PRIVATE_STATIC_FIELD] = newValue; +}; + +Object.defineProperty(Cl, _PRIVATE_STATIC_FIELD, { + writable: true, + value: 0 +}); +Object.defineProperty(Cl, _privateStaticFieldValue, { + get: void 0, + set: _set_privateStaticFieldValue +}); diff --git a/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors-loose/options.json b/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors-loose/options.json new file mode 100644 index 000000000000..50c7612f8387 --- /dev/null +++ b/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors-loose/options.json @@ -0,0 +1,14 @@ +{ + "plugins": [ + [ + "external-helpers", + { + "helperVersion": "7.1000.0" + } + ], + ["proposal-private-methods", { "loose": true }], + ["proposal-class-properties", { "loose": true }], + "transform-block-scoping", + "syntax-class-properties" + ] +} diff --git a/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors-loose/set-only-getter/exec.js b/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors-loose/set-only-getter/exec.js new file mode 100644 index 000000000000..7069abfadc9d --- /dev/null +++ b/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors-loose/set-only-getter/exec.js @@ -0,0 +1,13 @@ +class Cl { + static #PRIVATE_STATIC_FIELD = 0; + + static get #privateStaticFieldValue() { + return Cl.#PRIVATE_STATIC_FIELD; + } + + static setPrivateStaticFieldValue() { + Cl.#privateStaticFieldValue = 1; + } +} + +expect(() => Cl.setPrivateStaticFieldValue()).toThrow(TypeError); \ No newline at end of file diff --git a/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors-loose/set-only-getter/input.js b/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors-loose/set-only-getter/input.js new file mode 100644 index 000000000000..d54ce4e2c2d0 --- /dev/null +++ b/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors-loose/set-only-getter/input.js @@ -0,0 +1,11 @@ +class Cl { + static #PRIVATE_STATIC_FIELD = 0; + + static get #privateStaticFieldValue() { + return Cl.#PRIVATE_STATIC_FIELD; + } + + static setPrivateStaticFieldValue() { + Cl.#privateStaticFieldValue = 1; + } +} \ No newline at end of file diff --git a/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors-loose/set-only-getter/output.js b/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors-loose/set-only-getter/output.js new file mode 100644 index 000000000000..73e658037394 --- /dev/null +++ b/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors-loose/set-only-getter/output.js @@ -0,0 +1,23 @@ +class Cl { + static setPrivateStaticFieldValue() { + babelHelpers.classPrivateFieldLooseBase(Cl, _privateStaticFieldValue)[_privateStaticFieldValue] = 1; + } + +} + +var _PRIVATE_STATIC_FIELD = babelHelpers.classPrivateFieldLooseKey("PRIVATE_STATIC_FIELD"); + +var _privateStaticFieldValue = babelHelpers.classPrivateFieldLooseKey("privateStaticFieldValue"); + +var _get_privateStaticFieldValue = function () { + return babelHelpers.classPrivateFieldLooseBase(Cl, _PRIVATE_STATIC_FIELD)[_PRIVATE_STATIC_FIELD]; +}; + +Object.defineProperty(Cl, _PRIVATE_STATIC_FIELD, { + writable: true, + value: 0 +}); +Object.defineProperty(Cl, _privateStaticFieldValue, { + get: _get_privateStaticFieldValue, + set: void 0 +}); diff --git a/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors-loose/updates/exec.js b/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors-loose/updates/exec.js new file mode 100644 index 000000000000..05f70aecceec --- /dev/null +++ b/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors-loose/updates/exec.js @@ -0,0 +1,46 @@ +class Cl { + static #privateField = "top secret string"; + static publicField = "not secret string"; + + static get #privateFieldValue() { + return Cl.#privateField; + } + + static set #privateFieldValue(newValue) { + Cl.#privateField = newValue; + } + + static publicGetPrivateField() { + return Cl.#privateFieldValue; + } + + static publicSetPrivateField(newValue) { + Cl.#privateFieldValue = newValue; + } + + static get publicFieldValue() { + return Cl.publicField; + } + + static set publicFieldValue(newValue) { + Cl.publicField = newValue; + } + + static testUpdates() { + Cl.#privateField = 0; + Cl.publicField = 0; + Cl.#privateFieldValue = Cl.#privateFieldValue++; + Cl.publicFieldValue = Cl.publicFieldValue++; + expect(Cl.#privateField).toEqual(Cl.publicField); + + ++Cl.#privateFieldValue; + ++Cl.publicFieldValue; + expect(Cl.#privateField).toEqual(Cl.publicField); + + Cl.#privateFieldValue += 1; + Cl.publicFieldValue += 1; + expect(Cl.#privateField).toEqual(Cl.publicField); + } +} + +Cl.testUpdates(); \ No newline at end of file diff --git a/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors-loose/updates/input.js b/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors-loose/updates/input.js new file mode 100644 index 000000000000..33c7b39d9cb4 --- /dev/null +++ b/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors-loose/updates/input.js @@ -0,0 +1,44 @@ +class Cl { + static #privateField = "top secret string"; + static publicField = "not secret string"; + + static get #privateFieldValue() { + return Cl.#privateField; + } + + static set #privateFieldValue(newValue) { + Cl.#privateField = newValue; + } + + static publicGetPrivateField() { + return Cl.#privateFieldValue; + } + + static publicSetPrivateField(newValue) { + Cl.#privateFieldValue = newValue; + } + + static get publicFieldValue() { + return Cl.publicField; + } + + static set publicFieldValue(newValue) { + Cl.publicField = newValue; + } + + static testUpdates() { + Cl.#privateField = 0; + Cl.publicField = 0; + Cl.#privateFieldValue = Cl.#privateFieldValue++; + Cl.publicFieldValue = Cl.publicFieldValue++; + + ++Cl.#privateFieldValue; + ++Cl.publicFieldValue; + + Cl.#privateFieldValue += 1; + Cl.publicFieldValue += 1; + + Cl.#privateFieldValue = -(Cl.#privateFieldValue ** Cl.#privateFieldValue); + Cl.publicFieldValue = -(Cl.publicFieldValue ** Cl.publicFieldValue); + } +} \ No newline at end of file diff --git a/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors-loose/updates/output.js b/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors-loose/updates/output.js new file mode 100644 index 000000000000..b75fa4a4d18c --- /dev/null +++ b/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors-loose/updates/output.js @@ -0,0 +1,53 @@ +class Cl { + static publicGetPrivateField() { + return babelHelpers.classPrivateFieldLooseBase(Cl, _privateFieldValue)[_privateFieldValue]; + } + + static publicSetPrivateField(newValue) { + babelHelpers.classPrivateFieldLooseBase(Cl, _privateFieldValue)[_privateFieldValue] = newValue; + } + + static get publicFieldValue() { + return Cl.publicField; + } + + static set publicFieldValue(newValue) { + Cl.publicField = newValue; + } + + static testUpdates() { + babelHelpers.classPrivateFieldLooseBase(Cl, _privateField)[_privateField] = 0; + Cl.publicField = 0; + babelHelpers.classPrivateFieldLooseBase(Cl, _privateFieldValue)[_privateFieldValue] = babelHelpers.classPrivateFieldLooseBase(Cl, _privateFieldValue)[_privateFieldValue]++; + Cl.publicFieldValue = Cl.publicFieldValue++; + ++babelHelpers.classPrivateFieldLooseBase(Cl, _privateFieldValue)[_privateFieldValue]; + ++Cl.publicFieldValue; + babelHelpers.classPrivateFieldLooseBase(Cl, _privateFieldValue)[_privateFieldValue] += 1; + Cl.publicFieldValue += 1; + babelHelpers.classPrivateFieldLooseBase(Cl, _privateFieldValue)[_privateFieldValue] = -(babelHelpers.classPrivateFieldLooseBase(Cl, _privateFieldValue)[_privateFieldValue] ** babelHelpers.classPrivateFieldLooseBase(Cl, _privateFieldValue)[_privateFieldValue]); + Cl.publicFieldValue = -(Cl.publicFieldValue ** Cl.publicFieldValue); + } + +} + +var _privateField = babelHelpers.classPrivateFieldLooseKey("privateField"); + +var _privateFieldValue = babelHelpers.classPrivateFieldLooseKey("privateFieldValue"); + +var _set_privateFieldValue = function (newValue) { + babelHelpers.classPrivateFieldLooseBase(Cl, _privateField)[_privateField] = newValue; +}; + +var _get_privateFieldValue = function () { + return babelHelpers.classPrivateFieldLooseBase(Cl, _privateField)[_privateField]; +}; + +Object.defineProperty(Cl, _privateField, { + writable: true, + value: "top secret string" +}); +Cl.publicField = "not secret string"; +Object.defineProperty(Cl, _privateFieldValue, { + get: _get_privateFieldValue, + set: _set_privateFieldValue +}); diff --git a/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors/basic/exec.js b/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors/basic/exec.js new file mode 100644 index 000000000000..791a59034af9 --- /dev/null +++ b/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors/basic/exec.js @@ -0,0 +1,23 @@ +class Cl { + static #PRIVATE_STATIC_FIELD = "top secret string"; + + static get #privateStaticFieldValue() { + return Cl.#PRIVATE_STATIC_FIELD; + } + + static set #privateStaticFieldValue(newValue) { + Cl.#PRIVATE_STATIC_FIELD = `Updated: ${newValue}`; + } + + static getValue() { + return Cl.#privateStaticFieldValue; + } + + static setValue() { + Cl.#privateStaticFieldValue = "dank"; + } +} + +expect(Cl.getValue()).toEqual("top secret string"); +Cl.setValue(); +expect(Cl.getValue()).toEqual("Updated: dank"); \ No newline at end of file diff --git a/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors/basic/input.js b/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors/basic/input.js new file mode 100644 index 000000000000..c79cdbe5ff0e --- /dev/null +++ b/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors/basic/input.js @@ -0,0 +1,19 @@ +class Cl { + static #PRIVATE_STATIC_FIELD = "top secret string"; + + static get #privateStaticFieldValue() { + return Cl.#PRIVATE_STATIC_FIELD; + } + + static set #privateStaticFieldValue(newValue) { + Cl.#PRIVATE_STATIC_FIELD = `Updated: ${newValue}`; + } + + static getValue() { + return Cl.#privateStaticFieldValue; + } + + static setValue() { + Cl.#privateStaticFieldValue = "dank"; + } +} \ No newline at end of file diff --git a/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors/basic/output.js b/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors/basic/output.js new file mode 100644 index 000000000000..7dc0b26977eb --- /dev/null +++ b/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors/basic/output.js @@ -0,0 +1,27 @@ +class Cl { + static getValue() { + return babelHelpers.classStaticPrivateFieldSpecGet(Cl, Cl, _privateStaticFieldValue); + } + + static setValue() { + babelHelpers.classStaticPrivateFieldSpecSet(Cl, Cl, _privateStaticFieldValue, "dank"); + } + +} + +var _set_privateStaticFieldValue = function (newValue) { + babelHelpers.classStaticPrivateFieldSpecSet(Cl, Cl, _PRIVATE_STATIC_FIELD, `Updated: ${newValue}`); +}; + +var _get_privateStaticFieldValue = function () { + return babelHelpers.classStaticPrivateFieldSpecGet(Cl, Cl, _PRIVATE_STATIC_FIELD); +}; + +var _PRIVATE_STATIC_FIELD = { + writable: true, + value: "top secret string" +}; +var _privateStaticFieldValue = { + get: _get_privateStaticFieldValue, + set: _set_privateStaticFieldValue +}; diff --git a/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors/get-only-setter/exec.js b/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors/get-only-setter/exec.js new file mode 100644 index 000000000000..0c14f25c0938 --- /dev/null +++ b/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors/get-only-setter/exec.js @@ -0,0 +1,13 @@ +class Cl { + static #PRIVATE_STATIC_FIELD = 0; + + static set #privateStaticFieldValue(newValue) { + Cl.#PRIVATE_STATIC_FIELD = newValue; + } + + static getPrivateStaticFieldValue() { + return Cl.#privateStaticFieldValue; + } +} + +expect(Cl.getPrivateStaticFieldValue()).toBeUndefined(); \ No newline at end of file diff --git a/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors/get-only-setter/input.js b/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors/get-only-setter/input.js new file mode 100644 index 000000000000..ab8771074ec7 --- /dev/null +++ b/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors/get-only-setter/input.js @@ -0,0 +1,11 @@ +class Cl { + static #PRIVATE_STATIC_FIELD = 0; + + static set #privateStaticFieldValue(newValue) { + Cl.#PRIVATE_STATIC_FIELD = newValue; + } + + static getPrivateStaticFieldValue() { + return Cl.#privateStaticFieldValue; + } +} \ No newline at end of file diff --git a/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors/get-only-setter/output.js b/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors/get-only-setter/output.js new file mode 100644 index 000000000000..31c1bf46873e --- /dev/null +++ b/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors/get-only-setter/output.js @@ -0,0 +1,19 @@ +class Cl { + static getPrivateStaticFieldValue() { + return babelHelpers.classStaticPrivateFieldSpecGet(Cl, Cl, _privateStaticFieldValue); + } + +} + +var _set_privateStaticFieldValue = function (newValue) { + babelHelpers.classStaticPrivateFieldSpecSet(Cl, Cl, _PRIVATE_STATIC_FIELD, newValue); +}; + +var _PRIVATE_STATIC_FIELD = { + writable: true, + value: 0 +}; +var _privateStaticFieldValue = { + get: void 0, + set: _set_privateStaticFieldValue +}; diff --git a/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors/options.json b/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors/options.json new file mode 100644 index 000000000000..c5e6649e4ea8 --- /dev/null +++ b/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors/options.json @@ -0,0 +1,14 @@ +{ + "plugins": [ + [ + "external-helpers", + { + "helperVersion": "7.1000.0" + } + ], + "proposal-private-methods", + "proposal-class-properties", + "transform-block-scoping", + "syntax-class-properties" + ] +} diff --git a/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors/set-only-getter/exec.js b/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors/set-only-getter/exec.js new file mode 100644 index 000000000000..7069abfadc9d --- /dev/null +++ b/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors/set-only-getter/exec.js @@ -0,0 +1,13 @@ +class Cl { + static #PRIVATE_STATIC_FIELD = 0; + + static get #privateStaticFieldValue() { + return Cl.#PRIVATE_STATIC_FIELD; + } + + static setPrivateStaticFieldValue() { + Cl.#privateStaticFieldValue = 1; + } +} + +expect(() => Cl.setPrivateStaticFieldValue()).toThrow(TypeError); \ No newline at end of file diff --git a/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors/set-only-getter/input.js b/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors/set-only-getter/input.js new file mode 100644 index 000000000000..d54ce4e2c2d0 --- /dev/null +++ b/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors/set-only-getter/input.js @@ -0,0 +1,11 @@ +class Cl { + static #PRIVATE_STATIC_FIELD = 0; + + static get #privateStaticFieldValue() { + return Cl.#PRIVATE_STATIC_FIELD; + } + + static setPrivateStaticFieldValue() { + Cl.#privateStaticFieldValue = 1; + } +} \ No newline at end of file diff --git a/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors/set-only-getter/output.js b/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors/set-only-getter/output.js new file mode 100644 index 000000000000..fa3aebd45bfc --- /dev/null +++ b/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors/set-only-getter/output.js @@ -0,0 +1,19 @@ +class Cl { + static setPrivateStaticFieldValue() { + babelHelpers.classStaticPrivateFieldSpecSet(Cl, Cl, _privateStaticFieldValue, 1); + } + +} + +var _get_privateStaticFieldValue = function () { + return babelHelpers.classStaticPrivateFieldSpecGet(Cl, Cl, _PRIVATE_STATIC_FIELD); +}; + +var _PRIVATE_STATIC_FIELD = { + writable: true, + value: 0 +}; +var _privateStaticFieldValue = { + get: _get_privateStaticFieldValue, + set: void 0 +}; diff --git a/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors/updates/exec.js b/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors/updates/exec.js new file mode 100644 index 000000000000..05f70aecceec --- /dev/null +++ b/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors/updates/exec.js @@ -0,0 +1,46 @@ +class Cl { + static #privateField = "top secret string"; + static publicField = "not secret string"; + + static get #privateFieldValue() { + return Cl.#privateField; + } + + static set #privateFieldValue(newValue) { + Cl.#privateField = newValue; + } + + static publicGetPrivateField() { + return Cl.#privateFieldValue; + } + + static publicSetPrivateField(newValue) { + Cl.#privateFieldValue = newValue; + } + + static get publicFieldValue() { + return Cl.publicField; + } + + static set publicFieldValue(newValue) { + Cl.publicField = newValue; + } + + static testUpdates() { + Cl.#privateField = 0; + Cl.publicField = 0; + Cl.#privateFieldValue = Cl.#privateFieldValue++; + Cl.publicFieldValue = Cl.publicFieldValue++; + expect(Cl.#privateField).toEqual(Cl.publicField); + + ++Cl.#privateFieldValue; + ++Cl.publicFieldValue; + expect(Cl.#privateField).toEqual(Cl.publicField); + + Cl.#privateFieldValue += 1; + Cl.publicFieldValue += 1; + expect(Cl.#privateField).toEqual(Cl.publicField); + } +} + +Cl.testUpdates(); \ No newline at end of file diff --git a/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors/updates/input.js b/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors/updates/input.js new file mode 100644 index 000000000000..33c7b39d9cb4 --- /dev/null +++ b/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors/updates/input.js @@ -0,0 +1,44 @@ +class Cl { + static #privateField = "top secret string"; + static publicField = "not secret string"; + + static get #privateFieldValue() { + return Cl.#privateField; + } + + static set #privateFieldValue(newValue) { + Cl.#privateField = newValue; + } + + static publicGetPrivateField() { + return Cl.#privateFieldValue; + } + + static publicSetPrivateField(newValue) { + Cl.#privateFieldValue = newValue; + } + + static get publicFieldValue() { + return Cl.publicField; + } + + static set publicFieldValue(newValue) { + Cl.publicField = newValue; + } + + static testUpdates() { + Cl.#privateField = 0; + Cl.publicField = 0; + Cl.#privateFieldValue = Cl.#privateFieldValue++; + Cl.publicFieldValue = Cl.publicFieldValue++; + + ++Cl.#privateFieldValue; + ++Cl.publicFieldValue; + + Cl.#privateFieldValue += 1; + Cl.publicFieldValue += 1; + + Cl.#privateFieldValue = -(Cl.#privateFieldValue ** Cl.#privateFieldValue); + Cl.publicFieldValue = -(Cl.publicFieldValue ** Cl.publicFieldValue); + } +} \ No newline at end of file diff --git a/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors/updates/output.js b/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors/updates/output.js new file mode 100644 index 000000000000..1869c5b6ead8 --- /dev/null +++ b/packages/babel-plugin-proposal-private-methods/test/fixtures/static-accessors/updates/output.js @@ -0,0 +1,51 @@ +class Cl { + static publicGetPrivateField() { + return babelHelpers.classStaticPrivateFieldSpecGet(Cl, Cl, _privateFieldValue); + } + + static publicSetPrivateField(newValue) { + babelHelpers.classStaticPrivateFieldSpecSet(Cl, Cl, _privateFieldValue, newValue); + } + + static get publicFieldValue() { + return Cl.publicField; + } + + static set publicFieldValue(newValue) { + Cl.publicField = newValue; + } + + static testUpdates() { + var _Cl$privateFieldValue, _Cl$privateFieldValue2; + + babelHelpers.classStaticPrivateFieldSpecSet(Cl, Cl, _privateField, 0); + Cl.publicField = 0; + babelHelpers.classStaticPrivateFieldSpecSet(Cl, Cl, _privateFieldValue, (babelHelpers.classStaticPrivateFieldSpecSet(Cl, Cl, _privateFieldValue, (_Cl$privateFieldValue2 = +babelHelpers.classStaticPrivateFieldSpecGet(Cl, Cl, _privateFieldValue)) + 1), _Cl$privateFieldValue2)); + Cl.publicFieldValue = Cl.publicFieldValue++; + babelHelpers.classStaticPrivateFieldSpecSet(Cl, Cl, _privateFieldValue, +babelHelpers.classStaticPrivateFieldSpecGet(Cl, Cl, _privateFieldValue) + 1); + ++Cl.publicFieldValue; + babelHelpers.classStaticPrivateFieldSpecSet(Cl, Cl, _privateFieldValue, babelHelpers.classStaticPrivateFieldSpecGet(Cl, Cl, _privateFieldValue) + 1); + Cl.publicFieldValue += 1; + babelHelpers.classStaticPrivateFieldSpecSet(Cl, Cl, _privateFieldValue, -(babelHelpers.classStaticPrivateFieldSpecGet(Cl, Cl, _privateFieldValue) ** babelHelpers.classStaticPrivateFieldSpecGet(Cl, Cl, _privateFieldValue))); + Cl.publicFieldValue = -(Cl.publicFieldValue ** Cl.publicFieldValue); + } + +} + +var _set_privateFieldValue = function (newValue) { + babelHelpers.classStaticPrivateFieldSpecSet(Cl, Cl, _privateField, newValue); +}; + +var _get_privateFieldValue = function () { + return babelHelpers.classStaticPrivateFieldSpecGet(Cl, Cl, _privateField); +}; + +var _privateField = { + writable: true, + value: "top secret string" +}; +babelHelpers.defineProperty(Cl, "publicField", "not secret string"); +var _privateFieldValue = { + get: _get_privateFieldValue, + set: _set_privateFieldValue +}; diff --git a/packages/babel-plugin-proposal-throw-expressions/package.json b/packages/babel-plugin-proposal-throw-expressions/package.json index 2f6bc414a717..3c70650eb032 100644 --- a/packages/babel-plugin-proposal-throw-expressions/package.json +++ b/packages/babel-plugin-proposal-throw-expressions/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-proposal-throw-expressions", - "version": "7.2.0", + "version": "7.8.3", "description": "Wraps Throw Expressions in an IIFE", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-proposal-throw-expressions", "license": "MIT", @@ -12,14 +12,14 @@ "babel-plugin" ], "dependencies": { - "@babel/helper-plugin-utils": "^7.0.0", - "@babel/plugin-syntax-throw-expressions": "^7.2.0" + "@babel/helper-plugin-utils": "^7.8.3", + "@babel/plugin-syntax-throw-expressions": "^7.8.3" }, "peerDependencies": { "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.2.0", - "@babel/helper-plugin-test-runner": "^7.0.0" + "@babel/core": "^7.8.3", + "@babel/helper-plugin-test-runner": "^7.8.3" } } diff --git a/packages/babel-plugin-proposal-unicode-property-regex/.npmignore b/packages/babel-plugin-proposal-unicode-property-regex/.npmignore new file mode 100644 index 000000000000..2b1fceba679b --- /dev/null +++ b/packages/babel-plugin-proposal-unicode-property-regex/.npmignore @@ -0,0 +1,3 @@ +*.log +src +test diff --git a/packages/babel-plugin-proposal-unicode-property-regex/package.json b/packages/babel-plugin-proposal-unicode-property-regex/package.json index 96bdc44c4698..aff68e6b1c61 100644 --- a/packages/babel-plugin-proposal-unicode-property-regex/package.json +++ b/packages/babel-plugin-proposal-unicode-property-regex/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-proposal-unicode-property-regex", - "version": "7.4.4", + "version": "7.8.3", "description": "Compile Unicode property escapes in Unicode regular expressions to ES5.", "homepage": "https://babeljs.io/", "license": "MIT", @@ -22,15 +22,14 @@ "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-proposal-unicode-property-regex", "bugs": "https://github.com/babel/babel/issues", "dependencies": { - "@babel/helper-plugin-utils": "^7.0.0", - "@babel/helper-regex": "^7.4.4", - "regexpu-core": "^4.5.4" + "@babel/helper-create-regexp-features-plugin": "^7.8.3", + "@babel/helper-plugin-utils": "^7.8.3" }, "peerDependencies": { "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.4.4", - "@babel/helper-plugin-test-runner": "^7.0.0" + "@babel/core": "^7.8.3", + "@babel/helper-plugin-test-runner": "^7.8.3" } } diff --git a/packages/babel-plugin-proposal-unicode-property-regex/src/index.js b/packages/babel-plugin-proposal-unicode-property-regex/src/index.js index b0245892311f..bf76031cbf12 100644 --- a/packages/babel-plugin-proposal-unicode-property-regex/src/index.js +++ b/packages/babel-plugin-proposal-unicode-property-regex/src/index.js @@ -1,6 +1,6 @@ +/* eslint-disable @babel/development/plugin-name */ +import { createRegExpFeaturePlugin } from "@babel/helper-create-regexp-features-plugin"; import { declare } from "@babel/helper-plugin-utils"; -import rewritePattern from "regexpu-core"; -import * as regex from "@babel/helper-regex"; export default declare((api, options) => { api.assertVersion(7); @@ -10,23 +10,9 @@ export default declare((api, options) => { throw new Error(".useUnicodeFlag must be a boolean, or undefined"); } - return { + return createRegExpFeaturePlugin({ name: "proposal-unicode-property-regex", - - visitor: { - RegExpLiteral(path) { - const node = path.node; - if (!regex.is(node, "u")) { - return; - } - node.pattern = rewritePattern(node.pattern, node.flags, { - unicodePropertyEscape: true, - useUnicodeFlag, - }); - if (!useUnicodeFlag) { - regex.pullFlag(node, "u"); - } - }, - }, - }; + feature: "unicodePropertyEscape", + options: { useUnicodeFlag }, + }); }); diff --git a/packages/babel-plugin-proposal-unicode-property-regex/test/fixtures/with-unicode-flag/unicode-12/input.js b/packages/babel-plugin-proposal-unicode-property-regex/test/fixtures/with-unicode-flag/unicode-12/input.js index 711dde943b3c..e50ab9eb68e0 100644 --- a/packages/babel-plugin-proposal-unicode-property-regex/test/fixtures/with-unicode-flag/unicode-12/input.js +++ b/packages/babel-plugin-proposal-unicode-property-regex/test/fixtures/with-unicode-flag/unicode-12/input.js @@ -1 +1 @@ -var regex = /[\u{1E2C0}-\u{1E2F9}\u{1E2FF}]/u; +var regex = /[\p{Script_Extensions=Wancho}]/u; diff --git a/packages/babel-plugin-syntax-async-generators/README.md b/packages/babel-plugin-syntax-async-generators/README.md deleted file mode 100644 index 4fdb68df562d..000000000000 --- a/packages/babel-plugin-syntax-async-generators/README.md +++ /dev/null @@ -1,19 +0,0 @@ -# @babel/plugin-syntax-async-generators - -> Allow parsing of async generator functions - -See our website [@babel/plugin-syntax-async-generators](https://babeljs.io/docs/en/next/babel-plugin-syntax-async-generators.html) for more information. - -## Install - -Using npm: - -```sh -npm install --save-dev @babel/plugin-syntax-async-generators -``` - -or using yarn: - -```sh -yarn add @babel/plugin-syntax-async-generators --dev -``` diff --git a/packages/babel-plugin-syntax-async-generators/package.json b/packages/babel-plugin-syntax-async-generators/package.json deleted file mode 100644 index 60a1702af977..000000000000 --- a/packages/babel-plugin-syntax-async-generators/package.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "name": "@babel/plugin-syntax-async-generators", - "version": "7.2.0", - "description": "Allow parsing of async generator functions", - "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-syntax-async-generators", - "license": "MIT", - "publishConfig": { - "access": "public" - }, - "main": "lib/index.js", - "keywords": [ - "babel-plugin" - ], - "dependencies": { - "@babel/helper-plugin-utils": "^7.0.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - }, - "devDependencies": { - "@babel/core": "^7.2.0" - } -} diff --git a/packages/babel-plugin-syntax-async-generators/src/index.js b/packages/babel-plugin-syntax-async-generators/src/index.js deleted file mode 100644 index e18612556b27..000000000000 --- a/packages/babel-plugin-syntax-async-generators/src/index.js +++ /dev/null @@ -1,13 +0,0 @@ -import { declare } from "@babel/helper-plugin-utils"; - -export default declare(api => { - api.assertVersion(7); - - return { - name: "syntax-async-generators", - - manipulateOptions(opts, parserOpts) { - parserOpts.plugins.push("asyncGenerators"); - }, - }; -}); diff --git a/packages/babel-plugin-syntax-bigint/README.md b/packages/babel-plugin-syntax-bigint/README.md deleted file mode 100644 index bb49aab8ee34..000000000000 --- a/packages/babel-plugin-syntax-bigint/README.md +++ /dev/null @@ -1,19 +0,0 @@ -# @babel/plugin-syntax-bigint - -> Allow parsing of BigInt literals - -See our website [@babel/plugin-syntax-bigint](https://babeljs.io/docs/en/next/babel-plugin-syntax-bigint.html) for more information. - -## Install - -Using npm: - -```sh -npm install --save-dev @babel/plugin-syntax-bigint -``` - -or using yarn: - -```sh -yarn add @babel/plugin-syntax-bigint --dev -``` diff --git a/packages/babel-plugin-syntax-bigint/package.json b/packages/babel-plugin-syntax-bigint/package.json deleted file mode 100644 index 9993d4d33f1a..000000000000 --- a/packages/babel-plugin-syntax-bigint/package.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "name": "@babel/plugin-syntax-bigint", - "version": "7.4.4", - "description": "Allow parsing of BigInt literals", - "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-syntax-bigint", - "license": "MIT", - "publishConfig": { - "access": "public" - }, - "main": "lib/index.js", - "keywords": [ - "babel-plugin" - ], - "dependencies": { - "@babel/helper-plugin-utils": "^7.0.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - }, - "devDependencies": { - "@babel/core": "^7.4.4" - } -} diff --git a/packages/babel-plugin-syntax-bigint/src/index.js b/packages/babel-plugin-syntax-bigint/src/index.js deleted file mode 100644 index 89129a5f06d4..000000000000 --- a/packages/babel-plugin-syntax-bigint/src/index.js +++ /dev/null @@ -1,13 +0,0 @@ -import { declare } from "@babel/helper-plugin-utils"; - -export default declare(api => { - api.assertVersion(7); - - return { - name: "syntax-bigint", - - manipulateOptions(opts, parserOpts) { - parserOpts.plugins.push("bigInt"); - }, - }; -}); diff --git a/packages/babel-plugin-syntax-class-properties/package.json b/packages/babel-plugin-syntax-class-properties/package.json index dba0685a8477..68cbc402a4c3 100644 --- a/packages/babel-plugin-syntax-class-properties/package.json +++ b/packages/babel-plugin-syntax-class-properties/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-syntax-class-properties", - "version": "7.2.0", + "version": "7.8.3", "description": "Allow parsing of class properties", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-syntax-class-properties", "license": "MIT", @@ -12,12 +12,12 @@ "babel-plugin" ], "dependencies": { - "@babel/helper-plugin-utils": "^7.0.0" + "@babel/helper-plugin-utils": "^7.8.3" }, "peerDependencies": { "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.2.0" + "@babel/core": "^7.8.3" } } diff --git a/packages/babel-plugin-syntax-decorators/package.json b/packages/babel-plugin-syntax-decorators/package.json index a8bae4e61af0..839628a32c4d 100644 --- a/packages/babel-plugin-syntax-decorators/package.json +++ b/packages/babel-plugin-syntax-decorators/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-syntax-decorators", - "version": "7.2.0", + "version": "7.8.3", "description": "Allow parsing of decorators", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-syntax-decorators", "license": "MIT", @@ -12,12 +12,12 @@ "babel-plugin" ], "dependencies": { - "@babel/helper-plugin-utils": "^7.0.0" + "@babel/helper-plugin-utils": "^7.8.3" }, "peerDependencies": { "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.2.0" + "@babel/core": "^7.8.3" } } diff --git a/packages/babel-plugin-syntax-do-expressions/package.json b/packages/babel-plugin-syntax-do-expressions/package.json index d95b511792ad..a7b8506891a8 100644 --- a/packages/babel-plugin-syntax-do-expressions/package.json +++ b/packages/babel-plugin-syntax-do-expressions/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-syntax-do-expressions", - "version": "7.2.0", + "version": "7.8.3", "description": "Allow parsing of do expressions", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-syntax-do-expressions", "license": "MIT", @@ -12,12 +12,12 @@ "babel-plugin" ], "dependencies": { - "@babel/helper-plugin-utils": "^7.0.0" + "@babel/helper-plugin-utils": "^7.8.3" }, "peerDependencies": { "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.2.0" + "@babel/core": "^7.8.3" } } diff --git a/packages/babel-plugin-syntax-dynamic-import/README.md b/packages/babel-plugin-syntax-dynamic-import/README.md deleted file mode 100644 index 127903505f21..000000000000 --- a/packages/babel-plugin-syntax-dynamic-import/README.md +++ /dev/null @@ -1,19 +0,0 @@ -# @babel/plugin-syntax-dynamic-import - -> Allow parsing of import() - -See our website [@babel/plugin-syntax-dynamic-import](https://babeljs.io/docs/en/next/babel-plugin-syntax-dynamic-import.html) for more information. - -## Install - -Using npm: - -```sh -npm install --save-dev @babel/plugin-syntax-dynamic-import -``` - -or using yarn: - -```sh -yarn add @babel/plugin-syntax-dynamic-import --dev -``` diff --git a/packages/babel-plugin-syntax-dynamic-import/package.json b/packages/babel-plugin-syntax-dynamic-import/package.json deleted file mode 100644 index 23240cbaa16e..000000000000 --- a/packages/babel-plugin-syntax-dynamic-import/package.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "name": "@babel/plugin-syntax-dynamic-import", - "version": "7.2.0", - "description": "Allow parsing of import()", - "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-syntax-dynamic-import", - "license": "MIT", - "publishConfig": { - "access": "public" - }, - "main": "lib/index.js", - "keywords": [ - "babel-plugin" - ], - "dependencies": { - "@babel/helper-plugin-utils": "^7.0.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - }, - "devDependencies": { - "@babel/core": "^7.2.0" - } -} diff --git a/packages/babel-plugin-syntax-dynamic-import/src/index.js b/packages/babel-plugin-syntax-dynamic-import/src/index.js deleted file mode 100644 index 13914e3ada57..000000000000 --- a/packages/babel-plugin-syntax-dynamic-import/src/index.js +++ /dev/null @@ -1,13 +0,0 @@ -import { declare } from "@babel/helper-plugin-utils"; - -export default declare(api => { - api.assertVersion(7); - - return { - name: "syntax-dynamic-import", - - manipulateOptions(opts, parserOpts) { - parserOpts.plugins.push("dynamicImport"); - }, - }; -}); diff --git a/packages/babel-plugin-syntax-export-default-from/package.json b/packages/babel-plugin-syntax-export-default-from/package.json index 7c2f2ab05435..e1c15ddba36c 100644 --- a/packages/babel-plugin-syntax-export-default-from/package.json +++ b/packages/babel-plugin-syntax-export-default-from/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-syntax-export-default-from", - "version": "7.2.0", + "version": "7.8.3", "description": "Allow parsing of export default from", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-syntax-export-default-from", "license": "MIT", @@ -12,12 +12,12 @@ "babel-plugin" ], "dependencies": { - "@babel/helper-plugin-utils": "^7.0.0" + "@babel/helper-plugin-utils": "^7.8.3" }, "peerDependencies": { "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.2.0" + "@babel/core": "^7.8.3" } } diff --git a/packages/babel-plugin-syntax-export-namespace-from/package.json b/packages/babel-plugin-syntax-export-namespace-from/package.json index fde4093e1be8..ad3c7c32f07a 100644 --- a/packages/babel-plugin-syntax-export-namespace-from/package.json +++ b/packages/babel-plugin-syntax-export-namespace-from/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-syntax-export-namespace-from", - "version": "7.2.0", + "version": "7.8.3", "description": "Allow parsing of export namespace from", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-syntax-export-namespace-from", "license": "MIT", @@ -12,12 +12,12 @@ "babel-plugin" ], "dependencies": { - "@babel/helper-plugin-utils": "^7.0.0" + "@babel/helper-plugin-utils": "^7.8.3" }, "peerDependencies": { "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.2.0" + "@babel/core": "^7.8.3" } } diff --git a/packages/babel-plugin-syntax-flow/package.json b/packages/babel-plugin-syntax-flow/package.json index 864023567a5d..b762f6da4157 100644 --- a/packages/babel-plugin-syntax-flow/package.json +++ b/packages/babel-plugin-syntax-flow/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-syntax-flow", - "version": "7.2.0", + "version": "7.8.3", "description": "Allow parsing of the flow syntax", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-syntax-flow", "license": "MIT", @@ -12,12 +12,12 @@ "babel-plugin" ], "dependencies": { - "@babel/helper-plugin-utils": "^7.0.0" + "@babel/helper-plugin-utils": "^7.8.3" }, "peerDependencies": { "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.2.0" + "@babel/core": "^7.8.3" } } diff --git a/packages/babel-plugin-syntax-flow/src/index.js b/packages/babel-plugin-syntax-flow/src/index.js index 0062dbee50e6..72fb7dc60b95 100644 --- a/packages/babel-plugin-syntax-flow/src/index.js +++ b/packages/babel-plugin-syntax-flow/src/index.js @@ -5,12 +5,16 @@ export default declare((api, options) => { // When enabled and plugins includes flow, all files should be parsed as if // the @flow pragma was provided. - const { all } = options; + const { all, enums } = options; if (typeof all !== "boolean" && typeof all !== "undefined") { throw new Error(".all must be a boolean, or undefined"); } + if (typeof enums !== "boolean" && typeof enums !== "undefined") { + throw new Error(".enums must be a boolean, or undefined"); + } + return { name: "syntax-flow", @@ -25,7 +29,7 @@ export default declare((api, options) => { return; } - parserOpts.plugins.push(["flow", { all }]); + parserOpts.plugins.push(["flow", { all, enums }]); }, }; }); diff --git a/packages/babel-plugin-syntax-function-bind/package.json b/packages/babel-plugin-syntax-function-bind/package.json index 86cf0265d67e..8b767e563a6a 100644 --- a/packages/babel-plugin-syntax-function-bind/package.json +++ b/packages/babel-plugin-syntax-function-bind/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-syntax-function-bind", - "version": "7.2.0", + "version": "7.8.3", "description": "Allow parsing of function bind", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-syntax-function-bind", "license": "MIT", @@ -12,12 +12,12 @@ "babel-plugin" ], "dependencies": { - "@babel/helper-plugin-utils": "^7.0.0" + "@babel/helper-plugin-utils": "^7.8.3" }, "peerDependencies": { "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.2.0" + "@babel/core": "^7.8.3" } } diff --git a/packages/babel-plugin-syntax-function-sent/package.json b/packages/babel-plugin-syntax-function-sent/package.json index 1b503528cb48..61903d76f327 100644 --- a/packages/babel-plugin-syntax-function-sent/package.json +++ b/packages/babel-plugin-syntax-function-sent/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-syntax-function-sent", - "version": "7.2.0", + "version": "7.8.3", "description": "Allow parsing of the function.sent meta property", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-syntax-function-sent", "license": "MIT", @@ -12,12 +12,12 @@ "babel-plugin" ], "dependencies": { - "@babel/helper-plugin-utils": "^7.0.0" + "@babel/helper-plugin-utils": "^7.8.3" }, "peerDependencies": { "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.2.0" + "@babel/core": "^7.8.3" } } diff --git a/packages/babel-plugin-syntax-import-meta/package.json b/packages/babel-plugin-syntax-import-meta/package.json index 25c7cb70c748..dd82f0e31f57 100644 --- a/packages/babel-plugin-syntax-import-meta/package.json +++ b/packages/babel-plugin-syntax-import-meta/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-syntax-import-meta", - "version": "7.2.0", + "version": "7.8.3", "description": "Allow parsing of import.meta", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-syntax-import-meta", "license": "MIT", @@ -12,12 +12,12 @@ "babel-plugin" ], "dependencies": { - "@babel/helper-plugin-utils": "^7.0.0" + "@babel/helper-plugin-utils": "^7.8.3" }, "peerDependencies": { "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.2.0" + "@babel/core": "^7.8.3" } } diff --git a/packages/babel-plugin-syntax-json-strings/.npmignore b/packages/babel-plugin-syntax-json-strings/.npmignore deleted file mode 100644 index f9806945836e..000000000000 --- a/packages/babel-plugin-syntax-json-strings/.npmignore +++ /dev/null @@ -1,3 +0,0 @@ -src -test -*.log diff --git a/packages/babel-plugin-syntax-json-strings/README.md b/packages/babel-plugin-syntax-json-strings/README.md deleted file mode 100644 index 03c00a2d1764..000000000000 --- a/packages/babel-plugin-syntax-json-strings/README.md +++ /dev/null @@ -1,19 +0,0 @@ -# @babel/plugin-syntax-json-strings - -> Allow parsing of the U+2028 LINE SEPARATOR and U+2029 PARAGRAPH SEPARATOR in JS strings - -See our website [@babel/plugin-syntax-json-strings](https://babeljs.io/docs/en/next/babel-plugin-syntax-json-strings.html) for more information. - -## Install - -Using npm: - -```sh -npm install --save-dev @babel/plugin-syntax-json-strings -``` - -or using yarn: - -```sh -yarn add @babel/plugin-syntax-json-strings --dev -``` diff --git a/packages/babel-plugin-syntax-json-strings/package.json b/packages/babel-plugin-syntax-json-strings/package.json deleted file mode 100644 index 3f1dcab3841e..000000000000 --- a/packages/babel-plugin-syntax-json-strings/package.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "name": "@babel/plugin-syntax-json-strings", - "version": "7.2.0", - "description": "Allow parsing of the U+2028 LINE SEPARATOR and U+2029 PARAGRAPH SEPARATOR in JS strings", - "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-syntax-json-strings", - "license": "MIT", - "publishConfig": { - "access": "public" - }, - "main": "lib/index.js", - "keywords": [ - "babel-plugin" - ], - "dependencies": { - "@babel/helper-plugin-utils": "^7.0.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - }, - "devDependencies": { - "@babel/core": "^7.2.0" - } -} diff --git a/packages/babel-plugin-syntax-json-strings/src/index.js b/packages/babel-plugin-syntax-json-strings/src/index.js deleted file mode 100644 index 0a61997b8a6f..000000000000 --- a/packages/babel-plugin-syntax-json-strings/src/index.js +++ /dev/null @@ -1,13 +0,0 @@ -import { declare } from "@babel/helper-plugin-utils"; - -export default declare(api => { - api.assertVersion(7); - - return { - name: "syntax-json-strings", - - manipulateOptions(opts, parserOpts) { - parserOpts.plugins.push("jsonStrings"); - }, - }; -}); diff --git a/packages/babel-plugin-syntax-jsx/package.json b/packages/babel-plugin-syntax-jsx/package.json index dd4ead2baaf8..607003242268 100644 --- a/packages/babel-plugin-syntax-jsx/package.json +++ b/packages/babel-plugin-syntax-jsx/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-syntax-jsx", - "version": "7.2.0", + "version": "7.8.3", "description": "Allow parsing of jsx", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-syntax-jsx", "license": "MIT", @@ -12,12 +12,12 @@ "babel-plugin" ], "dependencies": { - "@babel/helper-plugin-utils": "^7.0.0" + "@babel/helper-plugin-utils": "^7.8.3" }, "peerDependencies": { "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.2.0" + "@babel/core": "^7.8.3" } } diff --git a/packages/babel-plugin-syntax-logical-assignment-operators/package.json b/packages/babel-plugin-syntax-logical-assignment-operators/package.json index aeea2eaa72e7..68dff072600e 100644 --- a/packages/babel-plugin-syntax-logical-assignment-operators/package.json +++ b/packages/babel-plugin-syntax-logical-assignment-operators/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-syntax-logical-assignment-operators", - "version": "7.2.0", + "version": "7.8.3", "description": "Allow parsing of the logical assignment operators", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-syntax-logical-assignment-operators", "license": "MIT", @@ -12,12 +12,12 @@ "babel-plugin" ], "dependencies": { - "@babel/helper-plugin-utils": "^7.0.0" + "@babel/helper-plugin-utils": "^7.8.3" }, "peerDependencies": { "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.2.0" + "@babel/core": "^7.8.3" } } diff --git a/packages/babel-plugin-syntax-nullish-coalescing-operator/.npmignore b/packages/babel-plugin-syntax-nullish-coalescing-operator/.npmignore deleted file mode 100644 index f9806945836e..000000000000 --- a/packages/babel-plugin-syntax-nullish-coalescing-operator/.npmignore +++ /dev/null @@ -1,3 +0,0 @@ -src -test -*.log diff --git a/packages/babel-plugin-syntax-nullish-coalescing-operator/README.md b/packages/babel-plugin-syntax-nullish-coalescing-operator/README.md deleted file mode 100644 index f91e8117f785..000000000000 --- a/packages/babel-plugin-syntax-nullish-coalescing-operator/README.md +++ /dev/null @@ -1,19 +0,0 @@ -# @babel/plugin-syntax-nullish-coalescing-operator - -> Allow parsing of the nullish-coalescing operator - -See our website [@babel/plugin-syntax-nullish-coalescing-operator](https://babeljs.io/docs/en/next/babel-plugin-syntax-nullish-coalescing-operator.html) for more information. - -## Install - -Using npm: - -```sh -npm install --save-dev @babel/plugin-syntax-nullish-coalescing-operator -``` - -or using yarn: - -```sh -yarn add @babel/plugin-syntax-nullish-coalescing-operator --dev -``` diff --git a/packages/babel-plugin-syntax-nullish-coalescing-operator/package.json b/packages/babel-plugin-syntax-nullish-coalescing-operator/package.json deleted file mode 100644 index 323934061e24..000000000000 --- a/packages/babel-plugin-syntax-nullish-coalescing-operator/package.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "name": "@babel/plugin-syntax-nullish-coalescing-operator", - "version": "7.2.0", - "description": "Allow parsing of the nullish-coalescing operator", - "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-syntax-nullish-coalescing-operator", - "license": "MIT", - "publishConfig": { - "access": "public" - }, - "main": "lib/index.js", - "keywords": [ - "babel-plugin" - ], - "dependencies": { - "@babel/helper-plugin-utils": "^7.0.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - }, - "devDependencies": { - "@babel/core": "^7.2.0" - } -} diff --git a/packages/babel-plugin-syntax-nullish-coalescing-operator/src/index.js b/packages/babel-plugin-syntax-nullish-coalescing-operator/src/index.js deleted file mode 100644 index 0bd6c5d70048..000000000000 --- a/packages/babel-plugin-syntax-nullish-coalescing-operator/src/index.js +++ /dev/null @@ -1,13 +0,0 @@ -import { declare } from "@babel/helper-plugin-utils"; - -export default declare(api => { - api.assertVersion(7); - - return { - name: "syntax-nullish-coalescing-operator", - - manipulateOptions(opts, parserOpts) { - parserOpts.plugins.push("nullishCoalescingOperator"); - }, - }; -}); diff --git a/packages/babel-plugin-syntax-numeric-separator/package.json b/packages/babel-plugin-syntax-numeric-separator/package.json index c60d9ccdf975..143a79126062 100644 --- a/packages/babel-plugin-syntax-numeric-separator/package.json +++ b/packages/babel-plugin-syntax-numeric-separator/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-syntax-numeric-separator", - "version": "7.2.0", + "version": "7.8.3", "description": "Allow parsing of Decimal, Binary, Hex and Octal literals that contain a Numeric Literal Separator", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-syntax-numeric-separator", "license": "MIT", @@ -12,12 +12,12 @@ "babel-plugin" ], "dependencies": { - "@babel/helper-plugin-utils": "^7.0.0" + "@babel/helper-plugin-utils": "^7.8.3" }, "peerDependencies": { "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.2.0" + "@babel/core": "^7.8.3" } } diff --git a/packages/babel-plugin-syntax-object-rest-spread/.npmignore b/packages/babel-plugin-syntax-object-rest-spread/.npmignore deleted file mode 100644 index f9806945836e..000000000000 --- a/packages/babel-plugin-syntax-object-rest-spread/.npmignore +++ /dev/null @@ -1,3 +0,0 @@ -src -test -*.log diff --git a/packages/babel-plugin-syntax-object-rest-spread/README.md b/packages/babel-plugin-syntax-object-rest-spread/README.md deleted file mode 100644 index 95c4472ebe68..000000000000 --- a/packages/babel-plugin-syntax-object-rest-spread/README.md +++ /dev/null @@ -1,19 +0,0 @@ -# @babel/plugin-syntax-object-rest-spread - -> Allow parsing of object rest/spread - -See our website [@babel/plugin-syntax-object-rest-spread](https://babeljs.io/docs/en/next/babel-plugin-syntax-object-rest-spread.html) for more information. - -## Install - -Using npm: - -```sh -npm install --save-dev @babel/plugin-syntax-object-rest-spread -``` - -or using yarn: - -```sh -yarn add @babel/plugin-syntax-object-rest-spread --dev -``` diff --git a/packages/babel-plugin-syntax-object-rest-spread/package.json b/packages/babel-plugin-syntax-object-rest-spread/package.json deleted file mode 100644 index e0b6524d3a5b..000000000000 --- a/packages/babel-plugin-syntax-object-rest-spread/package.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "name": "@babel/plugin-syntax-object-rest-spread", - "version": "7.2.0", - "description": "Allow parsing of object rest/spread", - "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-syntax-object-rest-spread", - "license": "MIT", - "publishConfig": { - "access": "public" - }, - "main": "lib/index.js", - "keywords": [ - "babel-plugin" - ], - "dependencies": { - "@babel/helper-plugin-utils": "^7.0.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - }, - "devDependencies": { - "@babel/core": "^7.2.0" - } -} diff --git a/packages/babel-plugin-syntax-object-rest-spread/src/index.js b/packages/babel-plugin-syntax-object-rest-spread/src/index.js deleted file mode 100644 index 66f909c5a1d9..000000000000 --- a/packages/babel-plugin-syntax-object-rest-spread/src/index.js +++ /dev/null @@ -1,13 +0,0 @@ -import { declare } from "@babel/helper-plugin-utils"; - -export default declare(api => { - api.assertVersion(7); - - return { - name: "syntax-object-rest-spread", - - manipulateOptions(opts, parserOpts) { - parserOpts.plugins.push("objectRestSpread"); - }, - }; -}); diff --git a/packages/babel-plugin-syntax-optional-catch-binding/.npmignore b/packages/babel-plugin-syntax-optional-catch-binding/.npmignore deleted file mode 100644 index f9806945836e..000000000000 --- a/packages/babel-plugin-syntax-optional-catch-binding/.npmignore +++ /dev/null @@ -1,3 +0,0 @@ -src -test -*.log diff --git a/packages/babel-plugin-syntax-optional-catch-binding/README.md b/packages/babel-plugin-syntax-optional-catch-binding/README.md deleted file mode 100644 index 9085f9180c54..000000000000 --- a/packages/babel-plugin-syntax-optional-catch-binding/README.md +++ /dev/null @@ -1,19 +0,0 @@ -# @babel/plugin-syntax-optional-catch-binding - -> Allow parsing of optional catch bindings - -See our website [@babel/plugin-syntax-optional-catch-binding](https://babeljs.io/docs/en/next/babel-plugin-syntax-optional-catch-binding.html) for more information. - -## Install - -Using npm: - -```sh -npm install --save-dev @babel/plugin-syntax-optional-catch-binding -``` - -or using yarn: - -```sh -yarn add @babel/plugin-syntax-optional-catch-binding --dev -``` diff --git a/packages/babel-plugin-syntax-optional-catch-binding/package.json b/packages/babel-plugin-syntax-optional-catch-binding/package.json deleted file mode 100644 index 09e1ff1b176f..000000000000 --- a/packages/babel-plugin-syntax-optional-catch-binding/package.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "name": "@babel/plugin-syntax-optional-catch-binding", - "version": "7.2.0", - "description": "Allow parsing of optional catch bindings", - "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-syntax-optional-catch-binding", - "license": "MIT", - "publishConfig": { - "access": "public" - }, - "main": "lib/index.js", - "keywords": [ - "babel-plugin" - ], - "dependencies": { - "@babel/helper-plugin-utils": "^7.0.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - }, - "devDependencies": { - "@babel/core": "^7.2.0" - } -} diff --git a/packages/babel-plugin-syntax-optional-catch-binding/src/index.js b/packages/babel-plugin-syntax-optional-catch-binding/src/index.js deleted file mode 100644 index 68de2be52c31..000000000000 --- a/packages/babel-plugin-syntax-optional-catch-binding/src/index.js +++ /dev/null @@ -1,13 +0,0 @@ -import { declare } from "@babel/helper-plugin-utils"; - -export default declare(api => { - api.assertVersion(7); - - return { - name: "syntax-optional-catch-binding", - - manipulateOptions(opts, parserOpts) { - parserOpts.plugins.push("optionalCatchBinding"); - }, - }; -}); diff --git a/packages/babel-plugin-syntax-optional-chaining/.npmignore b/packages/babel-plugin-syntax-optional-chaining/.npmignore deleted file mode 100644 index f9806945836e..000000000000 --- a/packages/babel-plugin-syntax-optional-chaining/.npmignore +++ /dev/null @@ -1,3 +0,0 @@ -src -test -*.log diff --git a/packages/babel-plugin-syntax-optional-chaining/README.md b/packages/babel-plugin-syntax-optional-chaining/README.md deleted file mode 100644 index 712abc37046d..000000000000 --- a/packages/babel-plugin-syntax-optional-chaining/README.md +++ /dev/null @@ -1,19 +0,0 @@ -# @babel/plugin-syntax-optional-chaining - -> Allow parsing of optional properties - -See our website [@babel/plugin-syntax-optional-chaining](https://babeljs.io/docs/en/next/babel-plugin-syntax-optional-chaining.html) for more information. - -## Install - -Using npm: - -```sh -npm install --save-dev @babel/plugin-syntax-optional-chaining -``` - -or using yarn: - -```sh -yarn add @babel/plugin-syntax-optional-chaining --dev -``` diff --git a/packages/babel-plugin-syntax-optional-chaining/package.json b/packages/babel-plugin-syntax-optional-chaining/package.json deleted file mode 100644 index 22adb320d437..000000000000 --- a/packages/babel-plugin-syntax-optional-chaining/package.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "name": "@babel/plugin-syntax-optional-chaining", - "version": "7.2.0", - "description": "Allow parsing of optional properties", - "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-syntax-optional-chaining", - "license": "MIT", - "publishConfig": { - "access": "public" - }, - "main": "lib/index.js", - "keywords": [ - "babel-plugin" - ], - "dependencies": { - "@babel/helper-plugin-utils": "^7.0.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - }, - "devDependencies": { - "@babel/core": "^7.2.0" - } -} diff --git a/packages/babel-plugin-syntax-optional-chaining/src/index.js b/packages/babel-plugin-syntax-optional-chaining/src/index.js deleted file mode 100644 index 968f34dd728e..000000000000 --- a/packages/babel-plugin-syntax-optional-chaining/src/index.js +++ /dev/null @@ -1,13 +0,0 @@ -import { declare } from "@babel/helper-plugin-utils"; - -export default declare(api => { - api.assertVersion(7); - - return { - name: "syntax-optional-chaining", - - manipulateOptions(opts, parserOpts) { - parserOpts.plugins.push("optionalChaining"); - }, - }; -}); diff --git a/packages/babel-plugin-syntax-partial-application/package.json b/packages/babel-plugin-syntax-partial-application/package.json index 50f8fcdf7e6b..4556ac19a1a5 100644 --- a/packages/babel-plugin-syntax-partial-application/package.json +++ b/packages/babel-plugin-syntax-partial-application/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-syntax-partial-application", - "version": "7.4.4", + "version": "7.8.3", "description": "Allow parsing of partial application syntax", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-syntax-partial-application", "license": "MIT", @@ -12,12 +12,12 @@ "babel-plugin" ], "dependencies": { - "@babel/helper-plugin-utils": "^7.0.0" + "@babel/helper-plugin-utils": "^7.8.3" }, "peerDependencies": { "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.4.4" + "@babel/core": "^7.8.3" } } diff --git a/packages/babel-plugin-syntax-pipeline-operator/.npmignore b/packages/babel-plugin-syntax-pipeline-operator/.npmignore new file mode 100644 index 000000000000..2b1fceba679b --- /dev/null +++ b/packages/babel-plugin-syntax-pipeline-operator/.npmignore @@ -0,0 +1,3 @@ +*.log +src +test diff --git a/packages/babel-plugin-syntax-pipeline-operator/package.json b/packages/babel-plugin-syntax-pipeline-operator/package.json index 61f571097149..a4eeafea4981 100644 --- a/packages/babel-plugin-syntax-pipeline-operator/package.json +++ b/packages/babel-plugin-syntax-pipeline-operator/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-syntax-pipeline-operator", - "version": "7.5.0", + "version": "7.8.3", "description": "Allow parsing of the pipeline operator", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-syntax-pipeline-operator", "license": "MIT", @@ -12,12 +12,12 @@ "babel-plugin" ], "dependencies": { - "@babel/helper-plugin-utils": "^7.0.0" + "@babel/helper-plugin-utils": "^7.8.3" }, "peerDependencies": { "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.5.0" + "@babel/core": "^7.8.3" } } diff --git a/packages/babel-plugin-syntax-throw-expressions/package.json b/packages/babel-plugin-syntax-throw-expressions/package.json index 55afeeb6b1dc..d5b16af51a63 100644 --- a/packages/babel-plugin-syntax-throw-expressions/package.json +++ b/packages/babel-plugin-syntax-throw-expressions/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-syntax-throw-expressions", - "version": "7.2.0", + "version": "7.8.3", "description": "Allow parsing of Throw Expressions", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-syntax-throw-expressions", "license": "MIT", @@ -12,12 +12,12 @@ "babel-plugin" ], "dependencies": { - "@babel/helper-plugin-utils": "^7.0.0" + "@babel/helper-plugin-utils": "^7.8.3" }, "peerDependencies": { "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.2.0" + "@babel/core": "^7.8.3" } } diff --git a/packages/babel-plugin-syntax-bigint/.npmignore b/packages/babel-plugin-syntax-top-level-await/.npmignore similarity index 100% rename from packages/babel-plugin-syntax-bigint/.npmignore rename to packages/babel-plugin-syntax-top-level-await/.npmignore diff --git a/packages/babel-plugin-syntax-top-level-await/README.md b/packages/babel-plugin-syntax-top-level-await/README.md new file mode 100644 index 000000000000..476cb27d6bbb --- /dev/null +++ b/packages/babel-plugin-syntax-top-level-await/README.md @@ -0,0 +1,19 @@ +# @babel/plugin-syntax-top-level-await + +> Allow parsing of top-level await in modules + +See our website [@babel/plugin-syntax-top-level-await](https://babeljs.io/docs/en/next/babel-plugin-syntax-top-level-await.html) for more information. + +## Install + +Using npm: + +```sh +npm install --save-dev @babel/plugin-syntax-top-level-await +``` + +or using yarn: + +```sh +yarn add @babel/plugin-syntax-top-level-await --dev +``` diff --git a/packages/babel-plugin-syntax-top-level-await/package.json b/packages/babel-plugin-syntax-top-level-await/package.json new file mode 100644 index 000000000000..20383fe62eaa --- /dev/null +++ b/packages/babel-plugin-syntax-top-level-await/package.json @@ -0,0 +1,23 @@ +{ + "name": "@babel/plugin-syntax-top-level-await", + "version": "7.8.3", + "description": "Allow parsing of top-level await in modules", + "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-syntax-top-level-await", + "license": "MIT", + "publishConfig": { + "access": "public" + }, + "main": "lib/index.js", + "keywords": [ + "babel-plugin" + ], + "dependencies": { + "@babel/helper-plugin-utils": "^7.8.3" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + }, + "devDependencies": { + "@babel/core": "^7.8.3" + } +} diff --git a/packages/babel-plugin-syntax-top-level-await/src/index.js b/packages/babel-plugin-syntax-top-level-await/src/index.js new file mode 100644 index 000000000000..2429b8ead657 --- /dev/null +++ b/packages/babel-plugin-syntax-top-level-await/src/index.js @@ -0,0 +1,13 @@ +import { declare } from "@babel/helper-plugin-utils"; + +export default declare(api => { + api.assertVersion(7); + + return { + name: "syntax-top-level-await", + + manipulateOptions(opts, parserOpts) { + parserOpts.plugins.push("topLevelAwait"); + }, + }; +}); diff --git a/packages/babel-plugin-syntax-typescript/package.json b/packages/babel-plugin-syntax-typescript/package.json index d3410aca3a27..dbf6bb8c1678 100644 --- a/packages/babel-plugin-syntax-typescript/package.json +++ b/packages/babel-plugin-syntax-typescript/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-syntax-typescript", - "version": "7.3.3", + "version": "7.8.3", "description": "Allow parsing of TypeScript syntax", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-syntax-typescript", "license": "MIT", @@ -13,12 +13,12 @@ "typescript" ], "dependencies": { - "@babel/helper-plugin-utils": "^7.0.0" + "@babel/helper-plugin-utils": "^7.8.3" }, "peerDependencies": { "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.3.3" + "@babel/core": "^7.8.3" } } diff --git a/packages/babel-plugin-transform-arrow-functions/package.json b/packages/babel-plugin-transform-arrow-functions/package.json index 7506dfc22b99..60fac1704868 100644 --- a/packages/babel-plugin-transform-arrow-functions/package.json +++ b/packages/babel-plugin-transform-arrow-functions/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-transform-arrow-functions", - "version": "7.2.0", + "version": "7.8.3", "description": "Compile ES2015 arrow functions to ES5", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-arrow-functions", "license": "MIT", @@ -12,14 +12,14 @@ "babel-plugin" ], "dependencies": { - "@babel/helper-plugin-utils": "^7.0.0" + "@babel/helper-plugin-utils": "^7.8.3" }, "peerDependencies": { "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.2.0", - "@babel/helper-plugin-test-runner": "^7.0.0", - "@babel/traverse": "^7.0.0" + "@babel/core": "^7.8.3", + "@babel/helper-plugin-test-runner": "^7.8.3", + "@babel/traverse": "^7.8.3" } } diff --git a/packages/babel-plugin-transform-async-to-generator/package.json b/packages/babel-plugin-transform-async-to-generator/package.json index d6b8b908e89a..738b247a5ee2 100644 --- a/packages/babel-plugin-transform-async-to-generator/package.json +++ b/packages/babel-plugin-transform-async-to-generator/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-transform-async-to-generator", - "version": "7.5.0", + "version": "7.8.3", "description": "Turn async functions into ES2015 generators", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-async-to-generator", "license": "MIT", @@ -12,15 +12,15 @@ "babel-plugin" ], "dependencies": { - "@babel/helper-module-imports": "^7.0.0", - "@babel/helper-plugin-utils": "^7.0.0", - "@babel/helper-remap-async-to-generator": "^7.1.0" + "@babel/helper-module-imports": "^7.8.3", + "@babel/helper-plugin-utils": "^7.8.3", + "@babel/helper-remap-async-to-generator": "^7.8.3" }, "peerDependencies": { "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.5.0", - "@babel/helper-plugin-test-runner": "^7.0.0" + "@babel/core": "^7.8.3", + "@babel/helper-plugin-test-runner": "^7.8.3" } } diff --git a/packages/babel-plugin-transform-async-to-generator/test/fixtures/async-to-generator/deeply-nested-asyncs/output.js b/packages/babel-plugin-transform-async-to-generator/test/fixtures/async-to-generator/deeply-nested-asyncs/output.js index a5914b25f780..c6437ce0bb15 100644 --- a/packages/babel-plugin-transform-async-to-generator/test/fixtures/async-to-generator/deeply-nested-asyncs/output.js +++ b/packages/babel-plugin-transform-async-to-generator/test/fixtures/async-to-generator/deeply-nested-asyncs/output.js @@ -4,8 +4,8 @@ function s(_x) { function _s() { _s = babelHelpers.asyncToGenerator(function* (x) { - var _this = this, - _arguments = arguments; + var _arguments = arguments, + _this = this; for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { args[_key - 1] = arguments[_key]; diff --git a/packages/babel-plugin-transform-async-to-generator/test/fixtures/async-to-generator/object-method-with-super/output.js b/packages/babel-plugin-transform-async-to-generator/test/fixtures/async-to-generator/object-method-with-super/output.js index c8bccac252f7..6e26d643e065 100644 --- a/packages/babel-plugin-transform-async-to-generator/test/fixtures/async-to-generator/object-method-with-super/output.js +++ b/packages/babel-plugin-transform-async-to-generator/test/fixtures/async-to-generator/object-method-with-super/output.js @@ -1,11 +1,12 @@ class Foo extends class {} { method() { - var _superprop_callMethod = (..._args) => super.method(..._args); + var _superprop_getMethod = () => super.method, + _this = this; return babelHelpers.asyncToGenerator(function* () { - _superprop_callMethod(); + _superprop_getMethod().call(_this); - var arrow = () => _superprop_callMethod(); + var arrow = () => _superprop_getMethod().call(_this); })(); } diff --git a/packages/babel-plugin-transform-block-scoped-functions/package.json b/packages/babel-plugin-transform-block-scoped-functions/package.json index b6ea3d6117f3..faacc88d68d7 100644 --- a/packages/babel-plugin-transform-block-scoped-functions/package.json +++ b/packages/babel-plugin-transform-block-scoped-functions/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-transform-block-scoped-functions", - "version": "7.2.0", + "version": "7.8.3", "description": "Babel plugin to ensure function declarations at the block level are block scoped", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-block-scoped-functions", "license": "MIT", @@ -12,13 +12,13 @@ "babel-plugin" ], "dependencies": { - "@babel/helper-plugin-utils": "^7.0.0" + "@babel/helper-plugin-utils": "^7.8.3" }, "peerDependencies": { "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.2.0", - "@babel/helper-plugin-test-runner": "^7.0.0" + "@babel/core": "^7.8.3", + "@babel/helper-plugin-test-runner": "^7.8.3" } } diff --git a/packages/babel-plugin-transform-block-scoping/package.json b/packages/babel-plugin-transform-block-scoping/package.json index d942568230ab..71672e895cf3 100644 --- a/packages/babel-plugin-transform-block-scoping/package.json +++ b/packages/babel-plugin-transform-block-scoping/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-transform-block-scoping", - "version": "7.5.5", + "version": "7.8.3", "description": "Compile ES2015 block scoping (const and let) to ES5", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-block-scoping", "license": "MIT", @@ -9,7 +9,7 @@ }, "main": "lib/index.js", "dependencies": { - "@babel/helper-plugin-utils": "^7.0.0", + "@babel/helper-plugin-utils": "^7.8.3", "lodash": "^4.17.13" }, "keywords": [ @@ -19,7 +19,7 @@ "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.5.5", - "@babel/helper-plugin-test-runner": "^7.0.0" + "@babel/core": "^7.8.3", + "@babel/helper-plugin-test-runner": "^7.8.3" } } diff --git a/packages/babel-plugin-transform-block-scoping/src/index.js b/packages/babel-plugin-transform-block-scoping/src/index.js index 50c254c848a8..5391032751c4 100644 --- a/packages/babel-plugin-transform-block-scoping/src/index.js +++ b/packages/babel-plugin-transform-block-scoping/src/index.js @@ -441,22 +441,25 @@ class BlockScoping { } updateScopeInfo(wrappedInClosure) { - const scope = this.scope; + const blockScope = this.blockPath.scope; - const parentScope = scope.getFunctionParent() || scope.getProgramParent(); + const parentScope = + blockScope.getFunctionParent() || blockScope.getProgramParent(); const letRefs = this.letReferences; for (const key of Object.keys(letRefs)) { const ref = letRefs[key]; - const binding = scope.getBinding(ref.name); + const binding = blockScope.getBinding(ref.name); if (!binding) continue; if (binding.kind === "let" || binding.kind === "const") { binding.kind = "var"; if (wrappedInClosure) { - scope.removeBinding(ref.name); + if (blockScope.hasOwnBinding(ref.name)) { + blockScope.removeBinding(ref.name); + } } else { - scope.moveBindingTo(ref.name, parentScope); + blockScope.moveBindingTo(ref.name, parentScope); } } } diff --git a/packages/babel-plugin-transform-block-scoping/test/fixtures/const-violations/flow-declar/input.js b/packages/babel-plugin-transform-block-scoping/test/fixtures/const-violations/flow-declar/input.js index e9ca299ae87e..666d38e3a4ed 100644 --- a/packages/babel-plugin-transform-block-scoping/test/fixtures/const-violations/flow-declar/input.js +++ b/packages/babel-plugin-transform-block-scoping/test/fixtures/const-violations/flow-declar/input.js @@ -1,2 +1,2 @@ declare class foo {} -const foo = 1; +const foo1 = 1; diff --git a/packages/babel-plugin-transform-block-scoping/test/fixtures/const-violations/flow-declar/output.js b/packages/babel-plugin-transform-block-scoping/test/fixtures/const-violations/flow-declar/output.js index 9375fc4abd22..0332cc0604b1 100644 --- a/packages/babel-plugin-transform-block-scoping/test/fixtures/const-violations/flow-declar/output.js +++ b/packages/babel-plugin-transform-block-scoping/test/fixtures/const-violations/flow-declar/output.js @@ -1 +1 @@ -var foo = 1; +var foo1 = 1; diff --git a/packages/babel-plugin-transform-block-scoping/test/fixtures/general/issue-10339/exec.js b/packages/babel-plugin-transform-block-scoping/test/fixtures/general/issue-10339/exec.js new file mode 100644 index 000000000000..9fea95129bb4 --- /dev/null +++ b/packages/babel-plugin-transform-block-scoping/test/fixtures/general/issue-10339/exec.js @@ -0,0 +1,38 @@ +const code = multiline([ + "for (const {foo, ...bar} of { bar: [] }) {", + "() => foo;", + "const [qux] = bar;", + "try {} catch (e) {", + "let quux = qux;", + "}", + "}" +]); + +let programPath; +let forOfPath; +let functionPath; + +transform(code, { + configFile: false, + plugins: [ + "../../../../lib", + { + post({ path }) { + programPath = path; + path.traverse({ + ForOfStatement(path) { forOfPath = path }, + FunctionExpression(path) { functionPath = path } + }); + } + } + ] +}); + +expect(Object.keys(programPath.scope.bindings)).toEqual(["foo", "bar"]); + +// for declarations should be transformed to for bindings +expect(forOfPath.scope.bindings).toEqual({}); +// The body should be wrapped into closure +expect(forOfPath.get("body").scope.bindings).toEqual({}); + +expect(Object.keys(functionPath.scope.bindings)).toEqual(["foo", "bar", "qux", "quux"]); diff --git a/packages/babel-plugin-transform-block-scoping/test/fixtures/general/issue-10339/input.js b/packages/babel-plugin-transform-block-scoping/test/fixtures/general/issue-10339/input.js new file mode 100644 index 000000000000..dcca3b6e2d97 --- /dev/null +++ b/packages/babel-plugin-transform-block-scoping/test/fixtures/general/issue-10339/input.js @@ -0,0 +1,7 @@ +for (const {foo, ...bar} of {}) { + () => foo; + const [qux] = bar; + try {} catch (e) { + const quux = qux; + } +} diff --git a/packages/babel-plugin-transform-block-scoping/test/fixtures/general/issue-10339/options.json b/packages/babel-plugin-transform-block-scoping/test/fixtures/general/issue-10339/options.json new file mode 100644 index 000000000000..c71915a51cc7 --- /dev/null +++ b/packages/babel-plugin-transform-block-scoping/test/fixtures/general/issue-10339/options.json @@ -0,0 +1,6 @@ +{ + "plugins": [ + "transform-block-scoping", + ["proposal-object-rest-spread", { "loose": true }] + ] +} diff --git a/packages/babel-plugin-transform-block-scoping/test/fixtures/general/issue-10339/output.js b/packages/babel-plugin-transform-block-scoping/test/fixtures/general/issue-10339/output.js new file mode 100644 index 000000000000..b482807df22a --- /dev/null +++ b/packages/babel-plugin-transform-block-scoping/test/fixtures/general/issue-10339/output.js @@ -0,0 +1,20 @@ +function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; } + +var _loop = function (foo, bar) { + () => foo; + + var [qux] = bar; + + try {} catch (e) { + var quux = qux; + } +}; + +for (var _ref of {}) { + var { + foo + } = _ref, + bar = _objectWithoutPropertiesLoose(_ref, ["foo"]); + + _loop(foo, bar); +} diff --git a/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/exported-fn/input.mjs b/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/exported-fn/input.mjs new file mode 100644 index 000000000000..ce79efd8d1e2 --- /dev/null +++ b/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/exported-fn/input.mjs @@ -0,0 +1,14 @@ +import { foo } from "somewhere"; + +// foo might call "bar" +foo(); + +a; + +let a; + +a; + +export function bar() { + return a; +} diff --git a/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/exported-fn/output.mjs b/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/exported-fn/output.mjs new file mode 100644 index 000000000000..b7679ea67438 --- /dev/null +++ b/packages/babel-plugin-transform-block-scoping/test/fixtures/tdz/exported-fn/output.mjs @@ -0,0 +1,10 @@ +var a = babelHelpers.temporalUndefined; +import { foo } from "somewhere"; // foo might call "bar" + +foo(); +babelHelpers.tdz("a"); +a = void 0; +a; +export function bar() { + return babelHelpers.temporalRef(a, "a"); +} diff --git a/packages/babel-plugin-transform-classes/package.json b/packages/babel-plugin-transform-classes/package.json index f1fcc8a2e80b..9cad1612941e 100644 --- a/packages/babel-plugin-transform-classes/package.json +++ b/packages/babel-plugin-transform-classes/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-transform-classes", - "version": "7.5.5", + "version": "7.8.3", "description": "Compile ES2015 classes to ES5", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-classes", "license": "MIT", @@ -9,13 +9,13 @@ }, "main": "lib/index.js", "dependencies": { - "@babel/helper-annotate-as-pure": "^7.0.0", - "@babel/helper-define-map": "^7.5.5", - "@babel/helper-function-name": "^7.1.0", - "@babel/helper-optimise-call-expression": "^7.0.0", - "@babel/helper-plugin-utils": "^7.0.0", - "@babel/helper-replace-supers": "^7.5.5", - "@babel/helper-split-export-declaration": "^7.4.4", + "@babel/helper-annotate-as-pure": "^7.8.3", + "@babel/helper-define-map": "^7.8.3", + "@babel/helper-function-name": "^7.8.3", + "@babel/helper-optimise-call-expression": "^7.8.3", + "@babel/helper-plugin-utils": "^7.8.3", + "@babel/helper-replace-supers": "^7.8.3", + "@babel/helper-split-export-declaration": "^7.8.3", "globals": "^11.1.0" }, "keywords": [ @@ -25,7 +25,7 @@ "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.5.5", - "@babel/helper-plugin-test-runner": "^7.0.0" + "@babel/core": "^7.8.3", + "@babel/helper-plugin-test-runner": "^7.8.3" } } diff --git a/packages/babel-plugin-transform-computed-properties/package.json b/packages/babel-plugin-transform-computed-properties/package.json index c749cfab88d6..43b9f70e6fb1 100644 --- a/packages/babel-plugin-transform-computed-properties/package.json +++ b/packages/babel-plugin-transform-computed-properties/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-transform-computed-properties", - "version": "7.2.0", + "version": "7.8.3", "description": "Compile ES2015 computed properties to ES5", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-computed-properties", "license": "MIT", @@ -12,13 +12,13 @@ "babel-plugin" ], "dependencies": { - "@babel/helper-plugin-utils": "^7.0.0" + "@babel/helper-plugin-utils": "^7.8.3" }, "peerDependencies": { "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.2.0", - "@babel/helper-plugin-test-runner": "^7.0.0" + "@babel/core": "^7.8.3", + "@babel/helper-plugin-test-runner": "^7.8.3" } } diff --git a/packages/babel-plugin-transform-destructuring/package.json b/packages/babel-plugin-transform-destructuring/package.json index fde64105a8bc..b8aab2dc0e57 100644 --- a/packages/babel-plugin-transform-destructuring/package.json +++ b/packages/babel-plugin-transform-destructuring/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-transform-destructuring", - "version": "7.5.0", + "version": "7.8.3", "description": "Compile ES2015 destructuring to ES5", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-destructuring", "license": "MIT", @@ -12,13 +12,13 @@ "babel-plugin" ], "dependencies": { - "@babel/helper-plugin-utils": "^7.0.0" + "@babel/helper-plugin-utils": "^7.8.3" }, "peerDependencies": { "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.4.4", - "@babel/helper-plugin-test-runner": "^7.0.0" + "@babel/core": "^7.8.3", + "@babel/helper-plugin-test-runner": "^7.8.3" } } diff --git a/packages/babel-plugin-transform-destructuring/test/fixtures/destructuring/non-iterable/exec.js b/packages/babel-plugin-transform-destructuring/test/fixtures/destructuring/non-iterable/exec.js new file mode 100644 index 000000000000..83099c46c4f4 --- /dev/null +++ b/packages/babel-plugin-transform-destructuring/test/fixtures/destructuring/non-iterable/exec.js @@ -0,0 +1,9 @@ +expect( + () => { + var [foo, bar] = undefined; + }).toThrow("Invalid attempt to destructure non-iterable instance"); + +expect( + () => { + var foo = [ ...undefined ]; + }).toThrow("Invalid attempt to spread non-iterable instance"); diff --git a/packages/babel-plugin-transform-dotall-regex/.npmignore b/packages/babel-plugin-transform-dotall-regex/.npmignore new file mode 100644 index 000000000000..2b1fceba679b --- /dev/null +++ b/packages/babel-plugin-transform-dotall-regex/.npmignore @@ -0,0 +1,3 @@ +*.log +src +test diff --git a/packages/babel-plugin-transform-dotall-regex/package.json b/packages/babel-plugin-transform-dotall-regex/package.json index 2e36b5923586..ec17bdc61eeb 100644 --- a/packages/babel-plugin-transform-dotall-regex/package.json +++ b/packages/babel-plugin-transform-dotall-regex/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-transform-dotall-regex", - "version": "7.4.4", + "version": "7.8.3", "description": "Compile regular expressions using the `s` (`dotAll`) flag to ES5.", "homepage": "https://babeljs.io/", "license": "MIT", @@ -8,9 +8,6 @@ "access": "public" }, "main": "lib/index.js", - "engines": { - "node": ">=4" - }, "keywords": [ "babel-plugin", "regex", @@ -21,15 +18,14 @@ "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-dotall-regex", "bugs": "https://github.com/babel/babel/issues", "dependencies": { - "@babel/helper-plugin-utils": "^7.0.0", - "@babel/helper-regex": "^7.4.4", - "regexpu-core": "^4.5.4" + "@babel/helper-create-regexp-features-plugin": "^7.8.3", + "@babel/helper-plugin-utils": "^7.8.3" }, "peerDependencies": { "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.4.4", - "@babel/helper-plugin-test-runner": "^7.0.0" + "@babel/core": "^7.8.3", + "@babel/helper-plugin-test-runner": "^7.8.3" } } diff --git a/packages/babel-plugin-transform-dotall-regex/src/index.js b/packages/babel-plugin-transform-dotall-regex/src/index.js index af11660ea05e..a41961076922 100644 --- a/packages/babel-plugin-transform-dotall-regex/src/index.js +++ b/packages/babel-plugin-transform-dotall-regex/src/index.js @@ -1,25 +1,12 @@ +/* eslint-disable @babel/development/plugin-name */ +import { createRegExpFeaturePlugin } from "@babel/helper-create-regexp-features-plugin"; import { declare } from "@babel/helper-plugin-utils"; -import rewritePattern from "regexpu-core"; -import * as regex from "@babel/helper-regex"; export default declare(api => { api.assertVersion(7); - return { + return createRegExpFeaturePlugin({ name: "transform-dotall-regex", - - visitor: { - RegExpLiteral(path) { - const node = path.node; - if (!regex.is(node, "s")) { - return; - } - node.pattern = rewritePattern(node.pattern, node.flags, { - dotAllFlag: true, - useUnicodeFlag: regex.is(node, "u"), - }); - regex.pullFlag(node, "s"); - }, - }, - }; + feature: "dotAllFlag", + }); }); diff --git a/packages/babel-plugin-transform-dotall-regex/test/fixtures/dotall-regex/simple/output.js b/packages/babel-plugin-transform-dotall-regex/test/fixtures/dotall-regex/simple/output.js index dec34325752f..283718ce96ce 100644 --- a/packages/babel-plugin-transform-dotall-regex/test/fixtures/dotall-regex/simple/output.js +++ b/packages/babel-plugin-transform-dotall-regex/test/fixtures/dotall-regex/simple/output.js @@ -1,2 +1,2 @@ var a = /./; -var b = /[\0-\uFFFF]/; +var b = /[\s\S]/; diff --git a/packages/babel-plugin-transform-dotall-regex/test/fixtures/dotall-regex/with-unicode-property-escape/input.js b/packages/babel-plugin-transform-dotall-regex/test/fixtures/dotall-regex/with-unicode-property-escape/input.js new file mode 100644 index 000000000000..dc74dbc0d615 --- /dev/null +++ b/packages/babel-plugin-transform-dotall-regex/test/fixtures/dotall-regex/with-unicode-property-escape/input.js @@ -0,0 +1,2 @@ +var a = /\p{Unified_Ideograph}./u; +var b = /\p{Unified_Ideograph}./su; diff --git a/packages/babel-plugin-transform-dotall-regex/test/fixtures/dotall-regex/with-unicode-property-escape/options.json b/packages/babel-plugin-transform-dotall-regex/test/fixtures/dotall-regex/with-unicode-property-escape/options.json new file mode 100644 index 000000000000..2078653dce15 --- /dev/null +++ b/packages/babel-plugin-transform-dotall-regex/test/fixtures/dotall-regex/with-unicode-property-escape/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["transform-dotall-regex", "proposal-unicode-property-regex"] +} diff --git a/packages/babel-plugin-transform-dotall-regex/test/fixtures/dotall-regex/with-unicode-property-escape/output.js b/packages/babel-plugin-transform-dotall-regex/test/fixtures/dotall-regex/with-unicode-property-escape/output.js new file mode 100644 index 000000000000..a8ddf757d926 --- /dev/null +++ b/packages/babel-plugin-transform-dotall-regex/test/fixtures/dotall-regex/with-unicode-property-escape/output.js @@ -0,0 +1,2 @@ +var a = /[\u3400-\u4DB5\u4E00-\u9FEF\uFA0E\uFA0F\uFA11\uFA13\uFA14\uFA1F\uFA21\uFA23\uFA24\uFA27-\uFA29\u{20000}-\u{2A6D6}\u{2A700}-\u{2B734}\u{2B740}-\u{2B81D}\u{2B820}-\u{2CEA1}\u{2CEB0}-\u{2EBE0}][\0-\t\x0B\f\x0E-\u2027\u202A-\u{10FFFF}]/u; +var b = /[\u3400-\u4DB5\u4E00-\u9FEF\uFA0E\uFA0F\uFA11\uFA13\uFA14\uFA1F\uFA21\uFA23\uFA24\uFA27-\uFA29\u{20000}-\u{2A6D6}\u{2A700}-\u{2B734}\u{2B740}-\u{2B81D}\u{2B820}-\u{2CEA1}\u{2CEB0}-\u{2EBE0}][\0-\u{10FFFF}]/u; diff --git a/packages/babel-plugin-transform-duplicate-keys/package.json b/packages/babel-plugin-transform-duplicate-keys/package.json index e58d6908cf20..74f1fe33ec92 100644 --- a/packages/babel-plugin-transform-duplicate-keys/package.json +++ b/packages/babel-plugin-transform-duplicate-keys/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-transform-duplicate-keys", - "version": "7.5.0", + "version": "7.8.3", "description": "Compile objects with duplicate keys to valid strict ES5", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-duplicate-keys", "license": "MIT", @@ -12,13 +12,13 @@ "babel-plugin" ], "dependencies": { - "@babel/helper-plugin-utils": "^7.0.0" + "@babel/helper-plugin-utils": "^7.8.3" }, "peerDependencies": { "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.5.0", - "@babel/helper-plugin-test-runner": "^7.0.0" + "@babel/core": "^7.8.3", + "@babel/helper-plugin-test-runner": "^7.8.3" } } diff --git a/packages/babel-plugin-transform-exponentiation-operator/package.json b/packages/babel-plugin-transform-exponentiation-operator/package.json index aaf4029930b0..5ade53de54dd 100644 --- a/packages/babel-plugin-transform-exponentiation-operator/package.json +++ b/packages/babel-plugin-transform-exponentiation-operator/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-transform-exponentiation-operator", - "version": "7.2.0", + "version": "7.8.3", "description": "Compile exponentiation operator to ES5", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-exponentiation-operator", "license": "MIT", @@ -12,14 +12,14 @@ "babel-plugin" ], "dependencies": { - "@babel/helper-builder-binary-assignment-operator-visitor": "^7.1.0", - "@babel/helper-plugin-utils": "^7.0.0" + "@babel/helper-builder-binary-assignment-operator-visitor": "^7.8.3", + "@babel/helper-plugin-utils": "^7.8.3" }, "peerDependencies": { "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.2.0", - "@babel/helper-plugin-test-runner": "^7.0.0" + "@babel/core": "^7.8.3", + "@babel/helper-plugin-test-runner": "^7.8.3" } } diff --git a/packages/babel-plugin-transform-flow-comments/package.json b/packages/babel-plugin-transform-flow-comments/package.json index 34123bbcc748..8a83330fd212 100644 --- a/packages/babel-plugin-transform-flow-comments/package.json +++ b/packages/babel-plugin-transform-flow-comments/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-transform-flow-comments", - "version": "7.5.5", + "version": "7.8.3", "description": "Turn flow type annotations into comments", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-flow-comments", "license": "MIT", @@ -12,15 +12,15 @@ "babel-plugin" ], "dependencies": { - "@babel/generator": "^7.5.5", - "@babel/helper-plugin-utils": "^7.0.0", - "@babel/plugin-syntax-flow": "^7.2.0" + "@babel/generator": "^7.8.3", + "@babel/helper-plugin-utils": "^7.8.3", + "@babel/plugin-syntax-flow": "^7.8.3" }, "peerDependencies": { "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.5.5", - "@babel/helper-plugin-test-runner": "^7.0.0" + "@babel/core": "^7.8.3", + "@babel/helper-plugin-test-runner": "^7.8.3" } } diff --git a/packages/babel-plugin-transform-flow-comments/src/index.js b/packages/babel-plugin-transform-flow-comments/src/index.js index 2d54ae9d9854..742db1f0f263 100644 --- a/packages/babel-plugin-transform-flow-comments/src/index.js +++ b/packages/babel-plugin-transform-flow-comments/src/index.js @@ -6,27 +6,73 @@ import generateCode from "@babel/generator"; export default declare(api => { api.assertVersion(7); - function attachComment(path, comment) { - let attach = path.getPrevSibling(); - let where = "trailing"; - if (!attach.node) { - attach = path.parentPath; + function commentFromString(comment) { + return typeof comment === "string" + ? { type: "CommentBlock", value: comment } + : comment; + } + + function attachComment({ + ofPath, + toPath, + where = "trailing", + optional = false, + comments = generateComment(ofPath, optional), + keepType = false, + }) { + if (!toPath || !toPath.node) { + toPath = ofPath.getPrevSibling(); + where = "trailing"; + } + if (!toPath.node) { + toPath = ofPath.getNextSibling(); + where = "leading"; + } + if (!toPath.node) { + toPath = ofPath.parentPath; where = "inner"; } - attach.addComment(where, comment); - path.remove(); + if (!Array.isArray(comments)) { + comments = [comments]; + } + comments = comments.map(commentFromString); + if (!keepType && ofPath && ofPath.node) { + // Removes the node at `ofPath` while conserving the comments attached + // to it. + const node = ofPath.node; + const parent = ofPath.parentPath; + const prev = ofPath.getPrevSibling(); + const next = ofPath.getNextSibling(); + const isSingleChild = !(prev.node || next.node); + const leading = node.leadingComments; + const trailing = node.trailingComments; + + if (isSingleChild && leading) { + parent.addComments("inner", leading); + } + toPath.addComments(where, comments); + ofPath.remove(); + if (isSingleChild && trailing) { + parent.addComments("inner", trailing); + } + } else { + toPath.addComments(where, comments); + } } - function wrapInFlowComment(path, parent) { - attachComment(path, generateComment(path, parent)); + function wrapInFlowComment(path) { + attachComment({ + ofPath: path, + comments: generateComment(path, path.parent.optional), + }); } - function generateComment(path, parent) { + function generateComment(path, optional) { let comment = path .getSource() .replace(/\*-\//g, "*-ESCAPED/") .replace(/\*\//g, "*-/"); - if (parent && parent.optional) comment = "?" + comment; + if (optional) comment = "?" + comment; if (comment[0] !== ":") comment = ":: " + comment; return comment; } @@ -42,28 +88,32 @@ export default declare(api => { visitor: { TypeCastExpression(path) { const { node } = path; - path - .get("expression") - .addComment("trailing", generateComment(path.get("typeAnnotation"))); + attachComment({ + ofPath: path.get("typeAnnotation"), + toPath: path.get("expression"), + keepType: true, + }); path.replaceWith(t.parenthesizedExpression(node.expression)); }, // support function a(b?) {} Identifier(path) { - if (path.parentPath.isFlow()) { - return; - } - + if (path.parentPath.isFlow()) return; const { node } = path; if (node.typeAnnotation) { - const typeAnnotation = path.get("typeAnnotation"); - path.addComment("trailing", generateComment(typeAnnotation, node)); - typeAnnotation.remove(); + attachComment({ + ofPath: path.get("typeAnnotation"), + toPath: path, + optional: node.optional || node.typeAnnotation.optional, + }); if (node.optional) { node.optional = false; } } else if (node.optional) { - path.addComment("trailing", ":: ?"); + attachComment({ + toPath: path, + comments: ":: ?", + }); node.optional = false; } }, @@ -81,58 +131,51 @@ export default declare(api => { Function(path) { if (path.isDeclareFunction()) return; const { node } = path; - if (node.returnType) { - const returnType = path.get("returnType"); - const typeAnnotation = returnType.get("typeAnnotation"); - const block = path.get("body"); - block.addComment( - "leading", - generateComment(returnType, typeAnnotation.node), - ); - returnType.remove(); - } if (node.typeParameters) { - const typeParameters = path.get("typeParameters"); - const id = path.get("id"); - id.addComment( - "trailing", - generateComment(typeParameters, typeParameters.node), - ); - typeParameters.remove(); + attachComment({ + ofPath: path.get("typeParameters"), + toPath: path.get("id"), + optional: node.typeParameters.optional, + }); + } + if (node.returnType) { + attachComment({ + ofPath: path.get("returnType"), + toPath: path.get("body"), + where: "leading", + optional: node.returnType.typeAnnotation.optional, + }); } }, // support for `class X { foo: string }` - #4622 ClassProperty(path) { - const { node, parent } = path; + const { node } = path; if (!node.value) { - wrapInFlowComment(path, parent); + wrapInFlowComment(path); } else if (node.typeAnnotation) { - const typeAnnotation = path.get("typeAnnotation"); - path - .get("key") - .addComment( - "trailing", - generateComment(typeAnnotation, typeAnnotation.node), - ); - typeAnnotation.remove(); + attachComment({ + ofPath: path.get("typeAnnotation"), + toPath: path.get("key"), + optional: node.typeAnnotation.optional, + }); } }, // support `export type a = {}` - #8 Error: You passed path.replaceWith() a falsy node ExportNamedDeclaration(path) { - const { node, parent } = path; + const { node } = path; if (node.exportKind !== "type" && !t.isFlow(node.declaration)) { return; } - wrapInFlowComment(path, parent); + wrapInFlowComment(path); }, // support `import type A` and `import typeof A` #10 ImportDeclaration(path) { - const { node, parent } = path; + const { node } = path; if (isTypeImport(node.importKind)) { - wrapInFlowComment(path, parent); + wrapInFlowComment(path); return; } @@ -148,61 +191,88 @@ export default declare(api => { if (typeSpecifiers.length > 0) { const typeImportNode = t.cloneNode(node); typeImportNode.specifiers = typeSpecifiers; + const comment = `:: ${generateCode(typeImportNode).code}`; if (nonTypeSpecifiers.length > 0) { - path.addComment( - "trailing", - `:: ${generateCode(typeImportNode).code}`, - ); + attachComment({ toPath: path, comments: comment }); } else { - attachComment(path, `:: ${generateCode(typeImportNode).code}`); + attachComment({ ofPath: path, comments: comment }); } } }, ObjectPattern(path) { const { node } = path; if (node.typeAnnotation) { - const typeAnnotation = path.get("typeAnnotation"); - path.addComment( - "trailing", - generateComment(typeAnnotation, typeAnnotation.node), - ); - typeAnnotation.remove(); + attachComment({ + ofPath: path.get("typeAnnotation"), + toPath: path, + optional: node.optional || node.typeAnnotation.optional, + }); } }, Flow(path) { - const { parent } = path; - wrapInFlowComment(path, parent); + wrapInFlowComment(path); }, Class(path) { const { node } = path; - if (node.typeParameters || node.implements) { - const comments = []; - if (node.typeParameters) { - const typeParameters = path.get("typeParameters"); + let comments = []; + if (node.typeParameters) { + const typeParameters = path.get("typeParameters"); + comments.push( + generateComment(typeParameters, node.typeParameters.optional), + ); + const trailingComments = node.typeParameters.trailingComments; + if (trailingComments) { + comments.push(...trailingComments); + } + typeParameters.remove(); + } + + if (node.superClass) { + if (comments.length > 0) { + attachComment({ + toPath: path.get("id"), + comments: comments, + }); + comments = []; + } + + if (node.superTypeParameters) { + const superTypeParameters = path.get("superTypeParameters"); comments.push( - generateComment(typeParameters, typeParameters.node).replace( - /^:: /, - "", + generateComment( + superTypeParameters, + superTypeParameters.node.optional, ), ); - typeParameters.remove(); + superTypeParameters.remove(); } - if (node.implements) { - const impls = path.get("implements"); - comments.push( - "implements " + - impls - .map(impl => generateComment(impl).replace(/^:: /, "")) - .join(", "), - ); - delete node["implements"]; + } + + if (node.implements) { + const impls = path.get("implements"); + const comment = + "implements " + + impls + .map(impl => generateComment(impl).replace(/^:: /, "")) + .join(", "); + delete node["implements"]; + + if (comments.length === 1) { + comments[0] += ` ${comment}`; + } else { + comments.push(`:: ${comment}`); } + } - const block = path.get("body"); - block.addComment("leading", ":: " + comments.join(" ")); + if (comments.length > 0) { + attachComment({ + toPath: path.get("body"), + where: "leading", + comments: comments, + }); } }, }, diff --git a/packages/babel-plugin-transform-flow-comments/test/fixtures/flow-comments/class-extends-type-parameter/input.js b/packages/babel-plugin-transform-flow-comments/test/fixtures/flow-comments/class-extends-type-parameter/input.js new file mode 100644 index 000000000000..c75d5b793b2e --- /dev/null +++ b/packages/babel-plugin-transform-flow-comments/test/fixtures/flow-comments/class-extends-type-parameter/input.js @@ -0,0 +1 @@ +class Foo extends Bar {} diff --git a/packages/babel-plugin-transform-flow-comments/test/fixtures/flow-comments/class-extends-type-parameter/output.js b/packages/babel-plugin-transform-flow-comments/test/fixtures/flow-comments/class-extends-type-parameter/output.js new file mode 100644 index 000000000000..b4f9a9dba49c --- /dev/null +++ b/packages/babel-plugin-transform-flow-comments/test/fixtures/flow-comments/class-extends-type-parameter/output.js @@ -0,0 +1,3 @@ +class Foo extends Bar +/*:: */ +{} diff --git a/packages/babel-plugin-transform-flow-comments/test/fixtures/flow-comments/class-type-parameter-extends-type-parameter/input.js b/packages/babel-plugin-transform-flow-comments/test/fixtures/flow-comments/class-type-parameter-extends-type-parameter/input.js new file mode 100644 index 000000000000..7a7673af94cc --- /dev/null +++ b/packages/babel-plugin-transform-flow-comments/test/fixtures/flow-comments/class-type-parameter-extends-type-parameter/input.js @@ -0,0 +1,3 @@ +class Foo /* inner */ extends Bar {} + +/*a*/class /*b*/Baz/*c*//*d*/extends /*e*/Bar/*f*//*g*/ {/*h*/}/*i*/ diff --git a/packages/babel-plugin-transform-flow-comments/test/fixtures/flow-comments/class-type-parameter-extends-type-parameter/output.js b/packages/babel-plugin-transform-flow-comments/test/fixtures/flow-comments/class-type-parameter-extends-type-parameter/output.js new file mode 100644 index 000000000000..45e9c5e696fa --- /dev/null +++ b/packages/babel-plugin-transform-flow-comments/test/fixtures/flow-comments/class-type-parameter-extends-type-parameter/output.js @@ -0,0 +1,30 @@ +class Foo +/*:: */ + +/* inner */ +extends Bar +/*:: */ +{} +/*a*/ + + +class +/*b*/ +Baz +/*c*/ + +/*:: */ + +/*d*/ +extends +/*e*/ +Bar +/*f*/ + +/*:: */ + +/*g*/ +{} +/*h*/ + +/*i*/ diff --git a/packages/babel-plugin-transform-flow-comments/test/fixtures/flow-comments/class-type-parameter-extends/input.js b/packages/babel-plugin-transform-flow-comments/test/fixtures/flow-comments/class-type-parameter-extends/input.js new file mode 100644 index 000000000000..3fb5906c3afc --- /dev/null +++ b/packages/babel-plugin-transform-flow-comments/test/fixtures/flow-comments/class-type-parameter-extends/input.js @@ -0,0 +1 @@ +class Foo extends Bar {} diff --git a/packages/babel-plugin-transform-flow-comments/test/fixtures/flow-comments/class-type-parameter-extends/output.js b/packages/babel-plugin-transform-flow-comments/test/fixtures/flow-comments/class-type-parameter-extends/output.js new file mode 100644 index 000000000000..47ca6593757d --- /dev/null +++ b/packages/babel-plugin-transform-flow-comments/test/fixtures/flow-comments/class-type-parameter-extends/output.js @@ -0,0 +1,3 @@ +class Foo +/*:: */ +extends Bar {} diff --git a/packages/babel-plugin-transform-flow-comments/test/fixtures/flow-comments/declare-statements/input.js b/packages/babel-plugin-transform-flow-comments/test/fixtures/flow-comments/declare-statements/input.js index 7c2826479454..64db78b233dc 100644 --- a/packages/babel-plugin-transform-flow-comments/test/fixtures/flow-comments/declare-statements/input.js +++ b/packages/babel-plugin-transform-flow-comments/test/fixtures/flow-comments/declare-statements/input.js @@ -4,13 +4,13 @@ declare function foo(): void declare function foo(): void; declare function foo(): void; declare function foo(x: number, y: string): void; -declare class A {} -declare class A extends B { x: number } -declare class A { static foo(): number, static x : string } -declare class A { static [ indexer: number]: string } -declare class A { static () : number } -declare class A mixins B, C {} -declare type A = string +declare class A1 {} +declare class A1 extends B { x: number } +declare class A1 { static foo(): number, static x : string } +declare class A1 { static [ indexer: number]: string } +declare class A1 { static () : number } +declare class A1 mixins B, C {} +declare type A2 = string declare type T = { [k:string]: U } -declare interface I { foo: string } -declare interface I { foo: T } +declare interface I1 { foo: string } +declare interface I2 { foo: T } diff --git a/packages/babel-plugin-transform-flow-comments/test/fixtures/flow-comments/declare-statements/output.js b/packages/babel-plugin-transform-flow-comments/test/fixtures/flow-comments/declare-statements/output.js index 3be48955c146..3feecb2a9347 100644 --- a/packages/babel-plugin-transform-flow-comments/test/fixtures/flow-comments/declare-statements/output.js +++ b/packages/babel-plugin-transform-flow-comments/test/fixtures/flow-comments/declare-statements/output.js @@ -10,22 +10,22 @@ /*:: declare function foo(x: number, y: string): void;*/ -/*:: declare class A {}*/ +/*:: declare class A1 {}*/ -/*:: declare class A extends B { x: number }*/ +/*:: declare class A1 extends B { x: number }*/ -/*:: declare class A { static foo(): number, static x : string }*/ +/*:: declare class A1 { static foo(): number, static x : string }*/ -/*:: declare class A { static [ indexer: number]: string }*/ +/*:: declare class A1 { static [ indexer: number]: string }*/ -/*:: declare class A { static () : number }*/ +/*:: declare class A1 { static () : number }*/ -/*:: declare class A mixins B, C {}*/ +/*:: declare class A1 mixins B, C {}*/ -/*:: declare type A = string*/ +/*:: declare type A2 = string*/ /*:: declare type T = { [k:string]: U }*/ -/*:: declare interface I { foo: string }*/ +/*:: declare interface I1 { foo: string }*/ -/*:: declare interface I { foo: T }*/ +/*:: declare interface I2 { foo: T }*/ diff --git a/packages/babel-plugin-transform-flow-comments/test/fixtures/flow-comments/preserve-comments-order/input.js b/packages/babel-plugin-transform-flow-comments/test/fixtures/flow-comments/preserve-comments-order/input.js new file mode 100644 index 000000000000..e21008c2f7d7 --- /dev/null +++ b/packages/babel-plugin-transform-flow-comments/test/fixtures/flow-comments/preserve-comments-order/input.js @@ -0,0 +1,7 @@ +/*a*/ +type Foo = number; +/*b*/ +var foo; +/*c*/ +type Bar = number; +/*d*/ diff --git a/packages/babel-plugin-transform-flow-comments/test/fixtures/flow-comments/preserve-comments-order/output.js b/packages/babel-plugin-transform-flow-comments/test/fixtures/flow-comments/preserve-comments-order/output.js new file mode 100644 index 000000000000..8365f7d536e2 --- /dev/null +++ b/packages/babel-plugin-transform-flow-comments/test/fixtures/flow-comments/preserve-comments-order/output.js @@ -0,0 +1,11 @@ +/*a*/ + +/*:: type Foo = number;*/ + +/*b*/ +var foo; +/*c*/ + +/*:: type Bar = number;*/ + +/*d*/ diff --git a/packages/babel-plugin-transform-flow-comments/test/fixtures/flow-comments/preserve-comments/input.js b/packages/babel-plugin-transform-flow-comments/test/fixtures/flow-comments/preserve-comments/input.js new file mode 100644 index 000000000000..4de529bb0fda --- /dev/null +++ b/packages/babel-plugin-transform-flow-comments/test/fixtures/flow-comments/preserve-comments/input.js @@ -0,0 +1,2 @@ +/**/ +type Foo = number; diff --git a/packages/babel-plugin-transform-flow-comments/test/fixtures/flow-comments/preserve-comments/output.js b/packages/babel-plugin-transform-flow-comments/test/fixtures/flow-comments/preserve-comments/output.js new file mode 100644 index 000000000000..95b2dd0f9cbf --- /dev/null +++ b/packages/babel-plugin-transform-flow-comments/test/fixtures/flow-comments/preserve-comments/output.js @@ -0,0 +1,3 @@ +/**/ + +/*:: type Foo = number;*/ diff --git a/packages/babel-plugin-transform-flow-strip-types/package.json b/packages/babel-plugin-transform-flow-strip-types/package.json index c484570c331d..844670d49835 100644 --- a/packages/babel-plugin-transform-flow-strip-types/package.json +++ b/packages/babel-plugin-transform-flow-strip-types/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-transform-flow-strip-types", - "version": "7.4.4", + "version": "7.8.3", "description": "Strip flow type annotations from your output code.", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-flow-strip-types", "license": "MIT", @@ -12,14 +12,14 @@ "babel-plugin" ], "dependencies": { - "@babel/helper-plugin-utils": "^7.0.0", - "@babel/plugin-syntax-flow": "^7.2.0" + "@babel/helper-plugin-utils": "^7.8.3", + "@babel/plugin-syntax-flow": "^7.8.3" }, "peerDependencies": { "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.4.4", - "@babel/helper-plugin-test-runner": "^7.0.0" + "@babel/core": "^7.8.3", + "@babel/helper-plugin-test-runner": "^7.8.3" } } diff --git a/packages/babel-plugin-transform-flow-strip-types/test/fixtures/strip-types/def-site-variance/input.js b/packages/babel-plugin-transform-flow-strip-types/test/fixtures/strip-types/def-site-variance/input.js index eb188c5c908a..9cc374a5d523 100644 --- a/packages/babel-plugin-transform-flow-strip-types/test/fixtures/strip-types/def-site-variance/input.js +++ b/packages/babel-plugin-transform-flow-strip-types/test/fixtures/strip-types/def-site-variance/input.js @@ -5,10 +5,10 @@ type T1 = { +p: T } type T2 = { -p: T } type T3 = { +[k:K]: V } type T4 = { -[k:K]: V } -interface I { +p: T } -interface I { -p: T } -interface I { +[k:K]: V } -interface I { -[k:K]: V } +interface I1 { +p: T } +interface I2 { -p: T } +interface I3 { +[k:K]: V } +interface I4 { -[k:K]: V } declare class I { +p: T } declare class I { -p: T } declare class I { +[k:K]: V } diff --git a/packages/babel-plugin-transform-flow-strip-types/test/fixtures/strip-types/strip-declare-statements/input.js b/packages/babel-plugin-transform-flow-strip-types/test/fixtures/strip-types/strip-declare-statements/input.js index 75b24828392c..10cce21e41f8 100644 --- a/packages/babel-plugin-transform-flow-strip-types/test/fixtures/strip-types/strip-declare-statements/input.js +++ b/packages/babel-plugin-transform-flow-strip-types/test/fixtures/strip-types/strip-declare-statements/input.js @@ -4,14 +4,14 @@ declare function foo(): void declare function foo(): void; declare function foo(): void; declare function foo(x: number, y: string): void; -declare class A {} -declare class A extends B { x: number } -declare class A { static foo(): number; static x : string } -declare class A { static [ indexer: number]: string } -declare class A { static () : number } -declare class A mixins B, C {} -declare type A = string +declare class A1 {} +declare class A1 extends B { x: number } +declare class A1 { static foo(): number; static x : string } +declare class A1 { static [ indexer: number]: string } +declare class A1 { static () : number } +declare class A1 mixins B, C {} +declare type A2 = string declare type T = { [k:string]: U } -declare interface I { foo: string } -declare interface I { foo: T } +declare interface I1 { foo: string } +declare interface I2 { foo: T } declare module.exports: string; diff --git a/packages/babel-plugin-transform-flow-strip-types/test/fixtures/strip-types/strip-interfaces-module-and-script/input.js b/packages/babel-plugin-transform-flow-strip-types/test/fixtures/strip-types/strip-interfaces-module-and-script/input.js index 2e37dfaf618d..1ee5de6c9ea3 100644 --- a/packages/babel-plugin-transform-flow-strip-types/test/fixtures/strip-types/strip-interfaces-module-and-script/input.js +++ b/packages/babel-plugin-transform-flow-strip-types/test/fixtures/strip-types/strip-interfaces-module-and-script/input.js @@ -1,7 +1,7 @@ -interface A {} -interface A extends B {} -interface A extends B, C {} -interface A { foo: () => number; } +interface A1 {} +interface A2 extends B {} +interface A3 extends B, C {} +interface A4 { foo: () => number; } interface Dictionary { [index: string]: string; length: number; } class Foo implements Bar {} class Foo2 extends Bar implements Bat, Man {} diff --git a/packages/babel-plugin-transform-flow-strip-types/test/fixtures/strip-types/strip-iterator/input.js b/packages/babel-plugin-transform-flow-strip-types/test/fixtures/strip-types/strip-iterator/input.js index 741c23987d23..7a1d4011b35a 100644 --- a/packages/babel-plugin-transform-flow-strip-types/test/fixtures/strip-types/strip-iterator/input.js +++ b/packages/babel-plugin-transform-flow-strip-types/test/fixtures/strip-types/strip-iterator/input.js @@ -6,10 +6,10 @@ declare class A { @@asyncIterator(): Iterator; } -interface A { +interface A1 { @@iterator(): Iterator; } -interface A { +interface A2 { @@asyncIterator(): Iterator; } diff --git a/packages/babel-plugin-transform-flow-strip-types/test/fixtures/strip-types/strip-typeapp-call/options.json b/packages/babel-plugin-transform-flow-strip-types/test/fixtures/strip-types/strip-typeapp-call/options.json index 81c1ea3a2294..1eca5cfc9f6b 100644 --- a/packages/babel-plugin-transform-flow-strip-types/test/fixtures/strip-types/strip-typeapp-call/options.json +++ b/packages/babel-plugin-transform-flow-strip-types/test/fixtures/strip-types/strip-typeapp-call/options.json @@ -1,7 +1,6 @@ { "plugins": [ "syntax-jsx", - "syntax-optional-chaining", "transform-flow-strip-types" ] } diff --git a/packages/babel-plugin-transform-for-of/package.json b/packages/babel-plugin-transform-for-of/package.json index 66d3aa78455d..fe308bed4302 100644 --- a/packages/babel-plugin-transform-for-of/package.json +++ b/packages/babel-plugin-transform-for-of/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-transform-for-of", - "version": "7.4.4", + "version": "7.8.3", "description": "Compile ES2015 for...of to ES5", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-for-of", "license": "MIT", @@ -12,13 +12,13 @@ "babel-plugin" ], "dependencies": { - "@babel/helper-plugin-utils": "^7.0.0" + "@babel/helper-plugin-utils": "^7.8.3" }, "peerDependencies": { "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.4.4", - "@babel/helper-plugin-test-runner": "^7.0.0" + "@babel/core": "^7.8.3", + "@babel/helper-plugin-test-runner": "^7.8.3" } } diff --git a/packages/babel-plugin-transform-function-name/package.json b/packages/babel-plugin-transform-function-name/package.json index 2a03ae1b21ac..913d13885fc1 100644 --- a/packages/babel-plugin-transform-function-name/package.json +++ b/packages/babel-plugin-transform-function-name/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-transform-function-name", - "version": "7.4.4", + "version": "7.8.3", "description": "Apply ES2015 function.name semantics to all functions", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-function-name", "license": "MIT", @@ -12,14 +12,14 @@ "babel-plugin" ], "dependencies": { - "@babel/helper-function-name": "^7.1.0", - "@babel/helper-plugin-utils": "^7.0.0" + "@babel/helper-function-name": "^7.8.3", + "@babel/helper-plugin-utils": "^7.8.3" }, "peerDependencies": { "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.4.4", - "@babel/helper-plugin-test-runner": "^7.0.0" + "@babel/core": "^7.8.3", + "@babel/helper-plugin-test-runner": "^7.8.3" } } diff --git a/packages/babel-plugin-transform-function-name/test/fixtures/function-name/export-default-arrow-renaming-module-umd/output.js b/packages/babel-plugin-transform-function-name/test/fixtures/function-name/export-default-arrow-renaming-module-umd/output.js index 318c2544cd52..cd8510701baf 100644 --- a/packages/babel-plugin-transform-function-name/test/fixtures/function-name/export-default-arrow-renaming-module-umd/output.js +++ b/packages/babel-plugin-transform-function-name/test/fixtures/function-name/export-default-arrow-renaming-module-umd/output.js @@ -10,7 +10,7 @@ factory(mod.exports); global.input = mod.exports; } -})(this, function (_exports) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports) { "use strict"; Object.defineProperty(_exports, "__esModule", { diff --git a/packages/babel-plugin-transform-instanceof/package.json b/packages/babel-plugin-transform-instanceof/package.json index 323984f68c50..9bd553ed59e0 100644 --- a/packages/babel-plugin-transform-instanceof/package.json +++ b/packages/babel-plugin-transform-instanceof/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-transform-instanceof", - "version": "7.5.5", + "version": "7.8.3", "description": "This plugin transforms all the ES2015 'instanceof' methods", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-instanceof", "license": "MIT", @@ -12,13 +12,13 @@ "babel-plugin" ], "dependencies": { - "@babel/helper-plugin-utils": "^7.0.0" + "@babel/helper-plugin-utils": "^7.8.3" }, "peerDependencies": { "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.5.5", - "@babel/helper-plugin-test-runner": "^7.0.0" + "@babel/core": "^7.8.3", + "@babel/helper-plugin-test-runner": "^7.8.3" } } diff --git a/packages/babel-plugin-transform-jscript/package.json b/packages/babel-plugin-transform-jscript/package.json index 81bbf34e52c0..bc9ab280489e 100644 --- a/packages/babel-plugin-transform-jscript/package.json +++ b/packages/babel-plugin-transform-jscript/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-transform-jscript", - "version": "7.2.0", + "version": "7.8.3", "description": "Babel plugin to fix buggy JScript named function expressions", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-jscript", "license": "MIT", @@ -12,13 +12,13 @@ "babel-plugin" ], "dependencies": { - "@babel/helper-plugin-utils": "^7.0.0" + "@babel/helper-plugin-utils": "^7.8.3" }, "peerDependencies": { "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.2.0", - "@babel/helper-plugin-test-runner": "^7.0.0" + "@babel/core": "^7.8.3", + "@babel/helper-plugin-test-runner": "^7.8.3" } } diff --git a/packages/babel-plugin-transform-literals/README.md b/packages/babel-plugin-transform-literals/README.md index a226d23421d3..0f9723063c63 100644 --- a/packages/babel-plugin-transform-literals/README.md +++ b/packages/babel-plugin-transform-literals/README.md @@ -1,6 +1,6 @@ # @babel/plugin-transform-literals -> Compile ES2015 unicode string and number literals to ES5 +> Compile ES2015 Unicode string and number literals to ES5 See our website [@babel/plugin-transform-literals](https://babeljs.io/docs/en/next/babel-plugin-transform-literals.html) for more information. diff --git a/packages/babel-plugin-transform-literals/package.json b/packages/babel-plugin-transform-literals/package.json index 5f171fa2f0e8..c19719cc927d 100644 --- a/packages/babel-plugin-transform-literals/package.json +++ b/packages/babel-plugin-transform-literals/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-transform-literals", - "version": "7.2.0", + "version": "7.8.3", "description": "Compile ES2015 unicode string and number literals to ES5", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-literals", "license": "MIT", @@ -12,13 +12,13 @@ "babel-plugin" ], "dependencies": { - "@babel/helper-plugin-utils": "^7.0.0" + "@babel/helper-plugin-utils": "^7.8.3" }, "peerDependencies": { "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.2.0", - "@babel/helper-plugin-test-runner": "^7.0.0" + "@babel/core": "^7.8.3", + "@babel/helper-plugin-test-runner": "^7.8.3" } } diff --git a/packages/babel-plugin-transform-member-expression-literals/package.json b/packages/babel-plugin-transform-member-expression-literals/package.json index 58e267904e81..9d849a51b3e8 100644 --- a/packages/babel-plugin-transform-member-expression-literals/package.json +++ b/packages/babel-plugin-transform-member-expression-literals/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-transform-member-expression-literals", - "version": "7.2.0", + "version": "7.8.3", "description": "Ensure that reserved words are quoted in property accesses", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-member-expression-literals", "license": "MIT", @@ -12,13 +12,13 @@ "babel-plugin" ], "dependencies": { - "@babel/helper-plugin-utils": "^7.0.0" + "@babel/helper-plugin-utils": "^7.8.3" }, "peerDependencies": { "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.2.0", - "@babel/helper-plugin-test-runner": "^7.0.0" + "@babel/core": "^7.8.3", + "@babel/helper-plugin-test-runner": "^7.8.3" } } diff --git a/packages/babel-plugin-transform-modules-amd/package.json b/packages/babel-plugin-transform-modules-amd/package.json index fd87e33c074a..51a608cf05c8 100644 --- a/packages/babel-plugin-transform-modules-amd/package.json +++ b/packages/babel-plugin-transform-modules-amd/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-transform-modules-amd", - "version": "7.5.0", + "version": "7.8.3", "description": "This plugin transforms ES2015 modules to AMD", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-modules-amd", "license": "MIT", @@ -9,8 +9,8 @@ }, "main": "lib/index.js", "dependencies": { - "@babel/helper-module-transforms": "^7.1.0", - "@babel/helper-plugin-utils": "^7.0.0", + "@babel/helper-module-transforms": "^7.8.3", + "@babel/helper-plugin-utils": "^7.8.3", "babel-plugin-dynamic-import-node": "^2.3.0" }, "keywords": [ @@ -20,7 +20,7 @@ "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.5.0", - "@babel/helper-plugin-test-runner": "^7.0.0" + "@babel/core": "^7.8.3", + "@babel/helper-plugin-test-runner": "^7.8.3" } } diff --git a/packages/babel-plugin-transform-modules-amd/test/fixtures/regression/9346/input.mjs b/packages/babel-plugin-transform-modules-amd/test/fixtures/regression/9346/input.mjs new file mode 100644 index 000000000000..a662778eac25 --- /dev/null +++ b/packages/babel-plugin-transform-modules-amd/test/fixtures/regression/9346/input.mjs @@ -0,0 +1,4 @@ +export function bug() {} +{ + let bug = 2; +} diff --git a/packages/babel-plugin-transform-modules-amd/test/fixtures/regression/9346/options.json b/packages/babel-plugin-transform-modules-amd/test/fixtures/regression/9346/options.json new file mode 100644 index 000000000000..8cbc099aab70 --- /dev/null +++ b/packages/babel-plugin-transform-modules-amd/test/fixtures/regression/9346/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["transform-modules-amd"] +} diff --git a/packages/babel-plugin-transform-modules-amd/test/fixtures/regression/9346/output.js b/packages/babel-plugin-transform-modules-amd/test/fixtures/regression/9346/output.js new file mode 100644 index 000000000000..f76724189f9f --- /dev/null +++ b/packages/babel-plugin-transform-modules-amd/test/fixtures/regression/9346/output.js @@ -0,0 +1,14 @@ +define(["exports"], function (_exports) { + "use strict"; + + Object.defineProperty(_exports, "__esModule", { + value: true + }); + _exports.bug = bug; + + function bug() {} + + { + let bug = 2; + } +}); diff --git a/packages/babel-plugin-transform-modules-commonjs/package.json b/packages/babel-plugin-transform-modules-commonjs/package.json index 00a0df0c6201..3971baf019c9 100644 --- a/packages/babel-plugin-transform-modules-commonjs/package.json +++ b/packages/babel-plugin-transform-modules-commonjs/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-transform-modules-commonjs", - "version": "7.5.0", + "version": "7.8.3", "description": "This plugin transforms ES2015 modules to CommonJS", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-modules-commonjs", "license": "MIT", @@ -9,9 +9,9 @@ }, "main": "lib/index.js", "dependencies": { - "@babel/helper-module-transforms": "^7.4.4", - "@babel/helper-plugin-utils": "^7.0.0", - "@babel/helper-simple-access": "^7.1.0", + "@babel/helper-module-transforms": "^7.8.3", + "@babel/helper-plugin-utils": "^7.8.3", + "@babel/helper-simple-access": "^7.8.3", "babel-plugin-dynamic-import-node": "^2.3.0" }, "keywords": [ @@ -21,8 +21,8 @@ "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.5.0", - "@babel/helper-plugin-test-runner": "^7.0.0", - "@babel/plugin-syntax-object-rest-spread": "^7.2.0" + "@babel/core": "^7.8.3", + "@babel/helper-plugin-test-runner": "^7.8.3", + "@babel/plugin-syntax-object-rest-spread": "^7.8.0" } } diff --git a/packages/babel-plugin-transform-modules-commonjs/test/fixtures/class-properties/options.json b/packages/babel-plugin-transform-modules-commonjs/test/fixtures/class-properties/options.json index cfb4f002f46a..4aaaa6971f9e 100644 --- a/packages/babel-plugin-transform-modules-commonjs/test/fixtures/class-properties/options.json +++ b/packages/babel-plugin-transform-modules-commonjs/test/fixtures/class-properties/options.json @@ -1,6 +1,10 @@ { "parserOpts": { - "plugins": ["classProperties", "classPrivateProperties", "classPrivateMethods"] + "plugins": [ + "classProperties", + "classPrivateProperties", + "classPrivateMethods" + ] }, "plugins": ["transform-modules-commonjs"] } diff --git a/packages/babel-plugin-transform-modules-commonjs/test/fixtures/misc/copy-getters-setters-star/output.js b/packages/babel-plugin-transform-modules-commonjs/test/fixtures/misc/copy-getters-setters-star/output.js index 71696cd623e0..015566b41f7a 100644 --- a/packages/babel-plugin-transform-modules-commonjs/test/fixtures/misc/copy-getters-setters-star/output.js +++ b/packages/babel-plugin-transform-modules-commonjs/test/fixtures/misc/copy-getters-setters-star/output.js @@ -9,4 +9,6 @@ var foo = _interopRequireWildcard(require("./moduleWithGetter")); exports.foo = foo; -function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } } +function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; } + +function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } diff --git a/packages/babel-plugin-transform-modules-commonjs/test/fixtures/misc/import-shadowed-assign/input.mjs b/packages/babel-plugin-transform-modules-commonjs/test/fixtures/misc/import-shadowed-assign/input.mjs new file mode 100644 index 000000000000..0ba3bfe4e6bc --- /dev/null +++ b/packages/babel-plugin-transform-modules-commonjs/test/fixtures/misc/import-shadowed-assign/input.mjs @@ -0,0 +1,12 @@ +import { foo } from "x"; + +function f(foo) { + foo = 2; + [foo] = []; + ({ foo } = {}); +} + + +foo = 2; +[foo] = []; +({ foo } = {}); diff --git a/packages/babel-plugin-transform-modules-commonjs/test/fixtures/misc/import-shadowed-assign/output.js b/packages/babel-plugin-transform-modules-commonjs/test/fixtures/misc/import-shadowed-assign/output.js new file mode 100644 index 000000000000..d78aaf7826e6 --- /dev/null +++ b/packages/babel-plugin-transform-modules-commonjs/test/fixtures/misc/import-shadowed-assign/output.js @@ -0,0 +1,23 @@ +"use strict"; + +var _x = require("x"); + +function f(foo) { + foo = 2; + [foo] = []; + ({ + foo + } = {}); +} + +_x.foo = (2, function () { + throw new Error('"' + "foo" + '" is read-only.'); +}()); +[foo] = ([], function () { + throw new Error('"' + "foo" + '" is read-only.'); +}()); +({ + foo +} = ({}, function () { + throw new Error('"' + "foo" + '" is read-only.'); +}())); diff --git a/packages/babel-plugin-transform-modules-commonjs/test/fixtures/regression/T7199/output.js b/packages/babel-plugin-transform-modules-commonjs/test/fixtures/regression/T7199/output.js index 563d49889bff..cbe323d57d81 100644 --- a/packages/babel-plugin-transform-modules-commonjs/test/fixtures/regression/T7199/output.js +++ b/packages/babel-plugin-transform-modules-commonjs/test/fixtures/regression/T7199/output.js @@ -8,7 +8,7 @@ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArra function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } -function _iterableToArrayLimit(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } +function _iterableToArrayLimit(arr, i) { if (!(Symbol.iterator in Object(arr) || Object.prototype.toString.call(arr) === "[object Arguments]")) { return; } var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } diff --git a/packages/babel-plugin-transform-modules-commonjs/test/fixtures/strict/import/input.mjs b/packages/babel-plugin-transform-modules-commonjs/test/fixtures/strict/import/input.mjs index 5b84f44e6659..0195246aa49c 100644 --- a/packages/babel-plugin-transform-modules-commonjs/test/fixtures/strict/import/input.mjs +++ b/packages/babel-plugin-transform-modules-commonjs/test/fixtures/strict/import/input.mjs @@ -7,3 +7,5 @@ foo; foo2; foo3; foo3(); +foo3``; +foo3?.(); diff --git a/packages/babel-plugin-transform-modules-commonjs/test/fixtures/strict/import/output.js b/packages/babel-plugin-transform-modules-commonjs/test/fixtures/strict/import/output.js index 1c2bc5f8e059..445e5f55895c 100644 --- a/packages/babel-plugin-transform-modules-commonjs/test/fixtures/strict/import/output.js +++ b/packages/babel-plugin-transform-modules-commonjs/test/fixtures/strict/import/output.js @@ -5,3 +5,5 @@ foo4.default; foo4.default; foo4.foo3; (0, foo4.foo3)(); +(0, foo4.foo3)``; +(0, foo4.foo3)?.(); diff --git a/packages/babel-plugin-transform-modules-commonjs/test/fixtures/strict/options.json b/packages/babel-plugin-transform-modules-commonjs/test/fixtures/strict/options.json index caedc022efa4..3e4f571b01d8 100644 --- a/packages/babel-plugin-transform-modules-commonjs/test/fixtures/strict/options.json +++ b/packages/babel-plugin-transform-modules-commonjs/test/fixtures/strict/options.json @@ -1,7 +1,6 @@ { "plugins": [ "external-helpers", - "syntax-object-rest-spread", [ "transform-modules-commonjs", { "strict": true, "mjsStrictNamespace": false } diff --git a/packages/babel-plugin-transform-modules-systemjs/package.json b/packages/babel-plugin-transform-modules-systemjs/package.json index d827ae959527..ded5a23720f8 100644 --- a/packages/babel-plugin-transform-modules-systemjs/package.json +++ b/packages/babel-plugin-transform-modules-systemjs/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-transform-modules-systemjs", - "version": "7.5.0", + "version": "7.8.3", "description": "This plugin transforms ES2015 modules to SystemJS", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-modules-systemjs", "license": "MIT", @@ -9,8 +9,9 @@ }, "main": "lib/index.js", "dependencies": { - "@babel/helper-hoist-variables": "^7.4.4", - "@babel/helper-plugin-utils": "^7.0.0", + "@babel/helper-hoist-variables": "^7.8.3", + "@babel/helper-module-transforms": "^7.8.3", + "@babel/helper-plugin-utils": "^7.8.3", "babel-plugin-dynamic-import-node": "^2.3.0" }, "keywords": [ @@ -20,8 +21,8 @@ "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.5.0", - "@babel/helper-plugin-test-runner": "^7.0.0", - "@babel/plugin-syntax-dynamic-import": "^7.2.0" + "@babel/core": "^7.8.3", + "@babel/helper-plugin-test-runner": "^7.8.3", + "@babel/plugin-syntax-dynamic-import": "^7.8.0" } } diff --git a/packages/babel-plugin-transform-modules-systemjs/src/index.js b/packages/babel-plugin-transform-modules-systemjs/src/index.js index 779b76170cdc..fa322f434cc2 100644 --- a/packages/babel-plugin-transform-modules-systemjs/src/index.js +++ b/packages/babel-plugin-transform-modules-systemjs/src/index.js @@ -2,6 +2,7 @@ import { declare } from "@babel/helper-plugin-utils"; import hoistVariables from "@babel/helper-hoist-variables"; import { template, types as t } from "@babel/core"; import { getImportSource } from "babel-plugin-dynamic-import-node/utils"; +import { rewriteThis } from "@babel/helper-module-transforms"; const buildTemplate = template(` SYSTEM_REGISTER(MODULE_NAME, SOURCES, function (EXPORT_IDENTIFIER, CONTEXT_IDENTIFIER) { @@ -106,7 +107,7 @@ function constructExportCall( export default declare((api, options) => { api.assertVersion(7); - const { systemGlobal = "System" } = options; + const { systemGlobal = "System", allowTopLevelThis = false } = options; const IGNORE_REASSIGNMENT_SYMBOL = Symbol(); const reassignmentVisitor = { @@ -227,6 +228,9 @@ export default declare((api, options) => { Program: { enter(path, state) { state.contextIdent = path.scope.generateUid("context"); + if (!allowTopLevelThis) { + rewriteThis(path); + } }, exit(path, state) { const undefinedIdent = path.scope.buildUndefinedNode(); @@ -413,6 +417,8 @@ export default declare((api, options) => { path.replaceWithMultiple(nodes); } + } else { + path.remove(); } } } diff --git a/packages/babel-plugin-transform-modules-systemjs/test/fixtures/allow-top-level-this/false/input.mjs b/packages/babel-plugin-transform-modules-systemjs/test/fixtures/allow-top-level-this/false/input.mjs new file mode 100644 index 000000000000..91f171590120 --- /dev/null +++ b/packages/babel-plugin-transform-modules-systemjs/test/fixtures/allow-top-level-this/false/input.mjs @@ -0,0 +1 @@ +export var v = this; diff --git a/packages/babel-plugin-transform-modules-systemjs/test/fixtures/allow-top-level-this/false/options.json b/packages/babel-plugin-transform-modules-systemjs/test/fixtures/allow-top-level-this/false/options.json new file mode 100644 index 000000000000..51c1aaefdc1d --- /dev/null +++ b/packages/babel-plugin-transform-modules-systemjs/test/fixtures/allow-top-level-this/false/options.json @@ -0,0 +1,7 @@ +{ + "plugins": [ + ["transform-modules-systemjs", { + "allowTopLevelThis": false + }] + ] +} diff --git a/packages/babel-plugin-transform-modules-systemjs/test/fixtures/allow-top-level-this/false/output.mjs b/packages/babel-plugin-transform-modules-systemjs/test/fixtures/allow-top-level-this/false/output.mjs new file mode 100644 index 000000000000..de6449909d41 --- /dev/null +++ b/packages/babel-plugin-transform-modules-systemjs/test/fixtures/allow-top-level-this/false/output.mjs @@ -0,0 +1,11 @@ +System.register([], function (_export, _context) { + "use strict"; + + var v; + return { + setters: [], + execute: function () { + _export("v", v = void 0); + } + }; +}); diff --git a/packages/babel-plugin-transform-modules-systemjs/test/fixtures/allow-top-level-this/true/input.mjs b/packages/babel-plugin-transform-modules-systemjs/test/fixtures/allow-top-level-this/true/input.mjs new file mode 100644 index 000000000000..91f171590120 --- /dev/null +++ b/packages/babel-plugin-transform-modules-systemjs/test/fixtures/allow-top-level-this/true/input.mjs @@ -0,0 +1 @@ +export var v = this; diff --git a/packages/babel-plugin-transform-modules-systemjs/test/fixtures/allow-top-level-this/true/options.json b/packages/babel-plugin-transform-modules-systemjs/test/fixtures/allow-top-level-this/true/options.json new file mode 100644 index 000000000000..066522d40d09 --- /dev/null +++ b/packages/babel-plugin-transform-modules-systemjs/test/fixtures/allow-top-level-this/true/options.json @@ -0,0 +1,7 @@ +{ + "plugins": [ + ["transform-modules-systemjs", { + "allowTopLevelThis": true + }] + ] +} diff --git a/packages/babel-plugin-transform-modules-systemjs/test/fixtures/allow-top-level-this/true/output.mjs b/packages/babel-plugin-transform-modules-systemjs/test/fixtures/allow-top-level-this/true/output.mjs new file mode 100644 index 000000000000..032cb659bdc2 --- /dev/null +++ b/packages/babel-plugin-transform-modules-systemjs/test/fixtures/allow-top-level-this/true/output.mjs @@ -0,0 +1,11 @@ +System.register([], function (_export, _context) { + "use strict"; + + var v; + return { + setters: [], + execute: function () { + _export("v", v = this); + } + }; +}); diff --git a/packages/babel-plugin-transform-modules-systemjs/test/fixtures/import-meta/options.json b/packages/babel-plugin-transform-modules-systemjs/test/fixtures/import-meta/options.json index 7513a834e42e..cb038f2e52c5 100644 --- a/packages/babel-plugin-transform-modules-systemjs/test/fixtures/import-meta/options.json +++ b/packages/babel-plugin-transform-modules-systemjs/test/fixtures/import-meta/options.json @@ -1,7 +1,6 @@ { "plugins": [ "external-helpers", - "syntax-dynamic-import", "syntax-import-meta", "transform-modules-systemjs" ] diff --git a/packages/babel-plugin-transform-modules-systemjs/test/fixtures/systemjs/export-const-destructuring-object-rest/options.json b/packages/babel-plugin-transform-modules-systemjs/test/fixtures/systemjs/export-const-destructuring-object-rest/options.json index 09137adf8d2e..3329c8d9519f 100644 --- a/packages/babel-plugin-transform-modules-systemjs/test/fixtures/systemjs/export-const-destructuring-object-rest/options.json +++ b/packages/babel-plugin-transform-modules-systemjs/test/fixtures/systemjs/export-const-destructuring-object-rest/options.json @@ -1,7 +1,6 @@ { "plugins": [ "external-helpers", - "transform-modules-systemjs", - "syntax-object-rest-spread" + "transform-modules-systemjs" ] } diff --git a/packages/babel-plugin-transform-modules-systemjs/test/fixtures/systemjs/export-named-8/input.mjs b/packages/babel-plugin-transform-modules-systemjs/test/fixtures/systemjs/export-named-8/input.mjs new file mode 100644 index 000000000000..336ce12bb910 --- /dev/null +++ b/packages/babel-plugin-transform-modules-systemjs/test/fixtures/systemjs/export-named-8/input.mjs @@ -0,0 +1 @@ +export {} diff --git a/packages/babel-plugin-transform-modules-systemjs/test/fixtures/systemjs/export-named-8/output.mjs b/packages/babel-plugin-transform-modules-systemjs/test/fixtures/systemjs/export-named-8/output.mjs new file mode 100644 index 000000000000..5ed7cacb99d1 --- /dev/null +++ b/packages/babel-plugin-transform-modules-systemjs/test/fixtures/systemjs/export-named-8/output.mjs @@ -0,0 +1,8 @@ +System.register([], function (_export, _context) { + "use strict"; + + return { + setters: [], + execute: function () {} + }; +}); diff --git a/packages/babel-plugin-transform-modules-umd/package.json b/packages/babel-plugin-transform-modules-umd/package.json index 9dd0f73213e6..3abaeac012c1 100644 --- a/packages/babel-plugin-transform-modules-umd/package.json +++ b/packages/babel-plugin-transform-modules-umd/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-transform-modules-umd", - "version": "7.2.0", + "version": "7.8.3", "description": "This plugin transforms ES2015 modules to UMD", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-modules-umd", "license": "MIT", @@ -9,8 +9,8 @@ }, "main": "lib/index.js", "dependencies": { - "@babel/helper-module-transforms": "^7.1.0", - "@babel/helper-plugin-utils": "^7.0.0" + "@babel/helper-module-transforms": "^7.8.3", + "@babel/helper-plugin-utils": "^7.8.3" }, "keywords": [ "babel-plugin" @@ -19,7 +19,7 @@ "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.2.0", - "@babel/helper-plugin-test-runner": "^7.0.0" + "@babel/core": "^7.8.3", + "@babel/helper-plugin-test-runner": "^7.8.3" } } diff --git a/packages/babel-plugin-transform-modules-umd/src/index.js b/packages/babel-plugin-transform-modules-umd/src/index.js index cd8000febb85..87ab37eff91d 100644 --- a/packages/babel-plugin-transform-modules-umd/src/index.js +++ b/packages/babel-plugin-transform-modules-umd/src/index.js @@ -14,7 +14,9 @@ import { types as t, template } from "@babel/core"; const buildPrerequisiteAssignment = template(` GLOBAL_REFERENCE = GLOBAL_REFERENCE || {} `); - +// Note: we avoid comparing typeof results with "object" or "symbol" otherwise +// they will be processed by `transform-typeof-symbol`, which in return could +// cause typeof helper used before declaration const buildWrapper = template(` (function (global, factory) { if (typeof define === "function" && define.amd) { @@ -27,7 +29,11 @@ const buildWrapper = template(` GLOBAL_TO_ASSIGN; } - })(this, function(IMPORT_NAMES) { + })( + typeof globalThis !== "undefined" ? globalThis + : typeof self !== "undefined" ? self + : this, + function(IMPORT_NAMES) { }) `); diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-default-10/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-default-10/output.js index f8e0cb66efbf..16cf5dab5b0e 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-default-10/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-default-10/output.js @@ -10,7 +10,7 @@ factory(mod.exports); global.input = mod.exports; } -})(this, function (_exports) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports) { "use strict"; _exports.__esModule = true; diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-default-11/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-default-11/output.js index 44e4e41f1697..43f6f4120ba2 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-default-11/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-default-11/output.js @@ -10,7 +10,7 @@ factory(mod.exports); global.input = mod.exports; } -})(this, function (_exports) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports) { "use strict"; _exports.__esModule = true; diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-default-2/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-default-2/output.js index 690c27a48c25..1eb753f05ea7 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-default-2/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-default-2/output.js @@ -10,7 +10,7 @@ factory(mod.exports); global.input = mod.exports; } -})(this, function (_exports) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports) { "use strict"; _exports.__esModule = true; diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-default-3/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-default-3/output.js index 956a4b228e56..8b28dd6ec87b 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-default-3/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-default-3/output.js @@ -10,7 +10,7 @@ factory(mod.exports); global.input = mod.exports; } -})(this, function (_exports) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports) { "use strict"; _exports.__esModule = true; diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-default-4/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-default-4/output.js index dcc999f2fb2b..d1aa080c8110 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-default-4/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-default-4/output.js @@ -10,7 +10,7 @@ factory(mod.exports); global.input = mod.exports; } -})(this, function (_exports) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports) { "use strict"; _exports.__esModule = true; diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-default-5/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-default-5/output.js index 255345ddc41e..50d6e6ae7234 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-default-5/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-default-5/output.js @@ -10,7 +10,7 @@ factory(mod.exports); global.input = mod.exports; } -})(this, function (_exports) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports) { "use strict"; _exports.__esModule = true; diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-default-6/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-default-6/output.js index c10daf42709d..2e9a39834a8f 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-default-6/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-default-6/output.js @@ -10,7 +10,7 @@ factory(mod.exports); global.input = mod.exports; } -})(this, function (_exports) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports) { "use strict"; _exports.__esModule = true; diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-default-7/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-default-7/output.js index 7cfc99ccd16c..99ed0428f6f9 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-default-7/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-default-7/output.js @@ -10,7 +10,7 @@ factory(mod.exports); global.input = mod.exports; } -})(this, function (_exports) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports) { "use strict"; _exports.__esModule = true; diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-default-8/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-default-8/output.js index 605b6c2762f8..50619c0ab739 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-default-8/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-default-8/output.js @@ -10,7 +10,7 @@ factory(mod.exports); global.input = mod.exports; } -})(this, function (_exports) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports) { "use strict"; _exports.__esModule = true; diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-default-9/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-default-9/output.js index 493509da29c4..78580db2a617 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-default-9/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-default-9/output.js @@ -10,7 +10,7 @@ factory(mod.exports); global.input = mod.exports; } -})(this, function (_exports) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports) { "use strict"; _exports.__esModule = true; diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-default/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-default/output.js index 406ad75ef7dc..005e2f9b8237 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-default/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-default/output.js @@ -10,7 +10,7 @@ factory(mod.exports); global.input = mod.exports; } -})(this, function (_exports) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports) { "use strict"; _exports.__esModule = true; diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-from-2/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-from-2/output.js index b03b7b38d0f8..75e19b01ab38 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-from-2/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-from-2/output.js @@ -10,7 +10,7 @@ factory(mod.exports, global.foo); global.input = mod.exports; } -})(this, function (_exports, _foo) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports, _foo) { "use strict"; _exports.__esModule = true; diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-from-3/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-from-3/output.js index 99cc2cff28f4..d6c735f4b8c8 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-from-3/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-from-3/output.js @@ -10,7 +10,7 @@ factory(mod.exports, global.foo); global.input = mod.exports; } -})(this, function (_exports, _foo) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports, _foo) { "use strict"; _exports.__esModule = true; diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-from-4/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-from-4/output.js index 36925b451778..13cd6c56cf1a 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-from-4/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-from-4/output.js @@ -10,7 +10,7 @@ factory(mod.exports, global.foo); global.input = mod.exports; } -})(this, function (_exports, _foo) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports, _foo) { "use strict"; _exports.__esModule = true; diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-from-5/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-from-5/output.js index eaa85ea93a42..db35ffb83d9e 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-from-5/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-from-5/output.js @@ -10,7 +10,7 @@ factory(mod.exports, global.foo); global.input = mod.exports; } -})(this, function (_exports, _foo) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports, _foo) { "use strict"; _exports.__esModule = true; diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-from-6/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-from-6/output.js index b7d54d8219b9..8405ded47ad5 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-from-6/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-from-6/output.js @@ -10,7 +10,7 @@ factory(mod.exports, global.foo); global.input = mod.exports; } -})(this, function (_exports, _foo) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports, _foo) { "use strict"; _exports.__esModule = true; diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-from/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-from/output.js index cde17ba82168..f200b057fbbf 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-from/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-from/output.js @@ -10,7 +10,7 @@ factory(mod.exports, global.foo); global.input = mod.exports; } -})(this, function (_exports, _foo) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports, _foo) { "use strict"; _exports.__esModule = true; diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-named-2/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-named-2/output.js index 493509da29c4..78580db2a617 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-named-2/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-named-2/output.js @@ -10,7 +10,7 @@ factory(mod.exports); global.input = mod.exports; } -})(this, function (_exports) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports) { "use strict"; _exports.__esModule = true; diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-named-3/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-named-3/output.js index c0e16dfcdfd3..4e96e316480b 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-named-3/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-named-3/output.js @@ -10,7 +10,7 @@ factory(mod.exports); global.input = mod.exports; } -})(this, function (_exports) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports) { "use strict"; _exports.__esModule = true; diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-named-4/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-named-4/output.js index b612eb59ae64..e19d1a5d1fc3 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-named-4/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-named-4/output.js @@ -10,7 +10,7 @@ factory(mod.exports); global.input = mod.exports; } -})(this, function (_exports) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports) { "use strict"; _exports.__esModule = true; diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-named-5/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-named-5/output.js index 37b7013b6631..c9353e2a5bd1 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-named-5/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-named-5/output.js @@ -10,7 +10,7 @@ factory(mod.exports); global.input = mod.exports; } -})(this, function (_exports) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports) { "use strict"; _exports.__esModule = true; diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-named/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-named/output.js index e1e04041f87f..23ff6af10e6e 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-named/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-named/output.js @@ -10,7 +10,7 @@ factory(mod.exports); global.input = mod.exports; } -})(this, function (_exports) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports) { "use strict"; _exports.__esModule = true; diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/exports-variable/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/exports-variable/output.js index 5606fe898c1a..d4aeec297660 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/exports-variable/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/exports-variable/output.js @@ -10,7 +10,7 @@ factory(mod.exports); global.input = mod.exports; } -})(this, function (_exports) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports) { "use strict"; _exports.__esModule = true; diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/get-module-name-option/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/get-module-name-option/output.js index d5c94066201a..bbfb355912b8 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/get-module-name-option/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/get-module-name-option/output.js @@ -10,6 +10,6 @@ factory(); global.myCustomModuleName = mod.exports; } -})(this, function () { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function () { "use strict"; }); diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/hoist-function-exports/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/hoist-function-exports/output.js index 87e3e0226890..640ce3bb776c 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/hoist-function-exports/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/hoist-function-exports/output.js @@ -10,7 +10,7 @@ factory(mod.exports, global.evens); global.input = mod.exports; } -})(this, function (_exports, _evens) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports, _evens) { "use strict"; _exports.__esModule = true; diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/imports-default/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/imports-default/output.js index bdc895976fd3..71c3133b263f 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/imports-default/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/imports-default/output.js @@ -10,7 +10,7 @@ factory(global.foo); global.input = mod.exports; } -})(this, function (_foo) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_foo) { "use strict"; _foo = babelHelpers.interopRequireDefault(_foo); diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/imports-exact-globals-false-with-overrides/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/imports-exact-globals-false-with-overrides/output.js index 79531c289ced..c751e3aee868 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/imports-exact-globals-false-with-overrides/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/imports-exact-globals-false-with-overrides/output.js @@ -10,7 +10,7 @@ factory(global.fooBAR, global.fooBAR, global.fizzBuzz); global.input = mod.exports; } -})(this, function (_fooBar, _fooBar2, _fizzbuzz) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_fooBar, _fooBar2, _fizzbuzz) { "use strict"; _fooBar = babelHelpers.interopRequireDefault(_fooBar); diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/imports-exact-globals-false/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/imports-exact-globals-false/output.js index 72d8bf864d29..5229781b738a 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/imports-exact-globals-false/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/imports-exact-globals-false/output.js @@ -10,7 +10,7 @@ factory(global.fooBar, global.fooBar, global.fizzbuzz); global.input = mod.exports; } -})(this, function (_fooBar, _fooBar2, _fizzbuzz) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_fooBar, _fooBar2, _fizzbuzz) { "use strict"; _fooBar = babelHelpers.interopRequireDefault(_fooBar); diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/imports-exact-globals-true-with-overrides/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/imports-exact-globals-true-with-overrides/output.js index bd083836e425..54211b04b3c0 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/imports-exact-globals-true-with-overrides/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/imports-exact-globals-true-with-overrides/output.js @@ -10,7 +10,7 @@ factory(global.fooBAR, global.mylib.fooBar, global.fizz.buzz); global.input = mod.exports; } -})(this, function (_fooBar, _fooBar2, _fizzbuzz) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_fooBar, _fooBar2, _fizzbuzz) { "use strict"; _fooBar = babelHelpers.interopRequireDefault(_fooBar); diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/imports-exact-globals-true/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/imports-exact-globals-true/output.js index c16c74d6d69c..bf4c741e6ce0 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/imports-exact-globals-true/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/imports-exact-globals-true/output.js @@ -10,7 +10,7 @@ factory(global.fooBar, global.mylibFooBar, global.fizzbuzz); global.input = mod.exports; } -})(this, function (_fooBar, _fooBar2, _fizzbuzz) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_fooBar, _fooBar2, _fizzbuzz) { "use strict"; _fooBar = babelHelpers.interopRequireDefault(_fooBar); diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/imports-glob/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/imports-glob/output.js index 3f403ba8ad4a..be83fe78d33c 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/imports-glob/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/imports-glob/output.js @@ -10,7 +10,7 @@ factory(global.foo); global.input = mod.exports; } -})(this, function (foo) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (foo) { "use strict"; foo = babelHelpers.interopRequireWildcard(foo); diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/imports-mixing/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/imports-mixing/output.js index f51c2d99aefa..17bf5e1fac30 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/imports-mixing/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/imports-mixing/output.js @@ -10,7 +10,7 @@ factory(global.foo); global.input = mod.exports; } -})(this, function (_foo) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_foo) { "use strict"; _foo = babelHelpers.interopRequireWildcard(_foo); diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/imports-named/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/imports-named/output.js index d0629b1666d4..d6e7457a2618 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/imports-named/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/imports-named/output.js @@ -10,7 +10,7 @@ factory(global.foo); global.input = mod.exports; } -})(this, function (_foo) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_foo) { "use strict"; _foo.bar; diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/imports/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/imports/output.js index c625f2ad0f13..5d36f0f1abf6 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/imports/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/imports/output.js @@ -10,6 +10,6 @@ factory(global.foo, global.fooBar, global.fooBar); global.input = mod.exports; } -})(this, function (_foo, _fooBar, _fooBar2) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_foo, _fooBar, _fooBar2) { "use strict"; }); diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/module-id-with-overridden-global-in-namespace/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/module-id-with-overridden-global-in-namespace/output.js index b1b88602b1d5..06cb04062449 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/module-id-with-overridden-global-in-namespace/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/module-id-with-overridden-global-in-namespace/output.js @@ -11,7 +11,7 @@ global.foo = global.foo || {}; global.foo.bar = mod.exports; } -})(this, function (_exports) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports) { "use strict"; _exports.__esModule = true; diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/module-id-with-overridden-global-in-very-nested-namespace/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/module-id-with-overridden-global-in-very-nested-namespace/output.js index bcae91ef8031..da053338dc3b 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/module-id-with-overridden-global-in-very-nested-namespace/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/module-id-with-overridden-global-in-very-nested-namespace/output.js @@ -13,7 +13,7 @@ global.foo.bar.baz = global.foo.bar.baz || {}; global.foo.bar.baz.qux = mod.exports; } -})(this, function (_exports) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports) { "use strict"; _exports.__esModule = true; diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/module-id-with-overridden-global/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/module-id-with-overridden-global/output.js index e643ca1729cf..55f97d820fda 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/module-id-with-overridden-global/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/module-id-with-overridden-global/output.js @@ -10,7 +10,7 @@ factory(mod.exports); global.baz = mod.exports; } -})(this, function (_exports) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports) { "use strict"; _exports.__esModule = true; diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/module-id/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/module-id/output.js index 2e8e731219b9..2d9c9cd817c0 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/module-id/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/module-id/output.js @@ -10,7 +10,7 @@ factory(); global.MyLib = mod.exports; } -})(this, function () { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function () { "use strict"; foobar(); diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/module-name-with-overridden-global/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/module-name-with-overridden-global/output.js index 516c1e9a10c0..45d0bcb7c75b 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/module-name-with-overridden-global/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/module-name-with-overridden-global/output.js @@ -10,7 +10,7 @@ factory(mod.exports); global.looseModuleNameWithOverriddenGlobalInput = mod.exports; } -})(this, function (_exports) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports) { "use strict"; _exports.__esModule = true; diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/module-name/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/module-name/output.js index 37b367916622..ec9d725704c7 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/module-name/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/module-name/output.js @@ -10,7 +10,7 @@ factory(); global.looseModuleNameInput = mod.exports; } -})(this, function () { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function () { "use strict"; foobar(); diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/non-default-imports/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/non-default-imports/output.js index a9273b54d4ba..81afa0c2b734 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/non-default-imports/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/non-default-imports/output.js @@ -10,6 +10,6 @@ factory(global.render); global.input = mod.exports; } -})(this, function (_render) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_render) { "use strict"; }); diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/override-export-name/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/override-export-name/output.js index 406ad75ef7dc..005e2f9b8237 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/override-export-name/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/override-export-name/output.js @@ -10,7 +10,7 @@ factory(mod.exports); global.input = mod.exports; } -})(this, function (_exports) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports) { "use strict"; _exports.__esModule = true; diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/override-import-name/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/override-import-name/output.js index 21f8cbe8bd64..9a60cc93eeff 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/override-import-name/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/override-import-name/output.js @@ -10,6 +10,6 @@ factory(global.Promise); global.input = mod.exports; } -})(this, function (_es6Promise) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_es6Promise) { "use strict"; }); diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/overview/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/overview/output.js index b66382de9469..92177358c8c4 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/overview/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/overview/output.js @@ -10,7 +10,7 @@ factory(mod.exports, global.foo, global.fooBar, global.fooBar); global.input = mod.exports; } -})(this, function (_exports, foo2, _fooBar, _fooBar2) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports, foo2, _fooBar, _fooBar2) { "use strict"; _exports.__esModule = true; diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/remap/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/remap/output.js index 32e24f80c89b..03b4c1258a54 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/remap/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/remap/output.js @@ -10,7 +10,7 @@ factory(mod.exports); global.input = mod.exports; } -})(this, function (_exports) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports) { "use strict"; _exports.__esModule = true; diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/regression/4192/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/regression/4192/output.js index 83495f9586e8..78689e28938e 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/regression/4192/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/regression/4192/output.js @@ -10,7 +10,7 @@ factory(mod.exports); global.input = mod.exports; } -})(this, function (_exports) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports) { "use strict"; Object.defineProperty(_exports, "__esModule", { diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-default-10/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-default-10/output.js index b4d81f7d48c9..96660c937784 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-default-10/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-default-10/output.js @@ -10,7 +10,7 @@ factory(mod.exports); global.input = mod.exports; } -})(this, function (_exports) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports) { "use strict"; Object.defineProperty(_exports, "__esModule", { diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-default-11/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-default-11/output.js index 053cce392d75..670be0b97f02 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-default-11/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-default-11/output.js @@ -10,7 +10,7 @@ factory(mod.exports); global.input = mod.exports; } -})(this, function (_exports) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports) { "use strict"; Object.defineProperty(_exports, "__esModule", { diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-default-2/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-default-2/output.js index 91736c0197c2..ec688671cff5 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-default-2/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-default-2/output.js @@ -10,7 +10,7 @@ factory(mod.exports); global.input = mod.exports; } -})(this, function (_exports) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports) { "use strict"; Object.defineProperty(_exports, "__esModule", { diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-default-3/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-default-3/output.js index 3ca1ff7d7423..b982d97d90da 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-default-3/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-default-3/output.js @@ -10,7 +10,7 @@ factory(mod.exports); global.input = mod.exports; } -})(this, function (_exports) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports) { "use strict"; Object.defineProperty(_exports, "__esModule", { diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-default-4/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-default-4/output.js index 006b7c28772a..e5dafcbe9c01 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-default-4/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-default-4/output.js @@ -10,7 +10,7 @@ factory(mod.exports); global.input = mod.exports; } -})(this, function (_exports) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports) { "use strict"; Object.defineProperty(_exports, "__esModule", { diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-default-5/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-default-5/output.js index e9d30703b26f..b57a16c2680f 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-default-5/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-default-5/output.js @@ -10,7 +10,7 @@ factory(mod.exports); global.input = mod.exports; } -})(this, function (_exports) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports) { "use strict"; Object.defineProperty(_exports, "__esModule", { diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-default-6/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-default-6/output.js index 7fdc39f6adf3..b244eea085de 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-default-6/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-default-6/output.js @@ -10,7 +10,7 @@ factory(mod.exports); global.input = mod.exports; } -})(this, function (_exports) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports) { "use strict"; Object.defineProperty(_exports, "__esModule", { diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-default-7/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-default-7/output.js index 15cad508a21a..7a36751246c2 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-default-7/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-default-7/output.js @@ -10,7 +10,7 @@ factory(mod.exports); global.input = mod.exports; } -})(this, function (_exports) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports) { "use strict"; Object.defineProperty(_exports, "__esModule", { diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-default-8/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-default-8/output.js index c92a85338f1b..260883e265f2 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-default-8/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-default-8/output.js @@ -10,7 +10,7 @@ factory(mod.exports); global.input = mod.exports; } -})(this, function (_exports) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports) { "use strict"; Object.defineProperty(_exports, "__esModule", { diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-default-9/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-default-9/output.js index b6a052ac6671..20b42c4faae2 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-default-9/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-default-9/output.js @@ -10,7 +10,7 @@ factory(mod.exports); global.input = mod.exports; } -})(this, function (_exports) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports) { "use strict"; Object.defineProperty(_exports, "__esModule", { diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-default/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-default/output.js index 3f5a188475c0..127234bed6d4 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-default/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-default/output.js @@ -10,7 +10,7 @@ factory(mod.exports); global.input = mod.exports; } -})(this, function (_exports) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports) { "use strict"; Object.defineProperty(_exports, "__esModule", { diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-from-2/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-from-2/output.js index fe946f300c70..3580d4361beb 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-from-2/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-from-2/output.js @@ -10,7 +10,7 @@ factory(mod.exports, global.foo); global.input = mod.exports; } -})(this, function (_exports, _foo) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports, _foo) { "use strict"; Object.defineProperty(_exports, "__esModule", { diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-from-3/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-from-3/output.js index 126e1be461b0..033dc64eadbe 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-from-3/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-from-3/output.js @@ -10,7 +10,7 @@ factory(mod.exports, global.foo); global.input = mod.exports; } -})(this, function (_exports, _foo) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports, _foo) { "use strict"; Object.defineProperty(_exports, "__esModule", { diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-from-4/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-from-4/output.js index dc6f562b4e3a..1a2577046f54 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-from-4/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-from-4/output.js @@ -10,7 +10,7 @@ factory(mod.exports, global.foo); global.input = mod.exports; } -})(this, function (_exports, _foo) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports, _foo) { "use strict"; Object.defineProperty(_exports, "__esModule", { diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-from-5/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-from-5/output.js index f0381a2ddba0..fd5bfbed33af 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-from-5/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-from-5/output.js @@ -10,7 +10,7 @@ factory(mod.exports, global.foo); global.input = mod.exports; } -})(this, function (_exports, _foo) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports, _foo) { "use strict"; Object.defineProperty(_exports, "__esModule", { diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-from-6/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-from-6/output.js index ec9180133584..46e4a2b27dd2 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-from-6/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-from-6/output.js @@ -10,7 +10,7 @@ factory(mod.exports, global.foo); global.input = mod.exports; } -})(this, function (_exports, _foo) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports, _foo) { "use strict"; Object.defineProperty(_exports, "__esModule", { diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-from/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-from/output.js index 116bc257736a..cda318717a4c 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-from/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-from/output.js @@ -10,7 +10,7 @@ factory(mod.exports, global.foo); global.input = mod.exports; } -})(this, function (_exports, _foo) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports, _foo) { "use strict"; Object.defineProperty(_exports, "__esModule", { diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-named-2/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-named-2/output.js index b6a052ac6671..20b42c4faae2 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-named-2/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-named-2/output.js @@ -10,7 +10,7 @@ factory(mod.exports); global.input = mod.exports; } -})(this, function (_exports) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports) { "use strict"; Object.defineProperty(_exports, "__esModule", { diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-named-3/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-named-3/output.js index 7263e5f91f48..9b45a5008053 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-named-3/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-named-3/output.js @@ -10,7 +10,7 @@ factory(mod.exports); global.input = mod.exports; } -})(this, function (_exports) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports) { "use strict"; Object.defineProperty(_exports, "__esModule", { diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-named-4/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-named-4/output.js index 14c4273fdc06..096434af4d2e 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-named-4/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-named-4/output.js @@ -10,7 +10,7 @@ factory(mod.exports); global.input = mod.exports; } -})(this, function (_exports) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports) { "use strict"; Object.defineProperty(_exports, "__esModule", { diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-named-5/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-named-5/output.js index 0ac1f5a990cc..6966fb097e00 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-named-5/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-named-5/output.js @@ -10,7 +10,7 @@ factory(mod.exports); global.input = mod.exports; } -})(this, function (_exports) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports) { "use strict"; Object.defineProperty(_exports, "__esModule", { diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-named/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-named/output.js index 009aedbfef27..1062cc37298a 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-named/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-named/output.js @@ -10,7 +10,7 @@ factory(mod.exports); global.input = mod.exports; } -})(this, function (_exports) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports) { "use strict"; Object.defineProperty(_exports, "__esModule", { diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/exports-variable/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/exports-variable/output.js index 90292c4609f7..9ad3023932a7 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/exports-variable/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/exports-variable/output.js @@ -10,7 +10,7 @@ factory(mod.exports); global.input = mod.exports; } -})(this, function (_exports) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports) { "use strict"; Object.defineProperty(_exports, "__esModule", { diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/get-module-name-option/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/get-module-name-option/output.js index d5c94066201a..bbfb355912b8 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/get-module-name-option/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/get-module-name-option/output.js @@ -10,6 +10,6 @@ factory(); global.myCustomModuleName = mod.exports; } -})(this, function () { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function () { "use strict"; }); diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/hoist-function-exports/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/hoist-function-exports/output.js index f5427d448fd1..f6448a39188b 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/hoist-function-exports/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/hoist-function-exports/output.js @@ -10,7 +10,7 @@ factory(mod.exports, global.evens); global.input = mod.exports; } -})(this, function (_exports, _evens) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports, _evens) { "use strict"; Object.defineProperty(_exports, "__esModule", { diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/imports-default/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/imports-default/output.js index bdc895976fd3..71c3133b263f 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/imports-default/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/imports-default/output.js @@ -10,7 +10,7 @@ factory(global.foo); global.input = mod.exports; } -})(this, function (_foo) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_foo) { "use strict"; _foo = babelHelpers.interopRequireDefault(_foo); diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/imports-exact-globals-false-with-overrides/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/imports-exact-globals-false-with-overrides/output.js index 79531c289ced..c751e3aee868 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/imports-exact-globals-false-with-overrides/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/imports-exact-globals-false-with-overrides/output.js @@ -10,7 +10,7 @@ factory(global.fooBAR, global.fooBAR, global.fizzBuzz); global.input = mod.exports; } -})(this, function (_fooBar, _fooBar2, _fizzbuzz) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_fooBar, _fooBar2, _fizzbuzz) { "use strict"; _fooBar = babelHelpers.interopRequireDefault(_fooBar); diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/imports-exact-globals-false/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/imports-exact-globals-false/output.js index 72d8bf864d29..5229781b738a 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/imports-exact-globals-false/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/imports-exact-globals-false/output.js @@ -10,7 +10,7 @@ factory(global.fooBar, global.fooBar, global.fizzbuzz); global.input = mod.exports; } -})(this, function (_fooBar, _fooBar2, _fizzbuzz) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_fooBar, _fooBar2, _fizzbuzz) { "use strict"; _fooBar = babelHelpers.interopRequireDefault(_fooBar); diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/imports-exact-globals-true-with-overrides/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/imports-exact-globals-true-with-overrides/output.js index bd083836e425..54211b04b3c0 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/imports-exact-globals-true-with-overrides/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/imports-exact-globals-true-with-overrides/output.js @@ -10,7 +10,7 @@ factory(global.fooBAR, global.mylib.fooBar, global.fizz.buzz); global.input = mod.exports; } -})(this, function (_fooBar, _fooBar2, _fizzbuzz) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_fooBar, _fooBar2, _fizzbuzz) { "use strict"; _fooBar = babelHelpers.interopRequireDefault(_fooBar); diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/imports-exact-globals-true/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/imports-exact-globals-true/output.js index c16c74d6d69c..bf4c741e6ce0 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/imports-exact-globals-true/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/imports-exact-globals-true/output.js @@ -10,7 +10,7 @@ factory(global.fooBar, global.mylibFooBar, global.fizzbuzz); global.input = mod.exports; } -})(this, function (_fooBar, _fooBar2, _fizzbuzz) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_fooBar, _fooBar2, _fizzbuzz) { "use strict"; _fooBar = babelHelpers.interopRequireDefault(_fooBar); diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/imports-glob/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/imports-glob/output.js index 3f403ba8ad4a..be83fe78d33c 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/imports-glob/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/imports-glob/output.js @@ -10,7 +10,7 @@ factory(global.foo); global.input = mod.exports; } -})(this, function (foo) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (foo) { "use strict"; foo = babelHelpers.interopRequireWildcard(foo); diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/imports-mixing/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/imports-mixing/output.js index f51c2d99aefa..17bf5e1fac30 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/imports-mixing/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/imports-mixing/output.js @@ -10,7 +10,7 @@ factory(global.foo); global.input = mod.exports; } -})(this, function (_foo) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_foo) { "use strict"; _foo = babelHelpers.interopRequireWildcard(_foo); diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/imports-named/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/imports-named/output.js index d0629b1666d4..d6e7457a2618 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/imports-named/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/imports-named/output.js @@ -10,7 +10,7 @@ factory(global.foo); global.input = mod.exports; } -})(this, function (_foo) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_foo) { "use strict"; _foo.bar; diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/imports/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/imports/output.js index c625f2ad0f13..5d36f0f1abf6 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/imports/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/imports/output.js @@ -10,6 +10,6 @@ factory(global.foo, global.fooBar, global.fooBar); global.input = mod.exports; } -})(this, function (_foo, _fooBar, _fooBar2) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_foo, _fooBar, _fooBar2) { "use strict"; }); diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/module-id-with-overridden-global-in-namespace/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/module-id-with-overridden-global-in-namespace/output.js index 3f43c9478122..db961cbcdf89 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/module-id-with-overridden-global-in-namespace/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/module-id-with-overridden-global-in-namespace/output.js @@ -11,7 +11,7 @@ global.foo = global.foo || {}; global.foo.bar = mod.exports; } -})(this, function (_exports) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports) { "use strict"; Object.defineProperty(_exports, "__esModule", { diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/module-id-with-overridden-global-in-very-nested-namespace/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/module-id-with-overridden-global-in-very-nested-namespace/output.js index 1ddcae34725f..c3bd11fb105c 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/module-id-with-overridden-global-in-very-nested-namespace/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/module-id-with-overridden-global-in-very-nested-namespace/output.js @@ -13,7 +13,7 @@ global.foo.bar.baz = global.foo.bar.baz || {}; global.foo.bar.baz.qux = mod.exports; } -})(this, function (_exports) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports) { "use strict"; Object.defineProperty(_exports, "__esModule", { diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/module-id-with-overridden-global/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/module-id-with-overridden-global/output.js index a9feedf65627..dd85a01acf7d 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/module-id-with-overridden-global/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/module-id-with-overridden-global/output.js @@ -10,7 +10,7 @@ factory(mod.exports); global.baz = mod.exports; } -})(this, function (_exports) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports) { "use strict"; Object.defineProperty(_exports, "__esModule", { diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/module-id/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/module-id/output.js index 2e8e731219b9..2d9c9cd817c0 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/module-id/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/module-id/output.js @@ -10,7 +10,7 @@ factory(); global.MyLib = mod.exports; } -})(this, function () { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function () { "use strict"; foobar(); diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/module-name-with-overridden-global/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/module-name-with-overridden-global/output.js index b17d582429ed..e6186c39d886 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/module-name-with-overridden-global/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/module-name-with-overridden-global/output.js @@ -10,7 +10,7 @@ factory(mod.exports); global.umdModuleNameWithOverriddenGlobalInput = mod.exports; } -})(this, function (_exports) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports) { "use strict"; Object.defineProperty(_exports, "__esModule", { diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/module-name/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/module-name/output.js index 3967f520001c..e85460f205bb 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/module-name/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/module-name/output.js @@ -10,7 +10,7 @@ factory(); global.umdModuleNameInput = mod.exports; } -})(this, function () { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function () { "use strict"; foobar(); diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/non-default-imports/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/non-default-imports/output.js index a9273b54d4ba..81afa0c2b734 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/non-default-imports/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/non-default-imports/output.js @@ -10,6 +10,6 @@ factory(global.render); global.input = mod.exports; } -})(this, function (_render) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_render) { "use strict"; }); diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/override-export-name/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/override-export-name/output.js index 3f5a188475c0..127234bed6d4 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/override-export-name/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/override-export-name/output.js @@ -10,7 +10,7 @@ factory(mod.exports); global.input = mod.exports; } -})(this, function (_exports) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports) { "use strict"; Object.defineProperty(_exports, "__esModule", { diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/override-import-name/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/override-import-name/output.js index 21f8cbe8bd64..9a60cc93eeff 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/override-import-name/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/override-import-name/output.js @@ -10,6 +10,6 @@ factory(global.Promise); global.input = mod.exports; } -})(this, function (_es6Promise) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_es6Promise) { "use strict"; }); diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/overview/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/overview/output.js index e60dd5dcb0e2..294904dbbd39 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/overview/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/overview/output.js @@ -10,7 +10,7 @@ factory(mod.exports, global.foo, global.fooBar, global.fooBar); global.input = mod.exports; } -})(this, function (_exports, foo2, _fooBar, _fooBar2) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports, foo2, _fooBar, _fooBar2) { "use strict"; Object.defineProperty(_exports, "__esModule", { diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/remap/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/remap/output.js index e5d904ca9981..33c36e34dc22 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/remap/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/remap/output.js @@ -10,7 +10,7 @@ factory(mod.exports); global.input = mod.exports; } -})(this, function (_exports) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports) { "use strict"; Object.defineProperty(_exports, "__esModule", { diff --git a/packages/babel-plugin-transform-named-capturing-groups-regex/package.json b/packages/babel-plugin-transform-named-capturing-groups-regex/package.json index dc95a58d86e8..b59d12e5b479 100644 --- a/packages/babel-plugin-transform-named-capturing-groups-regex/package.json +++ b/packages/babel-plugin-transform-named-capturing-groups-regex/package.json @@ -1,9 +1,12 @@ { "name": "@babel/plugin-transform-named-capturing-groups-regex", - "version": "7.4.5", + "version": "7.8.3", "description": "Compile regular expressions using named groups to ES5.", "homepage": "https://babeljs.io/", "license": "MIT", + "publishConfig": { + "access": "public" + }, "main": "lib/index.js", "keywords": [ "babel-plugin", @@ -11,17 +14,22 @@ "regexp", "regular expressions" ], - "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-named-capturing-groups-regex", + "repository": { + "type": "git", + "url": "https://github.com/babel/babel.git", + "directory": "packages/babel-plugin-transform-named-capturing-groups-regex" + }, "bugs": "https://github.com/babel/babel/issues", "dependencies": { - "regexp-tree": "^0.1.6" + "@babel/helper-create-regexp-features-plugin": "^7.8.3" }, "peerDependencies": { "@babel/core": "^7.0.0" }, "devDependencies": { - "@babel/core": "^7.4.5", - "@babel/helper-plugin-test-runner": "^7.0.0", - "core-js-pure": "^3.0.0" + "@babel/core": "^7.8.3", + "@babel/helper-plugin-test-runner": "^7.8.3", + "core-js": "^3.2.1", + "core-js-pure": "^3.2.1" } } diff --git a/packages/babel-plugin-transform-named-capturing-groups-regex/src/index.js b/packages/babel-plugin-transform-named-capturing-groups-regex/src/index.js index 042d16de9d4d..2cc0193310fd 100644 --- a/packages/babel-plugin-transform-named-capturing-groups-regex/src/index.js +++ b/packages/babel-plugin-transform-named-capturing-groups-regex/src/index.js @@ -1,54 +1,15 @@ -import regexpTree from "regexp-tree"; +/* eslint-disable @babel/development/plugin-name */ +import { createRegExpFeaturePlugin } from "@babel/helper-create-regexp-features-plugin"; -export default function({ types: t }, options) { +export default function(core, options) { const { runtime = true } = options; if (typeof runtime !== "boolean") { throw new Error("The 'runtime' option must be boolean"); } - return { + return createRegExpFeaturePlugin({ name: "transform-named-capturing-groups-regex", - - visitor: { - RegExpLiteral(path) { - const node = path.node; - if (node.pattern.indexOf("(?<") === -1) { - // Return early if there are no named groups. - // The .indexOf check may have false positives (e.g. /\(? 0 - ) { - node.pattern = result.getSource(); - - if (runtime && !isRegExpTest(path)) { - path.replaceWith( - t.callExpression(this.addHelper("wrapRegExp"), [ - node, - t.valueToNode(namedCapturingGroups), - ]), - ); - } - } - }, - }, - }; -} - -function isRegExpTest(path) { - return ( - path.parentPath.isMemberExpression({ - object: path.node, - computed: false, - }) && path.parentPath.get("property").isIdentifier({ name: "test" }) - ); + feature: "namedCaptureGroups", + options: { runtime }, + }); } diff --git a/packages/babel-plugin-transform-named-capturing-groups-regex/test/fixtures/runtime/issue-10393/exec.js b/packages/babel-plugin-transform-named-capturing-groups-regex/test/fixtures/runtime/issue-10393/exec.js new file mode 100644 index 000000000000..e12e576b6b0c --- /dev/null +++ b/packages/babel-plugin-transform-named-capturing-groups-regex/test/fixtures/runtime/issue-10393/exec.js @@ -0,0 +1,7 @@ +const regex = /(?<=a)(?[a])/ + +const result = regex.exec("aa"); + +expect(result.groups).toEqual({ + a: "a" +}); diff --git a/packages/babel-plugin-transform-named-capturing-groups-regex/test/fixtures/runtime/issue-10393/options.json b/packages/babel-plugin-transform-named-capturing-groups-regex/test/fixtures/runtime/issue-10393/options.json new file mode 100644 index 000000000000..2454c2169cf8 --- /dev/null +++ b/packages/babel-plugin-transform-named-capturing-groups-regex/test/fixtures/runtime/issue-10393/options.json @@ -0,0 +1,3 @@ +{ + "minNodeVersion": "8.0.0" +} diff --git a/packages/babel-plugin-transform-named-capturing-groups-regex/test/fixtures/runtime/issue-10601/exec.js b/packages/babel-plugin-transform-named-capturing-groups-regex/test/fixtures/runtime/issue-10601/exec.js new file mode 100644 index 000000000000..21136a48f1ac --- /dev/null +++ b/packages/babel-plugin-transform-named-capturing-groups-regex/test/fixtures/runtime/issue-10601/exec.js @@ -0,0 +1,7 @@ +const regex = /<(?\d)+>.*?<\/\k>/su; + +const result = regex.exec('<0>xxx\nyyy'); + +expect(result.groups).toEqual({ + tag: "0" +}); diff --git a/packages/babel-plugin-transform-named-capturing-groups-regex/test/fixtures/runtime/issue-10601/options.json b/packages/babel-plugin-transform-named-capturing-groups-regex/test/fixtures/runtime/issue-10601/options.json new file mode 100644 index 000000000000..2454c2169cf8 --- /dev/null +++ b/packages/babel-plugin-transform-named-capturing-groups-regex/test/fixtures/runtime/issue-10601/options.json @@ -0,0 +1,3 @@ +{ + "minNodeVersion": "8.0.0" +} diff --git a/packages/babel-plugin-transform-named-capturing-groups-regex/test/fixtures/syntax/escape-no-unicode-flag/options.json b/packages/babel-plugin-transform-named-capturing-groups-regex/test/fixtures/syntax/escape-no-unicode-flag/options.json index 47dc981e754b..f41e9ff57d0e 100644 --- a/packages/babel-plugin-transform-named-capturing-groups-regex/test/fixtures/syntax/escape-no-unicode-flag/options.json +++ b/packages/babel-plugin-transform-named-capturing-groups-regex/test/fixtures/syntax/escape-no-unicode-flag/options.json @@ -1,3 +1,3 @@ { - "throws": "invalid group Unicode name \"\\u{41}\", use `u` flag." + "throws": "Invalid escape sequence at position 3" } diff --git a/packages/babel-plugin-transform-named-capturing-groups-regex/test/fixtures/wrapper/looks-like-a-group-unicode/input.js b/packages/babel-plugin-transform-named-capturing-groups-regex/test/fixtures/wrapper/looks-like-a-group-unicode/input.js new file mode 100644 index 000000000000..00a7c78b9344 --- /dev/null +++ b/packages/babel-plugin-transform-named-capturing-groups-regex/test/fixtures/wrapper/looks-like-a-group-unicode/input.js @@ -0,0 +1 @@ +/no-groups-\(?looks\)\u{10000}/u; diff --git a/packages/babel-plugin-transform-named-capturing-groups-regex/test/fixtures/wrapper/looks-like-a-group-unicode/options.json b/packages/babel-plugin-transform-named-capturing-groups-regex/test/fixtures/wrapper/looks-like-a-group-unicode/options.json new file mode 100644 index 000000000000..1832df9cd6ad --- /dev/null +++ b/packages/babel-plugin-transform-named-capturing-groups-regex/test/fixtures/wrapper/looks-like-a-group-unicode/options.json @@ -0,0 +1,7 @@ +{ + "plugins": [ + ["external-helpers", { "helperVersion": "7.1000.0" }], + "transform-named-capturing-groups-regex", + "transform-unicode-regex" + ] +} diff --git a/packages/babel-plugin-transform-named-capturing-groups-regex/test/fixtures/wrapper/looks-like-a-group-unicode/output.js b/packages/babel-plugin-transform-named-capturing-groups-regex/test/fixtures/wrapper/looks-like-a-group-unicode/output.js new file mode 100644 index 000000000000..af299f8fceaf --- /dev/null +++ b/packages/babel-plugin-transform-named-capturing-groups-regex/test/fixtures/wrapper/looks-like-a-group-unicode/output.js @@ -0,0 +1 @@ +/no\x2Dgroups\x2D\(?looks\)(?:\uD800\uDC00)/; diff --git a/packages/babel-plugin-transform-named-capturing-groups-regex/test/fixtures/wrapper/looks-like-a-group/output.js b/packages/babel-plugin-transform-named-capturing-groups-regex/test/fixtures/wrapper/looks-like-a-group/output.js index 4c55ef0dbe17..6fe7c2ef533c 100644 --- a/packages/babel-plugin-transform-named-capturing-groups-regex/test/fixtures/wrapper/looks-like-a-group/output.js +++ b/packages/babel-plugin-transform-named-capturing-groups-regex/test/fixtures/wrapper/looks-like-a-group/output.js @@ -1 +1 @@ -/no-groups-\(?looks\)/; +/no\x2Dgroups\x2D\(?looks\)/; diff --git a/packages/babel-plugin-transform-new-target/package.json b/packages/babel-plugin-transform-new-target/package.json index f415edcfec42..71d0e6e71786 100644 --- a/packages/babel-plugin-transform-new-target/package.json +++ b/packages/babel-plugin-transform-new-target/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-transform-new-target", - "version": "7.4.4", + "version": "7.8.3", "description": "Transforms new.target meta property", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-new-target", "license": "MIT", @@ -12,15 +12,15 @@ "babel-plugin" ], "dependencies": { - "@babel/helper-plugin-utils": "^7.0.0" + "@babel/helper-plugin-utils": "^7.8.3" }, "peerDependencies": { "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.4.4", - "@babel/helper-plugin-test-runner": "^7.0.0", - "@babel/plugin-proposal-class-properties": "^7.4.4", - "@babel/plugin-transform-arrow-functions": "^7.0.0" + "@babel/core": "^7.8.3", + "@babel/helper-plugin-test-runner": "^7.8.3", + "@babel/plugin-proposal-class-properties": "^7.8.3", + "@babel/plugin-transform-arrow-functions": "^7.8.3" } } diff --git a/packages/babel-plugin-transform-object-assign/package.json b/packages/babel-plugin-transform-object-assign/package.json index b0852beb749c..0ddc53f8cfc3 100644 --- a/packages/babel-plugin-transform-object-assign/package.json +++ b/packages/babel-plugin-transform-object-assign/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-transform-object-assign", - "version": "7.2.0", + "version": "7.8.3", "description": "Replace Object.assign with an inline helper", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-object-assign", "author": "Jed Watson", @@ -13,13 +13,13 @@ "babel-plugin" ], "dependencies": { - "@babel/helper-plugin-utils": "^7.0.0" + "@babel/helper-plugin-utils": "^7.8.3" }, "peerDependencies": { "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.2.0", - "@babel/helper-plugin-test-runner": "^7.0.0" + "@babel/core": "^7.8.3", + "@babel/helper-plugin-test-runner": "^7.8.3" } } diff --git a/packages/babel-plugin-transform-object-set-prototype-of-to-assign/package.json b/packages/babel-plugin-transform-object-set-prototype-of-to-assign/package.json index 850f7c9e1c53..1af849a37337 100644 --- a/packages/babel-plugin-transform-object-set-prototype-of-to-assign/package.json +++ b/packages/babel-plugin-transform-object-set-prototype-of-to-assign/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-transform-object-set-prototype-of-to-assign", - "version": "7.2.0", + "version": "7.8.3", "description": "Turn Object.setPrototypeOf to assignments", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-object-set-prototype-of-to-assign", "license": "MIT", @@ -12,13 +12,13 @@ "babel-plugin" ], "dependencies": { - "@babel/helper-plugin-utils": "^7.0.0" + "@babel/helper-plugin-utils": "^7.8.3" }, "peerDependencies": { "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.2.0", - "@babel/helper-plugin-test-runner": "^7.0.0" + "@babel/core": "^7.8.3", + "@babel/helper-plugin-test-runner": "^7.8.3" } } diff --git a/packages/babel-plugin-transform-object-super/package.json b/packages/babel-plugin-transform-object-super/package.json index 488357a6e245..7325ef334c35 100644 --- a/packages/babel-plugin-transform-object-super/package.json +++ b/packages/babel-plugin-transform-object-super/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-transform-object-super", - "version": "7.5.5", + "version": "7.8.3", "description": "Compile ES2015 object super to ES5", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-object-super", "license": "MIT", @@ -12,14 +12,14 @@ "babel-plugin" ], "dependencies": { - "@babel/helper-plugin-utils": "^7.0.0", - "@babel/helper-replace-supers": "^7.5.5" + "@babel/helper-plugin-utils": "^7.8.3", + "@babel/helper-replace-supers": "^7.8.3" }, "peerDependencies": { "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.5.5", - "@babel/helper-plugin-test-runner": "^7.0.0" + "@babel/core": "^7.8.3", + "@babel/helper-plugin-test-runner": "^7.8.3" } } diff --git a/packages/babel-plugin-transform-parameters/package.json b/packages/babel-plugin-transform-parameters/package.json index fa8403ed44ce..525d5f9ae230 100644 --- a/packages/babel-plugin-transform-parameters/package.json +++ b/packages/babel-plugin-transform-parameters/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-transform-parameters", - "version": "7.4.4", + "version": "7.8.3", "description": "Compile ES2015 default and rest parameters to ES5", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-parameters", "license": "MIT", @@ -9,9 +9,9 @@ }, "main": "lib/index.js", "dependencies": { - "@babel/helper-call-delegate": "^7.4.4", - "@babel/helper-get-function-arity": "^7.0.0", - "@babel/helper-plugin-utils": "^7.0.0" + "@babel/helper-call-delegate": "^7.8.3", + "@babel/helper-get-function-arity": "^7.8.3", + "@babel/helper-plugin-utils": "^7.8.3" }, "keywords": [ "babel-plugin" @@ -20,7 +20,7 @@ "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.4.4", - "@babel/helper-plugin-test-runner": "^7.0.0" + "@babel/core": "^7.8.3", + "@babel/helper-plugin-test-runner": "^7.8.3" } } diff --git a/packages/babel-plugin-transform-parameters/src/params.js b/packages/babel-plugin-transform-parameters/src/params.js index 000a8505a581..4bf346b5be7b 100644 --- a/packages/babel-plugin-transform-parameters/src/params.js +++ b/packages/babel-plugin-transform-parameters/src/params.js @@ -32,7 +32,11 @@ function isSafeBinding(scope, node) { const iifeVisitor = { ReferencedIdentifier(path, state) { const { scope, node } = path; - if (node.name === "eval" || !isSafeBinding(scope, node)) { + if ( + node.name === "eval" || + !isSafeBinding(scope, node) || + !isSafeBinding(state.scope, node) + ) { state.iife = true; path.stop(); } diff --git a/packages/babel-plugin-transform-parameters/src/rest.js b/packages/babel-plugin-transform-parameters/src/rest.js index da85c7e5ad95..eccd548aec4c 100644 --- a/packages/babel-plugin-transform-parameters/src/rest.js +++ b/packages/babel-plugin-transform-parameters/src/rest.js @@ -87,26 +87,28 @@ const memberExpressionOptimisationVisitor = { const argsOptEligible = !state.deopted && - !// ex: `args[0] = "whatever"` - ( - (grandparentPath.isAssignmentExpression() && - parentPath.node === grandparentPath.node.left) || - // ex: `[args[0]] = ["whatever"]` - grandparentPath.isLVal() || - // ex: `for (rest[0] in this)` - // ex: `for (rest[0] of this)` - grandparentPath.isForXStatement() || - // ex: `++args[0]` - // ex: `args[0]--` - grandparentPath.isUpdateExpression() || - // ex: `delete args[0]` - grandparentPath.isUnaryExpression({ operator: "delete" }) || - // ex: `args[0]()` - // ex: `new args[0]()` - // ex: `new args[0]` - ((grandparentPath.isCallExpression() || - grandparentPath.isNewExpression()) && - parentPath.node === grandparentPath.node.callee) + !( + // ex: `args[0] = "whatever"` + ( + (grandparentPath.isAssignmentExpression() && + parentPath.node === grandparentPath.node.left) || + // ex: `[args[0]] = ["whatever"]` + grandparentPath.isLVal() || + // ex: `for (rest[0] in this)` + // ex: `for (rest[0] of this)` + grandparentPath.isForXStatement() || + // ex: `++args[0]` + // ex: `args[0]--` + grandparentPath.isUpdateExpression() || + // ex: `delete args[0]` + grandparentPath.isUnaryExpression({ operator: "delete" }) || + // ex: `args[0]()` + // ex: `new args[0]()` + // ex: `new args[0]` + ((grandparentPath.isCallExpression() || + grandparentPath.isNewExpression()) && + parentPath.node === grandparentPath.node.callee) + ) ); if (argsOptEligible) { diff --git a/packages/babel-plugin-transform-parameters/test/fixtures/parameters/default-iife-9947/input.js b/packages/babel-plugin-transform-parameters/test/fixtures/parameters/default-iife-9947/input.js new file mode 100644 index 000000000000..e2ca36c7ddb2 --- /dev/null +++ b/packages/babel-plugin-transform-parameters/test/fixtures/parameters/default-iife-9947/input.js @@ -0,0 +1,6 @@ +let x = "outside"; +function outer(a = () => x) { + let x = "inside"; + return a(); +} +outer(); diff --git a/packages/babel-plugin-transform-parameters/test/fixtures/parameters/default-iife-9947/output.js b/packages/babel-plugin-transform-parameters/test/fixtures/parameters/default-iife-9947/output.js new file mode 100644 index 000000000000..74ff50c2df94 --- /dev/null +++ b/packages/babel-plugin-transform-parameters/test/fixtures/parameters/default-iife-9947/output.js @@ -0,0 +1,13 @@ +var x = "outside"; + +function outer() { + var a = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : function () { + return x; + }; + return function () { + var x = "inside"; + return a(); + }(); +} + +outer(); diff --git a/packages/babel-plugin-transform-property-literals/package.json b/packages/babel-plugin-transform-property-literals/package.json index d74f95007361..2453c446a61f 100644 --- a/packages/babel-plugin-transform-property-literals/package.json +++ b/packages/babel-plugin-transform-property-literals/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-transform-property-literals", - "version": "7.2.0", + "version": "7.8.3", "description": "Ensure that reserved words are quoted in object property keys", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-property-literals", "license": "MIT", @@ -12,13 +12,13 @@ "babel-plugin" ], "dependencies": { - "@babel/helper-plugin-utils": "^7.0.0" + "@babel/helper-plugin-utils": "^7.8.3" }, "peerDependencies": { "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.2.0", - "@babel/helper-plugin-test-runner": "^7.0.0" + "@babel/core": "^7.8.3", + "@babel/helper-plugin-test-runner": "^7.8.3" } } diff --git a/packages/babel-plugin-transform-property-mutators/package.json b/packages/babel-plugin-transform-property-mutators/package.json index b280968195ce..d77149509f5a 100644 --- a/packages/babel-plugin-transform-property-mutators/package.json +++ b/packages/babel-plugin-transform-property-mutators/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-transform-property-mutators", - "version": "7.2.0", + "version": "7.8.3", "description": "Compile ES5 property mutator shorthand syntax to Object.defineProperty", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-property-mutators", "license": "MIT", @@ -12,14 +12,14 @@ "babel-plugin" ], "dependencies": { - "@babel/helper-define-map": "^7.1.0", - "@babel/helper-plugin-utils": "^7.0.0" + "@babel/helper-define-map": "^7.8.3", + "@babel/helper-plugin-utils": "^7.8.3" }, "peerDependencies": { "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.2.0", - "@babel/helper-plugin-test-runner": "^7.0.0" + "@babel/core": "^7.8.3", + "@babel/helper-plugin-test-runner": "^7.8.3" } } diff --git a/packages/babel-plugin-transform-proto-to-assign/package.json b/packages/babel-plugin-transform-proto-to-assign/package.json index 7b5799fa217d..76fea74a12d6 100644 --- a/packages/babel-plugin-transform-proto-to-assign/package.json +++ b/packages/babel-plugin-transform-proto-to-assign/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-transform-proto-to-assign", - "version": "7.5.5", + "version": "7.8.3", "description": "Babel plugin for turning __proto__ into a shallow property clone", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-proto-to-assign", "license": "MIT", @@ -12,14 +12,14 @@ "babel-plugin" ], "dependencies": { - "@babel/helper-plugin-utils": "^7.0.0", + "@babel/helper-plugin-utils": "^7.8.3", "lodash": "^4.17.13" }, "peerDependencies": { "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.5.5", - "@babel/helper-plugin-test-runner": "^7.0.0" + "@babel/core": "^7.8.3", + "@babel/helper-plugin-test-runner": "^7.8.3" } } diff --git a/packages/babel-plugin-transform-react-constant-elements/package.json b/packages/babel-plugin-transform-react-constant-elements/package.json index fd4533b2adba..73c5149a2415 100644 --- a/packages/babel-plugin-transform-react-constant-elements/package.json +++ b/packages/babel-plugin-transform-react-constant-elements/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-transform-react-constant-elements", - "version": "7.5.0", + "version": "7.8.3", "description": "Treat React JSX elements as value types and hoist them to the highest scope", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-react-constant-elements", "license": "MIT", @@ -12,14 +12,14 @@ "babel-plugin" ], "dependencies": { - "@babel/helper-annotate-as-pure": "^7.0.0", - "@babel/helper-plugin-utils": "^7.0.0" + "@babel/helper-annotate-as-pure": "^7.8.3", + "@babel/helper-plugin-utils": "^7.8.3" }, "peerDependencies": { "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.5.0", - "@babel/helper-plugin-test-runner": "^7.0.0" + "@babel/core": "^7.8.3", + "@babel/helper-plugin-test-runner": "^7.8.3" } } diff --git a/packages/babel-plugin-transform-react-constant-elements/src/index.js b/packages/babel-plugin-transform-react-constant-elements/src/index.js index 15589bd808f0..48d5e2bbc708 100644 --- a/packages/babel-plugin-transform-react-constant-elements/src/index.js +++ b/packages/babel-plugin-transform-react-constant-elements/src/index.js @@ -59,7 +59,8 @@ export default declare((api, options) => { const { value } = expressionResult; const isMutable = (!state.mutablePropsAllowed && - (value && typeof value === "object")) || + value && + typeof value === "object") || typeof value === "function"; if (!isMutable) { // It evaluated to an immutable value, so we can hoist it. diff --git a/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/deopt-mutable-complex/input.mjs b/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/deopt-mutable-complex/input.mjs new file mode 100644 index 000000000000..d55eaf7cd0ec --- /dev/null +++ b/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/deopt-mutable-complex/input.mjs @@ -0,0 +1,10 @@ +let foo = 'hello'; + +const mutate = () => { + foo = 'goodbye'; +} + +export const Component = () => { + if (Math.random() > 0.5) mutate(); + return {foo}; +}; diff --git a/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/deopt-mutable-complex/output.mjs b/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/deopt-mutable-complex/output.mjs new file mode 100644 index 000000000000..83c8f677226e --- /dev/null +++ b/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/deopt-mutable-complex/output.mjs @@ -0,0 +1,10 @@ +let foo = 'hello'; + +const mutate = () => { + foo = 'goodbye'; +}; + +export const Component = () => { + if (Math.random() > 0.5) mutate(); + return {foo}; +}; diff --git a/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/deopt-mutable/input.mjs b/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/deopt-mutable/input.mjs new file mode 100644 index 000000000000..1225d11e87eb --- /dev/null +++ b/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/deopt-mutable/input.mjs @@ -0,0 +1,6 @@ +let foo = 'hello'; + +export const Component = () => { + foo = 'goodbye'; + return {foo}; +}; diff --git a/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/deopt-mutable/output.mjs b/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/deopt-mutable/output.mjs new file mode 100644 index 000000000000..dd266a198d47 --- /dev/null +++ b/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/deopt-mutable/output.mjs @@ -0,0 +1,5 @@ +let foo = 'hello'; +export const Component = () => { + foo = 'goodbye'; + return {foo}; +}; diff --git a/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/inline-elements/output.js b/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/inline-elements/output.js index 27a2ad4df045..9d4821377915 100644 --- a/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/inline-elements/output.js +++ b/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/inline-elements/output.js @@ -1,6 +1,6 @@ var REACT_ELEMENT_TYPE; -function _jsx(type, props, key, children) { if (!REACT_ELEMENT_TYPE) { REACT_ELEMENT_TYPE = typeof Symbol === "function" && Symbol["for"] && Symbol["for"]("react.element") || 0xeac7; } var defaultProps = type && type.defaultProps; var childrenLength = arguments.length - 3; if (!props && childrenLength !== 0) { props = { children: void 0 }; } if (props && defaultProps) { for (var propName in defaultProps) { if (props[propName] === void 0) { props[propName] = defaultProps[propName]; } } } else if (!props) { props = defaultProps || {}; } if (childrenLength === 1) { props.children = children; } else if (childrenLength > 1) { var childArray = new Array(childrenLength); for (var i = 0; i < childrenLength; i++) { childArray[i] = arguments[i + 3]; } props.children = childArray; } return { $$typeof: REACT_ELEMENT_TYPE, type: type, key: key === undefined ? null : '' + key, ref: null, props: props, _owner: null }; } +function _jsx(type, props, key, children) { if (!REACT_ELEMENT_TYPE) { REACT_ELEMENT_TYPE = typeof Symbol === "function" && Symbol["for"] && Symbol["for"]("react.element") || 0xeac7; } var defaultProps = type && type.defaultProps; var childrenLength = arguments.length - 3; if (!props && childrenLength !== 0) { props = { children: void 0 }; } if (childrenLength === 1) { props.children = children; } else if (childrenLength > 1) { var childArray = new Array(childrenLength); for (var i = 0; i < childrenLength; i++) { childArray[i] = arguments[i + 3]; } props.children = childArray; } if (props && defaultProps) { for (var propName in defaultProps) { if (props[propName] === void 0) { props[propName] = defaultProps[propName]; } } } else if (!props) { props = defaultProps || {}; } return { $$typeof: REACT_ELEMENT_TYPE, type: type, key: key === undefined ? null : '' + key, ref: null, props: props, _owner: null }; } var _ref = /*#__PURE__*/ diff --git a/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/parameter-destructure-rest/options.json b/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/parameter-destructure-rest/options.json index 1b0cc13a7a3f..01101cd37ccb 100644 --- a/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/parameter-destructure-rest/options.json +++ b/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/parameter-destructure-rest/options.json @@ -3,7 +3,6 @@ "transform-destructuring", "transform-parameters", "transform-spread", - "syntax-object-rest-spread", "transform-react-constant-elements", "syntax-jsx", "external-helpers" diff --git a/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/parameter-destructure-spread-deopt/options.json b/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/parameter-destructure-spread-deopt/options.json index 1b0cc13a7a3f..01101cd37ccb 100644 --- a/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/parameter-destructure-spread-deopt/options.json +++ b/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/parameter-destructure-spread-deopt/options.json @@ -3,7 +3,6 @@ "transform-destructuring", "transform-parameters", "transform-spread", - "syntax-object-rest-spread", "transform-react-constant-elements", "syntax-jsx", "external-helpers" diff --git a/packages/babel-plugin-transform-react-display-name/package.json b/packages/babel-plugin-transform-react-display-name/package.json index 97aa1609d217..1932b063bf8b 100644 --- a/packages/babel-plugin-transform-react-display-name/package.json +++ b/packages/babel-plugin-transform-react-display-name/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-transform-react-display-name", - "version": "7.2.0", + "version": "7.8.3", "description": "Add displayName to React.createClass calls", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-react-display-name", "license": "MIT", @@ -12,13 +12,13 @@ "babel-plugin" ], "dependencies": { - "@babel/helper-plugin-utils": "^7.0.0" + "@babel/helper-plugin-utils": "^7.8.3" }, "peerDependencies": { "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.2.0", - "@babel/helper-plugin-test-runner": "^7.0.0" + "@babel/core": "^7.8.3", + "@babel/helper-plugin-test-runner": "^7.8.3" } } diff --git a/packages/babel-plugin-transform-react-inline-elements/package.json b/packages/babel-plugin-transform-react-inline-elements/package.json index fe32f272e543..c3aa23e8114c 100644 --- a/packages/babel-plugin-transform-react-inline-elements/package.json +++ b/packages/babel-plugin-transform-react-inline-elements/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-transform-react-inline-elements", - "version": "7.2.0", + "version": "7.8.3", "description": "Turn JSX elements into exploded React objects", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-react-inline-elements", "license": "MIT", @@ -12,14 +12,14 @@ "babel-plugin" ], "dependencies": { - "@babel/helper-builder-react-jsx": "^7.0.0", - "@babel/helper-plugin-utils": "^7.0.0" + "@babel/helper-builder-react-jsx": "^7.8.3", + "@babel/helper-plugin-utils": "^7.8.3" }, "peerDependencies": { "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.2.0", - "@babel/helper-plugin-test-runner": "^7.0.0" + "@babel/core": "^7.8.3", + "@babel/helper-plugin-test-runner": "^7.8.3" } } diff --git a/packages/babel-plugin-transform-react-jsx-compat/package.json b/packages/babel-plugin-transform-react-jsx-compat/package.json index 87a9d5e4735e..6b890d53da07 100644 --- a/packages/babel-plugin-transform-react-jsx-compat/package.json +++ b/packages/babel-plugin-transform-react-jsx-compat/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-transform-react-jsx-compat", - "version": "7.2.0", + "version": "7.8.3", "description": "Turn JSX into React Pre-0.12 function calls", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-react-jsx-compat", "license": "MIT", @@ -12,14 +12,14 @@ "babel-plugin" ], "dependencies": { - "@babel/helper-builder-react-jsx": "^7.0.0", - "@babel/helper-plugin-utils": "^7.0.0" + "@babel/helper-builder-react-jsx": "^7.8.3", + "@babel/helper-plugin-utils": "^7.8.3" }, "peerDependencies": { "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.2.0", - "@babel/helper-plugin-test-runner": "^7.0.0" + "@babel/core": "^7.8.3", + "@babel/helper-plugin-test-runner": "^7.8.3" } } diff --git a/packages/babel-plugin-transform-react-jsx-self/package.json b/packages/babel-plugin-transform-react-jsx-self/package.json index d649d89f05ae..818d19ef40f8 100644 --- a/packages/babel-plugin-transform-react-jsx-self/package.json +++ b/packages/babel-plugin-transform-react-jsx-self/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-transform-react-jsx-self", - "version": "7.2.0", + "version": "7.8.3", "description": "Add a __self prop to all JSX Elements", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-react-jsx-self", "license": "MIT", @@ -12,14 +12,14 @@ "babel-plugin" ], "dependencies": { - "@babel/helper-plugin-utils": "^7.0.0", - "@babel/plugin-syntax-jsx": "^7.2.0" + "@babel/helper-plugin-utils": "^7.8.3", + "@babel/plugin-syntax-jsx": "^7.8.3" }, "peerDependencies": { "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.2.0", - "@babel/helper-plugin-test-runner": "^7.0.0" + "@babel/core": "^7.8.3", + "@babel/helper-plugin-test-runner": "^7.8.3" } } diff --git a/packages/babel-plugin-transform-react-jsx-source/package.json b/packages/babel-plugin-transform-react-jsx-source/package.json index 829536fe4dc2..39dbd29bfbce 100644 --- a/packages/babel-plugin-transform-react-jsx-source/package.json +++ b/packages/babel-plugin-transform-react-jsx-source/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-transform-react-jsx-source", - "version": "7.5.0", + "version": "7.8.3", "description": "Add a __source prop to all JSX Elements", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-react-jsx-source", "license": "MIT", @@ -12,14 +12,14 @@ "babel-plugin" ], "dependencies": { - "@babel/helper-plugin-utils": "^7.0.0", - "@babel/plugin-syntax-jsx": "^7.2.0" + "@babel/helper-plugin-utils": "^7.8.3", + "@babel/plugin-syntax-jsx": "^7.8.3" }, "peerDependencies": { "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.5.0", - "@babel/helper-plugin-test-runner": "^7.0.0" + "@babel/core": "^7.8.3", + "@babel/helper-plugin-test-runner": "^7.8.3" } } diff --git a/packages/babel-plugin-transform-react-jsx-source/test/fixtures/react-source/basic-sample/options.json b/packages/babel-plugin-transform-react-jsx-source/test/fixtures/react-source/basic-sample/options.json new file mode 100644 index 000000000000..d6180568ae8d --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx-source/test/fixtures/react-source/basic-sample/options.json @@ -0,0 +1,3 @@ +{ + "os": ["linux", "darwin"] +} diff --git a/packages/babel-plugin-transform-react-jsx-source/test/fixtures/react-source/with-source/options.json b/packages/babel-plugin-transform-react-jsx-source/test/fixtures/react-source/with-source/options.json new file mode 100644 index 000000000000..d6180568ae8d --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx-source/test/fixtures/react-source/with-source/options.json @@ -0,0 +1,3 @@ +{ + "os": ["linux", "darwin"] +} diff --git a/packages/babel-plugin-transform-react-jsx/package.json b/packages/babel-plugin-transform-react-jsx/package.json index 5af70957b122..efeaaa87b9d3 100644 --- a/packages/babel-plugin-transform-react-jsx/package.json +++ b/packages/babel-plugin-transform-react-jsx/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-transform-react-jsx", - "version": "7.3.0", + "version": "7.8.3", "description": "Turn JSX into React function calls", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-react-jsx", "license": "MIT", @@ -12,15 +12,15 @@ "babel-plugin" ], "dependencies": { - "@babel/helper-builder-react-jsx": "^7.3.0", - "@babel/helper-plugin-utils": "^7.0.0", - "@babel/plugin-syntax-jsx": "^7.2.0" + "@babel/helper-builder-react-jsx": "^7.8.3", + "@babel/helper-plugin-utils": "^7.8.3", + "@babel/plugin-syntax-jsx": "^7.8.3" }, "peerDependencies": { "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.2.0", - "@babel/helper-plugin-test-runner": "^7.0.0" + "@babel/core": "^7.8.3", + "@babel/helper-plugin-test-runner": "^7.8.3" } } diff --git a/packages/babel-plugin-transform-react-jsx/src/index.js b/packages/babel-plugin-transform-react-jsx/src/index.js index 778e5f960b7a..a655b30b6972 100644 --- a/packages/babel-plugin-transform-react-jsx/src/index.js +++ b/packages/babel-plugin-transform-react-jsx/src/index.js @@ -80,7 +80,7 @@ export default declare((api, options) => { ) { throw new Error( "transform-react-jsx: pragma has been set but " + - "pragmafrag has not been set", + "pragmaFrag has not been set", ); } }, diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/react/throw-if-pragma-set-but-not-pragmafrag-and-frag-used/options.json b/packages/babel-plugin-transform-react-jsx/test/fixtures/react/throw-if-pragma-set-but-not-pragmafrag-and-frag-used/options.json index b89035fd105e..1bfb659b3c98 100644 --- a/packages/babel-plugin-transform-react-jsx/test/fixtures/react/throw-if-pragma-set-but-not-pragmafrag-and-frag-used/options.json +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/react/throw-if-pragma-set-but-not-pragmafrag-and-frag-used/options.json @@ -1,3 +1,3 @@ { - "throws": "transform-react-jsx: pragma has been set but pragmafrag has not been set" + "throws": "transform-react-jsx: pragma has been set but pragmaFrag has not been set" } diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/useSpread/assignment-invalid-option/input.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/useSpread/assignment-invalid-option/input.js new file mode 100644 index 000000000000..4caacb6aa17d --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/useSpread/assignment-invalid-option/input.js @@ -0,0 +1 @@ +var div = diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/useSpread/assignment-invalid-option/options.json b/packages/babel-plugin-transform-react-jsx/test/fixtures/useSpread/assignment-invalid-option/options.json new file mode 100644 index 000000000000..ff6406c9a4e2 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/useSpread/assignment-invalid-option/options.json @@ -0,0 +1,4 @@ +{ + "plugins": [["transform-react-jsx", { "useSpread": 0 }]], + "throws": "transform-react-jsx currently only accepts a boolean option for useSpread (defaults to false)" +} diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/useSpread/assignment-use-builtin/input.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/useSpread/assignment-use-builtin/input.js new file mode 100644 index 000000000000..4caacb6aa17d --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/useSpread/assignment-use-builtin/input.js @@ -0,0 +1 @@ +var div = diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/useSpread/assignment-use-builtin/options.json b/packages/babel-plugin-transform-react-jsx/test/fixtures/useSpread/assignment-use-builtin/options.json new file mode 100644 index 000000000000..eab6051daa03 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/useSpread/assignment-use-builtin/options.json @@ -0,0 +1,6 @@ +{ + "plugins": [ + ["transform-react-jsx", { "useSpread": true, "useBuiltIns": true }] + ], + "throws": "transform-react-jsx currently only accepts useBuiltIns or useSpread but not both" +} diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/useSpread/assignment/input.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/useSpread/assignment/input.js new file mode 100644 index 000000000000..4caacb6aa17d --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/useSpread/assignment/input.js @@ -0,0 +1 @@ +var div = diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/useSpread/assignment/output.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/useSpread/assignment/output.js new file mode 100644 index 000000000000..6d3c49132173 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/useSpread/assignment/output.js @@ -0,0 +1,3 @@ +var div = React.createElement(Component, { ...props, + foo: "bar" +}); diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/useSpread/options.json b/packages/babel-plugin-transform-react-jsx/test/fixtures/useSpread/options.json new file mode 100644 index 000000000000..7e0d5fcba0f3 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/useSpread/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["transform-react-jsx", { "useSpread": true }]] +} diff --git a/packages/babel-plugin-transform-regenerator/package.json b/packages/babel-plugin-transform-regenerator/package.json index 9dbdaa4c6c7c..e9576428d990 100644 --- a/packages/babel-plugin-transform-regenerator/package.json +++ b/packages/babel-plugin-transform-regenerator/package.json @@ -2,7 +2,7 @@ "name": "@babel/plugin-transform-regenerator", "author": "Ben Newman ", "description": "Explode async and generator functions into a state machine.", - "version": "7.4.5", + "version": "7.8.3", "homepage": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-regenerator", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-regenerator", "main": "lib/index.js", @@ -17,7 +17,7 @@ "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.4.5", - "@babel/helper-plugin-test-runner": "^7.0.0" + "@babel/core": "^7.8.3", + "@babel/helper-plugin-test-runner": "^7.8.3" } } diff --git a/packages/babel-plugin-transform-reserved-words/package.json b/packages/babel-plugin-transform-reserved-words/package.json index dfce3bc9cf07..1c80adbb6775 100644 --- a/packages/babel-plugin-transform-reserved-words/package.json +++ b/packages/babel-plugin-transform-reserved-words/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-transform-reserved-words", - "version": "7.2.0", + "version": "7.8.3", "description": "Ensure that no reserved words are used.", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-reserved-words", "license": "MIT", @@ -12,13 +12,13 @@ "babel-plugin" ], "dependencies": { - "@babel/helper-plugin-utils": "^7.0.0" + "@babel/helper-plugin-utils": "^7.8.3" }, "peerDependencies": { "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.2.0", - "@babel/helper-plugin-test-runner": "^7.0.0" + "@babel/core": "^7.8.3", + "@babel/helper-plugin-test-runner": "^7.8.3" } } diff --git a/packages/babel-plugin-transform-runtime/package.json b/packages/babel-plugin-transform-runtime/package.json index d6881ae6fb63..b7a9aaaa89ca 100644 --- a/packages/babel-plugin-transform-runtime/package.json +++ b/packages/babel-plugin-transform-runtime/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-transform-runtime", - "version": "7.5.5", + "version": "7.8.3", "description": "Externalise references to helpers and builtins, automatically polyfilling your code without polluting globals", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-runtime", "license": "MIT", @@ -12,8 +12,8 @@ "babel-plugin" ], "dependencies": { - "@babel/helper-module-imports": "^7.0.0", - "@babel/helper-plugin-utils": "^7.0.0", + "@babel/helper-module-imports": "^7.8.3", + "@babel/helper-plugin-utils": "^7.8.3", "resolve": "^1.8.1", "semver": "^5.5.1" }, @@ -21,13 +21,13 @@ "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.5.5", - "@babel/helper-plugin-test-runner": "^7.0.0", - "@babel/helpers": "^7.5.5", - "@babel/plugin-transform-runtime": "^7.5.5", - "@babel/preset-env": "^7.5.5", - "@babel/runtime": "^7.5.5", - "@babel/template": "^7.4.4", - "@babel/types": "7.0.0-beta.53" + "@babel/core": "^7.8.3", + "@babel/helper-plugin-test-runner": "^7.8.3", + "@babel/helpers": "^7.8.3", + "@babel/plugin-transform-typeof-symbol": "^7.8.3", + "@babel/preset-env": "^7.8.3", + "@babel/runtime": "^7.8.3", + "@babel/template": "^7.8.3", + "@babel/types": "^7.8.3" } } diff --git a/packages/babel-plugin-transform-runtime/scripts/build-dist.js b/packages/babel-plugin-transform-runtime/scripts/build-dist.js index e36ef0c68b0a..a107bbea1fa2 100644 --- a/packages/babel-plugin-transform-runtime/scripts/build-dist.js +++ b/packages/babel-plugin-transform-runtime/scripts/build-dist.js @@ -9,6 +9,7 @@ const t = require("@babel/types"); const transformRuntime = require("../"); +const runtimeVersion = require("@babel/runtime/package.json").version; const corejs2Definitions = require("../lib/runtime-corejs2-definitions").default(); const corejs3Definitions = require("../lib/runtime-corejs3-definitions").default(); @@ -151,15 +152,30 @@ function buildHelper( tree.body.push(...helper.nodes); return babel.transformFromAst(tree, null, { - presets: [[require("@babel/preset-env"), { modules: false }]], + filename: helperFilename, + presets: [ + [ + "@babel/preset-env", + { modules: false, exclude: ["@babel/plugin-transform-typeof-symbol"] }, + ], + ], plugins: [ - [transformRuntime, { corejs, useESModules: esm }], + [ + transformRuntime, + { corejs, useESModules: esm, version: runtimeVersion }, + ], buildRuntimeRewritePlugin( runtimeName, path.relative(path.dirname(helperFilename), pkgDirname), helperName ), ], + overrides: [ + { + exclude: /typeof/, + plugins: ["@babel/plugin-transform-typeof-symbol"], + }, + ], }).code; } diff --git a/packages/babel-plugin-transform-runtime/src/index.js b/packages/babel-plugin-transform-runtime/src/index.js index 3b7ff68e9c2f..a9d0fd350deb 100644 --- a/packages/babel-plugin-transform-runtime/src/index.js +++ b/packages/babel-plugin-transform-runtime/src/index.js @@ -113,7 +113,14 @@ export default declare((api, options, dirname) => { ); } + function isNamespaced(path) { + const binding = path.scope.getBinding(path.node.name); + if (!binding) return false; + return binding.path.isImportNamespaceSpecifier(); + } + function maybeNeedsPolyfill(path, methods, name) { + if (isNamespaced(path.get("object"))) return false; if (!methods[name].types) return true; const typeAnnotation = path.get("object").getTypeAnnotation(); @@ -123,6 +130,14 @@ export default declare((api, options, dirname) => { return methods[name].types.some(name => name === type); } + function resolvePropertyName(path, computed) { + const { node } = path; + if (!computed) return node.name; + if (path.isStringLiteral()) return node.value; + const result = path.evaluate(); + return result.value; + } + if (has(options, "useBuiltIns")) { if (options.useBuiltIns) { throw new Error( @@ -290,8 +305,11 @@ export default declare((api, options, dirname) => { if (!t.isMemberExpression(callee)) return; - const { object, property } = callee; - const propertyName = property.name; + const { object } = callee; + const propertyName = resolvePropertyName( + path.get("callee.property"), + callee.computed, + ); // transform calling instance methods like `something.includes()` if (injectCoreJS3 && !hasStaticMapping(object.name, propertyName)) { @@ -314,9 +332,7 @@ export default declare((api, options, dirname) => { node.callee = t.memberExpression( t.callExpression( this.addDefaultImport( - `${moduleName}/${corejsRoot}/instance/${ - InstanceProperties[propertyName].path - }`, + `${moduleName}/${corejsRoot}/instance/${InstanceProperties[propertyName].path}`, `${propertyName}InstanceProperty`, ), [context2], @@ -370,29 +386,33 @@ export default declare((api, options, dirname) => { if (!path.isReferenced()) return; const { node } = path; - const { object, property } = node; + const { object } = node; if (!t.isReferenced(object, node)) return; - if (node.computed) { - if (injectCoreJS2) return; - // transform `something[Symbol.iterator]` to calling `getIteratorMethod(something)` helper - if (path.get("property").matchesPattern("Symbol.iterator")) { - path.replaceWith( - t.callExpression( - this.addDefaultImport( - `${moduleName}/core-js/get-iterator-method`, - "getIteratorMethod", - ), - [object], + // transform `something[Symbol.iterator]` to calling `getIteratorMethod(something)` helper + if ( + !injectCoreJS2 && + node.computed && + path.get("property").matchesPattern("Symbol.iterator") + ) { + path.replaceWith( + t.callExpression( + this.addDefaultImport( + `${moduleName}/core-js/get-iterator-method`, + "getIteratorMethod", ), - ); - } + [object], + ), + ); return; } const objectName = object.name; - const propertyName = property.name; + const propertyName = resolvePropertyName( + path.get("property"), + node.computed, + ); // doesn't reference the global if ( path.scope.getBindingIdentifier(objectName) || @@ -407,9 +427,7 @@ export default declare((api, options, dirname) => { path.replaceWith( t.callExpression( this.addDefaultImport( - `${moduleName}/${corejsRoot}/instance/${ - InstanceProperties[propertyName].path - }`, + `${moduleName}/${corejsRoot}/instance/${InstanceProperties[propertyName].path}`, `${propertyName}InstanceProperty`, ), [object], @@ -421,9 +439,7 @@ export default declare((api, options, dirname) => { path.replaceWith( this.addDefaultImport( - `${modulePath}/${corejsRoot}/${ - StaticProperties[objectName][propertyName].path - }`, + `${modulePath}/${corejsRoot}/${StaticProperties[objectName][propertyName].path}`, `${objectName}$${propertyName}`, ), ); diff --git a/packages/babel-plugin-transform-runtime/test/fixtures/absoluteRuntime/options.json b/packages/babel-plugin-transform-runtime/test/fixtures/absoluteRuntime/options.json new file mode 100644 index 000000000000..d6180568ae8d --- /dev/null +++ b/packages/babel-plugin-transform-runtime/test/fixtures/absoluteRuntime/options.json @@ -0,0 +1,3 @@ +{ + "os": ["linux", "darwin"] +} diff --git a/packages/babel-plugin-transform-runtime/test/fixtures/absoluteRuntime/relative/output.js b/packages/babel-plugin-transform-runtime/test/fixtures/absoluteRuntime/relative/output.js index e783188c9e48..4e7a5218225f 100644 --- a/packages/babel-plugin-transform-runtime/test/fixtures/absoluteRuntime/relative/output.js +++ b/packages/babel-plugin-transform-runtime/test/fixtures/absoluteRuntime/relative/output.js @@ -1,4 +1,4 @@ -var _classCallCheck = require("/packages/babel-plugin-transform-runtime/node_modules/@babel/runtime/helpers/classCallCheck"); +var _classCallCheck = require("/packages/babel-plugin-transform-runtime/test/fixtures/absoluteRuntime/relative/subfolder/node_modules/@babel/runtime/helpers/classCallCheck"); let Foo = function Foo() { "use strict"; diff --git a/packages/babel-plugin-transform-runtime/test/fixtures/absoluteRuntime/relative/subfolder/node_modules/@babel/runtime/package.json b/packages/babel-plugin-transform-runtime/test/fixtures/absoluteRuntime/relative/subfolder/node_modules/@babel/runtime/package.json new file mode 100644 index 000000000000..652fee89ae19 --- /dev/null +++ b/packages/babel-plugin-transform-runtime/test/fixtures/absoluteRuntime/relative/subfolder/node_modules/@babel/runtime/package.json @@ -0,0 +1,4 @@ +{ + "name": "@babel/runtime", + "private": true +} diff --git a/packages/babel-plugin-transform-runtime/test/fixtures/runtime-corejs2/evaluated-static-methods/input.js b/packages/babel-plugin-transform-runtime/test/fixtures/runtime-corejs2/evaluated-static-methods/input.js new file mode 100644 index 000000000000..6968e9a2729b --- /dev/null +++ b/packages/babel-plugin-transform-runtime/test/fixtures/runtime-corejs2/evaluated-static-methods/input.js @@ -0,0 +1,5 @@ +var _isArray = "isArray"; + +Array["from"]; // polyfill +Array[_isArray]; // polyfill +Array[of]; // don't polyfill diff --git a/packages/babel-plugin-transform-runtime/test/fixtures/runtime-corejs2/evaluated-static-methods/options.json b/packages/babel-plugin-transform-runtime/test/fixtures/runtime-corejs2/evaluated-static-methods/options.json new file mode 100644 index 000000000000..3514ed63b409 --- /dev/null +++ b/packages/babel-plugin-transform-runtime/test/fixtures/runtime-corejs2/evaluated-static-methods/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["transform-runtime", { "corejs": 2 }]] +} diff --git a/packages/babel-plugin-transform-runtime/test/fixtures/runtime-corejs2/evaluated-static-methods/output.js b/packages/babel-plugin-transform-runtime/test/fixtures/runtime-corejs2/evaluated-static-methods/output.js new file mode 100644 index 000000000000..59868c6f60d5 --- /dev/null +++ b/packages/babel-plugin-transform-runtime/test/fixtures/runtime-corejs2/evaluated-static-methods/output.js @@ -0,0 +1,10 @@ +var _Array$isArray = require("@babel/runtime-corejs2/core-js/array/is-array"); + +var _Array$from = require("@babel/runtime-corejs2/core-js/array/from"); + +var _isArray = "isArray"; +_Array$from; // polyfill + +_Array$isArray; // polyfill + +Array[of]; // don't polyfill diff --git a/packages/babel-plugin-transform-runtime/test/fixtures/runtime-corejs2/instance-computed/input.js b/packages/babel-plugin-transform-runtime/test/fixtures/runtime-corejs2/instance-computed/input.js index 87ed431301c8..0ca5137f3896 100644 --- a/packages/babel-plugin-transform-runtime/test/fixtures/runtime-corejs2/instance-computed/input.js +++ b/packages/babel-plugin-transform-runtime/test/fixtures/runtime-corejs2/instance-computed/input.js @@ -1 +1 @@ -bar[filter]() \ No newline at end of file +bar[filter]() diff --git a/packages/babel-plugin-transform-runtime/test/fixtures/runtime-corejs3/built-in-globals-proposals/options.json b/packages/babel-plugin-transform-runtime/test/fixtures/runtime-corejs3/built-in-globals-proposals/options.json index 1e8ea7d11308..2b36aa6019b4 100644 --- a/packages/babel-plugin-transform-runtime/test/fixtures/runtime-corejs3/built-in-globals-proposals/options.json +++ b/packages/babel-plugin-transform-runtime/test/fixtures/runtime-corejs3/built-in-globals-proposals/options.json @@ -1,3 +1,5 @@ { - "plugins": [["transform-runtime", { "corejs": { "version": 3, "proposals": true } }]] + "plugins": [ + ["transform-runtime", { "corejs": { "version": 3, "proposals": true } }] + ] } diff --git a/packages/babel-plugin-transform-runtime/test/fixtures/runtime-corejs3/built-in-instance-methods-proposals/options.json b/packages/babel-plugin-transform-runtime/test/fixtures/runtime-corejs3/built-in-instance-methods-proposals/options.json index 1e8ea7d11308..2b36aa6019b4 100644 --- a/packages/babel-plugin-transform-runtime/test/fixtures/runtime-corejs3/built-in-instance-methods-proposals/options.json +++ b/packages/babel-plugin-transform-runtime/test/fixtures/runtime-corejs3/built-in-instance-methods-proposals/options.json @@ -1,3 +1,5 @@ { - "plugins": [["transform-runtime", { "corejs": { "version": 3, "proposals": true } }]] + "plugins": [ + ["transform-runtime", { "corejs": { "version": 3, "proposals": true } }] + ] } diff --git a/packages/babel-plugin-transform-runtime/test/fixtures/runtime-corejs3/built-in-static-methods-proposals/options.json b/packages/babel-plugin-transform-runtime/test/fixtures/runtime-corejs3/built-in-static-methods-proposals/options.json index 1e8ea7d11308..2b36aa6019b4 100644 --- a/packages/babel-plugin-transform-runtime/test/fixtures/runtime-corejs3/built-in-static-methods-proposals/options.json +++ b/packages/babel-plugin-transform-runtime/test/fixtures/runtime-corejs3/built-in-static-methods-proposals/options.json @@ -1,3 +1,5 @@ { - "plugins": [["transform-runtime", { "corejs": { "version": 3, "proposals": true } }]] + "plugins": [ + ["transform-runtime", { "corejs": { "version": 3, "proposals": true } }] + ] } diff --git a/packages/babel-plugin-transform-runtime/test/fixtures/runtime-corejs3/evaluated-instance-methods/input.js b/packages/babel-plugin-transform-runtime/test/fixtures/runtime-corejs3/evaluated-instance-methods/input.js new file mode 100644 index 000000000000..edc557316374 --- /dev/null +++ b/packages/babel-plugin-transform-runtime/test/fixtures/runtime-corejs3/evaluated-instance-methods/input.js @@ -0,0 +1,9 @@ +var _map = "map"; + +object["filter"]; // polyfill +object[_map]; // polyfill +object[find]; // don't polyfill + +object["filter"](); // polyfill +object[_map](); // polyfill +object[find](); // don't polyfill diff --git a/packages/babel-plugin-transform-runtime/test/fixtures/runtime-corejs3/evaluated-instance-methods/options.json b/packages/babel-plugin-transform-runtime/test/fixtures/runtime-corejs3/evaluated-instance-methods/options.json new file mode 100644 index 000000000000..2b36aa6019b4 --- /dev/null +++ b/packages/babel-plugin-transform-runtime/test/fixtures/runtime-corejs3/evaluated-instance-methods/options.json @@ -0,0 +1,5 @@ +{ + "plugins": [ + ["transform-runtime", { "corejs": { "version": 3, "proposals": true } }] + ] +} diff --git a/packages/babel-plugin-transform-runtime/test/fixtures/runtime-corejs3/evaluated-instance-methods/output.js b/packages/babel-plugin-transform-runtime/test/fixtures/runtime-corejs3/evaluated-instance-methods/output.js new file mode 100644 index 000000000000..1f2bc8c78155 --- /dev/null +++ b/packages/babel-plugin-transform-runtime/test/fixtures/runtime-corejs3/evaluated-instance-methods/output.js @@ -0,0 +1,21 @@ +var _mapInstanceProperty = require("@babel/runtime-corejs3/core-js/instance/map"); + +var _filterInstanceProperty = require("@babel/runtime-corejs3/core-js/instance/filter"); + +var _map = "map"; + +_filterInstanceProperty(object); // polyfill + + +_mapInstanceProperty(object); // polyfill + + +object[find]; // don't polyfill + +_filterInstanceProperty(object).call(object); // polyfill + + +_mapInstanceProperty(object).call(object); // polyfill + + +object[find](); // don't polyfill diff --git a/packages/babel-plugin-transform-runtime/test/fixtures/runtime-corejs3/evaluated-static-methods/input.js b/packages/babel-plugin-transform-runtime/test/fixtures/runtime-corejs3/evaluated-static-methods/input.js new file mode 100644 index 000000000000..6968e9a2729b --- /dev/null +++ b/packages/babel-plugin-transform-runtime/test/fixtures/runtime-corejs3/evaluated-static-methods/input.js @@ -0,0 +1,5 @@ +var _isArray = "isArray"; + +Array["from"]; // polyfill +Array[_isArray]; // polyfill +Array[of]; // don't polyfill diff --git a/packages/babel-plugin-transform-runtime/test/fixtures/runtime-corejs3/evaluated-static-methods/options.json b/packages/babel-plugin-transform-runtime/test/fixtures/runtime-corejs3/evaluated-static-methods/options.json new file mode 100644 index 000000000000..2b36aa6019b4 --- /dev/null +++ b/packages/babel-plugin-transform-runtime/test/fixtures/runtime-corejs3/evaluated-static-methods/options.json @@ -0,0 +1,5 @@ +{ + "plugins": [ + ["transform-runtime", { "corejs": { "version": 3, "proposals": true } }] + ] +} diff --git a/packages/babel-plugin-transform-runtime/test/fixtures/runtime-corejs3/evaluated-static-methods/output.js b/packages/babel-plugin-transform-runtime/test/fixtures/runtime-corejs3/evaluated-static-methods/output.js new file mode 100644 index 000000000000..83dde082836f --- /dev/null +++ b/packages/babel-plugin-transform-runtime/test/fixtures/runtime-corejs3/evaluated-static-methods/output.js @@ -0,0 +1,10 @@ +var _Array$isArray = require("@babel/runtime-corejs3/core-js/array/is-array"); + +var _Array$from = require("@babel/runtime-corejs3/core-js/array/from"); + +var _isArray = "isArray"; +_Array$from; // polyfill + +_Array$isArray; // polyfill + +Array[of]; // don't polyfill diff --git a/packages/babel-plugin-transform-runtime/test/fixtures/runtime-corejs3/instance-computed/input.js b/packages/babel-plugin-transform-runtime/test/fixtures/runtime-corejs3/instance-computed/input.js index 87ed431301c8..225ac3534de6 100644 --- a/packages/babel-plugin-transform-runtime/test/fixtures/runtime-corejs3/instance-computed/input.js +++ b/packages/babel-plugin-transform-runtime/test/fixtures/runtime-corejs3/instance-computed/input.js @@ -1 +1 @@ -bar[filter]() \ No newline at end of file +bar['filter']() diff --git a/packages/babel-plugin-transform-runtime/test/fixtures/runtime-corejs3/modules-namespaced/input.mjs b/packages/babel-plugin-transform-runtime/test/fixtures/runtime-corejs3/modules-namespaced/input.mjs new file mode 100644 index 000000000000..7962c3d2005c --- /dev/null +++ b/packages/babel-plugin-transform-runtime/test/fixtures/runtime-corejs3/modules-namespaced/input.mjs @@ -0,0 +1,2 @@ +import * as bar from "bar"; +bar.map(); diff --git a/packages/babel-plugin-transform-runtime/test/fixtures/runtime-corejs3/modules-namespaced/options.json b/packages/babel-plugin-transform-runtime/test/fixtures/runtime-corejs3/modules-namespaced/options.json new file mode 100644 index 000000000000..ea8bb9c3aa1c --- /dev/null +++ b/packages/babel-plugin-transform-runtime/test/fixtures/runtime-corejs3/modules-namespaced/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["transform-runtime", { "corejs": 3 }]] +} diff --git a/packages/babel-plugin-transform-runtime/test/fixtures/runtime-corejs3/modules-namespaced/output.mjs b/packages/babel-plugin-transform-runtime/test/fixtures/runtime-corejs3/modules-namespaced/output.mjs new file mode 100644 index 000000000000..7962c3d2005c --- /dev/null +++ b/packages/babel-plugin-transform-runtime/test/fixtures/runtime-corejs3/modules-namespaced/output.mjs @@ -0,0 +1,2 @@ +import * as bar from "bar"; +bar.map(); diff --git a/packages/babel-plugin-transform-shorthand-properties/package.json b/packages/babel-plugin-transform-shorthand-properties/package.json index 5233742c2adf..52df3edbf670 100644 --- a/packages/babel-plugin-transform-shorthand-properties/package.json +++ b/packages/babel-plugin-transform-shorthand-properties/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-transform-shorthand-properties", - "version": "7.2.0", + "version": "7.8.3", "description": "Compile ES2015 shorthand properties to ES5", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-shorthand-properties", "license": "MIT", @@ -12,13 +12,13 @@ "babel-plugin" ], "dependencies": { - "@babel/helper-plugin-utils": "^7.0.0" + "@babel/helper-plugin-utils": "^7.8.3" }, "peerDependencies": { "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.2.0", - "@babel/helper-plugin-test-runner": "^7.0.0" + "@babel/core": "^7.8.3", + "@babel/helper-plugin-test-runner": "^7.8.3" } } diff --git a/packages/babel-plugin-transform-spread/package.json b/packages/babel-plugin-transform-spread/package.json index 5c051240523d..1bcfe9a81492 100644 --- a/packages/babel-plugin-transform-spread/package.json +++ b/packages/babel-plugin-transform-spread/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-transform-spread", - "version": "7.2.2", + "version": "7.8.3", "description": "Compile ES2015 spread to ES5", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-spread", "license": "MIT", @@ -12,13 +12,13 @@ "babel-plugin" ], "dependencies": { - "@babel/helper-plugin-utils": "^7.0.0" + "@babel/helper-plugin-utils": "^7.8.3" }, "peerDependencies": { "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.2.2", - "@babel/helper-plugin-test-runner": "^7.0.0" + "@babel/core": "^7.8.3", + "@babel/helper-plugin-test-runner": "^7.8.3" } } diff --git a/packages/babel-plugin-transform-spread/test/fixtures/regression/10416/input.mjs b/packages/babel-plugin-transform-spread/test/fixtures/regression/10416/input.mjs new file mode 100644 index 000000000000..9aed42e1cc6c --- /dev/null +++ b/packages/babel-plugin-transform-spread/test/fixtures/regression/10416/input.mjs @@ -0,0 +1,6 @@ +const E_ARR = []; + +export default function () { + const someVar = E_ARR; + return [...someVar]; +} \ No newline at end of file diff --git a/packages/babel-plugin-transform-spread/test/fixtures/regression/10416/output.mjs b/packages/babel-plugin-transform-spread/test/fixtures/regression/10416/output.mjs new file mode 100644 index 000000000000..9593cc5ad0ba --- /dev/null +++ b/packages/babel-plugin-transform-spread/test/fixtures/regression/10416/output.mjs @@ -0,0 +1,5 @@ +const E_ARR = []; +export default function () { + const someVar = E_ARR; + return babelHelpers.toConsumableArray(someVar); +} diff --git a/packages/babel-plugin-transform-sticky-regex/package.json b/packages/babel-plugin-transform-sticky-regex/package.json index 0ff694871615..94c8c5c1c39e 100644 --- a/packages/babel-plugin-transform-sticky-regex/package.json +++ b/packages/babel-plugin-transform-sticky-regex/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-transform-sticky-regex", - "version": "7.2.0", + "version": "7.8.3", "description": "Compile ES2015 sticky regex to an ES5 RegExp constructor", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-sticky-regex", "license": "MIT", @@ -12,14 +12,14 @@ "babel-plugin" ], "dependencies": { - "@babel/helper-plugin-utils": "^7.0.0", - "@babel/helper-regex": "^7.0.0" + "@babel/helper-plugin-utils": "^7.8.3", + "@babel/helper-regex": "^7.8.3" }, "peerDependencies": { "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.2.0", - "@babel/helper-plugin-test-runner": "^7.0.0" + "@babel/core": "^7.8.3", + "@babel/helper-plugin-test-runner": "^7.8.3" } } diff --git a/packages/babel-plugin-transform-strict-mode/package.json b/packages/babel-plugin-transform-strict-mode/package.json index bb59d8c74be0..04611071dd64 100644 --- a/packages/babel-plugin-transform-strict-mode/package.json +++ b/packages/babel-plugin-transform-strict-mode/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-transform-strict-mode", - "version": "7.2.0", + "version": "7.8.3", "description": "This plugin places a 'use strict'; directive at the top of all files to enable strict mode", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-strict-mode", "license": "MIT", @@ -12,13 +12,13 @@ "babel-plugin" ], "dependencies": { - "@babel/helper-plugin-utils": "^7.0.0" + "@babel/helper-plugin-utils": "^7.8.3" }, "peerDependencies": { "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.2.0", - "@babel/helper-plugin-test-runner": "^7.0.0" + "@babel/core": "^7.8.3", + "@babel/helper-plugin-test-runner": "^7.8.3" } } diff --git a/packages/babel-plugin-transform-template-literals/package.json b/packages/babel-plugin-transform-template-literals/package.json index 0cf36ea7c2ed..07469e863647 100644 --- a/packages/babel-plugin-transform-template-literals/package.json +++ b/packages/babel-plugin-transform-template-literals/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-transform-template-literals", - "version": "7.4.4", + "version": "7.8.3", "description": "Compile ES2015 template literals to ES5", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-template-literals", "license": "MIT", @@ -9,8 +9,8 @@ }, "main": "lib/index.js", "dependencies": { - "@babel/helper-annotate-as-pure": "^7.0.0", - "@babel/helper-plugin-utils": "^7.0.0" + "@babel/helper-annotate-as-pure": "^7.8.3", + "@babel/helper-plugin-utils": "^7.8.3" }, "keywords": [ "babel-plugin" @@ -19,7 +19,7 @@ "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.4.4", - "@babel/helper-plugin-test-runner": "^7.0.0" + "@babel/core": "^7.8.3", + "@babel/helper-plugin-test-runner": "^7.8.3" } } diff --git a/packages/babel-plugin-transform-typeof-symbol/package.json b/packages/babel-plugin-transform-typeof-symbol/package.json index e893284ebc60..f89e3c893775 100644 --- a/packages/babel-plugin-transform-typeof-symbol/package.json +++ b/packages/babel-plugin-transform-typeof-symbol/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-transform-typeof-symbol", - "version": "7.2.0", + "version": "7.8.3", "description": "This transformer wraps all typeof expressions with a method that replicates native behaviour. (ie. returning “symbol” for symbols)", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-typeof-symbol", "license": "MIT", @@ -12,13 +12,13 @@ "babel-plugin" ], "dependencies": { - "@babel/helper-plugin-utils": "^7.0.0" + "@babel/helper-plugin-utils": "^7.8.3" }, "peerDependencies": { "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.2.0", - "@babel/helper-plugin-test-runner": "^7.0.0" + "@babel/core": "^7.8.3", + "@babel/helper-plugin-test-runner": "^7.8.3" } } diff --git a/packages/babel-plugin-transform-typescript/package.json b/packages/babel-plugin-transform-typescript/package.json index 7f146e81339b..25549540649b 100644 --- a/packages/babel-plugin-transform-typescript/package.json +++ b/packages/babel-plugin-transform-typescript/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-transform-typescript", - "version": "7.5.5", + "version": "7.8.3", "description": "Transform TypeScript into ES.next", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-typescript", "license": "MIT", @@ -13,15 +13,15 @@ "typescript" ], "dependencies": { - "@babel/helper-create-class-features-plugin": "^7.5.5", - "@babel/helper-plugin-utils": "^7.0.0", - "@babel/plugin-syntax-typescript": "^7.2.0" + "@babel/helper-create-class-features-plugin": "^7.8.3", + "@babel/helper-plugin-utils": "^7.8.3", + "@babel/plugin-syntax-typescript": "^7.8.3" }, "peerDependencies": { "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.5.5", - "@babel/helper-plugin-test-runner": "^7.0.0" + "@babel/core": "^7.8.3", + "@babel/helper-plugin-test-runner": "^7.8.3" } } diff --git a/packages/babel-plugin-transform-typescript/src/enum.js b/packages/babel-plugin-transform-typescript/src/enum.js index 11c7b5376d83..3b604e2e8fab 100644 --- a/packages/babel-plugin-transform-typescript/src/enum.js +++ b/packages/babel-plugin-transform-typescript/src/enum.js @@ -144,13 +144,12 @@ function evaluate( expr, seen: PreviousEnumMembers, ): number | string | typeof undefined { - if (expr.type === "StringLiteral") { - return expr.value; - } return evalConstant(expr); function evalConstant(expr): number | typeof undefined { switch (expr.type) { + case "StringLiteral": + return expr.value; case "UnaryExpression": return evalUnaryExpression(expr); case "BinaryExpression": @@ -161,6 +160,11 @@ function evaluate( return evalConstant(expr.expression); case "Identifier": return seen[expr.name]; + case "TemplateLiteral": + if (expr.quasis.length === 1) { + return expr.quasis[0].value.cooked; + } + /* falls through */ default: return undefined; } diff --git a/packages/babel-plugin-transform-typescript/src/index.js b/packages/babel-plugin-transform-typescript/src/index.js index c89e2dbe8185..97b23b454503 100644 --- a/packages/babel-plugin-transform-typescript/src/index.js +++ b/packages/babel-plugin-transform-typescript/src/index.js @@ -44,11 +44,95 @@ function registerGlobalType(programScope, name) { } export default declare( - (api, { jsxPragma = "React", allowNamespaces = false }) => { + ( + api, + { + jsxPragma = "React", + allowNamespaces = false, + allowDeclareFields = false, + }, + ) => { api.assertVersion(7); const JSX_ANNOTATION_REGEX = /\*?\s*@jsx\s+([^\s]+)/; + const classMemberVisitors = { + field(path) { + const { node } = path; + + if (!allowDeclareFields && node.declare) { + throw path.buildCodeFrameError( + `The 'declare' modifier is only allowed when the 'allowDeclareFields' option of ` + + `@babel/plugin-transform-typescript or @babel/preset-typescript is enabled.`, + ); + } + if (node.definite || node.declare) { + if (node.value) { + throw path.buildCodeFrameError( + `Definietly assigned fields and fields with the 'declare' modifier cannot` + + ` be initialized here, but only in the constructor`, + ); + } + + path.remove(); + } else if (!allowDeclareFields && !node.value && !node.decorators) { + path.remove(); + } + + if (node.accessibility) node.accessibility = null; + if (node.abstract) node.abstract = null; + if (node.readonly) node.readonly = null; + if (node.optional) node.optional = null; + if (node.typeAnnotation) node.typeAnnotation = null; + }, + method({ node }) { + if (node.accessibility) node.accessibility = null; + if (node.abstract) node.abstract = null; + if (node.optional) node.optional = null; + + // Rest handled by Function visitor + }, + constructor(path, classPath) { + if (path.node.accessibility) path.node.accessibility = null; + // Collects parameter properties so that we can add an assignment + // for each of them in the constructor body + // + // We use a WeakSet to ensure an assignment for a parameter + // property is only added once. This is necessary for cases like + // using `transform-classes`, which causes this visitor to run + // twice. + const parameterProperties = []; + for (const param of path.node.params) { + if ( + param.type === "TSParameterProperty" && + !PARSED_PARAMS.has(param.parameter) + ) { + PARSED_PARAMS.add(param.parameter); + parameterProperties.push(param.parameter); + } + } + + if (parameterProperties.length) { + const assigns = parameterProperties.map(p => { + let id; + if (t.isIdentifier(p)) { + id = p; + } else if (t.isAssignmentPattern(p) && t.isIdentifier(p.left)) { + id = p.left; + } else { + throw path.buildCodeFrameError( + "Parameter properties can not be destructuring patterns.", + ); + } + + return template.statement.ast`this.${id} = ${id}`; + }); + + injectInitialization(classPath, path, assigns); + } + }, + }; + return { name: "transform-typescript", inherits: syntaxTypeScript, @@ -192,27 +276,6 @@ export default declare( if (node.definite) node.definite = null; }, - ClassMethod(path) { - const { node } = path; - - if (node.accessibility) node.accessibility = null; - if (node.abstract) node.abstract = null; - if (node.optional) node.optional = null; - - // Rest handled by Function visitor - }, - - ClassProperty(path) { - const { node } = path; - - if (node.accessibility) node.accessibility = null; - if (node.abstract) node.abstract = null; - if (node.readonly) node.readonly = null; - if (node.optional) node.optional = null; - if (node.definite) node.definite = null; - if (node.typeAnnotation) node.typeAnnotation = null; - }, - TSIndexSignature(path) { path.remove(); }, @@ -238,54 +301,14 @@ export default declare( // class transform would transform the class, causing more specific // visitors to not run. path.get("body.body").forEach(child => { - const childNode = child.node; - - if (t.isClassMethod(childNode, { kind: "constructor" })) { - // Collects parameter properties so that we can add an assignment - // for each of them in the constructor body - // - // We use a WeakSet to ensure an assignment for a parameter - // property is only added once. This is necessary for cases like - // using `transform-classes`, which causes this visitor to run - // twice. - const parameterProperties = []; - for (const param of childNode.params) { - if ( - param.type === "TSParameterProperty" && - !PARSED_PARAMS.has(param.parameter) - ) { - PARSED_PARAMS.add(param.parameter); - parameterProperties.push(param.parameter); - } - } - - if (parameterProperties.length) { - const assigns = parameterProperties.map(p => { - let id; - if (t.isIdentifier(p)) { - id = p; - } else if ( - t.isAssignmentPattern(p) && - t.isIdentifier(p.left) - ) { - id = p.left; - } else { - throw path.buildCodeFrameError( - "Parameter properties can not be destructuring patterns.", - ); - } - - return template.statement.ast`this.${id} = ${id}`; - }); - - injectInitialization(path, child, assigns); + if (child.isClassMethod()) { + if (child.node.kind === "constructor") { + classMemberVisitors.constructor(child, path); + } else { + classMemberVisitors.method(child, path); } } else if (child.isClassProperty()) { - childNode.typeAnnotation = null; - - if (!childNode.value && !childNode.decorators) { - child.remove(); - } + classMemberVisitors.field(child, path); } }); }, diff --git a/packages/babel-plugin-transform-typescript/test/fixtures/class/abstract-class-decorated-parameter/output.mjs b/packages/babel-plugin-transform-typescript/test/fixtures/class/abstract-class-decorated-parameter/output.mjs index e8982550efbf..58aa80d516ec 100644 --- a/packages/babel-plugin-transform-typescript/test/fixtures/class/abstract-class-decorated-parameter/output.mjs +++ b/packages/babel-plugin-transform-typescript/test/fixtures/class/abstract-class-decorated-parameter/output.mjs @@ -2,7 +2,7 @@ var _class, _descriptor; function _applyDecoratedDescriptor(target, property, decorators, descriptor, context) { var desc = {}; Object.keys(descriptor).forEach(function (key) { desc[key] = descriptor[key]; }); desc.enumerable = !!desc.enumerable; desc.configurable = !!desc.configurable; if ('value' in desc || desc.initializer) { desc.writable = true; } desc = decorators.slice().reverse().reduce(function (desc, decorator) { return decorator(target, property, desc) || desc; }, desc); if (context && desc.initializer !== void 0) { desc.value = desc.initializer ? desc.initializer.call(context) : void 0; desc.initializer = undefined; } if (desc.initializer === void 0) { Object.defineProperty(target, property, desc); desc = null; } return desc; } -function _initializerWarningHelper(descriptor, context) { throw new Error('Decorating class property failed. Please ensure that ' + 'proposal-class-properties is enabled and set to use loose mode. ' + 'To use proposal-class-properties in spec mode with decorators, wait for ' + 'the next major version of decorators in stage 2.'); } +function _initializerWarningHelper(descriptor, context) { throw new Error('Decorating class property failed. Please ensure that ' + 'proposal-class-properties is enabled and runs after the decorators transform.'); } import { observable } from 'mobx'; let Foo = (_class = class Foo { diff --git a/packages/babel-plugin-transform-typescript/test/fixtures/class/declare-not-enabled/input.ts b/packages/babel-plugin-transform-typescript/test/fixtures/class/declare-not-enabled/input.ts new file mode 100644 index 000000000000..3cb9d54665fa --- /dev/null +++ b/packages/babel-plugin-transform-typescript/test/fixtures/class/declare-not-enabled/input.ts @@ -0,0 +1,3 @@ +class A { + declare x; +} diff --git a/packages/babel-plugin-transform-typescript/test/fixtures/class/declare-not-enabled/options.json b/packages/babel-plugin-transform-typescript/test/fixtures/class/declare-not-enabled/options.json new file mode 100644 index 000000000000..c844b0ad736c --- /dev/null +++ b/packages/babel-plugin-transform-typescript/test/fixtures/class/declare-not-enabled/options.json @@ -0,0 +1,4 @@ +{ + "plugins": ["transform-typescript"], + "throws": "The 'declare' modifier is only allowed when the 'allowDeclareFields' option of @babel/plugin-transform-typescript or @babel/preset-typescript is enabled." +} diff --git a/packages/babel-plugin-transform-typescript/test/fixtures/class/declare-not-initialized/input.ts b/packages/babel-plugin-transform-typescript/test/fixtures/class/declare-not-initialized/input.ts new file mode 100644 index 000000000000..c7c42323a390 --- /dev/null +++ b/packages/babel-plugin-transform-typescript/test/fixtures/class/declare-not-initialized/input.ts @@ -0,0 +1,3 @@ +class A { + x; +} \ No newline at end of file diff --git a/packages/babel-plugin-transform-typescript/test/fixtures/class/declare-not-initialized/options.json b/packages/babel-plugin-transform-typescript/test/fixtures/class/declare-not-initialized/options.json new file mode 100644 index 000000000000..a6d406a50e49 --- /dev/null +++ b/packages/babel-plugin-transform-typescript/test/fixtures/class/declare-not-initialized/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["transform-typescript", { "allowDeclareFields": true }]] +} diff --git a/packages/babel-plugin-transform-typescript/test/fixtures/class/declare-not-initialized/output.js b/packages/babel-plugin-transform-typescript/test/fixtures/class/declare-not-initialized/output.js new file mode 100644 index 000000000000..eebf5c5c33db --- /dev/null +++ b/packages/babel-plugin-transform-typescript/test/fixtures/class/declare-not-initialized/output.js @@ -0,0 +1,3 @@ +class A { + x; +} diff --git a/packages/babel-plugin-transform-typescript/test/fixtures/class/declare/input.ts b/packages/babel-plugin-transform-typescript/test/fixtures/class/declare/input.ts new file mode 100644 index 000000000000..7ab37b71fb39 --- /dev/null +++ b/packages/babel-plugin-transform-typescript/test/fixtures/class/declare/input.ts @@ -0,0 +1,3 @@ +class A { + declare x; +} \ No newline at end of file diff --git a/packages/babel-plugin-transform-typescript/test/fixtures/class/declare/options.json b/packages/babel-plugin-transform-typescript/test/fixtures/class/declare/options.json new file mode 100644 index 000000000000..a6d406a50e49 --- /dev/null +++ b/packages/babel-plugin-transform-typescript/test/fixtures/class/declare/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["transform-typescript", { "allowDeclareFields": true }]] +} diff --git a/packages/babel-plugin-transform-typescript/test/fixtures/class/declare/output.js b/packages/babel-plugin-transform-typescript/test/fixtures/class/declare/output.js new file mode 100644 index 000000000000..a869c2849526 --- /dev/null +++ b/packages/babel-plugin-transform-typescript/test/fixtures/class/declare/output.js @@ -0,0 +1 @@ +class A {} diff --git a/packages/babel-plugin-transform-typescript/test/fixtures/class/methods/input.ts b/packages/babel-plugin-transform-typescript/test/fixtures/class/methods/input.ts index 35f255f2b23e..58026a1bdaa7 100644 --- a/packages/babel-plugin-transform-typescript/test/fixtures/class/methods/input.ts +++ b/packages/babel-plugin-transform-typescript/test/fixtures/class/methods/input.ts @@ -1,4 +1,5 @@ class C { m(): void; public m(x?: number, ...y: number[]): void {} + public constructor() {} } diff --git a/packages/babel-plugin-transform-typescript/test/fixtures/class/methods/output.js b/packages/babel-plugin-transform-typescript/test/fixtures/class/methods/output.js index cb6e585efbb4..b5436ecfaec6 100644 --- a/packages/babel-plugin-transform-typescript/test/fixtures/class/methods/output.js +++ b/packages/babel-plugin-transform-typescript/test/fixtures/class/methods/output.js @@ -1,4 +1,6 @@ class C { m(x, ...y) {} + constructor() {} + } diff --git a/packages/babel-plugin-transform-typescript/test/fixtures/class/properties/input.ts b/packages/babel-plugin-transform-typescript/test/fixtures/class/properties/input.ts index abb53ac69bc3..b59f26e0c387 100644 --- a/packages/babel-plugin-transform-typescript/test/fixtures/class/properties/input.ts +++ b/packages/babel-plugin-transform-typescript/test/fixtures/class/properties/input.ts @@ -1,7 +1,8 @@ class C { public a?: number; private b: number = 0; - readonly c!: number = 1; + readonly c: number = 1; @foo d: number; @foo e: number = 3; + f!: number; } diff --git a/packages/babel-plugin-transform-typescript/test/fixtures/class/transform-properties-declare-wrong-order/input.ts b/packages/babel-plugin-transform-typescript/test/fixtures/class/transform-properties-declare-wrong-order/input.ts new file mode 100644 index 000000000000..afc220470140 --- /dev/null +++ b/packages/babel-plugin-transform-typescript/test/fixtures/class/transform-properties-declare-wrong-order/input.ts @@ -0,0 +1,4 @@ +class A { + declare x; + y; +} \ No newline at end of file diff --git a/packages/babel-plugin-transform-typescript/test/fixtures/class/transform-properties-declare-wrong-order/options.json b/packages/babel-plugin-transform-typescript/test/fixtures/class/transform-properties-declare-wrong-order/options.json new file mode 100644 index 000000000000..8a07f1cc2003 --- /dev/null +++ b/packages/babel-plugin-transform-typescript/test/fixtures/class/transform-properties-declare-wrong-order/options.json @@ -0,0 +1,7 @@ +{ + "plugins": [ + "proposal-class-properties", + ["transform-typescript", { "allowDeclareFields": true }] + ], + "throws": "TypeScript 'declare' fields must first be transformed by @babel/plugin-transform-typescript.\nIf you have already enabled that plugin (or '@babel/preset-typescript'), make sure that it runs before any plugin related to additional class features:\n - @babel/plugin-proposal-class-properties\n - @babel/plugin-proposal-private-methods\n - @babel/plugin-proposal-decorators" +} diff --git a/packages/babel-plugin-transform-typescript/test/fixtures/class/transform-properties-declare/input.ts b/packages/babel-plugin-transform-typescript/test/fixtures/class/transform-properties-declare/input.ts new file mode 100644 index 000000000000..afc220470140 --- /dev/null +++ b/packages/babel-plugin-transform-typescript/test/fixtures/class/transform-properties-declare/input.ts @@ -0,0 +1,4 @@ +class A { + declare x; + y; +} \ No newline at end of file diff --git a/packages/babel-plugin-transform-typescript/test/fixtures/class/transform-properties-declare/options.json b/packages/babel-plugin-transform-typescript/test/fixtures/class/transform-properties-declare/options.json new file mode 100644 index 000000000000..832ece64097b --- /dev/null +++ b/packages/babel-plugin-transform-typescript/test/fixtures/class/transform-properties-declare/options.json @@ -0,0 +1,6 @@ +{ + "plugins": [ + ["transform-typescript", { "allowDeclareFields": true }], + "proposal-class-properties" + ] +} diff --git a/packages/babel-plugin-transform-typescript/test/fixtures/class/transform-properties-declare/output.js b/packages/babel-plugin-transform-typescript/test/fixtures/class/transform-properties-declare/output.js new file mode 100644 index 000000000000..44b56f160013 --- /dev/null +++ b/packages/babel-plugin-transform-typescript/test/fixtures/class/transform-properties-declare/output.js @@ -0,0 +1,8 @@ +function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } + +class A { + constructor() { + _defineProperty(this, "y", void 0); + } + +} diff --git a/packages/babel-plugin-transform-typescript/test/fixtures/class/uninitialized-definite-with-declare-enabled/input.ts b/packages/babel-plugin-transform-typescript/test/fixtures/class/uninitialized-definite-with-declare-enabled/input.ts new file mode 100644 index 000000000000..4bb8da7936c6 --- /dev/null +++ b/packages/babel-plugin-transform-typescript/test/fixtures/class/uninitialized-definite-with-declare-enabled/input.ts @@ -0,0 +1,3 @@ +class A { + x!; +} \ No newline at end of file diff --git a/packages/babel-plugin-transform-typescript/test/fixtures/class/uninitialized-definite-with-declare-enabled/options.json b/packages/babel-plugin-transform-typescript/test/fixtures/class/uninitialized-definite-with-declare-enabled/options.json new file mode 100644 index 000000000000..a6d406a50e49 --- /dev/null +++ b/packages/babel-plugin-transform-typescript/test/fixtures/class/uninitialized-definite-with-declare-enabled/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["transform-typescript", { "allowDeclareFields": true }]] +} diff --git a/packages/babel-plugin-transform-typescript/test/fixtures/class/uninitialized-definite-with-declare-enabled/output.js b/packages/babel-plugin-transform-typescript/test/fixtures/class/uninitialized-definite-with-declare-enabled/output.js new file mode 100644 index 000000000000..a869c2849526 --- /dev/null +++ b/packages/babel-plugin-transform-typescript/test/fixtures/class/uninitialized-definite-with-declare-enabled/output.js @@ -0,0 +1 @@ +class A {} diff --git a/packages/babel-plugin-transform-typescript/test/fixtures/enum/string-value-template/input.ts b/packages/babel-plugin-transform-typescript/test/fixtures/enum/string-value-template/input.ts new file mode 100644 index 000000000000..01086419eaff --- /dev/null +++ b/packages/babel-plugin-transform-typescript/test/fixtures/enum/string-value-template/input.ts @@ -0,0 +1,3 @@ +enum E { + A = `Hey` +} diff --git a/packages/babel-plugin-transform-typescript/test/fixtures/enum/string-value-template/output.js b/packages/babel-plugin-transform-typescript/test/fixtures/enum/string-value-template/output.js new file mode 100644 index 000000000000..dfc0f72fcd49 --- /dev/null +++ b/packages/babel-plugin-transform-typescript/test/fixtures/enum/string-value-template/output.js @@ -0,0 +1,5 @@ +var E; + +(function (E) { + E["A"] = "Hey"; +})(E || (E = {})); diff --git a/packages/babel-plugin-transform-typescript/test/fixtures/enum/string-values/input.ts b/packages/babel-plugin-transform-typescript/test/fixtures/enum/string-value/input.ts similarity index 100% rename from packages/babel-plugin-transform-typescript/test/fixtures/enum/string-values/input.ts rename to packages/babel-plugin-transform-typescript/test/fixtures/enum/string-value/input.ts diff --git a/packages/babel-plugin-transform-typescript/test/fixtures/enum/string-values/output.js b/packages/babel-plugin-transform-typescript/test/fixtures/enum/string-value/output.js similarity index 100% rename from packages/babel-plugin-transform-typescript/test/fixtures/enum/string-values/output.js rename to packages/babel-plugin-transform-typescript/test/fixtures/enum/string-value/output.js diff --git a/packages/babel-plugin-transform-typescript/test/fixtures/enum/string-values-computed/input.ts b/packages/babel-plugin-transform-typescript/test/fixtures/enum/string-values-computed/input.ts index ac52806fb927..06e9b00f0682 100644 --- a/packages/babel-plugin-transform-typescript/test/fixtures/enum/string-values-computed/input.ts +++ b/packages/babel-plugin-transform-typescript/test/fixtures/enum/string-values-computed/input.ts @@ -1,4 +1,3 @@ -// Not type-correct code enum E { A = "HALLO" + "WERLD" } diff --git a/packages/babel-plugin-transform-typescript/test/fixtures/enum/string-values-computed/output.js b/packages/babel-plugin-transform-typescript/test/fixtures/enum/string-values-computed/output.js index e449a1ca233d..a0f3ea2ca81f 100644 --- a/packages/babel-plugin-transform-typescript/test/fixtures/enum/string-values-computed/output.js +++ b/packages/babel-plugin-transform-typescript/test/fixtures/enum/string-values-computed/output.js @@ -1,6 +1,5 @@ -// Not type-correct code var E; (function (E) { - E[E["A"] = "HALLO" + "WERLD"] = "A"; + E["A"] = "HALLOWERLD"; })(E || (E = {})); diff --git a/packages/babel-plugin-transform-typescript/test/fixtures/function/overloads-exports/input.mjs b/packages/babel-plugin-transform-typescript/test/fixtures/function/overloads-exports/input.mjs new file mode 100644 index 000000000000..d2e9958f6aaf --- /dev/null +++ b/packages/babel-plugin-transform-typescript/test/fixtures/function/overloads-exports/input.mjs @@ -0,0 +1,4 @@ +function f(): void; +function f(): void { +} +export { f } \ No newline at end of file diff --git a/packages/babel-plugin-transform-typescript/test/fixtures/function/overloads-exports/options.json b/packages/babel-plugin-transform-typescript/test/fixtures/function/overloads-exports/options.json new file mode 100644 index 000000000000..d5e8a7e4201b --- /dev/null +++ b/packages/babel-plugin-transform-typescript/test/fixtures/function/overloads-exports/options.json @@ -0,0 +1,4 @@ +{ + "plugins": ["transform-typescript"], + "sourceType": "module" +} diff --git a/packages/babel-plugin-transform-typescript/test/fixtures/function/overloads-exports/output.mjs b/packages/babel-plugin-transform-typescript/test/fixtures/function/overloads-exports/output.mjs new file mode 100644 index 000000000000..a7997dca3a66 --- /dev/null +++ b/packages/babel-plugin-transform-typescript/test/fixtures/function/overloads-exports/output.mjs @@ -0,0 +1,3 @@ +function f() {} + +export { f }; diff --git a/packages/babel-plugin-transform-typescript/test/fixtures/regression/10338/input.ts b/packages/babel-plugin-transform-typescript/test/fixtures/regression/10338/input.ts new file mode 100644 index 000000000000..36a5d899a6e1 --- /dev/null +++ b/packages/babel-plugin-transform-typescript/test/fixtures/regression/10338/input.ts @@ -0,0 +1,4 @@ +const {result} = idArray.reduce( + (a, b) => {}, + {result: [] as (number | bigint)[]}, +) \ No newline at end of file diff --git a/packages/babel-plugin-transform-typescript/test/fixtures/regression/10338/options.json b/packages/babel-plugin-transform-typescript/test/fixtures/regression/10338/options.json new file mode 100644 index 000000000000..c22d3cb0914c --- /dev/null +++ b/packages/babel-plugin-transform-typescript/test/fixtures/regression/10338/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["transform-typescript", "transform-destructuring"] +} diff --git a/packages/babel-plugin-transform-typescript/test/fixtures/regression/10338/output.js b/packages/babel-plugin-transform-typescript/test/fixtures/regression/10338/output.js new file mode 100644 index 000000000000..20db22353cb9 --- /dev/null +++ b/packages/babel-plugin-transform-typescript/test/fixtures/regression/10338/output.js @@ -0,0 +1,4 @@ +const _idArray$reduce = idArray.reduce((a, b) => {}, { + result: [] +}), + result = _idArray$reduce.result; diff --git a/packages/babel-plugin-transform-unicode-regex/package.json b/packages/babel-plugin-transform-unicode-regex/package.json index 32610f9c7d4b..458fe89d0798 100644 --- a/packages/babel-plugin-transform-unicode-regex/package.json +++ b/packages/babel-plugin-transform-unicode-regex/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-transform-unicode-regex", - "version": "7.4.4", + "version": "7.8.3", "description": "Compile ES2015 Unicode regex to ES5", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-unicode-regex", "license": "MIT", @@ -12,15 +12,14 @@ "babel-plugin" ], "dependencies": { - "@babel/helper-plugin-utils": "^7.0.0", - "@babel/helper-regex": "^7.4.4", - "regexpu-core": "^4.5.4" + "@babel/helper-create-regexp-features-plugin": "^7.8.3", + "@babel/helper-plugin-utils": "^7.8.3" }, "peerDependencies": { "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.4.4", - "@babel/helper-plugin-test-runner": "^7.0.0" + "@babel/core": "^7.8.3", + "@babel/helper-plugin-test-runner": "^7.8.3" } } diff --git a/packages/babel-plugin-transform-unicode-regex/src/index.js b/packages/babel-plugin-transform-unicode-regex/src/index.js index 88593e055917..cfc4cd8a40f2 100644 --- a/packages/babel-plugin-transform-unicode-regex/src/index.js +++ b/packages/babel-plugin-transform-unicode-regex/src/index.js @@ -1,19 +1,12 @@ +/* eslint-disable @babel/development/plugin-name */ +import { createRegExpFeaturePlugin } from "@babel/helper-create-regexp-features-plugin"; import { declare } from "@babel/helper-plugin-utils"; -import rewritePattern from "regexpu-core"; -import * as regex from "@babel/helper-regex"; export default declare(api => { api.assertVersion(7); - return { + return createRegExpFeaturePlugin({ name: "transform-unicode-regex", - - visitor: { - RegExpLiteral({ node }) { - if (!regex.is(node, "u")) return; - node.pattern = rewritePattern(node.pattern, node.flags); - regex.pullFlag(node, "u"); - }, - }, - }; + feature: "unicodeFlag", + }); }); diff --git a/packages/babel-polyfill/package.json b/packages/babel-polyfill/package.json index 9fb6d4b92eea..9a8834bb0fdc 100644 --- a/packages/babel-polyfill/package.json +++ b/packages/babel-polyfill/package.json @@ -1,6 +1,6 @@ { "name": "@babel/polyfill", - "version": "7.4.4", + "version": "7.8.3", "description": "Provides polyfills necessary for a full ES2015+ environment", "author": "Sebastian McKenzie ", "homepage": "https://babeljs.io/", @@ -8,6 +8,10 @@ "publishConfig": { "access": "public" }, + "scripts": { + "prepublishOnly": "cp dist/polyfill.min.js browser.js", + "postpublish": "rm browser.js" + }, "repository": "https://github.com/babel/babel/tree/master/packages/babel-polyfill", "main": "lib/index.js", "dependencies": { diff --git a/packages/babel-polyfill/scripts/build-dist.sh b/packages/babel-polyfill/scripts/build-dist.sh index db5b2bd2ed0a..0128c59321c6 100755 --- a/packages/babel-polyfill/scripts/build-dist.sh +++ b/packages/babel-polyfill/scripts/build-dist.sh @@ -12,6 +12,6 @@ node $BROWSERIFY_CMD lib/index.js \ --plugin derequire/plugin \ >dist/polyfill.js node $UGLIFY_CMD dist/polyfill.js \ - --compress keep_fnames,keep_fargs,warnings=false \ + --compress keep_fnames,keep_fargs \ --mangle keep_fnames \ >dist/polyfill.min.js diff --git a/packages/babel-polyfill/scripts/postpublish.js b/packages/babel-polyfill/scripts/postpublish.js deleted file mode 100644 index 57a59218c810..000000000000 --- a/packages/babel-polyfill/scripts/postpublish.js +++ /dev/null @@ -1,8 +0,0 @@ -"use strict"; - -const fs = require("fs"); -const path = require("path"); - -try { - fs.unlinkSync(path.join(__dirname, "../browser.js")); -} catch (err) {} diff --git a/packages/babel-polyfill/scripts/prepublish.js b/packages/babel-polyfill/scripts/prepublish.js deleted file mode 100644 index 84276779f950..000000000000 --- a/packages/babel-polyfill/scripts/prepublish.js +++ /dev/null @@ -1,13 +0,0 @@ -"use strict"; - -const fs = require("fs"); -const path = require("path"); - -function relative(loc) { - return path.join(__dirname, "..", loc); -} - -fs.writeFileSync( - relative("browser.js"), - fs.readFileSync(relative("dist/polyfill.min.js")) -); diff --git a/packages/babel-preset-env-standalone/README.md b/packages/babel-preset-env-standalone/README.md index 61352bcac5a3..e4de61fa68de 100644 --- a/packages/babel-preset-env-standalone/README.md +++ b/packages/babel-preset-env-standalone/README.md @@ -1,6 +1,6 @@ # @babel/preset-env-standalone -> Standalone build of babel-prest-env for use in non-Node.js environments. +> Standalone build of babel-preset-env for use in non-Node.js environments. See our website [@babel/preset-env-standalone](https://babeljs.io/docs/en/next/babel-preset-env-standalone.html) for more information. diff --git a/packages/babel-preset-env-standalone/package.json b/packages/babel-preset-env-standalone/package.json index 410419bb4d58..eea41b28bd8b 100644 --- a/packages/babel-preset-env-standalone/package.json +++ b/packages/babel-preset-env-standalone/package.json @@ -1,20 +1,29 @@ { "name": "@babel/preset-env-standalone", - "version": "7.5.5", - "description": "Standalone build of babel-prest-env for use in non-Node.js environments.", + "version": "7.8.3", + "description": "Standalone build of babel-preset-env for use in non-Node.js environments.", "main": "babel-preset-env.js", "files": [ "babel-preset-env.js", - "babel-preset-env.min.js", - "src" + "babel-preset-env.min.js" ], + "scripts": { + "prepublishOnly": "cd ../.. && make prepublish-build-preset-env-standalone" + }, "devDependencies": { - "@babel/plugin-proposal-dynamic-import": "^7.5.0", - "@babel/plugin-proposal-json-strings": "^7.0.0", - "@babel/plugin-transform-named-capturing-groups-regex": "^7.4.5", - "@babel/plugin-transform-new-target": "^7.4.4", - "@babel/preset-env": "^7.5.5", - "@babel/standalone": "^7.5.5" + "@babel/plugin-proposal-dynamic-import": "^7.8.3", + "@babel/plugin-proposal-json-strings": "^7.8.3", + "@babel/plugin-proposal-nullish-coalescing-operator": "^7.8.3", + "@babel/plugin-proposal-optional-chaining": "^7.8.3", + "@babel/plugin-syntax-json-strings": "^7.8.0", + "@babel/plugin-syntax-nullish-coalescing-operator": "^7.8.0", + "@babel/plugin-syntax-optional-chaining": "^7.8.0", + "@babel/plugin-syntax-top-level-await": "^7.8.3", + "@babel/plugin-transform-named-capturing-groups-regex": "^7.8.3", + "@babel/plugin-transform-new-target": "^7.8.3", + "@babel/preset-env": "^7.8.3", + "@babel/standalone": "^7.8.3", + "lodash": "^4.17.13" }, "keywords": [ "babel", diff --git a/packages/babel-preset-env-standalone/scripts/prepublish.js b/packages/babel-preset-env-standalone/scripts/prepublish.js deleted file mode 100644 index bff650fb032d..000000000000 --- a/packages/babel-preset-env-standalone/scripts/prepublish.js +++ /dev/null @@ -1,11 +0,0 @@ -// This file is executed by lerna before publishing, -// @babel/preset-env-standalone so that it has the -// new version and not the old one. - -require("child_process").execSync( - "make prepublish-build-preset-env-standalone", - { - cwd: require("path").resolve(__dirname, "../../.."), - stdio: "inherit", - } -); diff --git a/packages/babel-preset-env-standalone/src/available-plugins.js b/packages/babel-preset-env-standalone/src/available-plugins.js index 9d9e68640234..bb66ed7777ec 100644 --- a/packages/babel-preset-env-standalone/src/available-plugins.js +++ b/packages/babel-preset-env-standalone/src/available-plugins.js @@ -1,10 +1,28 @@ +/* eslint sort-keys: "error" */ + import { availablePlugins, registerPlugin } from "@babel/standalone"; +import proposalJsonStrings from "@babel/plugin-proposal-json-strings"; +import proposalDynamicImport from "@babel/plugin-proposal-dynamic-import"; +import proposalNullishCoalescingOperator from "@babel/plugin-proposal-nullish-coalescing-operator"; +import proposalOptionalChaining from "@babel/plugin-proposal-optional-chaining"; +import syntaxJsonStrings from "@babel/plugin-syntax-json-strings"; +import syntaxNullishCoalescingOperator from "@babel/plugin-syntax-nullish-coalescing-operator"; +import syntaxOptionalChaining from "@babel/plugin-syntax-nullish-coalescing-operator"; +import syntaxTopLevelAwait from "@babel/plugin-syntax-top-level-await"; +import transformNamedCapturingGroupsRegex from "@babel/plugin-transform-named-capturing-groups-regex"; +import transformNewTarget from "@babel/plugin-transform-new-target"; const notIncludedPlugins = { - "transform-named-capturing-groups-regex": require("@babel/plugin-transform-named-capturing-groups-regex"), - "transform-new-target": require("@babel/plugin-transform-new-target"), - "proposal-json-strings": require("@babel/plugin-proposal-json-strings"), - "proposal-dynamic-import": require("@babel/plugin-proposal-dynamic-import"), + "proposal-dynamic-import": proposalDynamicImport, + "proposal-json-strings": proposalJsonStrings, + "proposal-nullish-coalescing-operator": proposalNullishCoalescingOperator, + "proposal-optional-chaining": proposalOptionalChaining, + "syntax-json-strings": syntaxJsonStrings, + "syntax-nullish-coalescing-operator": syntaxNullishCoalescingOperator, + "syntax-optional-chaining": syntaxOptionalChaining, + "syntax-top-level-await": syntaxTopLevelAwait, + "transform-named-capturing-groups-regex": transformNamedCapturingGroupsRegex, + "transform-new-target": transformNewTarget, }; Object.keys(notIncludedPlugins).forEach(pluginName => { diff --git a/packages/babel-preset-env-standalone/test/available-plugins.js b/packages/babel-preset-env-standalone/test/available-plugins.js new file mode 100644 index 000000000000..bfaa76beac53 --- /dev/null +++ b/packages/babel-preset-env-standalone/test/available-plugins.js @@ -0,0 +1,19 @@ +import expectedAvailablePlugins from "@babel/preset-env/lib/available-plugins"; +import difference from "lodash/difference"; + +// build-babel-preset-env-standalone in CI coverage tests is skipped, so we skip this test as well +(process.env.TEST_TYPE === "cov" ? describe.skip : describe)( + "available-plugins", + () => { + const actualAvailablePlugins = require("../lib/available-plugins").default; + it("should be a superset of available-plugins in @babel/preset-env", () => { + const expectedPluginList = Object.keys(expectedAvailablePlugins); + expectedPluginList.sort(); + + const actualPluginList = Object.keys(actualAvailablePlugins); + actualPluginList.sort(); + // If this test is failed, add the missing plugins to ./src/available-plugins + expect(difference(expectedPluginList, actualPluginList)).toEqual([]); + }); + }, +); diff --git a/packages/babel-preset-env-standalone/test/babel-preset-env.js b/packages/babel-preset-env-standalone/test/babel-preset-env.js index 6ecd097b1404..d1d2600ca362 100644 --- a/packages/babel-preset-env-standalone/test/babel-preset-env.js +++ b/packages/babel-preset-env-standalone/test/babel-preset-env.js @@ -1,3 +1,4 @@ +// build-babel-standalone in CI coverage tests is skipped, so we skip this test as well (process.env.TEST_TYPE === "cov" ? describe.skip : describe)( "babel-preset-env-standalone", () => { diff --git a/packages/babel-preset-env/.gitignore b/packages/babel-preset-env/.gitignore index b8733fbb9848..8f638248faad 100644 --- a/packages/babel-preset-env/.gitignore +++ b/packages/babel-preset-env/.gitignore @@ -8,3 +8,4 @@ test/tmp .nyc_output tmp babel-preset-env-*.tgz +/build diff --git a/packages/babel-preset-env/.npmignore b/packages/babel-preset-env/.npmignore index 40425577dea0..e843712b4ea6 100644 --- a/packages/babel-preset-env/.npmignore +++ b/packages/babel-preset-env/.npmignore @@ -15,3 +15,4 @@ babel-preset-env-*.tgz flow-typed .github .idea +/build diff --git a/packages/babel-preset-env/CONTRIBUTING.md b/packages/babel-preset-env/CONTRIBUTING.md index de861d996e6d..64cce1dfe1d5 100644 --- a/packages/babel-preset-env/CONTRIBUTING.md +++ b/packages/babel-preset-env/CONTRIBUTING.md @@ -2,7 +2,7 @@ ## Adding a new plugin or polyfill to support (when approved in the next ECMAScript version) -### Update [`plugin-features.js`](https://github.com/babel/babel/blob/master/packages/babel-preset-env/data/plugin-features.js) +### Update [`plugin-features.js`](https://github.com/babel/babel/blob/master/packages/babel-compat-data/scripts/data/plugin-features.js) *Example:* @@ -63,9 +63,9 @@ If you want to mark a new proposal as shipped, add it to [this list](https://git ### Update [`plugins.json`](https://github.com/babel/babel/blob/master/packages/babel-preset-env/data/plugins.json) -Until `compat-table` is a standalone npm module for data we are using the git url +Until `compat-table` is a standalone npm module for data we are using the git commit in `scripts/download-compat-table.sh` -`"compat-table": "kangax/compat-table#[latest-commit-hash]"`, +`COMPAT_TABLE_COMMIT=[latest-commit-hash]`, So we update and then run `npm run build-data`. If there are no changes, then `plugins.json` will be the same. diff --git a/packages/babel-preset-env/data/built-in-modules.js b/packages/babel-preset-env/data/built-in-modules.js new file mode 100644 index 000000000000..161ddb8ea7ab --- /dev/null +++ b/packages/babel-preset-env/data/built-in-modules.js @@ -0,0 +1,3 @@ +// TODO: Remove in Babel 8 + +module.exports = require("@babel/compat-data/native-modules"); diff --git a/packages/babel-preset-env/data/built-in-modules.json.js b/packages/babel-preset-env/data/built-in-modules.json.js new file mode 100644 index 000000000000..161ddb8ea7ab --- /dev/null +++ b/packages/babel-preset-env/data/built-in-modules.json.js @@ -0,0 +1,3 @@ +// TODO: Remove in Babel 8 + +module.exports = require("@babel/compat-data/native-modules"); diff --git a/packages/babel-preset-env/data/built-ins.js b/packages/babel-preset-env/data/built-ins.js new file mode 100644 index 000000000000..38f8a09add7a --- /dev/null +++ b/packages/babel-preset-env/data/built-ins.js @@ -0,0 +1,4 @@ +// TODO: Remove in Babel 8 +// https://github.com/vuejs/vue-cli/issues/3671 + +module.exports = require("./corejs2-built-ins.json"); diff --git a/packages/babel-preset-env/data/corejs2-built-ins.js b/packages/babel-preset-env/data/corejs2-built-ins.js new file mode 100644 index 000000000000..486f3b1e1b2a --- /dev/null +++ b/packages/babel-preset-env/data/corejs2-built-ins.js @@ -0,0 +1,3 @@ +// TODO: Remove in Babel 8 + +module.exports = require("@babel/compat-data/corejs2-built-ins"); diff --git a/packages/babel-preset-env/data/corejs2-built-ins.json.js b/packages/babel-preset-env/data/corejs2-built-ins.json.js new file mode 100644 index 000000000000..486f3b1e1b2a --- /dev/null +++ b/packages/babel-preset-env/data/corejs2-built-ins.json.js @@ -0,0 +1,3 @@ +// TODO: Remove in Babel 8 + +module.exports = require("@babel/compat-data/corejs2-built-ins"); diff --git a/packages/babel-preset-env/data/plugins.js b/packages/babel-preset-env/data/plugins.js new file mode 100644 index 000000000000..b5d6b4361f10 --- /dev/null +++ b/packages/babel-preset-env/data/plugins.js @@ -0,0 +1,3 @@ +// TODO: Remove in Babel 8 + +module.exports = require("@babel/compat-data/plugins"); diff --git a/packages/babel-preset-env/data/plugins.json.js b/packages/babel-preset-env/data/plugins.json.js new file mode 100644 index 000000000000..b5d6b4361f10 --- /dev/null +++ b/packages/babel-preset-env/data/plugins.json.js @@ -0,0 +1,3 @@ +// TODO: Remove in Babel 8 + +module.exports = require("@babel/compat-data/plugins"); diff --git a/packages/babel-preset-env/data/shipped-proposals.js b/packages/babel-preset-env/data/shipped-proposals.js index 90864b6c94b6..c2dff4cb96ec 100644 --- a/packages/babel-preset-env/data/shipped-proposals.js +++ b/packages/babel-preset-env/data/shipped-proposals.js @@ -1,14 +1,24 @@ +/* eslint sort-keys: "error" */ // These mappings represent the syntax proposals that have been // shipped by browsers, and are enabled by the `shippedProposals` option. const proposalPlugins = {}; -const pluginSyntaxMap = new Map([ - ["proposal-async-generator-functions", "syntax-async-generators"], - ["proposal-object-rest-spread", "syntax-object-rest-spread"], - ["proposal-optional-catch-binding", "syntax-optional-catch-binding"], - ["proposal-unicode-property-regex", null], - ["proposal-json-strings", "syntax-json-strings"], -]); +// use intermediary object to enforce alphabetical key order +const pluginSyntaxObject = { + "proposal-async-generator-functions": "syntax-async-generators", + "proposal-json-strings": "syntax-json-strings", + "proposal-nullish-coalescing-operator": "syntax-nullish-coalescing-operator", + "proposal-object-rest-spread": "syntax-object-rest-spread", + "proposal-optional-catch-binding": "syntax-optional-catch-binding", + "proposal-optional-chaining": "syntax-optional-chaining", + "proposal-unicode-property-regex": null, +}; -module.exports = { proposalPlugins, pluginSyntaxMap }; +const pluginSyntaxEntries = Object.keys(pluginSyntaxObject).map(function (key) { + return [key, pluginSyntaxObject[key]]; +}); + +const pluginSyntaxMap = new Map(pluginSyntaxEntries); + +module.exports = { pluginSyntaxMap, proposalPlugins }; diff --git a/packages/babel-preset-env/data/unreleased-labels.js b/packages/babel-preset-env/data/unreleased-labels.js index bc5130567d2f..112d859930d8 100644 --- a/packages/babel-preset-env/data/unreleased-labels.js +++ b/packages/babel-preset-env/data/unreleased-labels.js @@ -1,3 +1,3 @@ -module.exports = { - safari: "tp", -}; +// TODO: Remove in Babel 8 + +module.exports = require("@babel/helper-compilation-targets").unreleasedLabels; diff --git a/packages/babel-preset-env/package.json b/packages/babel-preset-env/package.json index 0e4230400a87..ef176475b633 100644 --- a/packages/babel-preset-env/package.json +++ b/packages/babel-preset-env/package.json @@ -1,6 +1,6 @@ { "name": "@babel/preset-env", - "version": "7.5.5", + "version": "7.8.3", "description": "A Babel preset for each environment.", "author": "Henry Zhu ", "homepage": "https://babeljs.io/", @@ -10,72 +10,73 @@ }, "repository": "https://github.com/babel/babel/tree/master/packages/babel-preset-env", "main": "lib/index.js", - "scripts": { - "build-data": "node ./scripts/build-data.js; node ./scripts/build-modules-support.js" - }, "dependencies": { - "@babel/helper-module-imports": "^7.0.0", - "@babel/helper-plugin-utils": "^7.0.0", - "@babel/plugin-proposal-async-generator-functions": "^7.2.0", - "@babel/plugin-proposal-dynamic-import": "^7.5.0", - "@babel/plugin-proposal-json-strings": "^7.2.0", - "@babel/plugin-proposal-object-rest-spread": "^7.5.5", - "@babel/plugin-proposal-optional-catch-binding": "^7.2.0", - "@babel/plugin-proposal-unicode-property-regex": "^7.4.4", - "@babel/plugin-syntax-async-generators": "^7.2.0", - "@babel/plugin-syntax-dynamic-import": "^7.2.0", - "@babel/plugin-syntax-json-strings": "^7.2.0", - "@babel/plugin-syntax-object-rest-spread": "^7.2.0", - "@babel/plugin-syntax-optional-catch-binding": "^7.2.0", - "@babel/plugin-transform-arrow-functions": "^7.2.0", - "@babel/plugin-transform-async-to-generator": "^7.5.0", - "@babel/plugin-transform-block-scoped-functions": "^7.2.0", - "@babel/plugin-transform-block-scoping": "^7.5.5", - "@babel/plugin-transform-classes": "^7.5.5", - "@babel/plugin-transform-computed-properties": "^7.2.0", - "@babel/plugin-transform-destructuring": "^7.5.0", - "@babel/plugin-transform-dotall-regex": "^7.4.4", - "@babel/plugin-transform-duplicate-keys": "^7.5.0", - "@babel/plugin-transform-exponentiation-operator": "^7.2.0", - "@babel/plugin-transform-for-of": "^7.4.4", - "@babel/plugin-transform-function-name": "^7.4.4", - "@babel/plugin-transform-literals": "^7.2.0", - "@babel/plugin-transform-member-expression-literals": "^7.2.0", - "@babel/plugin-transform-modules-amd": "^7.5.0", - "@babel/plugin-transform-modules-commonjs": "^7.5.0", - "@babel/plugin-transform-modules-systemjs": "^7.5.0", - "@babel/plugin-transform-modules-umd": "^7.2.0", - "@babel/plugin-transform-named-capturing-groups-regex": "^7.4.5", - "@babel/plugin-transform-new-target": "^7.4.4", - "@babel/plugin-transform-object-super": "^7.5.5", - "@babel/plugin-transform-parameters": "^7.4.4", - "@babel/plugin-transform-property-literals": "^7.2.0", - "@babel/plugin-transform-regenerator": "^7.4.5", - "@babel/plugin-transform-reserved-words": "^7.2.0", - "@babel/plugin-transform-shorthand-properties": "^7.2.0", - "@babel/plugin-transform-spread": "^7.2.0", - "@babel/plugin-transform-sticky-regex": "^7.2.0", - "@babel/plugin-transform-template-literals": "^7.4.4", - "@babel/plugin-transform-typeof-symbol": "^7.2.0", - "@babel/plugin-transform-unicode-regex": "^7.4.4", - "@babel/types": "^7.5.5", - "browserslist": "^4.6.0", - "core-js-compat": "^3.1.1", + "@babel/compat-data": "^7.8.0", + "@babel/helper-compilation-targets": "^7.8.3", + "@babel/helper-module-imports": "^7.8.3", + "@babel/helper-plugin-utils": "^7.8.3", + "@babel/plugin-proposal-async-generator-functions": "^7.8.3", + "@babel/plugin-proposal-dynamic-import": "^7.8.3", + "@babel/plugin-proposal-json-strings": "^7.8.3", + "@babel/plugin-proposal-nullish-coalescing-operator": "^7.8.3", + "@babel/plugin-proposal-object-rest-spread": "^7.8.3", + "@babel/plugin-proposal-optional-catch-binding": "^7.8.3", + "@babel/plugin-proposal-optional-chaining": "^7.8.3", + "@babel/plugin-proposal-unicode-property-regex": "^7.8.3", + "@babel/plugin-syntax-async-generators": "^7.8.0", + "@babel/plugin-syntax-dynamic-import": "^7.8.0", + "@babel/plugin-syntax-json-strings": "^7.8.0", + "@babel/plugin-syntax-nullish-coalescing-operator": "^7.8.0", + "@babel/plugin-syntax-object-rest-spread": "^7.8.0", + "@babel/plugin-syntax-optional-catch-binding": "^7.8.0", + "@babel/plugin-syntax-optional-chaining": "^7.8.0", + "@babel/plugin-syntax-top-level-await": "^7.8.3", + "@babel/plugin-transform-arrow-functions": "^7.8.3", + "@babel/plugin-transform-async-to-generator": "^7.8.3", + "@babel/plugin-transform-block-scoped-functions": "^7.8.3", + "@babel/plugin-transform-block-scoping": "^7.8.3", + "@babel/plugin-transform-classes": "^7.8.3", + "@babel/plugin-transform-computed-properties": "^7.8.3", + "@babel/plugin-transform-destructuring": "^7.8.3", + "@babel/plugin-transform-dotall-regex": "^7.8.3", + "@babel/plugin-transform-duplicate-keys": "^7.8.3", + "@babel/plugin-transform-exponentiation-operator": "^7.8.3", + "@babel/plugin-transform-for-of": "^7.8.3", + "@babel/plugin-transform-function-name": "^7.8.3", + "@babel/plugin-transform-literals": "^7.8.3", + "@babel/plugin-transform-member-expression-literals": "^7.8.3", + "@babel/plugin-transform-modules-amd": "^7.8.3", + "@babel/plugin-transform-modules-commonjs": "^7.8.3", + "@babel/plugin-transform-modules-systemjs": "^7.8.3", + "@babel/plugin-transform-modules-umd": "^7.8.3", + "@babel/plugin-transform-named-capturing-groups-regex": "^7.8.3", + "@babel/plugin-transform-new-target": "^7.8.3", + "@babel/plugin-transform-object-super": "^7.8.3", + "@babel/plugin-transform-parameters": "^7.8.3", + "@babel/plugin-transform-property-literals": "^7.8.3", + "@babel/plugin-transform-regenerator": "^7.8.3", + "@babel/plugin-transform-reserved-words": "^7.8.3", + "@babel/plugin-transform-shorthand-properties": "^7.8.3", + "@babel/plugin-transform-spread": "^7.8.3", + "@babel/plugin-transform-sticky-regex": "^7.8.3", + "@babel/plugin-transform-template-literals": "^7.8.3", + "@babel/plugin-transform-typeof-symbol": "^7.8.3", + "@babel/plugin-transform-unicode-regex": "^7.8.3", + "@babel/types": "^7.8.3", + "browserslist": "^4.8.2", + "core-js-compat": "^3.6.2", "invariant": "^2.2.2", - "js-levenshtein": "^1.1.3", + "levenary": "^1.1.0", "semver": "^5.5.0" }, "peerDependencies": { "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/cli": "^7.5.5", - "@babel/core": "^7.5.5", - "@babel/helper-fixtures": "^7.5.5", - "@babel/helper-plugin-test-runner": "^7.0.0", - "@babel/plugin-syntax-dynamic-import": "^7.2.0", - "caniuse-db": "1.0.30000969", - "compat-table": "kangax/compat-table#071b478a44694cbf72a78db8ab39189c5ae31b2c", - "electron-to-chromium": "1.3.113" + "@babel/cli": "^7.8.3", + "@babel/core": "^7.8.3", + "@babel/helper-fixtures": "^7.8.3", + "@babel/helper-plugin-test-runner": "^7.8.3", + "@babel/plugin-syntax-dynamic-import": "^7.2.0" } } diff --git a/packages/babel-preset-env/src/available-plugins.js b/packages/babel-preset-env/src/available-plugins.js index 77da4ff02cf0..d9a2a3da9608 100644 --- a/packages/babel-preset-env/src/available-plugins.js +++ b/packages/babel-preset-env/src/available-plugins.js @@ -1,46 +1,100 @@ // @flow +/* eslint sort-keys: "error" */ + +import syntaxAsyncGenerators from "@babel/plugin-syntax-async-generators"; +import syntaxDynamicImport from "@babel/plugin-syntax-dynamic-import"; +import syntaxJsonStrings from "@babel/plugin-syntax-json-strings"; +import syntaxNullishCoalescingOperator from "@babel/plugin-syntax-nullish-coalescing-operator"; +import syntaxObjectRestSpread from "@babel/plugin-syntax-object-rest-spread"; +import syntaxOptionalCatchBinding from "@babel/plugin-syntax-optional-catch-binding"; +import syntaxOptionalChaining from "@babel/plugin-syntax-optional-chaining"; +import syntaxTopLevelAwait from "@babel/plugin-syntax-top-level-await"; +import proposalAsyncGeneratorFunctions from "@babel/plugin-proposal-async-generator-functions"; +import proposalDynamicImport from "@babel/plugin-proposal-dynamic-import"; +import proposalJsonStrings from "@babel/plugin-proposal-json-strings"; +import proposalNullishCoalescingOperator from "@babel/plugin-proposal-nullish-coalescing-operator"; +import proposalObjectRestSpread from "@babel/plugin-proposal-object-rest-spread"; +import proposalOptionalCatchBinding from "@babel/plugin-proposal-optional-catch-binding"; +import proposalOptionalChaining from "@babel/plugin-proposal-optional-chaining"; +import proposalUnicodePropertyRegex from "@babel/plugin-proposal-unicode-property-regex"; +import transformAsyncToGenerator from "@babel/plugin-transform-async-to-generator"; +import transformArrowFunctions from "@babel/plugin-transform-arrow-functions"; +import transformBlockScopedFunctions from "@babel/plugin-transform-block-scoped-functions"; +import transformBlockScoping from "@babel/plugin-transform-block-scoping"; +import transformClasses from "@babel/plugin-transform-classes"; +import transformComputedProperties from "@babel/plugin-transform-computed-properties"; +import transformDestructuring from "@babel/plugin-transform-destructuring"; +import transformDotallRegex from "@babel/plugin-transform-dotall-regex"; +import transformDuplicateKeys from "@babel/plugin-transform-duplicate-keys"; +import transformExponentialOperator from "@babel/plugin-transform-exponentiation-operator"; +import transformForOf from "@babel/plugin-transform-for-of"; +import transformFunctionName from "@babel/plugin-transform-function-name"; +import transformLiterals from "@babel/plugin-transform-literals"; +import transformMemberExpressionLiterals from "@babel/plugin-transform-member-expression-literals"; +import transformModulesAmd from "@babel/plugin-transform-modules-amd"; +import transformModulesCommonjs from "@babel/plugin-transform-modules-commonjs"; +import transformModulesSystemjs from "@babel/plugin-transform-modules-systemjs"; +import transformModulesUmd from "@babel/plugin-transform-modules-umd"; +import transformNamedCapturingGroupsRegex from "@babel/plugin-transform-named-capturing-groups-regex"; +import transformNewTarget from "@babel/plugin-transform-new-target"; +import transformObjectSuper from "@babel/plugin-transform-object-super"; +import transformParameters from "@babel/plugin-transform-parameters"; +import transformPropertyLiterals from "@babel/plugin-transform-property-literals"; +import transformRegenerator from "@babel/plugin-transform-regenerator"; +import transformReservedWords from "@babel/plugin-transform-reserved-words"; +import transformShorthandProperties from "@babel/plugin-transform-shorthand-properties"; +import transformSpread from "@babel/plugin-transform-spread"; +import transformStickyRegex from "@babel/plugin-transform-sticky-regex"; +import transformTemplateLiterals from "@babel/plugin-transform-template-literals"; +import transformTypeofSymbol from "@babel/plugin-transform-typeof-symbol"; +import transformUnicodeRegex from "@babel/plugin-transform-unicode-regex"; export default { - "syntax-async-generators": require("@babel/plugin-syntax-async-generators"), - "syntax-dynamic-import": require("@babel/plugin-syntax-dynamic-import"), - "syntax-json-strings": require("@babel/plugin-syntax-json-strings"), - "syntax-object-rest-spread": require("@babel/plugin-syntax-object-rest-spread"), - "syntax-optional-catch-binding": require("@babel/plugin-syntax-optional-catch-binding"), - "transform-async-to-generator": require("@babel/plugin-transform-async-to-generator"), - "proposal-async-generator-functions": require("@babel/plugin-proposal-async-generator-functions"), - "proposal-dynamic-import": require("@babel/plugin-proposal-dynamic-import"), - "proposal-json-strings": require("@babel/plugin-proposal-json-strings"), - "transform-arrow-functions": require("@babel/plugin-transform-arrow-functions"), - "transform-block-scoped-functions": require("@babel/plugin-transform-block-scoped-functions"), - "transform-block-scoping": require("@babel/plugin-transform-block-scoping"), - "transform-classes": require("@babel/plugin-transform-classes"), - "transform-computed-properties": require("@babel/plugin-transform-computed-properties"), - "transform-destructuring": require("@babel/plugin-transform-destructuring"), - "transform-dotall-regex": require("@babel/plugin-transform-dotall-regex"), - "transform-duplicate-keys": require("@babel/plugin-transform-duplicate-keys"), - "transform-for-of": require("@babel/plugin-transform-for-of"), - "transform-function-name": require("@babel/plugin-transform-function-name"), - "transform-literals": require("@babel/plugin-transform-literals"), - "transform-member-expression-literals": require("@babel/plugin-transform-member-expression-literals"), - "transform-modules-amd": require("@babel/plugin-transform-modules-amd"), - "transform-modules-commonjs": require("@babel/plugin-transform-modules-commonjs"), - "transform-modules-systemjs": require("@babel/plugin-transform-modules-systemjs"), - "transform-modules-umd": require("@babel/plugin-transform-modules-umd"), - "transform-named-capturing-groups-regex": require("@babel/plugin-transform-named-capturing-groups-regex"), - "transform-object-super": require("@babel/plugin-transform-object-super"), - "transform-parameters": require("@babel/plugin-transform-parameters"), - "transform-property-literals": require("@babel/plugin-transform-property-literals"), - "transform-reserved-words": require("@babel/plugin-transform-reserved-words"), - "transform-shorthand-properties": require("@babel/plugin-transform-shorthand-properties"), - "transform-spread": require("@babel/plugin-transform-spread"), - "transform-sticky-regex": require("@babel/plugin-transform-sticky-regex"), - "transform-template-literals": require("@babel/plugin-transform-template-literals"), - "transform-typeof-symbol": require("@babel/plugin-transform-typeof-symbol"), - "transform-unicode-regex": require("@babel/plugin-transform-unicode-regex"), - "transform-exponentiation-operator": require("@babel/plugin-transform-exponentiation-operator"), - "transform-new-target": require("@babel/plugin-transform-new-target"), - "proposal-object-rest-spread": require("@babel/plugin-proposal-object-rest-spread"), - "proposal-optional-catch-binding": require("@babel/plugin-proposal-optional-catch-binding"), - "transform-regenerator": require("@babel/plugin-transform-regenerator"), - "proposal-unicode-property-regex": require("@babel/plugin-proposal-unicode-property-regex"), + "proposal-async-generator-functions": proposalAsyncGeneratorFunctions, + "proposal-dynamic-import": proposalDynamicImport, + "proposal-json-strings": proposalJsonStrings, + "proposal-nullish-coalescing-operator": proposalNullishCoalescingOperator, + "proposal-object-rest-spread": proposalObjectRestSpread, + "proposal-optional-catch-binding": proposalOptionalCatchBinding, + "proposal-optional-chaining": proposalOptionalChaining, + "proposal-unicode-property-regex": proposalUnicodePropertyRegex, + "syntax-async-generators": syntaxAsyncGenerators, + "syntax-dynamic-import": syntaxDynamicImport, + "syntax-json-strings": syntaxJsonStrings, + "syntax-nullish-coalescing-operator": syntaxNullishCoalescingOperator, + "syntax-object-rest-spread": syntaxObjectRestSpread, + "syntax-optional-catch-binding": syntaxOptionalCatchBinding, + "syntax-optional-chaining": syntaxOptionalChaining, + "syntax-top-level-await": syntaxTopLevelAwait, + "transform-arrow-functions": transformArrowFunctions, + "transform-async-to-generator": transformAsyncToGenerator, + "transform-block-scoped-functions": transformBlockScopedFunctions, + "transform-block-scoping": transformBlockScoping, + "transform-classes": transformClasses, + "transform-computed-properties": transformComputedProperties, + "transform-destructuring": transformDestructuring, + "transform-dotall-regex": transformDotallRegex, + "transform-duplicate-keys": transformDuplicateKeys, + "transform-exponentiation-operator": transformExponentialOperator, + "transform-for-of": transformForOf, + "transform-function-name": transformFunctionName, + "transform-literals": transformLiterals, + "transform-member-expression-literals": transformMemberExpressionLiterals, + "transform-modules-amd": transformModulesAmd, + "transform-modules-commonjs": transformModulesCommonjs, + "transform-modules-systemjs": transformModulesSystemjs, + "transform-modules-umd": transformModulesUmd, + "transform-named-capturing-groups-regex": transformNamedCapturingGroupsRegex, + "transform-new-target": transformNewTarget, + "transform-object-super": transformObjectSuper, + "transform-parameters": transformParameters, + "transform-property-literals": transformPropertyLiterals, + "transform-regenerator": transformRegenerator, + "transform-reserved-words": transformReservedWords, + "transform-shorthand-properties": transformShorthandProperties, + "transform-spread": transformSpread, + "transform-sticky-regex": transformStickyRegex, + "transform-template-literals": transformTemplateLiterals, + "transform-typeof-symbol": transformTypeofSymbol, + "transform-unicode-regex": transformUnicodeRegex, }; diff --git a/packages/babel-preset-env/src/debug.js b/packages/babel-preset-env/src/debug.js index db72cf0c3e3e..b91499e72275 100644 --- a/packages/babel-preset-env/src/debug.js +++ b/packages/babel-preset-env/src/debug.js @@ -1,9 +1,9 @@ // @flow -/*eslint quotes: ["error", "double", { "avoidEscape": true }]*/ -import semver from "semver"; -import { isUnreleasedVersion, prettifyVersion, semverify } from "./utils"; -import type { Targets } from "./types"; +import { + getInclusionReasons, + type Targets, +} from "@babel/helper-compilation-targets"; const wordEnds = (size: number) => { return size > 1 ? "s" : ""; @@ -16,29 +16,7 @@ export const logPluginOrPolyfill = ( targetVersions: Targets, list: { [key: string]: Targets }, ) => { - const minVersions = list[item] || {}; - - const filteredList = Object.keys(targetVersions).reduce((result, env) => { - const minVersion = minVersions[env]; - const targetVersion = targetVersions[env]; - - if (!minVersion) { - result[env] = prettifyVersion(targetVersion); - } else { - const minIsUnreleased = isUnreleasedVersion(minVersion, env); - const targetIsUnreleased = isUnreleasedVersion(targetVersion, env); - - if ( - !targetIsUnreleased && - (minIsUnreleased || - semver.lt(targetVersion.toString(), semverify(minVersion))) - ) { - result[env] = prettifyVersion(targetVersion); - } - } - - return result; - }, {}); + const filteredList = getInclusionReasons(item, targetVersions, list); const formattedTargets = JSON.stringify(filteredList) .replace(/,/g, ", ") @@ -56,6 +34,10 @@ export const logEntryPolyfills = ( polyfillTargets: Targets, allBuiltInsList: { [key: string]: Targets }, ) => { + // normalize filename to generate consistent preset-env test fixtures + if (process.env.BABEL_ENV === "test") { + filename = filename.replace(/\\/g, "/"); + } if (!importPolyfillIncluded) { console.log(`\n[${filename}] Import of ${polyfillName} was not found.`); return; @@ -83,6 +65,10 @@ export const logUsagePolyfills = ( polyfillTargets: Targets, allBuiltInsList: { [key: string]: Targets }, ) => { + // normalize filename to generate consistent preset-env test fixtures + if (process.env.BABEL_ENV === "test") { + filename = filename.replace(/\\/g, "/"); + } if (!polyfills.size) { console.log( `\n[${filename}] Based on your code and targets, core-js polyfills were not added.`, diff --git a/packages/babel-preset-env/src/filter-items.js b/packages/babel-preset-env/src/filter-items.js index 7d9c07026eba..a0041b3f082b 100644 --- a/packages/babel-preset-env/src/filter-items.js +++ b/packages/babel-preset-env/src/filter-items.js @@ -1,87 +1,11 @@ // @flow -import semver from "semver"; -import { semverify, isUnreleasedVersion } from "./utils"; -import type { Targets } from "./types"; - -export function isPluginRequired( - supportedEnvironments: Targets, - plugin: Targets, +export function removeUnnecessaryItems( + items: Set, + overlapping: { [name: string]: string[] }, ) { - const targetEnvironments = Object.keys(supportedEnvironments); - - if (targetEnvironments.length === 0) { - return true; - } - - const isRequiredForEnvironments = targetEnvironments.filter(environment => { - // Feature is not implemented in that environment - if (!plugin[environment]) { - return true; - } - - const lowestImplementedVersion = plugin[environment]; - const lowestTargetedVersion = supportedEnvironments[environment]; - - // If targets has unreleased value as a lowest version, then don't require a plugin. - if (isUnreleasedVersion(lowestTargetedVersion, environment)) { - return false; - } - - // Include plugin if it is supported in the unreleased environment, which wasn't specified in targets - if (isUnreleasedVersion(lowestImplementedVersion, environment)) { - return true; - } - - if (!semver.valid(lowestTargetedVersion.toString())) { - throw new Error( - `Invalid version passed for target "${environment}": "${lowestTargetedVersion}". ` + - "Versions must be in semver format (major.minor.patch)", - ); - } - - return semver.gt( - semverify(lowestImplementedVersion), - lowestTargetedVersion.toString(), - ); + items.forEach(item => { + // $FlowIgnore Flow doesn't support calls in optional chains + overlapping[item]?.forEach(name => items.delete(name)); }); - - return isRequiredForEnvironments.length > 0; -} - -export default function( - list: { [feature: string]: Targets }, - includes: Set, - excludes: Set, - targets: Targets, - defaultIncludes: Array | null, - defaultExcludes?: Array | null, - pluginSyntaxMap?: Map, -) { - const result = new Set(); - - for (const item in list) { - if ( - !excludes.has(item) && - (isPluginRequired(targets, list[item]) || includes.has(item)) - ) { - result.add(item); - } else if (pluginSyntaxMap) { - const shippedProposalsSyntax = pluginSyntaxMap.get(item); - - if (shippedProposalsSyntax) { - result.add(shippedProposalsSyntax); - } - } - } - - if (defaultIncludes) { - defaultIncludes.forEach(item => !excludes.has(item) && result.add(item)); - } - - if (defaultExcludes) { - defaultExcludes.forEach(item => !includes.has(item) && result.delete(item)); - } - - return result; } diff --git a/packages/babel-preset-env/src/index.js b/packages/babel-preset-env/src/index.js index 85a784476b83..8ff9d72e5caf 100644 --- a/packages/babel-preset-env/src/index.js +++ b/packages/babel-preset-env/src/index.js @@ -1,12 +1,14 @@ //@flow +import { SemVer } from "semver"; import { logPluginOrPolyfill } from "./debug"; import getOptionSpecificExcludesFor from "./get-option-specific-excludes"; -import filterItems from "./filter-items"; +import { removeUnnecessaryItems } from "./filter-items"; import moduleTransformations from "./module-transformations"; import normalizeOptions from "./normalize-options"; -import pluginList from "../data/plugins.json"; +import pluginList from "@babel/compat-data/plugins"; import { proposalPlugins, pluginSyntaxMap } from "../data/shipped-proposals"; +import overlappingPlugins from "@babel/compat-data/overlapping-plugins"; import addCoreJS2UsagePlugin from "./polyfills/corejs2/usage-plugin"; import addCoreJS3UsagePlugin from "./polyfills/corejs3/usage-plugin"; @@ -15,12 +17,25 @@ import replaceCoreJS2EntryPlugin from "./polyfills/corejs2/entry-plugin"; import replaceCoreJS3EntryPlugin from "./polyfills/corejs3/entry-plugin"; import removeRegeneratorEntryPlugin from "./polyfills/regenerator/entry-plugin"; -import getTargets from "./targets-parser"; +import getTargets, { + prettifyTargets, + filterItems, + isRequired, + type Targets, +} from "@babel/helper-compilation-targets"; import availablePlugins from "./available-plugins"; -import { filterStageFromList, prettifyTargets } from "./utils"; +import { filterStageFromList } from "./utils"; import { declare } from "@babel/helper-plugin-utils"; -export { isPluginRequired } from "./filter-items"; +import typeof ModuleTransformationsType from "./module-transformations"; +import type { BuiltInsOption, ModuleOption } from "./types"; + +// TODO: Remove in Babel 8 +export function isPluginRequired(targets: Targets, support: Targets) { + return isRequired("fake-name", targets, { + compatData: { "fake-name": support }, + }); +} const pluginListWithoutProposals = filterStageFromList( pluginList, @@ -56,6 +71,110 @@ export const transformIncludesAndExcludes = (opts: Array): Object => { ); }; +export const getModulesPluginNames = ({ + modules, + transformations, + shouldTransformESM, + shouldTransformDynamicImport, + shouldParseTopLevelAwait, +}: { + modules: ModuleOption, + transformations: ModuleTransformationsType, + shouldTransformESM: boolean, + shouldTransformDynamicImport: boolean, + shouldParseTopLevelAwait: boolean, +}) => { + const modulesPluginNames = []; + if (modules !== false && transformations[modules]) { + if (shouldTransformESM) { + modulesPluginNames.push(transformations[modules]); + } + + if ( + shouldTransformDynamicImport && + shouldTransformESM && + modules !== "umd" + ) { + modulesPluginNames.push("proposal-dynamic-import"); + } else { + if (shouldTransformDynamicImport) { + console.warn( + "Dynamic import can only be supported when transforming ES modules" + + " to AMD, CommonJS or SystemJS. Only the parser plugin will be enabled.", + ); + } + modulesPluginNames.push("syntax-dynamic-import"); + } + } else { + modulesPluginNames.push("syntax-dynamic-import"); + } + + if (shouldParseTopLevelAwait) { + modulesPluginNames.push("syntax-top-level-await"); + } + + return modulesPluginNames; +}; + +export const getPolyfillPlugins = ({ + useBuiltIns, + corejs, + polyfillTargets, + include, + exclude, + proposals, + shippedProposals, + regenerator, + debug, +}: { + useBuiltIns: BuiltInsOption, + corejs: typeof SemVer | null | false, + polyfillTargets: Targets, + include: Set, + exclude: Set, + proposals: boolean, + shippedProposals: boolean, + regenerator: boolean, + debug: boolean, +}) => { + const polyfillPlugins = []; + if (useBuiltIns === "usage" || useBuiltIns === "entry") { + const pluginOptions = { + corejs, + polyfillTargets, + include, + exclude, + proposals, + shippedProposals, + regenerator, + debug, + }; + + if (corejs) { + if (useBuiltIns === "usage") { + if (corejs.major === 2) { + polyfillPlugins.push([addCoreJS2UsagePlugin, pluginOptions]); + } else { + polyfillPlugins.push([addCoreJS3UsagePlugin, pluginOptions]); + } + if (regenerator) { + polyfillPlugins.push([addRegeneratorUsagePlugin, pluginOptions]); + } + } else { + if (corejs.major === 2) { + polyfillPlugins.push([replaceCoreJS2EntryPlugin, pluginOptions]); + } else { + polyfillPlugins.push([replaceCoreJS3EntryPlugin, pluginOptions]); + if (!regenerator) { + polyfillPlugins.push([removeRegeneratorEntryPlugin, pluginOptions]); + } + } + } + } + } + return polyfillPlugins; +}; + function supportsStaticESM(caller) { return !!(caller && caller.supportsStaticESM); } @@ -64,6 +183,10 @@ function supportsDynamicImport(caller) { return !!(caller && caller.supportsDynamicImport); } +function supportsTopLevelAwait(caller) { + return !!(caller && caller.supportsTopLevelAwait); +} + export default declare((api, opts) => { api.assertVersion(7); @@ -115,58 +238,48 @@ export default declare((api, opts) => { const transformTargets = forceAllTransforms || hasUglifyTarget ? {} : targets; - const transformations = filterItems( + const modulesPluginNames = getModulesPluginNames({ + modules, + transformations: moduleTransformations, + // TODO: Remove the 'api.caller' check eventually. Just here to prevent + // unnecessary breakage in the short term for users on older betas/RCs. + shouldTransformESM: + modules !== "auto" || !api.caller || !api.caller(supportsStaticESM), + shouldTransformDynamicImport: + modules !== "auto" || !api.caller || !api.caller(supportsDynamicImport), + shouldParseTopLevelAwait: !api.caller || api.caller(supportsTopLevelAwait), + }); + + const pluginNames = filterItems( shippedProposals ? pluginList : pluginListWithoutProposals, include.plugins, exclude.plugins, transformTargets, - null, + modulesPluginNames, getOptionSpecificExcludesFor({ loose }), pluginSyntaxMap, ); + removeUnnecessaryItems(pluginNames, overlappingPlugins); - const plugins = []; - const pluginUseBuiltIns = useBuiltIns !== false; - - if (modules !== false && moduleTransformations[modules]) { - // TODO: Remove the 'api.caller' check eventually. Just here to prevent - // unnecessary breakage in the short term for users on older betas/RCs. - const shouldTransformESM = - modules !== "auto" || !api.caller || !api.caller(supportsStaticESM); - const shouldTransformDynamicImport = - modules !== "auto" || !api.caller || !api.caller(supportsDynamicImport); - - if (shouldTransformESM) { - // NOTE: not giving spec here yet to avoid compatibility issues when - // transform-modules-commonjs gets its spec mode - plugins.push([getPlugin(moduleTransformations[modules]), { loose }]); - } - - if ( - shouldTransformDynamicImport && - shouldTransformESM && - modules !== "umd" - ) { - plugins.push([getPlugin("proposal-dynamic-import"), { loose }]); - } else { - if (shouldTransformDynamicImport) { - console.warn( - "Dynamic import can only be supported when transforming ES modules" + - " to AMD, CommonJS or SystemJS. Only the parser plugin will be enabled.", - ); - } - plugins.push(getPlugin("syntax-dynamic-import")); - } - } else { - plugins.push(getPlugin("syntax-dynamic-import")); - } + const polyfillPlugins = getPolyfillPlugins({ + useBuiltIns, + corejs, + polyfillTargets: targets, + include: include.builtIns, + exclude: exclude.builtIns, + proposals, + shippedProposals, + regenerator: pluginNames.has("transform-regenerator"), + debug, + }); - transformations.forEach(pluginName => - plugins.push([ + const pluginUseBuiltIns = useBuiltIns !== false; + const plugins = Array.from(pluginNames) + .map(pluginName => [ getPlugin(pluginName), { spec, loose, useBuiltIns: pluginUseBuiltIns }, - ]), - ); + ]) + .concat(polyfillPlugins); if (debug) { console.log("@babel/preset-env: `DEBUG` option"); @@ -174,8 +287,8 @@ export default declare((api, opts) => { console.log(JSON.stringify(prettifyTargets(targets), null, 2)); console.log(`\nUsing modules transform: ${modules.toString()}`); console.log("\nUsing plugins:"); - transformations.forEach(transform => { - logPluginOrPolyfill(transform, targets, pluginList); + pluginNames.forEach(pluginName => { + logPluginOrPolyfill(pluginName, targets, pluginList); }); if (!useBuiltIns) { @@ -183,46 +296,10 @@ export default declare((api, opts) => { "\nUsing polyfills: No polyfills were added, since the `useBuiltIns` option was not set.", ); } else { + // NOTE: Polyfill plugins are outputting debug info internally console.log(`\nUsing polyfills with \`${useBuiltIns}\` option:`); } } - if (useBuiltIns === "usage" || useBuiltIns === "entry") { - const regenerator = transformations.has("transform-regenerator"); - - const pluginOptions = { - corejs, - polyfillTargets: targets, - include: include.builtIns, - exclude: exclude.builtIns, - proposals, - shippedProposals, - regenerator, - debug, - }; - - if (corejs) { - if (useBuiltIns === "usage") { - if (corejs.major === 2) { - plugins.push([addCoreJS2UsagePlugin, pluginOptions]); - } else { - plugins.push([addCoreJS3UsagePlugin, pluginOptions]); - } - if (regenerator) { - plugins.push([addRegeneratorUsagePlugin, pluginOptions]); - } - } else { - if (corejs.major === 2) { - plugins.push([replaceCoreJS2EntryPlugin, pluginOptions]); - } else { - plugins.push([replaceCoreJS3EntryPlugin, pluginOptions]); - if (!regenerator) { - plugins.push([removeRegeneratorEntryPlugin, pluginOptions]); - } - } - } - } - } - return { plugins }; }); diff --git a/packages/babel-preset-env/src/normalize-options.js b/packages/babel-preset-env/src/normalize-options.js index 76b13f5a7e39..667805bb5703 100644 --- a/packages/babel-preset-env/src/normalize-options.js +++ b/packages/babel-preset-env/src/normalize-options.js @@ -1,14 +1,13 @@ // @flow import corejs3Polyfills from "core-js-compat/data"; +import findSuggestion from "levenary"; import invariant from "invariant"; import { coerce, SemVer } from "semver"; -import corejs2Polyfills from "../data/corejs2-built-ins.json"; -import pluginsList from "../data/plugins.json"; +import corejs2Polyfills from "@babel/compat-data/corejs2-built-ins"; +import pluginsList from "@babel/compat-data/plugins"; import moduleTransformations from "./module-transformations"; import { TopLevelOptions, ModulesOption, UseBuiltInsOption } from "./options"; import { defaultWebIncludes } from "./polyfills/corejs2/get-platform-specific-default"; -import { isBrowsersQueryValid } from "./targets-parser"; -import { findSuggestion } from "./utils"; import type { BuiltInsOption, @@ -26,29 +25,35 @@ const validateTopLevelOptions = (options: Options) => { if (!TopLevelOptions[option]) { throw new Error( `Invalid Option: ${option} is not a valid top-level option. - Maybe you meant to use '${findSuggestion(validOptions, option)}'?`, + Maybe you meant to use '${findSuggestion(option, validOptions)}'?`, ); } } }; -const allPluginsList = [ - ...Object.keys(pluginsList), +const allPluginsList = Object.keys(pluginsList); + +// NOTE: Since module plugins are handled seperatly compared to other plugins (via the "modules" option) it +// should only be possible to exclude and not include module plugins, otherwise it's possible that preset-env +// will add a module plugin twice. +const modulePlugins = [ + "proposal-dynamic-import", ...Object.keys(moduleTransformations).map(m => moduleTransformations[m]), ]; -const validIncludesAndExcludesWithoutCoreJS = new Set(allPluginsList); - -const validIncludesAndExcludesWithCoreJS2 = new Set([ - ...allPluginsList, - ...Object.keys(corejs2Polyfills), - ...defaultWebIncludes, -]); - -const validIncludesAndExcludesWithCoreJS3 = new Set([ - ...allPluginsList, - ...Object.keys(corejs3Polyfills), -]); +const getValidIncludesAndExcludes = ( + type: "include" | "exclude", + corejs: number | false, +) => + new Set([ + ...allPluginsList, + ...(type === "exclude" ? modulePlugins : []), + ...(corejs + ? corejs == 2 + ? [...Object.keys(corejs2Polyfills), ...defaultWebIncludes] + : Object.keys(corejs3Polyfills) + : []), + ]); const pluginToRegExp = (plugin: PluginListItem) => { if (plugin instanceof RegExp) return plugin; @@ -59,14 +64,14 @@ const pluginToRegExp = (plugin: PluginListItem) => { } }; -const selectPlugins = (regexp: RegExp | null, corejs: number | false) => - Array.from( - corejs - ? corejs == 2 - ? validIncludesAndExcludesWithCoreJS2 - : validIncludesAndExcludesWithCoreJS3 - : validIncludesAndExcludesWithoutCoreJS, - ).filter(item => regexp instanceof RegExp && regexp.test(item)); +const selectPlugins = ( + regexp: RegExp | null, + type: "include" | "exclude", + corejs: number | false, +) => + Array.from(getValidIncludesAndExcludes(type, corejs)).filter( + item => regexp instanceof RegExp && regexp.test(item), + ); const flatten = (array: Array>): Array => [].concat(...array); @@ -78,7 +83,7 @@ const expandIncludesAndExcludes = ( if (plugins.length === 0) return []; const selectedPlugins = plugins.map(plugin => - selectPlugins(pluginToRegExp(plugin), corejs), + selectPlugins(pluginToRegExp(plugin), type, corejs), ); const invalidRegExpList = plugins.filter( (p, i) => selectedPlugins[i].length === 0, @@ -115,7 +120,7 @@ export const checkDuplicateIncludeExcludes = ( const normalizeTargets = targets => { // TODO: Allow to use only query or strings as a targets from next breaking change. - if (isBrowsersQueryValid(targets)) { + if (typeof targets === "string" || Array.isArray(targets)) { return { browsers: targets }; } return { diff --git a/packages/babel-preset-env/src/options.js b/packages/babel-preset-env/src/options.js index f8bf5d0bba6c..b84423eca7d1 100644 --- a/packages/babel-preset-env/src/options.js +++ b/packages/babel-preset-env/src/options.js @@ -31,22 +31,3 @@ export const UseBuiltInsOption = { entry: "entry", usage: "usage", }; - -export const TargetNames = { - esmodules: "esmodules", - node: "node", - browsers: "browsers", - chrome: "chrome", - opera: "opera", - edge: "edge", - firefox: "firefox", - safari: "safari", - ie: "ie", - ios: "ios", - android: "android", - electron: "electron", - samsung: "samsung", - - // deprecated - uglify: "uglify", -}; diff --git a/packages/babel-preset-env/src/polyfills/corejs2/entry-plugin.js b/packages/babel-preset-env/src/polyfills/corejs2/entry-plugin.js index 82fa4dd9f237..da8010e2c731 100644 --- a/packages/babel-preset-env/src/polyfills/corejs2/entry-plugin.js +++ b/packages/babel-preset-env/src/polyfills/corejs2/entry-plugin.js @@ -1,8 +1,8 @@ // @flow -import corejs2Polyfills from "../../../data/corejs2-built-ins.json"; +import corejs2Polyfills from "@babel/compat-data/corejs2-built-ins"; +import { filterItems } from "@babel/helper-compilation-targets"; import getPlatformSpecificDefaultFor from "./get-platform-specific-default"; -import filterItems from "../../filter-items"; import { createImport, isPolyfillSource, diff --git a/packages/babel-preset-env/src/polyfills/corejs2/get-platform-specific-default.js b/packages/babel-preset-env/src/polyfills/corejs2/get-platform-specific-default.js index aa89ebfb1900..3674a2be8d4e 100644 --- a/packages/babel-preset-env/src/polyfills/corejs2/get-platform-specific-default.js +++ b/packages/babel-preset-env/src/polyfills/corejs2/get-platform-specific-default.js @@ -1,6 +1,6 @@ // @flow -import type { Targets } from "../../types"; +import type { Targets } from "@babel/helper-compilation-targets"; export const defaultWebIncludes = [ "web.timers", diff --git a/packages/babel-preset-env/src/polyfills/corejs2/usage-plugin.js b/packages/babel-preset-env/src/polyfills/corejs2/usage-plugin.js index 038736100841..a9269237e5ae 100644 --- a/packages/babel-preset-env/src/polyfills/corejs2/usage-plugin.js +++ b/packages/babel-preset-env/src/polyfills/corejs2/usage-plugin.js @@ -1,8 +1,8 @@ // @flow -import corejs2Polyfills from "../../../data/corejs2-built-ins.json"; +import corejs2Polyfills from "@babel/compat-data/corejs2-built-ins"; +import { filterItems } from "@babel/helper-compilation-targets"; import getPlatformSpecificDefaultFor from "./get-platform-specific-default"; -import filterItems from "../../filter-items"; import { BuiltIns, StaticProperties, @@ -15,6 +15,7 @@ import { isPolyfillSource, getImportSource, getRequireSource, + isNamespaced, } from "../../utils"; import { logUsagePolyfills } from "../../debug"; @@ -102,8 +103,11 @@ export default function( const { node } = path; const { object, property } = node; + // ignore namespace + if (isNamespaced(path.get("object"))) return; + let evaluatedPropType = object.name; - let propertyName = property.name; + let propertyName = ""; let instanceType = ""; if (node.computed) { @@ -115,6 +119,8 @@ export default function( propertyName = result.value; } } + } else { + propertyName = property.name; } if (path.scope.getBindingIdentifier(object.name)) { diff --git a/packages/babel-preset-env/src/polyfills/corejs3/built-in-definitions.js b/packages/babel-preset-env/src/polyfills/corejs3/built-in-definitions.js index 656738f16fee..2ed1915d87c5 100644 --- a/packages/babel-preset-env/src/polyfills/corejs3/built-in-definitions.js +++ b/packages/babel-preset-env/src/polyfills/corejs3/built-in-definitions.js @@ -197,7 +197,7 @@ export const InstanceProperties: ObjectMap = { forEach: ["es.array.for-each", "web.dom-collections.for-each"], includes: ["es.array.includes", "es.string.includes"], indexOf: ["es.array.index-of"], - italic: ["es.string.italics"], + italics: ["es.string.italics"], join: ["es.array.join"], keys: ArrayNatureIteratorsWithTag, lastIndex: ["esnext.array.last-index"], @@ -215,7 +215,7 @@ export const InstanceProperties: ObjectMap = { repeat: ["es.string.repeat"], replace: ["es.string.replace", "es.regexp.exec"], replaceAll: ["esnext.string.replace-all"], - reverse: ["es.string.reverse"], + reverse: ["es.array.reverse"], search: ["es.string.search", "es.regexp.exec"], slice: ["es.array.slice"], small: ["es.string.small"], @@ -358,7 +358,11 @@ export const StaticProperties: ObjectMap> = { "esnext.promise.all-settled", ...PromiseDependenciesWithIterators, ], - any: ["esnext.promise.any", ...PromiseDependenciesWithIterators], + any: [ + "esnext.promise.any", + "esnext.aggregate-error", + ...PromiseDependenciesWithIterators, + ], race: PromiseDependenciesWithIterators, try: ["esnext.promise.try", ...PromiseDependenciesWithIterators], }, diff --git a/packages/babel-preset-env/src/polyfills/corejs3/entry-plugin.js b/packages/babel-preset-env/src/polyfills/corejs3/entry-plugin.js index 1d8d3df0a2fa..3ec5875d2b85 100644 --- a/packages/babel-preset-env/src/polyfills/corejs3/entry-plugin.js +++ b/packages/babel-preset-env/src/polyfills/corejs3/entry-plugin.js @@ -3,13 +3,14 @@ import corejs3Polyfills from "core-js-compat/data"; import corejsEntries from "core-js-compat/entries"; import getModulesListForTargetVersion from "core-js-compat/get-modules-list-for-target-version"; -import filterItems from "../../filter-items"; +import { filterItems } from "@babel/helper-compilation-targets"; import { has, intersection, createImport, getImportSource, getRequireSource, + getModulePath, } from "../../utils"; import { logEntryPolyfills } from "../../debug"; @@ -48,6 +49,20 @@ export default function( const available = new Set(getModulesListForTargetVersion(corejs.version)); + function shouldReplace(source, modules) { + if (!modules) return false; + if ( + // Don't replace an import with itself to avoid an infinite loop + modules.length === 1 && + polyfills.has(modules[0]) && + available.has(modules[0]) && + getModulePath(modules[0]) === source + ) { + return false; + } + return true; + } + const isPolyfillImport = { ImportDeclaration(path: NodePath) { const source = getImportSource(path); @@ -56,24 +71,40 @@ export default function( console.warn(BABEL_POLYFILL_DEPRECATION); } else { const modules = isCoreJSSource(source); - if (modules) { + if (shouldReplace(source, modules)) { this.replaceBySeparateModulesImport(path, modules); } } }, - Program(path: NodePath) { - path.get("body").forEach(bodyPath => { - const source = getRequireSource(bodyPath); - if (!source) return; - if (isBabelPolyfillSource(source)) { - console.warn(BABEL_POLYFILL_DEPRECATION); - } else { - const modules = isCoreJSSource(source); - if (modules) { - this.replaceBySeparateModulesImport(bodyPath, modules); + Program: { + enter(path: NodePath) { + path.get("body").forEach(bodyPath => { + const source = getRequireSource(bodyPath); + if (!source) return; + if (isBabelPolyfillSource(source)) { + console.warn(BABEL_POLYFILL_DEPRECATION); + } else { + const modules = isCoreJSSource(source); + if (shouldReplace(source, modules)) { + this.replaceBySeparateModulesImport(bodyPath, modules); + } + } + }); + }, + exit(path: NodePath) { + const filtered = intersection(polyfills, this.polyfillsSet, available); + const reversed = Array.from(filtered).reverse(); + + for (const module of reversed) { + // Program:exit could be called multiple times. + // Avoid injecting the polyfills twice. + if (!this.injectedPolyfills.has(module)) { + createImport(path, module); } } - }); + + filtered.forEach(module => this.injectedPolyfills.add(module)); + }, }, }; @@ -81,6 +112,7 @@ export default function( name: "corejs3-entry", visitor: isPolyfillImport, pre() { + this.injectedPolyfills = new Set(); this.polyfillsSet = new Set(); this.replaceBySeparateModulesImport = function(path, modules) { @@ -91,19 +123,12 @@ export default function( path.remove(); }; }, - post({ path }: { path: NodePath }) { - const filtered = intersection(polyfills, this.polyfillsSet, available); - const reversed = Array.from(filtered).reverse(); - - for (const module of reversed) { - createImport(path, module); - } - + post() { if (debug) { logEntryPolyfills( "core-js", - this.polyfillsSet.size > 0, - filtered, + this.injectedPolyfills.size > 0, + this.injectedPolyfills, this.file.opts.filename, polyfillTargets, corejs3Polyfills, diff --git a/packages/babel-preset-env/src/polyfills/corejs3/usage-plugin.js b/packages/babel-preset-env/src/polyfills/corejs3/usage-plugin.js index ea1e06492134..11eabb97b642 100644 --- a/packages/babel-preset-env/src/polyfills/corejs3/usage-plugin.js +++ b/packages/babel-preset-env/src/polyfills/corejs3/usage-plugin.js @@ -3,7 +3,7 @@ import corejs3Polyfills from "core-js-compat/data"; import corejs3ShippedProposalsList from "./shipped-proposals"; import getModulesListForTargetVersion from "core-js-compat/get-modules-list-for-target-version"; -import filterItems from "../../filter-items"; +import { filterItems } from "@babel/helper-compilation-targets"; import { BuiltIns, StaticProperties, @@ -21,6 +21,7 @@ import { isPolyfillSource, getImportSource, getRequireSource, + isNamespaced, } from "../../utils"; import { logUsagePolyfills } from "../../debug"; @@ -98,7 +99,7 @@ export default function( } } } - return { builtIn, instanceType }; + return { builtIn, instanceType, isNamespaced: isNamespaced(path) }; } const addAndRemovePolyfillImports = { @@ -111,13 +112,30 @@ export default function( }, // require('core-js') - Program(path: NodePath) { - path.get("body").forEach(bodyPath => { - if (isPolyfillSource(getRequireSource(bodyPath))) { - console.warn(NO_DIRECT_POLYFILL_IMPORT); - bodyPath.remove(); + Program: { + enter(path: NodePath) { + path.get("body").forEach(bodyPath => { + if (isPolyfillSource(getRequireSource(bodyPath))) { + console.warn(NO_DIRECT_POLYFILL_IMPORT); + bodyPath.remove(); + } + }); + }, + + exit(path: NodePath) { + const filtered = intersection(polyfills, this.polyfillsSet, available); + const reversed = Array.from(filtered).reverse(); + + for (const module of reversed) { + // Program:exit could be called multiple times. + // Avoid injecting the polyfills twice. + if (!this.injectedPolyfills.has(module)) { + createImport(path, module); + } } - }); + + filtered.forEach(module => this.injectedPolyfills.add(module)); + }, }, // import('something').then(...) @@ -213,6 +231,7 @@ export default function( return { name: "corejs3-usage", pre() { + this.injectedPolyfills = new Set(); this.polyfillsSet = new Set(); this.addUnsupported = function(builtIn) { @@ -230,7 +249,8 @@ export default function( }; this.addPropertyDependencies = function(source = {}, key) { - const { builtIn, instanceType } = source; + const { builtIn, instanceType, isNamespaced } = source; + if (isNamespaced) return; if (PossibleGlobalObjects.has(builtIn)) { this.addBuiltInDependencies(key); } else if (has(StaticProperties, builtIn)) { @@ -250,17 +270,10 @@ export default function( this.addUnsupported(InstancePropertyDependencies); }; }, - post({ path }: { path: NodePath }) { - const filtered = intersection(polyfills, this.polyfillsSet, available); - const reversed = Array.from(filtered).reverse(); - - for (const module of reversed) { - createImport(path, module); - } - + post() { if (debug) { logUsagePolyfills( - filtered, + this.injectedPolyfills, this.file.opts.filename, polyfillTargets, corejs3Polyfills, diff --git a/packages/babel-preset-env/src/polyfills/regenerator/entry-plugin.js b/packages/babel-preset-env/src/polyfills/regenerator/entry-plugin.js index a7872ac5429f..53db45877398 100644 --- a/packages/babel-preset-env/src/polyfills/regenerator/entry-plugin.js +++ b/packages/babel-preset-env/src/polyfills/regenerator/entry-plugin.js @@ -33,10 +33,13 @@ export default function() { }, post() { if (this.opts.debug && this.regeneratorImportExcluded) { + let filename = this.file.opts.filename; + // normalize filename to generate consistent preset-env test fixtures + if (process.env.BABEL_ENV === "test") { + filename = filename.replace(/\\/g, "/"); + } console.log( - `\n[${ - this.file.opts.filename - }] Based on your targets, regenerator-runtime import excluded.`, + `\n[${filename}] Based on your targets, regenerator-runtime import excluded.`, ); } }, diff --git a/packages/babel-preset-env/src/polyfills/regenerator/usage-plugin.js b/packages/babel-preset-env/src/polyfills/regenerator/usage-plugin.js index 36ac15502b18..f417cf248de8 100644 --- a/packages/babel-preset-env/src/polyfills/regenerator/usage-plugin.js +++ b/packages/babel-preset-env/src/polyfills/regenerator/usage-plugin.js @@ -21,10 +21,13 @@ export default function() { }, post() { if (this.opts.debug && this.usesRegenerator) { + let filename = this.file.opts.filename; + // normalize filename to generate consistent preset-env test fixtures + if (process.env.BABEL_ENV === "test") { + filename = filename.replace(/\\/g, "/"); + } console.log( - `\n[${ - this.file.opts.filename - }] Based on your code and targets, added regenerator-runtime.`, + `\n[${filename}] Based on your code and targets, added regenerator-runtime.`, ); } }, diff --git a/packages/babel-preset-env/src/targets-parser.js b/packages/babel-preset-env/src/targets-parser.js index 4c006bf2f073..3697cb58f26f 100644 --- a/packages/babel-preset-env/src/targets-parser.js +++ b/packages/babel-preset-env/src/targets-parser.js @@ -1,265 +1,7 @@ -// @flow +// TODO: Remove in Babel 8 -import browserslist from "browserslist"; -import invariant from "invariant"; -import semver from "semver"; -import { - semverify, - isUnreleasedVersion, - getLowestUnreleased, - findSuggestion, -} from "./utils"; -import browserModulesData from "../data/built-in-modules.json"; -import { TargetNames } from "./options"; -import type { Targets } from "./types"; - -const browserslistDefaults = browserslist.defaults; - -const validBrowserslistTargets = [ - ...Object.keys(browserslist.data), - ...Object.keys(browserslist.aliases), -]; - -const objectToBrowserslist = (object: Targets): Array => { - return Object.keys(object).reduce((list, targetName) => { - if (validBrowserslistTargets.indexOf(targetName) >= 0) { - const targetVersion = object[targetName]; - return list.concat(`${targetName} ${targetVersion}`); - } - return list; - }, []); -}; - -const validateTargetNames = (targets: Targets): void => { - const validTargets = Object.keys(TargetNames); - for (const target in targets) { - if (!TargetNames[target]) { - throw new Error( - `Invalid Option: '${target}' is not a valid target - Maybe you meant to use '${findSuggestion(validTargets, target)}'?`, - ); - } - } -}; - -const browserNameMap = { - and_chr: "chrome", - and_ff: "firefox", - android: "android", - chrome: "chrome", - edge: "edge", - firefox: "firefox", - ie: "ie", - ie_mob: "ie", - ios_saf: "ios", - node: "node", - op_mob: "opera", - opera: "opera", - safari: "safari", - samsung: "samsung", -}; - -export const isBrowsersQueryValid = ( - browsers: string | Array | Targets, -): boolean => typeof browsers === "string" || Array.isArray(browsers); - -const validateBrowsers = browsers => { - invariant( - typeof browsers === "undefined" || isBrowsersQueryValid(browsers), - `Invalid Option: '${browsers}' is not a valid browserslist query`, - ); - - return browsers; -}; - -export const semverMin = (first: ?string, second: string): string => { - return first && semver.lt(first, second) ? first : second; -}; - -const mergeBrowsers = (fromQuery: Targets, fromTarget: Targets) => { - return Object.keys(fromTarget).reduce((queryObj, targKey) => { - if (targKey !== TargetNames.browsers) { - queryObj[targKey] = fromTarget[targKey]; - } - return queryObj; - }, fromQuery); -}; - -const getLowestVersions = (browsers: Array): Targets => { - return browsers.reduce((all: Object, browser: string): Object => { - const [browserName, browserVersion] = browser.split(" "); - const normalizedBrowserName = browserNameMap[browserName]; - - if (!normalizedBrowserName) { - return all; - } - - try { - // Browser version can return as "10.0-10.2" - const splitVersion = browserVersion.split("-")[0].toLowerCase(); - const isSplitUnreleased = isUnreleasedVersion(splitVersion, browserName); - - if (!all[normalizedBrowserName]) { - all[normalizedBrowserName] = isSplitUnreleased - ? splitVersion - : semverify(splitVersion); - return all; - } - - const version = all[normalizedBrowserName]; - const isUnreleased = isUnreleasedVersion(version, browserName); - - if (isUnreleased && isSplitUnreleased) { - all[normalizedBrowserName] = getLowestUnreleased( - version, - splitVersion, - browserName, - ); - } else if (isUnreleased) { - all[normalizedBrowserName] = semverify(splitVersion); - } else if (!isUnreleased && !isSplitUnreleased) { - const parsedBrowserVersion = semverify(splitVersion); - - all[normalizedBrowserName] = semverMin(version, parsedBrowserVersion); - } - } catch (e) {} - - return all; - }, {}); -}; - -const outputDecimalWarning = (decimalTargets: Array): void => { - if (!decimalTargets || !decimalTargets.length) { - return; - } - - console.log("Warning, the following targets are using a decimal version:"); - console.log(""); - decimalTargets.forEach(({ target, value }) => - console.log(` ${target}: ${value}`), - ); - console.log(""); - console.log( - "We recommend using a string for minor/patch versions to avoid numbers like 6.10", - ); - console.log("getting parsed as 6.1, which can lead to unexpected behavior."); - console.log(""); -}; - -const semverifyTarget = (target, value) => { - try { - return semverify(value); - } catch (error) { - throw new Error( - `Invalid Option: '${value}' is not a valid value for 'targets.${target}'.`, - ); - } -}; - -const targetParserMap = { - __default: (target, value) => { - const version = isUnreleasedVersion(value, target) - ? value.toLowerCase() - : semverifyTarget(target, value); - return [target, version]; - }, - - // Parse `node: true` and `node: "current"` to version - node: (target, value) => { - const parsed = - value === true || value === "current" - ? process.versions.node - : semverifyTarget(target, value); - return [target, parsed]; - }, -}; - -type ParsedResult = { - targets: Targets, - decimalWarnings: Array, -}; - -const getTargets = (targets: Object = {}, options: Object = {}): Targets => { - const targetOpts: Targets = {}; - - validateTargetNames(targets); - - // `esmodules` as a target indicates the specific set of browsers supporting ES Modules. - // These values OVERRIDE the `browsers` field. - if (targets.esmodules) { - const supportsESModules = browserModulesData["es6.module"]; - targets.browsers = Object.keys(supportsESModules) - .map(browser => `${browser} ${supportsESModules[browser]}`) - .join(", "); - } - - // Parse browsers target via browserslist - const browsersquery = validateBrowsers(targets.browsers); - - const hasTargets = Object.keys(targets).length > 0; - const shouldParseBrowsers = !!targets.browsers; - const shouldSearchForConfig = - !options.ignoreBrowserslistConfig && !hasTargets; - - if (shouldParseBrowsers || shouldSearchForConfig) { - // If no targets are passed, we need to overwrite browserslist's defaults - // so that we enable all transforms (acting like the now deprecated - // preset-latest). - // - // Note, if browserslist resolves the config (ex. package.json), then usage - // of `defaults` in queries will be different since we don't want to break - // the behavior of "no targets is the same as preset-latest". - if (!hasTargets) { - browserslist.defaults = objectToBrowserslist(targets); - } - - const browsers = browserslist(browsersquery, { - path: options.configPath, - mobileToDesktop: true, - }); - - const queryBrowsers = getLowestVersions(browsers); - targets = mergeBrowsers(queryBrowsers, targets); - - // Reset browserslist defaults - browserslist.defaults = browserslistDefaults; - } - - // Parse remaining targets - const parsed = Object.keys(targets) - .filter(value => value !== TargetNames.esmodules) - .sort() - .reduce( - (results: ParsedResult, target: string): ParsedResult => { - if (target !== TargetNames.browsers) { - const value = targets[target]; - - // Warn when specifying minor/patch as a decimal - if (typeof value === "number" && value % 1 !== 0) { - results.decimalWarnings.push({ target, value }); - } - - // Check if we have a target parser? - const parser = targetParserMap[target] || targetParserMap.__default; - const [parsedTarget, parsedValue] = parser(target, value); - - if (parsedValue) { - // Merge (lowest wins) - results.targets[parsedTarget] = parsedValue; - } - } - - return results; - }, - { - targets: targetOpts, - decimalWarnings: [], - }, - ); - - outputDecimalWarning(parsed.decimalWarnings); - - return parsed.targets; -}; - -export default getTargets; +export { + default, + isBrowsersQueryValid, + semverMin, +} from "@babel/helper-compilation-targets"; diff --git a/packages/babel-preset-env/src/types.js b/packages/babel-preset-env/src/types.js index c1c3157eb27d..1066c665f1a6 100644 --- a/packages/babel-preset-env/src/types.js +++ b/packages/babel-preset-env/src/types.js @@ -2,24 +2,7 @@ import { ModulesOption, UseBuiltInsOption } from "./options"; import type { NormalizedCorejsOption } from "./normalize-options"; - -// Targets -export type Target = - | "node" - | "chrome" - | "opera" - | "edge" - | "firefox" - | "safari" - | "ie" - | "ios" - | "android" - | "electron" - | "samsung"; - -export type Targets = { - [target: Target]: string, -}; +import type { Targets } from "@babel/helper-compilation-targets"; // Options // Use explicit modules to prevent typo errors. diff --git a/packages/babel-preset-env/src/utils.js b/packages/babel-preset-env/src/utils.js index 81c1c3721c99..c7a330fe9f51 100644 --- a/packages/babel-preset-env/src/utils.js +++ b/packages/babel-preset-env/src/utils.js @@ -2,13 +2,8 @@ import * as t from "@babel/types"; import type { NodePath } from "@babel/traverse"; -import invariant from "invariant"; -import semver from "semver"; -import levenshtein from "js-levenshtein"; import { addSideEffect } from "@babel/helper-module-imports"; -import unreleasedLabels from "../data/unreleased-labels"; -import { semverMin } from "./targets-parser"; -import type { Targets } from "./types"; +import type { Targets } from "@babel/helper-compilation-targets"; export const has = Object.hasOwnProperty.call.bind(Object.hasOwnProperty); @@ -19,28 +14,6 @@ export function getType(target: any): string { .toLowerCase(); } -const versionRegExp = /^(\d+|\d+.\d+)$/; - -// Convert version to a semver value. -// 2.5 -> 2.5.0; 1 -> 1.0.0; -export function semverify(version: number | string): string { - if (typeof version === "string" && semver.valid(version)) { - return version; - } - - invariant( - typeof version === "number" || - (typeof version === "string" && versionRegExp.test(version)), - `'${version}' is not a valid version`, - ); - - const split = version.toString().split("."); - while (split.length < 3) { - split.push("0"); - } - return split.join("."); -} - export function intersection( first: Set, second: Set, @@ -53,71 +26,6 @@ export function intersection( return result; } -export function findSuggestion(options: string[], option: string): string { - let levenshteinValue = Infinity; - return options.reduce((suggestion, validOption) => { - const value = levenshtein(validOption, option); - if (value < levenshteinValue) { - levenshteinValue = value; - return validOption; - } - return suggestion; - }, undefined); -} - -export function prettifyVersion(version: string) { - if (typeof version !== "string") { - return version; - } - - const parts = [semver.major(version)]; - const minor = semver.minor(version); - const patch = semver.patch(version); - - if (minor || patch) { - parts.push(minor); - } - - if (patch) { - parts.push(patch); - } - - return parts.join("."); -} - -export function prettifyTargets(targets: Targets): Targets { - return Object.keys(targets).reduce((results, target) => { - let value = targets[target]; - - const unreleasedLabel = unreleasedLabels[target]; - if (typeof value === "string" && unreleasedLabel !== value) { - value = prettifyVersion(value); - } - - results[target] = value; - return results; - }, {}); -} - -export function isUnreleasedVersion( - version: string | number, - env: string, -): boolean { - const unreleasedLabel = unreleasedLabels[env]; - return ( - !!unreleasedLabel && unreleasedLabel === version.toString().toLowerCase() - ); -} - -export function getLowestUnreleased(a: string, b: string, env: string): string { - const unreleasedLabel = unreleasedLabels[env]; - const hasUnreleased = [a, b].some(item => item === unreleasedLabel); - if (hasUnreleased) { - return a === hasUnreleased ? b : a || b; - } - return semverMin(a, b); -} - export function filterStageFromList( list: { [feature: string]: Targets }, stageList: { [feature: string]: boolean }, @@ -162,3 +70,10 @@ export function getModulePath(mod: string): string { export function createImport(path: NodePath, mod: string) { return addSideEffect(path, getModulePath(mod)); } + +export function isNamespaced(path: NodePath) { + if (!path.node) return false; + const binding = path.scope.getBinding(path.node.name); + if (!binding) return false; + return binding.path.isImportNamespaceSpecifier(); +} diff --git a/packages/babel-preset-env/test/debug-fixtures.js b/packages/babel-preset-env/test/debug-fixtures.js deleted file mode 100644 index 959a2fd133b5..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures.js +++ /dev/null @@ -1,148 +0,0 @@ -const child = require("child_process"); -const fs = require("fs-extra"); -const helper = require("@babel/helper-fixtures"); -const path = require("path"); - -const fixtureLoc = path.join(__dirname, "debug-fixtures"); -const tmpLoc = path.join(__dirname, "tmp"); - -const clear = () => { - process.chdir(__dirname); - if (fs.existsSync(tmpLoc)) fs.removeSync(tmpLoc); - fs.mkdirSync(tmpLoc); - process.chdir(tmpLoc); -}; - -const saveInFiles = files => { - Object.keys(files).forEach(filename => { - const content = files[filename]; - fs.outputFileSync(filename, content); - }); -}; - -const testOutputType = (type, stdTarg, opts) => { - stdTarg = stdTarg.trim(); - stdTarg = stdTarg.replace(/\\/g, "/"); - const optsTarg = opts[type]; - - if (optsTarg) { - const expectStdout = optsTarg.trim(); - expect(stdTarg).toBe(expectStdout); - } else { - const file = path.join(opts.testLoc, `${type}.txt`); - console.log(`New test file created: ${file}`); - fs.outputFileSync(file, stdTarg); - } -}; - -const assertTest = (stdout, stderr, opts) => { - testOutputType("stdout", stdout, opts); - if (stderr) { - testOutputType("stderr", stderr, opts); - } -}; - -const buildTest = opts => { - const binLoc = require.resolve("@babel/cli/bin/babel"); - - return callback => { - clear(); - saveInFiles(opts.inFiles); - - let args = [binLoc]; - args = args.concat(opts.args); - - const spawn = child.spawn(process.execPath, args, { - cwd: tmpLoc, - }); - - let stdout = ""; - let stderr = ""; - - spawn.stdout.on("data", chunk => (stdout += chunk)); - spawn.stderr.on("data", chunk => (stderr += chunk)); - - spawn.on("close", () => { - let err; - - try { - stdout = replacePaths(stdout); - stderr = replacePaths(stderr); - - assertTest(stdout, stderr, opts); - } catch (e) { - err = e; - } - - callback(err); - }); - }; -}; - -function replacePaths(str) { - let prev; - do { - prev = str; - str = str.replace(tmpLoc, ""); - } while (str !== prev); - - return str; -} - -describe("debug output", () => { - let cwd; - - beforeEach(() => { - cwd = process.cwd(); - }); - - afterEach(() => { - process.chdir(cwd); - }); - - fs.readdirSync(fixtureLoc).forEach(testName => { - if (testName.slice(0, 1) === ".") return; - const testLoc = path.join(fixtureLoc, testName); - - const opts = { - args: ["src", "--out-dir", "lib"], - testLoc: testLoc, - }; - - const stdoutLoc = path.join(testLoc, "stdout.txt"); - const stderrLoc = path.join(testLoc, "stderr.txt"); - - if (fs.existsSync(stdoutLoc)) { - opts.stdout = helper.readFile(stdoutLoc); - } - - if (fs.existsSync(stderrLoc)) { - opts.stderr = helper.readFile(stderrLoc); - } - - const optionsLoc = path.join(testLoc, "options.json"); - - if (!fs.existsSync(optionsLoc)) { - throw new Error( - `Debug test '${testName}' is missing an options.json file`, - ); - } - - const inFilesFolderLoc = path.join(testLoc, "in"); - - opts.inFiles = { - ".babelrc": helper.readFile(optionsLoc), - }; - - if (!fs.existsSync(inFilesFolderLoc)) { - opts.inFiles["src/in.js"] = ""; - } else { - fs.readdirSync(inFilesFolderLoc).forEach(filename => { - opts.inFiles[`src/${filename}`] = helper.readFile( - path.join(inFilesFolderLoc, filename), - ); - }); - } - it(testName, buildTest(opts)); - }); -}); diff --git a/packages/babel-preset-env/test/debug-fixtures/corejs-without-usebuiltins/options.json b/packages/babel-preset-env/test/debug-fixtures/corejs-without-usebuiltins/options.json deleted file mode 100644 index 5e051fe4e1b1..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/corejs-without-usebuiltins/options.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "presets": [ - ["../../lib", { - "debug": true, - "corejs": 3 - }] - ] -} diff --git a/packages/babel-preset-env/test/debug-fixtures/corejs-without-usebuiltins/stdout.txt b/packages/babel-preset-env/test/debug-fixtures/corejs-without-usebuiltins/stdout.txt deleted file mode 100644 index 1480ffe6bec5..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/corejs-without-usebuiltins/stdout.txt +++ /dev/null @@ -1,45 +0,0 @@ -The `corejs` option only has an effect when the `useBuiltIns` option is not `false` - -@babel/preset-env: `DEBUG` option - -Using targets: -{} - -Using modules transform: auto - -Using plugins: - transform-template-literals {} - transform-literals {} - transform-function-name {} - transform-arrow-functions {} - transform-block-scoped-functions {} - transform-classes {} - transform-object-super {} - transform-shorthand-properties {} - transform-duplicate-keys {} - transform-computed-properties {} - transform-for-of {} - transform-sticky-regex {} - transform-dotall-regex {} - transform-unicode-regex {} - transform-spread {} - transform-parameters {} - transform-destructuring {} - transform-block-scoping {} - transform-typeof-symbol {} - transform-new-target {} - transform-regenerator {} - transform-exponentiation-operator {} - transform-async-to-generator {} - proposal-async-generator-functions {} - proposal-object-rest-spread {} - proposal-unicode-property-regex {} - proposal-json-strings {} - proposal-optional-catch-binding {} - transform-named-capturing-groups-regex {} - transform-member-expression-literals {} - transform-property-literals {} - transform-reserved-words {} - -Using polyfills: No polyfills were added, since the `useBuiltIns` option was not set. -Successfully compiled 1 file with Babel. \ No newline at end of file diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs2-android/options.json b/packages/babel-preset-env/test/debug-fixtures/entry-corejs2-android/options.json deleted file mode 100644 index 4874a2298d1e..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/entry-corejs2-android/options.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "presets": [ - ["../../lib", { - "debug": true, - "targets": { - "browsers": [ "Android >= 4" ] - }, - "useBuiltIns": "entry", - "corejs": 2 - }] - ] -} diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs2-android/stdout.txt b/packages/babel-preset-env/test/debug-fixtures/entry-corejs2-android/stdout.txt deleted file mode 100644 index f3d91c14ed87..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/entry-corejs2-android/stdout.txt +++ /dev/null @@ -1,159 +0,0 @@ -@babel/preset-env: `DEBUG` option - -Using targets: -{ - "android": "4" -} - -Using modules transform: auto - -Using plugins: - transform-template-literals { "android":"4" } - transform-literals { "android":"4" } - transform-function-name { "android":"4" } - transform-arrow-functions { "android":"4" } - transform-block-scoped-functions { "android":"4" } - transform-classes { "android":"4" } - transform-object-super { "android":"4" } - transform-shorthand-properties { "android":"4" } - transform-duplicate-keys { "android":"4" } - transform-computed-properties { "android":"4" } - transform-for-of { "android":"4" } - transform-sticky-regex { "android":"4" } - transform-dotall-regex { "android":"4" } - transform-unicode-regex { "android":"4" } - transform-spread { "android":"4" } - transform-parameters { "android":"4" } - transform-destructuring { "android":"4" } - transform-block-scoping { "android":"4" } - transform-typeof-symbol { "android":"4" } - transform-new-target { "android":"4" } - transform-regenerator { "android":"4" } - transform-exponentiation-operator { "android":"4" } - transform-async-to-generator { "android":"4" } - proposal-async-generator-functions { "android":"4" } - proposal-object-rest-spread { "android":"4" } - proposal-unicode-property-regex { "android":"4" } - proposal-json-strings { "android":"4" } - proposal-optional-catch-binding { "android":"4" } - transform-named-capturing-groups-regex { "android":"4" } - transform-reserved-words { "android":"4" } - -Using polyfills with `entry` option: - -[/src/in.js] Replaced @babel/polyfill entries with the following polyfills: - es6.array.copy-within { "android":"4" } - es6.array.fill { "android":"4" } - es6.array.find { "android":"4" } - es6.array.find-index { "android":"4" } - es7.array.flat-map { "android":"4" } - es6.array.from { "android":"4" } - es7.array.includes { "android":"4" } - es6.array.iterator { "android":"4" } - es6.array.of { "android":"4" } - es6.array.sort { "android":"4" } - es6.array.species { "android":"4" } - es6.date.to-primitive { "android":"4" } - es6.function.has-instance { "android":"4" } - es6.map { "android":"4" } - es6.math.acosh { "android":"4" } - es6.math.asinh { "android":"4" } - es6.math.atanh { "android":"4" } - es6.math.cbrt { "android":"4" } - es6.math.clz32 { "android":"4" } - es6.math.cosh { "android":"4" } - es6.math.expm1 { "android":"4" } - es6.math.fround { "android":"4" } - es6.math.hypot { "android":"4" } - es6.math.imul { "android":"4" } - es6.math.log1p { "android":"4" } - es6.math.log10 { "android":"4" } - es6.math.log2 { "android":"4" } - es6.math.sign { "android":"4" } - es6.math.sinh { "android":"4" } - es6.math.tanh { "android":"4" } - es6.math.trunc { "android":"4" } - es6.number.constructor { "android":"4" } - es6.number.epsilon { "android":"4" } - es6.number.is-finite { "android":"4" } - es6.number.is-integer { "android":"4" } - es6.number.is-nan { "android":"4" } - es6.number.is-safe-integer { "android":"4" } - es6.number.max-safe-integer { "android":"4" } - es6.number.min-safe-integer { "android":"4" } - es6.number.parse-float { "android":"4" } - es6.number.parse-int { "android":"4" } - es6.object.assign { "android":"4" } - es7.object.define-getter { "android":"4" } - es7.object.define-setter { "android":"4" } - es7.object.entries { "android":"4" } - es6.object.freeze { "android":"4" } - es6.object.get-own-property-descriptor { "android":"4" } - es7.object.get-own-property-descriptors { "android":"4" } - es6.object.get-own-property-names { "android":"4" } - es6.object.get-prototype-of { "android":"4" } - es7.object.lookup-getter { "android":"4" } - es7.object.lookup-setter { "android":"4" } - es6.object.prevent-extensions { "android":"4" } - es6.object.to-string { "android":"4" } - es6.object.is { "android":"4" } - es6.object.is-frozen { "android":"4" } - es6.object.is-sealed { "android":"4" } - es6.object.is-extensible { "android":"4" } - es6.object.keys { "android":"4" } - es6.object.seal { "android":"4" } - es6.object.set-prototype-of { "android":"4" } - es7.object.values { "android":"4" } - es6.promise { "android":"4" } - es7.promise.finally { "android":"4" } - es6.reflect.apply { "android":"4" } - es6.reflect.construct { "android":"4" } - es6.reflect.define-property { "android":"4" } - es6.reflect.delete-property { "android":"4" } - es6.reflect.get { "android":"4" } - es6.reflect.get-own-property-descriptor { "android":"4" } - es6.reflect.get-prototype-of { "android":"4" } - es6.reflect.has { "android":"4" } - es6.reflect.is-extensible { "android":"4" } - es6.reflect.own-keys { "android":"4" } - es6.reflect.prevent-extensions { "android":"4" } - es6.reflect.set { "android":"4" } - es6.reflect.set-prototype-of { "android":"4" } - es6.regexp.constructor { "android":"4" } - es6.regexp.flags { "android":"4" } - es6.regexp.match { "android":"4" } - es6.regexp.replace { "android":"4" } - es6.regexp.split { "android":"4" } - es6.regexp.search { "android":"4" } - es6.regexp.to-string { "android":"4" } - es6.set { "android":"4" } - es6.symbol { "android":"4" } - es7.symbol.async-iterator { "android":"4" } - es6.string.code-point-at { "android":"4" } - es6.string.ends-with { "android":"4" } - es6.string.from-code-point { "android":"4" } - es6.string.includes { "android":"4" } - es6.string.iterator { "android":"4" } - es7.string.pad-start { "android":"4" } - es7.string.pad-end { "android":"4" } - es6.string.raw { "android":"4" } - es6.string.repeat { "android":"4" } - es6.string.starts-with { "android":"4" } - es7.string.trim-left { "android":"4" } - es7.string.trim-right { "android":"4" } - es6.typed.array-buffer { "android":"4" } - es6.typed.int8-array { "android":"4" } - es6.typed.uint8-array { "android":"4" } - es6.typed.uint8-clamped-array { "android":"4" } - es6.typed.int16-array { "android":"4" } - es6.typed.uint16-array { "android":"4" } - es6.typed.int32-array { "android":"4" } - es6.typed.uint32-array { "android":"4" } - es6.typed.float32-array { "android":"4" } - es6.typed.float64-array { "android":"4" } - es6.weak-map { "android":"4" } - es6.weak-set { "android":"4" } - web.timers { "android":"4" } - web.immediate { "android":"4" } - web.dom.iterable { "android":"4" } -Successfully compiled 1 file with Babel. \ No newline at end of file diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs2-electron/options.json b/packages/babel-preset-env/test/debug-fixtures/entry-corejs2-electron/options.json deleted file mode 100644 index 7055c2d63318..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/entry-corejs2-electron/options.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "presets": [ - ["../../lib", { - "debug": true, - "targets": { - "electron": 0.36 - }, - "useBuiltIns": "entry", - "corejs": 2 - }] - ] -} diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs2-electron/stdout.txt b/packages/babel-preset-env/test/debug-fixtures/entry-corejs2-electron/stdout.txt deleted file mode 100644 index e0c6a95adc0d..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/entry-corejs2-electron/stdout.txt +++ /dev/null @@ -1,134 +0,0 @@ -Warning, the following targets are using a decimal version: - - electron: 0.36 - -We recommend using a string for minor/patch versions to avoid numbers like 6.10 -getting parsed as 6.1, which can lead to unexpected behavior. - -@babel/preset-env: `DEBUG` option - -Using targets: -{ - "electron": "0.36" -} - -Using modules transform: auto - -Using plugins: - transform-function-name { "electron":"0.36" } - transform-for-of { "electron":"0.36" } - transform-sticky-regex { "electron":"0.36" } - transform-dotall-regex { "electron":"0.36" } - transform-unicode-regex { "electron":"0.36" } - transform-parameters { "electron":"0.36" } - transform-destructuring { "electron":"0.36" } - transform-block-scoping { "electron":"0.36" } - transform-regenerator { "electron":"0.36" } - transform-exponentiation-operator { "electron":"0.36" } - transform-async-to-generator { "electron":"0.36" } - proposal-async-generator-functions { "electron":"0.36" } - proposal-object-rest-spread { "electron":"0.36" } - proposal-unicode-property-regex { "electron":"0.36" } - proposal-json-strings { "electron":"0.36" } - proposal-optional-catch-binding { "electron":"0.36" } - transform-named-capturing-groups-regex { "electron":"0.36" } - transform-member-expression-literals { "electron":"0.36" } - transform-property-literals { "electron":"0.36" } - -Using polyfills with `entry` option: - -[/src/in.js] Replaced @babel/polyfill entries with the following polyfills: - es6.array.every { "electron":"0.36" } - es6.array.filter { "electron":"0.36" } - es7.array.flat-map { "electron":"0.36" } - es6.array.for-each { "electron":"0.36" } - es6.array.from { "electron":"0.36" } - es6.array.index-of { "electron":"0.36" } - es6.array.is-array { "electron":"0.36" } - es6.array.last-index-of { "electron":"0.36" } - es6.array.map { "electron":"0.36" } - es6.array.reduce { "electron":"0.36" } - es6.array.reduce-right { "electron":"0.36" } - es6.array.some { "electron":"0.36" } - es6.array.sort { "electron":"0.36" } - es6.array.species { "electron":"0.36" } - es6.date.now { "electron":"0.36" } - es6.date.to-iso-string { "electron":"0.36" } - es6.date.to-json { "electron":"0.36" } - es6.date.to-string { "electron":"0.36" } - es6.function.bind { "electron":"0.36" } - es6.function.has-instance { "electron":"0.36" } - es6.function.name { "electron":"0.36" } - es6.map { "electron":"0.36" } - es6.object.assign { "electron":"0.36" } - es6.object.create { "electron":"0.36" } - es7.object.define-getter { "electron":"0.36" } - es7.object.define-setter { "electron":"0.36" } - es6.object.define-property { "electron":"0.36" } - es6.object.define-properties { "electron":"0.36" } - es7.object.entries { "electron":"0.36" } - es7.object.get-own-property-descriptors { "electron":"0.36" } - es7.object.lookup-getter { "electron":"0.36" } - es7.object.lookup-setter { "electron":"0.36" } - es6.object.to-string { "electron":"0.36" } - es7.object.values { "electron":"0.36" } - es6.promise { "electron":"0.36" } - es7.promise.finally { "electron":"0.36" } - es6.reflect.apply { "electron":"0.36" } - es6.reflect.construct { "electron":"0.36" } - es6.reflect.define-property { "electron":"0.36" } - es6.reflect.delete-property { "electron":"0.36" } - es6.reflect.get { "electron":"0.36" } - es6.reflect.get-own-property-descriptor { "electron":"0.36" } - es6.reflect.get-prototype-of { "electron":"0.36" } - es6.reflect.has { "electron":"0.36" } - es6.reflect.is-extensible { "electron":"0.36" } - es6.reflect.own-keys { "electron":"0.36" } - es6.reflect.prevent-extensions { "electron":"0.36" } - es6.reflect.set { "electron":"0.36" } - es6.reflect.set-prototype-of { "electron":"0.36" } - es6.regexp.constructor { "electron":"0.36" } - es6.regexp.flags { "electron":"0.36" } - es6.regexp.match { "electron":"0.36" } - es6.regexp.replace { "electron":"0.36" } - es6.regexp.split { "electron":"0.36" } - es6.regexp.search { "electron":"0.36" } - es6.regexp.to-string { "electron":"0.36" } - es6.set { "electron":"0.36" } - es6.symbol { "electron":"0.36" } - es7.symbol.async-iterator { "electron":"0.36" } - es6.string.anchor { "electron":"0.36" } - es6.string.big { "electron":"0.36" } - es6.string.blink { "electron":"0.36" } - es6.string.bold { "electron":"0.36" } - es6.string.fixed { "electron":"0.36" } - es6.string.fontcolor { "electron":"0.36" } - es6.string.fontsize { "electron":"0.36" } - es6.string.italics { "electron":"0.36" } - es6.string.link { "electron":"0.36" } - es7.string.pad-start { "electron":"0.36" } - es7.string.pad-end { "electron":"0.36" } - es6.string.small { "electron":"0.36" } - es6.string.strike { "electron":"0.36" } - es6.string.sub { "electron":"0.36" } - es6.string.sup { "electron":"0.36" } - es6.string.trim { "electron":"0.36" } - es7.string.trim-left { "electron":"0.36" } - es7.string.trim-right { "electron":"0.36" } - es6.typed.array-buffer { "electron":"0.36" } - es6.typed.data-view { "electron":"0.36" } - es6.typed.int8-array { "electron":"0.36" } - es6.typed.uint8-array { "electron":"0.36" } - es6.typed.uint8-clamped-array { "electron":"0.36" } - es6.typed.int16-array { "electron":"0.36" } - es6.typed.uint16-array { "electron":"0.36" } - es6.typed.int32-array { "electron":"0.36" } - es6.typed.uint32-array { "electron":"0.36" } - es6.typed.float32-array { "electron":"0.36" } - es6.typed.float64-array { "electron":"0.36" } - es6.weak-map { "electron":"0.36" } - es6.weak-set { "electron":"0.36" } - web.timers { "electron":"0.36" } - web.immediate { "electron":"0.36" } - web.dom.iterable { "electron":"0.36" } -Successfully compiled 1 file with Babel. \ No newline at end of file diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs2-force-all-transforms/options.json b/packages/babel-preset-env/test/debug-fixtures/entry-corejs2-force-all-transforms/options.json deleted file mode 100644 index 3615dbaff0f6..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/entry-corejs2-force-all-transforms/options.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "presets": [ - ["../../lib", { - "debug": true, - "modules": false, - "targets": { - "chrome": 55 - }, - "useBuiltIns": "entry", - "corejs": 2, - "forceAllTransforms": true - }] - ] -} diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs2-force-all-transforms/stdout.txt b/packages/babel-preset-env/test/debug-fixtures/entry-corejs2-force-all-transforms/stdout.txt deleted file mode 100644 index 988f64db332a..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/entry-corejs2-force-all-transforms/stdout.txt +++ /dev/null @@ -1,63 +0,0 @@ -@babel/preset-env: `DEBUG` option - -Using targets: -{ - "chrome": "55" -} - -Using modules transform: false - -Using plugins: - transform-template-literals {} - transform-literals {} - transform-function-name {} - transform-arrow-functions {} - transform-block-scoped-functions {} - transform-classes {} - transform-object-super {} - transform-shorthand-properties {} - transform-duplicate-keys {} - transform-computed-properties {} - transform-for-of {} - transform-sticky-regex {} - transform-dotall-regex { "chrome":"55" } - transform-unicode-regex {} - transform-spread {} - transform-parameters {} - transform-destructuring {} - transform-block-scoping {} - transform-typeof-symbol {} - transform-new-target {} - transform-regenerator {} - transform-exponentiation-operator {} - transform-async-to-generator {} - proposal-async-generator-functions { "chrome":"55" } - proposal-object-rest-spread { "chrome":"55" } - proposal-unicode-property-regex { "chrome":"55" } - proposal-json-strings { "chrome":"55" } - proposal-optional-catch-binding { "chrome":"55" } - transform-named-capturing-groups-regex { "chrome":"55" } - transform-member-expression-literals {} - transform-property-literals {} - transform-reserved-words {} - -Using polyfills with `entry` option: - -[/src/in.js] Replaced @babel/polyfill entries with the following polyfills: - es7.array.flat-map { "chrome":"55" } - es6.array.sort { "chrome":"55" } - es7.object.define-getter { "chrome":"55" } - es7.object.define-setter { "chrome":"55" } - es7.object.lookup-getter { "chrome":"55" } - es7.object.lookup-setter { "chrome":"55" } - es6.object.to-string { "chrome":"55" } - es7.promise.finally { "chrome":"55" } - es7.symbol.async-iterator { "chrome":"55" } - es7.string.pad-start { "chrome":"55" } - es7.string.pad-end { "chrome":"55" } - es7.string.trim-left { "chrome":"55" } - es7.string.trim-right { "chrome":"55" } - web.timers { "chrome":"55" } - web.immediate { "chrome":"55" } - web.dom.iterable { "chrome":"55" } -Successfully compiled 1 file with Babel. \ No newline at end of file diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs2-no-import/options.json b/packages/babel-preset-env/test/debug-fixtures/entry-corejs2-no-import/options.json deleted file mode 100644 index b8acc7a56de8..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/entry-corejs2-no-import/options.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "presets": [ - ["../../lib", { - "debug": true, - "targets": { - "node": 6 - }, - "useBuiltIns": "entry", - "corejs": 2 - }] - ] -} diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs2-no-import/stdout.txt b/packages/babel-preset-env/test/debug-fixtures/entry-corejs2-no-import/stdout.txt deleted file mode 100644 index ac37a584bfdf..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/entry-corejs2-no-import/stdout.txt +++ /dev/null @@ -1,27 +0,0 @@ -@babel/preset-env: `DEBUG` option - -Using targets: -{ - "node": "6" -} - -Using modules transform: auto - -Using plugins: - transform-function-name { "node":"6" } - transform-for-of { "node":"6" } - transform-dotall-regex { "node":"6" } - transform-destructuring { "node":"6" } - transform-exponentiation-operator { "node":"6" } - transform-async-to-generator { "node":"6" } - proposal-async-generator-functions { "node":"6" } - proposal-object-rest-spread { "node":"6" } - proposal-unicode-property-regex { "node":"6" } - proposal-json-strings { "node":"6" } - proposal-optional-catch-binding { "node":"6" } - transform-named-capturing-groups-regex { "node":"6" } - -Using polyfills with `entry` option: - -[/src/in.js] Import of @babel/polyfill was not found. -Successfully compiled 1 file with Babel. \ No newline at end of file diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs2-proposals-chrome-71/options.json b/packages/babel-preset-env/test/debug-fixtures/entry-corejs2-proposals-chrome-71/options.json deleted file mode 100644 index 6873f884f7c8..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/entry-corejs2-proposals-chrome-71/options.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "presets": [ - ["../../lib", { - "debug": true, - "targets": { - "browsers": "chrome 71" - }, - "useBuiltIns": "entry", - "corejs": { "version": 2, "proposals": true } - }] - ] -} diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs2-proposals-chrome-71/stdout.txt b/packages/babel-preset-env/test/debug-fixtures/entry-corejs2-proposals-chrome-71/stdout.txt deleted file mode 100644 index c5a336627064..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/entry-corejs2-proposals-chrome-71/stdout.txt +++ /dev/null @@ -1,22 +0,0 @@ -@babel/preset-env: `DEBUG` option - -Using targets: -{ - "chrome": "71" -} - -Using modules transform: auto - -Using plugins: - syntax-async-generators { "chrome":"71" } - syntax-object-rest-spread { "chrome":"71" } - syntax-json-strings { "chrome":"71" } - syntax-optional-catch-binding { "chrome":"71" } - -Using polyfills with `entry` option: - -[/src/in.js] Replaced @babel/polyfill entries with the following polyfills: - web.timers { "chrome":"71" } - web.immediate { "chrome":"71" } - web.dom.iterable { "chrome":"71" } -Successfully compiled 1 file with Babel. \ No newline at end of file diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs2-proposals/options.json b/packages/babel-preset-env/test/debug-fixtures/entry-corejs2-proposals/options.json deleted file mode 100644 index e95eabddbf17..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/entry-corejs2-proposals/options.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "presets": [ - ["../../lib", { - "debug": true, - "useBuiltIns": "entry", - "corejs": { "version": 2, "proposals": true } - }] - ] -} diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs2-proposals/stdout.txt b/packages/babel-preset-env/test/debug-fixtures/entry-corejs2-proposals/stdout.txt deleted file mode 100644 index 04e8ce0e5829..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/entry-corejs2-proposals/stdout.txt +++ /dev/null @@ -1,193 +0,0 @@ -@babel/preset-env: `DEBUG` option - -Using targets: -{} - -Using modules transform: auto - -Using plugins: - transform-template-literals {} - transform-literals {} - transform-function-name {} - transform-arrow-functions {} - transform-block-scoped-functions {} - transform-classes {} - transform-object-super {} - transform-shorthand-properties {} - transform-duplicate-keys {} - transform-computed-properties {} - transform-for-of {} - transform-sticky-regex {} - transform-dotall-regex {} - transform-unicode-regex {} - transform-spread {} - transform-parameters {} - transform-destructuring {} - transform-block-scoping {} - transform-typeof-symbol {} - transform-new-target {} - transform-regenerator {} - transform-exponentiation-operator {} - transform-async-to-generator {} - proposal-async-generator-functions {} - proposal-object-rest-spread {} - proposal-unicode-property-regex {} - proposal-json-strings {} - proposal-optional-catch-binding {} - transform-named-capturing-groups-regex {} - transform-member-expression-literals {} - transform-property-literals {} - transform-reserved-words {} - -Using polyfills with `entry` option: - -[/src/in.js] Replaced @babel/polyfill entries with the following polyfills: - es6.array.copy-within {} - es6.array.every {} - es6.array.fill {} - es6.array.filter {} - es6.array.find {} - es6.array.find-index {} - es7.array.flat-map {} - es6.array.for-each {} - es6.array.from {} - es7.array.includes {} - es6.array.index-of {} - es6.array.is-array {} - es6.array.iterator {} - es6.array.last-index-of {} - es6.array.map {} - es6.array.of {} - es6.array.reduce {} - es6.array.reduce-right {} - es6.array.some {} - es6.array.sort {} - es6.array.species {} - es6.date.now {} - es6.date.to-iso-string {} - es6.date.to-json {} - es6.date.to-primitive {} - es6.date.to-string {} - es6.function.bind {} - es6.function.has-instance {} - es6.function.name {} - es6.map {} - es6.math.acosh {} - es6.math.asinh {} - es6.math.atanh {} - es6.math.cbrt {} - es6.math.clz32 {} - es6.math.cosh {} - es6.math.expm1 {} - es6.math.fround {} - es6.math.hypot {} - es6.math.imul {} - es6.math.log1p {} - es6.math.log10 {} - es6.math.log2 {} - es6.math.sign {} - es6.math.sinh {} - es6.math.tanh {} - es6.math.trunc {} - es6.number.constructor {} - es6.number.epsilon {} - es6.number.is-finite {} - es6.number.is-integer {} - es6.number.is-nan {} - es6.number.is-safe-integer {} - es6.number.max-safe-integer {} - es6.number.min-safe-integer {} - es6.number.parse-float {} - es6.number.parse-int {} - es6.object.assign {} - es6.object.create {} - es7.object.define-getter {} - es7.object.define-setter {} - es6.object.define-property {} - es6.object.define-properties {} - es7.object.entries {} - es6.object.freeze {} - es6.object.get-own-property-descriptor {} - es7.object.get-own-property-descriptors {} - es6.object.get-own-property-names {} - es6.object.get-prototype-of {} - es7.object.lookup-getter {} - es7.object.lookup-setter {} - es6.object.prevent-extensions {} - es6.object.to-string {} - es6.object.is {} - es6.object.is-frozen {} - es6.object.is-sealed {} - es6.object.is-extensible {} - es6.object.keys {} - es6.object.seal {} - es6.object.set-prototype-of {} - es7.object.values {} - es6.promise {} - es7.promise.finally {} - es6.reflect.apply {} - es6.reflect.construct {} - es6.reflect.define-property {} - es6.reflect.delete-property {} - es6.reflect.get {} - es6.reflect.get-own-property-descriptor {} - es6.reflect.get-prototype-of {} - es6.reflect.has {} - es6.reflect.is-extensible {} - es6.reflect.own-keys {} - es6.reflect.prevent-extensions {} - es6.reflect.set {} - es6.reflect.set-prototype-of {} - es6.regexp.constructor {} - es6.regexp.flags {} - es6.regexp.match {} - es6.regexp.replace {} - es6.regexp.split {} - es6.regexp.search {} - es6.regexp.to-string {} - es6.set {} - es6.symbol {} - es7.symbol.async-iterator {} - es6.string.anchor {} - es6.string.big {} - es6.string.blink {} - es6.string.bold {} - es6.string.code-point-at {} - es6.string.ends-with {} - es6.string.fixed {} - es6.string.fontcolor {} - es6.string.fontsize {} - es6.string.from-code-point {} - es6.string.includes {} - es6.string.italics {} - es6.string.iterator {} - es6.string.link {} - es7.string.pad-start {} - es7.string.pad-end {} - es6.string.raw {} - es6.string.repeat {} - es6.string.small {} - es6.string.starts-with {} - es6.string.strike {} - es6.string.sub {} - es6.string.sup {} - es6.string.trim {} - es7.string.trim-left {} - es7.string.trim-right {} - es6.typed.array-buffer {} - es6.typed.data-view {} - es6.typed.int8-array {} - es6.typed.uint8-array {} - es6.typed.uint8-clamped-array {} - es6.typed.int16-array {} - es6.typed.uint16-array {} - es6.typed.int32-array {} - es6.typed.uint32-array {} - es6.typed.float32-array {} - es6.typed.float64-array {} - es6.weak-map {} - es6.weak-set {} - web.timers {} - web.immediate {} - web.dom.iterable {} -Successfully compiled 1 file with Babel. \ No newline at end of file diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs2-shippedProposals-chrome-71/options.json b/packages/babel-preset-env/test/debug-fixtures/entry-corejs2-shippedProposals-chrome-71/options.json deleted file mode 100644 index 2998e96d184b..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/entry-corejs2-shippedProposals-chrome-71/options.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "presets": [ - ["../../lib", { - "debug": true, - "targets": { - "browsers": "chrome 71" - }, - "shippedProposals": true, - "useBuiltIns": "entry", - "corejs": 2 - }] - ] -} diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs2-shippedProposals-chrome-71/stdout.txt b/packages/babel-preset-env/test/debug-fixtures/entry-corejs2-shippedProposals-chrome-71/stdout.txt deleted file mode 100644 index c5a336627064..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/entry-corejs2-shippedProposals-chrome-71/stdout.txt +++ /dev/null @@ -1,22 +0,0 @@ -@babel/preset-env: `DEBUG` option - -Using targets: -{ - "chrome": "71" -} - -Using modules transform: auto - -Using plugins: - syntax-async-generators { "chrome":"71" } - syntax-object-rest-spread { "chrome":"71" } - syntax-json-strings { "chrome":"71" } - syntax-optional-catch-binding { "chrome":"71" } - -Using polyfills with `entry` option: - -[/src/in.js] Replaced @babel/polyfill entries with the following polyfills: - web.timers { "chrome":"71" } - web.immediate { "chrome":"71" } - web.dom.iterable { "chrome":"71" } -Successfully compiled 1 file with Babel. \ No newline at end of file diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs2-shippedProposals/options.json b/packages/babel-preset-env/test/debug-fixtures/entry-corejs2-shippedProposals/options.json deleted file mode 100644 index 519fd0ad0e7b..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/entry-corejs2-shippedProposals/options.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "presets": [ - ["../../lib", { - "debug": true, - "shippedProposals": true, - "useBuiltIns": "entry", - "corejs": 2 - }] - ] -} diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs2-shippedProposals/stdout.txt b/packages/babel-preset-env/test/debug-fixtures/entry-corejs2-shippedProposals/stdout.txt deleted file mode 100644 index 04e8ce0e5829..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/entry-corejs2-shippedProposals/stdout.txt +++ /dev/null @@ -1,193 +0,0 @@ -@babel/preset-env: `DEBUG` option - -Using targets: -{} - -Using modules transform: auto - -Using plugins: - transform-template-literals {} - transform-literals {} - transform-function-name {} - transform-arrow-functions {} - transform-block-scoped-functions {} - transform-classes {} - transform-object-super {} - transform-shorthand-properties {} - transform-duplicate-keys {} - transform-computed-properties {} - transform-for-of {} - transform-sticky-regex {} - transform-dotall-regex {} - transform-unicode-regex {} - transform-spread {} - transform-parameters {} - transform-destructuring {} - transform-block-scoping {} - transform-typeof-symbol {} - transform-new-target {} - transform-regenerator {} - transform-exponentiation-operator {} - transform-async-to-generator {} - proposal-async-generator-functions {} - proposal-object-rest-spread {} - proposal-unicode-property-regex {} - proposal-json-strings {} - proposal-optional-catch-binding {} - transform-named-capturing-groups-regex {} - transform-member-expression-literals {} - transform-property-literals {} - transform-reserved-words {} - -Using polyfills with `entry` option: - -[/src/in.js] Replaced @babel/polyfill entries with the following polyfills: - es6.array.copy-within {} - es6.array.every {} - es6.array.fill {} - es6.array.filter {} - es6.array.find {} - es6.array.find-index {} - es7.array.flat-map {} - es6.array.for-each {} - es6.array.from {} - es7.array.includes {} - es6.array.index-of {} - es6.array.is-array {} - es6.array.iterator {} - es6.array.last-index-of {} - es6.array.map {} - es6.array.of {} - es6.array.reduce {} - es6.array.reduce-right {} - es6.array.some {} - es6.array.sort {} - es6.array.species {} - es6.date.now {} - es6.date.to-iso-string {} - es6.date.to-json {} - es6.date.to-primitive {} - es6.date.to-string {} - es6.function.bind {} - es6.function.has-instance {} - es6.function.name {} - es6.map {} - es6.math.acosh {} - es6.math.asinh {} - es6.math.atanh {} - es6.math.cbrt {} - es6.math.clz32 {} - es6.math.cosh {} - es6.math.expm1 {} - es6.math.fround {} - es6.math.hypot {} - es6.math.imul {} - es6.math.log1p {} - es6.math.log10 {} - es6.math.log2 {} - es6.math.sign {} - es6.math.sinh {} - es6.math.tanh {} - es6.math.trunc {} - es6.number.constructor {} - es6.number.epsilon {} - es6.number.is-finite {} - es6.number.is-integer {} - es6.number.is-nan {} - es6.number.is-safe-integer {} - es6.number.max-safe-integer {} - es6.number.min-safe-integer {} - es6.number.parse-float {} - es6.number.parse-int {} - es6.object.assign {} - es6.object.create {} - es7.object.define-getter {} - es7.object.define-setter {} - es6.object.define-property {} - es6.object.define-properties {} - es7.object.entries {} - es6.object.freeze {} - es6.object.get-own-property-descriptor {} - es7.object.get-own-property-descriptors {} - es6.object.get-own-property-names {} - es6.object.get-prototype-of {} - es7.object.lookup-getter {} - es7.object.lookup-setter {} - es6.object.prevent-extensions {} - es6.object.to-string {} - es6.object.is {} - es6.object.is-frozen {} - es6.object.is-sealed {} - es6.object.is-extensible {} - es6.object.keys {} - es6.object.seal {} - es6.object.set-prototype-of {} - es7.object.values {} - es6.promise {} - es7.promise.finally {} - es6.reflect.apply {} - es6.reflect.construct {} - es6.reflect.define-property {} - es6.reflect.delete-property {} - es6.reflect.get {} - es6.reflect.get-own-property-descriptor {} - es6.reflect.get-prototype-of {} - es6.reflect.has {} - es6.reflect.is-extensible {} - es6.reflect.own-keys {} - es6.reflect.prevent-extensions {} - es6.reflect.set {} - es6.reflect.set-prototype-of {} - es6.regexp.constructor {} - es6.regexp.flags {} - es6.regexp.match {} - es6.regexp.replace {} - es6.regexp.split {} - es6.regexp.search {} - es6.regexp.to-string {} - es6.set {} - es6.symbol {} - es7.symbol.async-iterator {} - es6.string.anchor {} - es6.string.big {} - es6.string.blink {} - es6.string.bold {} - es6.string.code-point-at {} - es6.string.ends-with {} - es6.string.fixed {} - es6.string.fontcolor {} - es6.string.fontsize {} - es6.string.from-code-point {} - es6.string.includes {} - es6.string.italics {} - es6.string.iterator {} - es6.string.link {} - es7.string.pad-start {} - es7.string.pad-end {} - es6.string.raw {} - es6.string.repeat {} - es6.string.small {} - es6.string.starts-with {} - es6.string.strike {} - es6.string.sub {} - es6.string.sup {} - es6.string.trim {} - es7.string.trim-left {} - es7.string.trim-right {} - es6.typed.array-buffer {} - es6.typed.data-view {} - es6.typed.int8-array {} - es6.typed.uint8-array {} - es6.typed.uint8-clamped-array {} - es6.typed.int16-array {} - es6.typed.uint16-array {} - es6.typed.int32-array {} - es6.typed.uint32-array {} - es6.typed.float32-array {} - es6.typed.float64-array {} - es6.weak-map {} - es6.weak-set {} - web.timers {} - web.immediate {} - web.dom.iterable {} -Successfully compiled 1 file with Babel. \ No newline at end of file diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs2-specific-targets/options.json b/packages/babel-preset-env/test/debug-fixtures/entry-corejs2-specific-targets/options.json deleted file mode 100644 index dc30ad296d4b..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/entry-corejs2-specific-targets/options.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "presets": [ - ["../../lib", { - "debug": true, - "targets": { - "browsers": "ie 10, ios 9, safari 7, edge 13, chrome 54, firefox 49" - }, - "useBuiltIns": "entry", - "corejs": 2 - }] - ] -} diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs2-specific-targets/stdout.txt b/packages/babel-preset-env/test/debug-fixtures/entry-corejs2-specific-targets/stdout.txt deleted file mode 100644 index a7c6a94b05aa..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/entry-corejs2-specific-targets/stdout.txt +++ /dev/null @@ -1,178 +0,0 @@ -@babel/preset-env: `DEBUG` option - -Using targets: -{ - "chrome": "54", - "edge": "13", - "firefox": "49", - "ie": "10", - "ios": "9", - "safari": "7" -} - -Using modules transform: auto - -Using plugins: - transform-template-literals { "ie":"10", "ios":"9", "safari":"7" } - transform-literals { "firefox":"49", "ie":"10", "safari":"7" } - transform-function-name { "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } - transform-arrow-functions { "ie":"10", "ios":"9", "safari":"7" } - transform-block-scoped-functions { "ie":"10", "ios":"9", "safari":"7" } - transform-classes { "ie":"10", "ios":"9", "safari":"7" } - transform-object-super { "ie":"10", "ios":"9", "safari":"7" } - transform-shorthand-properties { "ie":"10", "safari":"7" } - transform-duplicate-keys { "ie":"10", "safari":"7" } - transform-computed-properties { "ie":"10", "safari":"7" } - transform-for-of { "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } - transform-sticky-regex { "ie":"10", "ios":"9", "safari":"7" } - transform-dotall-regex { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } - transform-unicode-regex { "ie":"10", "ios":"9", "safari":"7" } - transform-spread { "ie":"10", "ios":"9", "safari":"7" } - transform-parameters { "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } - transform-destructuring { "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } - transform-block-scoping { "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } - transform-typeof-symbol { "ie":"10", "safari":"7" } - transform-new-target { "edge":"13", "ie":"10", "ios":"9", "safari":"7" } - transform-regenerator { "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } - transform-exponentiation-operator { "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } - transform-async-to-generator { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } - proposal-async-generator-functions { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } - proposal-object-rest-spread { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } - proposal-unicode-property-regex { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } - proposal-json-strings { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } - proposal-optional-catch-binding { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } - transform-named-capturing-groups-regex { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } - -Using polyfills with `entry` option: - -[/src/in.js] Replaced @babel/polyfill entries with the following polyfills: - es6.array.copy-within { "ie":"10", "safari":"7" } - es6.array.fill { "ie":"10", "safari":"7" } - es6.array.find { "ie":"10", "safari":"7" } - es6.array.find-index { "ie":"10", "safari":"7" } - es7.array.flat-map { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } - es6.array.from { "edge":"13", "ie":"10", "ios":"9", "safari":"7" } - es7.array.includes { "edge":"13", "ie":"10", "ios":"9", "safari":"7" } - es6.array.iterator { "ie":"10", "safari":"7" } - es6.array.of { "ie":"10", "safari":"7" } - es6.array.sort { "chrome":"54", "ios":"9", "safari":"7" } - es6.array.species { "ie":"10", "ios":"9", "safari":"7" } - es6.date.to-json { "ios":"9", "safari":"7" } - es6.date.to-primitive { "edge":"13", "ie":"10", "ios":"9", "safari":"7" } - es6.function.has-instance { "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } - es6.function.name { "edge":"13", "ie":"10" } - es6.map { "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } - es6.math.acosh { "ie":"10", "safari":"7" } - es6.math.asinh { "ie":"10", "safari":"7" } - es6.math.atanh { "ie":"10", "safari":"7" } - es6.math.cbrt { "ie":"10", "safari":"7" } - es6.math.clz32 { "ie":"10", "safari":"7" } - es6.math.cosh { "ie":"10", "safari":"7" } - es6.math.expm1 { "ie":"10", "safari":"7" } - es6.math.fround { "ie":"10", "safari":"7" } - es6.math.hypot { "ie":"10", "safari":"7" } - es6.math.imul { "ie":"10" } - es6.math.log1p { "ie":"10", "safari":"7" } - es6.math.log10 { "ie":"10", "safari":"7" } - es6.math.log2 { "ie":"10", "safari":"7" } - es6.math.sign { "ie":"10", "safari":"7" } - es6.math.sinh { "ie":"10", "safari":"7" } - es6.math.tanh { "ie":"10", "safari":"7" } - es6.math.trunc { "ie":"10", "safari":"7" } - es6.number.constructor { "ie":"10", "safari":"7" } - es6.number.epsilon { "ie":"10", "safari":"7" } - es6.number.is-finite { "ie":"10", "safari":"7" } - es6.number.is-integer { "ie":"10", "safari":"7" } - es6.number.is-nan { "ie":"10", "safari":"7" } - es6.number.is-safe-integer { "ie":"10", "safari":"7" } - es6.number.max-safe-integer { "ie":"10", "safari":"7" } - es6.number.min-safe-integer { "ie":"10", "safari":"7" } - es6.number.parse-float { "ie":"10", "safari":"7" } - es6.number.parse-int { "ie":"10", "safari":"7" } - es6.object.assign { "ie":"10", "ios":"9", "safari":"7" } - es7.object.define-getter { "chrome":"54", "edge":"13", "ie":"10", "safari":"7" } - es7.object.define-setter { "chrome":"54", "edge":"13", "ie":"10", "safari":"7" } - es7.object.entries { "edge":"13", "ie":"10", "ios":"9", "safari":"7" } - es6.object.freeze { "ie":"10", "safari":"7" } - es6.object.get-own-property-descriptor { "ie":"10", "safari":"7" } - es7.object.get-own-property-descriptors { "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } - es6.object.get-own-property-names { "ie":"10", "safari":"7" } - es6.object.get-prototype-of { "ie":"10", "safari":"7" } - es7.object.lookup-getter { "chrome":"54", "edge":"13", "ie":"10", "safari":"7" } - es7.object.lookup-setter { "chrome":"54", "edge":"13", "ie":"10", "safari":"7" } - es6.object.prevent-extensions { "ie":"10", "safari":"7" } - es6.object.to-string { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } - es6.object.is { "ie":"10", "safari":"7" } - es6.object.is-frozen { "ie":"10", "safari":"7" } - es6.object.is-sealed { "ie":"10", "safari":"7" } - es6.object.is-extensible { "ie":"10", "safari":"7" } - es6.object.keys { "ie":"10", "safari":"7" } - es6.object.seal { "ie":"10", "safari":"7" } - es6.object.set-prototype-of { "ie":"10", "safari":"7" } - es7.object.values { "edge":"13", "ie":"10", "ios":"9", "safari":"7" } - es6.promise { "edge":"13", "ie":"10", "ios":"9", "safari":"7" } - es7.promise.finally { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } - es6.reflect.apply { "ie":"10", "ios":"9", "safari":"7" } - es6.reflect.construct { "ie":"10", "ios":"9", "safari":"7" } - es6.reflect.define-property { "ie":"10", "ios":"9", "safari":"7" } - es6.reflect.delete-property { "ie":"10", "ios":"9", "safari":"7" } - es6.reflect.get { "ie":"10", "ios":"9", "safari":"7" } - es6.reflect.get-own-property-descriptor { "ie":"10", "ios":"9", "safari":"7" } - es6.reflect.get-prototype-of { "ie":"10", "ios":"9", "safari":"7" } - es6.reflect.has { "ie":"10", "ios":"9", "safari":"7" } - es6.reflect.is-extensible { "ie":"10", "ios":"9", "safari":"7" } - es6.reflect.own-keys { "ie":"10", "ios":"9", "safari":"7" } - es6.reflect.prevent-extensions { "ie":"10", "ios":"9", "safari":"7" } - es6.reflect.set { "ie":"10", "ios":"9", "safari":"7" } - es6.reflect.set-prototype-of { "ie":"10", "ios":"9", "safari":"7" } - es6.regexp.constructor { "edge":"13", "ie":"10", "ios":"9", "safari":"7" } - es6.regexp.flags { "edge":"13", "ie":"10", "safari":"7" } - es6.regexp.match { "edge":"13", "ie":"10", "ios":"9", "safari":"7" } - es6.regexp.replace { "edge":"13", "ie":"10", "ios":"9", "safari":"7" } - es6.regexp.split { "edge":"13", "ie":"10", "ios":"9", "safari":"7" } - es6.regexp.search { "edge":"13", "ie":"10", "ios":"9", "safari":"7" } - es6.regexp.to-string { "edge":"13", "ie":"10", "ios":"9", "safari":"7" } - es6.set { "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } - es6.symbol { "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } - es7.symbol.async-iterator { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } - es6.string.anchor { "ie":"10" } - es6.string.big { "ie":"10" } - es6.string.blink { "ie":"10" } - es6.string.bold { "ie":"10" } - es6.string.code-point-at { "ie":"10", "safari":"7" } - es6.string.ends-with { "ie":"10", "safari":"7" } - es6.string.fixed { "ie":"10" } - es6.string.fontcolor { "ie":"10" } - es6.string.fontsize { "ie":"10" } - es6.string.from-code-point { "ie":"10", "safari":"7" } - es6.string.includes { "ie":"10", "safari":"7" } - es6.string.italics { "ie":"10" } - es6.string.iterator { "ie":"10", "safari":"7" } - es6.string.link { "ie":"10" } - es7.string.pad-start { "chrome":"54", "edge":"13", "ie":"10", "ios":"9", "safari":"7" } - es7.string.pad-end { "chrome":"54", "edge":"13", "ie":"10", "ios":"9", "safari":"7" } - es6.string.raw { "ie":"10", "safari":"7" } - es6.string.repeat { "ie":"10", "safari":"7" } - es6.string.small { "ie":"10" } - es6.string.starts-with { "ie":"10", "safari":"7" } - es6.string.strike { "ie":"10" } - es6.string.sub { "ie":"10" } - es6.string.sup { "ie":"10" } - es7.string.trim-left { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } - es7.string.trim-right { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } - es6.typed.array-buffer { "ie":"10", "ios":"9", "safari":"7" } - es6.typed.int8-array { "ie":"10", "ios":"9", "safari":"7" } - es6.typed.uint8-array { "ie":"10", "ios":"9", "safari":"7" } - es6.typed.uint8-clamped-array { "ie":"10", "ios":"9", "safari":"7" } - es6.typed.int16-array { "ie":"10", "ios":"9", "safari":"7" } - es6.typed.uint16-array { "ie":"10", "ios":"9", "safari":"7" } - es6.typed.int32-array { "ie":"10", "ios":"9", "safari":"7" } - es6.typed.uint32-array { "ie":"10", "ios":"9", "safari":"7" } - es6.typed.float32-array { "ie":"10", "ios":"9", "safari":"7" } - es6.typed.float64-array { "ie":"10", "ios":"9", "safari":"7" } - es6.weak-map { "edge":"13", "firefox":"49", "ie":"10", "safari":"7" } - es6.weak-set { "edge":"13", "firefox":"49", "ie":"10", "safari":"7" } - web.timers { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } - web.immediate { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } - web.dom.iterable { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } -Successfully compiled 1 file with Babel. \ No newline at end of file diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs2-versions-decimals/options.json b/packages/babel-preset-env/test/debug-fixtures/entry-corejs2-versions-decimals/options.json deleted file mode 100644 index abf19b511667..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/entry-corejs2-versions-decimals/options.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "presets": [ - ["../../lib", { - "useBuiltIns": "entry", - "corejs": 2, - "debug": true, - "targets": { - "chrome": 54, - "electron": 0.36, - "node": 6.10, - "ie": 10 - } - }] - ] -} diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs2-versions-decimals/stdout.txt b/packages/babel-preset-env/test/debug-fixtures/entry-corejs2-versions-decimals/stdout.txt deleted file mode 100644 index 3988359b77cf..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/entry-corejs2-versions-decimals/stdout.txt +++ /dev/null @@ -1,205 +0,0 @@ -Warning, the following targets are using a decimal version: - - electron: 0.36 - node: 6.1 - -We recommend using a string for minor/patch versions to avoid numbers like 6.10 -getting parsed as 6.1, which can lead to unexpected behavior. - -@babel/preset-env: `DEBUG` option - -Using targets: -{ - "chrome": "54", - "electron": "0.36", - "ie": "10", - "node": "6.1" -} - -Using modules transform: auto - -Using plugins: - transform-template-literals { "ie":"10" } - transform-literals { "ie":"10" } - transform-function-name { "electron":"0.36", "ie":"10", "node":"6.1" } - transform-arrow-functions { "ie":"10" } - transform-block-scoped-functions { "ie":"10" } - transform-classes { "ie":"10" } - transform-object-super { "ie":"10" } - transform-shorthand-properties { "ie":"10" } - transform-duplicate-keys { "ie":"10" } - transform-computed-properties { "ie":"10" } - transform-for-of { "electron":"0.36", "ie":"10", "node":"6.1" } - transform-sticky-regex { "electron":"0.36", "ie":"10" } - transform-dotall-regex { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } - transform-unicode-regex { "electron":"0.36", "ie":"10" } - transform-spread { "ie":"10" } - transform-parameters { "electron":"0.36", "ie":"10" } - transform-destructuring { "electron":"0.36", "ie":"10", "node":"6.1" } - transform-block-scoping { "electron":"0.36", "ie":"10" } - transform-typeof-symbol { "ie":"10" } - transform-new-target { "ie":"10" } - transform-regenerator { "electron":"0.36", "ie":"10" } - transform-exponentiation-operator { "electron":"0.36", "ie":"10", "node":"6.1" } - transform-async-to-generator { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } - proposal-async-generator-functions { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } - proposal-object-rest-spread { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } - proposal-unicode-property-regex { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } - proposal-json-strings { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } - proposal-optional-catch-binding { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } - transform-named-capturing-groups-regex { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } - transform-member-expression-literals { "electron":"0.36" } - transform-property-literals { "electron":"0.36" } - -Using polyfills with `entry` option: - -[/src/in.js] Replaced @babel/polyfill entries with the following polyfills: - es6.array.copy-within { "ie":"10" } - es6.array.every { "electron":"0.36" } - es6.array.fill { "ie":"10" } - es6.array.filter { "electron":"0.36" } - es6.array.find { "ie":"10" } - es6.array.find-index { "ie":"10" } - es7.array.flat-map { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } - es6.array.for-each { "electron":"0.36" } - es6.array.from { "electron":"0.36", "ie":"10", "node":"6.1" } - es7.array.includes { "ie":"10" } - es6.array.index-of { "electron":"0.36" } - es6.array.is-array { "electron":"0.36" } - es6.array.iterator { "ie":"10" } - es6.array.last-index-of { "electron":"0.36" } - es6.array.map { "electron":"0.36" } - es6.array.of { "ie":"10" } - es6.array.reduce { "electron":"0.36" } - es6.array.reduce-right { "electron":"0.36" } - es6.array.some { "electron":"0.36" } - es6.array.sort { "chrome":"54", "electron":"0.36", "node":"6.1" } - es6.array.species { "electron":"0.36", "ie":"10", "node":"6.1" } - es6.date.now { "electron":"0.36" } - es6.date.to-iso-string { "electron":"0.36" } - es6.date.to-json { "electron":"0.36" } - es6.date.to-primitive { "ie":"10" } - es6.date.to-string { "electron":"0.36" } - es6.function.bind { "electron":"0.36" } - es6.function.has-instance { "electron":"0.36", "ie":"10", "node":"6.1" } - es6.function.name { "electron":"0.36", "ie":"10" } - es6.map { "electron":"0.36", "ie":"10", "node":"6.1" } - es6.math.acosh { "ie":"10" } - es6.math.asinh { "ie":"10" } - es6.math.atanh { "ie":"10" } - es6.math.cbrt { "ie":"10" } - es6.math.clz32 { "ie":"10" } - es6.math.cosh { "ie":"10" } - es6.math.expm1 { "ie":"10" } - es6.math.fround { "ie":"10" } - es6.math.hypot { "ie":"10" } - es6.math.imul { "ie":"10" } - es6.math.log1p { "ie":"10" } - es6.math.log10 { "ie":"10" } - es6.math.log2 { "ie":"10" } - es6.math.sign { "ie":"10" } - es6.math.sinh { "ie":"10" } - es6.math.tanh { "ie":"10" } - es6.math.trunc { "ie":"10" } - es6.number.constructor { "ie":"10" } - es6.number.epsilon { "ie":"10" } - es6.number.is-finite { "ie":"10" } - es6.number.is-integer { "ie":"10" } - es6.number.is-nan { "ie":"10" } - es6.number.is-safe-integer { "ie":"10" } - es6.number.max-safe-integer { "ie":"10" } - es6.number.min-safe-integer { "ie":"10" } - es6.number.parse-float { "ie":"10" } - es6.number.parse-int { "ie":"10" } - es6.object.assign { "electron":"0.36", "ie":"10" } - es6.object.create { "electron":"0.36" } - es7.object.define-getter { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } - es7.object.define-setter { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } - es6.object.define-property { "electron":"0.36" } - es6.object.define-properties { "electron":"0.36" } - es7.object.entries { "electron":"0.36", "ie":"10", "node":"6.1" } - es6.object.freeze { "ie":"10" } - es6.object.get-own-property-descriptor { "ie":"10" } - es7.object.get-own-property-descriptors { "electron":"0.36", "ie":"10", "node":"6.1" } - es6.object.get-own-property-names { "ie":"10" } - es6.object.get-prototype-of { "ie":"10" } - es7.object.lookup-getter { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } - es7.object.lookup-setter { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } - es6.object.prevent-extensions { "ie":"10" } - es6.object.to-string { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } - es6.object.is { "ie":"10" } - es6.object.is-frozen { "ie":"10" } - es6.object.is-sealed { "ie":"10" } - es6.object.is-extensible { "ie":"10" } - es6.object.keys { "ie":"10" } - es6.object.seal { "ie":"10" } - es6.object.set-prototype-of { "ie":"10" } - es7.object.values { "electron":"0.36", "ie":"10", "node":"6.1" } - es6.promise { "electron":"0.36", "ie":"10", "node":"6.1" } - es7.promise.finally { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } - es6.reflect.apply { "electron":"0.36", "ie":"10" } - es6.reflect.construct { "electron":"0.36", "ie":"10" } - es6.reflect.define-property { "electron":"0.36", "ie":"10" } - es6.reflect.delete-property { "electron":"0.36", "ie":"10" } - es6.reflect.get { "electron":"0.36", "ie":"10" } - es6.reflect.get-own-property-descriptor { "electron":"0.36", "ie":"10" } - es6.reflect.get-prototype-of { "electron":"0.36", "ie":"10" } - es6.reflect.has { "electron":"0.36", "ie":"10" } - es6.reflect.is-extensible { "electron":"0.36", "ie":"10" } - es6.reflect.own-keys { "electron":"0.36", "ie":"10" } - es6.reflect.prevent-extensions { "electron":"0.36", "ie":"10" } - es6.reflect.set { "electron":"0.36", "ie":"10" } - es6.reflect.set-prototype-of { "electron":"0.36", "ie":"10" } - es6.regexp.constructor { "electron":"0.36", "ie":"10" } - es6.regexp.flags { "electron":"0.36", "ie":"10" } - es6.regexp.match { "electron":"0.36", "ie":"10" } - es6.regexp.replace { "electron":"0.36", "ie":"10" } - es6.regexp.split { "electron":"0.36", "ie":"10" } - es6.regexp.search { "electron":"0.36", "ie":"10" } - es6.regexp.to-string { "electron":"0.36", "ie":"10" } - es6.set { "electron":"0.36", "ie":"10", "node":"6.1" } - es6.symbol { "electron":"0.36", "ie":"10", "node":"6.1" } - es7.symbol.async-iterator { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } - es6.string.anchor { "electron":"0.36", "ie":"10" } - es6.string.big { "electron":"0.36", "ie":"10" } - es6.string.blink { "electron":"0.36", "ie":"10" } - es6.string.bold { "electron":"0.36", "ie":"10" } - es6.string.code-point-at { "ie":"10" } - es6.string.ends-with { "ie":"10" } - es6.string.fixed { "electron":"0.36", "ie":"10" } - es6.string.fontcolor { "electron":"0.36", "ie":"10" } - es6.string.fontsize { "electron":"0.36", "ie":"10" } - es6.string.from-code-point { "ie":"10" } - es6.string.includes { "ie":"10" } - es6.string.italics { "electron":"0.36", "ie":"10" } - es6.string.iterator { "ie":"10" } - es6.string.link { "electron":"0.36", "ie":"10" } - es7.string.pad-start { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } - es7.string.pad-end { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } - es6.string.raw { "ie":"10" } - es6.string.repeat { "ie":"10" } - es6.string.small { "electron":"0.36", "ie":"10" } - es6.string.starts-with { "ie":"10" } - es6.string.strike { "electron":"0.36", "ie":"10" } - es6.string.sub { "electron":"0.36", "ie":"10" } - es6.string.sup { "electron":"0.36", "ie":"10" } - es6.string.trim { "electron":"0.36" } - es7.string.trim-left { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } - es7.string.trim-right { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } - es6.typed.array-buffer { "electron":"0.36", "ie":"10", "node":"6.1" } - es6.typed.data-view { "electron":"0.36" } - es6.typed.int8-array { "electron":"0.36", "ie":"10", "node":"6.1" } - es6.typed.uint8-array { "electron":"0.36", "ie":"10", "node":"6.1" } - es6.typed.uint8-clamped-array { "electron":"0.36", "ie":"10", "node":"6.1" } - es6.typed.int16-array { "electron":"0.36", "ie":"10", "node":"6.1" } - es6.typed.uint16-array { "electron":"0.36", "ie":"10", "node":"6.1" } - es6.typed.int32-array { "electron":"0.36", "ie":"10", "node":"6.1" } - es6.typed.uint32-array { "electron":"0.36", "ie":"10", "node":"6.1" } - es6.typed.float32-array { "electron":"0.36", "ie":"10", "node":"6.1" } - es6.typed.float64-array { "electron":"0.36", "ie":"10", "node":"6.1" } - es6.weak-map { "electron":"0.36", "ie":"10", "node":"6.1" } - es6.weak-set { "electron":"0.36", "ie":"10", "node":"6.1" } - web.timers { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } - web.immediate { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } - web.dom.iterable { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } -Successfully compiled 1 file with Babel. \ No newline at end of file diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs2-versions-strings/options.json b/packages/babel-preset-env/test/debug-fixtures/entry-corejs2-versions-strings/options.json deleted file mode 100644 index e586d8bb545e..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/entry-corejs2-versions-strings/options.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "presets": [ - ["../../lib", { - "useBuiltIns": "entry", - "corejs": 2, - "debug": true, - "targets": { - "chrome": "54", - "node": "6.10", - "ie": "10" - } - }] - ] -} diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs2-versions-strings/stdout.txt b/packages/babel-preset-env/test/debug-fixtures/entry-corejs2-versions-strings/stdout.txt deleted file mode 100644 index 2599a836d290..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/entry-corejs2-versions-strings/stdout.txt +++ /dev/null @@ -1,174 +0,0 @@ -@babel/preset-env: `DEBUG` option - -Using targets: -{ - "chrome": "54", - "ie": "10", - "node": "6.10" -} - -Using modules transform: auto - -Using plugins: - transform-template-literals { "ie":"10" } - transform-literals { "ie":"10" } - transform-function-name { "ie":"10" } - transform-arrow-functions { "ie":"10" } - transform-block-scoped-functions { "ie":"10" } - transform-classes { "ie":"10" } - transform-object-super { "ie":"10" } - transform-shorthand-properties { "ie":"10" } - transform-duplicate-keys { "ie":"10" } - transform-computed-properties { "ie":"10" } - transform-for-of { "ie":"10" } - transform-sticky-regex { "ie":"10" } - transform-dotall-regex { "chrome":"54", "ie":"10", "node":"6.10" } - transform-unicode-regex { "ie":"10" } - transform-spread { "ie":"10" } - transform-parameters { "ie":"10" } - transform-destructuring { "ie":"10" } - transform-block-scoping { "ie":"10" } - transform-typeof-symbol { "ie":"10" } - transform-new-target { "ie":"10" } - transform-regenerator { "ie":"10" } - transform-exponentiation-operator { "ie":"10", "node":"6.10" } - transform-async-to-generator { "chrome":"54", "ie":"10", "node":"6.10" } - proposal-async-generator-functions { "chrome":"54", "ie":"10", "node":"6.10" } - proposal-object-rest-spread { "chrome":"54", "ie":"10", "node":"6.10" } - proposal-unicode-property-regex { "chrome":"54", "ie":"10", "node":"6.10" } - proposal-json-strings { "chrome":"54", "ie":"10", "node":"6.10" } - proposal-optional-catch-binding { "chrome":"54", "ie":"10", "node":"6.10" } - transform-named-capturing-groups-regex { "chrome":"54", "ie":"10", "node":"6.10" } - -Using polyfills with `entry` option: - -[/src/in.js] Replaced @babel/polyfill entries with the following polyfills: - es6.array.copy-within { "ie":"10" } - es6.array.fill { "ie":"10" } - es6.array.find { "ie":"10" } - es6.array.find-index { "ie":"10" } - es7.array.flat-map { "chrome":"54", "ie":"10", "node":"6.10" } - es6.array.from { "ie":"10" } - es7.array.includes { "ie":"10" } - es6.array.iterator { "ie":"10" } - es6.array.of { "ie":"10" } - es6.array.sort { "chrome":"54", "node":"6.10" } - es6.array.species { "ie":"10" } - es6.date.to-primitive { "ie":"10" } - es6.function.has-instance { "ie":"10" } - es6.function.name { "ie":"10" } - es6.map { "ie":"10" } - es6.math.acosh { "ie":"10" } - es6.math.asinh { "ie":"10" } - es6.math.atanh { "ie":"10" } - es6.math.cbrt { "ie":"10" } - es6.math.clz32 { "ie":"10" } - es6.math.cosh { "ie":"10" } - es6.math.expm1 { "ie":"10" } - es6.math.fround { "ie":"10" } - es6.math.hypot { "ie":"10" } - es6.math.imul { "ie":"10" } - es6.math.log1p { "ie":"10" } - es6.math.log10 { "ie":"10" } - es6.math.log2 { "ie":"10" } - es6.math.sign { "ie":"10" } - es6.math.sinh { "ie":"10" } - es6.math.tanh { "ie":"10" } - es6.math.trunc { "ie":"10" } - es6.number.constructor { "ie":"10" } - es6.number.epsilon { "ie":"10" } - es6.number.is-finite { "ie":"10" } - es6.number.is-integer { "ie":"10" } - es6.number.is-nan { "ie":"10" } - es6.number.is-safe-integer { "ie":"10" } - es6.number.max-safe-integer { "ie":"10" } - es6.number.min-safe-integer { "ie":"10" } - es6.number.parse-float { "ie":"10" } - es6.number.parse-int { "ie":"10" } - es6.object.assign { "ie":"10" } - es7.object.define-getter { "chrome":"54", "ie":"10", "node":"6.10" } - es7.object.define-setter { "chrome":"54", "ie":"10", "node":"6.10" } - es7.object.entries { "ie":"10", "node":"6.10" } - es6.object.freeze { "ie":"10" } - es6.object.get-own-property-descriptor { "ie":"10" } - es7.object.get-own-property-descriptors { "ie":"10", "node":"6.10" } - es6.object.get-own-property-names { "ie":"10" } - es6.object.get-prototype-of { "ie":"10" } - es7.object.lookup-getter { "chrome":"54", "ie":"10", "node":"6.10" } - es7.object.lookup-setter { "chrome":"54", "ie":"10", "node":"6.10" } - es6.object.prevent-extensions { "ie":"10" } - es6.object.to-string { "chrome":"54", "ie":"10", "node":"6.10" } - es6.object.is { "ie":"10" } - es6.object.is-frozen { "ie":"10" } - es6.object.is-sealed { "ie":"10" } - es6.object.is-extensible { "ie":"10" } - es6.object.keys { "ie":"10" } - es6.object.seal { "ie":"10" } - es6.object.set-prototype-of { "ie":"10" } - es7.object.values { "ie":"10", "node":"6.10" } - es6.promise { "ie":"10" } - es7.promise.finally { "chrome":"54", "ie":"10", "node":"6.10" } - es6.reflect.apply { "ie":"10" } - es6.reflect.construct { "ie":"10" } - es6.reflect.define-property { "ie":"10" } - es6.reflect.delete-property { "ie":"10" } - es6.reflect.get { "ie":"10" } - es6.reflect.get-own-property-descriptor { "ie":"10" } - es6.reflect.get-prototype-of { "ie":"10" } - es6.reflect.has { "ie":"10" } - es6.reflect.is-extensible { "ie":"10" } - es6.reflect.own-keys { "ie":"10" } - es6.reflect.prevent-extensions { "ie":"10" } - es6.reflect.set { "ie":"10" } - es6.reflect.set-prototype-of { "ie":"10" } - es6.regexp.constructor { "ie":"10" } - es6.regexp.flags { "ie":"10" } - es6.regexp.match { "ie":"10" } - es6.regexp.replace { "ie":"10" } - es6.regexp.split { "ie":"10" } - es6.regexp.search { "ie":"10" } - es6.regexp.to-string { "ie":"10" } - es6.set { "ie":"10" } - es6.symbol { "ie":"10" } - es7.symbol.async-iterator { "chrome":"54", "ie":"10", "node":"6.10" } - es6.string.anchor { "ie":"10" } - es6.string.big { "ie":"10" } - es6.string.blink { "ie":"10" } - es6.string.bold { "ie":"10" } - es6.string.code-point-at { "ie":"10" } - es6.string.ends-with { "ie":"10" } - es6.string.fixed { "ie":"10" } - es6.string.fontcolor { "ie":"10" } - es6.string.fontsize { "ie":"10" } - es6.string.from-code-point { "ie":"10" } - es6.string.includes { "ie":"10" } - es6.string.italics { "ie":"10" } - es6.string.iterator { "ie":"10" } - es6.string.link { "ie":"10" } - es7.string.pad-start { "chrome":"54", "ie":"10", "node":"6.10" } - es7.string.pad-end { "chrome":"54", "ie":"10", "node":"6.10" } - es6.string.raw { "ie":"10" } - es6.string.repeat { "ie":"10" } - es6.string.small { "ie":"10" } - es6.string.starts-with { "ie":"10" } - es6.string.strike { "ie":"10" } - es6.string.sub { "ie":"10" } - es6.string.sup { "ie":"10" } - es7.string.trim-left { "chrome":"54", "ie":"10", "node":"6.10" } - es7.string.trim-right { "chrome":"54", "ie":"10", "node":"6.10" } - es6.typed.array-buffer { "ie":"10" } - es6.typed.int8-array { "ie":"10" } - es6.typed.uint8-array { "ie":"10" } - es6.typed.uint8-clamped-array { "ie":"10" } - es6.typed.int16-array { "ie":"10" } - es6.typed.uint16-array { "ie":"10" } - es6.typed.int32-array { "ie":"10" } - es6.typed.uint32-array { "ie":"10" } - es6.typed.float32-array { "ie":"10" } - es6.typed.float64-array { "ie":"10" } - es6.weak-map { "ie":"10" } - es6.weak-set { "ie":"10" } - web.timers { "chrome":"54", "ie":"10", "node":"6.10" } - web.immediate { "chrome":"54", "ie":"10", "node":"6.10" } - web.dom.iterable { "chrome":"54", "ie":"10", "node":"6.10" } -Successfully compiled 1 file with Babel. \ No newline at end of file diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs2/options.json b/packages/babel-preset-env/test/debug-fixtures/entry-corejs2/options.json deleted file mode 100644 index de9fd3231ddf..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/entry-corejs2/options.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "presets": [ - ["../../lib", { - "debug": true, - "targets": { - "browsers": "chrome >= 54, ie 10", - "node": 6 - }, - "useBuiltIns": "entry", - "corejs": 2 - }] - ] -} diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs2/stdout.txt b/packages/babel-preset-env/test/debug-fixtures/entry-corejs2/stdout.txt deleted file mode 100644 index 943bad68b9b1..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/entry-corejs2/stdout.txt +++ /dev/null @@ -1,174 +0,0 @@ -@babel/preset-env: `DEBUG` option - -Using targets: -{ - "chrome": "54", - "ie": "10", - "node": "6" -} - -Using modules transform: auto - -Using plugins: - transform-template-literals { "ie":"10" } - transform-literals { "ie":"10" } - transform-function-name { "ie":"10", "node":"6" } - transform-arrow-functions { "ie":"10" } - transform-block-scoped-functions { "ie":"10" } - transform-classes { "ie":"10" } - transform-object-super { "ie":"10" } - transform-shorthand-properties { "ie":"10" } - transform-duplicate-keys { "ie":"10" } - transform-computed-properties { "ie":"10" } - transform-for-of { "ie":"10", "node":"6" } - transform-sticky-regex { "ie":"10" } - transform-dotall-regex { "chrome":"54", "ie":"10", "node":"6" } - transform-unicode-regex { "ie":"10" } - transform-spread { "ie":"10" } - transform-parameters { "ie":"10" } - transform-destructuring { "ie":"10", "node":"6" } - transform-block-scoping { "ie":"10" } - transform-typeof-symbol { "ie":"10" } - transform-new-target { "ie":"10" } - transform-regenerator { "ie":"10" } - transform-exponentiation-operator { "ie":"10", "node":"6" } - transform-async-to-generator { "chrome":"54", "ie":"10", "node":"6" } - proposal-async-generator-functions { "chrome":"54", "ie":"10", "node":"6" } - proposal-object-rest-spread { "chrome":"54", "ie":"10", "node":"6" } - proposal-unicode-property-regex { "chrome":"54", "ie":"10", "node":"6" } - proposal-json-strings { "chrome":"54", "ie":"10", "node":"6" } - proposal-optional-catch-binding { "chrome":"54", "ie":"10", "node":"6" } - transform-named-capturing-groups-regex { "chrome":"54", "ie":"10", "node":"6" } - -Using polyfills with `entry` option: - -[/src/in.js] Replaced @babel/polyfill entries with the following polyfills: - es6.array.copy-within { "ie":"10" } - es6.array.fill { "ie":"10" } - es6.array.find { "ie":"10" } - es6.array.find-index { "ie":"10" } - es7.array.flat-map { "chrome":"54", "ie":"10", "node":"6" } - es6.array.from { "ie":"10", "node":"6" } - es7.array.includes { "ie":"10" } - es6.array.iterator { "ie":"10" } - es6.array.of { "ie":"10" } - es6.array.sort { "chrome":"54", "node":"6" } - es6.array.species { "ie":"10", "node":"6" } - es6.date.to-primitive { "ie":"10" } - es6.function.has-instance { "ie":"10", "node":"6" } - es6.function.name { "ie":"10" } - es6.map { "ie":"10", "node":"6" } - es6.math.acosh { "ie":"10" } - es6.math.asinh { "ie":"10" } - es6.math.atanh { "ie":"10" } - es6.math.cbrt { "ie":"10" } - es6.math.clz32 { "ie":"10" } - es6.math.cosh { "ie":"10" } - es6.math.expm1 { "ie":"10" } - es6.math.fround { "ie":"10" } - es6.math.hypot { "ie":"10" } - es6.math.imul { "ie":"10" } - es6.math.log1p { "ie":"10" } - es6.math.log10 { "ie":"10" } - es6.math.log2 { "ie":"10" } - es6.math.sign { "ie":"10" } - es6.math.sinh { "ie":"10" } - es6.math.tanh { "ie":"10" } - es6.math.trunc { "ie":"10" } - es6.number.constructor { "ie":"10" } - es6.number.epsilon { "ie":"10" } - es6.number.is-finite { "ie":"10" } - es6.number.is-integer { "ie":"10" } - es6.number.is-nan { "ie":"10" } - es6.number.is-safe-integer { "ie":"10" } - es6.number.max-safe-integer { "ie":"10" } - es6.number.min-safe-integer { "ie":"10" } - es6.number.parse-float { "ie":"10" } - es6.number.parse-int { "ie":"10" } - es6.object.assign { "ie":"10" } - es7.object.define-getter { "chrome":"54", "ie":"10", "node":"6" } - es7.object.define-setter { "chrome":"54", "ie":"10", "node":"6" } - es7.object.entries { "ie":"10", "node":"6" } - es6.object.freeze { "ie":"10" } - es6.object.get-own-property-descriptor { "ie":"10" } - es7.object.get-own-property-descriptors { "ie":"10", "node":"6" } - es6.object.get-own-property-names { "ie":"10" } - es6.object.get-prototype-of { "ie":"10" } - es7.object.lookup-getter { "chrome":"54", "ie":"10", "node":"6" } - es7.object.lookup-setter { "chrome":"54", "ie":"10", "node":"6" } - es6.object.prevent-extensions { "ie":"10" } - es6.object.to-string { "chrome":"54", "ie":"10", "node":"6" } - es6.object.is { "ie":"10" } - es6.object.is-frozen { "ie":"10" } - es6.object.is-sealed { "ie":"10" } - es6.object.is-extensible { "ie":"10" } - es6.object.keys { "ie":"10" } - es6.object.seal { "ie":"10" } - es6.object.set-prototype-of { "ie":"10" } - es7.object.values { "ie":"10", "node":"6" } - es6.promise { "ie":"10", "node":"6" } - es7.promise.finally { "chrome":"54", "ie":"10", "node":"6" } - es6.reflect.apply { "ie":"10" } - es6.reflect.construct { "ie":"10" } - es6.reflect.define-property { "ie":"10" } - es6.reflect.delete-property { "ie":"10" } - es6.reflect.get { "ie":"10" } - es6.reflect.get-own-property-descriptor { "ie":"10" } - es6.reflect.get-prototype-of { "ie":"10" } - es6.reflect.has { "ie":"10" } - es6.reflect.is-extensible { "ie":"10" } - es6.reflect.own-keys { "ie":"10" } - es6.reflect.prevent-extensions { "ie":"10" } - es6.reflect.set { "ie":"10" } - es6.reflect.set-prototype-of { "ie":"10" } - es6.regexp.constructor { "ie":"10" } - es6.regexp.flags { "ie":"10" } - es6.regexp.match { "ie":"10" } - es6.regexp.replace { "ie":"10" } - es6.regexp.split { "ie":"10" } - es6.regexp.search { "ie":"10" } - es6.regexp.to-string { "ie":"10" } - es6.set { "ie":"10", "node":"6" } - es6.symbol { "ie":"10", "node":"6" } - es7.symbol.async-iterator { "chrome":"54", "ie":"10", "node":"6" } - es6.string.anchor { "ie":"10" } - es6.string.big { "ie":"10" } - es6.string.blink { "ie":"10" } - es6.string.bold { "ie":"10" } - es6.string.code-point-at { "ie":"10" } - es6.string.ends-with { "ie":"10" } - es6.string.fixed { "ie":"10" } - es6.string.fontcolor { "ie":"10" } - es6.string.fontsize { "ie":"10" } - es6.string.from-code-point { "ie":"10" } - es6.string.includes { "ie":"10" } - es6.string.italics { "ie":"10" } - es6.string.iterator { "ie":"10" } - es6.string.link { "ie":"10" } - es7.string.pad-start { "chrome":"54", "ie":"10", "node":"6" } - es7.string.pad-end { "chrome":"54", "ie":"10", "node":"6" } - es6.string.raw { "ie":"10" } - es6.string.repeat { "ie":"10" } - es6.string.small { "ie":"10" } - es6.string.starts-with { "ie":"10" } - es6.string.strike { "ie":"10" } - es6.string.sub { "ie":"10" } - es6.string.sup { "ie":"10" } - es7.string.trim-left { "chrome":"54", "ie":"10", "node":"6" } - es7.string.trim-right { "chrome":"54", "ie":"10", "node":"6" } - es6.typed.array-buffer { "ie":"10", "node":"6" } - es6.typed.int8-array { "ie":"10", "node":"6" } - es6.typed.uint8-array { "ie":"10", "node":"6" } - es6.typed.uint8-clamped-array { "ie":"10", "node":"6" } - es6.typed.int16-array { "ie":"10", "node":"6" } - es6.typed.uint16-array { "ie":"10", "node":"6" } - es6.typed.int32-array { "ie":"10", "node":"6" } - es6.typed.uint32-array { "ie":"10", "node":"6" } - es6.typed.float32-array { "ie":"10", "node":"6" } - es6.typed.float64-array { "ie":"10", "node":"6" } - es6.weak-map { "ie":"10", "node":"6" } - es6.weak-set { "ie":"10", "node":"6" } - web.timers { "chrome":"54", "ie":"10", "node":"6" } - web.immediate { "chrome":"54", "ie":"10", "node":"6" } - web.dom.iterable { "chrome":"54", "ie":"10", "node":"6" } -Successfully compiled 1 file with Babel. \ No newline at end of file diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-all-chrome-71/options.json b/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-all-chrome-71/options.json deleted file mode 100644 index b9db1e21e401..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-all-chrome-71/options.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "presets": [ - ["../../lib", { - "debug": true, - "targets": { - "browsers": "chrome 71" - }, - "shippedProposals": true, - "useBuiltIns": "entry", - "corejs": 3 - }] - ] -} diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-all-chrome-71/stdout.txt b/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-all-chrome-71/stdout.txt deleted file mode 100644 index 9bd35deedc21..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-all-chrome-71/stdout.txt +++ /dev/null @@ -1,106 +0,0 @@ -@babel/preset-env: `DEBUG` option - -Using targets: -{ - "chrome": "71" -} - -Using modules transform: auto - -Using plugins: - syntax-async-generators { "chrome":"71" } - syntax-object-rest-spread { "chrome":"71" } - syntax-json-strings { "chrome":"71" } - syntax-optional-catch-binding { "chrome":"71" } - -Using polyfills with `entry` option: - -[/src/in.js] Replaced core-js entries with the following polyfills: - es.array.unscopables.flat { "chrome":"71" } - es.array.unscopables.flat-map { "chrome":"71" } - es.object.from-entries { "chrome":"71" } - esnext.aggregate-error { "chrome":"71" } - esnext.array.last-index { "chrome":"71" } - esnext.array.last-item { "chrome":"71" } - esnext.composite-key { "chrome":"71" } - esnext.composite-symbol { "chrome":"71" } - esnext.map.delete-all { "chrome":"71" } - esnext.map.every { "chrome":"71" } - esnext.map.filter { "chrome":"71" } - esnext.map.find { "chrome":"71" } - esnext.map.find-key { "chrome":"71" } - esnext.map.from { "chrome":"71" } - esnext.map.group-by { "chrome":"71" } - esnext.map.includes { "chrome":"71" } - esnext.map.key-by { "chrome":"71" } - esnext.map.key-of { "chrome":"71" } - esnext.map.map-keys { "chrome":"71" } - esnext.map.map-values { "chrome":"71" } - esnext.map.merge { "chrome":"71" } - esnext.map.of { "chrome":"71" } - esnext.map.reduce { "chrome":"71" } - esnext.map.some { "chrome":"71" } - esnext.map.update { "chrome":"71" } - esnext.math.clamp { "chrome":"71" } - esnext.math.deg-per-rad { "chrome":"71" } - esnext.math.degrees { "chrome":"71" } - esnext.math.fscale { "chrome":"71" } - esnext.math.iaddh { "chrome":"71" } - esnext.math.imulh { "chrome":"71" } - esnext.math.isubh { "chrome":"71" } - esnext.math.rad-per-deg { "chrome":"71" } - esnext.math.radians { "chrome":"71" } - esnext.math.scale { "chrome":"71" } - esnext.math.seeded-prng { "chrome":"71" } - esnext.math.signbit { "chrome":"71" } - esnext.math.umulh { "chrome":"71" } - esnext.number.from-string { "chrome":"71" } - esnext.observable { "chrome":"71" } - esnext.promise.all-settled { "chrome":"71" } - esnext.promise.any { "chrome":"71" } - esnext.promise.try { "chrome":"71" } - esnext.reflect.define-metadata { "chrome":"71" } - esnext.reflect.delete-metadata { "chrome":"71" } - esnext.reflect.get-metadata { "chrome":"71" } - esnext.reflect.get-metadata-keys { "chrome":"71" } - esnext.reflect.get-own-metadata { "chrome":"71" } - esnext.reflect.get-own-metadata-keys { "chrome":"71" } - esnext.reflect.has-metadata { "chrome":"71" } - esnext.reflect.has-own-metadata { "chrome":"71" } - esnext.reflect.metadata { "chrome":"71" } - esnext.set.add-all { "chrome":"71" } - esnext.set.delete-all { "chrome":"71" } - esnext.set.difference { "chrome":"71" } - esnext.set.every { "chrome":"71" } - esnext.set.filter { "chrome":"71" } - esnext.set.find { "chrome":"71" } - esnext.set.from { "chrome":"71" } - esnext.set.intersection { "chrome":"71" } - esnext.set.is-disjoint-from { "chrome":"71" } - esnext.set.is-subset-of { "chrome":"71" } - esnext.set.is-superset-of { "chrome":"71" } - esnext.set.join { "chrome":"71" } - esnext.set.map { "chrome":"71" } - esnext.set.of { "chrome":"71" } - esnext.set.reduce { "chrome":"71" } - esnext.set.some { "chrome":"71" } - esnext.set.symmetric-difference { "chrome":"71" } - esnext.set.union { "chrome":"71" } - esnext.string.at { "chrome":"71" } - esnext.string.code-points { "chrome":"71" } - esnext.string.replace-all { "chrome":"71" } - esnext.symbol.dispose { "chrome":"71" } - esnext.symbol.observable { "chrome":"71" } - esnext.symbol.pattern-match { "chrome":"71" } - esnext.weak-map.delete-all { "chrome":"71" } - esnext.weak-map.from { "chrome":"71" } - esnext.weak-map.of { "chrome":"71" } - esnext.weak-set.add-all { "chrome":"71" } - esnext.weak-set.delete-all { "chrome":"71" } - esnext.weak-set.from { "chrome":"71" } - esnext.weak-set.of { "chrome":"71" } - web.immediate { "chrome":"71" } - esnext.string.match-all { "chrome":"71" } - -[/src/in.js] Based on your targets, regenerator-runtime import excluded. -Successfully compiled 1 file with Babel. \ No newline at end of file diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-all/options.json b/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-all/options.json deleted file mode 100644 index 1e5ef9ed0a56..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-all/options.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "presets": [ - ["../../lib", { - "debug": true, - "shippedProposals": true, - "useBuiltIns": "entry", - "corejs": 3 - }] - ] -} diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-all/stdout.txt b/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-all/stdout.txt deleted file mode 100644 index cf2f612260b2..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-all/stdout.txt +++ /dev/null @@ -1,335 +0,0 @@ -@babel/preset-env: `DEBUG` option - -Using targets: -{} - -Using modules transform: auto - -Using plugins: - transform-template-literals {} - transform-literals {} - transform-function-name {} - transform-arrow-functions {} - transform-block-scoped-functions {} - transform-classes {} - transform-object-super {} - transform-shorthand-properties {} - transform-duplicate-keys {} - transform-computed-properties {} - transform-for-of {} - transform-sticky-regex {} - transform-dotall-regex {} - transform-unicode-regex {} - transform-spread {} - transform-parameters {} - transform-destructuring {} - transform-block-scoping {} - transform-typeof-symbol {} - transform-new-target {} - transform-regenerator {} - transform-exponentiation-operator {} - transform-async-to-generator {} - proposal-async-generator-functions {} - proposal-object-rest-spread {} - proposal-unicode-property-regex {} - proposal-json-strings {} - proposal-optional-catch-binding {} - transform-named-capturing-groups-regex {} - transform-member-expression-literals {} - transform-property-literals {} - transform-reserved-words {} - -Using polyfills with `entry` option: - -[/src/in.js] Replaced core-js entries with the following polyfills: - es.symbol {} - es.symbol.description {} - es.symbol.async-iterator {} - es.symbol.has-instance {} - es.symbol.is-concat-spreadable {} - es.symbol.iterator {} - es.symbol.match {} - es.symbol.replace {} - es.symbol.search {} - es.symbol.species {} - es.symbol.split {} - es.symbol.to-primitive {} - es.symbol.to-string-tag {} - es.symbol.unscopables {} - es.array.concat {} - es.array.copy-within {} - es.array.every {} - es.array.fill {} - es.array.filter {} - es.array.find {} - es.array.find-index {} - es.array.flat {} - es.array.flat-map {} - es.array.for-each {} - es.array.from {} - es.array.includes {} - es.array.index-of {} - es.array.is-array {} - es.array.iterator {} - es.array.join {} - es.array.last-index-of {} - es.array.map {} - es.array.of {} - es.array.reduce {} - es.array.reduce-right {} - es.array.reverse {} - es.array.slice {} - es.array.some {} - es.array.sort {} - es.array.species {} - es.array.splice {} - es.array.unscopables.flat {} - es.array.unscopables.flat-map {} - es.array-buffer.constructor {} - es.array-buffer.is-view {} - es.array-buffer.slice {} - es.data-view {} - es.date.now {} - es.date.to-iso-string {} - es.date.to-json {} - es.date.to-primitive {} - es.date.to-string {} - es.function.bind {} - es.function.has-instance {} - es.function.name {} - es.json.to-string-tag {} - es.map {} - es.math.acosh {} - es.math.asinh {} - es.math.atanh {} - es.math.cbrt {} - es.math.clz32 {} - es.math.cosh {} - es.math.expm1 {} - es.math.fround {} - es.math.hypot {} - es.math.imul {} - es.math.log10 {} - es.math.log1p {} - es.math.log2 {} - es.math.sign {} - es.math.sinh {} - es.math.tanh {} - es.math.to-string-tag {} - es.math.trunc {} - es.number.constructor {} - es.number.epsilon {} - es.number.is-finite {} - es.number.is-integer {} - es.number.is-nan {} - es.number.is-safe-integer {} - es.number.max-safe-integer {} - es.number.min-safe-integer {} - es.number.parse-float {} - es.number.parse-int {} - es.number.to-fixed {} - es.number.to-precision {} - es.object.assign {} - es.object.create {} - es.object.define-getter {} - es.object.define-properties {} - es.object.define-property {} - es.object.define-setter {} - es.object.entries {} - es.object.freeze {} - es.object.from-entries {} - es.object.get-own-property-descriptor {} - es.object.get-own-property-descriptors {} - es.object.get-own-property-names {} - es.object.get-prototype-of {} - es.object.is {} - es.object.is-extensible {} - es.object.is-frozen {} - es.object.is-sealed {} - es.object.keys {} - es.object.lookup-getter {} - es.object.lookup-setter {} - es.object.prevent-extensions {} - es.object.seal {} - es.object.set-prototype-of {} - es.object.to-string {} - es.object.values {} - es.parse-float {} - es.parse-int {} - es.promise {} - es.promise.finally {} - es.reflect.apply {} - es.reflect.construct {} - es.reflect.define-property {} - es.reflect.delete-property {} - es.reflect.get {} - es.reflect.get-own-property-descriptor {} - es.reflect.get-prototype-of {} - es.reflect.has {} - es.reflect.is-extensible {} - es.reflect.own-keys {} - es.reflect.prevent-extensions {} - es.reflect.set {} - es.reflect.set-prototype-of {} - es.regexp.constructor {} - es.regexp.exec {} - es.regexp.flags {} - es.regexp.to-string {} - es.set {} - es.string.code-point-at {} - es.string.ends-with {} - es.string.from-code-point {} - es.string.includes {} - es.string.iterator {} - es.string.match {} - es.string.pad-end {} - es.string.pad-start {} - es.string.raw {} - es.string.repeat {} - es.string.replace {} - es.string.search {} - es.string.split {} - es.string.starts-with {} - es.string.trim {} - es.string.trim-end {} - es.string.trim-start {} - es.string.anchor {} - es.string.big {} - es.string.blink {} - es.string.bold {} - es.string.fixed {} - es.string.fontcolor {} - es.string.fontsize {} - es.string.italics {} - es.string.link {} - es.string.small {} - es.string.strike {} - es.string.sub {} - es.string.sup {} - es.typed-array.float32-array {} - es.typed-array.float64-array {} - es.typed-array.int8-array {} - es.typed-array.int16-array {} - es.typed-array.int32-array {} - es.typed-array.uint8-array {} - es.typed-array.uint8-clamped-array {} - es.typed-array.uint16-array {} - es.typed-array.uint32-array {} - es.typed-array.copy-within {} - es.typed-array.every {} - es.typed-array.fill {} - es.typed-array.filter {} - es.typed-array.find {} - es.typed-array.find-index {} - es.typed-array.for-each {} - es.typed-array.from {} - es.typed-array.includes {} - es.typed-array.index-of {} - es.typed-array.iterator {} - es.typed-array.join {} - es.typed-array.last-index-of {} - es.typed-array.map {} - es.typed-array.of {} - es.typed-array.reduce {} - es.typed-array.reduce-right {} - es.typed-array.reverse {} - es.typed-array.set {} - es.typed-array.slice {} - es.typed-array.some {} - es.typed-array.sort {} - es.typed-array.subarray {} - es.typed-array.to-locale-string {} - es.typed-array.to-string {} - es.weak-map {} - es.weak-set {} - esnext.aggregate-error {} - esnext.array.last-index {} - esnext.array.last-item {} - esnext.composite-key {} - esnext.composite-symbol {} - esnext.global-this {} - esnext.map.delete-all {} - esnext.map.every {} - esnext.map.filter {} - esnext.map.find {} - esnext.map.find-key {} - esnext.map.from {} - esnext.map.group-by {} - esnext.map.includes {} - esnext.map.key-by {} - esnext.map.key-of {} - esnext.map.map-keys {} - esnext.map.map-values {} - esnext.map.merge {} - esnext.map.of {} - esnext.map.reduce {} - esnext.map.some {} - esnext.map.update {} - esnext.math.clamp {} - esnext.math.deg-per-rad {} - esnext.math.degrees {} - esnext.math.fscale {} - esnext.math.iaddh {} - esnext.math.imulh {} - esnext.math.isubh {} - esnext.math.rad-per-deg {} - esnext.math.radians {} - esnext.math.scale {} - esnext.math.seeded-prng {} - esnext.math.signbit {} - esnext.math.umulh {} - esnext.number.from-string {} - esnext.observable {} - esnext.promise.all-settled {} - esnext.promise.any {} - esnext.promise.try {} - esnext.reflect.define-metadata {} - esnext.reflect.delete-metadata {} - esnext.reflect.get-metadata {} - esnext.reflect.get-metadata-keys {} - esnext.reflect.get-own-metadata {} - esnext.reflect.get-own-metadata-keys {} - esnext.reflect.has-metadata {} - esnext.reflect.has-own-metadata {} - esnext.reflect.metadata {} - esnext.set.add-all {} - esnext.set.delete-all {} - esnext.set.difference {} - esnext.set.every {} - esnext.set.filter {} - esnext.set.find {} - esnext.set.from {} - esnext.set.intersection {} - esnext.set.is-disjoint-from {} - esnext.set.is-subset-of {} - esnext.set.is-superset-of {} - esnext.set.join {} - esnext.set.map {} - esnext.set.of {} - esnext.set.reduce {} - esnext.set.some {} - esnext.set.symmetric-difference {} - esnext.set.union {} - esnext.string.at {} - esnext.string.code-points {} - esnext.string.replace-all {} - esnext.symbol.dispose {} - esnext.symbol.observable {} - esnext.symbol.pattern-match {} - esnext.weak-map.delete-all {} - esnext.weak-map.from {} - esnext.weak-map.of {} - esnext.weak-set.add-all {} - esnext.weak-set.delete-all {} - esnext.weak-set.from {} - esnext.weak-set.of {} - web.dom-collections.for-each {} - web.dom-collections.iterator {} - web.immediate {} - web.queue-microtask {} - web.timers {} - web.url {} - web.url.to-json {} - web.url-search-params {} - esnext.string.match-all {} -Successfully compiled 1 file with Babel. \ No newline at end of file diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-android/options.json b/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-android/options.json deleted file mode 100644 index e7f7ecdb7292..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-android/options.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "presets": [ - ["../../lib", { - "debug": true, - "targets": { - "browsers": [ "Android >= 4" ] - }, - "useBuiltIns": "entry", - "corejs": 3 - }] - ] -} diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-android/stdout.txt b/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-android/stdout.txt deleted file mode 100644 index b73850b76698..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-android/stdout.txt +++ /dev/null @@ -1,248 +0,0 @@ -@babel/preset-env: `DEBUG` option - -Using targets: -{ - "android": "4" -} - -Using modules transform: auto - -Using plugins: - transform-template-literals { "android":"4" } - transform-literals { "android":"4" } - transform-function-name { "android":"4" } - transform-arrow-functions { "android":"4" } - transform-block-scoped-functions { "android":"4" } - transform-classes { "android":"4" } - transform-object-super { "android":"4" } - transform-shorthand-properties { "android":"4" } - transform-duplicate-keys { "android":"4" } - transform-computed-properties { "android":"4" } - transform-for-of { "android":"4" } - transform-sticky-regex { "android":"4" } - transform-dotall-regex { "android":"4" } - transform-unicode-regex { "android":"4" } - transform-spread { "android":"4" } - transform-parameters { "android":"4" } - transform-destructuring { "android":"4" } - transform-block-scoping { "android":"4" } - transform-typeof-symbol { "android":"4" } - transform-new-target { "android":"4" } - transform-regenerator { "android":"4" } - transform-exponentiation-operator { "android":"4" } - transform-async-to-generator { "android":"4" } - proposal-async-generator-functions { "android":"4" } - proposal-object-rest-spread { "android":"4" } - proposal-unicode-property-regex { "android":"4" } - proposal-json-strings { "android":"4" } - proposal-optional-catch-binding { "android":"4" } - transform-named-capturing-groups-regex { "android":"4" } - transform-reserved-words { "android":"4" } - -Using polyfills with `entry` option: - -[/src/in.js] Replaced core-js entries with the following polyfills: - es.symbol { "android":"4" } - es.symbol.description { "android":"4" } - es.symbol.async-iterator { "android":"4" } - es.symbol.has-instance { "android":"4" } - es.symbol.is-concat-spreadable { "android":"4" } - es.symbol.iterator { "android":"4" } - es.symbol.match { "android":"4" } - es.symbol.replace { "android":"4" } - es.symbol.search { "android":"4" } - es.symbol.species { "android":"4" } - es.symbol.split { "android":"4" } - es.symbol.to-primitive { "android":"4" } - es.symbol.to-string-tag { "android":"4" } - es.symbol.unscopables { "android":"4" } - es.array.concat { "android":"4" } - es.array.copy-within { "android":"4" } - es.array.every { "android":"4" } - es.array.fill { "android":"4" } - es.array.filter { "android":"4" } - es.array.find { "android":"4" } - es.array.find-index { "android":"4" } - es.array.flat { "android":"4" } - es.array.flat-map { "android":"4" } - es.array.for-each { "android":"4" } - es.array.from { "android":"4" } - es.array.includes { "android":"4" } - es.array.index-of { "android":"4" } - es.array.iterator { "android":"4" } - es.array.join { "android":"4" } - es.array.last-index-of { "android":"4" } - es.array.map { "android":"4" } - es.array.of { "android":"4" } - es.array.reduce { "android":"4" } - es.array.reduce-right { "android":"4" } - es.array.reverse { "android":"4" } - es.array.slice { "android":"4" } - es.array.some { "android":"4" } - es.array.sort { "android":"4" } - es.array.species { "android":"4" } - es.array.splice { "android":"4" } - es.array.unscopables.flat { "android":"4" } - es.array.unscopables.flat-map { "android":"4" } - es.array-buffer.constructor { "android":"4" } - es.array-buffer.is-view { "android":"4" } - es.array-buffer.slice { "android":"4" } - es.data-view { "android":"4" } - es.date.to-iso-string { "android":"4" } - es.date.to-json { "android":"4" } - es.date.to-primitive { "android":"4" } - es.date.to-string { "android":"4" } - es.function.has-instance { "android":"4" } - es.function.name { "android":"4" } - es.json.to-string-tag { "android":"4" } - es.map { "android":"4" } - es.math.acosh { "android":"4" } - es.math.asinh { "android":"4" } - es.math.atanh { "android":"4" } - es.math.cbrt { "android":"4" } - es.math.clz32 { "android":"4" } - es.math.cosh { "android":"4" } - es.math.expm1 { "android":"4" } - es.math.fround { "android":"4" } - es.math.hypot { "android":"4" } - es.math.imul { "android":"4" } - es.math.log10 { "android":"4" } - es.math.log1p { "android":"4" } - es.math.log2 { "android":"4" } - es.math.sign { "android":"4" } - es.math.sinh { "android":"4" } - es.math.tanh { "android":"4" } - es.math.to-string-tag { "android":"4" } - es.math.trunc { "android":"4" } - es.number.constructor { "android":"4" } - es.number.epsilon { "android":"4" } - es.number.is-finite { "android":"4" } - es.number.is-integer { "android":"4" } - es.number.is-nan { "android":"4" } - es.number.is-safe-integer { "android":"4" } - es.number.max-safe-integer { "android":"4" } - es.number.min-safe-integer { "android":"4" } - es.number.parse-float { "android":"4" } - es.number.parse-int { "android":"4" } - es.number.to-fixed { "android":"4" } - es.number.to-precision { "android":"4" } - es.object.assign { "android":"4" } - es.object.define-getter { "android":"4" } - es.object.define-properties { "android":"4" } - es.object.define-property { "android":"4" } - es.object.define-setter { "android":"4" } - es.object.entries { "android":"4" } - es.object.freeze { "android":"4" } - es.object.from-entries { "android":"4" } - es.object.get-own-property-descriptor { "android":"4" } - es.object.get-own-property-descriptors { "android":"4" } - es.object.get-own-property-names { "android":"4" } - es.object.get-prototype-of { "android":"4" } - es.object.is { "android":"4" } - es.object.is-extensible { "android":"4" } - es.object.is-frozen { "android":"4" } - es.object.is-sealed { "android":"4" } - es.object.keys { "android":"4" } - es.object.lookup-getter { "android":"4" } - es.object.lookup-setter { "android":"4" } - es.object.prevent-extensions { "android":"4" } - es.object.seal { "android":"4" } - es.object.set-prototype-of { "android":"4" } - es.object.to-string { "android":"4" } - es.object.values { "android":"4" } - es.parse-float { "android":"4" } - es.parse-int { "android":"4" } - es.promise { "android":"4" } - es.promise.finally { "android":"4" } - es.reflect.apply { "android":"4" } - es.reflect.construct { "android":"4" } - es.reflect.define-property { "android":"4" } - es.reflect.delete-property { "android":"4" } - es.reflect.get { "android":"4" } - es.reflect.get-own-property-descriptor { "android":"4" } - es.reflect.get-prototype-of { "android":"4" } - es.reflect.has { "android":"4" } - es.reflect.is-extensible { "android":"4" } - es.reflect.own-keys { "android":"4" } - es.reflect.prevent-extensions { "android":"4" } - es.reflect.set { "android":"4" } - es.reflect.set-prototype-of { "android":"4" } - es.regexp.constructor { "android":"4" } - es.regexp.exec { "android":"4" } - es.regexp.flags { "android":"4" } - es.regexp.to-string { "android":"4" } - es.set { "android":"4" } - es.string.code-point-at { "android":"4" } - es.string.ends-with { "android":"4" } - es.string.from-code-point { "android":"4" } - es.string.includes { "android":"4" } - es.string.iterator { "android":"4" } - es.string.match { "android":"4" } - es.string.pad-end { "android":"4" } - es.string.pad-start { "android":"4" } - es.string.raw { "android":"4" } - es.string.repeat { "android":"4" } - es.string.replace { "android":"4" } - es.string.search { "android":"4" } - es.string.split { "android":"4" } - es.string.starts-with { "android":"4" } - es.string.trim { "android":"4" } - es.string.trim-end { "android":"4" } - es.string.trim-start { "android":"4" } - es.string.anchor { "android":"4" } - es.string.big { "android":"4" } - es.string.blink { "android":"4" } - es.string.bold { "android":"4" } - es.string.fixed { "android":"4" } - es.string.fontcolor { "android":"4" } - es.string.fontsize { "android":"4" } - es.string.italics { "android":"4" } - es.string.link { "android":"4" } - es.string.small { "android":"4" } - es.string.strike { "android":"4" } - es.string.sub { "android":"4" } - es.string.sup { "android":"4" } - es.typed-array.float32-array { "android":"4" } - es.typed-array.float64-array { "android":"4" } - es.typed-array.int8-array { "android":"4" } - es.typed-array.int16-array { "android":"4" } - es.typed-array.int32-array { "android":"4" } - es.typed-array.uint8-array { "android":"4" } - es.typed-array.uint8-clamped-array { "android":"4" } - es.typed-array.uint16-array { "android":"4" } - es.typed-array.uint32-array { "android":"4" } - es.typed-array.copy-within { "android":"4" } - es.typed-array.every { "android":"4" } - es.typed-array.fill { "android":"4" } - es.typed-array.filter { "android":"4" } - es.typed-array.find { "android":"4" } - es.typed-array.find-index { "android":"4" } - es.typed-array.for-each { "android":"4" } - es.typed-array.from { "android":"4" } - es.typed-array.includes { "android":"4" } - es.typed-array.index-of { "android":"4" } - es.typed-array.iterator { "android":"4" } - es.typed-array.join { "android":"4" } - es.typed-array.last-index-of { "android":"4" } - es.typed-array.map { "android":"4" } - es.typed-array.of { "android":"4" } - es.typed-array.reduce { "android":"4" } - es.typed-array.reduce-right { "android":"4" } - es.typed-array.reverse { "android":"4" } - es.typed-array.set { "android":"4" } - es.typed-array.slice { "android":"4" } - es.typed-array.some { "android":"4" } - es.typed-array.sort { "android":"4" } - es.typed-array.subarray { "android":"4" } - es.typed-array.to-locale-string { "android":"4" } - es.typed-array.to-string { "android":"4" } - es.weak-map { "android":"4" } - es.weak-set { "android":"4" } - web.dom-collections.for-each { "android":"4" } - web.dom-collections.iterator { "android":"4" } - web.immediate { "android":"4" } - web.queue-microtask { "android":"4" } - web.url { "android":"4" } - web.url.to-json { "android":"4" } - web.url-search-params { "android":"4" } -Successfully compiled 1 file with Babel. \ No newline at end of file diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-babel-polyfill/options.json b/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-babel-polyfill/options.json deleted file mode 100644 index 1e5ef9ed0a56..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-babel-polyfill/options.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "presets": [ - ["../../lib", { - "debug": true, - "shippedProposals": true, - "useBuiltIns": "entry", - "corejs": 3 - }] - ] -} diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-babel-polyfill/stdout.txt b/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-babel-polyfill/stdout.txt deleted file mode 100644 index 22616b88ea89..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-babel-polyfill/stdout.txt +++ /dev/null @@ -1,45 +0,0 @@ -@babel/preset-env: `DEBUG` option - -Using targets: -{} - -Using modules transform: auto - -Using plugins: - transform-template-literals {} - transform-literals {} - transform-function-name {} - transform-arrow-functions {} - transform-block-scoped-functions {} - transform-classes {} - transform-object-super {} - transform-shorthand-properties {} - transform-duplicate-keys {} - transform-computed-properties {} - transform-for-of {} - transform-sticky-regex {} - transform-dotall-regex {} - transform-unicode-regex {} - transform-spread {} - transform-parameters {} - transform-destructuring {} - transform-block-scoping {} - transform-typeof-symbol {} - transform-new-target {} - transform-regenerator {} - transform-exponentiation-operator {} - transform-async-to-generator {} - proposal-async-generator-functions {} - proposal-object-rest-spread {} - proposal-unicode-property-regex {} - proposal-json-strings {} - proposal-optional-catch-binding {} - transform-named-capturing-groups-regex {} - transform-member-expression-literals {} - transform-property-literals {} - transform-reserved-words {} - -Using polyfills with `entry` option: - -[/src/in.js] Import of core-js was not found. -Successfully compiled 1 file with Babel. \ No newline at end of file diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-electron/options.json b/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-electron/options.json deleted file mode 100644 index acc203c75c8e..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-electron/options.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "presets": [ - ["../../lib", { - "debug": true, - "targets": { - "electron": 0.36 - }, - "useBuiltIns": "entry", - "corejs": 3 - }] - ] -} diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-electron/stdout.txt b/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-electron/stdout.txt deleted file mode 100644 index f554ec16ce1f..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-electron/stdout.txt +++ /dev/null @@ -1,136 +0,0 @@ -Warning, the following targets are using a decimal version: - - electron: 0.36 - -We recommend using a string for minor/patch versions to avoid numbers like 6.10 -getting parsed as 6.1, which can lead to unexpected behavior. - -@babel/preset-env: `DEBUG` option - -Using targets: -{ - "electron": "0.36" -} - -Using modules transform: auto - -Using plugins: - transform-function-name { "electron":"0.36" } - transform-for-of { "electron":"0.36" } - transform-sticky-regex { "electron":"0.36" } - transform-dotall-regex { "electron":"0.36" } - transform-unicode-regex { "electron":"0.36" } - transform-parameters { "electron":"0.36" } - transform-destructuring { "electron":"0.36" } - transform-block-scoping { "electron":"0.36" } - transform-regenerator { "electron":"0.36" } - transform-exponentiation-operator { "electron":"0.36" } - transform-async-to-generator { "electron":"0.36" } - proposal-async-generator-functions { "electron":"0.36" } - proposal-object-rest-spread { "electron":"0.36" } - proposal-unicode-property-regex { "electron":"0.36" } - proposal-json-strings { "electron":"0.36" } - proposal-optional-catch-binding { "electron":"0.36" } - transform-named-capturing-groups-regex { "electron":"0.36" } - transform-member-expression-literals { "electron":"0.36" } - transform-property-literals { "electron":"0.36" } - -Using polyfills with `entry` option: - -[/src/in.js] Replaced core-js entries with the following polyfills: - es.symbol { "electron":"0.36" } - es.symbol.description { "electron":"0.36" } - es.symbol.async-iterator { "electron":"0.36" } - es.symbol.has-instance { "electron":"0.36" } - es.symbol.is-concat-spreadable { "electron":"0.36" } - es.symbol.match { "electron":"0.36" } - es.symbol.replace { "electron":"0.36" } - es.symbol.search { "electron":"0.36" } - es.symbol.species { "electron":"0.36" } - es.symbol.split { "electron":"0.36" } - es.symbol.to-string-tag { "electron":"0.36" } - es.array.concat { "electron":"0.36" } - es.array.filter { "electron":"0.36" } - es.array.flat { "electron":"0.36" } - es.array.flat-map { "electron":"0.36" } - es.array.from { "electron":"0.36" } - es.array.includes { "electron":"0.36" } - es.array.index-of { "electron":"0.36" } - es.array.iterator { "electron":"0.36" } - es.array.last-index-of { "electron":"0.36" } - es.array.map { "electron":"0.36" } - es.array.slice { "electron":"0.36" } - es.array.sort { "electron":"0.36" } - es.array.species { "electron":"0.36" } - es.array.splice { "electron":"0.36" } - es.array.unscopables.flat { "electron":"0.36" } - es.array.unscopables.flat-map { "electron":"0.36" } - es.function.has-instance { "electron":"0.36" } - es.json.to-string-tag { "electron":"0.36" } - es.map { "electron":"0.36" } - es.math.acosh { "electron":"0.36" } - es.math.to-string-tag { "electron":"0.36" } - es.object.assign { "electron":"0.36" } - es.object.define-getter { "electron":"0.36" } - es.object.define-setter { "electron":"0.36" } - es.object.entries { "electron":"0.36" } - es.object.from-entries { "electron":"0.36" } - es.object.get-own-property-descriptors { "electron":"0.36" } - es.object.lookup-getter { "electron":"0.36" } - es.object.lookup-setter { "electron":"0.36" } - es.object.to-string { "electron":"0.36" } - es.object.values { "electron":"0.36" } - es.promise { "electron":"0.36" } - es.promise.finally { "electron":"0.36" } - es.reflect.apply { "electron":"0.36" } - es.reflect.construct { "electron":"0.36" } - es.reflect.define-property { "electron":"0.36" } - es.reflect.delete-property { "electron":"0.36" } - es.reflect.get { "electron":"0.36" } - es.reflect.get-own-property-descriptor { "electron":"0.36" } - es.reflect.get-prototype-of { "electron":"0.36" } - es.reflect.has { "electron":"0.36" } - es.reflect.is-extensible { "electron":"0.36" } - es.reflect.own-keys { "electron":"0.36" } - es.reflect.prevent-extensions { "electron":"0.36" } - es.reflect.set { "electron":"0.36" } - es.reflect.set-prototype-of { "electron":"0.36" } - es.regexp.constructor { "electron":"0.36" } - es.regexp.flags { "electron":"0.36" } - es.regexp.to-string { "electron":"0.36" } - es.set { "electron":"0.36" } - es.string.ends-with { "electron":"0.36" } - es.string.includes { "electron":"0.36" } - es.string.match { "electron":"0.36" } - es.string.pad-end { "electron":"0.36" } - es.string.pad-start { "electron":"0.36" } - es.string.replace { "electron":"0.36" } - es.string.search { "electron":"0.36" } - es.string.split { "electron":"0.36" } - es.string.starts-with { "electron":"0.36" } - es.string.trim { "electron":"0.36" } - es.string.trim-end { "electron":"0.36" } - es.string.trim-start { "electron":"0.36" } - es.typed-array.float32-array { "electron":"0.36" } - es.typed-array.float64-array { "electron":"0.36" } - es.typed-array.int8-array { "electron":"0.36" } - es.typed-array.int16-array { "electron":"0.36" } - es.typed-array.int32-array { "electron":"0.36" } - es.typed-array.uint8-array { "electron":"0.36" } - es.typed-array.uint8-clamped-array { "electron":"0.36" } - es.typed-array.uint16-array { "electron":"0.36" } - es.typed-array.uint32-array { "electron":"0.36" } - es.typed-array.from { "electron":"0.36" } - es.typed-array.includes { "electron":"0.36" } - es.typed-array.of { "electron":"0.36" } - es.typed-array.to-string { "electron":"0.36" } - es.weak-map { "electron":"0.36" } - es.weak-set { "electron":"0.36" } - web.dom-collections.for-each { "electron":"0.36" } - web.dom-collections.iterator { "electron":"0.36" } - web.immediate { "electron":"0.36" } - web.queue-microtask { "electron":"0.36" } - web.url { "electron":"0.36" } - web.url.to-json { "electron":"0.36" } - web.url-search-params { "electron":"0.36" } -Successfully compiled 1 file with Babel. \ No newline at end of file diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-es-chrome-71/options.json b/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-es-chrome-71/options.json deleted file mode 100644 index b9db1e21e401..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-es-chrome-71/options.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "presets": [ - ["../../lib", { - "debug": true, - "targets": { - "browsers": "chrome 71" - }, - "shippedProposals": true, - "useBuiltIns": "entry", - "corejs": 3 - }] - ] -} diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-es-chrome-71/stdout.txt b/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-es-chrome-71/stdout.txt deleted file mode 100644 index 1e83b69ce75f..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-es-chrome-71/stdout.txt +++ /dev/null @@ -1,24 +0,0 @@ -@babel/preset-env: `DEBUG` option - -Using targets: -{ - "chrome": "71" -} - -Using modules transform: auto - -Using plugins: - syntax-async-generators { "chrome":"71" } - syntax-object-rest-spread { "chrome":"71" } - syntax-json-strings { "chrome":"71" } - syntax-optional-catch-binding { "chrome":"71" } - -Using polyfills with `entry` option: - -[/src/in.js] Replaced core-js entries with the following polyfills: - es.array.unscopables.flat { "chrome":"71" } - es.array.unscopables.flat-map { "chrome":"71" } - es.object.from-entries { "chrome":"71" } - -[/src/in.js] Based on your targets, regenerator-runtime import excluded. -Successfully compiled 1 file with Babel. \ No newline at end of file diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-es-proposals-chrome-71/options.json b/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-es-proposals-chrome-71/options.json deleted file mode 100644 index b9db1e21e401..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-es-proposals-chrome-71/options.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "presets": [ - ["../../lib", { - "debug": true, - "targets": { - "browsers": "chrome 71" - }, - "shippedProposals": true, - "useBuiltIns": "entry", - "corejs": 3 - }] - ] -} diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-es-proposals-chrome-71/stdout.txt b/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-es-proposals-chrome-71/stdout.txt deleted file mode 100644 index 6d0687966b22..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-es-proposals-chrome-71/stdout.txt +++ /dev/null @@ -1,105 +0,0 @@ -@babel/preset-env: `DEBUG` option - -Using targets: -{ - "chrome": "71" -} - -Using modules transform: auto - -Using plugins: - syntax-async-generators { "chrome":"71" } - syntax-object-rest-spread { "chrome":"71" } - syntax-json-strings { "chrome":"71" } - syntax-optional-catch-binding { "chrome":"71" } - -Using polyfills with `entry` option: - -[/src/in.js] Replaced core-js entries with the following polyfills: - es.array.unscopables.flat { "chrome":"71" } - es.array.unscopables.flat-map { "chrome":"71" } - es.object.from-entries { "chrome":"71" } - esnext.aggregate-error { "chrome":"71" } - esnext.array.last-index { "chrome":"71" } - esnext.array.last-item { "chrome":"71" } - esnext.composite-key { "chrome":"71" } - esnext.composite-symbol { "chrome":"71" } - esnext.map.delete-all { "chrome":"71" } - esnext.map.every { "chrome":"71" } - esnext.map.filter { "chrome":"71" } - esnext.map.find { "chrome":"71" } - esnext.map.find-key { "chrome":"71" } - esnext.map.from { "chrome":"71" } - esnext.map.group-by { "chrome":"71" } - esnext.map.includes { "chrome":"71" } - esnext.map.key-by { "chrome":"71" } - esnext.map.key-of { "chrome":"71" } - esnext.map.map-keys { "chrome":"71" } - esnext.map.map-values { "chrome":"71" } - esnext.map.merge { "chrome":"71" } - esnext.map.of { "chrome":"71" } - esnext.map.reduce { "chrome":"71" } - esnext.map.some { "chrome":"71" } - esnext.map.update { "chrome":"71" } - esnext.math.clamp { "chrome":"71" } - esnext.math.deg-per-rad { "chrome":"71" } - esnext.math.degrees { "chrome":"71" } - esnext.math.fscale { "chrome":"71" } - esnext.math.iaddh { "chrome":"71" } - esnext.math.imulh { "chrome":"71" } - esnext.math.isubh { "chrome":"71" } - esnext.math.rad-per-deg { "chrome":"71" } - esnext.math.radians { "chrome":"71" } - esnext.math.scale { "chrome":"71" } - esnext.math.seeded-prng { "chrome":"71" } - esnext.math.signbit { "chrome":"71" } - esnext.math.umulh { "chrome":"71" } - esnext.number.from-string { "chrome":"71" } - esnext.observable { "chrome":"71" } - esnext.promise.all-settled { "chrome":"71" } - esnext.promise.any { "chrome":"71" } - esnext.promise.try { "chrome":"71" } - esnext.reflect.define-metadata { "chrome":"71" } - esnext.reflect.delete-metadata { "chrome":"71" } - esnext.reflect.get-metadata { "chrome":"71" } - esnext.reflect.get-metadata-keys { "chrome":"71" } - esnext.reflect.get-own-metadata { "chrome":"71" } - esnext.reflect.get-own-metadata-keys { "chrome":"71" } - esnext.reflect.has-metadata { "chrome":"71" } - esnext.reflect.has-own-metadata { "chrome":"71" } - esnext.reflect.metadata { "chrome":"71" } - esnext.set.add-all { "chrome":"71" } - esnext.set.delete-all { "chrome":"71" } - esnext.set.difference { "chrome":"71" } - esnext.set.every { "chrome":"71" } - esnext.set.filter { "chrome":"71" } - esnext.set.find { "chrome":"71" } - esnext.set.from { "chrome":"71" } - esnext.set.intersection { "chrome":"71" } - esnext.set.is-disjoint-from { "chrome":"71" } - esnext.set.is-subset-of { "chrome":"71" } - esnext.set.is-superset-of { "chrome":"71" } - esnext.set.join { "chrome":"71" } - esnext.set.map { "chrome":"71" } - esnext.set.of { "chrome":"71" } - esnext.set.reduce { "chrome":"71" } - esnext.set.some { "chrome":"71" } - esnext.set.symmetric-difference { "chrome":"71" } - esnext.set.union { "chrome":"71" } - esnext.string.at { "chrome":"71" } - esnext.string.code-points { "chrome":"71" } - esnext.string.replace-all { "chrome":"71" } - esnext.symbol.dispose { "chrome":"71" } - esnext.symbol.observable { "chrome":"71" } - esnext.symbol.pattern-match { "chrome":"71" } - esnext.weak-map.delete-all { "chrome":"71" } - esnext.weak-map.from { "chrome":"71" } - esnext.weak-map.of { "chrome":"71" } - esnext.weak-set.add-all { "chrome":"71" } - esnext.weak-set.delete-all { "chrome":"71" } - esnext.weak-set.from { "chrome":"71" } - esnext.weak-set.of { "chrome":"71" } - esnext.string.match-all { "chrome":"71" } - -[/src/in.js] Based on your targets, regenerator-runtime import excluded. -Successfully compiled 1 file with Babel. \ No newline at end of file diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-es-proposals/options.json b/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-es-proposals/options.json deleted file mode 100644 index 1e5ef9ed0a56..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-es-proposals/options.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "presets": [ - ["../../lib", { - "debug": true, - "shippedProposals": true, - "useBuiltIns": "entry", - "corejs": 3 - }] - ] -} diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-es-proposals/stdout.txt b/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-es-proposals/stdout.txt deleted file mode 100644 index 954fd4133665..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-es-proposals/stdout.txt +++ /dev/null @@ -1,330 +0,0 @@ -@babel/preset-env: `DEBUG` option - -Using targets: -{} - -Using modules transform: auto - -Using plugins: - transform-template-literals {} - transform-literals {} - transform-function-name {} - transform-arrow-functions {} - transform-block-scoped-functions {} - transform-classes {} - transform-object-super {} - transform-shorthand-properties {} - transform-duplicate-keys {} - transform-computed-properties {} - transform-for-of {} - transform-sticky-regex {} - transform-dotall-regex {} - transform-unicode-regex {} - transform-spread {} - transform-parameters {} - transform-destructuring {} - transform-block-scoping {} - transform-typeof-symbol {} - transform-new-target {} - transform-regenerator {} - transform-exponentiation-operator {} - transform-async-to-generator {} - proposal-async-generator-functions {} - proposal-object-rest-spread {} - proposal-unicode-property-regex {} - proposal-json-strings {} - proposal-optional-catch-binding {} - transform-named-capturing-groups-regex {} - transform-member-expression-literals {} - transform-property-literals {} - transform-reserved-words {} - -Using polyfills with `entry` option: - -[/src/in.js] Replaced core-js entries with the following polyfills: - es.symbol {} - es.symbol.description {} - es.symbol.async-iterator {} - es.symbol.has-instance {} - es.symbol.is-concat-spreadable {} - es.symbol.iterator {} - es.symbol.match {} - es.symbol.replace {} - es.symbol.search {} - es.symbol.species {} - es.symbol.split {} - es.symbol.to-primitive {} - es.symbol.to-string-tag {} - es.symbol.unscopables {} - es.array.concat {} - es.array.copy-within {} - es.array.every {} - es.array.fill {} - es.array.filter {} - es.array.find {} - es.array.find-index {} - es.array.flat {} - es.array.flat-map {} - es.array.for-each {} - es.array.from {} - es.array.includes {} - es.array.index-of {} - es.array.is-array {} - es.array.iterator {} - es.array.join {} - es.array.last-index-of {} - es.array.map {} - es.array.of {} - es.array.reduce {} - es.array.reduce-right {} - es.array.reverse {} - es.array.slice {} - es.array.some {} - es.array.sort {} - es.array.species {} - es.array.splice {} - es.array.unscopables.flat {} - es.array.unscopables.flat-map {} - es.array-buffer.constructor {} - es.array-buffer.is-view {} - es.array-buffer.slice {} - es.data-view {} - es.date.now {} - es.date.to-iso-string {} - es.date.to-json {} - es.date.to-primitive {} - es.date.to-string {} - es.function.bind {} - es.function.has-instance {} - es.function.name {} - es.json.to-string-tag {} - es.map {} - es.math.acosh {} - es.math.asinh {} - es.math.atanh {} - es.math.cbrt {} - es.math.clz32 {} - es.math.cosh {} - es.math.expm1 {} - es.math.fround {} - es.math.hypot {} - es.math.imul {} - es.math.log10 {} - es.math.log1p {} - es.math.log2 {} - es.math.sign {} - es.math.sinh {} - es.math.tanh {} - es.math.to-string-tag {} - es.math.trunc {} - es.number.constructor {} - es.number.epsilon {} - es.number.is-finite {} - es.number.is-integer {} - es.number.is-nan {} - es.number.is-safe-integer {} - es.number.max-safe-integer {} - es.number.min-safe-integer {} - es.number.parse-float {} - es.number.parse-int {} - es.number.to-fixed {} - es.number.to-precision {} - es.object.assign {} - es.object.create {} - es.object.define-getter {} - es.object.define-properties {} - es.object.define-property {} - es.object.define-setter {} - es.object.entries {} - es.object.freeze {} - es.object.from-entries {} - es.object.get-own-property-descriptor {} - es.object.get-own-property-descriptors {} - es.object.get-own-property-names {} - es.object.get-prototype-of {} - es.object.is {} - es.object.is-extensible {} - es.object.is-frozen {} - es.object.is-sealed {} - es.object.keys {} - es.object.lookup-getter {} - es.object.lookup-setter {} - es.object.prevent-extensions {} - es.object.seal {} - es.object.set-prototype-of {} - es.object.to-string {} - es.object.values {} - es.parse-float {} - es.parse-int {} - es.promise {} - es.promise.finally {} - es.reflect.apply {} - es.reflect.construct {} - es.reflect.define-property {} - es.reflect.delete-property {} - es.reflect.get {} - es.reflect.get-own-property-descriptor {} - es.reflect.get-prototype-of {} - es.reflect.has {} - es.reflect.is-extensible {} - es.reflect.own-keys {} - es.reflect.prevent-extensions {} - es.reflect.set {} - es.reflect.set-prototype-of {} - es.regexp.constructor {} - es.regexp.exec {} - es.regexp.flags {} - es.regexp.to-string {} - es.set {} - es.string.code-point-at {} - es.string.ends-with {} - es.string.from-code-point {} - es.string.includes {} - es.string.iterator {} - es.string.match {} - es.string.pad-end {} - es.string.pad-start {} - es.string.raw {} - es.string.repeat {} - es.string.replace {} - es.string.search {} - es.string.split {} - es.string.starts-with {} - es.string.trim {} - es.string.trim-end {} - es.string.trim-start {} - es.string.anchor {} - es.string.big {} - es.string.blink {} - es.string.bold {} - es.string.fixed {} - es.string.fontcolor {} - es.string.fontsize {} - es.string.italics {} - es.string.link {} - es.string.small {} - es.string.strike {} - es.string.sub {} - es.string.sup {} - es.typed-array.float32-array {} - es.typed-array.float64-array {} - es.typed-array.int8-array {} - es.typed-array.int16-array {} - es.typed-array.int32-array {} - es.typed-array.uint8-array {} - es.typed-array.uint8-clamped-array {} - es.typed-array.uint16-array {} - es.typed-array.uint32-array {} - es.typed-array.copy-within {} - es.typed-array.every {} - es.typed-array.fill {} - es.typed-array.filter {} - es.typed-array.find {} - es.typed-array.find-index {} - es.typed-array.for-each {} - es.typed-array.from {} - es.typed-array.includes {} - es.typed-array.index-of {} - es.typed-array.iterator {} - es.typed-array.join {} - es.typed-array.last-index-of {} - es.typed-array.map {} - es.typed-array.of {} - es.typed-array.reduce {} - es.typed-array.reduce-right {} - es.typed-array.reverse {} - es.typed-array.set {} - es.typed-array.slice {} - es.typed-array.some {} - es.typed-array.sort {} - es.typed-array.subarray {} - es.typed-array.to-locale-string {} - es.typed-array.to-string {} - es.weak-map {} - es.weak-set {} - esnext.aggregate-error {} - esnext.array.last-index {} - esnext.array.last-item {} - esnext.composite-key {} - esnext.composite-symbol {} - esnext.global-this {} - esnext.map.delete-all {} - esnext.map.every {} - esnext.map.filter {} - esnext.map.find {} - esnext.map.find-key {} - esnext.map.from {} - esnext.map.group-by {} - esnext.map.includes {} - esnext.map.key-by {} - esnext.map.key-of {} - esnext.map.map-keys {} - esnext.map.map-values {} - esnext.map.merge {} - esnext.map.of {} - esnext.map.reduce {} - esnext.map.some {} - esnext.map.update {} - esnext.math.clamp {} - esnext.math.deg-per-rad {} - esnext.math.degrees {} - esnext.math.fscale {} - esnext.math.iaddh {} - esnext.math.imulh {} - esnext.math.isubh {} - esnext.math.rad-per-deg {} - esnext.math.radians {} - esnext.math.scale {} - esnext.math.seeded-prng {} - esnext.math.signbit {} - esnext.math.umulh {} - esnext.number.from-string {} - esnext.observable {} - esnext.promise.all-settled {} - esnext.promise.any {} - esnext.promise.try {} - esnext.reflect.define-metadata {} - esnext.reflect.delete-metadata {} - esnext.reflect.get-metadata {} - esnext.reflect.get-metadata-keys {} - esnext.reflect.get-own-metadata {} - esnext.reflect.get-own-metadata-keys {} - esnext.reflect.has-metadata {} - esnext.reflect.has-own-metadata {} - esnext.reflect.metadata {} - esnext.set.add-all {} - esnext.set.delete-all {} - esnext.set.difference {} - esnext.set.every {} - esnext.set.filter {} - esnext.set.find {} - esnext.set.from {} - esnext.set.intersection {} - esnext.set.is-disjoint-from {} - esnext.set.is-subset-of {} - esnext.set.is-superset-of {} - esnext.set.join {} - esnext.set.map {} - esnext.set.of {} - esnext.set.reduce {} - esnext.set.some {} - esnext.set.symmetric-difference {} - esnext.set.union {} - esnext.string.at {} - esnext.string.code-points {} - esnext.string.replace-all {} - esnext.symbol.dispose {} - esnext.symbol.observable {} - esnext.symbol.pattern-match {} - esnext.weak-map.delete-all {} - esnext.weak-map.from {} - esnext.weak-map.of {} - esnext.weak-set.add-all {} - esnext.weak-set.delete-all {} - esnext.weak-set.from {} - esnext.weak-set.of {} - web.url {} - web.url.to-json {} - web.url-search-params {} - esnext.string.match-all {} -Successfully compiled 1 file with Babel. \ No newline at end of file diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-es/options.json b/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-es/options.json deleted file mode 100644 index 1e5ef9ed0a56..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-es/options.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "presets": [ - ["../../lib", { - "debug": true, - "shippedProposals": true, - "useBuiltIns": "entry", - "corejs": 3 - }] - ] -} diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-es/stdout.txt b/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-es/stdout.txt deleted file mode 100644 index cf961ab95885..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-es/stdout.txt +++ /dev/null @@ -1,245 +0,0 @@ -@babel/preset-env: `DEBUG` option - -Using targets: -{} - -Using modules transform: auto - -Using plugins: - transform-template-literals {} - transform-literals {} - transform-function-name {} - transform-arrow-functions {} - transform-block-scoped-functions {} - transform-classes {} - transform-object-super {} - transform-shorthand-properties {} - transform-duplicate-keys {} - transform-computed-properties {} - transform-for-of {} - transform-sticky-regex {} - transform-dotall-regex {} - transform-unicode-regex {} - transform-spread {} - transform-parameters {} - transform-destructuring {} - transform-block-scoping {} - transform-typeof-symbol {} - transform-new-target {} - transform-regenerator {} - transform-exponentiation-operator {} - transform-async-to-generator {} - proposal-async-generator-functions {} - proposal-object-rest-spread {} - proposal-unicode-property-regex {} - proposal-json-strings {} - proposal-optional-catch-binding {} - transform-named-capturing-groups-regex {} - transform-member-expression-literals {} - transform-property-literals {} - transform-reserved-words {} - -Using polyfills with `entry` option: - -[/src/in.js] Replaced core-js entries with the following polyfills: - es.symbol {} - es.symbol.description {} - es.symbol.async-iterator {} - es.symbol.has-instance {} - es.symbol.is-concat-spreadable {} - es.symbol.iterator {} - es.symbol.match {} - es.symbol.replace {} - es.symbol.search {} - es.symbol.species {} - es.symbol.split {} - es.symbol.to-primitive {} - es.symbol.to-string-tag {} - es.symbol.unscopables {} - es.array.concat {} - es.array.copy-within {} - es.array.every {} - es.array.fill {} - es.array.filter {} - es.array.find {} - es.array.find-index {} - es.array.flat {} - es.array.flat-map {} - es.array.for-each {} - es.array.from {} - es.array.includes {} - es.array.index-of {} - es.array.is-array {} - es.array.iterator {} - es.array.join {} - es.array.last-index-of {} - es.array.map {} - es.array.of {} - es.array.reduce {} - es.array.reduce-right {} - es.array.reverse {} - es.array.slice {} - es.array.some {} - es.array.sort {} - es.array.species {} - es.array.splice {} - es.array.unscopables.flat {} - es.array.unscopables.flat-map {} - es.array-buffer.constructor {} - es.array-buffer.is-view {} - es.array-buffer.slice {} - es.data-view {} - es.date.now {} - es.date.to-iso-string {} - es.date.to-json {} - es.date.to-primitive {} - es.date.to-string {} - es.function.bind {} - es.function.has-instance {} - es.function.name {} - es.json.to-string-tag {} - es.map {} - es.math.acosh {} - es.math.asinh {} - es.math.atanh {} - es.math.cbrt {} - es.math.clz32 {} - es.math.cosh {} - es.math.expm1 {} - es.math.fround {} - es.math.hypot {} - es.math.imul {} - es.math.log10 {} - es.math.log1p {} - es.math.log2 {} - es.math.sign {} - es.math.sinh {} - es.math.tanh {} - es.math.to-string-tag {} - es.math.trunc {} - es.number.constructor {} - es.number.epsilon {} - es.number.is-finite {} - es.number.is-integer {} - es.number.is-nan {} - es.number.is-safe-integer {} - es.number.max-safe-integer {} - es.number.min-safe-integer {} - es.number.parse-float {} - es.number.parse-int {} - es.number.to-fixed {} - es.number.to-precision {} - es.object.assign {} - es.object.create {} - es.object.define-getter {} - es.object.define-properties {} - es.object.define-property {} - es.object.define-setter {} - es.object.entries {} - es.object.freeze {} - es.object.from-entries {} - es.object.get-own-property-descriptor {} - es.object.get-own-property-descriptors {} - es.object.get-own-property-names {} - es.object.get-prototype-of {} - es.object.is {} - es.object.is-extensible {} - es.object.is-frozen {} - es.object.is-sealed {} - es.object.keys {} - es.object.lookup-getter {} - es.object.lookup-setter {} - es.object.prevent-extensions {} - es.object.seal {} - es.object.set-prototype-of {} - es.object.to-string {} - es.object.values {} - es.parse-float {} - es.parse-int {} - es.promise {} - es.promise.finally {} - es.reflect.apply {} - es.reflect.construct {} - es.reflect.define-property {} - es.reflect.delete-property {} - es.reflect.get {} - es.reflect.get-own-property-descriptor {} - es.reflect.get-prototype-of {} - es.reflect.has {} - es.reflect.is-extensible {} - es.reflect.own-keys {} - es.reflect.prevent-extensions {} - es.reflect.set {} - es.reflect.set-prototype-of {} - es.regexp.constructor {} - es.regexp.exec {} - es.regexp.flags {} - es.regexp.to-string {} - es.set {} - es.string.code-point-at {} - es.string.ends-with {} - es.string.from-code-point {} - es.string.includes {} - es.string.iterator {} - es.string.match {} - es.string.pad-end {} - es.string.pad-start {} - es.string.raw {} - es.string.repeat {} - es.string.replace {} - es.string.search {} - es.string.split {} - es.string.starts-with {} - es.string.trim {} - es.string.trim-end {} - es.string.trim-start {} - es.string.anchor {} - es.string.big {} - es.string.blink {} - es.string.bold {} - es.string.fixed {} - es.string.fontcolor {} - es.string.fontsize {} - es.string.italics {} - es.string.link {} - es.string.small {} - es.string.strike {} - es.string.sub {} - es.string.sup {} - es.typed-array.float32-array {} - es.typed-array.float64-array {} - es.typed-array.int8-array {} - es.typed-array.int16-array {} - es.typed-array.int32-array {} - es.typed-array.uint8-array {} - es.typed-array.uint8-clamped-array {} - es.typed-array.uint16-array {} - es.typed-array.uint32-array {} - es.typed-array.copy-within {} - es.typed-array.every {} - es.typed-array.fill {} - es.typed-array.filter {} - es.typed-array.find {} - es.typed-array.find-index {} - es.typed-array.for-each {} - es.typed-array.from {} - es.typed-array.includes {} - es.typed-array.index-of {} - es.typed-array.iterator {} - es.typed-array.join {} - es.typed-array.last-index-of {} - es.typed-array.map {} - es.typed-array.of {} - es.typed-array.reduce {} - es.typed-array.reduce-right {} - es.typed-array.reverse {} - es.typed-array.set {} - es.typed-array.slice {} - es.typed-array.some {} - es.typed-array.sort {} - es.typed-array.subarray {} - es.typed-array.to-locale-string {} - es.typed-array.to-string {} - es.weak-map {} - es.weak-set {} -Successfully compiled 1 file with Babel. \ No newline at end of file diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-force-all-transforms/options.json b/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-force-all-transforms/options.json deleted file mode 100644 index c1c4390e7125..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-force-all-transforms/options.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "presets": [ - ["../../lib", { - "debug": true, - "modules": false, - "targets": { - "chrome": 55 - }, - "useBuiltIns": "entry", - "corejs": 3, - "forceAllTransforms": true - }] - ] -} diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-force-all-transforms/stdout.txt b/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-force-all-transforms/stdout.txt deleted file mode 100644 index 332da98e97bf..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-force-all-transforms/stdout.txt +++ /dev/null @@ -1,75 +0,0 @@ -@babel/preset-env: `DEBUG` option - -Using targets: -{ - "chrome": "55" -} - -Using modules transform: false - -Using plugins: - transform-template-literals {} - transform-literals {} - transform-function-name {} - transform-arrow-functions {} - transform-block-scoped-functions {} - transform-classes {} - transform-object-super {} - transform-shorthand-properties {} - transform-duplicate-keys {} - transform-computed-properties {} - transform-for-of {} - transform-sticky-regex {} - transform-dotall-regex { "chrome":"55" } - transform-unicode-regex {} - transform-spread {} - transform-parameters {} - transform-destructuring {} - transform-block-scoping {} - transform-typeof-symbol {} - transform-new-target {} - transform-regenerator {} - transform-exponentiation-operator {} - transform-async-to-generator {} - proposal-async-generator-functions { "chrome":"55" } - proposal-object-rest-spread { "chrome":"55" } - proposal-unicode-property-regex { "chrome":"55" } - proposal-json-strings { "chrome":"55" } - proposal-optional-catch-binding { "chrome":"55" } - transform-named-capturing-groups-regex { "chrome":"55" } - transform-member-expression-literals {} - transform-property-literals {} - transform-reserved-words {} - -Using polyfills with `entry` option: - -[/src/in.js] Replaced core-js entries with the following polyfills: - es.symbol.description { "chrome":"55" } - es.symbol.async-iterator { "chrome":"55" } - es.array.flat { "chrome":"55" } - es.array.flat-map { "chrome":"55" } - es.array.iterator { "chrome":"55" } - es.array.sort { "chrome":"55" } - es.array.unscopables.flat { "chrome":"55" } - es.array.unscopables.flat-map { "chrome":"55" } - es.object.define-getter { "chrome":"55" } - es.object.define-setter { "chrome":"55" } - es.object.from-entries { "chrome":"55" } - es.object.lookup-getter { "chrome":"55" } - es.object.lookup-setter { "chrome":"55" } - es.promise { "chrome":"55" } - es.promise.finally { "chrome":"55" } - es.string.pad-end { "chrome":"55" } - es.string.pad-start { "chrome":"55" } - es.string.replace { "chrome":"55" } - es.string.trim { "chrome":"55" } - es.string.trim-end { "chrome":"55" } - es.string.trim-start { "chrome":"55" } - web.dom-collections.for-each { "chrome":"55" } - web.dom-collections.iterator { "chrome":"55" } - web.immediate { "chrome":"55" } - web.queue-microtask { "chrome":"55" } - web.url { "chrome":"55" } - web.url.to-json { "chrome":"55" } - web.url-search-params { "chrome":"55" } -Successfully compiled 1 file with Babel. \ No newline at end of file diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-no-import/options.json b/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-no-import/options.json deleted file mode 100644 index 394e16ee1e55..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-no-import/options.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "presets": [ - ["../../lib", { - "debug": true, - "targets": { - "node": 6 - }, - "useBuiltIns": "entry", - "corejs": 3 - }] - ] -} diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-no-import/stdout.txt b/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-no-import/stdout.txt deleted file mode 100644 index 73ffcc5860ea..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-no-import/stdout.txt +++ /dev/null @@ -1,27 +0,0 @@ -@babel/preset-env: `DEBUG` option - -Using targets: -{ - "node": "6" -} - -Using modules transform: auto - -Using plugins: - transform-function-name { "node":"6" } - transform-for-of { "node":"6" } - transform-dotall-regex { "node":"6" } - transform-destructuring { "node":"6" } - transform-exponentiation-operator { "node":"6" } - transform-async-to-generator { "node":"6" } - proposal-async-generator-functions { "node":"6" } - proposal-object-rest-spread { "node":"6" } - proposal-unicode-property-regex { "node":"6" } - proposal-json-strings { "node":"6" } - proposal-optional-catch-binding { "node":"6" } - transform-named-capturing-groups-regex { "node":"6" } - -Using polyfills with `entry` option: - -[/src/in.js] Import of core-js was not found. -Successfully compiled 1 file with Babel. \ No newline at end of file diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-proposals-chrome-71/options.json b/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-proposals-chrome-71/options.json deleted file mode 100644 index f08309ca7b73..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-proposals-chrome-71/options.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "presets": [ - ["../../lib", { - "debug": true, - "targets": { - "browsers": "chrome 71" - }, - "useBuiltIns": "entry", - "corejs": { "version": 3, "proposals": true } - }] - ] -} diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-proposals-chrome-71/stdout.txt b/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-proposals-chrome-71/stdout.txt deleted file mode 100644 index 7b8630d1d45f..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-proposals-chrome-71/stdout.txt +++ /dev/null @@ -1,102 +0,0 @@ -@babel/preset-env: `DEBUG` option - -Using targets: -{ - "chrome": "71" -} - -Using modules transform: auto - -Using plugins: - syntax-async-generators { "chrome":"71" } - syntax-object-rest-spread { "chrome":"71" } - syntax-json-strings { "chrome":"71" } - syntax-optional-catch-binding { "chrome":"71" } - -Using polyfills with `entry` option: - -[/src/in.js] Replaced core-js entries with the following polyfills: - esnext.aggregate-error { "chrome":"71" } - esnext.array.last-index { "chrome":"71" } - esnext.array.last-item { "chrome":"71" } - esnext.composite-key { "chrome":"71" } - esnext.composite-symbol { "chrome":"71" } - esnext.map.delete-all { "chrome":"71" } - esnext.map.every { "chrome":"71" } - esnext.map.filter { "chrome":"71" } - esnext.map.find { "chrome":"71" } - esnext.map.find-key { "chrome":"71" } - esnext.map.from { "chrome":"71" } - esnext.map.group-by { "chrome":"71" } - esnext.map.includes { "chrome":"71" } - esnext.map.key-by { "chrome":"71" } - esnext.map.key-of { "chrome":"71" } - esnext.map.map-keys { "chrome":"71" } - esnext.map.map-values { "chrome":"71" } - esnext.map.merge { "chrome":"71" } - esnext.map.of { "chrome":"71" } - esnext.map.reduce { "chrome":"71" } - esnext.map.some { "chrome":"71" } - esnext.map.update { "chrome":"71" } - esnext.math.clamp { "chrome":"71" } - esnext.math.deg-per-rad { "chrome":"71" } - esnext.math.degrees { "chrome":"71" } - esnext.math.fscale { "chrome":"71" } - esnext.math.iaddh { "chrome":"71" } - esnext.math.imulh { "chrome":"71" } - esnext.math.isubh { "chrome":"71" } - esnext.math.rad-per-deg { "chrome":"71" } - esnext.math.radians { "chrome":"71" } - esnext.math.scale { "chrome":"71" } - esnext.math.seeded-prng { "chrome":"71" } - esnext.math.signbit { "chrome":"71" } - esnext.math.umulh { "chrome":"71" } - esnext.number.from-string { "chrome":"71" } - esnext.observable { "chrome":"71" } - esnext.promise.all-settled { "chrome":"71" } - esnext.promise.any { "chrome":"71" } - esnext.promise.try { "chrome":"71" } - esnext.reflect.define-metadata { "chrome":"71" } - esnext.reflect.delete-metadata { "chrome":"71" } - esnext.reflect.get-metadata { "chrome":"71" } - esnext.reflect.get-metadata-keys { "chrome":"71" } - esnext.reflect.get-own-metadata { "chrome":"71" } - esnext.reflect.get-own-metadata-keys { "chrome":"71" } - esnext.reflect.has-metadata { "chrome":"71" } - esnext.reflect.has-own-metadata { "chrome":"71" } - esnext.reflect.metadata { "chrome":"71" } - esnext.set.add-all { "chrome":"71" } - esnext.set.delete-all { "chrome":"71" } - esnext.set.difference { "chrome":"71" } - esnext.set.every { "chrome":"71" } - esnext.set.filter { "chrome":"71" } - esnext.set.find { "chrome":"71" } - esnext.set.from { "chrome":"71" } - esnext.set.intersection { "chrome":"71" } - esnext.set.is-disjoint-from { "chrome":"71" } - esnext.set.is-subset-of { "chrome":"71" } - esnext.set.is-superset-of { "chrome":"71" } - esnext.set.join { "chrome":"71" } - esnext.set.map { "chrome":"71" } - esnext.set.of { "chrome":"71" } - esnext.set.reduce { "chrome":"71" } - esnext.set.some { "chrome":"71" } - esnext.set.symmetric-difference { "chrome":"71" } - esnext.set.union { "chrome":"71" } - esnext.string.at { "chrome":"71" } - esnext.string.code-points { "chrome":"71" } - esnext.string.replace-all { "chrome":"71" } - esnext.symbol.dispose { "chrome":"71" } - esnext.symbol.observable { "chrome":"71" } - esnext.symbol.pattern-match { "chrome":"71" } - esnext.weak-map.delete-all { "chrome":"71" } - esnext.weak-map.from { "chrome":"71" } - esnext.weak-map.of { "chrome":"71" } - esnext.weak-set.add-all { "chrome":"71" } - esnext.weak-set.delete-all { "chrome":"71" } - esnext.weak-set.from { "chrome":"71" } - esnext.weak-set.of { "chrome":"71" } - esnext.string.match-all { "chrome":"71" } - -[/src/in.js] Based on your targets, regenerator-runtime import excluded. -Successfully compiled 1 file with Babel. \ No newline at end of file diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-proposals/options.json b/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-proposals/options.json deleted file mode 100644 index 56005256589a..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-proposals/options.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "presets": [ - ["../../lib", { - "debug": true, - "useBuiltIns": "entry", - "corejs": { "version": 3, "proposals": true } - }] - ] -} diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-proposals/stdout.txt b/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-proposals/stdout.txt deleted file mode 100644 index 34bf4094e273..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-proposals/stdout.txt +++ /dev/null @@ -1,130 +0,0 @@ -@babel/preset-env: `DEBUG` option - -Using targets: -{} - -Using modules transform: auto - -Using plugins: - transform-template-literals {} - transform-literals {} - transform-function-name {} - transform-arrow-functions {} - transform-block-scoped-functions {} - transform-classes {} - transform-object-super {} - transform-shorthand-properties {} - transform-duplicate-keys {} - transform-computed-properties {} - transform-for-of {} - transform-sticky-regex {} - transform-dotall-regex {} - transform-unicode-regex {} - transform-spread {} - transform-parameters {} - transform-destructuring {} - transform-block-scoping {} - transform-typeof-symbol {} - transform-new-target {} - transform-regenerator {} - transform-exponentiation-operator {} - transform-async-to-generator {} - proposal-async-generator-functions {} - proposal-object-rest-spread {} - proposal-unicode-property-regex {} - proposal-json-strings {} - proposal-optional-catch-binding {} - transform-named-capturing-groups-regex {} - transform-member-expression-literals {} - transform-property-literals {} - transform-reserved-words {} - -Using polyfills with `entry` option: - -[/src/in.js] Replaced core-js entries with the following polyfills: - esnext.aggregate-error {} - esnext.array.last-index {} - esnext.array.last-item {} - esnext.composite-key {} - esnext.composite-symbol {} - esnext.global-this {} - esnext.map.delete-all {} - esnext.map.every {} - esnext.map.filter {} - esnext.map.find {} - esnext.map.find-key {} - esnext.map.from {} - esnext.map.group-by {} - esnext.map.includes {} - esnext.map.key-by {} - esnext.map.key-of {} - esnext.map.map-keys {} - esnext.map.map-values {} - esnext.map.merge {} - esnext.map.of {} - esnext.map.reduce {} - esnext.map.some {} - esnext.map.update {} - esnext.math.clamp {} - esnext.math.deg-per-rad {} - esnext.math.degrees {} - esnext.math.fscale {} - esnext.math.iaddh {} - esnext.math.imulh {} - esnext.math.isubh {} - esnext.math.rad-per-deg {} - esnext.math.radians {} - esnext.math.scale {} - esnext.math.seeded-prng {} - esnext.math.signbit {} - esnext.math.umulh {} - esnext.number.from-string {} - esnext.observable {} - esnext.promise.all-settled {} - esnext.promise.any {} - esnext.promise.try {} - esnext.reflect.define-metadata {} - esnext.reflect.delete-metadata {} - esnext.reflect.get-metadata {} - esnext.reflect.get-metadata-keys {} - esnext.reflect.get-own-metadata {} - esnext.reflect.get-own-metadata-keys {} - esnext.reflect.has-metadata {} - esnext.reflect.has-own-metadata {} - esnext.reflect.metadata {} - esnext.set.add-all {} - esnext.set.delete-all {} - esnext.set.difference {} - esnext.set.every {} - esnext.set.filter {} - esnext.set.find {} - esnext.set.from {} - esnext.set.intersection {} - esnext.set.is-disjoint-from {} - esnext.set.is-subset-of {} - esnext.set.is-superset-of {} - esnext.set.join {} - esnext.set.map {} - esnext.set.of {} - esnext.set.reduce {} - esnext.set.some {} - esnext.set.symmetric-difference {} - esnext.set.union {} - esnext.string.at {} - esnext.string.code-points {} - esnext.string.replace-all {} - esnext.symbol.dispose {} - esnext.symbol.observable {} - esnext.symbol.pattern-match {} - esnext.weak-map.delete-all {} - esnext.weak-map.from {} - esnext.weak-map.of {} - esnext.weak-set.add-all {} - esnext.weak-set.delete-all {} - esnext.weak-set.from {} - esnext.weak-set.of {} - web.url {} - web.url.to-json {} - web.url-search-params {} - esnext.string.match-all {} -Successfully compiled 1 file with Babel. \ No newline at end of file diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-runtime-only-chrome-71/options.json b/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-runtime-only-chrome-71/options.json deleted file mode 100644 index b9db1e21e401..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-runtime-only-chrome-71/options.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "presets": [ - ["../../lib", { - "debug": true, - "targets": { - "browsers": "chrome 71" - }, - "shippedProposals": true, - "useBuiltIns": "entry", - "corejs": 3 - }] - ] -} diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-runtime-only-chrome-71/stdout.txt b/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-runtime-only-chrome-71/stdout.txt deleted file mode 100644 index 2420ffb75e8e..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-runtime-only-chrome-71/stdout.txt +++ /dev/null @@ -1,21 +0,0 @@ -@babel/preset-env: `DEBUG` option - -Using targets: -{ - "chrome": "71" -} - -Using modules transform: auto - -Using plugins: - syntax-async-generators { "chrome":"71" } - syntax-object-rest-spread { "chrome":"71" } - syntax-json-strings { "chrome":"71" } - syntax-optional-catch-binding { "chrome":"71" } - -Using polyfills with `entry` option: - -[/src/in.js] Import of core-js was not found. - -[/src/in.js] Based on your targets, regenerator-runtime import excluded. -Successfully compiled 1 file with Babel. \ No newline at end of file diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-runtime-only/options.json b/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-runtime-only/options.json deleted file mode 100644 index b9db1e21e401..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-runtime-only/options.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "presets": [ - ["../../lib", { - "debug": true, - "targets": { - "browsers": "chrome 71" - }, - "shippedProposals": true, - "useBuiltIns": "entry", - "corejs": 3 - }] - ] -} diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-runtime-only/stdout.txt b/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-runtime-only/stdout.txt deleted file mode 100644 index 2420ffb75e8e..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-runtime-only/stdout.txt +++ /dev/null @@ -1,21 +0,0 @@ -@babel/preset-env: `DEBUG` option - -Using targets: -{ - "chrome": "71" -} - -Using modules transform: auto - -Using plugins: - syntax-async-generators { "chrome":"71" } - syntax-object-rest-spread { "chrome":"71" } - syntax-json-strings { "chrome":"71" } - syntax-optional-catch-binding { "chrome":"71" } - -Using polyfills with `entry` option: - -[/src/in.js] Import of core-js was not found. - -[/src/in.js] Based on your targets, regenerator-runtime import excluded. -Successfully compiled 1 file with Babel. \ No newline at end of file diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-specific-entries-chrome-71/options.json b/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-specific-entries-chrome-71/options.json deleted file mode 100644 index b9db1e21e401..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-specific-entries-chrome-71/options.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "presets": [ - ["../../lib", { - "debug": true, - "targets": { - "browsers": "chrome 71" - }, - "shippedProposals": true, - "useBuiltIns": "entry", - "corejs": 3 - }] - ] -} diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-specific-entries-chrome-71/stdout.txt b/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-specific-entries-chrome-71/stdout.txt deleted file mode 100644 index e77af2686b72..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-specific-entries-chrome-71/stdout.txt +++ /dev/null @@ -1,31 +0,0 @@ -@babel/preset-env: `DEBUG` option - -Using targets: -{ - "chrome": "71" -} - -Using modules transform: auto - -Using plugins: - syntax-async-generators { "chrome":"71" } - syntax-object-rest-spread { "chrome":"71" } - syntax-json-strings { "chrome":"71" } - syntax-optional-catch-binding { "chrome":"71" } - -Using polyfills with `entry` option: - -[/src/in.js] Replaced core-js entries with the following polyfills: - es.object.from-entries { "chrome":"71" } - esnext.reflect.define-metadata { "chrome":"71" } - esnext.reflect.delete-metadata { "chrome":"71" } - esnext.reflect.get-metadata { "chrome":"71" } - esnext.reflect.get-metadata-keys { "chrome":"71" } - esnext.reflect.get-own-metadata { "chrome":"71" } - esnext.reflect.get-own-metadata-keys { "chrome":"71" } - esnext.reflect.has-metadata { "chrome":"71" } - esnext.reflect.has-own-metadata { "chrome":"71" } - esnext.reflect.metadata { "chrome":"71" } - -[/src/in.js] Based on your targets, regenerator-runtime import excluded. -Successfully compiled 1 file with Babel. \ No newline at end of file diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-specific-entries/options.json b/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-specific-entries/options.json deleted file mode 100644 index 1e5ef9ed0a56..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-specific-entries/options.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "presets": [ - ["../../lib", { - "debug": true, - "shippedProposals": true, - "useBuiltIns": "entry", - "corejs": 3 - }] - ] -} diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-specific-entries/stdout.txt b/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-specific-entries/stdout.txt deleted file mode 100644 index d8ff0734f2d0..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-specific-entries/stdout.txt +++ /dev/null @@ -1,95 +0,0 @@ -@babel/preset-env: `DEBUG` option - -Using targets: -{} - -Using modules transform: auto - -Using plugins: - transform-template-literals {} - transform-literals {} - transform-function-name {} - transform-arrow-functions {} - transform-block-scoped-functions {} - transform-classes {} - transform-object-super {} - transform-shorthand-properties {} - transform-duplicate-keys {} - transform-computed-properties {} - transform-for-of {} - transform-sticky-regex {} - transform-dotall-regex {} - transform-unicode-regex {} - transform-spread {} - transform-parameters {} - transform-destructuring {} - transform-block-scoping {} - transform-typeof-symbol {} - transform-new-target {} - transform-regenerator {} - transform-exponentiation-operator {} - transform-async-to-generator {} - proposal-async-generator-functions {} - proposal-object-rest-spread {} - proposal-unicode-property-regex {} - proposal-json-strings {} - proposal-optional-catch-binding {} - transform-named-capturing-groups-regex {} - transform-member-expression-literals {} - transform-property-literals {} - transform-reserved-words {} - -Using polyfills with `entry` option: - -[/src/in.js] Replaced core-js entries with the following polyfills: - es.symbol {} - es.json.to-string-tag {} - es.math.to-string-tag {} - es.object.assign {} - es.object.create {} - es.object.define-getter {} - es.object.define-properties {} - es.object.define-property {} - es.object.define-setter {} - es.object.entries {} - es.object.freeze {} - es.object.from-entries {} - es.object.get-own-property-descriptor {} - es.object.get-own-property-descriptors {} - es.object.get-own-property-names {} - es.object.get-prototype-of {} - es.object.is {} - es.object.is-extensible {} - es.object.is-frozen {} - es.object.is-sealed {} - es.object.keys {} - es.object.lookup-getter {} - es.object.lookup-setter {} - es.object.prevent-extensions {} - es.object.seal {} - es.object.set-prototype-of {} - es.object.to-string {} - es.object.values {} - es.reflect.apply {} - es.reflect.construct {} - es.reflect.define-property {} - es.reflect.delete-property {} - es.reflect.get {} - es.reflect.get-own-property-descriptor {} - es.reflect.get-prototype-of {} - es.reflect.has {} - es.reflect.is-extensible {} - es.reflect.own-keys {} - es.reflect.prevent-extensions {} - es.reflect.set {} - es.reflect.set-prototype-of {} - esnext.reflect.define-metadata {} - esnext.reflect.delete-metadata {} - esnext.reflect.get-metadata {} - esnext.reflect.get-metadata-keys {} - esnext.reflect.get-own-metadata {} - esnext.reflect.get-own-metadata-keys {} - esnext.reflect.has-metadata {} - esnext.reflect.has-own-metadata {} - esnext.reflect.metadata {} -Successfully compiled 1 file with Babel. \ No newline at end of file diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-specific-targets/options.json b/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-specific-targets/options.json deleted file mode 100644 index b5693669350b..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-specific-targets/options.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "presets": [ - ["../../lib", { - "debug": true, - "targets": { - "browsers": "ie 10, ios 9, safari 7, edge 13, chrome 54, firefox 49" - }, - "useBuiltIns": "entry", - "corejs": 3 - }] - ] -} diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-specific-targets/stdout.txt b/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-specific-targets/stdout.txt deleted file mode 100644 index 0be270e41146..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-specific-targets/stdout.txt +++ /dev/null @@ -1,252 +0,0 @@ -@babel/preset-env: `DEBUG` option - -Using targets: -{ - "chrome": "54", - "edge": "13", - "firefox": "49", - "ie": "10", - "ios": "9", - "safari": "7" -} - -Using modules transform: auto - -Using plugins: - transform-template-literals { "ie":"10", "ios":"9", "safari":"7" } - transform-literals { "firefox":"49", "ie":"10", "safari":"7" } - transform-function-name { "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } - transform-arrow-functions { "ie":"10", "ios":"9", "safari":"7" } - transform-block-scoped-functions { "ie":"10", "ios":"9", "safari":"7" } - transform-classes { "ie":"10", "ios":"9", "safari":"7" } - transform-object-super { "ie":"10", "ios":"9", "safari":"7" } - transform-shorthand-properties { "ie":"10", "safari":"7" } - transform-duplicate-keys { "ie":"10", "safari":"7" } - transform-computed-properties { "ie":"10", "safari":"7" } - transform-for-of { "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } - transform-sticky-regex { "ie":"10", "ios":"9", "safari":"7" } - transform-dotall-regex { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } - transform-unicode-regex { "ie":"10", "ios":"9", "safari":"7" } - transform-spread { "ie":"10", "ios":"9", "safari":"7" } - transform-parameters { "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } - transform-destructuring { "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } - transform-block-scoping { "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } - transform-typeof-symbol { "ie":"10", "safari":"7" } - transform-new-target { "edge":"13", "ie":"10", "ios":"9", "safari":"7" } - transform-regenerator { "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } - transform-exponentiation-operator { "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } - transform-async-to-generator { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } - proposal-async-generator-functions { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } - proposal-object-rest-spread { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } - proposal-unicode-property-regex { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } - proposal-json-strings { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } - proposal-optional-catch-binding { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } - transform-named-capturing-groups-regex { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } - -Using polyfills with `entry` option: - -[/src/in.js] Replaced core-js entries with the following polyfills: - es.symbol { "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } - es.symbol.description { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } - es.symbol.async-iterator { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } - es.symbol.has-instance { "edge":"13", "ie":"10", "ios":"9", "safari":"7" } - es.symbol.is-concat-spreadable { "edge":"13", "ie":"10", "ios":"9", "safari":"7" } - es.symbol.iterator { "ie":"10", "safari":"7" } - es.symbol.match { "edge":"13", "ie":"10", "ios":"9", "safari":"7" } - es.symbol.replace { "edge":"13", "ie":"10", "ios":"9", "safari":"7" } - es.symbol.search { "edge":"13", "ie":"10", "ios":"9", "safari":"7" } - es.symbol.species { "ie":"10", "ios":"9", "safari":"7" } - es.symbol.split { "edge":"13", "ie":"10", "ios":"9", "safari":"7" } - es.symbol.to-primitive { "edge":"13", "ie":"10", "ios":"9", "safari":"7" } - es.symbol.to-string-tag { "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } - es.symbol.unscopables { "ie":"10", "safari":"7" } - es.array.concat { "edge":"13", "ie":"10", "ios":"9", "safari":"7" } - es.array.copy-within { "ie":"10", "safari":"7" } - es.array.every { "safari":"7" } - es.array.fill { "ie":"10", "safari":"7" } - es.array.filter { "ie":"10", "ios":"9", "safari":"7" } - es.array.find { "ie":"10", "safari":"7" } - es.array.find-index { "ie":"10", "safari":"7" } - es.array.flat { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } - es.array.flat-map { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } - es.array.for-each { "safari":"7" } - es.array.from { "edge":"13", "firefox":"49", "ie":"10", "safari":"7" } - es.array.includes { "edge":"13", "ie":"10", "ios":"9", "safari":"7" } - es.array.index-of { "safari":"7" } - es.array.iterator { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } - es.array.join { "ie":"10", "safari":"7" } - es.array.last-index-of { "safari":"7" } - es.array.map { "ie":"10", "ios":"9", "safari":"7" } - es.array.of { "ie":"10", "safari":"7" } - es.array.reduce { "safari":"7" } - es.array.reduce-right { "safari":"7" } - es.array.reverse { "ios":"9", "safari":"7" } - es.array.slice { "ie":"10", "ios":"9", "safari":"7" } - es.array.some { "safari":"7" } - es.array.sort { "chrome":"54", "ios":"9", "safari":"7" } - es.array.species { "ie":"10", "ios":"9", "safari":"7" } - es.array.splice { "ie":"10", "ios":"9", "safari":"7" } - es.array.unscopables.flat { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } - es.array.unscopables.flat-map { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } - es.array-buffer.constructor { "edge":"13", "ie":"10", "ios":"9", "safari":"7" } - es.array-buffer.is-view { "ie":"10", "safari":"7" } - es.array-buffer.slice { "ie":"10", "ios":"9", "safari":"7" } - es.data-view { "safari":"7" } - es.date.to-iso-string { "safari":"7" } - es.date.to-json { "ios":"9", "safari":"7" } - es.date.to-primitive { "edge":"13", "ie":"10", "ios":"9", "safari":"7" } - es.date.to-string { "safari":"7" } - es.function.has-instance { "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } - es.function.name { "edge":"13", "ie":"10", "safari":"7" } - es.json.to-string-tag { "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } - es.map { "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } - es.math.acosh { "ie":"10", "safari":"7" } - es.math.asinh { "ie":"10", "safari":"7" } - es.math.atanh { "ie":"10", "safari":"7" } - es.math.cbrt { "ie":"10", "safari":"7" } - es.math.clz32 { "ie":"10", "safari":"7" } - es.math.cosh { "ie":"10", "safari":"7" } - es.math.expm1 { "ie":"10", "safari":"7" } - es.math.fround { "ie":"10", "safari":"7" } - es.math.hypot { "ie":"10", "safari":"7" } - es.math.imul { "ie":"10", "safari":"7" } - es.math.log10 { "ie":"10", "safari":"7" } - es.math.log1p { "ie":"10", "safari":"7" } - es.math.log2 { "ie":"10", "safari":"7" } - es.math.sign { "ie":"10", "safari":"7" } - es.math.sinh { "ie":"10", "safari":"7" } - es.math.tanh { "ie":"10", "safari":"7" } - es.math.to-string-tag { "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } - es.math.trunc { "ie":"10", "safari":"7" } - es.number.constructor { "ie":"10", "safari":"7" } - es.number.epsilon { "ie":"10", "safari":"7" } - es.number.is-finite { "ie":"10", "safari":"7" } - es.number.is-integer { "ie":"10", "safari":"7" } - es.number.is-nan { "ie":"10", "safari":"7" } - es.number.is-safe-integer { "ie":"10", "safari":"7" } - es.number.max-safe-integer { "ie":"10", "safari":"7" } - es.number.min-safe-integer { "ie":"10", "safari":"7" } - es.number.parse-float { "ie":"10", "ios":"9", "safari":"7" } - es.number.parse-int { "ie":"10", "safari":"7" } - es.number.to-fixed { "edge":"13", "ie":"10", "safari":"7" } - es.number.to-precision { "safari":"7" } - es.object.assign { "ie":"10", "safari":"7" } - es.object.define-getter { "chrome":"54", "edge":"13", "ie":"10", "safari":"7" } - es.object.define-properties { "safari":"7" } - es.object.define-property { "safari":"7" } - es.object.define-setter { "chrome":"54", "edge":"13", "ie":"10", "safari":"7" } - es.object.entries { "edge":"13", "ie":"10", "ios":"9", "safari":"7" } - es.object.freeze { "ie":"10", "safari":"7" } - es.object.from-entries { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } - es.object.get-own-property-descriptor { "ie":"10", "safari":"7" } - es.object.get-own-property-descriptors { "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } - es.object.get-own-property-names { "ie":"10", "safari":"7" } - es.object.get-prototype-of { "ie":"10", "safari":"7" } - es.object.is { "ie":"10", "safari":"7" } - es.object.is-extensible { "ie":"10", "safari":"7" } - es.object.is-frozen { "ie":"10", "safari":"7" } - es.object.is-sealed { "ie":"10", "safari":"7" } - es.object.keys { "ie":"10", "safari":"7" } - es.object.lookup-getter { "chrome":"54", "edge":"13", "ie":"10", "safari":"7" } - es.object.lookup-setter { "chrome":"54", "edge":"13", "ie":"10", "safari":"7" } - es.object.prevent-extensions { "ie":"10", "safari":"7" } - es.object.seal { "ie":"10", "safari":"7" } - es.object.set-prototype-of { "ie":"10", "safari":"7" } - es.object.to-string { "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } - es.object.values { "edge":"13", "ie":"10", "ios":"9", "safari":"7" } - es.parse-float { "safari":"7" } - es.parse-int { "safari":"7" } - es.promise { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } - es.promise.finally { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } - es.reflect.apply { "edge":"13", "ie":"10", "ios":"9", "safari":"7" } - es.reflect.construct { "edge":"13", "ie":"10", "ios":"9", "safari":"7" } - es.reflect.define-property { "ie":"10", "ios":"9", "safari":"7" } - es.reflect.delete-property { "ie":"10", "ios":"9", "safari":"7" } - es.reflect.get { "ie":"10", "ios":"9", "safari":"7" } - es.reflect.get-own-property-descriptor { "ie":"10", "ios":"9", "safari":"7" } - es.reflect.get-prototype-of { "ie":"10", "ios":"9", "safari":"7" } - es.reflect.has { "ie":"10", "ios":"9", "safari":"7" } - es.reflect.is-extensible { "ie":"10", "ios":"9", "safari":"7" } - es.reflect.own-keys { "ie":"10", "ios":"9", "safari":"7" } - es.reflect.prevent-extensions { "ie":"10", "ios":"9", "safari":"7" } - es.reflect.set { "ie":"10", "ios":"9", "safari":"7" } - es.reflect.set-prototype-of { "ie":"10", "ios":"9", "safari":"7" } - es.regexp.constructor { "edge":"13", "ie":"10", "ios":"9", "safari":"7" } - es.regexp.exec { "safari":"7" } - es.regexp.flags { "edge":"13", "ie":"10", "safari":"7" } - es.regexp.to-string { "edge":"13", "ie":"10", "ios":"9", "safari":"7" } - es.set { "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } - es.string.code-point-at { "ie":"10", "safari":"7" } - es.string.ends-with { "edge":"13", "ie":"10", "ios":"9", "safari":"7" } - es.string.from-code-point { "ie":"10", "safari":"7" } - es.string.includes { "edge":"13", "ie":"10", "ios":"9", "safari":"7" } - es.string.iterator { "ie":"10", "safari":"7" } - es.string.match { "edge":"13", "ie":"10", "ios":"9", "safari":"7" } - es.string.pad-end { "chrome":"54", "edge":"13", "ie":"10", "ios":"9", "safari":"7" } - es.string.pad-start { "chrome":"54", "edge":"13", "ie":"10", "ios":"9", "safari":"7" } - es.string.raw { "ie":"10", "safari":"7" } - es.string.repeat { "ie":"10", "safari":"7" } - es.string.replace { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } - es.string.search { "edge":"13", "ie":"10", "ios":"9", "safari":"7" } - es.string.split { "edge":"13", "ie":"10", "ios":"9", "safari":"7" } - es.string.starts-with { "edge":"13", "ie":"10", "ios":"9", "safari":"7" } - es.string.trim { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } - es.string.trim-end { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } - es.string.trim-start { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } - es.string.anchor { "ie":"10", "safari":"7" } - es.string.big { "ie":"10", "safari":"7" } - es.string.blink { "ie":"10", "safari":"7" } - es.string.bold { "ie":"10", "safari":"7" } - es.string.fixed { "ie":"10", "safari":"7" } - es.string.fontcolor { "ie":"10", "safari":"7" } - es.string.fontsize { "ie":"10", "safari":"7" } - es.string.italics { "ie":"10", "safari":"7" } - es.string.link { "ie":"10", "safari":"7" } - es.string.small { "ie":"10", "safari":"7" } - es.string.strike { "ie":"10", "safari":"7" } - es.string.sub { "ie":"10", "safari":"7" } - es.string.sup { "ie":"10", "safari":"7" } - es.typed-array.float32-array { "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } - es.typed-array.float64-array { "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } - es.typed-array.int8-array { "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } - es.typed-array.int16-array { "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } - es.typed-array.int32-array { "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } - es.typed-array.uint8-array { "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } - es.typed-array.uint8-clamped-array { "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } - es.typed-array.uint16-array { "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } - es.typed-array.uint32-array { "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } - es.typed-array.copy-within { "ie":"10", "ios":"9", "safari":"7" } - es.typed-array.every { "ie":"10", "ios":"9", "safari":"7" } - es.typed-array.fill { "ie":"10", "ios":"9", "safari":"7" } - es.typed-array.filter { "ie":"10", "ios":"9", "safari":"7" } - es.typed-array.find { "ie":"10", "ios":"9", "safari":"7" } - es.typed-array.find-index { "ie":"10", "ios":"9", "safari":"7" } - es.typed-array.for-each { "ie":"10", "ios":"9", "safari":"7" } - es.typed-array.from { "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } - es.typed-array.includes { "edge":"13", "ie":"10", "ios":"9", "safari":"7" } - es.typed-array.index-of { "ie":"10", "ios":"9", "safari":"7" } - es.typed-array.iterator { "ie":"10", "ios":"9", "safari":"7" } - es.typed-array.join { "ie":"10", "ios":"9", "safari":"7" } - es.typed-array.last-index-of { "ie":"10", "ios":"9", "safari":"7" } - es.typed-array.map { "ie":"10", "ios":"9", "safari":"7" } - es.typed-array.of { "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } - es.typed-array.reduce { "ie":"10", "ios":"9", "safari":"7" } - es.typed-array.reduce-right { "ie":"10", "ios":"9", "safari":"7" } - es.typed-array.reverse { "ie":"10", "ios":"9", "safari":"7" } - es.typed-array.set { "ie":"10", "safari":"7" } - es.typed-array.slice { "ie":"10", "ios":"9", "safari":"7" } - es.typed-array.some { "ie":"10", "ios":"9", "safari":"7" } - es.typed-array.sort { "ie":"10", "ios":"9", "safari":"7" } - es.typed-array.subarray { "ie":"10", "safari":"7" } - es.typed-array.to-locale-string { "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } - es.typed-array.to-string { "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } - es.weak-map { "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } - es.weak-set { "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } - web.dom-collections.for-each { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } - web.dom-collections.iterator { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } - web.immediate { "chrome":"54", "firefox":"49", "ios":"9", "safari":"7" } - web.queue-microtask { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } - web.url { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } - web.url.to-json { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } - web.url-search-params { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } -Successfully compiled 1 file with Babel. \ No newline at end of file diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-stable-chrome-71/options.json b/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-stable-chrome-71/options.json deleted file mode 100644 index b9db1e21e401..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-stable-chrome-71/options.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "presets": [ - ["../../lib", { - "debug": true, - "targets": { - "browsers": "chrome 71" - }, - "shippedProposals": true, - "useBuiltIns": "entry", - "corejs": 3 - }] - ] -} diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-stable-chrome-71/stdout.txt b/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-stable-chrome-71/stdout.txt deleted file mode 100644 index 781f32ad0974..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-stable-chrome-71/stdout.txt +++ /dev/null @@ -1,25 +0,0 @@ -@babel/preset-env: `DEBUG` option - -Using targets: -{ - "chrome": "71" -} - -Using modules transform: auto - -Using plugins: - syntax-async-generators { "chrome":"71" } - syntax-object-rest-spread { "chrome":"71" } - syntax-json-strings { "chrome":"71" } - syntax-optional-catch-binding { "chrome":"71" } - -Using polyfills with `entry` option: - -[/src/in.js] Replaced core-js entries with the following polyfills: - es.array.unscopables.flat { "chrome":"71" } - es.array.unscopables.flat-map { "chrome":"71" } - es.object.from-entries { "chrome":"71" } - web.immediate { "chrome":"71" } - -[/src/in.js] Based on your targets, regenerator-runtime import excluded. -Successfully compiled 1 file with Babel. \ No newline at end of file diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-stable-samsung-8.2/options.json b/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-stable-samsung-8.2/options.json deleted file mode 100644 index 381749958890..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-stable-samsung-8.2/options.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "presets": [ - ["../../lib", { - "debug": true, - "targets": { - "browsers": "samsung 8.2" - }, - "shippedProposals": true, - "useBuiltIns": "entry", - "corejs": 3 - }] - ] -} diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-stable-samsung-8.2/stdout.txt b/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-stable-samsung-8.2/stdout.txt deleted file mode 100644 index 50f7b3e20e25..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-stable-samsung-8.2/stdout.txt +++ /dev/null @@ -1,39 +0,0 @@ -@babel/preset-env: `DEBUG` option - -Using targets: -{ - "samsung": "8.2" -} - -Using modules transform: auto - -Using plugins: - syntax-async-generators { "samsung":"8.2" } - syntax-object-rest-spread { "samsung":"8.2" } - proposal-unicode-property-regex { "samsung":"8.2" } - proposal-json-strings { "samsung":"8.2" } - proposal-optional-catch-binding { "samsung":"8.2" } - transform-named-capturing-groups-regex { "samsung":"8.2" } - -Using polyfills with `entry` option: - -[/src/in.js] Replaced core-js entries with the following polyfills: - es.symbol.description { "samsung":"8.2" } - es.array.flat { "samsung":"8.2" } - es.array.flat-map { "samsung":"8.2" } - es.array.iterator { "samsung":"8.2" } - es.array.unscopables.flat { "samsung":"8.2" } - es.array.unscopables.flat-map { "samsung":"8.2" } - es.object.from-entries { "samsung":"8.2" } - es.promise { "samsung":"8.2" } - es.promise.finally { "samsung":"8.2" } - es.string.replace { "samsung":"8.2" } - es.string.trim-end { "samsung":"8.2" } - es.string.trim-start { "samsung":"8.2" } - web.dom-collections.iterator { "samsung":"8.2" } - web.immediate { "samsung":"8.2" } - web.queue-microtask { "samsung":"8.2" } - web.url.to-json { "samsung":"8.2" } - -[/src/in.js] Based on your targets, regenerator-runtime import excluded. -Successfully compiled 1 file with Babel. \ No newline at end of file diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-stable/options.json b/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-stable/options.json deleted file mode 100644 index 1e5ef9ed0a56..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-stable/options.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "presets": [ - ["../../lib", { - "debug": true, - "shippedProposals": true, - "useBuiltIns": "entry", - "corejs": 3 - }] - ] -} diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-stable/stdout.txt b/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-stable/stdout.txt deleted file mode 100644 index ac359171f3f1..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-stable/stdout.txt +++ /dev/null @@ -1,253 +0,0 @@ -@babel/preset-env: `DEBUG` option - -Using targets: -{} - -Using modules transform: auto - -Using plugins: - transform-template-literals {} - transform-literals {} - transform-function-name {} - transform-arrow-functions {} - transform-block-scoped-functions {} - transform-classes {} - transform-object-super {} - transform-shorthand-properties {} - transform-duplicate-keys {} - transform-computed-properties {} - transform-for-of {} - transform-sticky-regex {} - transform-dotall-regex {} - transform-unicode-regex {} - transform-spread {} - transform-parameters {} - transform-destructuring {} - transform-block-scoping {} - transform-typeof-symbol {} - transform-new-target {} - transform-regenerator {} - transform-exponentiation-operator {} - transform-async-to-generator {} - proposal-async-generator-functions {} - proposal-object-rest-spread {} - proposal-unicode-property-regex {} - proposal-json-strings {} - proposal-optional-catch-binding {} - transform-named-capturing-groups-regex {} - transform-member-expression-literals {} - transform-property-literals {} - transform-reserved-words {} - -Using polyfills with `entry` option: - -[/src/in.js] Replaced core-js entries with the following polyfills: - es.symbol {} - es.symbol.description {} - es.symbol.async-iterator {} - es.symbol.has-instance {} - es.symbol.is-concat-spreadable {} - es.symbol.iterator {} - es.symbol.match {} - es.symbol.replace {} - es.symbol.search {} - es.symbol.species {} - es.symbol.split {} - es.symbol.to-primitive {} - es.symbol.to-string-tag {} - es.symbol.unscopables {} - es.array.concat {} - es.array.copy-within {} - es.array.every {} - es.array.fill {} - es.array.filter {} - es.array.find {} - es.array.find-index {} - es.array.flat {} - es.array.flat-map {} - es.array.for-each {} - es.array.from {} - es.array.includes {} - es.array.index-of {} - es.array.is-array {} - es.array.iterator {} - es.array.join {} - es.array.last-index-of {} - es.array.map {} - es.array.of {} - es.array.reduce {} - es.array.reduce-right {} - es.array.reverse {} - es.array.slice {} - es.array.some {} - es.array.sort {} - es.array.species {} - es.array.splice {} - es.array.unscopables.flat {} - es.array.unscopables.flat-map {} - es.array-buffer.constructor {} - es.array-buffer.is-view {} - es.array-buffer.slice {} - es.data-view {} - es.date.now {} - es.date.to-iso-string {} - es.date.to-json {} - es.date.to-primitive {} - es.date.to-string {} - es.function.bind {} - es.function.has-instance {} - es.function.name {} - es.json.to-string-tag {} - es.map {} - es.math.acosh {} - es.math.asinh {} - es.math.atanh {} - es.math.cbrt {} - es.math.clz32 {} - es.math.cosh {} - es.math.expm1 {} - es.math.fround {} - es.math.hypot {} - es.math.imul {} - es.math.log10 {} - es.math.log1p {} - es.math.log2 {} - es.math.sign {} - es.math.sinh {} - es.math.tanh {} - es.math.to-string-tag {} - es.math.trunc {} - es.number.constructor {} - es.number.epsilon {} - es.number.is-finite {} - es.number.is-integer {} - es.number.is-nan {} - es.number.is-safe-integer {} - es.number.max-safe-integer {} - es.number.min-safe-integer {} - es.number.parse-float {} - es.number.parse-int {} - es.number.to-fixed {} - es.number.to-precision {} - es.object.assign {} - es.object.create {} - es.object.define-getter {} - es.object.define-properties {} - es.object.define-property {} - es.object.define-setter {} - es.object.entries {} - es.object.freeze {} - es.object.from-entries {} - es.object.get-own-property-descriptor {} - es.object.get-own-property-descriptors {} - es.object.get-own-property-names {} - es.object.get-prototype-of {} - es.object.is {} - es.object.is-extensible {} - es.object.is-frozen {} - es.object.is-sealed {} - es.object.keys {} - es.object.lookup-getter {} - es.object.lookup-setter {} - es.object.prevent-extensions {} - es.object.seal {} - es.object.set-prototype-of {} - es.object.to-string {} - es.object.values {} - es.parse-float {} - es.parse-int {} - es.promise {} - es.promise.finally {} - es.reflect.apply {} - es.reflect.construct {} - es.reflect.define-property {} - es.reflect.delete-property {} - es.reflect.get {} - es.reflect.get-own-property-descriptor {} - es.reflect.get-prototype-of {} - es.reflect.has {} - es.reflect.is-extensible {} - es.reflect.own-keys {} - es.reflect.prevent-extensions {} - es.reflect.set {} - es.reflect.set-prototype-of {} - es.regexp.constructor {} - es.regexp.exec {} - es.regexp.flags {} - es.regexp.to-string {} - es.set {} - es.string.code-point-at {} - es.string.ends-with {} - es.string.from-code-point {} - es.string.includes {} - es.string.iterator {} - es.string.match {} - es.string.pad-end {} - es.string.pad-start {} - es.string.raw {} - es.string.repeat {} - es.string.replace {} - es.string.search {} - es.string.split {} - es.string.starts-with {} - es.string.trim {} - es.string.trim-end {} - es.string.trim-start {} - es.string.anchor {} - es.string.big {} - es.string.blink {} - es.string.bold {} - es.string.fixed {} - es.string.fontcolor {} - es.string.fontsize {} - es.string.italics {} - es.string.link {} - es.string.small {} - es.string.strike {} - es.string.sub {} - es.string.sup {} - es.typed-array.float32-array {} - es.typed-array.float64-array {} - es.typed-array.int8-array {} - es.typed-array.int16-array {} - es.typed-array.int32-array {} - es.typed-array.uint8-array {} - es.typed-array.uint8-clamped-array {} - es.typed-array.uint16-array {} - es.typed-array.uint32-array {} - es.typed-array.copy-within {} - es.typed-array.every {} - es.typed-array.fill {} - es.typed-array.filter {} - es.typed-array.find {} - es.typed-array.find-index {} - es.typed-array.for-each {} - es.typed-array.from {} - es.typed-array.includes {} - es.typed-array.index-of {} - es.typed-array.iterator {} - es.typed-array.join {} - es.typed-array.last-index-of {} - es.typed-array.map {} - es.typed-array.of {} - es.typed-array.reduce {} - es.typed-array.reduce-right {} - es.typed-array.reverse {} - es.typed-array.set {} - es.typed-array.slice {} - es.typed-array.some {} - es.typed-array.sort {} - es.typed-array.subarray {} - es.typed-array.to-locale-string {} - es.typed-array.to-string {} - es.weak-map {} - es.weak-set {} - web.dom-collections.for-each {} - web.dom-collections.iterator {} - web.immediate {} - web.queue-microtask {} - web.timers {} - web.url {} - web.url.to-json {} - web.url-search-params {} -Successfully compiled 1 file with Babel. \ No newline at end of file diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-stage-chrome-71/options.json b/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-stage-chrome-71/options.json deleted file mode 100644 index b9db1e21e401..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-stage-chrome-71/options.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "presets": [ - ["../../lib", { - "debug": true, - "targets": { - "browsers": "chrome 71" - }, - "shippedProposals": true, - "useBuiltIns": "entry", - "corejs": 3 - }] - ] -} diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-stage-chrome-71/stdout.txt b/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-stage-chrome-71/stdout.txt deleted file mode 100644 index 7b8630d1d45f..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-stage-chrome-71/stdout.txt +++ /dev/null @@ -1,102 +0,0 @@ -@babel/preset-env: `DEBUG` option - -Using targets: -{ - "chrome": "71" -} - -Using modules transform: auto - -Using plugins: - syntax-async-generators { "chrome":"71" } - syntax-object-rest-spread { "chrome":"71" } - syntax-json-strings { "chrome":"71" } - syntax-optional-catch-binding { "chrome":"71" } - -Using polyfills with `entry` option: - -[/src/in.js] Replaced core-js entries with the following polyfills: - esnext.aggregate-error { "chrome":"71" } - esnext.array.last-index { "chrome":"71" } - esnext.array.last-item { "chrome":"71" } - esnext.composite-key { "chrome":"71" } - esnext.composite-symbol { "chrome":"71" } - esnext.map.delete-all { "chrome":"71" } - esnext.map.every { "chrome":"71" } - esnext.map.filter { "chrome":"71" } - esnext.map.find { "chrome":"71" } - esnext.map.find-key { "chrome":"71" } - esnext.map.from { "chrome":"71" } - esnext.map.group-by { "chrome":"71" } - esnext.map.includes { "chrome":"71" } - esnext.map.key-by { "chrome":"71" } - esnext.map.key-of { "chrome":"71" } - esnext.map.map-keys { "chrome":"71" } - esnext.map.map-values { "chrome":"71" } - esnext.map.merge { "chrome":"71" } - esnext.map.of { "chrome":"71" } - esnext.map.reduce { "chrome":"71" } - esnext.map.some { "chrome":"71" } - esnext.map.update { "chrome":"71" } - esnext.math.clamp { "chrome":"71" } - esnext.math.deg-per-rad { "chrome":"71" } - esnext.math.degrees { "chrome":"71" } - esnext.math.fscale { "chrome":"71" } - esnext.math.iaddh { "chrome":"71" } - esnext.math.imulh { "chrome":"71" } - esnext.math.isubh { "chrome":"71" } - esnext.math.rad-per-deg { "chrome":"71" } - esnext.math.radians { "chrome":"71" } - esnext.math.scale { "chrome":"71" } - esnext.math.seeded-prng { "chrome":"71" } - esnext.math.signbit { "chrome":"71" } - esnext.math.umulh { "chrome":"71" } - esnext.number.from-string { "chrome":"71" } - esnext.observable { "chrome":"71" } - esnext.promise.all-settled { "chrome":"71" } - esnext.promise.any { "chrome":"71" } - esnext.promise.try { "chrome":"71" } - esnext.reflect.define-metadata { "chrome":"71" } - esnext.reflect.delete-metadata { "chrome":"71" } - esnext.reflect.get-metadata { "chrome":"71" } - esnext.reflect.get-metadata-keys { "chrome":"71" } - esnext.reflect.get-own-metadata { "chrome":"71" } - esnext.reflect.get-own-metadata-keys { "chrome":"71" } - esnext.reflect.has-metadata { "chrome":"71" } - esnext.reflect.has-own-metadata { "chrome":"71" } - esnext.reflect.metadata { "chrome":"71" } - esnext.set.add-all { "chrome":"71" } - esnext.set.delete-all { "chrome":"71" } - esnext.set.difference { "chrome":"71" } - esnext.set.every { "chrome":"71" } - esnext.set.filter { "chrome":"71" } - esnext.set.find { "chrome":"71" } - esnext.set.from { "chrome":"71" } - esnext.set.intersection { "chrome":"71" } - esnext.set.is-disjoint-from { "chrome":"71" } - esnext.set.is-subset-of { "chrome":"71" } - esnext.set.is-superset-of { "chrome":"71" } - esnext.set.join { "chrome":"71" } - esnext.set.map { "chrome":"71" } - esnext.set.of { "chrome":"71" } - esnext.set.reduce { "chrome":"71" } - esnext.set.some { "chrome":"71" } - esnext.set.symmetric-difference { "chrome":"71" } - esnext.set.union { "chrome":"71" } - esnext.string.at { "chrome":"71" } - esnext.string.code-points { "chrome":"71" } - esnext.string.replace-all { "chrome":"71" } - esnext.symbol.dispose { "chrome":"71" } - esnext.symbol.observable { "chrome":"71" } - esnext.symbol.pattern-match { "chrome":"71" } - esnext.weak-map.delete-all { "chrome":"71" } - esnext.weak-map.from { "chrome":"71" } - esnext.weak-map.of { "chrome":"71" } - esnext.weak-set.add-all { "chrome":"71" } - esnext.weak-set.delete-all { "chrome":"71" } - esnext.weak-set.from { "chrome":"71" } - esnext.weak-set.of { "chrome":"71" } - esnext.string.match-all { "chrome":"71" } - -[/src/in.js] Based on your targets, regenerator-runtime import excluded. -Successfully compiled 1 file with Babel. \ No newline at end of file diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-stage/options.json b/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-stage/options.json deleted file mode 100644 index 1e5ef9ed0a56..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-stage/options.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "presets": [ - ["../../lib", { - "debug": true, - "shippedProposals": true, - "useBuiltIns": "entry", - "corejs": 3 - }] - ] -} diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-stage/stdout.txt b/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-stage/stdout.txt deleted file mode 100644 index 34bf4094e273..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-stage/stdout.txt +++ /dev/null @@ -1,130 +0,0 @@ -@babel/preset-env: `DEBUG` option - -Using targets: -{} - -Using modules transform: auto - -Using plugins: - transform-template-literals {} - transform-literals {} - transform-function-name {} - transform-arrow-functions {} - transform-block-scoped-functions {} - transform-classes {} - transform-object-super {} - transform-shorthand-properties {} - transform-duplicate-keys {} - transform-computed-properties {} - transform-for-of {} - transform-sticky-regex {} - transform-dotall-regex {} - transform-unicode-regex {} - transform-spread {} - transform-parameters {} - transform-destructuring {} - transform-block-scoping {} - transform-typeof-symbol {} - transform-new-target {} - transform-regenerator {} - transform-exponentiation-operator {} - transform-async-to-generator {} - proposal-async-generator-functions {} - proposal-object-rest-spread {} - proposal-unicode-property-regex {} - proposal-json-strings {} - proposal-optional-catch-binding {} - transform-named-capturing-groups-regex {} - transform-member-expression-literals {} - transform-property-literals {} - transform-reserved-words {} - -Using polyfills with `entry` option: - -[/src/in.js] Replaced core-js entries with the following polyfills: - esnext.aggregate-error {} - esnext.array.last-index {} - esnext.array.last-item {} - esnext.composite-key {} - esnext.composite-symbol {} - esnext.global-this {} - esnext.map.delete-all {} - esnext.map.every {} - esnext.map.filter {} - esnext.map.find {} - esnext.map.find-key {} - esnext.map.from {} - esnext.map.group-by {} - esnext.map.includes {} - esnext.map.key-by {} - esnext.map.key-of {} - esnext.map.map-keys {} - esnext.map.map-values {} - esnext.map.merge {} - esnext.map.of {} - esnext.map.reduce {} - esnext.map.some {} - esnext.map.update {} - esnext.math.clamp {} - esnext.math.deg-per-rad {} - esnext.math.degrees {} - esnext.math.fscale {} - esnext.math.iaddh {} - esnext.math.imulh {} - esnext.math.isubh {} - esnext.math.rad-per-deg {} - esnext.math.radians {} - esnext.math.scale {} - esnext.math.seeded-prng {} - esnext.math.signbit {} - esnext.math.umulh {} - esnext.number.from-string {} - esnext.observable {} - esnext.promise.all-settled {} - esnext.promise.any {} - esnext.promise.try {} - esnext.reflect.define-metadata {} - esnext.reflect.delete-metadata {} - esnext.reflect.get-metadata {} - esnext.reflect.get-metadata-keys {} - esnext.reflect.get-own-metadata {} - esnext.reflect.get-own-metadata-keys {} - esnext.reflect.has-metadata {} - esnext.reflect.has-own-metadata {} - esnext.reflect.metadata {} - esnext.set.add-all {} - esnext.set.delete-all {} - esnext.set.difference {} - esnext.set.every {} - esnext.set.filter {} - esnext.set.find {} - esnext.set.from {} - esnext.set.intersection {} - esnext.set.is-disjoint-from {} - esnext.set.is-subset-of {} - esnext.set.is-superset-of {} - esnext.set.join {} - esnext.set.map {} - esnext.set.of {} - esnext.set.reduce {} - esnext.set.some {} - esnext.set.symmetric-difference {} - esnext.set.union {} - esnext.string.at {} - esnext.string.code-points {} - esnext.string.replace-all {} - esnext.symbol.dispose {} - esnext.symbol.observable {} - esnext.symbol.pattern-match {} - esnext.weak-map.delete-all {} - esnext.weak-map.from {} - esnext.weak-map.of {} - esnext.weak-set.add-all {} - esnext.weak-set.delete-all {} - esnext.weak-set.from {} - esnext.weak-set.of {} - web.url {} - web.url.to-json {} - web.url-search-params {} - esnext.string.match-all {} -Successfully compiled 1 file with Babel. \ No newline at end of file diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-versions-decimals/options.json b/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-versions-decimals/options.json deleted file mode 100644 index 8eebdab425d8..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-versions-decimals/options.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "presets": [ - ["../../lib", { - "useBuiltIns": "entry", - "corejs": 3, - "debug": true, - "targets": { - "chrome": 54, - "electron": 0.36, - "node": 6.10, - "ie": 10 - } - }] - ] -} diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-versions-decimals/stdout.txt b/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-versions-decimals/stdout.txt deleted file mode 100644 index 359bbdb07bdd..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-versions-decimals/stdout.txt +++ /dev/null @@ -1,244 +0,0 @@ -Warning, the following targets are using a decimal version: - - electron: 0.36 - node: 6.1 - -We recommend using a string for minor/patch versions to avoid numbers like 6.10 -getting parsed as 6.1, which can lead to unexpected behavior. - -@babel/preset-env: `DEBUG` option - -Using targets: -{ - "chrome": "54", - "electron": "0.36", - "ie": "10", - "node": "6.1" -} - -Using modules transform: auto - -Using plugins: - transform-template-literals { "ie":"10" } - transform-literals { "ie":"10" } - transform-function-name { "electron":"0.36", "ie":"10", "node":"6.1" } - transform-arrow-functions { "ie":"10" } - transform-block-scoped-functions { "ie":"10" } - transform-classes { "ie":"10" } - transform-object-super { "ie":"10" } - transform-shorthand-properties { "ie":"10" } - transform-duplicate-keys { "ie":"10" } - transform-computed-properties { "ie":"10" } - transform-for-of { "electron":"0.36", "ie":"10", "node":"6.1" } - transform-sticky-regex { "electron":"0.36", "ie":"10" } - transform-dotall-regex { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } - transform-unicode-regex { "electron":"0.36", "ie":"10" } - transform-spread { "ie":"10" } - transform-parameters { "electron":"0.36", "ie":"10" } - transform-destructuring { "electron":"0.36", "ie":"10", "node":"6.1" } - transform-block-scoping { "electron":"0.36", "ie":"10" } - transform-typeof-symbol { "ie":"10" } - transform-new-target { "ie":"10" } - transform-regenerator { "electron":"0.36", "ie":"10" } - transform-exponentiation-operator { "electron":"0.36", "ie":"10", "node":"6.1" } - transform-async-to-generator { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } - proposal-async-generator-functions { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } - proposal-object-rest-spread { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } - proposal-unicode-property-regex { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } - proposal-json-strings { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } - proposal-optional-catch-binding { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } - transform-named-capturing-groups-regex { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } - transform-member-expression-literals { "electron":"0.36" } - transform-property-literals { "electron":"0.36" } - -Using polyfills with `entry` option: - -[/src/in.js] Replaced core-js entries with the following polyfills: - es.symbol { "electron":"0.36", "ie":"10" } - es.symbol.description { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } - es.symbol.async-iterator { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } - es.symbol.has-instance { "electron":"0.36", "ie":"10" } - es.symbol.is-concat-spreadable { "electron":"0.36", "ie":"10" } - es.symbol.iterator { "ie":"10" } - es.symbol.match { "electron":"0.36", "ie":"10" } - es.symbol.replace { "electron":"0.36", "ie":"10" } - es.symbol.search { "electron":"0.36", "ie":"10" } - es.symbol.species { "electron":"0.36", "ie":"10", "node":"6.1" } - es.symbol.split { "electron":"0.36", "ie":"10" } - es.symbol.to-primitive { "ie":"10" } - es.symbol.to-string-tag { "electron":"0.36", "ie":"10" } - es.symbol.unscopables { "ie":"10" } - es.array.concat { "electron":"0.36", "ie":"10", "node":"6.1" } - es.array.copy-within { "ie":"10" } - es.array.fill { "ie":"10" } - es.array.filter { "electron":"0.36", "ie":"10", "node":"6.1" } - es.array.find { "ie":"10" } - es.array.find-index { "ie":"10" } - es.array.flat { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } - es.array.flat-map { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } - es.array.from { "electron":"0.36", "ie":"10", "node":"6.1" } - es.array.includes { "electron":"0.36", "ie":"10", "node":"6.1" } - es.array.index-of { "electron":"0.36", "node":"6.1" } - es.array.iterator { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } - es.array.join { "ie":"10" } - es.array.last-index-of { "electron":"0.36", "node":"6.1" } - es.array.map { "electron":"0.36", "ie":"10", "node":"6.1" } - es.array.of { "ie":"10" } - es.array.slice { "electron":"0.36", "ie":"10", "node":"6.1" } - es.array.sort { "chrome":"54", "electron":"0.36", "node":"6.1" } - es.array.species { "electron":"0.36", "ie":"10", "node":"6.1" } - es.array.splice { "electron":"0.36", "ie":"10", "node":"6.1" } - es.array.unscopables.flat { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } - es.array.unscopables.flat-map { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } - es.array-buffer.constructor { "ie":"10" } - es.array-buffer.is-view { "ie":"10" } - es.array-buffer.slice { "ie":"10" } - es.date.to-primitive { "ie":"10" } - es.function.has-instance { "electron":"0.36", "ie":"10", "node":"6.1" } - es.function.name { "ie":"10" } - es.json.to-string-tag { "electron":"0.36", "ie":"10" } - es.map { "electron":"0.36", "ie":"10", "node":"6.1" } - es.math.acosh { "electron":"0.36", "ie":"10", "node":"6.1" } - es.math.asinh { "ie":"10" } - es.math.atanh { "ie":"10" } - es.math.cbrt { "ie":"10" } - es.math.clz32 { "ie":"10" } - es.math.cosh { "ie":"10" } - es.math.expm1 { "ie":"10" } - es.math.fround { "ie":"10" } - es.math.hypot { "ie":"10" } - es.math.imul { "ie":"10" } - es.math.log10 { "ie":"10" } - es.math.log1p { "ie":"10" } - es.math.log2 { "ie":"10" } - es.math.sign { "ie":"10" } - es.math.sinh { "ie":"10" } - es.math.tanh { "ie":"10" } - es.math.to-string-tag { "electron":"0.36", "ie":"10" } - es.math.trunc { "ie":"10" } - es.number.constructor { "ie":"10" } - es.number.epsilon { "ie":"10" } - es.number.is-finite { "ie":"10" } - es.number.is-integer { "ie":"10" } - es.number.is-nan { "ie":"10" } - es.number.is-safe-integer { "ie":"10" } - es.number.max-safe-integer { "ie":"10" } - es.number.min-safe-integer { "ie":"10" } - es.number.parse-float { "ie":"10" } - es.number.parse-int { "ie":"10" } - es.number.to-fixed { "ie":"10" } - es.object.assign { "electron":"0.36", "ie":"10" } - es.object.define-getter { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } - es.object.define-setter { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } - es.object.entries { "electron":"0.36", "ie":"10", "node":"6.1" } - es.object.freeze { "ie":"10" } - es.object.from-entries { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } - es.object.get-own-property-descriptor { "ie":"10" } - es.object.get-own-property-descriptors { "electron":"0.36", "ie":"10", "node":"6.1" } - es.object.get-own-property-names { "ie":"10" } - es.object.get-prototype-of { "ie":"10" } - es.object.is { "ie":"10" } - es.object.is-extensible { "ie":"10" } - es.object.is-frozen { "ie":"10" } - es.object.is-sealed { "ie":"10" } - es.object.keys { "ie":"10" } - es.object.lookup-getter { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } - es.object.lookup-setter { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } - es.object.prevent-extensions { "ie":"10" } - es.object.seal { "ie":"10" } - es.object.set-prototype-of { "ie":"10" } - es.object.to-string { "electron":"0.36", "ie":"10" } - es.object.values { "electron":"0.36", "ie":"10", "node":"6.1" } - es.promise { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } - es.promise.finally { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } - es.reflect.apply { "electron":"0.36", "ie":"10" } - es.reflect.construct { "electron":"0.36", "ie":"10" } - es.reflect.define-property { "electron":"0.36", "ie":"10" } - es.reflect.delete-property { "electron":"0.36", "ie":"10" } - es.reflect.get { "electron":"0.36", "ie":"10" } - es.reflect.get-own-property-descriptor { "electron":"0.36", "ie":"10" } - es.reflect.get-prototype-of { "electron":"0.36", "ie":"10" } - es.reflect.has { "electron":"0.36", "ie":"10" } - es.reflect.is-extensible { "electron":"0.36", "ie":"10" } - es.reflect.own-keys { "electron":"0.36", "ie":"10" } - es.reflect.prevent-extensions { "electron":"0.36", "ie":"10" } - es.reflect.set { "electron":"0.36", "ie":"10" } - es.reflect.set-prototype-of { "electron":"0.36", "ie":"10" } - es.regexp.constructor { "electron":"0.36", "ie":"10", "node":"6.1" } - es.regexp.flags { "electron":"0.36", "ie":"10" } - es.regexp.to-string { "electron":"0.36", "ie":"10" } - es.set { "electron":"0.36", "ie":"10", "node":"6.1" } - es.string.code-point-at { "ie":"10" } - es.string.ends-with { "electron":"0.36", "ie":"10", "node":"6.1" } - es.string.from-code-point { "ie":"10" } - es.string.includes { "electron":"0.36", "ie":"10", "node":"6.1" } - es.string.iterator { "ie":"10" } - es.string.match { "electron":"0.36", "ie":"10", "node":"6.1" } - es.string.pad-end { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } - es.string.pad-start { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } - es.string.raw { "ie":"10" } - es.string.repeat { "ie":"10" } - es.string.replace { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } - es.string.search { "electron":"0.36", "ie":"10", "node":"6.1" } - es.string.split { "electron":"0.36", "ie":"10", "node":"6.1" } - es.string.starts-with { "electron":"0.36", "ie":"10", "node":"6.1" } - es.string.trim { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } - es.string.trim-end { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } - es.string.trim-start { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } - es.string.anchor { "ie":"10" } - es.string.big { "ie":"10" } - es.string.blink { "ie":"10" } - es.string.bold { "ie":"10" } - es.string.fixed { "ie":"10" } - es.string.fontcolor { "ie":"10" } - es.string.fontsize { "ie":"10" } - es.string.italics { "ie":"10" } - es.string.link { "ie":"10" } - es.string.small { "ie":"10" } - es.string.strike { "ie":"10" } - es.string.sub { "ie":"10" } - es.string.sup { "ie":"10" } - es.typed-array.float32-array { "electron":"0.36", "ie":"10", "node":"6.1" } - es.typed-array.float64-array { "electron":"0.36", "ie":"10", "node":"6.1" } - es.typed-array.int8-array { "electron":"0.36", "ie":"10", "node":"6.1" } - es.typed-array.int16-array { "electron":"0.36", "ie":"10", "node":"6.1" } - es.typed-array.int32-array { "electron":"0.36", "ie":"10", "node":"6.1" } - es.typed-array.uint8-array { "electron":"0.36", "ie":"10", "node":"6.1" } - es.typed-array.uint8-clamped-array { "electron":"0.36", "ie":"10", "node":"6.1" } - es.typed-array.uint16-array { "electron":"0.36", "ie":"10", "node":"6.1" } - es.typed-array.uint32-array { "electron":"0.36", "ie":"10", "node":"6.1" } - es.typed-array.copy-within { "ie":"10" } - es.typed-array.every { "ie":"10" } - es.typed-array.fill { "ie":"10" } - es.typed-array.filter { "ie":"10" } - es.typed-array.find { "ie":"10" } - es.typed-array.find-index { "ie":"10" } - es.typed-array.for-each { "ie":"10" } - es.typed-array.from { "electron":"0.36", "ie":"10", "node":"6.1" } - es.typed-array.includes { "electron":"0.36", "ie":"10" } - es.typed-array.index-of { "ie":"10" } - es.typed-array.iterator { "ie":"10" } - es.typed-array.join { "ie":"10" } - es.typed-array.last-index-of { "ie":"10" } - es.typed-array.map { "ie":"10" } - es.typed-array.of { "electron":"0.36", "ie":"10", "node":"6.1" } - es.typed-array.reduce { "ie":"10" } - es.typed-array.reduce-right { "ie":"10" } - es.typed-array.reverse { "ie":"10" } - es.typed-array.set { "ie":"10" } - es.typed-array.slice { "ie":"10" } - es.typed-array.some { "ie":"10" } - es.typed-array.sort { "ie":"10" } - es.typed-array.subarray { "ie":"10" } - es.typed-array.to-locale-string { "ie":"10" } - es.typed-array.to-string { "electron":"0.36", "ie":"10", "node":"6.1" } - es.weak-map { "electron":"0.36", "ie":"10", "node":"6.1" } - es.weak-set { "electron":"0.36", "ie":"10", "node":"6.1" } - web.dom-collections.for-each { "chrome":"54", "electron":"0.36", "ie":"10" } - web.dom-collections.iterator { "chrome":"54", "electron":"0.36", "ie":"10" } - web.immediate { "chrome":"54", "electron":"0.36" } - web.queue-microtask { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } - web.url { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } - web.url.to-json { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } - web.url-search-params { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } -Successfully compiled 1 file with Babel. \ No newline at end of file diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-versions-strings-minor-3.0/options.json b/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-versions-strings-minor-3.0/options.json deleted file mode 100644 index 41cfee645021..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-versions-strings-minor-3.0/options.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "presets": [ - ["../../lib", { - "useBuiltIns": "entry", - "corejs": "3.0", - "debug": true, - "targets": { - "chrome": "54", - "node": "6.10", - "ie": "10" - } - }] - ] -} diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-versions-strings-minor-3.0/stdout.txt b/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-versions-strings-minor-3.0/stdout.txt deleted file mode 100644 index d51520a95c36..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-versions-strings-minor-3.0/stdout.txt +++ /dev/null @@ -1,231 +0,0 @@ -@babel/preset-env: `DEBUG` option - -Using targets: -{ - "chrome": "54", - "ie": "10", - "node": "6.10" -} - -Using modules transform: auto - -Using plugins: - transform-template-literals { "ie":"10" } - transform-literals { "ie":"10" } - transform-function-name { "ie":"10" } - transform-arrow-functions { "ie":"10" } - transform-block-scoped-functions { "ie":"10" } - transform-classes { "ie":"10" } - transform-object-super { "ie":"10" } - transform-shorthand-properties { "ie":"10" } - transform-duplicate-keys { "ie":"10" } - transform-computed-properties { "ie":"10" } - transform-for-of { "ie":"10" } - transform-sticky-regex { "ie":"10" } - transform-dotall-regex { "chrome":"54", "ie":"10", "node":"6.10" } - transform-unicode-regex { "ie":"10" } - transform-spread { "ie":"10" } - transform-parameters { "ie":"10" } - transform-destructuring { "ie":"10" } - transform-block-scoping { "ie":"10" } - transform-typeof-symbol { "ie":"10" } - transform-new-target { "ie":"10" } - transform-regenerator { "ie":"10" } - transform-exponentiation-operator { "ie":"10", "node":"6.10" } - transform-async-to-generator { "chrome":"54", "ie":"10", "node":"6.10" } - proposal-async-generator-functions { "chrome":"54", "ie":"10", "node":"6.10" } - proposal-object-rest-spread { "chrome":"54", "ie":"10", "node":"6.10" } - proposal-unicode-property-regex { "chrome":"54", "ie":"10", "node":"6.10" } - proposal-json-strings { "chrome":"54", "ie":"10", "node":"6.10" } - proposal-optional-catch-binding { "chrome":"54", "ie":"10", "node":"6.10" } - transform-named-capturing-groups-regex { "chrome":"54", "ie":"10", "node":"6.10" } - -Using polyfills with `entry` option: - -[/src/in.js] Replaced core-js entries with the following polyfills: - es.symbol { "ie":"10" } - es.symbol.description { "chrome":"54", "ie":"10", "node":"6.10" } - es.symbol.async-iterator { "chrome":"54", "ie":"10", "node":"6.10" } - es.symbol.has-instance { "ie":"10" } - es.symbol.is-concat-spreadable { "ie":"10" } - es.symbol.iterator { "ie":"10" } - es.symbol.match { "ie":"10" } - es.symbol.replace { "ie":"10" } - es.symbol.search { "ie":"10" } - es.symbol.species { "ie":"10" } - es.symbol.split { "ie":"10" } - es.symbol.to-primitive { "ie":"10" } - es.symbol.to-string-tag { "ie":"10" } - es.symbol.unscopables { "ie":"10" } - es.array.concat { "ie":"10" } - es.array.copy-within { "ie":"10" } - es.array.fill { "ie":"10" } - es.array.filter { "ie":"10" } - es.array.find { "ie":"10" } - es.array.find-index { "ie":"10" } - es.array.flat { "chrome":"54", "ie":"10", "node":"6.10" } - es.array.flat-map { "chrome":"54", "ie":"10", "node":"6.10" } - es.array.from { "ie":"10" } - es.array.includes { "ie":"10", "node":"6.10" } - es.array.iterator { "chrome":"54", "ie":"10", "node":"6.10" } - es.array.join { "ie":"10" } - es.array.map { "ie":"10" } - es.array.of { "ie":"10" } - es.array.slice { "ie":"10" } - es.array.sort { "chrome":"54", "node":"6.10" } - es.array.species { "ie":"10" } - es.array.splice { "ie":"10" } - es.array.unscopables.flat { "chrome":"54", "ie":"10", "node":"6.10" } - es.array.unscopables.flat-map { "chrome":"54", "ie":"10", "node":"6.10" } - es.array-buffer.constructor { "ie":"10" } - es.array-buffer.is-view { "ie":"10" } - es.array-buffer.slice { "ie":"10" } - es.date.to-primitive { "ie":"10" } - es.function.has-instance { "ie":"10" } - es.function.name { "ie":"10" } - es.json.to-string-tag { "ie":"10" } - es.map { "ie":"10" } - es.math.acosh { "ie":"10", "node":"6.10" } - es.math.asinh { "ie":"10" } - es.math.atanh { "ie":"10" } - es.math.cbrt { "ie":"10" } - es.math.clz32 { "ie":"10" } - es.math.cosh { "ie":"10" } - es.math.expm1 { "ie":"10" } - es.math.fround { "ie":"10" } - es.math.hypot { "ie":"10" } - es.math.imul { "ie":"10" } - es.math.log10 { "ie":"10" } - es.math.log1p { "ie":"10" } - es.math.log2 { "ie":"10" } - es.math.sign { "ie":"10" } - es.math.sinh { "ie":"10" } - es.math.tanh { "ie":"10" } - es.math.to-string-tag { "ie":"10" } - es.math.trunc { "ie":"10" } - es.number.constructor { "ie":"10" } - es.number.epsilon { "ie":"10" } - es.number.is-finite { "ie":"10" } - es.number.is-integer { "ie":"10" } - es.number.is-nan { "ie":"10" } - es.number.is-safe-integer { "ie":"10" } - es.number.max-safe-integer { "ie":"10" } - es.number.min-safe-integer { "ie":"10" } - es.number.parse-float { "ie":"10" } - es.number.parse-int { "ie":"10" } - es.number.to-fixed { "ie":"10" } - es.object.assign { "ie":"10" } - es.object.define-getter { "chrome":"54", "ie":"10", "node":"6.10" } - es.object.define-setter { "chrome":"54", "ie":"10", "node":"6.10" } - es.object.entries { "ie":"10", "node":"6.10" } - es.object.freeze { "ie":"10" } - es.object.from-entries { "chrome":"54", "ie":"10", "node":"6.10" } - es.object.get-own-property-descriptor { "ie":"10" } - es.object.get-own-property-descriptors { "ie":"10", "node":"6.10" } - es.object.get-own-property-names { "ie":"10" } - es.object.get-prototype-of { "ie":"10" } - es.object.is { "ie":"10" } - es.object.is-extensible { "ie":"10" } - es.object.is-frozen { "ie":"10" } - es.object.is-sealed { "ie":"10" } - es.object.keys { "ie":"10" } - es.object.lookup-getter { "chrome":"54", "ie":"10", "node":"6.10" } - es.object.lookup-setter { "chrome":"54", "ie":"10", "node":"6.10" } - es.object.prevent-extensions { "ie":"10" } - es.object.seal { "ie":"10" } - es.object.set-prototype-of { "ie":"10" } - es.object.to-string { "ie":"10" } - es.object.values { "ie":"10", "node":"6.10" } - es.promise { "chrome":"54", "ie":"10", "node":"6.10" } - es.promise.finally { "chrome":"54", "ie":"10", "node":"6.10" } - es.reflect.apply { "ie":"10" } - es.reflect.construct { "ie":"10" } - es.reflect.define-property { "ie":"10" } - es.reflect.delete-property { "ie":"10" } - es.reflect.get { "ie":"10" } - es.reflect.get-own-property-descriptor { "ie":"10" } - es.reflect.get-prototype-of { "ie":"10" } - es.reflect.has { "ie":"10" } - es.reflect.is-extensible { "ie":"10" } - es.reflect.own-keys { "ie":"10" } - es.reflect.prevent-extensions { "ie":"10" } - es.reflect.set { "ie":"10" } - es.reflect.set-prototype-of { "ie":"10" } - es.regexp.constructor { "ie":"10" } - es.regexp.flags { "ie":"10" } - es.regexp.to-string { "ie":"10" } - es.set { "ie":"10" } - es.string.code-point-at { "ie":"10" } - es.string.ends-with { "ie":"10" } - es.string.from-code-point { "ie":"10" } - es.string.includes { "ie":"10" } - es.string.iterator { "ie":"10" } - es.string.match { "ie":"10" } - es.string.pad-end { "chrome":"54", "ie":"10", "node":"6.10" } - es.string.pad-start { "chrome":"54", "ie":"10", "node":"6.10" } - es.string.raw { "ie":"10" } - es.string.repeat { "ie":"10" } - es.string.replace { "chrome":"54", "ie":"10", "node":"6.10" } - es.string.search { "ie":"10" } - es.string.split { "ie":"10", "node":"6.10" } - es.string.starts-with { "ie":"10" } - es.string.trim { "chrome":"54", "ie":"10", "node":"6.10" } - es.string.trim-end { "chrome":"54", "ie":"10", "node":"6.10" } - es.string.trim-start { "chrome":"54", "ie":"10", "node":"6.10" } - es.string.anchor { "ie":"10" } - es.string.big { "ie":"10" } - es.string.blink { "ie":"10" } - es.string.bold { "ie":"10" } - es.string.fixed { "ie":"10" } - es.string.fontcolor { "ie":"10" } - es.string.fontsize { "ie":"10" } - es.string.italics { "ie":"10" } - es.string.link { "ie":"10" } - es.string.small { "ie":"10" } - es.string.strike { "ie":"10" } - es.string.sub { "ie":"10" } - es.string.sup { "ie":"10" } - es.typed-array.float32-array { "ie":"10", "node":"6.10" } - es.typed-array.float64-array { "ie":"10", "node":"6.10" } - es.typed-array.int8-array { "ie":"10", "node":"6.10" } - es.typed-array.int16-array { "ie":"10", "node":"6.10" } - es.typed-array.int32-array { "ie":"10", "node":"6.10" } - es.typed-array.uint8-array { "ie":"10", "node":"6.10" } - es.typed-array.uint8-clamped-array { "ie":"10", "node":"6.10" } - es.typed-array.uint16-array { "ie":"10", "node":"6.10" } - es.typed-array.uint32-array { "ie":"10", "node":"6.10" } - es.typed-array.copy-within { "ie":"10" } - es.typed-array.every { "ie":"10" } - es.typed-array.fill { "ie":"10" } - es.typed-array.filter { "ie":"10" } - es.typed-array.find { "ie":"10" } - es.typed-array.find-index { "ie":"10" } - es.typed-array.for-each { "ie":"10" } - es.typed-array.from { "ie":"10", "node":"6.10" } - es.typed-array.includes { "ie":"10" } - es.typed-array.index-of { "ie":"10" } - es.typed-array.iterator { "ie":"10" } - es.typed-array.join { "ie":"10" } - es.typed-array.last-index-of { "ie":"10" } - es.typed-array.map { "ie":"10" } - es.typed-array.of { "ie":"10", "node":"6.10" } - es.typed-array.reduce { "ie":"10" } - es.typed-array.reduce-right { "ie":"10" } - es.typed-array.reverse { "ie":"10" } - es.typed-array.set { "ie":"10" } - es.typed-array.slice { "ie":"10" } - es.typed-array.some { "ie":"10" } - es.typed-array.sort { "ie":"10" } - es.typed-array.subarray { "ie":"10" } - es.typed-array.to-locale-string { "ie":"10" } - es.typed-array.to-string { "ie":"10" } - es.weak-map { "ie":"10" } - es.weak-set { "ie":"10" } - web.dom-collections.for-each { "chrome":"54", "ie":"10" } - web.dom-collections.iterator { "chrome":"54", "ie":"10" } - web.immediate { "chrome":"54" } - web.queue-microtask { "chrome":"54", "ie":"10", "node":"6.10" } - web.url { "chrome":"54", "ie":"10", "node":"6.10" } - web.url.to-json { "chrome":"54", "ie":"10", "node":"6.10" } - web.url-search-params { "chrome":"54", "ie":"10", "node":"6.10" } -Successfully compiled 1 file with Babel. \ No newline at end of file diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-versions-strings-minor-3.1/options.json b/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-versions-strings-minor-3.1/options.json deleted file mode 100644 index fd88d31055ef..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-versions-strings-minor-3.1/options.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "presets": [ - ["../../lib", { - "useBuiltIns": "entry", - "corejs": "3.1", - "debug": true, - "targets": { - "chrome": "54", - "node": "6.10", - "ie": "10" - } - }] - ] -} diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-versions-strings-minor-3.1/stdout.txt b/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-versions-strings-minor-3.1/stdout.txt deleted file mode 100644 index 9bdec21bb16c..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-versions-strings-minor-3.1/stdout.txt +++ /dev/null @@ -1,233 +0,0 @@ -@babel/preset-env: `DEBUG` option - -Using targets: -{ - "chrome": "54", - "ie": "10", - "node": "6.10" -} - -Using modules transform: auto - -Using plugins: - transform-template-literals { "ie":"10" } - transform-literals { "ie":"10" } - transform-function-name { "ie":"10" } - transform-arrow-functions { "ie":"10" } - transform-block-scoped-functions { "ie":"10" } - transform-classes { "ie":"10" } - transform-object-super { "ie":"10" } - transform-shorthand-properties { "ie":"10" } - transform-duplicate-keys { "ie":"10" } - transform-computed-properties { "ie":"10" } - transform-for-of { "ie":"10" } - transform-sticky-regex { "ie":"10" } - transform-dotall-regex { "chrome":"54", "ie":"10", "node":"6.10" } - transform-unicode-regex { "ie":"10" } - transform-spread { "ie":"10" } - transform-parameters { "ie":"10" } - transform-destructuring { "ie":"10" } - transform-block-scoping { "ie":"10" } - transform-typeof-symbol { "ie":"10" } - transform-new-target { "ie":"10" } - transform-regenerator { "ie":"10" } - transform-exponentiation-operator { "ie":"10", "node":"6.10" } - transform-async-to-generator { "chrome":"54", "ie":"10", "node":"6.10" } - proposal-async-generator-functions { "chrome":"54", "ie":"10", "node":"6.10" } - proposal-object-rest-spread { "chrome":"54", "ie":"10", "node":"6.10" } - proposal-unicode-property-regex { "chrome":"54", "ie":"10", "node":"6.10" } - proposal-json-strings { "chrome":"54", "ie":"10", "node":"6.10" } - proposal-optional-catch-binding { "chrome":"54", "ie":"10", "node":"6.10" } - transform-named-capturing-groups-regex { "chrome":"54", "ie":"10", "node":"6.10" } - -Using polyfills with `entry` option: - -[/src/in.js] Replaced core-js entries with the following polyfills: - es.symbol { "ie":"10" } - es.symbol.description { "chrome":"54", "ie":"10", "node":"6.10" } - es.symbol.async-iterator { "chrome":"54", "ie":"10", "node":"6.10" } - es.symbol.has-instance { "ie":"10" } - es.symbol.is-concat-spreadable { "ie":"10" } - es.symbol.iterator { "ie":"10" } - es.symbol.match { "ie":"10" } - es.symbol.match-all { "chrome":"54", "ie":"10", "node":"6.10" } - es.symbol.replace { "ie":"10" } - es.symbol.search { "ie":"10" } - es.symbol.species { "ie":"10" } - es.symbol.split { "ie":"10" } - es.symbol.to-primitive { "ie":"10" } - es.symbol.to-string-tag { "ie":"10" } - es.symbol.unscopables { "ie":"10" } - es.array.concat { "ie":"10" } - es.array.copy-within { "ie":"10" } - es.array.fill { "ie":"10" } - es.array.filter { "ie":"10" } - es.array.find { "ie":"10" } - es.array.find-index { "ie":"10" } - es.array.flat { "chrome":"54", "ie":"10", "node":"6.10" } - es.array.flat-map { "chrome":"54", "ie":"10", "node":"6.10" } - es.array.from { "ie":"10" } - es.array.includes { "ie":"10", "node":"6.10" } - es.array.iterator { "chrome":"54", "ie":"10", "node":"6.10" } - es.array.join { "ie":"10" } - es.array.map { "ie":"10" } - es.array.of { "ie":"10" } - es.array.slice { "ie":"10" } - es.array.sort { "chrome":"54", "node":"6.10" } - es.array.species { "ie":"10" } - es.array.splice { "ie":"10" } - es.array.unscopables.flat { "chrome":"54", "ie":"10", "node":"6.10" } - es.array.unscopables.flat-map { "chrome":"54", "ie":"10", "node":"6.10" } - es.array-buffer.constructor { "ie":"10" } - es.array-buffer.is-view { "ie":"10" } - es.array-buffer.slice { "ie":"10" } - es.date.to-primitive { "ie":"10" } - es.function.has-instance { "ie":"10" } - es.function.name { "ie":"10" } - es.json.to-string-tag { "ie":"10" } - es.map { "ie":"10" } - es.math.acosh { "ie":"10", "node":"6.10" } - es.math.asinh { "ie":"10" } - es.math.atanh { "ie":"10" } - es.math.cbrt { "ie":"10" } - es.math.clz32 { "ie":"10" } - es.math.cosh { "ie":"10" } - es.math.expm1 { "ie":"10" } - es.math.fround { "ie":"10" } - es.math.hypot { "ie":"10" } - es.math.imul { "ie":"10" } - es.math.log10 { "ie":"10" } - es.math.log1p { "ie":"10" } - es.math.log2 { "ie":"10" } - es.math.sign { "ie":"10" } - es.math.sinh { "ie":"10" } - es.math.tanh { "ie":"10" } - es.math.to-string-tag { "ie":"10" } - es.math.trunc { "ie":"10" } - es.number.constructor { "ie":"10" } - es.number.epsilon { "ie":"10" } - es.number.is-finite { "ie":"10" } - es.number.is-integer { "ie":"10" } - es.number.is-nan { "ie":"10" } - es.number.is-safe-integer { "ie":"10" } - es.number.max-safe-integer { "ie":"10" } - es.number.min-safe-integer { "ie":"10" } - es.number.parse-float { "ie":"10" } - es.number.parse-int { "ie":"10" } - es.number.to-fixed { "ie":"10" } - es.object.assign { "ie":"10" } - es.object.define-getter { "chrome":"54", "ie":"10", "node":"6.10" } - es.object.define-setter { "chrome":"54", "ie":"10", "node":"6.10" } - es.object.entries { "ie":"10", "node":"6.10" } - es.object.freeze { "ie":"10" } - es.object.from-entries { "chrome":"54", "ie":"10", "node":"6.10" } - es.object.get-own-property-descriptor { "ie":"10" } - es.object.get-own-property-descriptors { "ie":"10", "node":"6.10" } - es.object.get-own-property-names { "ie":"10" } - es.object.get-prototype-of { "ie":"10" } - es.object.is { "ie":"10" } - es.object.is-extensible { "ie":"10" } - es.object.is-frozen { "ie":"10" } - es.object.is-sealed { "ie":"10" } - es.object.keys { "ie":"10" } - es.object.lookup-getter { "chrome":"54", "ie":"10", "node":"6.10" } - es.object.lookup-setter { "chrome":"54", "ie":"10", "node":"6.10" } - es.object.prevent-extensions { "ie":"10" } - es.object.seal { "ie":"10" } - es.object.set-prototype-of { "ie":"10" } - es.object.to-string { "ie":"10" } - es.object.values { "ie":"10", "node":"6.10" } - es.promise { "chrome":"54", "ie":"10", "node":"6.10" } - es.promise.finally { "chrome":"54", "ie":"10", "node":"6.10" } - es.reflect.apply { "ie":"10" } - es.reflect.construct { "ie":"10" } - es.reflect.define-property { "ie":"10" } - es.reflect.delete-property { "ie":"10" } - es.reflect.get { "ie":"10" } - es.reflect.get-own-property-descriptor { "ie":"10" } - es.reflect.get-prototype-of { "ie":"10" } - es.reflect.has { "ie":"10" } - es.reflect.is-extensible { "ie":"10" } - es.reflect.own-keys { "ie":"10" } - es.reflect.prevent-extensions { "ie":"10" } - es.reflect.set { "ie":"10" } - es.reflect.set-prototype-of { "ie":"10" } - es.regexp.constructor { "ie":"10" } - es.regexp.flags { "ie":"10" } - es.regexp.to-string { "ie":"10" } - es.set { "ie":"10" } - es.string.code-point-at { "ie":"10" } - es.string.ends-with { "ie":"10" } - es.string.from-code-point { "ie":"10" } - es.string.includes { "ie":"10" } - es.string.iterator { "ie":"10" } - es.string.match { "ie":"10" } - es.string.match-all { "chrome":"54", "ie":"10", "node":"6.10" } - es.string.pad-end { "chrome":"54", "ie":"10", "node":"6.10" } - es.string.pad-start { "chrome":"54", "ie":"10", "node":"6.10" } - es.string.raw { "ie":"10" } - es.string.repeat { "ie":"10" } - es.string.replace { "chrome":"54", "ie":"10", "node":"6.10" } - es.string.search { "ie":"10" } - es.string.split { "ie":"10", "node":"6.10" } - es.string.starts-with { "ie":"10" } - es.string.trim { "chrome":"54", "ie":"10", "node":"6.10" } - es.string.trim-end { "chrome":"54", "ie":"10", "node":"6.10" } - es.string.trim-start { "chrome":"54", "ie":"10", "node":"6.10" } - es.string.anchor { "ie":"10" } - es.string.big { "ie":"10" } - es.string.blink { "ie":"10" } - es.string.bold { "ie":"10" } - es.string.fixed { "ie":"10" } - es.string.fontcolor { "ie":"10" } - es.string.fontsize { "ie":"10" } - es.string.italics { "ie":"10" } - es.string.link { "ie":"10" } - es.string.small { "ie":"10" } - es.string.strike { "ie":"10" } - es.string.sub { "ie":"10" } - es.string.sup { "ie":"10" } - es.typed-array.float32-array { "ie":"10", "node":"6.10" } - es.typed-array.float64-array { "ie":"10", "node":"6.10" } - es.typed-array.int8-array { "ie":"10", "node":"6.10" } - es.typed-array.int16-array { "ie":"10", "node":"6.10" } - es.typed-array.int32-array { "ie":"10", "node":"6.10" } - es.typed-array.uint8-array { "ie":"10", "node":"6.10" } - es.typed-array.uint8-clamped-array { "ie":"10", "node":"6.10" } - es.typed-array.uint16-array { "ie":"10", "node":"6.10" } - es.typed-array.uint32-array { "ie":"10", "node":"6.10" } - es.typed-array.copy-within { "ie":"10" } - es.typed-array.every { "ie":"10" } - es.typed-array.fill { "ie":"10" } - es.typed-array.filter { "ie":"10" } - es.typed-array.find { "ie":"10" } - es.typed-array.find-index { "ie":"10" } - es.typed-array.for-each { "ie":"10" } - es.typed-array.from { "ie":"10", "node":"6.10" } - es.typed-array.includes { "ie":"10" } - es.typed-array.index-of { "ie":"10" } - es.typed-array.iterator { "ie":"10" } - es.typed-array.join { "ie":"10" } - es.typed-array.last-index-of { "ie":"10" } - es.typed-array.map { "ie":"10" } - es.typed-array.of { "ie":"10", "node":"6.10" } - es.typed-array.reduce { "ie":"10" } - es.typed-array.reduce-right { "ie":"10" } - es.typed-array.reverse { "ie":"10" } - es.typed-array.set { "ie":"10" } - es.typed-array.slice { "ie":"10" } - es.typed-array.some { "ie":"10" } - es.typed-array.sort { "ie":"10" } - es.typed-array.subarray { "ie":"10" } - es.typed-array.to-locale-string { "ie":"10" } - es.typed-array.to-string { "ie":"10" } - es.weak-map { "ie":"10" } - es.weak-set { "ie":"10" } - web.dom-collections.for-each { "chrome":"54", "ie":"10" } - web.dom-collections.iterator { "chrome":"54", "ie":"10" } - web.immediate { "chrome":"54" } - web.queue-microtask { "chrome":"54", "ie":"10", "node":"6.10" } - web.url { "chrome":"54", "ie":"10", "node":"6.10" } - web.url.to-json { "chrome":"54", "ie":"10", "node":"6.10" } - web.url-search-params { "chrome":"54", "ie":"10", "node":"6.10" } -Successfully compiled 1 file with Babel. \ No newline at end of file diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-versions-strings/options.json b/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-versions-strings/options.json deleted file mode 100644 index 7cda7fb38c22..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-versions-strings/options.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "presets": [ - ["../../lib", { - "useBuiltIns": "entry", - "corejs": 3, - "debug": true, - "targets": { - "chrome": "54", - "node": "6.10", - "ie": "10" - } - }] - ] -} diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-versions-strings/stdout.txt b/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-versions-strings/stdout.txt deleted file mode 100644 index d51520a95c36..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-versions-strings/stdout.txt +++ /dev/null @@ -1,231 +0,0 @@ -@babel/preset-env: `DEBUG` option - -Using targets: -{ - "chrome": "54", - "ie": "10", - "node": "6.10" -} - -Using modules transform: auto - -Using plugins: - transform-template-literals { "ie":"10" } - transform-literals { "ie":"10" } - transform-function-name { "ie":"10" } - transform-arrow-functions { "ie":"10" } - transform-block-scoped-functions { "ie":"10" } - transform-classes { "ie":"10" } - transform-object-super { "ie":"10" } - transform-shorthand-properties { "ie":"10" } - transform-duplicate-keys { "ie":"10" } - transform-computed-properties { "ie":"10" } - transform-for-of { "ie":"10" } - transform-sticky-regex { "ie":"10" } - transform-dotall-regex { "chrome":"54", "ie":"10", "node":"6.10" } - transform-unicode-regex { "ie":"10" } - transform-spread { "ie":"10" } - transform-parameters { "ie":"10" } - transform-destructuring { "ie":"10" } - transform-block-scoping { "ie":"10" } - transform-typeof-symbol { "ie":"10" } - transform-new-target { "ie":"10" } - transform-regenerator { "ie":"10" } - transform-exponentiation-operator { "ie":"10", "node":"6.10" } - transform-async-to-generator { "chrome":"54", "ie":"10", "node":"6.10" } - proposal-async-generator-functions { "chrome":"54", "ie":"10", "node":"6.10" } - proposal-object-rest-spread { "chrome":"54", "ie":"10", "node":"6.10" } - proposal-unicode-property-regex { "chrome":"54", "ie":"10", "node":"6.10" } - proposal-json-strings { "chrome":"54", "ie":"10", "node":"6.10" } - proposal-optional-catch-binding { "chrome":"54", "ie":"10", "node":"6.10" } - transform-named-capturing-groups-regex { "chrome":"54", "ie":"10", "node":"6.10" } - -Using polyfills with `entry` option: - -[/src/in.js] Replaced core-js entries with the following polyfills: - es.symbol { "ie":"10" } - es.symbol.description { "chrome":"54", "ie":"10", "node":"6.10" } - es.symbol.async-iterator { "chrome":"54", "ie":"10", "node":"6.10" } - es.symbol.has-instance { "ie":"10" } - es.symbol.is-concat-spreadable { "ie":"10" } - es.symbol.iterator { "ie":"10" } - es.symbol.match { "ie":"10" } - es.symbol.replace { "ie":"10" } - es.symbol.search { "ie":"10" } - es.symbol.species { "ie":"10" } - es.symbol.split { "ie":"10" } - es.symbol.to-primitive { "ie":"10" } - es.symbol.to-string-tag { "ie":"10" } - es.symbol.unscopables { "ie":"10" } - es.array.concat { "ie":"10" } - es.array.copy-within { "ie":"10" } - es.array.fill { "ie":"10" } - es.array.filter { "ie":"10" } - es.array.find { "ie":"10" } - es.array.find-index { "ie":"10" } - es.array.flat { "chrome":"54", "ie":"10", "node":"6.10" } - es.array.flat-map { "chrome":"54", "ie":"10", "node":"6.10" } - es.array.from { "ie":"10" } - es.array.includes { "ie":"10", "node":"6.10" } - es.array.iterator { "chrome":"54", "ie":"10", "node":"6.10" } - es.array.join { "ie":"10" } - es.array.map { "ie":"10" } - es.array.of { "ie":"10" } - es.array.slice { "ie":"10" } - es.array.sort { "chrome":"54", "node":"6.10" } - es.array.species { "ie":"10" } - es.array.splice { "ie":"10" } - es.array.unscopables.flat { "chrome":"54", "ie":"10", "node":"6.10" } - es.array.unscopables.flat-map { "chrome":"54", "ie":"10", "node":"6.10" } - es.array-buffer.constructor { "ie":"10" } - es.array-buffer.is-view { "ie":"10" } - es.array-buffer.slice { "ie":"10" } - es.date.to-primitive { "ie":"10" } - es.function.has-instance { "ie":"10" } - es.function.name { "ie":"10" } - es.json.to-string-tag { "ie":"10" } - es.map { "ie":"10" } - es.math.acosh { "ie":"10", "node":"6.10" } - es.math.asinh { "ie":"10" } - es.math.atanh { "ie":"10" } - es.math.cbrt { "ie":"10" } - es.math.clz32 { "ie":"10" } - es.math.cosh { "ie":"10" } - es.math.expm1 { "ie":"10" } - es.math.fround { "ie":"10" } - es.math.hypot { "ie":"10" } - es.math.imul { "ie":"10" } - es.math.log10 { "ie":"10" } - es.math.log1p { "ie":"10" } - es.math.log2 { "ie":"10" } - es.math.sign { "ie":"10" } - es.math.sinh { "ie":"10" } - es.math.tanh { "ie":"10" } - es.math.to-string-tag { "ie":"10" } - es.math.trunc { "ie":"10" } - es.number.constructor { "ie":"10" } - es.number.epsilon { "ie":"10" } - es.number.is-finite { "ie":"10" } - es.number.is-integer { "ie":"10" } - es.number.is-nan { "ie":"10" } - es.number.is-safe-integer { "ie":"10" } - es.number.max-safe-integer { "ie":"10" } - es.number.min-safe-integer { "ie":"10" } - es.number.parse-float { "ie":"10" } - es.number.parse-int { "ie":"10" } - es.number.to-fixed { "ie":"10" } - es.object.assign { "ie":"10" } - es.object.define-getter { "chrome":"54", "ie":"10", "node":"6.10" } - es.object.define-setter { "chrome":"54", "ie":"10", "node":"6.10" } - es.object.entries { "ie":"10", "node":"6.10" } - es.object.freeze { "ie":"10" } - es.object.from-entries { "chrome":"54", "ie":"10", "node":"6.10" } - es.object.get-own-property-descriptor { "ie":"10" } - es.object.get-own-property-descriptors { "ie":"10", "node":"6.10" } - es.object.get-own-property-names { "ie":"10" } - es.object.get-prototype-of { "ie":"10" } - es.object.is { "ie":"10" } - es.object.is-extensible { "ie":"10" } - es.object.is-frozen { "ie":"10" } - es.object.is-sealed { "ie":"10" } - es.object.keys { "ie":"10" } - es.object.lookup-getter { "chrome":"54", "ie":"10", "node":"6.10" } - es.object.lookup-setter { "chrome":"54", "ie":"10", "node":"6.10" } - es.object.prevent-extensions { "ie":"10" } - es.object.seal { "ie":"10" } - es.object.set-prototype-of { "ie":"10" } - es.object.to-string { "ie":"10" } - es.object.values { "ie":"10", "node":"6.10" } - es.promise { "chrome":"54", "ie":"10", "node":"6.10" } - es.promise.finally { "chrome":"54", "ie":"10", "node":"6.10" } - es.reflect.apply { "ie":"10" } - es.reflect.construct { "ie":"10" } - es.reflect.define-property { "ie":"10" } - es.reflect.delete-property { "ie":"10" } - es.reflect.get { "ie":"10" } - es.reflect.get-own-property-descriptor { "ie":"10" } - es.reflect.get-prototype-of { "ie":"10" } - es.reflect.has { "ie":"10" } - es.reflect.is-extensible { "ie":"10" } - es.reflect.own-keys { "ie":"10" } - es.reflect.prevent-extensions { "ie":"10" } - es.reflect.set { "ie":"10" } - es.reflect.set-prototype-of { "ie":"10" } - es.regexp.constructor { "ie":"10" } - es.regexp.flags { "ie":"10" } - es.regexp.to-string { "ie":"10" } - es.set { "ie":"10" } - es.string.code-point-at { "ie":"10" } - es.string.ends-with { "ie":"10" } - es.string.from-code-point { "ie":"10" } - es.string.includes { "ie":"10" } - es.string.iterator { "ie":"10" } - es.string.match { "ie":"10" } - es.string.pad-end { "chrome":"54", "ie":"10", "node":"6.10" } - es.string.pad-start { "chrome":"54", "ie":"10", "node":"6.10" } - es.string.raw { "ie":"10" } - es.string.repeat { "ie":"10" } - es.string.replace { "chrome":"54", "ie":"10", "node":"6.10" } - es.string.search { "ie":"10" } - es.string.split { "ie":"10", "node":"6.10" } - es.string.starts-with { "ie":"10" } - es.string.trim { "chrome":"54", "ie":"10", "node":"6.10" } - es.string.trim-end { "chrome":"54", "ie":"10", "node":"6.10" } - es.string.trim-start { "chrome":"54", "ie":"10", "node":"6.10" } - es.string.anchor { "ie":"10" } - es.string.big { "ie":"10" } - es.string.blink { "ie":"10" } - es.string.bold { "ie":"10" } - es.string.fixed { "ie":"10" } - es.string.fontcolor { "ie":"10" } - es.string.fontsize { "ie":"10" } - es.string.italics { "ie":"10" } - es.string.link { "ie":"10" } - es.string.small { "ie":"10" } - es.string.strike { "ie":"10" } - es.string.sub { "ie":"10" } - es.string.sup { "ie":"10" } - es.typed-array.float32-array { "ie":"10", "node":"6.10" } - es.typed-array.float64-array { "ie":"10", "node":"6.10" } - es.typed-array.int8-array { "ie":"10", "node":"6.10" } - es.typed-array.int16-array { "ie":"10", "node":"6.10" } - es.typed-array.int32-array { "ie":"10", "node":"6.10" } - es.typed-array.uint8-array { "ie":"10", "node":"6.10" } - es.typed-array.uint8-clamped-array { "ie":"10", "node":"6.10" } - es.typed-array.uint16-array { "ie":"10", "node":"6.10" } - es.typed-array.uint32-array { "ie":"10", "node":"6.10" } - es.typed-array.copy-within { "ie":"10" } - es.typed-array.every { "ie":"10" } - es.typed-array.fill { "ie":"10" } - es.typed-array.filter { "ie":"10" } - es.typed-array.find { "ie":"10" } - es.typed-array.find-index { "ie":"10" } - es.typed-array.for-each { "ie":"10" } - es.typed-array.from { "ie":"10", "node":"6.10" } - es.typed-array.includes { "ie":"10" } - es.typed-array.index-of { "ie":"10" } - es.typed-array.iterator { "ie":"10" } - es.typed-array.join { "ie":"10" } - es.typed-array.last-index-of { "ie":"10" } - es.typed-array.map { "ie":"10" } - es.typed-array.of { "ie":"10", "node":"6.10" } - es.typed-array.reduce { "ie":"10" } - es.typed-array.reduce-right { "ie":"10" } - es.typed-array.reverse { "ie":"10" } - es.typed-array.set { "ie":"10" } - es.typed-array.slice { "ie":"10" } - es.typed-array.some { "ie":"10" } - es.typed-array.sort { "ie":"10" } - es.typed-array.subarray { "ie":"10" } - es.typed-array.to-locale-string { "ie":"10" } - es.typed-array.to-string { "ie":"10" } - es.weak-map { "ie":"10" } - es.weak-set { "ie":"10" } - web.dom-collections.for-each { "chrome":"54", "ie":"10" } - web.dom-collections.iterator { "chrome":"54", "ie":"10" } - web.immediate { "chrome":"54" } - web.queue-microtask { "chrome":"54", "ie":"10", "node":"6.10" } - web.url { "chrome":"54", "ie":"10", "node":"6.10" } - web.url.to-json { "chrome":"54", "ie":"10", "node":"6.10" } - web.url-search-params { "chrome":"54", "ie":"10", "node":"6.10" } -Successfully compiled 1 file with Babel. \ No newline at end of file diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-web-chrome-71/options.json b/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-web-chrome-71/options.json deleted file mode 100644 index b9db1e21e401..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-web-chrome-71/options.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "presets": [ - ["../../lib", { - "debug": true, - "targets": { - "browsers": "chrome 71" - }, - "shippedProposals": true, - "useBuiltIns": "entry", - "corejs": 3 - }] - ] -} diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-web-chrome-71/stdout.txt b/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-web-chrome-71/stdout.txt deleted file mode 100644 index 47e1b712c226..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-web-chrome-71/stdout.txt +++ /dev/null @@ -1,22 +0,0 @@ -@babel/preset-env: `DEBUG` option - -Using targets: -{ - "chrome": "71" -} - -Using modules transform: auto - -Using plugins: - syntax-async-generators { "chrome":"71" } - syntax-object-rest-spread { "chrome":"71" } - syntax-json-strings { "chrome":"71" } - syntax-optional-catch-binding { "chrome":"71" } - -Using polyfills with `entry` option: - -[/src/in.js] Replaced core-js entries with the following polyfill: - web.immediate { "chrome":"71" } - -[/src/in.js] Based on your targets, regenerator-runtime import excluded. -Successfully compiled 1 file with Babel. \ No newline at end of file diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-web/options.json b/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-web/options.json deleted file mode 100644 index 1e5ef9ed0a56..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-web/options.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "presets": [ - ["../../lib", { - "debug": true, - "shippedProposals": true, - "useBuiltIns": "entry", - "corejs": 3 - }] - ] -} diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-web/stdout.txt b/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-web/stdout.txt deleted file mode 100644 index 10497d8551ab..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-web/stdout.txt +++ /dev/null @@ -1,53 +0,0 @@ -@babel/preset-env: `DEBUG` option - -Using targets: -{} - -Using modules transform: auto - -Using plugins: - transform-template-literals {} - transform-literals {} - transform-function-name {} - transform-arrow-functions {} - transform-block-scoped-functions {} - transform-classes {} - transform-object-super {} - transform-shorthand-properties {} - transform-duplicate-keys {} - transform-computed-properties {} - transform-for-of {} - transform-sticky-regex {} - transform-dotall-regex {} - transform-unicode-regex {} - transform-spread {} - transform-parameters {} - transform-destructuring {} - transform-block-scoping {} - transform-typeof-symbol {} - transform-new-target {} - transform-regenerator {} - transform-exponentiation-operator {} - transform-async-to-generator {} - proposal-async-generator-functions {} - proposal-object-rest-spread {} - proposal-unicode-property-regex {} - proposal-json-strings {} - proposal-optional-catch-binding {} - transform-named-capturing-groups-regex {} - transform-member-expression-literals {} - transform-property-literals {} - transform-reserved-words {} - -Using polyfills with `entry` option: - -[/src/in.js] Replaced core-js entries with the following polyfills: - web.dom-collections.for-each {} - web.dom-collections.iterator {} - web.immediate {} - web.queue-microtask {} - web.timers {} - web.url {} - web.url.to-json {} - web.url-search-params {} -Successfully compiled 1 file with Babel. \ No newline at end of file diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3/options.json b/packages/babel-preset-env/test/debug-fixtures/entry-corejs3/options.json deleted file mode 100644 index d4af133772ff..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3/options.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "presets": [ - ["../../lib", { - "debug": true, - "targets": { - "browsers": "chrome >= 54, ie 10", - "node": 6 - }, - "useBuiltIns": "entry", - "corejs": 3 - }] - ] -} diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3/stdout.txt b/packages/babel-preset-env/test/debug-fixtures/entry-corejs3/stdout.txt deleted file mode 100644 index be4132d6b1f0..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3/stdout.txt +++ /dev/null @@ -1,233 +0,0 @@ -@babel/preset-env: `DEBUG` option - -Using targets: -{ - "chrome": "54", - "ie": "10", - "node": "6" -} - -Using modules transform: auto - -Using plugins: - transform-template-literals { "ie":"10" } - transform-literals { "ie":"10" } - transform-function-name { "ie":"10", "node":"6" } - transform-arrow-functions { "ie":"10" } - transform-block-scoped-functions { "ie":"10" } - transform-classes { "ie":"10" } - transform-object-super { "ie":"10" } - transform-shorthand-properties { "ie":"10" } - transform-duplicate-keys { "ie":"10" } - transform-computed-properties { "ie":"10" } - transform-for-of { "ie":"10", "node":"6" } - transform-sticky-regex { "ie":"10" } - transform-dotall-regex { "chrome":"54", "ie":"10", "node":"6" } - transform-unicode-regex { "ie":"10" } - transform-spread { "ie":"10" } - transform-parameters { "ie":"10" } - transform-destructuring { "ie":"10", "node":"6" } - transform-block-scoping { "ie":"10" } - transform-typeof-symbol { "ie":"10" } - transform-new-target { "ie":"10" } - transform-regenerator { "ie":"10" } - transform-exponentiation-operator { "ie":"10", "node":"6" } - transform-async-to-generator { "chrome":"54", "ie":"10", "node":"6" } - proposal-async-generator-functions { "chrome":"54", "ie":"10", "node":"6" } - proposal-object-rest-spread { "chrome":"54", "ie":"10", "node":"6" } - proposal-unicode-property-regex { "chrome":"54", "ie":"10", "node":"6" } - proposal-json-strings { "chrome":"54", "ie":"10", "node":"6" } - proposal-optional-catch-binding { "chrome":"54", "ie":"10", "node":"6" } - transform-named-capturing-groups-regex { "chrome":"54", "ie":"10", "node":"6" } - -Using polyfills with `entry` option: - -[/src/in.js] Replaced core-js entries with the following polyfills: - es.symbol { "ie":"10" } - es.symbol.description { "chrome":"54", "ie":"10", "node":"6" } - es.symbol.async-iterator { "chrome":"54", "ie":"10", "node":"6" } - es.symbol.has-instance { "ie":"10" } - es.symbol.is-concat-spreadable { "ie":"10" } - es.symbol.iterator { "ie":"10" } - es.symbol.match { "ie":"10" } - es.symbol.replace { "ie":"10" } - es.symbol.search { "ie":"10" } - es.symbol.species { "ie":"10", "node":"6" } - es.symbol.split { "ie":"10" } - es.symbol.to-primitive { "ie":"10" } - es.symbol.to-string-tag { "ie":"10" } - es.symbol.unscopables { "ie":"10" } - es.array.concat { "ie":"10", "node":"6" } - es.array.copy-within { "ie":"10" } - es.array.fill { "ie":"10" } - es.array.filter { "ie":"10", "node":"6" } - es.array.find { "ie":"10" } - es.array.find-index { "ie":"10" } - es.array.flat { "chrome":"54", "ie":"10", "node":"6" } - es.array.flat-map { "chrome":"54", "ie":"10", "node":"6" } - es.array.from { "ie":"10", "node":"6" } - es.array.includes { "ie":"10", "node":"6" } - es.array.index-of { "node":"6" } - es.array.iterator { "chrome":"54", "ie":"10", "node":"6" } - es.array.join { "ie":"10" } - es.array.last-index-of { "node":"6" } - es.array.map { "ie":"10", "node":"6" } - es.array.of { "ie":"10" } - es.array.slice { "ie":"10", "node":"6" } - es.array.sort { "chrome":"54", "node":"6" } - es.array.species { "ie":"10", "node":"6" } - es.array.splice { "ie":"10", "node":"6" } - es.array.unscopables.flat { "chrome":"54", "ie":"10", "node":"6" } - es.array.unscopables.flat-map { "chrome":"54", "ie":"10", "node":"6" } - es.array-buffer.constructor { "ie":"10" } - es.array-buffer.is-view { "ie":"10" } - es.array-buffer.slice { "ie":"10" } - es.date.to-primitive { "ie":"10" } - es.function.has-instance { "ie":"10", "node":"6" } - es.function.name { "ie":"10" } - es.json.to-string-tag { "ie":"10" } - es.map { "ie":"10", "node":"6" } - es.math.acosh { "ie":"10", "node":"6" } - es.math.asinh { "ie":"10" } - es.math.atanh { "ie":"10" } - es.math.cbrt { "ie":"10" } - es.math.clz32 { "ie":"10" } - es.math.cosh { "ie":"10" } - es.math.expm1 { "ie":"10" } - es.math.fround { "ie":"10" } - es.math.hypot { "ie":"10" } - es.math.imul { "ie":"10" } - es.math.log10 { "ie":"10" } - es.math.log1p { "ie":"10" } - es.math.log2 { "ie":"10" } - es.math.sign { "ie":"10" } - es.math.sinh { "ie":"10" } - es.math.tanh { "ie":"10" } - es.math.to-string-tag { "ie":"10" } - es.math.trunc { "ie":"10" } - es.number.constructor { "ie":"10" } - es.number.epsilon { "ie":"10" } - es.number.is-finite { "ie":"10" } - es.number.is-integer { "ie":"10" } - es.number.is-nan { "ie":"10" } - es.number.is-safe-integer { "ie":"10" } - es.number.max-safe-integer { "ie":"10" } - es.number.min-safe-integer { "ie":"10" } - es.number.parse-float { "ie":"10" } - es.number.parse-int { "ie":"10" } - es.number.to-fixed { "ie":"10" } - es.object.assign { "ie":"10" } - es.object.define-getter { "chrome":"54", "ie":"10", "node":"6" } - es.object.define-setter { "chrome":"54", "ie":"10", "node":"6" } - es.object.entries { "ie":"10", "node":"6" } - es.object.freeze { "ie":"10" } - es.object.from-entries { "chrome":"54", "ie":"10", "node":"6" } - es.object.get-own-property-descriptor { "ie":"10" } - es.object.get-own-property-descriptors { "ie":"10", "node":"6" } - es.object.get-own-property-names { "ie":"10" } - es.object.get-prototype-of { "ie":"10" } - es.object.is { "ie":"10" } - es.object.is-extensible { "ie":"10" } - es.object.is-frozen { "ie":"10" } - es.object.is-sealed { "ie":"10" } - es.object.keys { "ie":"10" } - es.object.lookup-getter { "chrome":"54", "ie":"10", "node":"6" } - es.object.lookup-setter { "chrome":"54", "ie":"10", "node":"6" } - es.object.prevent-extensions { "ie":"10" } - es.object.seal { "ie":"10" } - es.object.set-prototype-of { "ie":"10" } - es.object.to-string { "ie":"10" } - es.object.values { "ie":"10", "node":"6" } - es.promise { "chrome":"54", "ie":"10", "node":"6" } - es.promise.finally { "chrome":"54", "ie":"10", "node":"6" } - es.reflect.apply { "ie":"10" } - es.reflect.construct { "ie":"10" } - es.reflect.define-property { "ie":"10" } - es.reflect.delete-property { "ie":"10" } - es.reflect.get { "ie":"10" } - es.reflect.get-own-property-descriptor { "ie":"10" } - es.reflect.get-prototype-of { "ie":"10" } - es.reflect.has { "ie":"10" } - es.reflect.is-extensible { "ie":"10" } - es.reflect.own-keys { "ie":"10" } - es.reflect.prevent-extensions { "ie":"10" } - es.reflect.set { "ie":"10" } - es.reflect.set-prototype-of { "ie":"10" } - es.regexp.constructor { "ie":"10", "node":"6" } - es.regexp.flags { "ie":"10" } - es.regexp.to-string { "ie":"10" } - es.set { "ie":"10", "node":"6" } - es.string.code-point-at { "ie":"10" } - es.string.ends-with { "ie":"10", "node":"6" } - es.string.from-code-point { "ie":"10" } - es.string.includes { "ie":"10", "node":"6" } - es.string.iterator { "ie":"10" } - es.string.match { "ie":"10", "node":"6" } - es.string.pad-end { "chrome":"54", "ie":"10", "node":"6" } - es.string.pad-start { "chrome":"54", "ie":"10", "node":"6" } - es.string.raw { "ie":"10" } - es.string.repeat { "ie":"10" } - es.string.replace { "chrome":"54", "ie":"10", "node":"6" } - es.string.search { "ie":"10", "node":"6" } - es.string.split { "ie":"10", "node":"6" } - es.string.starts-with { "ie":"10", "node":"6" } - es.string.trim { "chrome":"54", "ie":"10", "node":"6" } - es.string.trim-end { "chrome":"54", "ie":"10", "node":"6" } - es.string.trim-start { "chrome":"54", "ie":"10", "node":"6" } - es.string.anchor { "ie":"10" } - es.string.big { "ie":"10" } - es.string.blink { "ie":"10" } - es.string.bold { "ie":"10" } - es.string.fixed { "ie":"10" } - es.string.fontcolor { "ie":"10" } - es.string.fontsize { "ie":"10" } - es.string.italics { "ie":"10" } - es.string.link { "ie":"10" } - es.string.small { "ie":"10" } - es.string.strike { "ie":"10" } - es.string.sub { "ie":"10" } - es.string.sup { "ie":"10" } - es.typed-array.float32-array { "ie":"10", "node":"6" } - es.typed-array.float64-array { "ie":"10", "node":"6" } - es.typed-array.int8-array { "ie":"10", "node":"6" } - es.typed-array.int16-array { "ie":"10", "node":"6" } - es.typed-array.int32-array { "ie":"10", "node":"6" } - es.typed-array.uint8-array { "ie":"10", "node":"6" } - es.typed-array.uint8-clamped-array { "ie":"10", "node":"6" } - es.typed-array.uint16-array { "ie":"10", "node":"6" } - es.typed-array.uint32-array { "ie":"10", "node":"6" } - es.typed-array.copy-within { "ie":"10" } - es.typed-array.every { "ie":"10" } - es.typed-array.fill { "ie":"10" } - es.typed-array.filter { "ie":"10" } - es.typed-array.find { "ie":"10" } - es.typed-array.find-index { "ie":"10" } - es.typed-array.for-each { "ie":"10" } - es.typed-array.from { "ie":"10", "node":"6" } - es.typed-array.includes { "ie":"10" } - es.typed-array.index-of { "ie":"10" } - es.typed-array.iterator { "ie":"10" } - es.typed-array.join { "ie":"10" } - es.typed-array.last-index-of { "ie":"10" } - es.typed-array.map { "ie":"10" } - es.typed-array.of { "ie":"10", "node":"6" } - es.typed-array.reduce { "ie":"10" } - es.typed-array.reduce-right { "ie":"10" } - es.typed-array.reverse { "ie":"10" } - es.typed-array.set { "ie":"10" } - es.typed-array.slice { "ie":"10" } - es.typed-array.some { "ie":"10" } - es.typed-array.sort { "ie":"10" } - es.typed-array.subarray { "ie":"10" } - es.typed-array.to-locale-string { "ie":"10" } - es.typed-array.to-string { "ie":"10", "node":"6" } - es.weak-map { "ie":"10", "node":"6" } - es.weak-set { "ie":"10", "node":"6" } - web.dom-collections.for-each { "chrome":"54", "ie":"10" } - web.dom-collections.iterator { "chrome":"54", "ie":"10" } - web.immediate { "chrome":"54" } - web.queue-microtask { "chrome":"54", "ie":"10", "node":"6" } - web.url { "chrome":"54", "ie":"10", "node":"6" } - web.url.to-json { "chrome":"54", "ie":"10", "node":"6" } - web.url-search-params { "chrome":"54", "ie":"10", "node":"6" } -Successfully compiled 1 file with Babel. \ No newline at end of file diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-no-corejs-no-import/options.json b/packages/babel-preset-env/test/debug-fixtures/entry-no-corejs-no-import/options.json deleted file mode 100644 index c852ad03f690..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/entry-no-corejs-no-import/options.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "presets": [ - ["../../lib", { - "debug": true, - "targets": { - "node": 6 - }, - "useBuiltIns": "entry" - }] - ] -} diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-no-corejs-no-import/stdout.txt b/packages/babel-preset-env/test/debug-fixtures/entry-no-corejs-no-import/stdout.txt deleted file mode 100644 index ac37a584bfdf..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/entry-no-corejs-no-import/stdout.txt +++ /dev/null @@ -1,27 +0,0 @@ -@babel/preset-env: `DEBUG` option - -Using targets: -{ - "node": "6" -} - -Using modules transform: auto - -Using plugins: - transform-function-name { "node":"6" } - transform-for-of { "node":"6" } - transform-dotall-regex { "node":"6" } - transform-destructuring { "node":"6" } - transform-exponentiation-operator { "node":"6" } - transform-async-to-generator { "node":"6" } - proposal-async-generator-functions { "node":"6" } - proposal-object-rest-spread { "node":"6" } - proposal-unicode-property-regex { "node":"6" } - proposal-json-strings { "node":"6" } - proposal-optional-catch-binding { "node":"6" } - transform-named-capturing-groups-regex { "node":"6" } - -Using polyfills with `entry` option: - -[/src/in.js] Import of @babel/polyfill was not found. -Successfully compiled 1 file with Babel. \ No newline at end of file diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-no-corejs-shippedProposals/options.json b/packages/babel-preset-env/test/debug-fixtures/entry-no-corejs-shippedProposals/options.json deleted file mode 100644 index 40884decf8fd..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/entry-no-corejs-shippedProposals/options.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "presets": [ - ["../../lib", { - "debug": true, - "shippedProposals": true, - "useBuiltIns": "entry" - }] - ] -} diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-no-corejs-shippedProposals/stdout.txt b/packages/babel-preset-env/test/debug-fixtures/entry-no-corejs-shippedProposals/stdout.txt deleted file mode 100644 index 04e8ce0e5829..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/entry-no-corejs-shippedProposals/stdout.txt +++ /dev/null @@ -1,193 +0,0 @@ -@babel/preset-env: `DEBUG` option - -Using targets: -{} - -Using modules transform: auto - -Using plugins: - transform-template-literals {} - transform-literals {} - transform-function-name {} - transform-arrow-functions {} - transform-block-scoped-functions {} - transform-classes {} - transform-object-super {} - transform-shorthand-properties {} - transform-duplicate-keys {} - transform-computed-properties {} - transform-for-of {} - transform-sticky-regex {} - transform-dotall-regex {} - transform-unicode-regex {} - transform-spread {} - transform-parameters {} - transform-destructuring {} - transform-block-scoping {} - transform-typeof-symbol {} - transform-new-target {} - transform-regenerator {} - transform-exponentiation-operator {} - transform-async-to-generator {} - proposal-async-generator-functions {} - proposal-object-rest-spread {} - proposal-unicode-property-regex {} - proposal-json-strings {} - proposal-optional-catch-binding {} - transform-named-capturing-groups-regex {} - transform-member-expression-literals {} - transform-property-literals {} - transform-reserved-words {} - -Using polyfills with `entry` option: - -[/src/in.js] Replaced @babel/polyfill entries with the following polyfills: - es6.array.copy-within {} - es6.array.every {} - es6.array.fill {} - es6.array.filter {} - es6.array.find {} - es6.array.find-index {} - es7.array.flat-map {} - es6.array.for-each {} - es6.array.from {} - es7.array.includes {} - es6.array.index-of {} - es6.array.is-array {} - es6.array.iterator {} - es6.array.last-index-of {} - es6.array.map {} - es6.array.of {} - es6.array.reduce {} - es6.array.reduce-right {} - es6.array.some {} - es6.array.sort {} - es6.array.species {} - es6.date.now {} - es6.date.to-iso-string {} - es6.date.to-json {} - es6.date.to-primitive {} - es6.date.to-string {} - es6.function.bind {} - es6.function.has-instance {} - es6.function.name {} - es6.map {} - es6.math.acosh {} - es6.math.asinh {} - es6.math.atanh {} - es6.math.cbrt {} - es6.math.clz32 {} - es6.math.cosh {} - es6.math.expm1 {} - es6.math.fround {} - es6.math.hypot {} - es6.math.imul {} - es6.math.log1p {} - es6.math.log10 {} - es6.math.log2 {} - es6.math.sign {} - es6.math.sinh {} - es6.math.tanh {} - es6.math.trunc {} - es6.number.constructor {} - es6.number.epsilon {} - es6.number.is-finite {} - es6.number.is-integer {} - es6.number.is-nan {} - es6.number.is-safe-integer {} - es6.number.max-safe-integer {} - es6.number.min-safe-integer {} - es6.number.parse-float {} - es6.number.parse-int {} - es6.object.assign {} - es6.object.create {} - es7.object.define-getter {} - es7.object.define-setter {} - es6.object.define-property {} - es6.object.define-properties {} - es7.object.entries {} - es6.object.freeze {} - es6.object.get-own-property-descriptor {} - es7.object.get-own-property-descriptors {} - es6.object.get-own-property-names {} - es6.object.get-prototype-of {} - es7.object.lookup-getter {} - es7.object.lookup-setter {} - es6.object.prevent-extensions {} - es6.object.to-string {} - es6.object.is {} - es6.object.is-frozen {} - es6.object.is-sealed {} - es6.object.is-extensible {} - es6.object.keys {} - es6.object.seal {} - es6.object.set-prototype-of {} - es7.object.values {} - es6.promise {} - es7.promise.finally {} - es6.reflect.apply {} - es6.reflect.construct {} - es6.reflect.define-property {} - es6.reflect.delete-property {} - es6.reflect.get {} - es6.reflect.get-own-property-descriptor {} - es6.reflect.get-prototype-of {} - es6.reflect.has {} - es6.reflect.is-extensible {} - es6.reflect.own-keys {} - es6.reflect.prevent-extensions {} - es6.reflect.set {} - es6.reflect.set-prototype-of {} - es6.regexp.constructor {} - es6.regexp.flags {} - es6.regexp.match {} - es6.regexp.replace {} - es6.regexp.split {} - es6.regexp.search {} - es6.regexp.to-string {} - es6.set {} - es6.symbol {} - es7.symbol.async-iterator {} - es6.string.anchor {} - es6.string.big {} - es6.string.blink {} - es6.string.bold {} - es6.string.code-point-at {} - es6.string.ends-with {} - es6.string.fixed {} - es6.string.fontcolor {} - es6.string.fontsize {} - es6.string.from-code-point {} - es6.string.includes {} - es6.string.italics {} - es6.string.iterator {} - es6.string.link {} - es7.string.pad-start {} - es7.string.pad-end {} - es6.string.raw {} - es6.string.repeat {} - es6.string.small {} - es6.string.starts-with {} - es6.string.strike {} - es6.string.sub {} - es6.string.sup {} - es6.string.trim {} - es7.string.trim-left {} - es7.string.trim-right {} - es6.typed.array-buffer {} - es6.typed.data-view {} - es6.typed.int8-array {} - es6.typed.uint8-array {} - es6.typed.uint8-clamped-array {} - es6.typed.int16-array {} - es6.typed.uint16-array {} - es6.typed.int32-array {} - es6.typed.uint32-array {} - es6.typed.float32-array {} - es6.typed.float64-array {} - es6.weak-map {} - es6.weak-set {} - web.timers {} - web.immediate {} - web.dom.iterable {} -Successfully compiled 1 file with Babel. \ No newline at end of file diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-no-corejs-uglify/options.json b/packages/babel-preset-env/test/debug-fixtures/entry-no-corejs-uglify/options.json deleted file mode 100644 index 99859f1e9d1c..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/entry-no-corejs-uglify/options.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "presets": [ - ["../../lib", { - "debug": true, - "targets": { - "chrome": 55, - "uglify": true - }, - "useBuiltIns": "entry", - "modules": false - }] - ] -} diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-no-corejs-uglify/stdout.txt b/packages/babel-preset-env/test/debug-fixtures/entry-no-corejs-uglify/stdout.txt deleted file mode 100644 index 2a97e7973107..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/entry-no-corejs-uglify/stdout.txt +++ /dev/null @@ -1,66 +0,0 @@ -The uglify target has been deprecated. Set the top level -option `forceAllTransforms: true` instead. - -@babel/preset-env: `DEBUG` option - -Using targets: -{ - "chrome": "55" -} - -Using modules transform: false - -Using plugins: - transform-template-literals {} - transform-literals {} - transform-function-name {} - transform-arrow-functions {} - transform-block-scoped-functions {} - transform-classes {} - transform-object-super {} - transform-shorthand-properties {} - transform-duplicate-keys {} - transform-computed-properties {} - transform-for-of {} - transform-sticky-regex {} - transform-dotall-regex { "chrome":"55" } - transform-unicode-regex {} - transform-spread {} - transform-parameters {} - transform-destructuring {} - transform-block-scoping {} - transform-typeof-symbol {} - transform-new-target {} - transform-regenerator {} - transform-exponentiation-operator {} - transform-async-to-generator {} - proposal-async-generator-functions { "chrome":"55" } - proposal-object-rest-spread { "chrome":"55" } - proposal-unicode-property-regex { "chrome":"55" } - proposal-json-strings { "chrome":"55" } - proposal-optional-catch-binding { "chrome":"55" } - transform-named-capturing-groups-regex { "chrome":"55" } - transform-member-expression-literals {} - transform-property-literals {} - transform-reserved-words {} - -Using polyfills with `entry` option: - -[/src/in.js] Replaced @babel/polyfill entries with the following polyfills: - es7.array.flat-map { "chrome":"55" } - es6.array.sort { "chrome":"55" } - es7.object.define-getter { "chrome":"55" } - es7.object.define-setter { "chrome":"55" } - es7.object.lookup-getter { "chrome":"55" } - es7.object.lookup-setter { "chrome":"55" } - es6.object.to-string { "chrome":"55" } - es7.promise.finally { "chrome":"55" } - es7.symbol.async-iterator { "chrome":"55" } - es7.string.pad-start { "chrome":"55" } - es7.string.pad-end { "chrome":"55" } - es7.string.trim-left { "chrome":"55" } - es7.string.trim-right { "chrome":"55" } - web.timers { "chrome":"55" } - web.immediate { "chrome":"55" } - web.dom.iterable { "chrome":"55" } -Successfully compiled 1 file with Babel. \ No newline at end of file diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-no-corejs/options.json b/packages/babel-preset-env/test/debug-fixtures/entry-no-corejs/options.json deleted file mode 100644 index 8a1de9062d64..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/entry-no-corejs/options.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "presets": [ - ["../../lib", { - "debug": true, - "targets": { - "browsers": "chrome >= 54, ie 10", - "node": 6 - }, - "useBuiltIns": "entry" - }] - ] -} diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-no-corejs/stdout.txt b/packages/babel-preset-env/test/debug-fixtures/entry-no-corejs/stdout.txt deleted file mode 100644 index 943bad68b9b1..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/entry-no-corejs/stdout.txt +++ /dev/null @@ -1,174 +0,0 @@ -@babel/preset-env: `DEBUG` option - -Using targets: -{ - "chrome": "54", - "ie": "10", - "node": "6" -} - -Using modules transform: auto - -Using plugins: - transform-template-literals { "ie":"10" } - transform-literals { "ie":"10" } - transform-function-name { "ie":"10", "node":"6" } - transform-arrow-functions { "ie":"10" } - transform-block-scoped-functions { "ie":"10" } - transform-classes { "ie":"10" } - transform-object-super { "ie":"10" } - transform-shorthand-properties { "ie":"10" } - transform-duplicate-keys { "ie":"10" } - transform-computed-properties { "ie":"10" } - transform-for-of { "ie":"10", "node":"6" } - transform-sticky-regex { "ie":"10" } - transform-dotall-regex { "chrome":"54", "ie":"10", "node":"6" } - transform-unicode-regex { "ie":"10" } - transform-spread { "ie":"10" } - transform-parameters { "ie":"10" } - transform-destructuring { "ie":"10", "node":"6" } - transform-block-scoping { "ie":"10" } - transform-typeof-symbol { "ie":"10" } - transform-new-target { "ie":"10" } - transform-regenerator { "ie":"10" } - transform-exponentiation-operator { "ie":"10", "node":"6" } - transform-async-to-generator { "chrome":"54", "ie":"10", "node":"6" } - proposal-async-generator-functions { "chrome":"54", "ie":"10", "node":"6" } - proposal-object-rest-spread { "chrome":"54", "ie":"10", "node":"6" } - proposal-unicode-property-regex { "chrome":"54", "ie":"10", "node":"6" } - proposal-json-strings { "chrome":"54", "ie":"10", "node":"6" } - proposal-optional-catch-binding { "chrome":"54", "ie":"10", "node":"6" } - transform-named-capturing-groups-regex { "chrome":"54", "ie":"10", "node":"6" } - -Using polyfills with `entry` option: - -[/src/in.js] Replaced @babel/polyfill entries with the following polyfills: - es6.array.copy-within { "ie":"10" } - es6.array.fill { "ie":"10" } - es6.array.find { "ie":"10" } - es6.array.find-index { "ie":"10" } - es7.array.flat-map { "chrome":"54", "ie":"10", "node":"6" } - es6.array.from { "ie":"10", "node":"6" } - es7.array.includes { "ie":"10" } - es6.array.iterator { "ie":"10" } - es6.array.of { "ie":"10" } - es6.array.sort { "chrome":"54", "node":"6" } - es6.array.species { "ie":"10", "node":"6" } - es6.date.to-primitive { "ie":"10" } - es6.function.has-instance { "ie":"10", "node":"6" } - es6.function.name { "ie":"10" } - es6.map { "ie":"10", "node":"6" } - es6.math.acosh { "ie":"10" } - es6.math.asinh { "ie":"10" } - es6.math.atanh { "ie":"10" } - es6.math.cbrt { "ie":"10" } - es6.math.clz32 { "ie":"10" } - es6.math.cosh { "ie":"10" } - es6.math.expm1 { "ie":"10" } - es6.math.fround { "ie":"10" } - es6.math.hypot { "ie":"10" } - es6.math.imul { "ie":"10" } - es6.math.log1p { "ie":"10" } - es6.math.log10 { "ie":"10" } - es6.math.log2 { "ie":"10" } - es6.math.sign { "ie":"10" } - es6.math.sinh { "ie":"10" } - es6.math.tanh { "ie":"10" } - es6.math.trunc { "ie":"10" } - es6.number.constructor { "ie":"10" } - es6.number.epsilon { "ie":"10" } - es6.number.is-finite { "ie":"10" } - es6.number.is-integer { "ie":"10" } - es6.number.is-nan { "ie":"10" } - es6.number.is-safe-integer { "ie":"10" } - es6.number.max-safe-integer { "ie":"10" } - es6.number.min-safe-integer { "ie":"10" } - es6.number.parse-float { "ie":"10" } - es6.number.parse-int { "ie":"10" } - es6.object.assign { "ie":"10" } - es7.object.define-getter { "chrome":"54", "ie":"10", "node":"6" } - es7.object.define-setter { "chrome":"54", "ie":"10", "node":"6" } - es7.object.entries { "ie":"10", "node":"6" } - es6.object.freeze { "ie":"10" } - es6.object.get-own-property-descriptor { "ie":"10" } - es7.object.get-own-property-descriptors { "ie":"10", "node":"6" } - es6.object.get-own-property-names { "ie":"10" } - es6.object.get-prototype-of { "ie":"10" } - es7.object.lookup-getter { "chrome":"54", "ie":"10", "node":"6" } - es7.object.lookup-setter { "chrome":"54", "ie":"10", "node":"6" } - es6.object.prevent-extensions { "ie":"10" } - es6.object.to-string { "chrome":"54", "ie":"10", "node":"6" } - es6.object.is { "ie":"10" } - es6.object.is-frozen { "ie":"10" } - es6.object.is-sealed { "ie":"10" } - es6.object.is-extensible { "ie":"10" } - es6.object.keys { "ie":"10" } - es6.object.seal { "ie":"10" } - es6.object.set-prototype-of { "ie":"10" } - es7.object.values { "ie":"10", "node":"6" } - es6.promise { "ie":"10", "node":"6" } - es7.promise.finally { "chrome":"54", "ie":"10", "node":"6" } - es6.reflect.apply { "ie":"10" } - es6.reflect.construct { "ie":"10" } - es6.reflect.define-property { "ie":"10" } - es6.reflect.delete-property { "ie":"10" } - es6.reflect.get { "ie":"10" } - es6.reflect.get-own-property-descriptor { "ie":"10" } - es6.reflect.get-prototype-of { "ie":"10" } - es6.reflect.has { "ie":"10" } - es6.reflect.is-extensible { "ie":"10" } - es6.reflect.own-keys { "ie":"10" } - es6.reflect.prevent-extensions { "ie":"10" } - es6.reflect.set { "ie":"10" } - es6.reflect.set-prototype-of { "ie":"10" } - es6.regexp.constructor { "ie":"10" } - es6.regexp.flags { "ie":"10" } - es6.regexp.match { "ie":"10" } - es6.regexp.replace { "ie":"10" } - es6.regexp.split { "ie":"10" } - es6.regexp.search { "ie":"10" } - es6.regexp.to-string { "ie":"10" } - es6.set { "ie":"10", "node":"6" } - es6.symbol { "ie":"10", "node":"6" } - es7.symbol.async-iterator { "chrome":"54", "ie":"10", "node":"6" } - es6.string.anchor { "ie":"10" } - es6.string.big { "ie":"10" } - es6.string.blink { "ie":"10" } - es6.string.bold { "ie":"10" } - es6.string.code-point-at { "ie":"10" } - es6.string.ends-with { "ie":"10" } - es6.string.fixed { "ie":"10" } - es6.string.fontcolor { "ie":"10" } - es6.string.fontsize { "ie":"10" } - es6.string.from-code-point { "ie":"10" } - es6.string.includes { "ie":"10" } - es6.string.italics { "ie":"10" } - es6.string.iterator { "ie":"10" } - es6.string.link { "ie":"10" } - es7.string.pad-start { "chrome":"54", "ie":"10", "node":"6" } - es7.string.pad-end { "chrome":"54", "ie":"10", "node":"6" } - es6.string.raw { "ie":"10" } - es6.string.repeat { "ie":"10" } - es6.string.small { "ie":"10" } - es6.string.starts-with { "ie":"10" } - es6.string.strike { "ie":"10" } - es6.string.sub { "ie":"10" } - es6.string.sup { "ie":"10" } - es7.string.trim-left { "chrome":"54", "ie":"10", "node":"6" } - es7.string.trim-right { "chrome":"54", "ie":"10", "node":"6" } - es6.typed.array-buffer { "ie":"10", "node":"6" } - es6.typed.int8-array { "ie":"10", "node":"6" } - es6.typed.uint8-array { "ie":"10", "node":"6" } - es6.typed.uint8-clamped-array { "ie":"10", "node":"6" } - es6.typed.int16-array { "ie":"10", "node":"6" } - es6.typed.uint16-array { "ie":"10", "node":"6" } - es6.typed.int32-array { "ie":"10", "node":"6" } - es6.typed.uint32-array { "ie":"10", "node":"6" } - es6.typed.float32-array { "ie":"10", "node":"6" } - es6.typed.float64-array { "ie":"10", "node":"6" } - es6.weak-map { "ie":"10", "node":"6" } - es6.weak-set { "ie":"10", "node":"6" } - web.timers { "chrome":"54", "ie":"10", "node":"6" } - web.immediate { "chrome":"54", "ie":"10", "node":"6" } - web.dom.iterable { "chrome":"54", "ie":"10", "node":"6" } -Successfully compiled 1 file with Babel. \ No newline at end of file diff --git a/packages/babel-preset-env/test/debug-fixtures/plugins-only/options.json b/packages/babel-preset-env/test/debug-fixtures/plugins-only/options.json deleted file mode 100644 index ec9d6a4e722a..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/plugins-only/options.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "presets": [ - ["../../lib", { - "debug": true, - "exclude": [ - "transform-async-to-generator", - "transform-regenerator", - "transform-parameters" - ], - "targets": { - "firefox": 52, - "node": 7.4 - }, - "useBuiltIns": false - }] - ] -} diff --git a/packages/babel-preset-env/test/debug-fixtures/plugins-only/stdout.txt b/packages/babel-preset-env/test/debug-fixtures/plugins-only/stdout.txt deleted file mode 100644 index b9408aae4462..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/plugins-only/stdout.txt +++ /dev/null @@ -1,32 +0,0 @@ -Warning, the following targets are using a decimal version: - - node: 7.4 - -We recommend using a string for minor/patch versions to avoid numbers like 6.10 -getting parsed as 6.1, which can lead to unexpected behavior. - -@babel/preset-env: `DEBUG` option - -Using targets: -{ - "firefox": "52", - "node": "7.4" -} - -Using modules transform: auto - -Using plugins: - transform-literals { "firefox":"52" } - transform-function-name { "firefox":"52" } - transform-for-of { "firefox":"52" } - transform-dotall-regex { "firefox":"52", "node":"7.4" } - transform-destructuring { "firefox":"52" } - proposal-async-generator-functions { "firefox":"52", "node":"7.4" } - proposal-object-rest-spread { "firefox":"52", "node":"7.4" } - proposal-unicode-property-regex { "firefox":"52", "node":"7.4" } - proposal-json-strings { "firefox":"52", "node":"7.4" } - proposal-optional-catch-binding { "firefox":"52", "node":"7.4" } - transform-named-capturing-groups-regex { "firefox":"52", "node":"7.4" } - -Using polyfills: No polyfills were added, since the `useBuiltIns` option was not set. -Successfully compiled 1 file with Babel. \ No newline at end of file diff --git a/packages/babel-preset-env/test/debug-fixtures/usage-corejs2-chrome-71/options.json b/packages/babel-preset-env/test/debug-fixtures/usage-corejs2-chrome-71/options.json deleted file mode 100644 index b2ed793a3530..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/usage-corejs2-chrome-71/options.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "presets": [ - ["../../lib", { - "debug": true, - "targets": { - "chrome": 71 - }, - "useBuiltIns": "usage", - "corejs": 2 - }] - ] -} diff --git a/packages/babel-preset-env/test/debug-fixtures/usage-corejs2-chrome-71/stdout.txt b/packages/babel-preset-env/test/debug-fixtures/usage-corejs2-chrome-71/stdout.txt deleted file mode 100644 index b3df5f0872ba..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/usage-corejs2-chrome-71/stdout.txt +++ /dev/null @@ -1,23 +0,0 @@ -@babel/preset-env: `DEBUG` option - -Using targets: -{ - "chrome": "71" -} - -Using modules transform: auto - -Using plugins: - syntax-async-generators { "chrome":"71" } - syntax-object-rest-spread { "chrome":"71" } - syntax-json-strings { "chrome":"71" } - syntax-optional-catch-binding { "chrome":"71" } - -Using polyfills with `usage` option: - -[/src/in.js] Added following core-js polyfill: - web.dom.iterable { "chrome":"71" } - -[/src/in2.js] Added following core-js polyfill: - web.dom.iterable { "chrome":"71" } -Successfully compiled 2 files with Babel. \ No newline at end of file diff --git a/packages/babel-preset-env/test/debug-fixtures/usage-corejs2-none/options.json b/packages/babel-preset-env/test/debug-fixtures/usage-corejs2-none/options.json deleted file mode 100644 index 087a0efc9f65..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/usage-corejs2-none/options.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "presets": [ - ["../../lib", { - "debug": true, - "targets": { - "chrome": 52, - "firefox": 50, - "ie": 11 - }, - "useBuiltIns": "usage", - "corejs": 2 - }] - ] -} diff --git a/packages/babel-preset-env/test/debug-fixtures/usage-corejs2-none/stdout.txt b/packages/babel-preset-env/test/debug-fixtures/usage-corejs2-none/stdout.txt deleted file mode 100644 index fafdcfca187c..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/usage-corejs2-none/stdout.txt +++ /dev/null @@ -1,47 +0,0 @@ -@babel/preset-env: `DEBUG` option - -Using targets: -{ - "chrome": "52", - "firefox": "50", - "ie": "11" -} - -Using modules transform: auto - -Using plugins: - transform-template-literals { "ie":"11" } - transform-literals { "firefox":"50", "ie":"11" } - transform-function-name { "firefox":"50", "ie":"11" } - transform-arrow-functions { "ie":"11" } - transform-classes { "ie":"11" } - transform-object-super { "ie":"11" } - transform-shorthand-properties { "ie":"11" } - transform-duplicate-keys { "ie":"11" } - transform-computed-properties { "ie":"11" } - transform-for-of { "firefox":"50", "ie":"11" } - transform-sticky-regex { "ie":"11" } - transform-dotall-regex { "chrome":"52", "firefox":"50", "ie":"11" } - transform-unicode-regex { "ie":"11" } - transform-spread { "ie":"11" } - transform-parameters { "firefox":"50", "ie":"11" } - transform-destructuring { "firefox":"50", "ie":"11" } - transform-block-scoping { "firefox":"50", "ie":"11" } - transform-typeof-symbol { "ie":"11" } - transform-new-target { "ie":"11" } - transform-regenerator { "firefox":"50", "ie":"11" } - transform-exponentiation-operator { "firefox":"50", "ie":"11" } - transform-async-to-generator { "chrome":"52", "firefox":"50", "ie":"11" } - proposal-async-generator-functions { "chrome":"52", "firefox":"50", "ie":"11" } - proposal-object-rest-spread { "chrome":"52", "firefox":"50", "ie":"11" } - proposal-unicode-property-regex { "chrome":"52", "firefox":"50", "ie":"11" } - proposal-json-strings { "chrome":"52", "firefox":"50", "ie":"11" } - proposal-optional-catch-binding { "chrome":"52", "firefox":"50", "ie":"11" } - transform-named-capturing-groups-regex { "chrome":"52", "firefox":"50", "ie":"11" } - -Using polyfills with `usage` option: - -[/src/in.js] Based on your code and targets, core-js polyfills were not added. - -[/src/in2.js] Based on your code and targets, core-js polyfills were not added. -Successfully compiled 2 files with Babel. \ No newline at end of file diff --git a/packages/babel-preset-env/test/debug-fixtures/usage-corejs2-proposals-chrome-71/options.json b/packages/babel-preset-env/test/debug-fixtures/usage-corejs2-proposals-chrome-71/options.json deleted file mode 100644 index b2110d7ec87a..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/usage-corejs2-proposals-chrome-71/options.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "presets": [ - ["../../lib", { - "debug": true, - "targets": { - "chrome": 71 - }, - "useBuiltIns": "usage", - "corejs": { "version": 2, "proposals": true } - }] - ] -} diff --git a/packages/babel-preset-env/test/debug-fixtures/usage-corejs2-proposals-chrome-71/stdout.txt b/packages/babel-preset-env/test/debug-fixtures/usage-corejs2-proposals-chrome-71/stdout.txt deleted file mode 100644 index b3df5f0872ba..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/usage-corejs2-proposals-chrome-71/stdout.txt +++ /dev/null @@ -1,23 +0,0 @@ -@babel/preset-env: `DEBUG` option - -Using targets: -{ - "chrome": "71" -} - -Using modules transform: auto - -Using plugins: - syntax-async-generators { "chrome":"71" } - syntax-object-rest-spread { "chrome":"71" } - syntax-json-strings { "chrome":"71" } - syntax-optional-catch-binding { "chrome":"71" } - -Using polyfills with `usage` option: - -[/src/in.js] Added following core-js polyfill: - web.dom.iterable { "chrome":"71" } - -[/src/in2.js] Added following core-js polyfill: - web.dom.iterable { "chrome":"71" } -Successfully compiled 2 files with Babel. \ No newline at end of file diff --git a/packages/babel-preset-env/test/debug-fixtures/usage-corejs2-proposals/options.json b/packages/babel-preset-env/test/debug-fixtures/usage-corejs2-proposals/options.json deleted file mode 100644 index 04beb327c6ab..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/usage-corejs2-proposals/options.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "presets": [ - ["../../lib", { - "debug": true, - "targets": { - "chrome": 52, - "firefox": 50, - "ie": 11 - }, - "useBuiltIns": "usage", - "corejs": { "version": 2, "proposals": true } - }] - ] -} diff --git a/packages/babel-preset-env/test/debug-fixtures/usage-corejs2-proposals/stdout.txt b/packages/babel-preset-env/test/debug-fixtures/usage-corejs2-proposals/stdout.txt deleted file mode 100644 index 8d1136d823bd..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/usage-corejs2-proposals/stdout.txt +++ /dev/null @@ -1,56 +0,0 @@ -@babel/preset-env: `DEBUG` option - -Using targets: -{ - "chrome": "52", - "firefox": "50", - "ie": "11" -} - -Using modules transform: auto - -Using plugins: - transform-template-literals { "ie":"11" } - transform-literals { "firefox":"50", "ie":"11" } - transform-function-name { "firefox":"50", "ie":"11" } - transform-arrow-functions { "ie":"11" } - transform-classes { "ie":"11" } - transform-object-super { "ie":"11" } - transform-shorthand-properties { "ie":"11" } - transform-duplicate-keys { "ie":"11" } - transform-computed-properties { "ie":"11" } - transform-for-of { "firefox":"50", "ie":"11" } - transform-sticky-regex { "ie":"11" } - transform-dotall-regex { "chrome":"52", "firefox":"50", "ie":"11" } - transform-unicode-regex { "ie":"11" } - transform-spread { "ie":"11" } - transform-parameters { "firefox":"50", "ie":"11" } - transform-destructuring { "firefox":"50", "ie":"11" } - transform-block-scoping { "firefox":"50", "ie":"11" } - transform-typeof-symbol { "ie":"11" } - transform-new-target { "ie":"11" } - transform-regenerator { "firefox":"50", "ie":"11" } - transform-exponentiation-operator { "firefox":"50", "ie":"11" } - transform-async-to-generator { "chrome":"52", "firefox":"50", "ie":"11" } - proposal-async-generator-functions { "chrome":"52", "firefox":"50", "ie":"11" } - proposal-object-rest-spread { "chrome":"52", "firefox":"50", "ie":"11" } - proposal-unicode-property-regex { "chrome":"52", "firefox":"50", "ie":"11" } - proposal-json-strings { "chrome":"52", "firefox":"50", "ie":"11" } - proposal-optional-catch-binding { "chrome":"52", "firefox":"50", "ie":"11" } - transform-named-capturing-groups-regex { "chrome":"52", "firefox":"50", "ie":"11" } - -Using polyfills with `usage` option: - -[/src/in.js] Added following core-js polyfills: - es6.object.to-string { "chrome":"52", "firefox":"50", "ie":"11" } - es6.promise { "ie":"11" } - es6.map { "firefox":"50", "ie":"11" } - es6.string.iterator { "ie":"11" } - es6.array.iterator { "ie":"11" } - web.dom.iterable { "chrome":"52", "firefox":"50", "ie":"11" } - -[/src/in2.js] Added following core-js polyfill: - web.dom.iterable { "chrome":"52", "firefox":"50", "ie":"11" } - -[/src/in2.js] Based on your code and targets, added regenerator-runtime. -Successfully compiled 2 files with Babel. \ No newline at end of file diff --git a/packages/babel-preset-env/test/debug-fixtures/usage-corejs2-shippedProposals/options.json b/packages/babel-preset-env/test/debug-fixtures/usage-corejs2-shippedProposals/options.json deleted file mode 100644 index 448b3d6f1e8e..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/usage-corejs2-shippedProposals/options.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "presets": [ - ["../../lib", { - "debug": true, - "targets": { - "chrome": 52, - "firefox": 50, - "ie": 11 - }, - "shippedProposals": true, - "useBuiltIns": "usage", - "corejs": 2 - }] - ] -} diff --git a/packages/babel-preset-env/test/debug-fixtures/usage-corejs2-shippedProposals/stdout.txt b/packages/babel-preset-env/test/debug-fixtures/usage-corejs2-shippedProposals/stdout.txt deleted file mode 100644 index 8d1136d823bd..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/usage-corejs2-shippedProposals/stdout.txt +++ /dev/null @@ -1,56 +0,0 @@ -@babel/preset-env: `DEBUG` option - -Using targets: -{ - "chrome": "52", - "firefox": "50", - "ie": "11" -} - -Using modules transform: auto - -Using plugins: - transform-template-literals { "ie":"11" } - transform-literals { "firefox":"50", "ie":"11" } - transform-function-name { "firefox":"50", "ie":"11" } - transform-arrow-functions { "ie":"11" } - transform-classes { "ie":"11" } - transform-object-super { "ie":"11" } - transform-shorthand-properties { "ie":"11" } - transform-duplicate-keys { "ie":"11" } - transform-computed-properties { "ie":"11" } - transform-for-of { "firefox":"50", "ie":"11" } - transform-sticky-regex { "ie":"11" } - transform-dotall-regex { "chrome":"52", "firefox":"50", "ie":"11" } - transform-unicode-regex { "ie":"11" } - transform-spread { "ie":"11" } - transform-parameters { "firefox":"50", "ie":"11" } - transform-destructuring { "firefox":"50", "ie":"11" } - transform-block-scoping { "firefox":"50", "ie":"11" } - transform-typeof-symbol { "ie":"11" } - transform-new-target { "ie":"11" } - transform-regenerator { "firefox":"50", "ie":"11" } - transform-exponentiation-operator { "firefox":"50", "ie":"11" } - transform-async-to-generator { "chrome":"52", "firefox":"50", "ie":"11" } - proposal-async-generator-functions { "chrome":"52", "firefox":"50", "ie":"11" } - proposal-object-rest-spread { "chrome":"52", "firefox":"50", "ie":"11" } - proposal-unicode-property-regex { "chrome":"52", "firefox":"50", "ie":"11" } - proposal-json-strings { "chrome":"52", "firefox":"50", "ie":"11" } - proposal-optional-catch-binding { "chrome":"52", "firefox":"50", "ie":"11" } - transform-named-capturing-groups-regex { "chrome":"52", "firefox":"50", "ie":"11" } - -Using polyfills with `usage` option: - -[/src/in.js] Added following core-js polyfills: - es6.object.to-string { "chrome":"52", "firefox":"50", "ie":"11" } - es6.promise { "ie":"11" } - es6.map { "firefox":"50", "ie":"11" } - es6.string.iterator { "ie":"11" } - es6.array.iterator { "ie":"11" } - web.dom.iterable { "chrome":"52", "firefox":"50", "ie":"11" } - -[/src/in2.js] Added following core-js polyfill: - web.dom.iterable { "chrome":"52", "firefox":"50", "ie":"11" } - -[/src/in2.js] Based on your code and targets, added regenerator-runtime. -Successfully compiled 2 files with Babel. \ No newline at end of file diff --git a/packages/babel-preset-env/test/debug-fixtures/usage-corejs2-with-import/options.json b/packages/babel-preset-env/test/debug-fixtures/usage-corejs2-with-import/options.json deleted file mode 100644 index ab34fa8b5159..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/usage-corejs2-with-import/options.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "presets": [ - ["../../lib", { - "debug": true, - "targets": { - "chrome": 55 - }, - "useBuiltIns": "usage", - "corejs": 2 - }] - ] -} diff --git a/packages/babel-preset-env/test/debug-fixtures/usage-corejs2-with-import/stdout.txt b/packages/babel-preset-env/test/debug-fixtures/usage-corejs2-with-import/stdout.txt deleted file mode 100644 index e976e00c5f93..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/usage-corejs2-with-import/stdout.txt +++ /dev/null @@ -1,22 +0,0 @@ -@babel/preset-env: `DEBUG` option - -Using targets: -{ - "chrome": "55" -} - -Using modules transform: auto - -Using plugins: - transform-dotall-regex { "chrome":"55" } - proposal-async-generator-functions { "chrome":"55" } - proposal-object-rest-spread { "chrome":"55" } - proposal-unicode-property-regex { "chrome":"55" } - proposal-json-strings { "chrome":"55" } - proposal-optional-catch-binding { "chrome":"55" } - transform-named-capturing-groups-regex { "chrome":"55" } - -Using polyfills with `usage` option: - -[/src/in.js] Based on your code and targets, core-js polyfills were not added. -Successfully compiled 1 file with Babel. \ No newline at end of file diff --git a/packages/babel-preset-env/test/debug-fixtures/usage-corejs2/options.json b/packages/babel-preset-env/test/debug-fixtures/usage-corejs2/options.json deleted file mode 100644 index 087a0efc9f65..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/usage-corejs2/options.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "presets": [ - ["../../lib", { - "debug": true, - "targets": { - "chrome": 52, - "firefox": 50, - "ie": 11 - }, - "useBuiltIns": "usage", - "corejs": 2 - }] - ] -} diff --git a/packages/babel-preset-env/test/debug-fixtures/usage-corejs2/stdout.txt b/packages/babel-preset-env/test/debug-fixtures/usage-corejs2/stdout.txt deleted file mode 100644 index 8d1136d823bd..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/usage-corejs2/stdout.txt +++ /dev/null @@ -1,56 +0,0 @@ -@babel/preset-env: `DEBUG` option - -Using targets: -{ - "chrome": "52", - "firefox": "50", - "ie": "11" -} - -Using modules transform: auto - -Using plugins: - transform-template-literals { "ie":"11" } - transform-literals { "firefox":"50", "ie":"11" } - transform-function-name { "firefox":"50", "ie":"11" } - transform-arrow-functions { "ie":"11" } - transform-classes { "ie":"11" } - transform-object-super { "ie":"11" } - transform-shorthand-properties { "ie":"11" } - transform-duplicate-keys { "ie":"11" } - transform-computed-properties { "ie":"11" } - transform-for-of { "firefox":"50", "ie":"11" } - transform-sticky-regex { "ie":"11" } - transform-dotall-regex { "chrome":"52", "firefox":"50", "ie":"11" } - transform-unicode-regex { "ie":"11" } - transform-spread { "ie":"11" } - transform-parameters { "firefox":"50", "ie":"11" } - transform-destructuring { "firefox":"50", "ie":"11" } - transform-block-scoping { "firefox":"50", "ie":"11" } - transform-typeof-symbol { "ie":"11" } - transform-new-target { "ie":"11" } - transform-regenerator { "firefox":"50", "ie":"11" } - transform-exponentiation-operator { "firefox":"50", "ie":"11" } - transform-async-to-generator { "chrome":"52", "firefox":"50", "ie":"11" } - proposal-async-generator-functions { "chrome":"52", "firefox":"50", "ie":"11" } - proposal-object-rest-spread { "chrome":"52", "firefox":"50", "ie":"11" } - proposal-unicode-property-regex { "chrome":"52", "firefox":"50", "ie":"11" } - proposal-json-strings { "chrome":"52", "firefox":"50", "ie":"11" } - proposal-optional-catch-binding { "chrome":"52", "firefox":"50", "ie":"11" } - transform-named-capturing-groups-regex { "chrome":"52", "firefox":"50", "ie":"11" } - -Using polyfills with `usage` option: - -[/src/in.js] Added following core-js polyfills: - es6.object.to-string { "chrome":"52", "firefox":"50", "ie":"11" } - es6.promise { "ie":"11" } - es6.map { "firefox":"50", "ie":"11" } - es6.string.iterator { "ie":"11" } - es6.array.iterator { "ie":"11" } - web.dom.iterable { "chrome":"52", "firefox":"50", "ie":"11" } - -[/src/in2.js] Added following core-js polyfill: - web.dom.iterable { "chrome":"52", "firefox":"50", "ie":"11" } - -[/src/in2.js] Based on your code and targets, added regenerator-runtime. -Successfully compiled 2 files with Babel. \ No newline at end of file diff --git a/packages/babel-preset-env/test/debug-fixtures/usage-corejs3-chrome-71/options.json b/packages/babel-preset-env/test/debug-fixtures/usage-corejs3-chrome-71/options.json deleted file mode 100644 index 31c2a9c77a6f..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/usage-corejs3-chrome-71/options.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "presets": [ - ["../../lib", { - "debug": true, - "targets": { - "chrome": 71 - }, - "useBuiltIns": "usage", - "corejs": 3 - }] - ] -} diff --git a/packages/babel-preset-env/test/debug-fixtures/usage-corejs3-chrome-71/stdout.txt b/packages/babel-preset-env/test/debug-fixtures/usage-corejs3-chrome-71/stdout.txt deleted file mode 100644 index 3b0d7b91373c..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/usage-corejs3-chrome-71/stdout.txt +++ /dev/null @@ -1,21 +0,0 @@ -@babel/preset-env: `DEBUG` option - -Using targets: -{ - "chrome": "71" -} - -Using modules transform: auto - -Using plugins: - syntax-async-generators { "chrome":"71" } - syntax-object-rest-spread { "chrome":"71" } - syntax-json-strings { "chrome":"71" } - syntax-optional-catch-binding { "chrome":"71" } - -Using polyfills with `usage` option: - -[/src/in.js] Based on your code and targets, core-js polyfills were not added. - -[/src/in2.js] Based on your code and targets, core-js polyfills were not added. -Successfully compiled 2 files with Babel. \ No newline at end of file diff --git a/packages/babel-preset-env/test/debug-fixtures/usage-corejs3-none/options.json b/packages/babel-preset-env/test/debug-fixtures/usage-corejs3-none/options.json deleted file mode 100644 index 6c2922e8970d..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/usage-corejs3-none/options.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "presets": [ - ["../../lib", { - "debug": true, - "targets": { - "chrome": 52, - "firefox": 50, - "ie": 11 - }, - "useBuiltIns": "usage", - "corejs": 3 - }] - ] -} diff --git a/packages/babel-preset-env/test/debug-fixtures/usage-corejs3-none/stdout.txt b/packages/babel-preset-env/test/debug-fixtures/usage-corejs3-none/stdout.txt deleted file mode 100644 index fafdcfca187c..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/usage-corejs3-none/stdout.txt +++ /dev/null @@ -1,47 +0,0 @@ -@babel/preset-env: `DEBUG` option - -Using targets: -{ - "chrome": "52", - "firefox": "50", - "ie": "11" -} - -Using modules transform: auto - -Using plugins: - transform-template-literals { "ie":"11" } - transform-literals { "firefox":"50", "ie":"11" } - transform-function-name { "firefox":"50", "ie":"11" } - transform-arrow-functions { "ie":"11" } - transform-classes { "ie":"11" } - transform-object-super { "ie":"11" } - transform-shorthand-properties { "ie":"11" } - transform-duplicate-keys { "ie":"11" } - transform-computed-properties { "ie":"11" } - transform-for-of { "firefox":"50", "ie":"11" } - transform-sticky-regex { "ie":"11" } - transform-dotall-regex { "chrome":"52", "firefox":"50", "ie":"11" } - transform-unicode-regex { "ie":"11" } - transform-spread { "ie":"11" } - transform-parameters { "firefox":"50", "ie":"11" } - transform-destructuring { "firefox":"50", "ie":"11" } - transform-block-scoping { "firefox":"50", "ie":"11" } - transform-typeof-symbol { "ie":"11" } - transform-new-target { "ie":"11" } - transform-regenerator { "firefox":"50", "ie":"11" } - transform-exponentiation-operator { "firefox":"50", "ie":"11" } - transform-async-to-generator { "chrome":"52", "firefox":"50", "ie":"11" } - proposal-async-generator-functions { "chrome":"52", "firefox":"50", "ie":"11" } - proposal-object-rest-spread { "chrome":"52", "firefox":"50", "ie":"11" } - proposal-unicode-property-regex { "chrome":"52", "firefox":"50", "ie":"11" } - proposal-json-strings { "chrome":"52", "firefox":"50", "ie":"11" } - proposal-optional-catch-binding { "chrome":"52", "firefox":"50", "ie":"11" } - transform-named-capturing-groups-regex { "chrome":"52", "firefox":"50", "ie":"11" } - -Using polyfills with `usage` option: - -[/src/in.js] Based on your code and targets, core-js polyfills were not added. - -[/src/in2.js] Based on your code and targets, core-js polyfills were not added. -Successfully compiled 2 files with Babel. \ No newline at end of file diff --git a/packages/babel-preset-env/test/debug-fixtures/usage-corejs3-proposals-chrome-71/options.json b/packages/babel-preset-env/test/debug-fixtures/usage-corejs3-proposals-chrome-71/options.json deleted file mode 100644 index 24bc77a0d5e0..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/usage-corejs3-proposals-chrome-71/options.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "presets": [ - ["../../lib", { - "debug": true, - "targets": { - "chrome": 71 - }, - "useBuiltIns": "usage", - "corejs": { "version": 3, "proposals": true } - }] - ] -} diff --git a/packages/babel-preset-env/test/debug-fixtures/usage-corejs3-proposals-chrome-71/stdout.txt b/packages/babel-preset-env/test/debug-fixtures/usage-corejs3-proposals-chrome-71/stdout.txt deleted file mode 100644 index e3546e022a16..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/usage-corejs3-proposals-chrome-71/stdout.txt +++ /dev/null @@ -1,36 +0,0 @@ -@babel/preset-env: `DEBUG` option - -Using targets: -{ - "chrome": "71" -} - -Using modules transform: auto - -Using plugins: - syntax-async-generators { "chrome":"71" } - syntax-object-rest-spread { "chrome":"71" } - syntax-json-strings { "chrome":"71" } - syntax-optional-catch-binding { "chrome":"71" } - -Using polyfills with `usage` option: - -[/src/in.js] Added following core-js polyfills: - esnext.map.delete-all { "chrome":"71" } - esnext.map.every { "chrome":"71" } - esnext.map.filter { "chrome":"71" } - esnext.map.find { "chrome":"71" } - esnext.map.find-key { "chrome":"71" } - esnext.map.includes { "chrome":"71" } - esnext.map.key-of { "chrome":"71" } - esnext.map.map-keys { "chrome":"71" } - esnext.map.map-values { "chrome":"71" } - esnext.map.merge { "chrome":"71" } - esnext.map.reduce { "chrome":"71" } - esnext.map.some { "chrome":"71" } - esnext.map.update { "chrome":"71" } - esnext.observable { "chrome":"71" } - esnext.symbol.observable { "chrome":"71" } - -[/src/in2.js] Based on your code and targets, core-js polyfills were not added. -Successfully compiled 2 files with Babel. \ No newline at end of file diff --git a/packages/babel-preset-env/test/debug-fixtures/usage-corejs3-proposals/options.json b/packages/babel-preset-env/test/debug-fixtures/usage-corejs3-proposals/options.json deleted file mode 100644 index 437b707652d3..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/usage-corejs3-proposals/options.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "presets": [ - ["../../lib", { - "debug": true, - "targets": { - "chrome": 52, - "firefox": 50, - "ie": 11 - }, - "useBuiltIns": "usage", - "corejs": { "version": 3, "proposals": true } - }] - ] -} diff --git a/packages/babel-preset-env/test/debug-fixtures/usage-corejs3-proposals/stdout.txt b/packages/babel-preset-env/test/debug-fixtures/usage-corejs3-proposals/stdout.txt deleted file mode 100644 index cec7b6803911..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/usage-corejs3-proposals/stdout.txt +++ /dev/null @@ -1,75 +0,0 @@ -@babel/preset-env: `DEBUG` option - -Using targets: -{ - "chrome": "52", - "firefox": "50", - "ie": "11" -} - -Using modules transform: auto - -Using plugins: - transform-template-literals { "ie":"11" } - transform-literals { "firefox":"50", "ie":"11" } - transform-function-name { "firefox":"50", "ie":"11" } - transform-arrow-functions { "ie":"11" } - transform-classes { "ie":"11" } - transform-object-super { "ie":"11" } - transform-shorthand-properties { "ie":"11" } - transform-duplicate-keys { "ie":"11" } - transform-computed-properties { "ie":"11" } - transform-for-of { "firefox":"50", "ie":"11" } - transform-sticky-regex { "ie":"11" } - transform-dotall-regex { "chrome":"52", "firefox":"50", "ie":"11" } - transform-unicode-regex { "ie":"11" } - transform-spread { "ie":"11" } - transform-parameters { "firefox":"50", "ie":"11" } - transform-destructuring { "firefox":"50", "ie":"11" } - transform-block-scoping { "firefox":"50", "ie":"11" } - transform-typeof-symbol { "ie":"11" } - transform-new-target { "ie":"11" } - transform-regenerator { "firefox":"50", "ie":"11" } - transform-exponentiation-operator { "firefox":"50", "ie":"11" } - transform-async-to-generator { "chrome":"52", "firefox":"50", "ie":"11" } - proposal-async-generator-functions { "chrome":"52", "firefox":"50", "ie":"11" } - proposal-object-rest-spread { "chrome":"52", "firefox":"50", "ie":"11" } - proposal-unicode-property-regex { "chrome":"52", "firefox":"50", "ie":"11" } - proposal-json-strings { "chrome":"52", "firefox":"50", "ie":"11" } - proposal-optional-catch-binding { "chrome":"52", "firefox":"50", "ie":"11" } - transform-named-capturing-groups-regex { "chrome":"52", "firefox":"50", "ie":"11" } - -Using polyfills with `usage` option: - -[/src/in.js] Added following core-js polyfills: - es.array.iterator { "chrome":"52", "firefox":"50", "ie":"11" } - es.map { "firefox":"50", "ie":"11" } - es.object.to-string { "firefox":"50", "ie":"11" } - es.promise { "chrome":"52", "firefox":"50", "ie":"11" } - es.string.iterator { "ie":"11" } - esnext.global-this { "chrome":"52", "firefox":"50", "ie":"11" } - esnext.map.delete-all { "chrome":"52", "firefox":"50", "ie":"11" } - esnext.map.every { "chrome":"52", "firefox":"50", "ie":"11" } - esnext.map.filter { "chrome":"52", "firefox":"50", "ie":"11" } - esnext.map.find { "chrome":"52", "firefox":"50", "ie":"11" } - esnext.map.find-key { "chrome":"52", "firefox":"50", "ie":"11" } - esnext.map.includes { "chrome":"52", "firefox":"50", "ie":"11" } - esnext.map.key-of { "chrome":"52", "firefox":"50", "ie":"11" } - esnext.map.map-keys { "chrome":"52", "firefox":"50", "ie":"11" } - esnext.map.map-values { "chrome":"52", "firefox":"50", "ie":"11" } - esnext.map.merge { "chrome":"52", "firefox":"50", "ie":"11" } - esnext.map.reduce { "chrome":"52", "firefox":"50", "ie":"11" } - esnext.map.some { "chrome":"52", "firefox":"50", "ie":"11" } - esnext.map.update { "chrome":"52", "firefox":"50", "ie":"11" } - esnext.observable { "chrome":"52", "firefox":"50", "ie":"11" } - esnext.symbol.observable { "chrome":"52", "firefox":"50", "ie":"11" } - web.dom-collections.iterator { "chrome":"52", "firefox":"50", "ie":"11" } - web.queue-microtask { "chrome":"52", "firefox":"50", "ie":"11" } - -[/src/in2.js] Added following core-js polyfills: - es.array.iterator { "chrome":"52", "firefox":"50", "ie":"11" } - es.string.iterator { "ie":"11" } - web.dom-collections.iterator { "chrome":"52", "firefox":"50", "ie":"11" } - -[/src/in2.js] Based on your code and targets, added regenerator-runtime. -Successfully compiled 2 files with Babel. \ No newline at end of file diff --git a/packages/babel-preset-env/test/debug-fixtures/usage-corejs3-shippedProposals/options.json b/packages/babel-preset-env/test/debug-fixtures/usage-corejs3-shippedProposals/options.json deleted file mode 100644 index 0c80d936a7fb..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/usage-corejs3-shippedProposals/options.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "presets": [ - ["../../lib", { - "debug": true, - "targets": { - "chrome": 52, - "firefox": 50, - "ie": 11 - }, - "shippedProposals": true, - "useBuiltIns": "usage", - "corejs": 3 - }] - ] -} diff --git a/packages/babel-preset-env/test/debug-fixtures/usage-corejs3-shippedProposals/stdout.txt b/packages/babel-preset-env/test/debug-fixtures/usage-corejs3-shippedProposals/stdout.txt deleted file mode 100644 index c9d333c5820b..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/usage-corejs3-shippedProposals/stdout.txt +++ /dev/null @@ -1,60 +0,0 @@ -@babel/preset-env: `DEBUG` option - -Using targets: -{ - "chrome": "52", - "firefox": "50", - "ie": "11" -} - -Using modules transform: auto - -Using plugins: - transform-template-literals { "ie":"11" } - transform-literals { "firefox":"50", "ie":"11" } - transform-function-name { "firefox":"50", "ie":"11" } - transform-arrow-functions { "ie":"11" } - transform-classes { "ie":"11" } - transform-object-super { "ie":"11" } - transform-shorthand-properties { "ie":"11" } - transform-duplicate-keys { "ie":"11" } - transform-computed-properties { "ie":"11" } - transform-for-of { "firefox":"50", "ie":"11" } - transform-sticky-regex { "ie":"11" } - transform-dotall-regex { "chrome":"52", "firefox":"50", "ie":"11" } - transform-unicode-regex { "ie":"11" } - transform-spread { "ie":"11" } - transform-parameters { "firefox":"50", "ie":"11" } - transform-destructuring { "firefox":"50", "ie":"11" } - transform-block-scoping { "firefox":"50", "ie":"11" } - transform-typeof-symbol { "ie":"11" } - transform-new-target { "ie":"11" } - transform-regenerator { "firefox":"50", "ie":"11" } - transform-exponentiation-operator { "firefox":"50", "ie":"11" } - transform-async-to-generator { "chrome":"52", "firefox":"50", "ie":"11" } - proposal-async-generator-functions { "chrome":"52", "firefox":"50", "ie":"11" } - proposal-object-rest-spread { "chrome":"52", "firefox":"50", "ie":"11" } - proposal-unicode-property-regex { "chrome":"52", "firefox":"50", "ie":"11" } - proposal-json-strings { "chrome":"52", "firefox":"50", "ie":"11" } - proposal-optional-catch-binding { "chrome":"52", "firefox":"50", "ie":"11" } - transform-named-capturing-groups-regex { "chrome":"52", "firefox":"50", "ie":"11" } - -Using polyfills with `usage` option: - -[/src/in.js] Added following core-js polyfills: - es.array.iterator { "chrome":"52", "firefox":"50", "ie":"11" } - es.map { "firefox":"50", "ie":"11" } - es.object.to-string { "firefox":"50", "ie":"11" } - es.promise { "chrome":"52", "firefox":"50", "ie":"11" } - es.string.iterator { "ie":"11" } - web.dom-collections.iterator { "chrome":"52", "firefox":"50", "ie":"11" } - web.queue-microtask { "chrome":"52", "firefox":"50", "ie":"11" } - esnext.global-this { "chrome":"52", "firefox":"50", "ie":"11" } - -[/src/in2.js] Added following core-js polyfills: - es.array.iterator { "chrome":"52", "firefox":"50", "ie":"11" } - es.string.iterator { "ie":"11" } - web.dom-collections.iterator { "chrome":"52", "firefox":"50", "ie":"11" } - -[/src/in2.js] Based on your code and targets, added regenerator-runtime. -Successfully compiled 2 files with Babel. \ No newline at end of file diff --git a/packages/babel-preset-env/test/debug-fixtures/usage-corejs3-versions-strings-minor-3.0/options.json b/packages/babel-preset-env/test/debug-fixtures/usage-corejs3-versions-strings-minor-3.0/options.json deleted file mode 100644 index b0adb5c0910f..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/usage-corejs3-versions-strings-minor-3.0/options.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "presets": [ - ["../../lib", { - "debug": true, - "targets": { - "chrome": 52, - "firefox": 50, - "ie": 11 - }, - "useBuiltIns": "usage", - "corejs": "3.0" - }] - ] -} diff --git a/packages/babel-preset-env/test/debug-fixtures/usage-corejs3-versions-strings-minor-3.0/stdout.txt b/packages/babel-preset-env/test/debug-fixtures/usage-corejs3-versions-strings-minor-3.0/stdout.txt deleted file mode 100644 index 5c7a63345026..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/usage-corejs3-versions-strings-minor-3.0/stdout.txt +++ /dev/null @@ -1,59 +0,0 @@ -@babel/preset-env: `DEBUG` option - -Using targets: -{ - "chrome": "52", - "firefox": "50", - "ie": "11" -} - -Using modules transform: auto - -Using plugins: - transform-template-literals { "ie":"11" } - transform-literals { "firefox":"50", "ie":"11" } - transform-function-name { "firefox":"50", "ie":"11" } - transform-arrow-functions { "ie":"11" } - transform-classes { "ie":"11" } - transform-object-super { "ie":"11" } - transform-shorthand-properties { "ie":"11" } - transform-duplicate-keys { "ie":"11" } - transform-computed-properties { "ie":"11" } - transform-for-of { "firefox":"50", "ie":"11" } - transform-sticky-regex { "ie":"11" } - transform-dotall-regex { "chrome":"52", "firefox":"50", "ie":"11" } - transform-unicode-regex { "ie":"11" } - transform-spread { "ie":"11" } - transform-parameters { "firefox":"50", "ie":"11" } - transform-destructuring { "firefox":"50", "ie":"11" } - transform-block-scoping { "firefox":"50", "ie":"11" } - transform-typeof-symbol { "ie":"11" } - transform-new-target { "ie":"11" } - transform-regenerator { "firefox":"50", "ie":"11" } - transform-exponentiation-operator { "firefox":"50", "ie":"11" } - transform-async-to-generator { "chrome":"52", "firefox":"50", "ie":"11" } - proposal-async-generator-functions { "chrome":"52", "firefox":"50", "ie":"11" } - proposal-object-rest-spread { "chrome":"52", "firefox":"50", "ie":"11" } - proposal-unicode-property-regex { "chrome":"52", "firefox":"50", "ie":"11" } - proposal-json-strings { "chrome":"52", "firefox":"50", "ie":"11" } - proposal-optional-catch-binding { "chrome":"52", "firefox":"50", "ie":"11" } - transform-named-capturing-groups-regex { "chrome":"52", "firefox":"50", "ie":"11" } - -Using polyfills with `usage` option: - -[/src/in.js] Added following core-js polyfills: - es.array.iterator { "chrome":"52", "firefox":"50", "ie":"11" } - es.map { "firefox":"50", "ie":"11" } - es.object.to-string { "firefox":"50", "ie":"11" } - es.promise { "chrome":"52", "firefox":"50", "ie":"11" } - es.string.iterator { "ie":"11" } - web.dom-collections.iterator { "chrome":"52", "firefox":"50", "ie":"11" } - web.queue-microtask { "chrome":"52", "firefox":"50", "ie":"11" } - -[/src/in2.js] Added following core-js polyfills: - es.array.iterator { "chrome":"52", "firefox":"50", "ie":"11" } - es.string.iterator { "ie":"11" } - web.dom-collections.iterator { "chrome":"52", "firefox":"50", "ie":"11" } - -[/src/in2.js] Based on your code and targets, added regenerator-runtime. -Successfully compiled 2 files with Babel. \ No newline at end of file diff --git a/packages/babel-preset-env/test/debug-fixtures/usage-corejs3-versions-strings-minor-3.1/options.json b/packages/babel-preset-env/test/debug-fixtures/usage-corejs3-versions-strings-minor-3.1/options.json deleted file mode 100644 index c2e64be32390..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/usage-corejs3-versions-strings-minor-3.1/options.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "presets": [ - ["../../lib", { - "debug": true, - "targets": { - "chrome": 52, - "firefox": 50, - "ie": 11 - }, - "useBuiltIns": "usage", - "corejs": "3.1" - }] - ] -} diff --git a/packages/babel-preset-env/test/debug-fixtures/usage-corejs3-versions-strings-minor-3.1/stdout.txt b/packages/babel-preset-env/test/debug-fixtures/usage-corejs3-versions-strings-minor-3.1/stdout.txt deleted file mode 100644 index 5c7a63345026..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/usage-corejs3-versions-strings-minor-3.1/stdout.txt +++ /dev/null @@ -1,59 +0,0 @@ -@babel/preset-env: `DEBUG` option - -Using targets: -{ - "chrome": "52", - "firefox": "50", - "ie": "11" -} - -Using modules transform: auto - -Using plugins: - transform-template-literals { "ie":"11" } - transform-literals { "firefox":"50", "ie":"11" } - transform-function-name { "firefox":"50", "ie":"11" } - transform-arrow-functions { "ie":"11" } - transform-classes { "ie":"11" } - transform-object-super { "ie":"11" } - transform-shorthand-properties { "ie":"11" } - transform-duplicate-keys { "ie":"11" } - transform-computed-properties { "ie":"11" } - transform-for-of { "firefox":"50", "ie":"11" } - transform-sticky-regex { "ie":"11" } - transform-dotall-regex { "chrome":"52", "firefox":"50", "ie":"11" } - transform-unicode-regex { "ie":"11" } - transform-spread { "ie":"11" } - transform-parameters { "firefox":"50", "ie":"11" } - transform-destructuring { "firefox":"50", "ie":"11" } - transform-block-scoping { "firefox":"50", "ie":"11" } - transform-typeof-symbol { "ie":"11" } - transform-new-target { "ie":"11" } - transform-regenerator { "firefox":"50", "ie":"11" } - transform-exponentiation-operator { "firefox":"50", "ie":"11" } - transform-async-to-generator { "chrome":"52", "firefox":"50", "ie":"11" } - proposal-async-generator-functions { "chrome":"52", "firefox":"50", "ie":"11" } - proposal-object-rest-spread { "chrome":"52", "firefox":"50", "ie":"11" } - proposal-unicode-property-regex { "chrome":"52", "firefox":"50", "ie":"11" } - proposal-json-strings { "chrome":"52", "firefox":"50", "ie":"11" } - proposal-optional-catch-binding { "chrome":"52", "firefox":"50", "ie":"11" } - transform-named-capturing-groups-regex { "chrome":"52", "firefox":"50", "ie":"11" } - -Using polyfills with `usage` option: - -[/src/in.js] Added following core-js polyfills: - es.array.iterator { "chrome":"52", "firefox":"50", "ie":"11" } - es.map { "firefox":"50", "ie":"11" } - es.object.to-string { "firefox":"50", "ie":"11" } - es.promise { "chrome":"52", "firefox":"50", "ie":"11" } - es.string.iterator { "ie":"11" } - web.dom-collections.iterator { "chrome":"52", "firefox":"50", "ie":"11" } - web.queue-microtask { "chrome":"52", "firefox":"50", "ie":"11" } - -[/src/in2.js] Added following core-js polyfills: - es.array.iterator { "chrome":"52", "firefox":"50", "ie":"11" } - es.string.iterator { "ie":"11" } - web.dom-collections.iterator { "chrome":"52", "firefox":"50", "ie":"11" } - -[/src/in2.js] Based on your code and targets, added regenerator-runtime. -Successfully compiled 2 files with Babel. \ No newline at end of file diff --git a/packages/babel-preset-env/test/debug-fixtures/usage-corejs3-with-import/options.json b/packages/babel-preset-env/test/debug-fixtures/usage-corejs3-with-import/options.json deleted file mode 100644 index 66118c78ad68..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/usage-corejs3-with-import/options.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "presets": [ - ["../../lib", { - "debug": true, - "targets": { - "chrome": 55 - }, - "useBuiltIns": "usage", - "corejs": 3 - }] - ] -} diff --git a/packages/babel-preset-env/test/debug-fixtures/usage-corejs3-with-import/stdout.txt b/packages/babel-preset-env/test/debug-fixtures/usage-corejs3-with-import/stdout.txt deleted file mode 100644 index e976e00c5f93..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/usage-corejs3-with-import/stdout.txt +++ /dev/null @@ -1,22 +0,0 @@ -@babel/preset-env: `DEBUG` option - -Using targets: -{ - "chrome": "55" -} - -Using modules transform: auto - -Using plugins: - transform-dotall-regex { "chrome":"55" } - proposal-async-generator-functions { "chrome":"55" } - proposal-object-rest-spread { "chrome":"55" } - proposal-unicode-property-regex { "chrome":"55" } - proposal-json-strings { "chrome":"55" } - proposal-optional-catch-binding { "chrome":"55" } - transform-named-capturing-groups-regex { "chrome":"55" } - -Using polyfills with `usage` option: - -[/src/in.js] Based on your code and targets, core-js polyfills were not added. -Successfully compiled 1 file with Babel. \ No newline at end of file diff --git a/packages/babel-preset-env/test/debug-fixtures/usage-corejs3/options.json b/packages/babel-preset-env/test/debug-fixtures/usage-corejs3/options.json deleted file mode 100644 index 6c2922e8970d..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/usage-corejs3/options.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "presets": [ - ["../../lib", { - "debug": true, - "targets": { - "chrome": 52, - "firefox": 50, - "ie": 11 - }, - "useBuiltIns": "usage", - "corejs": 3 - }] - ] -} diff --git a/packages/babel-preset-env/test/debug-fixtures/usage-corejs3/stdout.txt b/packages/babel-preset-env/test/debug-fixtures/usage-corejs3/stdout.txt deleted file mode 100644 index 5c7a63345026..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/usage-corejs3/stdout.txt +++ /dev/null @@ -1,59 +0,0 @@ -@babel/preset-env: `DEBUG` option - -Using targets: -{ - "chrome": "52", - "firefox": "50", - "ie": "11" -} - -Using modules transform: auto - -Using plugins: - transform-template-literals { "ie":"11" } - transform-literals { "firefox":"50", "ie":"11" } - transform-function-name { "firefox":"50", "ie":"11" } - transform-arrow-functions { "ie":"11" } - transform-classes { "ie":"11" } - transform-object-super { "ie":"11" } - transform-shorthand-properties { "ie":"11" } - transform-duplicate-keys { "ie":"11" } - transform-computed-properties { "ie":"11" } - transform-for-of { "firefox":"50", "ie":"11" } - transform-sticky-regex { "ie":"11" } - transform-dotall-regex { "chrome":"52", "firefox":"50", "ie":"11" } - transform-unicode-regex { "ie":"11" } - transform-spread { "ie":"11" } - transform-parameters { "firefox":"50", "ie":"11" } - transform-destructuring { "firefox":"50", "ie":"11" } - transform-block-scoping { "firefox":"50", "ie":"11" } - transform-typeof-symbol { "ie":"11" } - transform-new-target { "ie":"11" } - transform-regenerator { "firefox":"50", "ie":"11" } - transform-exponentiation-operator { "firefox":"50", "ie":"11" } - transform-async-to-generator { "chrome":"52", "firefox":"50", "ie":"11" } - proposal-async-generator-functions { "chrome":"52", "firefox":"50", "ie":"11" } - proposal-object-rest-spread { "chrome":"52", "firefox":"50", "ie":"11" } - proposal-unicode-property-regex { "chrome":"52", "firefox":"50", "ie":"11" } - proposal-json-strings { "chrome":"52", "firefox":"50", "ie":"11" } - proposal-optional-catch-binding { "chrome":"52", "firefox":"50", "ie":"11" } - transform-named-capturing-groups-regex { "chrome":"52", "firefox":"50", "ie":"11" } - -Using polyfills with `usage` option: - -[/src/in.js] Added following core-js polyfills: - es.array.iterator { "chrome":"52", "firefox":"50", "ie":"11" } - es.map { "firefox":"50", "ie":"11" } - es.object.to-string { "firefox":"50", "ie":"11" } - es.promise { "chrome":"52", "firefox":"50", "ie":"11" } - es.string.iterator { "ie":"11" } - web.dom-collections.iterator { "chrome":"52", "firefox":"50", "ie":"11" } - web.queue-microtask { "chrome":"52", "firefox":"50", "ie":"11" } - -[/src/in2.js] Added following core-js polyfills: - es.array.iterator { "chrome":"52", "firefox":"50", "ie":"11" } - es.string.iterator { "ie":"11" } - web.dom-collections.iterator { "chrome":"52", "firefox":"50", "ie":"11" } - -[/src/in2.js] Based on your code and targets, added regenerator-runtime. -Successfully compiled 2 files with Babel. \ No newline at end of file diff --git a/packages/babel-preset-env/test/debug-fixtures/usage-no-corejs-none/options.json b/packages/babel-preset-env/test/debug-fixtures/usage-no-corejs-none/options.json deleted file mode 100644 index f1f5db8b10f6..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/usage-no-corejs-none/options.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "presets": [ - ["../../lib", { - "debug": true, - "targets": { - "chrome": 52, - "firefox": 50, - "ie": 11 - }, - "useBuiltIns": "usage" - }] - ] -} diff --git a/packages/babel-preset-env/test/debug-fixtures/usage-no-corejs-none/stdout.txt b/packages/babel-preset-env/test/debug-fixtures/usage-no-corejs-none/stdout.txt deleted file mode 100644 index fafdcfca187c..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/usage-no-corejs-none/stdout.txt +++ /dev/null @@ -1,47 +0,0 @@ -@babel/preset-env: `DEBUG` option - -Using targets: -{ - "chrome": "52", - "firefox": "50", - "ie": "11" -} - -Using modules transform: auto - -Using plugins: - transform-template-literals { "ie":"11" } - transform-literals { "firefox":"50", "ie":"11" } - transform-function-name { "firefox":"50", "ie":"11" } - transform-arrow-functions { "ie":"11" } - transform-classes { "ie":"11" } - transform-object-super { "ie":"11" } - transform-shorthand-properties { "ie":"11" } - transform-duplicate-keys { "ie":"11" } - transform-computed-properties { "ie":"11" } - transform-for-of { "firefox":"50", "ie":"11" } - transform-sticky-regex { "ie":"11" } - transform-dotall-regex { "chrome":"52", "firefox":"50", "ie":"11" } - transform-unicode-regex { "ie":"11" } - transform-spread { "ie":"11" } - transform-parameters { "firefox":"50", "ie":"11" } - transform-destructuring { "firefox":"50", "ie":"11" } - transform-block-scoping { "firefox":"50", "ie":"11" } - transform-typeof-symbol { "ie":"11" } - transform-new-target { "ie":"11" } - transform-regenerator { "firefox":"50", "ie":"11" } - transform-exponentiation-operator { "firefox":"50", "ie":"11" } - transform-async-to-generator { "chrome":"52", "firefox":"50", "ie":"11" } - proposal-async-generator-functions { "chrome":"52", "firefox":"50", "ie":"11" } - proposal-object-rest-spread { "chrome":"52", "firefox":"50", "ie":"11" } - proposal-unicode-property-regex { "chrome":"52", "firefox":"50", "ie":"11" } - proposal-json-strings { "chrome":"52", "firefox":"50", "ie":"11" } - proposal-optional-catch-binding { "chrome":"52", "firefox":"50", "ie":"11" } - transform-named-capturing-groups-regex { "chrome":"52", "firefox":"50", "ie":"11" } - -Using polyfills with `usage` option: - -[/src/in.js] Based on your code and targets, core-js polyfills were not added. - -[/src/in2.js] Based on your code and targets, core-js polyfills were not added. -Successfully compiled 2 files with Babel. \ No newline at end of file diff --git a/packages/babel-preset-env/test/debug-fixtures/usage-no-corejs/options.json b/packages/babel-preset-env/test/debug-fixtures/usage-no-corejs/options.json deleted file mode 100644 index f1f5db8b10f6..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/usage-no-corejs/options.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "presets": [ - ["../../lib", { - "debug": true, - "targets": { - "chrome": 52, - "firefox": 50, - "ie": 11 - }, - "useBuiltIns": "usage" - }] - ] -} diff --git a/packages/babel-preset-env/test/debug-fixtures/usage-no-corejs/stdout.txt b/packages/babel-preset-env/test/debug-fixtures/usage-no-corejs/stdout.txt deleted file mode 100644 index 8d1136d823bd..000000000000 --- a/packages/babel-preset-env/test/debug-fixtures/usage-no-corejs/stdout.txt +++ /dev/null @@ -1,56 +0,0 @@ -@babel/preset-env: `DEBUG` option - -Using targets: -{ - "chrome": "52", - "firefox": "50", - "ie": "11" -} - -Using modules transform: auto - -Using plugins: - transform-template-literals { "ie":"11" } - transform-literals { "firefox":"50", "ie":"11" } - transform-function-name { "firefox":"50", "ie":"11" } - transform-arrow-functions { "ie":"11" } - transform-classes { "ie":"11" } - transform-object-super { "ie":"11" } - transform-shorthand-properties { "ie":"11" } - transform-duplicate-keys { "ie":"11" } - transform-computed-properties { "ie":"11" } - transform-for-of { "firefox":"50", "ie":"11" } - transform-sticky-regex { "ie":"11" } - transform-dotall-regex { "chrome":"52", "firefox":"50", "ie":"11" } - transform-unicode-regex { "ie":"11" } - transform-spread { "ie":"11" } - transform-parameters { "firefox":"50", "ie":"11" } - transform-destructuring { "firefox":"50", "ie":"11" } - transform-block-scoping { "firefox":"50", "ie":"11" } - transform-typeof-symbol { "ie":"11" } - transform-new-target { "ie":"11" } - transform-regenerator { "firefox":"50", "ie":"11" } - transform-exponentiation-operator { "firefox":"50", "ie":"11" } - transform-async-to-generator { "chrome":"52", "firefox":"50", "ie":"11" } - proposal-async-generator-functions { "chrome":"52", "firefox":"50", "ie":"11" } - proposal-object-rest-spread { "chrome":"52", "firefox":"50", "ie":"11" } - proposal-unicode-property-regex { "chrome":"52", "firefox":"50", "ie":"11" } - proposal-json-strings { "chrome":"52", "firefox":"50", "ie":"11" } - proposal-optional-catch-binding { "chrome":"52", "firefox":"50", "ie":"11" } - transform-named-capturing-groups-regex { "chrome":"52", "firefox":"50", "ie":"11" } - -Using polyfills with `usage` option: - -[/src/in.js] Added following core-js polyfills: - es6.object.to-string { "chrome":"52", "firefox":"50", "ie":"11" } - es6.promise { "ie":"11" } - es6.map { "firefox":"50", "ie":"11" } - es6.string.iterator { "ie":"11" } - es6.array.iterator { "ie":"11" } - web.dom.iterable { "chrome":"52", "firefox":"50", "ie":"11" } - -[/src/in2.js] Added following core-js polyfill: - web.dom.iterable { "chrome":"52", "firefox":"50", "ie":"11" } - -[/src/in2.js] Based on your code and targets, added regenerator-runtime. -Successfully compiled 2 files with Babel. \ No newline at end of file diff --git a/packages/babel-preset-env/test/fixtures/.plugins-overlapping/chrome-49/input.js b/packages/babel-preset-env/test/fixtures/.plugins-overlapping/chrome-49/input.js new file mode 100644 index 000000000000..9604ae0250bb --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/.plugins-overlapping/chrome-49/input.js @@ -0,0 +1 @@ +async function foo() {} \ No newline at end of file diff --git a/packages/babel-preset-env/test/fixtures/.plugins-overlapping/chrome-49/options.json b/packages/babel-preset-env/test/fixtures/.plugins-overlapping/chrome-49/options.json new file mode 100644 index 000000000000..41ee66e16cc0 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/.plugins-overlapping/chrome-49/options.json @@ -0,0 +1,11 @@ +{ + "plugins": [], + "presets": [ + [ + "../../../../lib", + { + "targets": { "chrome": "49" } + } + ] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/.plugins-overlapping/chrome-49/output.js b/packages/babel-preset-env/test/fixtures/.plugins-overlapping/chrome-49/output.js new file mode 100644 index 000000000000..19684e4a4db3 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/.plugins-overlapping/chrome-49/output.js @@ -0,0 +1,9 @@ +function foo() { + return regeneratorRuntime.async(function foo$(_context) { + while (1) switch (_context.prev = _context.next) { + case 0: + case "end": + return _context.stop(); + } + }); +} diff --git a/packages/babel-preset-env/test/fixtures/.plugins-overlapping/chrome-50/input.js b/packages/babel-preset-env/test/fixtures/.plugins-overlapping/chrome-50/input.js new file mode 100644 index 000000000000..9604ae0250bb --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/.plugins-overlapping/chrome-50/input.js @@ -0,0 +1 @@ +async function foo() {} \ No newline at end of file diff --git a/packages/babel-preset-env/test/fixtures/.plugins-overlapping/chrome-50/options.json b/packages/babel-preset-env/test/fixtures/.plugins-overlapping/chrome-50/options.json new file mode 100644 index 000000000000..df56e583e65b --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/.plugins-overlapping/chrome-50/options.json @@ -0,0 +1,11 @@ +{ + "plugins": [], + "presets": [ + [ + "../../../../lib", + { + "targets": { "chrome": "50" } + } + ] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/.plugins-overlapping/chrome-50/output.js b/packages/babel-preset-env/test/fixtures/.plugins-overlapping/chrome-50/output.js new file mode 100644 index 000000000000..d69b16f0660c --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/.plugins-overlapping/chrome-50/output.js @@ -0,0 +1,12 @@ +function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } } + +function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; } + +function foo() { + return _foo.apply(this, arguments); +} + +function _foo() { + _foo = _asyncToGenerator(function* () {}); + return _foo.apply(this, arguments); +} diff --git a/packages/babel-preset-env/test/fixtures/.plugins-overlapping/chrome-54/input.js b/packages/babel-preset-env/test/fixtures/.plugins-overlapping/chrome-54/input.js new file mode 100644 index 000000000000..9604ae0250bb --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/.plugins-overlapping/chrome-54/input.js @@ -0,0 +1 @@ +async function foo() {} \ No newline at end of file diff --git a/packages/babel-preset-env/test/fixtures/.plugins-overlapping/chrome-54/options.json b/packages/babel-preset-env/test/fixtures/.plugins-overlapping/chrome-54/options.json new file mode 100644 index 000000000000..d76f324a91bb --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/.plugins-overlapping/chrome-54/options.json @@ -0,0 +1,11 @@ +{ + "plugins": [], + "presets": [ + [ + "../../../../lib", + { + "targets": { "chrome": "54" } + } + ] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/.plugins-overlapping/chrome-54/output.js b/packages/babel-preset-env/test/fixtures/.plugins-overlapping/chrome-54/output.js new file mode 100644 index 000000000000..d69b16f0660c --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/.plugins-overlapping/chrome-54/output.js @@ -0,0 +1,12 @@ +function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } } + +function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; } + +function foo() { + return _foo.apply(this, arguments); +} + +function _foo() { + _foo = _asyncToGenerator(function* () {}); + return _foo.apply(this, arguments); +} diff --git a/packages/babel-preset-env/test/fixtures/.plugins-overlapping/chrome-55/input.js b/packages/babel-preset-env/test/fixtures/.plugins-overlapping/chrome-55/input.js new file mode 100644 index 000000000000..9604ae0250bb --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/.plugins-overlapping/chrome-55/input.js @@ -0,0 +1 @@ +async function foo() {} \ No newline at end of file diff --git a/packages/babel-preset-env/test/fixtures/.plugins-overlapping/chrome-55/options.json b/packages/babel-preset-env/test/fixtures/.plugins-overlapping/chrome-55/options.json new file mode 100644 index 000000000000..c08a917cbc95 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/.plugins-overlapping/chrome-55/options.json @@ -0,0 +1,11 @@ +{ + "plugins": [], + "presets": [ + [ + "../../../../lib", + { + "targets": { "chrome": "55" } + } + ] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/.plugins-overlapping/chrome-55/output.js b/packages/babel-preset-env/test/fixtures/.plugins-overlapping/chrome-55/output.js new file mode 100644 index 000000000000..f9df9686dd67 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/.plugins-overlapping/chrome-55/output.js @@ -0,0 +1 @@ +async function foo() {} diff --git a/packages/babel-preset-env/test/fixtures/corejs2/entry-shippedProposals/output.js b/packages/babel-preset-env/test/fixtures/corejs2/entry-shippedProposals/output.js index 6618653a758e..54c32b60fc2c 100644 --- a/packages/babel-preset-env/test/fixtures/corejs2/entry-shippedProposals/output.js +++ b/packages/babel-preset-env/test/fixtures/corejs2/entry-shippedProposals/output.js @@ -298,7 +298,7 @@ require("regenerator-runtime/runtime"); function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } -function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } +function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } @@ -310,7 +310,7 @@ function _awaitAsyncGenerator(value) { return new _AwaitValue(value); } function _wrapAsyncGenerator(fn) { return function () { return new _AsyncGenerator(fn.apply(this, arguments)); }; } -function _AsyncGenerator(gen) { var front, back; function send(key, arg) { return new Promise(function (resolve, reject) { var request = { key: key, arg: arg, resolve: resolve, reject: reject, next: null }; if (back) { back = back.next = request; } else { front = back = request; resume(key, arg); } }); } function resume(key, arg) { try { var result = gen[key](arg); var value = result.value; var wrappedAwait = value instanceof _AwaitValue; Promise.resolve(wrappedAwait ? value.wrapped : value).then(function (arg) { if (wrappedAwait) { resume("next", arg); return; } settle(result.done ? "return" : "normal", arg); }, function (err) { resume("throw", err); }); } catch (err) { settle("throw", err); } } function settle(type, value) { switch (type) { case "return": front.resolve({ value: value, done: true }); break; case "throw": front.reject(value); break; default: front.resolve({ value: value, done: false }); break; } front = front.next; if (front) { resume(front.key, front.arg); } else { back = null; } } this._invoke = send; if (typeof gen["return"] !== "function") { this["return"] = undefined; } } +function _AsyncGenerator(gen) { var front, back; function send(key, arg) { return new Promise(function (resolve, reject) { var request = { key: key, arg: arg, resolve: resolve, reject: reject, next: null }; if (back) { back = back.next = request; } else { front = back = request; resume(key, arg); } }); } function resume(key, arg) { try { var result = gen[key](arg); var value = result.value; var wrappedAwait = value instanceof _AwaitValue; Promise.resolve(wrappedAwait ? value.wrapped : value).then(function (arg) { if (wrappedAwait) { resume(key === "return" ? "return" : "next", arg); return; } settle(result.done ? "return" : "normal", arg); }, function (err) { resume("throw", err); }); } catch (err) { settle("throw", err); } } function settle(type, value) { switch (type) { case "return": front.resolve({ value: value, done: true }); break; case "throw": front.reject(value); break; default: front.resolve({ value: value, done: false }); break; } front = front.next; if (front) { resume(front.key, front.arg); } else { back = null; } } this._invoke = send; if (typeof gen["return"] !== "function") { this["return"] = undefined; } } if (typeof Symbol === "function" && Symbol.asyncIterator) { _AsyncGenerator.prototype[Symbol.asyncIterator] = function () { return this; }; } diff --git a/packages/babel-preset-env/test/fixtures/corejs2/usage-browserslist-config-ignore/options.json b/packages/babel-preset-env/test/fixtures/corejs2/usage-browserslist-config-ignore/options.json index f0e1e2cba61d..d7dca0ca75ef 100644 --- a/packages/babel-preset-env/test/fixtures/corejs2/usage-browserslist-config-ignore/options.json +++ b/packages/babel-preset-env/test/fixtures/corejs2/usage-browserslist-config-ignore/options.json @@ -1,4 +1,5 @@ { + "validateLogs": true, "presets": [ [ "../../../../lib", diff --git a/packages/babel-preset-env/test/fixtures/corejs2/usage-browserslist-config-ignore/stdout.txt b/packages/babel-preset-env/test/fixtures/corejs2/usage-browserslist-config-ignore/stdout.txt new file mode 100644 index 000000000000..1177233c1854 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/corejs2/usage-browserslist-config-ignore/stdout.txt @@ -0,0 +1,36 @@ +@babel/preset-env: `DEBUG` option + +Using targets: +{ + "chrome": "61", + "edge": "16", + "firefox": "60", + "ios": "10.3", + "opera": "48", + "safari": "10.1" +} + +Using modules transform: false + +Using plugins: + transform-template-literals { "ios":"10.3", "safari":"10.1" } + transform-function-name { "edge":"16" } + transform-dotall-regex { "chrome":"61", "edge":"16", "firefox":"60", "ios":"10.3", "opera":"48", "safari":"10.1" } + transform-unicode-regex { "ios":"10.3", "safari":"10.1" } + transform-parameters { "edge":"16" } + transform-block-scoping { "ios":"10.3", "safari":"10.1" } + transform-async-to-generator { "ios":"10.3", "safari":"10.1" } + proposal-async-generator-functions { "chrome":"61", "edge":"16", "ios":"10.3", "opera":"48", "safari":"10.1" } + proposal-object-rest-spread { "edge":"16", "ios":"10.3", "safari":"10.1" } + proposal-unicode-property-regex { "chrome":"61", "edge":"16", "firefox":"60", "ios":"10.3", "opera":"48", "safari":"10.1" } + proposal-json-strings { "chrome":"61", "edge":"16", "firefox":"60", "ios":"10.3", "opera":"48", "safari":"10.1" } + proposal-optional-catch-binding { "chrome":"61", "edge":"16", "ios":"10.3", "opera":"48", "safari":"10.1" } + proposal-optional-chaining { "chrome":"61", "edge":"16", "firefox":"60", "ios":"10.3", "opera":"48", "safari":"10.1" } + transform-named-capturing-groups-regex { "chrome":"61", "edge":"16", "firefox":"60", "ios":"10.3", "opera":"48", "safari":"10.1" } + proposal-nullish-coalescing-operator { "chrome":"61", "edge":"16", "firefox":"60", "ios":"10.3", "opera":"48", "safari":"10.1" } + syntax-dynamic-import { "chrome":"61", "edge":"16", "firefox":"60", "ios":"10.3", "opera":"48", "safari":"10.1" } + +Using polyfills with `usage` option: + +[/packages/babel-preset-env/test/fixtures/corejs2/usage-browserslist-config-ignore/input.mjs] Added following core-js polyfill: + web.dom.iterable { "chrome":"61", "edge":"16", "firefox":"60", "ios":"10.3", "opera":"48", "safari":"10.1" } diff --git a/packages/babel-preset-env/test/fixtures/corejs2/usage-evaluated-not-confident/input.mjs b/packages/babel-preset-env/test/fixtures/corejs2/usage-evaluated-not-confident/input.mjs new file mode 100644 index 000000000000..279b65c0b53e --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/corejs2/usage-evaluated-not-confident/input.mjs @@ -0,0 +1,5 @@ +Object['values'](); // include +[]['map'](); // include + +Object[keys](); // don't include +[][filter](); // don't include diff --git a/packages/babel-preset-env/test/fixtures/corejs2/usage-evaluated-not-confident/options.json b/packages/babel-preset-env/test/fixtures/corejs2/usage-evaluated-not-confident/options.json new file mode 100644 index 000000000000..fe3e4d6cf9c9 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/corejs2/usage-evaluated-not-confident/options.json @@ -0,0 +1,12 @@ +{ + "presets": [ + [ + "../../../../lib", + { + "useBuiltIns": "usage", + "corejs": 2, + "modules": false + } + ] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/corejs2/usage-evaluated-not-confident/output.mjs b/packages/babel-preset-env/test/fixtures/corejs2/usage-evaluated-not-confident/output.mjs new file mode 100644 index 000000000000..dfd826b75852 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/corejs2/usage-evaluated-not-confident/output.mjs @@ -0,0 +1,12 @@ +import "core-js/modules/es6.array.map"; +import "core-js/modules/web.dom.iterable"; +import "core-js/modules/es6.array.iterator"; +import "core-js/modules/es6.object.to-string"; +import "core-js/modules/es7.object.values"; +Object['values'](); // include + +[]['map'](); // include + +Object[keys](); // don't include + +[][filter](); // don't include diff --git a/packages/babel-preset-env/test/fixtures/corejs2/usage-for-of-destructure-with/output.mjs b/packages/babel-preset-env/test/fixtures/corejs2/usage-for-of-destructure-with/output.mjs index 18b1bb0bfb15..6762f8384120 100644 --- a/packages/babel-preset-env/test/fixtures/corejs2/usage-for-of-destructure-with/output.mjs +++ b/packages/babel-preset-env/test/fixtures/corejs2/usage-for-of-destructure-with/output.mjs @@ -1,9 +1,8 @@ import "core-js/modules/es7.string.pad-end"; import "core-js/modules/es7.string.pad-start"; -for (const _ref of foo) { - const { - padStart - } = _ref; +for (const { + padStart +} of foo) { console.log('b'.padEnd(5)); } diff --git a/packages/babel-preset-env/test/fixtures/corejs2/usage-modules-namespaced/input.mjs b/packages/babel-preset-env/test/fixtures/corejs2/usage-modules-namespaced/input.mjs new file mode 100644 index 000000000000..3f57abb6052e --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/corejs2/usage-modules-namespaced/input.mjs @@ -0,0 +1,2 @@ +import * as ns from "ns"; +ns.map; diff --git a/packages/babel-preset-env/test/fixtures/corejs2/usage-modules-namespaced/options.json b/packages/babel-preset-env/test/fixtures/corejs2/usage-modules-namespaced/options.json new file mode 100644 index 000000000000..429ee132c960 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/corejs2/usage-modules-namespaced/options.json @@ -0,0 +1,12 @@ +{ + "presets": [ + [ + "../../../../lib", + { + "modules": false, + "useBuiltIns": "usage", + "corejs": 2 + } + ] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/corejs2/usage-modules-namespaced/output.mjs b/packages/babel-preset-env/test/fixtures/corejs2/usage-modules-namespaced/output.mjs new file mode 100644 index 000000000000..4efb9b0a495f --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/corejs2/usage-modules-namespaced/output.mjs @@ -0,0 +1,3 @@ +import * as ns from "ns"; +ns.map; + diff --git a/packages/babel-preset-env/test/fixtures/corejs2/usage-remove-babel-polyfill-import/options.json b/packages/babel-preset-env/test/fixtures/corejs2/usage-remove-babel-polyfill-import/options.json index fe3e4d6cf9c9..71b68e4379e7 100644 --- a/packages/babel-preset-env/test/fixtures/corejs2/usage-remove-babel-polyfill-import/options.json +++ b/packages/babel-preset-env/test/fixtures/corejs2/usage-remove-babel-polyfill-import/options.json @@ -1,4 +1,5 @@ { + "validateLogs": true, "presets": [ [ "../../../../lib", diff --git a/packages/babel-preset-env/test/fixtures/corejs2/usage-remove-babel-polyfill-import/output.mjs b/packages/babel-preset-env/test/fixtures/corejs2/usage-remove-babel-polyfill-import/output.mjs new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/packages/babel-preset-env/test/fixtures/corejs2/usage-remove-babel-polyfill-import/stderr.txt b/packages/babel-preset-env/test/fixtures/corejs2/usage-remove-babel-polyfill-import/stderr.txt new file mode 100644 index 000000000000..6234fa874573 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/corejs2/usage-remove-babel-polyfill-import/stderr.txt @@ -0,0 +1,11 @@ +When setting `useBuiltIns: 'usage'`, polyfills are automatically imported when needed. + Please remove the `import '@babel/polyfill'` call or use `useBuiltIns: 'entry'` instead. + + When setting `useBuiltIns: 'usage'`, polyfills are automatically imported when needed. + Please remove the `import '@babel/polyfill'` call or use `useBuiltIns: 'entry'` instead. + + When setting `useBuiltIns: 'usage'`, polyfills are automatically imported when needed. + Please remove the `import '@babel/polyfill'` call or use `useBuiltIns: 'entry'` instead. + + When setting `useBuiltIns: 'usage'`, polyfills are automatically imported when needed. + Please remove the `import '@babel/polyfill'` call or use `useBuiltIns: 'entry'` instead. diff --git a/packages/babel-preset-env/test/fixtures/corejs2/usage-shippedProposals/output.js b/packages/babel-preset-env/test/fixtures/corejs2/usage-shippedProposals/output.js index 341d5845145e..53afb8206c83 100644 --- a/packages/babel-preset-env/test/fixtures/corejs2/usage-shippedProposals/output.js +++ b/packages/babel-preset-env/test/fixtures/corejs2/usage-shippedProposals/output.js @@ -30,7 +30,7 @@ require("core-js/modules/es6.object.to-string"); function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } -function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } +function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } @@ -42,7 +42,7 @@ function _awaitAsyncGenerator(value) { return new _AwaitValue(value); } function _wrapAsyncGenerator(fn) { return function () { return new _AsyncGenerator(fn.apply(this, arguments)); }; } -function _AsyncGenerator(gen) { var front, back; function send(key, arg) { return new Promise(function (resolve, reject) { var request = { key: key, arg: arg, resolve: resolve, reject: reject, next: null }; if (back) { back = back.next = request; } else { front = back = request; resume(key, arg); } }); } function resume(key, arg) { try { var result = gen[key](arg); var value = result.value; var wrappedAwait = value instanceof _AwaitValue; Promise.resolve(wrappedAwait ? value.wrapped : value).then(function (arg) { if (wrappedAwait) { resume("next", arg); return; } settle(result.done ? "return" : "normal", arg); }, function (err) { resume("throw", err); }); } catch (err) { settle("throw", err); } } function settle(type, value) { switch (type) { case "return": front.resolve({ value: value, done: true }); break; case "throw": front.reject(value); break; default: front.resolve({ value: value, done: false }); break; } front = front.next; if (front) { resume(front.key, front.arg); } else { back = null; } } this._invoke = send; if (typeof gen["return"] !== "function") { this["return"] = undefined; } } +function _AsyncGenerator(gen) { var front, back; function send(key, arg) { return new Promise(function (resolve, reject) { var request = { key: key, arg: arg, resolve: resolve, reject: reject, next: null }; if (back) { back = back.next = request; } else { front = back = request; resume(key, arg); } }); } function resume(key, arg) { try { var result = gen[key](arg); var value = result.value; var wrappedAwait = value instanceof _AwaitValue; Promise.resolve(wrappedAwait ? value.wrapped : value).then(function (arg) { if (wrappedAwait) { resume(key === "return" ? "return" : "next", arg); return; } settle(result.done ? "return" : "normal", arg); }, function (err) { resume("throw", err); }); } catch (err) { settle("throw", err); } } function settle(type, value) { switch (type) { case "return": front.resolve({ value: value, done: true }); break; case "throw": front.reject(value); break; default: front.resolve({ value: value, done: false }); break; } front = front.next; if (front) { resume(front.key, front.arg); } else { back = null; } } this._invoke = send; if (typeof gen["return"] !== "function") { this["return"] = undefined; } } if (typeof Symbol === "function" && Symbol.asyncIterator) { _AsyncGenerator.prototype[Symbol.asyncIterator] = function () { return this; }; } diff --git a/packages/babel-preset-env/test/fixtures/corejs3/entry-all-chrome-71/output.mjs b/packages/babel-preset-env/test/fixtures/corejs3/entry-all-chrome-71/output.mjs index b0bfda361f5d..efa4728cac88 100644 --- a/packages/babel-preset-env/test/fixtures/corejs3/entry-all-chrome-71/output.mjs +++ b/packages/babel-preset-env/test/fixtures/corejs3/entry-all-chrome-71/output.mjs @@ -1,5 +1,6 @@ import "core-js/modules/es.array.unscopables.flat"; import "core-js/modules/es.array.unscopables.flat-map"; +import "core-js/modules/es.math.hypot"; import "core-js/modules/es.object.from-entries"; import "core-js/modules/esnext.aggregate-error"; import "core-js/modules/esnext.array.last-index"; @@ -70,6 +71,7 @@ import "core-js/modules/esnext.set.symmetric-difference"; import "core-js/modules/esnext.set.union"; import "core-js/modules/esnext.string.at"; import "core-js/modules/esnext.string.code-points"; +import "core-js/modules/esnext.string.match-all"; import "core-js/modules/esnext.string.replace-all"; import "core-js/modules/esnext.symbol.dispose"; import "core-js/modules/esnext.symbol.observable"; @@ -82,4 +84,3 @@ import "core-js/modules/esnext.weak-set.delete-all"; import "core-js/modules/esnext.weak-set.from"; import "core-js/modules/esnext.weak-set.of"; import "core-js/modules/web.immediate"; -import "core-js/modules/esnext.string.match-all"; diff --git a/packages/babel-preset-env/test/fixtures/corejs3/entry-all/output.mjs b/packages/babel-preset-env/test/fixtures/corejs3/entry-all/output.mjs index d1fd6163046e..de6d3f35f1d0 100644 --- a/packages/babel-preset-env/test/fixtures/corejs3/entry-all/output.mjs +++ b/packages/babel-preset-env/test/fixtures/corejs3/entry-all/output.mjs @@ -268,6 +268,7 @@ import "core-js/modules/esnext.set.symmetric-difference"; import "core-js/modules/esnext.set.union"; import "core-js/modules/esnext.string.at"; import "core-js/modules/esnext.string.code-points"; +import "core-js/modules/esnext.string.match-all"; import "core-js/modules/esnext.string.replace-all"; import "core-js/modules/esnext.symbol.dispose"; import "core-js/modules/esnext.symbol.observable"; @@ -287,5 +288,4 @@ import "core-js/modules/web.timers"; import "core-js/modules/web.url"; import "core-js/modules/web.url.to-json"; import "core-js/modules/web.url-search-params"; -import "core-js/modules/esnext.string.match-all"; import 'regenerator-runtime/runtime'; diff --git a/packages/babel-preset-env/test/fixtures/corejs3/entry-babel-polyfill/options.json b/packages/babel-preset-env/test/fixtures/corejs3/entry-babel-polyfill/options.json index fe930890ee20..1b870fc5224a 100644 --- a/packages/babel-preset-env/test/fixtures/corejs3/entry-babel-polyfill/options.json +++ b/packages/babel-preset-env/test/fixtures/corejs3/entry-babel-polyfill/options.json @@ -1,4 +1,5 @@ { + "validateLogs": true, "presets": [ [ "../../../../lib", diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-babel-polyfill/stderr.txt b/packages/babel-preset-env/test/fixtures/corejs3/entry-babel-polyfill/stderr.txt similarity index 100% rename from packages/babel-preset-env/test/debug-fixtures/entry-corejs3-babel-polyfill/stderr.txt rename to packages/babel-preset-env/test/fixtures/corejs3/entry-babel-polyfill/stderr.txt diff --git a/packages/babel-preset-env/test/fixtures/corejs3/entry-chrome-48/output.mjs b/packages/babel-preset-env/test/fixtures/corejs3/entry-chrome-48/output.mjs index 4714da27c5b2..064f9d4a4469 100644 --- a/packages/babel-preset-env/test/fixtures/corejs3/entry-chrome-48/output.mjs +++ b/packages/babel-preset-env/test/fixtures/corejs3/entry-chrome-48/output.mjs @@ -28,6 +28,7 @@ import "core-js/modules/es.function.has-instance"; import "core-js/modules/es.json.to-string-tag"; import "core-js/modules/es.map"; import "core-js/modules/es.math.acosh"; +import "core-js/modules/es.math.hypot"; import "core-js/modules/es.math.to-string-tag"; import "core-js/modules/es.object.assign"; import "core-js/modules/es.object.define-getter"; diff --git a/packages/babel-preset-env/test/fixtures/corejs3/entry-chrome-49/output.mjs b/packages/babel-preset-env/test/fixtures/corejs3/entry-chrome-49/output.mjs index d38ec2742978..add5d817c3ca 100644 --- a/packages/babel-preset-env/test/fixtures/corejs3/entry-chrome-49/output.mjs +++ b/packages/babel-preset-env/test/fixtures/corejs3/entry-chrome-49/output.mjs @@ -26,6 +26,7 @@ import "core-js/modules/es.function.has-instance"; import "core-js/modules/es.json.to-string-tag"; import "core-js/modules/es.map"; import "core-js/modules/es.math.acosh"; +import "core-js/modules/es.math.hypot"; import "core-js/modules/es.math.to-string-tag"; import "core-js/modules/es.object.define-getter"; import "core-js/modules/es.object.define-setter"; diff --git a/packages/babel-preset-env/test/fixtures/corejs3/entry-chrome-66/output.mjs b/packages/babel-preset-env/test/fixtures/corejs3/entry-chrome-66/output.mjs index f367b9447dc2..8051a9cde054 100644 --- a/packages/babel-preset-env/test/fixtures/corejs3/entry-chrome-66/output.mjs +++ b/packages/babel-preset-env/test/fixtures/corejs3/entry-chrome-66/output.mjs @@ -3,12 +3,15 @@ import "core-js/modules/es.array.flat"; import "core-js/modules/es.array.flat-map"; import "core-js/modules/es.array.unscopables.flat"; import "core-js/modules/es.array.unscopables.flat-map"; +import "core-js/modules/es.math.hypot"; import "core-js/modules/es.object.from-entries"; import "core-js/modules/es.promise"; import "core-js/modules/es.promise.finally"; import "core-js/modules/web.immediate"; import "core-js/modules/web.queue-microtask"; +import "core-js/modules/web.url"; import "core-js/modules/web.url.to-json"; +import "core-js/modules/web.url-search-params"; const foo = { a: true }; diff --git a/packages/babel-preset-env/test/fixtures/corejs3/entry-chrome-71/output.mjs b/packages/babel-preset-env/test/fixtures/corejs3/entry-chrome-71/output.mjs index e7e57e8ebb0d..7ff494cd47e4 100644 --- a/packages/babel-preset-env/test/fixtures/corejs3/entry-chrome-71/output.mjs +++ b/packages/babel-preset-env/test/fixtures/corejs3/entry-chrome-71/output.mjs @@ -1,5 +1,6 @@ import "core-js/modules/es.array.unscopables.flat"; import "core-js/modules/es.array.unscopables.flat-map"; +import "core-js/modules/es.math.hypot"; import "core-js/modules/es.object.from-entries"; import "core-js/modules/web.immediate"; const foo = { diff --git a/packages/babel-preset-env/test/fixtures/corejs3/entry-chromeandroid/output.mjs b/packages/babel-preset-env/test/fixtures/corejs3/entry-chromeandroid/output.mjs index e3be757cb2a9..929415b8b20e 100644 --- a/packages/babel-preset-env/test/fixtures/corejs3/entry-chromeandroid/output.mjs +++ b/packages/babel-preset-env/test/fixtures/corejs3/entry-chromeandroid/output.mjs @@ -6,6 +6,7 @@ import "core-js/modules/es.array.iterator"; import "core-js/modules/es.array.sort"; import "core-js/modules/es.array.unscopables.flat"; import "core-js/modules/es.array.unscopables.flat-map"; +import "core-js/modules/es.math.hypot"; import "core-js/modules/es.object.define-getter"; import "core-js/modules/es.object.define-setter"; import "core-js/modules/es.object.from-entries"; diff --git a/packages/babel-preset-env/test/fixtures/corejs3/entry-electron/output.mjs b/packages/babel-preset-env/test/fixtures/corejs3/entry-electron/output.mjs index daf15be68f3a..34a798940e85 100644 --- a/packages/babel-preset-env/test/fixtures/corejs3/entry-electron/output.mjs +++ b/packages/babel-preset-env/test/fixtures/corejs3/entry-electron/output.mjs @@ -6,6 +6,7 @@ import "core-js/modules/es.array.iterator"; import "core-js/modules/es.array.sort"; import "core-js/modules/es.array.unscopables.flat"; import "core-js/modules/es.array.unscopables.flat-map"; +import "core-js/modules/es.math.hypot"; import "core-js/modules/es.object.define-getter"; import "core-js/modules/es.object.define-setter"; import "core-js/modules/es.object.from-entries"; diff --git a/packages/babel-preset-env/test/fixtures/corejs3/entry-entries-es-proposals-stage-chrome-71/output.mjs b/packages/babel-preset-env/test/fixtures/corejs3/entry-entries-es-proposals-stage-chrome-71/output.mjs index a6c680fa982e..be5df68026ae 100644 --- a/packages/babel-preset-env/test/fixtures/corejs3/entry-entries-es-proposals-stage-chrome-71/output.mjs +++ b/packages/babel-preset-env/test/fixtures/corejs3/entry-entries-es-proposals-stage-chrome-71/output.mjs @@ -1,5 +1,6 @@ import "core-js/modules/es.array.unscopables.flat"; import "core-js/modules/es.array.unscopables.flat-map"; +import "core-js/modules/es.math.hypot"; import "core-js/modules/es.object.from-entries"; import "core-js/modules/esnext.aggregate-error"; import "core-js/modules/esnext.array.last-index"; @@ -70,6 +71,7 @@ import "core-js/modules/esnext.set.symmetric-difference"; import "core-js/modules/esnext.set.union"; import "core-js/modules/esnext.string.at"; import "core-js/modules/esnext.string.code-points"; +import "core-js/modules/esnext.string.match-all"; import "core-js/modules/esnext.string.replace-all"; import "core-js/modules/esnext.symbol.dispose"; import "core-js/modules/esnext.symbol.observable"; @@ -81,4 +83,3 @@ import "core-js/modules/esnext.weak-set.add-all"; import "core-js/modules/esnext.weak-set.delete-all"; import "core-js/modules/esnext.weak-set.from"; import "core-js/modules/esnext.weak-set.of"; -import "core-js/modules/esnext.string.match-all"; diff --git a/packages/babel-preset-env/test/fixtures/corejs3/entry-entries-es-proposals-stage/output.mjs b/packages/babel-preset-env/test/fixtures/corejs3/entry-entries-es-proposals-stage/output.mjs index c90f59ea1482..51a04c11f07a 100644 --- a/packages/babel-preset-env/test/fixtures/corejs3/entry-entries-es-proposals-stage/output.mjs +++ b/packages/babel-preset-env/test/fixtures/corejs3/entry-entries-es-proposals-stage/output.mjs @@ -268,6 +268,7 @@ import "core-js/modules/esnext.set.symmetric-difference"; import "core-js/modules/esnext.set.union"; import "core-js/modules/esnext.string.at"; import "core-js/modules/esnext.string.code-points"; +import "core-js/modules/esnext.string.match-all"; import "core-js/modules/esnext.string.replace-all"; import "core-js/modules/esnext.symbol.dispose"; import "core-js/modules/esnext.symbol.observable"; @@ -282,5 +283,4 @@ import "core-js/modules/esnext.weak-set.of"; import "core-js/modules/web.url"; import "core-js/modules/web.url.to-json"; import "core-js/modules/web.url-search-params"; -import "core-js/modules/esnext.string.match-all"; import 'regenerator-runtime/runtime'; diff --git a/packages/babel-preset-env/test/fixtures/corejs3/entry-entries-modules-chrome-71/output.mjs b/packages/babel-preset-env/test/fixtures/corejs3/entry-entries-modules-chrome-71/output.mjs index 44a025d6a453..55d6e9dbd5c4 100644 --- a/packages/babel-preset-env/test/fixtures/corejs3/entry-entries-modules-chrome-71/output.mjs +++ b/packages/babel-preset-env/test/fixtures/corejs3/entry-entries-modules-chrome-71/output.mjs @@ -1,2 +1,2 @@ -import "core-js/modules/es.object.from-entries"; -import "core-js/modules/esnext.string.replace-all"; +import 'core-js/modules/es.object.from-entries'; +import 'core-js/modules/esnext.string.replace-all'; diff --git a/packages/babel-preset-env/test/fixtures/corejs3/entry-entries-modules/output.mjs b/packages/babel-preset-env/test/fixtures/corejs3/entry-entries-modules/output.mjs index 16b33e2fd0b9..e761a4ac12c5 100644 --- a/packages/babel-preset-env/test/fixtures/corejs3/entry-entries-modules/output.mjs +++ b/packages/babel-preset-env/test/fixtures/corejs3/entry-entries-modules/output.mjs @@ -1,3 +1,3 @@ -import "core-js/modules/es.symbol"; -import "core-js/modules/es.object.from-entries"; -import "core-js/modules/esnext.string.replace-all"; +import 'core-js/modules/es.symbol'; +import 'core-js/modules/es.object.from-entries'; +import 'core-js/modules/esnext.string.replace-all'; diff --git a/packages/babel-preset-env/test/fixtures/corejs3/entry-entries-proposals-chrome-71/output.mjs b/packages/babel-preset-env/test/fixtures/corejs3/entry-entries-proposals-chrome-71/output.mjs index 56b2198265f2..c010a7b5fccb 100644 --- a/packages/babel-preset-env/test/fixtures/corejs3/entry-entries-proposals-chrome-71/output.mjs +++ b/packages/babel-preset-env/test/fixtures/corejs3/entry-entries-proposals-chrome-71/output.mjs @@ -67,6 +67,7 @@ import "core-js/modules/esnext.set.symmetric-difference"; import "core-js/modules/esnext.set.union"; import "core-js/modules/esnext.string.at"; import "core-js/modules/esnext.string.code-points"; +import "core-js/modules/esnext.string.match-all"; import "core-js/modules/esnext.string.replace-all"; import "core-js/modules/esnext.symbol.dispose"; import "core-js/modules/esnext.symbol.observable"; @@ -78,4 +79,3 @@ import "core-js/modules/esnext.weak-set.add-all"; import "core-js/modules/esnext.weak-set.delete-all"; import "core-js/modules/esnext.weak-set.from"; import "core-js/modules/esnext.weak-set.of"; -import "core-js/modules/esnext.string.match-all"; diff --git a/packages/babel-preset-env/test/fixtures/corejs3/entry-entries-proposals/output.mjs b/packages/babel-preset-env/test/fixtures/corejs3/entry-entries-proposals/output.mjs index 65c37496e056..d59c98b71768 100644 --- a/packages/babel-preset-env/test/fixtures/corejs3/entry-entries-proposals/output.mjs +++ b/packages/babel-preset-env/test/fixtures/corejs3/entry-entries-proposals/output.mjs @@ -68,6 +68,7 @@ import "core-js/modules/esnext.set.symmetric-difference"; import "core-js/modules/esnext.set.union"; import "core-js/modules/esnext.string.at"; import "core-js/modules/esnext.string.code-points"; +import "core-js/modules/esnext.string.match-all"; import "core-js/modules/esnext.string.replace-all"; import "core-js/modules/esnext.symbol.dispose"; import "core-js/modules/esnext.symbol.observable"; @@ -82,5 +83,4 @@ import "core-js/modules/esnext.weak-set.of"; import "core-js/modules/web.url"; import "core-js/modules/web.url.to-json"; import "core-js/modules/web.url-search-params"; -import "core-js/modules/esnext.string.match-all"; import 'regenerator-runtime/runtime'; diff --git a/packages/babel-preset-env/test/fixtures/corejs3/entry-entries-stage-chrome-71/output.mjs b/packages/babel-preset-env/test/fixtures/corejs3/entry-entries-stage-chrome-71/output.mjs index 56b2198265f2..c010a7b5fccb 100644 --- a/packages/babel-preset-env/test/fixtures/corejs3/entry-entries-stage-chrome-71/output.mjs +++ b/packages/babel-preset-env/test/fixtures/corejs3/entry-entries-stage-chrome-71/output.mjs @@ -67,6 +67,7 @@ import "core-js/modules/esnext.set.symmetric-difference"; import "core-js/modules/esnext.set.union"; import "core-js/modules/esnext.string.at"; import "core-js/modules/esnext.string.code-points"; +import "core-js/modules/esnext.string.match-all"; import "core-js/modules/esnext.string.replace-all"; import "core-js/modules/esnext.symbol.dispose"; import "core-js/modules/esnext.symbol.observable"; @@ -78,4 +79,3 @@ import "core-js/modules/esnext.weak-set.add-all"; import "core-js/modules/esnext.weak-set.delete-all"; import "core-js/modules/esnext.weak-set.from"; import "core-js/modules/esnext.weak-set.of"; -import "core-js/modules/esnext.string.match-all"; diff --git a/packages/babel-preset-env/test/fixtures/corejs3/entry-entries-stage/output.mjs b/packages/babel-preset-env/test/fixtures/corejs3/entry-entries-stage/output.mjs index 65c37496e056..d59c98b71768 100644 --- a/packages/babel-preset-env/test/fixtures/corejs3/entry-entries-stage/output.mjs +++ b/packages/babel-preset-env/test/fixtures/corejs3/entry-entries-stage/output.mjs @@ -68,6 +68,7 @@ import "core-js/modules/esnext.set.symmetric-difference"; import "core-js/modules/esnext.set.union"; import "core-js/modules/esnext.string.at"; import "core-js/modules/esnext.string.code-points"; +import "core-js/modules/esnext.string.match-all"; import "core-js/modules/esnext.string.replace-all"; import "core-js/modules/esnext.symbol.dispose"; import "core-js/modules/esnext.symbol.observable"; @@ -82,5 +83,4 @@ import "core-js/modules/esnext.weak-set.of"; import "core-js/modules/web.url"; import "core-js/modules/web.url.to-json"; import "core-js/modules/web.url-search-params"; -import "core-js/modules/esnext.string.match-all"; import 'regenerator-runtime/runtime'; diff --git a/packages/babel-preset-env/test/fixtures/corejs3/entry-ie-11/output.mjs b/packages/babel-preset-env/test/fixtures/corejs3/entry-ie-11/output.mjs index f6b2431273cf..8f5bacb3d250 100644 --- a/packages/babel-preset-env/test/fixtures/corejs3/entry-ie-11/output.mjs +++ b/packages/babel-preset-env/test/fixtures/corejs3/entry-ie-11/output.mjs @@ -14,19 +14,26 @@ import "core-js/modules/es.symbol.to-string-tag"; import "core-js/modules/es.symbol.unscopables"; import "core-js/modules/es.array.concat"; import "core-js/modules/es.array.copy-within"; +import "core-js/modules/es.array.every"; import "core-js/modules/es.array.fill"; import "core-js/modules/es.array.filter"; import "core-js/modules/es.array.find"; import "core-js/modules/es.array.find-index"; import "core-js/modules/es.array.flat"; import "core-js/modules/es.array.flat-map"; +import "core-js/modules/es.array.for-each"; import "core-js/modules/es.array.from"; import "core-js/modules/es.array.includes"; +import "core-js/modules/es.array.index-of"; import "core-js/modules/es.array.iterator"; import "core-js/modules/es.array.join"; +import "core-js/modules/es.array.last-index-of"; import "core-js/modules/es.array.map"; import "core-js/modules/es.array.of"; +import "core-js/modules/es.array.reduce"; +import "core-js/modules/es.array.reduce-right"; import "core-js/modules/es.array.slice"; +import "core-js/modules/es.array.some"; import "core-js/modules/es.array.species"; import "core-js/modules/es.array.splice"; import "core-js/modules/es.array.unscopables.flat"; @@ -103,6 +110,7 @@ import "core-js/modules/es.reflect.prevent-extensions"; import "core-js/modules/es.reflect.set"; import "core-js/modules/es.reflect.set-prototype-of"; import "core-js/modules/es.regexp.constructor"; +import "core-js/modules/es.regexp.exec"; import "core-js/modules/es.regexp.flags"; import "core-js/modules/es.regexp.to-string"; import "core-js/modules/es.set"; diff --git a/packages/babel-preset-env/test/fixtures/corejs3/entry-ie-9/output.mjs b/packages/babel-preset-env/test/fixtures/corejs3/entry-ie-9/output.mjs index 80f642659b89..4882a3abee1d 100644 --- a/packages/babel-preset-env/test/fixtures/corejs3/entry-ie-9/output.mjs +++ b/packages/babel-preset-env/test/fixtures/corejs3/entry-ie-9/output.mjs @@ -14,19 +14,26 @@ import "core-js/modules/es.symbol.to-string-tag"; import "core-js/modules/es.symbol.unscopables"; import "core-js/modules/es.array.concat"; import "core-js/modules/es.array.copy-within"; +import "core-js/modules/es.array.every"; import "core-js/modules/es.array.fill"; import "core-js/modules/es.array.filter"; import "core-js/modules/es.array.find"; import "core-js/modules/es.array.find-index"; import "core-js/modules/es.array.flat"; import "core-js/modules/es.array.flat-map"; +import "core-js/modules/es.array.for-each"; import "core-js/modules/es.array.from"; import "core-js/modules/es.array.includes"; +import "core-js/modules/es.array.index-of"; import "core-js/modules/es.array.iterator"; import "core-js/modules/es.array.join"; +import "core-js/modules/es.array.last-index-of"; import "core-js/modules/es.array.map"; import "core-js/modules/es.array.of"; +import "core-js/modules/es.array.reduce"; +import "core-js/modules/es.array.reduce-right"; import "core-js/modules/es.array.slice"; +import "core-js/modules/es.array.some"; import "core-js/modules/es.array.species"; import "core-js/modules/es.array.splice"; import "core-js/modules/es.array.unscopables.flat"; @@ -107,6 +114,7 @@ import "core-js/modules/es.reflect.prevent-extensions"; import "core-js/modules/es.reflect.set"; import "core-js/modules/es.reflect.set-prototype-of"; import "core-js/modules/es.regexp.constructor"; +import "core-js/modules/es.regexp.exec"; import "core-js/modules/es.regexp.flags"; import "core-js/modules/es.regexp.to-string"; import "core-js/modules/es.set"; diff --git a/packages/babel-preset-env/test/fixtures/corejs3/entry-import/output.mjs b/packages/babel-preset-env/test/fixtures/corejs3/entry-import/output.mjs index f891a16256c3..1332106cce0a 100644 --- a/packages/babel-preset-env/test/fixtures/corejs3/entry-import/output.mjs +++ b/packages/babel-preset-env/test/fixtures/corejs3/entry-import/output.mjs @@ -6,6 +6,7 @@ import "core-js/modules/es.array.iterator"; import "core-js/modules/es.array.sort"; import "core-js/modules/es.array.unscopables.flat"; import "core-js/modules/es.array.unscopables.flat-map"; +import "core-js/modules/es.math.hypot"; import "core-js/modules/es.object.define-getter"; import "core-js/modules/es.object.define-setter"; import "core-js/modules/es.object.from-entries"; diff --git a/packages/babel-preset-env/test/fixtures/corejs3/entry-node-10.13/output.mjs b/packages/babel-preset-env/test/fixtures/corejs3/entry-node-10.13/output.mjs index ff125b389f5e..dd8a2c20f45c 100644 --- a/packages/babel-preset-env/test/fixtures/corejs3/entry-node-10.13/output.mjs +++ b/packages/babel-preset-env/test/fixtures/corejs3/entry-node-10.13/output.mjs @@ -3,5 +3,6 @@ import "core-js/modules/es.array.flat"; import "core-js/modules/es.array.flat-map"; import "core-js/modules/es.array.unscopables.flat"; import "core-js/modules/es.array.unscopables.flat-map"; +import "core-js/modules/es.math.hypot"; import "core-js/modules/es.object.from-entries"; import "core-js/modules/web.queue-microtask"; diff --git a/packages/babel-preset-env/test/fixtures/corejs3/entry-node-11/output.mjs b/packages/babel-preset-env/test/fixtures/corejs3/entry-node-11/output.mjs index d8b2d0eb8b78..db959e64958b 100644 --- a/packages/babel-preset-env/test/fixtures/corejs3/entry-node-11/output.mjs +++ b/packages/babel-preset-env/test/fixtures/corejs3/entry-node-11/output.mjs @@ -1,4 +1,5 @@ import "core-js/modules/es.array.unscopables.flat"; import "core-js/modules/es.array.unscopables.flat-map"; +import "core-js/modules/es.math.hypot"; import "core-js/modules/es.object.from-entries"; import "core-js/modules/web.queue-microtask"; diff --git a/packages/babel-preset-env/test/fixtures/corejs3/entry-node-web/output.mjs b/packages/babel-preset-env/test/fixtures/corejs3/entry-node-web/output.mjs index d5e59efa8f02..cd01fb3f1a40 100644 --- a/packages/babel-preset-env/test/fixtures/corejs3/entry-node-web/output.mjs +++ b/packages/babel-preset-env/test/fixtures/corejs3/entry-node-web/output.mjs @@ -6,6 +6,7 @@ import "core-js/modules/es.array.iterator"; import "core-js/modules/es.array.sort"; import "core-js/modules/es.array.unscopables.flat"; import "core-js/modules/es.array.unscopables.flat-map"; +import "core-js/modules/es.math.hypot"; import "core-js/modules/es.object.define-getter"; import "core-js/modules/es.object.define-setter"; import "core-js/modules/es.object.from-entries"; diff --git a/packages/babel-preset-env/test/fixtures/corejs3/entry-node/output.mjs b/packages/babel-preset-env/test/fixtures/corejs3/entry-node/output.mjs index 87a92e7348c0..a3a45d940508 100644 --- a/packages/babel-preset-env/test/fixtures/corejs3/entry-node/output.mjs +++ b/packages/babel-preset-env/test/fixtures/corejs3/entry-node/output.mjs @@ -6,6 +6,7 @@ import "core-js/modules/es.array.iterator"; import "core-js/modules/es.array.sort"; import "core-js/modules/es.array.unscopables.flat"; import "core-js/modules/es.array.unscopables.flat-map"; +import "core-js/modules/es.math.hypot"; import "core-js/modules/es.object.define-getter"; import "core-js/modules/es.object.define-setter"; import "core-js/modules/es.object.from-entries"; diff --git a/packages/babel-preset-env/test/fixtures/corejs3/entry-require-all/output.js b/packages/babel-preset-env/test/fixtures/corejs3/entry-require-all/output.js index ac1379a63561..788e39cdfeb8 100644 --- a/packages/babel-preset-env/test/fixtures/corejs3/entry-require-all/output.js +++ b/packages/babel-preset-env/test/fixtures/corejs3/entry-require-all/output.js @@ -14,6 +14,8 @@ require("core-js/modules/es.array.unscopables.flat"); require("core-js/modules/es.array.unscopables.flat-map"); +require("core-js/modules/es.math.hypot"); + require("core-js/modules/es.object.define-getter"); require("core-js/modules/es.object.define-setter"); @@ -180,6 +182,8 @@ require("core-js/modules/esnext.string.at"); require("core-js/modules/esnext.string.code-points"); +require("core-js/modules/esnext.string.match-all"); + require("core-js/modules/esnext.string.replace-all"); require("core-js/modules/esnext.symbol.dispose"); @@ -216,6 +220,4 @@ require("core-js/modules/web.url.to-json"); require("core-js/modules/web.url-search-params"); -require("core-js/modules/esnext.string.match-all"); - 1 ** 2; diff --git a/packages/babel-preset-env/test/fixtures/corejs3/entry-require-babel-polyfill/options.json b/packages/babel-preset-env/test/fixtures/corejs3/entry-require-babel-polyfill/options.json index bc7cfa8eb23e..fc08c036754a 100644 --- a/packages/babel-preset-env/test/fixtures/corejs3/entry-require-babel-polyfill/options.json +++ b/packages/babel-preset-env/test/fixtures/corejs3/entry-require-babel-polyfill/options.json @@ -1,4 +1,5 @@ { + "validateLogs": true, "presets": [ [ "../../../../lib", diff --git a/packages/babel-preset-env/test/fixtures/corejs3/entry-require-babel-polyfill/stderr.txt b/packages/babel-preset-env/test/fixtures/corejs3/entry-require-babel-polyfill/stderr.txt new file mode 100644 index 000000000000..eaf553660fd2 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/corejs3/entry-require-babel-polyfill/stderr.txt @@ -0,0 +1,2 @@ +`@babel/polyfill` is deprecated. Please, use required parts of `core-js` + and `regenerator-runtime/runtime` separately diff --git a/packages/babel-preset-env/test/fixtures/corejs3/entry-require-es-chrome-71/output.js b/packages/babel-preset-env/test/fixtures/corejs3/entry-require-es-chrome-71/output.js index af7ecd4cda07..ca0c13b8c25b 100644 --- a/packages/babel-preset-env/test/fixtures/corejs3/entry-require-es-chrome-71/output.js +++ b/packages/babel-preset-env/test/fixtures/corejs3/entry-require-es-chrome-71/output.js @@ -2,6 +2,8 @@ require("core-js/modules/es.array.unscopables.flat"); require("core-js/modules/es.array.unscopables.flat-map"); +require("core-js/modules/es.math.hypot"); + require("core-js/modules/es.object.from-entries"); 1 ** 2; diff --git a/packages/babel-preset-env/test/fixtures/corejs3/entry-require-es-proposals/output.js b/packages/babel-preset-env/test/fixtures/corejs3/entry-require-es-proposals/output.js index 31ec22fc83ba..72ba892bc13d 100644 --- a/packages/babel-preset-env/test/fixtures/corejs3/entry-require-es-proposals/output.js +++ b/packages/babel-preset-env/test/fixtures/corejs3/entry-require-es-proposals/output.js @@ -14,6 +14,8 @@ require("core-js/modules/es.array.unscopables.flat"); require("core-js/modules/es.array.unscopables.flat-map"); +require("core-js/modules/es.math.hypot"); + require("core-js/modules/es.object.define-getter"); require("core-js/modules/es.object.define-setter"); @@ -180,6 +182,8 @@ require("core-js/modules/esnext.string.at"); require("core-js/modules/esnext.string.code-points"); +require("core-js/modules/esnext.string.match-all"); + require("core-js/modules/esnext.string.replace-all"); require("core-js/modules/esnext.symbol.dispose"); @@ -208,6 +212,4 @@ require("core-js/modules/web.url.to-json"); require("core-js/modules/web.url-search-params"); -require("core-js/modules/esnext.string.match-all"); - 1 ** 2; diff --git a/packages/babel-preset-env/test/fixtures/corejs3/entry-require/output.js b/packages/babel-preset-env/test/fixtures/corejs3/entry-require/output.js index 49aa2d8f4ca3..974ad1fee63b 100644 --- a/packages/babel-preset-env/test/fixtures/corejs3/entry-require/output.js +++ b/packages/babel-preset-env/test/fixtures/corejs3/entry-require/output.js @@ -14,6 +14,8 @@ require("core-js/modules/es.array.unscopables.flat"); require("core-js/modules/es.array.unscopables.flat-map"); +require("core-js/modules/es.math.hypot"); + require("core-js/modules/es.object.define-getter"); require("core-js/modules/es.object.define-setter"); diff --git a/packages/babel-preset-env/test/fixtures/corejs3/entry-stable-chrome-71/output.mjs b/packages/babel-preset-env/test/fixtures/corejs3/entry-stable-chrome-71/output.mjs index de648a923f2b..521c32b6f351 100644 --- a/packages/babel-preset-env/test/fixtures/corejs3/entry-stable-chrome-71/output.mjs +++ b/packages/babel-preset-env/test/fixtures/corejs3/entry-stable-chrome-71/output.mjs @@ -1,4 +1,5 @@ import "core-js/modules/es.array.unscopables.flat"; import "core-js/modules/es.array.unscopables.flat-map"; +import "core-js/modules/es.math.hypot"; import "core-js/modules/es.object.from-entries"; import "core-js/modules/web.immediate"; diff --git a/packages/babel-preset-env/test/fixtures/corejs3/entry-stable-samsung-8.2/output.mjs b/packages/babel-preset-env/test/fixtures/corejs3/entry-stable-samsung-8.2/output.mjs index b55987d82a9f..e99fb491804b 100644 --- a/packages/babel-preset-env/test/fixtures/corejs3/entry-stable-samsung-8.2/output.mjs +++ b/packages/babel-preset-env/test/fixtures/corejs3/entry-stable-samsung-8.2/output.mjs @@ -4,6 +4,7 @@ import "core-js/modules/es.array.flat-map"; import "core-js/modules/es.array.iterator"; import "core-js/modules/es.array.unscopables.flat"; import "core-js/modules/es.array.unscopables.flat-map"; +import "core-js/modules/es.math.hypot"; import "core-js/modules/es.object.from-entries"; import "core-js/modules/es.promise"; import "core-js/modules/es.promise.finally"; @@ -13,4 +14,6 @@ import "core-js/modules/es.string.trim-start"; import "core-js/modules/web.dom-collections.iterator"; import "core-js/modules/web.immediate"; import "core-js/modules/web.queue-microtask"; +import "core-js/modules/web.url"; import "core-js/modules/web.url.to-json"; +import "core-js/modules/web.url-search-params"; diff --git a/packages/babel-preset-env/test/fixtures/corejs3/exclude-built-ins/output.mjs b/packages/babel-preset-env/test/fixtures/corejs3/exclude-built-ins/output.mjs index 8dc8ff014a4c..cb63c2cc360c 100644 --- a/packages/babel-preset-env/test/fixtures/corejs3/exclude-built-ins/output.mjs +++ b/packages/babel-preset-env/test/fixtures/corejs3/exclude-built-ins/output.mjs @@ -4,6 +4,7 @@ import "core-js/modules/es.array.flat-map"; import "core-js/modules/es.array.iterator"; import "core-js/modules/es.array.unscopables.flat"; import "core-js/modules/es.array.unscopables.flat-map"; +import "core-js/modules/es.math.hypot"; import "core-js/modules/es.object.from-entries"; import "core-js/modules/es.promise"; import "core-js/modules/es.promise.finally"; @@ -11,4 +12,6 @@ import "core-js/modules/es.string.replace"; import "core-js/modules/es.string.trim-end"; import "core-js/modules/es.string.trim-start"; import "core-js/modules/web.queue-microtask"; +import "core-js/modules/web.url"; import "core-js/modules/web.url.to-json"; +import "core-js/modules/web.url-search-params"; diff --git a/packages/babel-preset-env/test/fixtures/corejs3/exclude-include/output.mjs b/packages/babel-preset-env/test/fixtures/corejs3/exclude-include/output.mjs index e116abf02cf1..170d86bd7cae 100644 --- a/packages/babel-preset-env/test/fixtures/corejs3/exclude-include/output.mjs +++ b/packages/babel-preset-env/test/fixtures/corejs3/exclude-include/output.mjs @@ -7,6 +7,7 @@ import "core-js/modules/es.array.sort"; import "core-js/modules/es.array.unscopables.flat"; import "core-js/modules/es.array.unscopables.flat-map"; import "core-js/modules/es.map"; +import "core-js/modules/es.math.hypot"; import "core-js/modules/es.object.define-getter"; import "core-js/modules/es.object.define-setter"; import "core-js/modules/es.object.from-entries"; diff --git a/packages/babel-preset-env/test/fixtures/corejs3/force-all-transforms/output.mjs b/packages/babel-preset-env/test/fixtures/corejs3/force-all-transforms/output.mjs index 698280d4465c..acdf857cf0e3 100644 --- a/packages/babel-preset-env/test/fixtures/corejs3/force-all-transforms/output.mjs +++ b/packages/babel-preset-env/test/fixtures/corejs3/force-all-transforms/output.mjs @@ -6,6 +6,7 @@ import "core-js/modules/es.array.iterator"; import "core-js/modules/es.array.sort"; import "core-js/modules/es.array.unscopables.flat"; import "core-js/modules/es.array.unscopables.flat-map"; +import "core-js/modules/es.math.hypot"; import "core-js/modules/es.object.define-getter"; import "core-js/modules/es.object.define-setter"; import "core-js/modules/es.object.from-entries"; diff --git a/packages/babel-preset-env/test/fixtures/corejs3/include-built-ins/output.mjs b/packages/babel-preset-env/test/fixtures/corejs3/include-built-ins/output.mjs index 504b23702786..49a4b1893150 100644 --- a/packages/babel-preset-env/test/fixtures/corejs3/include-built-ins/output.mjs +++ b/packages/babel-preset-env/test/fixtures/corejs3/include-built-ins/output.mjs @@ -7,6 +7,7 @@ import "core-js/modules/es.array.sort"; import "core-js/modules/es.array.unscopables.flat"; import "core-js/modules/es.array.unscopables.flat-map"; import "core-js/modules/es.map"; +import "core-js/modules/es.math.hypot"; import "core-js/modules/es.object.define-getter"; import "core-js/modules/es.object.define-setter"; import "core-js/modules/es.object.from-entries"; diff --git a/packages/babel-preset-env/test/fixtures/corejs3/usage-browserslist-config-ignore/options.json b/packages/babel-preset-env/test/fixtures/corejs3/usage-browserslist-config-ignore/options.json index 95a82bb5ec7a..ffb21b1f8aa2 100644 --- a/packages/babel-preset-env/test/fixtures/corejs3/usage-browserslist-config-ignore/options.json +++ b/packages/babel-preset-env/test/fixtures/corejs3/usage-browserslist-config-ignore/options.json @@ -1,4 +1,5 @@ { + "validateLogs": true, "presets": [ [ "../../../../lib", diff --git a/packages/babel-preset-env/test/fixtures/corejs3/usage-browserslist-config-ignore/stdout.txt b/packages/babel-preset-env/test/fixtures/corejs3/usage-browserslist-config-ignore/stdout.txt new file mode 100644 index 000000000000..1988ed515d68 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/corejs3/usage-browserslist-config-ignore/stdout.txt @@ -0,0 +1,37 @@ +@babel/preset-env: `DEBUG` option + +Using targets: +{ + "chrome": "61", + "edge": "16", + "firefox": "60", + "ios": "10.3", + "opera": "48", + "safari": "10.1" +} + +Using modules transform: false + +Using plugins: + transform-template-literals { "ios":"10.3", "safari":"10.1" } + transform-function-name { "edge":"16" } + transform-dotall-regex { "chrome":"61", "edge":"16", "firefox":"60", "ios":"10.3", "opera":"48", "safari":"10.1" } + transform-unicode-regex { "ios":"10.3", "safari":"10.1" } + transform-parameters { "edge":"16" } + transform-block-scoping { "ios":"10.3", "safari":"10.1" } + transform-async-to-generator { "ios":"10.3", "safari":"10.1" } + proposal-async-generator-functions { "chrome":"61", "edge":"16", "ios":"10.3", "opera":"48", "safari":"10.1" } + proposal-object-rest-spread { "edge":"16", "ios":"10.3", "safari":"10.1" } + proposal-unicode-property-regex { "chrome":"61", "edge":"16", "firefox":"60", "ios":"10.3", "opera":"48", "safari":"10.1" } + proposal-json-strings { "chrome":"61", "edge":"16", "firefox":"60", "ios":"10.3", "opera":"48", "safari":"10.1" } + proposal-optional-catch-binding { "chrome":"61", "edge":"16", "ios":"10.3", "opera":"48", "safari":"10.1" } + proposal-optional-chaining { "chrome":"61", "edge":"16", "firefox":"60", "ios":"10.3", "opera":"48", "safari":"10.1" } + transform-named-capturing-groups-regex { "chrome":"61", "edge":"16", "firefox":"60", "ios":"10.3", "opera":"48", "safari":"10.1" } + proposal-nullish-coalescing-operator { "chrome":"61", "edge":"16", "firefox":"60", "ios":"10.3", "opera":"48", "safari":"10.1" } + syntax-dynamic-import { "chrome":"61", "edge":"16", "firefox":"60", "ios":"10.3", "opera":"48", "safari":"10.1" } + +Using polyfills with `usage` option: + +[/packages/babel-preset-env/test/fixtures/corejs3/usage-browserslist-config-ignore/input.mjs] Added following core-js polyfills: + es.array.iterator { "chrome":"61", "opera":"48" } + web.dom-collections.iterator { "chrome":"61", "edge":"16", "ios":"10.3", "opera":"48", "safari":"10.1" } diff --git a/packages/babel-preset-env/test/fixtures/corejs3/usage-dynamic-import-chrome-71/options.json b/packages/babel-preset-env/test/fixtures/corejs3/usage-dynamic-import-chrome-71/options.json index 26b5f87194db..eb821662bc64 100644 --- a/packages/babel-preset-env/test/fixtures/corejs3/usage-dynamic-import-chrome-71/options.json +++ b/packages/babel-preset-env/test/fixtures/corejs3/usage-dynamic-import-chrome-71/options.json @@ -1,5 +1,4 @@ { - "plugins": ["syntax-dynamic-import"], "presets": [ [ "../../../../lib", diff --git a/packages/babel-preset-env/test/fixtures/corejs3/usage-dynamic-import/options.json b/packages/babel-preset-env/test/fixtures/corejs3/usage-dynamic-import/options.json index 563713faab57..c7f8e1de8403 100644 --- a/packages/babel-preset-env/test/fixtures/corejs3/usage-dynamic-import/options.json +++ b/packages/babel-preset-env/test/fixtures/corejs3/usage-dynamic-import/options.json @@ -1,5 +1,4 @@ { - "plugins": ["syntax-dynamic-import"], "presets": [ [ "../../../../lib", diff --git a/packages/babel-preset-env/test/fixtures/corejs3/usage-for-of-destructure-with/output.mjs b/packages/babel-preset-env/test/fixtures/corejs3/usage-for-of-destructure-with/output.mjs index 5237617a6e67..2769d6c95b21 100644 --- a/packages/babel-preset-env/test/fixtures/corejs3/usage-for-of-destructure-with/output.mjs +++ b/packages/babel-preset-env/test/fixtures/corejs3/usage-for-of-destructure-with/output.mjs @@ -2,9 +2,8 @@ import "core-js/modules/es.array.iterator"; import "core-js/modules/es.string.pad-end"; import "core-js/modules/es.string.pad-start"; -for (const _ref of foo) { - const { - padStart - } = _ref; +for (const { + padStart +} of foo) { console.log('b'.padEnd(5)); } diff --git a/packages/babel-preset-env/test/fixtures/corejs3/usage-modules-namespaced/input.mjs b/packages/babel-preset-env/test/fixtures/corejs3/usage-modules-namespaced/input.mjs new file mode 100644 index 000000000000..3f57abb6052e --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/corejs3/usage-modules-namespaced/input.mjs @@ -0,0 +1,2 @@ +import * as ns from "ns"; +ns.map; diff --git a/packages/babel-preset-env/test/fixtures/corejs3/usage-modules-namespaced/options.json b/packages/babel-preset-env/test/fixtures/corejs3/usage-modules-namespaced/options.json new file mode 100644 index 000000000000..d15a6c1c2826 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/corejs3/usage-modules-namespaced/options.json @@ -0,0 +1,12 @@ +{ + "presets": [ + [ + "../../../../lib", + { + "modules": false, + "useBuiltIns": "usage", + "corejs": 3 + } + ] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/corejs3/usage-modules-namespaced/output.mjs b/packages/babel-preset-env/test/fixtures/corejs3/usage-modules-namespaced/output.mjs new file mode 100644 index 000000000000..3f57abb6052e --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/corejs3/usage-modules-namespaced/output.mjs @@ -0,0 +1,2 @@ +import * as ns from "ns"; +ns.map; diff --git a/packages/babel-preset-env/test/fixtures/debug/browserslists-android-3/input.mjs b/packages/babel-preset-env/test/fixtures/debug/browserslists-android-3/input.mjs new file mode 100644 index 000000000000..c3fee8a17564 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/browserslists-android-3/input.mjs @@ -0,0 +1 @@ +import "core-js"; diff --git a/packages/babel-preset-env/test/fixtures/debug/browserslists-android-3/options.json b/packages/babel-preset-env/test/fixtures/debug/browserslists-android-3/options.json new file mode 100644 index 000000000000..b8ccf9b2471e --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/browserslists-android-3/options.json @@ -0,0 +1,17 @@ +{ + "validateLogs": true, + "ignoreOutput": true, + "presets": [ + [ + "env", + { + "debug": true, + "targets": { + "browsers": [ + "android 3" + ] + } + } + ] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/debug/browserslists-android-3/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/browserslists-android-3/stdout.txt new file mode 100644 index 000000000000..d079d9b7f0bb --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/browserslists-android-3/stdout.txt @@ -0,0 +1,48 @@ +@babel/preset-env: `DEBUG` option + +Using targets: +{ + "android": "3" +} + +Using modules transform: auto + +Using plugins: + transform-template-literals { "android":"3" } + transform-literals { "android":"3" } + transform-function-name { "android":"3" } + transform-arrow-functions { "android":"3" } + transform-block-scoped-functions { "android":"3" } + transform-classes { "android":"3" } + transform-object-super { "android":"3" } + transform-shorthand-properties { "android":"3" } + transform-duplicate-keys { "android":"3" } + transform-computed-properties { "android":"3" } + transform-for-of { "android":"3" } + transform-sticky-regex { "android":"3" } + transform-dotall-regex { "android":"3" } + transform-unicode-regex { "android":"3" } + transform-spread { "android":"3" } + transform-parameters { "android":"3" } + transform-destructuring { "android":"3" } + transform-block-scoping { "android":"3" } + transform-typeof-symbol { "android":"3" } + transform-new-target { "android":"3" } + transform-regenerator { "android":"3" } + transform-exponentiation-operator { "android":"3" } + transform-async-to-generator { "android":"3" } + proposal-async-generator-functions { "android":"3" } + proposal-object-rest-spread { "android":"3" } + proposal-unicode-property-regex { "android":"3" } + proposal-json-strings { "android":"3" } + proposal-optional-catch-binding { "android":"3" } + proposal-optional-chaining { "android":"3" } + transform-named-capturing-groups-regex { "android":"3" } + transform-member-expression-literals { "android":"3" } + transform-property-literals { "android":"3" } + transform-reserved-words { "android":"3" } + proposal-nullish-coalescing-operator { "android":"3" } + transform-modules-commonjs { "android":"3" } + proposal-dynamic-import { "android":"3" } + +Using polyfills: No polyfills were added, since the `useBuiltIns` option was not set. diff --git a/packages/babel-preset-env/test/fixtures/debug/browserslists-defaults-not-ie/input.mjs b/packages/babel-preset-env/test/fixtures/debug/browserslists-defaults-not-ie/input.mjs new file mode 100644 index 000000000000..c3fee8a17564 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/browserslists-defaults-not-ie/input.mjs @@ -0,0 +1 @@ +import "core-js"; diff --git a/packages/babel-preset-env/test/fixtures/debug/browserslists-defaults-not-ie/options.json b/packages/babel-preset-env/test/fixtures/debug/browserslists-defaults-not-ie/options.json new file mode 100644 index 000000000000..8bbb1c0f23d9 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/browserslists-defaults-not-ie/options.json @@ -0,0 +1,19 @@ +{ + "validateLogs": true, + "ignoreOutput": true, + "presets": [ + [ + "env", + { + "debug": true, + "targets": { + "browsers": [ + "defaults", + "not ie 11", + "not ie_mob 11" + ] + } + } + ] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/debug/browserslists-defaults-not-ie/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/browserslists-defaults-not-ie/stdout.txt new file mode 100644 index 000000000000..fa83ff03bb10 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/browserslists-defaults-not-ie/stdout.txt @@ -0,0 +1,52 @@ +@babel/preset-env: `DEBUG` option + +Using targets: +{ + "android": "77", + "chrome": "49", + "edge": "17", + "firefox": "68", + "ios": "12.2", + "opera": "63", + "safari": "5.1", + "samsung": "9.2" +} + +Using modules transform: auto + +Using plugins: + transform-template-literals { "ios":"12.2", "safari":"5.1" } + transform-literals { "safari":"5.1" } + transform-function-name { "chrome":"49", "edge":"17", "safari":"5.1" } + transform-arrow-functions { "safari":"5.1" } + transform-block-scoped-functions { "safari":"5.1" } + transform-classes { "safari":"5.1" } + transform-object-super { "safari":"5.1" } + transform-shorthand-properties { "safari":"5.1" } + transform-duplicate-keys { "safari":"5.1" } + transform-computed-properties { "safari":"5.1" } + transform-for-of { "chrome":"49", "safari":"5.1" } + transform-sticky-regex { "safari":"5.1" } + transform-dotall-regex { "chrome":"49", "edge":"17", "firefox":"68", "safari":"5.1" } + transform-unicode-regex { "chrome":"49", "safari":"5.1" } + transform-spread { "safari":"5.1" } + transform-parameters { "edge":"17", "safari":"5.1" } + transform-destructuring { "chrome":"49", "safari":"5.1" } + transform-block-scoping { "safari":"5.1" } + transform-typeof-symbol { "safari":"5.1" } + transform-new-target { "safari":"5.1" } + transform-regenerator { "chrome":"49", "safari":"5.1" } + transform-exponentiation-operator { "chrome":"49", "safari":"5.1" } + transform-async-to-generator { "chrome":"49", "safari":"5.1" } + proposal-async-generator-functions { "chrome":"49", "edge":"17", "safari":"5.1" } + proposal-object-rest-spread { "chrome":"49", "edge":"17", "safari":"5.1" } + proposal-unicode-property-regex { "chrome":"49", "edge":"17", "firefox":"68", "safari":"5.1" } + proposal-json-strings { "chrome":"49", "edge":"17", "safari":"5.1" } + proposal-optional-catch-binding { "chrome":"49", "edge":"17", "safari":"5.1" } + proposal-optional-chaining { "android":"77", "chrome":"49", "edge":"17", "firefox":"68", "ios":"12.2", "opera":"63", "safari":"5.1", "samsung":"9.2" } + transform-named-capturing-groups-regex { "chrome":"49", "edge":"17", "firefox":"68", "safari":"5.1" } + proposal-nullish-coalescing-operator { "android":"77", "chrome":"49", "edge":"17", "firefox":"68", "ios":"12.2", "opera":"63", "safari":"5.1", "samsung":"9.2" } + transform-modules-commonjs { "android":"77", "chrome":"49", "edge":"17", "firefox":"68", "ios":"12.2", "opera":"63", "safari":"5.1", "samsung":"9.2" } + proposal-dynamic-import { "android":"77", "chrome":"49", "edge":"17", "firefox":"68", "ios":"12.2", "opera":"63", "safari":"5.1", "samsung":"9.2" } + +Using polyfills: No polyfills were added, since the `useBuiltIns` option was not set. diff --git a/packages/babel-preset-env/test/fixtures/debug/browserslists-defaults/input.mjs b/packages/babel-preset-env/test/fixtures/debug/browserslists-defaults/input.mjs new file mode 100644 index 000000000000..c3fee8a17564 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/browserslists-defaults/input.mjs @@ -0,0 +1 @@ +import "core-js"; diff --git a/packages/babel-preset-env/test/fixtures/debug/browserslists-defaults/options.json b/packages/babel-preset-env/test/fixtures/debug/browserslists-defaults/options.json new file mode 100644 index 000000000000..b4fbce958eac --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/browserslists-defaults/options.json @@ -0,0 +1,15 @@ +{ + "validateLogs": true, + "ignoreOutput": true, + "presets": [ + [ + "env", + { + "debug": true, + "targets": { + "browsers": "defaults" + } + } + ] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/debug/browserslists-defaults/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/browserslists-defaults/stdout.txt new file mode 100644 index 000000000000..fd2bde77e63a --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/browserslists-defaults/stdout.txt @@ -0,0 +1,53 @@ +@babel/preset-env: `DEBUG` option + +Using targets: +{ + "android": "77", + "chrome": "49", + "edge": "17", + "firefox": "68", + "ie": "11", + "ios": "12.2", + "opera": "63", + "safari": "5.1", + "samsung": "9.2" +} + +Using modules transform: auto + +Using plugins: + transform-template-literals { "ie":"11", "ios":"12.2", "safari":"5.1" } + transform-literals { "ie":"11", "safari":"5.1" } + transform-function-name { "chrome":"49", "edge":"17", "ie":"11", "safari":"5.1" } + transform-arrow-functions { "ie":"11", "safari":"5.1" } + transform-block-scoped-functions { "safari":"5.1" } + transform-classes { "ie":"11", "safari":"5.1" } + transform-object-super { "ie":"11", "safari":"5.1" } + transform-shorthand-properties { "ie":"11", "safari":"5.1" } + transform-duplicate-keys { "ie":"11", "safari":"5.1" } + transform-computed-properties { "ie":"11", "safari":"5.1" } + transform-for-of { "chrome":"49", "ie":"11", "safari":"5.1" } + transform-sticky-regex { "ie":"11", "safari":"5.1" } + transform-dotall-regex { "chrome":"49", "edge":"17", "firefox":"68", "ie":"11", "safari":"5.1" } + transform-unicode-regex { "chrome":"49", "ie":"11", "safari":"5.1" } + transform-spread { "ie":"11", "safari":"5.1" } + transform-parameters { "edge":"17", "ie":"11", "safari":"5.1" } + transform-destructuring { "chrome":"49", "ie":"11", "safari":"5.1" } + transform-block-scoping { "ie":"11", "safari":"5.1" } + transform-typeof-symbol { "ie":"11", "safari":"5.1" } + transform-new-target { "ie":"11", "safari":"5.1" } + transform-regenerator { "chrome":"49", "ie":"11", "safari":"5.1" } + transform-exponentiation-operator { "chrome":"49", "ie":"11", "safari":"5.1" } + transform-async-to-generator { "chrome":"49", "ie":"11", "safari":"5.1" } + proposal-async-generator-functions { "chrome":"49", "edge":"17", "ie":"11", "safari":"5.1" } + proposal-object-rest-spread { "chrome":"49", "edge":"17", "ie":"11", "safari":"5.1" } + proposal-unicode-property-regex { "chrome":"49", "edge":"17", "firefox":"68", "ie":"11", "safari":"5.1" } + proposal-json-strings { "chrome":"49", "edge":"17", "ie":"11", "safari":"5.1" } + proposal-optional-catch-binding { "chrome":"49", "edge":"17", "ie":"11", "safari":"5.1" } + proposal-optional-chaining { "android":"77", "chrome":"49", "edge":"17", "firefox":"68", "ie":"11", "ios":"12.2", "opera":"63", "safari":"5.1", "samsung":"9.2" } + transform-named-capturing-groups-regex { "chrome":"49", "edge":"17", "firefox":"68", "ie":"11", "safari":"5.1" } + proposal-nullish-coalescing-operator { "android":"77", "chrome":"49", "edge":"17", "firefox":"68", "ie":"11", "ios":"12.2", "opera":"63", "safari":"5.1", "samsung":"9.2" } + transform-modules-commonjs { "android":"77", "chrome":"49", "edge":"17", "firefox":"68", "ie":"11", "ios":"12.2", "opera":"63", "safari":"5.1", "samsung":"9.2" } + proposal-dynamic-import { "android":"77", "chrome":"49", "edge":"17", "firefox":"68", "ie":"11", "ios":"12.2", "opera":"63", "safari":"5.1", "samsung":"9.2" } + +Using polyfills: No polyfills were added, since the `useBuiltIns` option was not set. diff --git a/packages/babel-preset-env/test/fixtures/debug/browserslists-last-2-versions-not-ie/input.mjs b/packages/babel-preset-env/test/fixtures/debug/browserslists-last-2-versions-not-ie/input.mjs new file mode 100644 index 000000000000..c3fee8a17564 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/browserslists-last-2-versions-not-ie/input.mjs @@ -0,0 +1 @@ +import "core-js"; diff --git a/packages/babel-preset-env/test/fixtures/debug/browserslists-last-2-versions-not-ie/options.json b/packages/babel-preset-env/test/fixtures/debug/browserslists-last-2-versions-not-ie/options.json new file mode 100644 index 000000000000..58797fc7f4e1 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/browserslists-last-2-versions-not-ie/options.json @@ -0,0 +1,19 @@ +{ + "validateLogs": true, + "ignoreOutput": true, + "presets": [ + [ + "env", + { + "debug": true, + "targets": { + "browsers": [ + "last 2 versions", + "not ie <= 11", + "not ie_mob <= 11" + ] + } + } + ] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/debug/browserslists-last-2-versions-not-ie/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/browserslists-last-2-versions-not-ie/stdout.txt new file mode 100644 index 000000000000..a643d3d2c96f --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/browserslists-last-2-versions-not-ie/stdout.txt @@ -0,0 +1,33 @@ +@babel/preset-env: `DEBUG` option + +Using targets: +{ + "android": "77", + "chrome": "77", + "edge": "17", + "firefox": "70", + "ios": "13", + "opera": "63", + "safari": "12.1", + "samsung": "9.2" +} + +Using modules transform: auto + +Using plugins: + transform-template-literals { "safari":"12.1" } + transform-function-name { "edge":"17" } + transform-dotall-regex { "edge":"17", "firefox":"70" } + transform-parameters { "edge":"17" } + proposal-async-generator-functions { "edge":"17" } + proposal-object-rest-spread { "edge":"17" } + proposal-unicode-property-regex { "edge":"17", "firefox":"70" } + proposal-json-strings { "edge":"17" } + proposal-optional-catch-binding { "edge":"17" } + proposal-optional-chaining { "android":"77", "chrome":"77", "edge":"17", "firefox":"70", "ios":"13", "opera":"63", "safari":"12.1", "samsung":"9.2" } + transform-named-capturing-groups-regex { "edge":"17", "firefox":"70" } + proposal-nullish-coalescing-operator { "android":"77", "chrome":"77", "edge":"17", "firefox":"70", "ios":"13", "opera":"63", "safari":"12.1", "samsung":"9.2" } + transform-modules-commonjs { "android":"77", "chrome":"77", "edge":"17", "firefox":"70", "ios":"13", "opera":"63", "safari":"12.1", "samsung":"9.2" } + proposal-dynamic-import { "android":"77", "chrome":"77", "edge":"17", "firefox":"70", "ios":"13", "opera":"63", "safari":"12.1", "samsung":"9.2" } + +Using polyfills: No polyfills were added, since the `useBuiltIns` option was not set. diff --git a/packages/babel-preset-env/test/debug-fixtures/corejs-without-usebuiltins/in/in.js b/packages/babel-preset-env/test/fixtures/debug/corejs-without-usebuiltins/input.mjs similarity index 100% rename from packages/babel-preset-env/test/debug-fixtures/corejs-without-usebuiltins/in/in.js rename to packages/babel-preset-env/test/fixtures/debug/corejs-without-usebuiltins/input.mjs diff --git a/packages/babel-preset-env/test/fixtures/debug/corejs-without-usebuiltins/options.json b/packages/babel-preset-env/test/fixtures/debug/corejs-without-usebuiltins/options.json new file mode 100644 index 000000000000..bb7efd202301 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/corejs-without-usebuiltins/options.json @@ -0,0 +1,13 @@ +{ + "validateLogs": true, + "ignoreOutput": true, + "presets": [ + [ + "env", + { + "debug": true, + "corejs": 3 + } + ] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/debug/corejs-without-usebuiltins/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/corejs-without-usebuiltins/stdout.txt new file mode 100644 index 000000000000..90cb09a7618b --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/corejs-without-usebuiltins/stdout.txt @@ -0,0 +1,48 @@ +The `corejs` option only has an effect when the `useBuiltIns` option is not `false` + +@babel/preset-env: `DEBUG` option + +Using targets: +{} + +Using modules transform: auto + +Using plugins: + transform-template-literals {} + transform-literals {} + transform-function-name {} + transform-arrow-functions {} + transform-block-scoped-functions {} + transform-classes {} + transform-object-super {} + transform-shorthand-properties {} + transform-duplicate-keys {} + transform-computed-properties {} + transform-for-of {} + transform-sticky-regex {} + transform-dotall-regex {} + transform-unicode-regex {} + transform-spread {} + transform-parameters {} + transform-destructuring {} + transform-block-scoping {} + transform-typeof-symbol {} + transform-new-target {} + transform-regenerator {} + transform-exponentiation-operator {} + transform-async-to-generator {} + proposal-async-generator-functions {} + proposal-object-rest-spread {} + proposal-unicode-property-regex {} + proposal-json-strings {} + proposal-optional-catch-binding {} + proposal-optional-chaining {} + transform-named-capturing-groups-regex {} + transform-member-expression-literals {} + transform-property-literals {} + transform-reserved-words {} + proposal-nullish-coalescing-operator {} + transform-modules-commonjs {} + proposal-dynamic-import {} + +Using polyfills: No polyfills were added, since the `useBuiltIns` option was not set. diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs2-android/in/in.js b/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-android/input.mjs similarity index 100% rename from packages/babel-preset-env/test/debug-fixtures/entry-corejs2-android/in/in.js rename to packages/babel-preset-env/test/fixtures/debug/entry-corejs2-android/input.mjs diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-android/options.json b/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-android/options.json new file mode 100644 index 000000000000..7c23631533a1 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-android/options.json @@ -0,0 +1,17 @@ +{ + "validateLogs": true, + "ignoreOutput": true, + "presets": [ + [ + "env", + { + "debug": true, + "targets": { + "browsers": ["Android >= 4"] + }, + "useBuiltIns": "entry", + "corejs": 2 + } + ] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-android/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-android/stdout.txt new file mode 100644 index 000000000000..5fed38cd6add --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-android/stdout.txt @@ -0,0 +1,162 @@ +@babel/preset-env: `DEBUG` option + +Using targets: +{ + "android": "4" +} + +Using modules transform: auto + +Using plugins: + transform-template-literals { "android":"4" } + transform-literals { "android":"4" } + transform-function-name { "android":"4" } + transform-arrow-functions { "android":"4" } + transform-block-scoped-functions { "android":"4" } + transform-classes { "android":"4" } + transform-object-super { "android":"4" } + transform-shorthand-properties { "android":"4" } + transform-duplicate-keys { "android":"4" } + transform-computed-properties { "android":"4" } + transform-for-of { "android":"4" } + transform-sticky-regex { "android":"4" } + transform-dotall-regex { "android":"4" } + transform-unicode-regex { "android":"4" } + transform-spread { "android":"4" } + transform-parameters { "android":"4" } + transform-destructuring { "android":"4" } + transform-block-scoping { "android":"4" } + transform-typeof-symbol { "android":"4" } + transform-new-target { "android":"4" } + transform-regenerator { "android":"4" } + transform-exponentiation-operator { "android":"4" } + transform-async-to-generator { "android":"4" } + proposal-async-generator-functions { "android":"4" } + proposal-object-rest-spread { "android":"4" } + proposal-unicode-property-regex { "android":"4" } + proposal-json-strings { "android":"4" } + proposal-optional-catch-binding { "android":"4" } + proposal-optional-chaining { "android":"4" } + transform-named-capturing-groups-regex { "android":"4" } + transform-reserved-words { "android":"4" } + proposal-nullish-coalescing-operator { "android":"4" } + transform-modules-commonjs { "android":"4" } + proposal-dynamic-import { "android":"4" } + +Using polyfills with `entry` option: + +[/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-android/input.mjs] Replaced @babel/polyfill entries with the following polyfills: + es6.array.copy-within { "android":"4" } + es6.array.fill { "android":"4" } + es6.array.find { "android":"4" } + es6.array.find-index { "android":"4" } + es7.array.flat-map { "android":"4" } + es6.array.from { "android":"4" } + es7.array.includes { "android":"4" } + es6.array.iterator { "android":"4" } + es6.array.of { "android":"4" } + es6.array.sort { "android":"4" } + es6.array.species { "android":"4" } + es6.date.to-primitive { "android":"4" } + es6.function.has-instance { "android":"4" } + es6.map { "android":"4" } + es6.math.acosh { "android":"4" } + es6.math.asinh { "android":"4" } + es6.math.atanh { "android":"4" } + es6.math.cbrt { "android":"4" } + es6.math.clz32 { "android":"4" } + es6.math.cosh { "android":"4" } + es6.math.expm1 { "android":"4" } + es6.math.fround { "android":"4" } + es6.math.hypot { "android":"4" } + es6.math.imul { "android":"4" } + es6.math.log1p { "android":"4" } + es6.math.log10 { "android":"4" } + es6.math.log2 { "android":"4" } + es6.math.sign { "android":"4" } + es6.math.sinh { "android":"4" } + es6.math.tanh { "android":"4" } + es6.math.trunc { "android":"4" } + es6.number.constructor { "android":"4" } + es6.number.epsilon { "android":"4" } + es6.number.is-finite { "android":"4" } + es6.number.is-integer { "android":"4" } + es6.number.is-nan { "android":"4" } + es6.number.is-safe-integer { "android":"4" } + es6.number.max-safe-integer { "android":"4" } + es6.number.min-safe-integer { "android":"4" } + es6.number.parse-float { "android":"4" } + es6.number.parse-int { "android":"4" } + es6.object.assign { "android":"4" } + es7.object.define-getter { "android":"4" } + es7.object.define-setter { "android":"4" } + es7.object.entries { "android":"4" } + es6.object.freeze { "android":"4" } + es6.object.get-own-property-descriptor { "android":"4" } + es7.object.get-own-property-descriptors { "android":"4" } + es6.object.get-own-property-names { "android":"4" } + es6.object.get-prototype-of { "android":"4" } + es7.object.lookup-getter { "android":"4" } + es7.object.lookup-setter { "android":"4" } + es6.object.prevent-extensions { "android":"4" } + es6.object.to-string { "android":"4" } + es6.object.is { "android":"4" } + es6.object.is-frozen { "android":"4" } + es6.object.is-sealed { "android":"4" } + es6.object.is-extensible { "android":"4" } + es6.object.keys { "android":"4" } + es6.object.seal { "android":"4" } + es6.object.set-prototype-of { "android":"4" } + es7.object.values { "android":"4" } + es6.promise { "android":"4" } + es7.promise.finally { "android":"4" } + es6.reflect.apply { "android":"4" } + es6.reflect.construct { "android":"4" } + es6.reflect.define-property { "android":"4" } + es6.reflect.delete-property { "android":"4" } + es6.reflect.get { "android":"4" } + es6.reflect.get-own-property-descriptor { "android":"4" } + es6.reflect.get-prototype-of { "android":"4" } + es6.reflect.has { "android":"4" } + es6.reflect.is-extensible { "android":"4" } + es6.reflect.own-keys { "android":"4" } + es6.reflect.prevent-extensions { "android":"4" } + es6.reflect.set { "android":"4" } + es6.reflect.set-prototype-of { "android":"4" } + es6.regexp.constructor { "android":"4" } + es6.regexp.flags { "android":"4" } + es6.regexp.match { "android":"4" } + es6.regexp.replace { "android":"4" } + es6.regexp.split { "android":"4" } + es6.regexp.search { "android":"4" } + es6.regexp.to-string { "android":"4" } + es6.set { "android":"4" } + es6.symbol { "android":"4" } + es7.symbol.async-iterator { "android":"4" } + es6.string.code-point-at { "android":"4" } + es6.string.ends-with { "android":"4" } + es6.string.from-code-point { "android":"4" } + es6.string.includes { "android":"4" } + es6.string.iterator { "android":"4" } + es7.string.pad-start { "android":"4" } + es7.string.pad-end { "android":"4" } + es6.string.raw { "android":"4" } + es6.string.repeat { "android":"4" } + es6.string.starts-with { "android":"4" } + es7.string.trim-left { "android":"4" } + es7.string.trim-right { "android":"4" } + es6.typed.array-buffer { "android":"4" } + es6.typed.int8-array { "android":"4" } + es6.typed.uint8-array { "android":"4" } + es6.typed.uint8-clamped-array { "android":"4" } + es6.typed.int16-array { "android":"4" } + es6.typed.uint16-array { "android":"4" } + es6.typed.int32-array { "android":"4" } + es6.typed.uint32-array { "android":"4" } + es6.typed.float32-array { "android":"4" } + es6.typed.float64-array { "android":"4" } + es6.weak-map { "android":"4" } + es6.weak-set { "android":"4" } + web.timers { "android":"4" } + web.immediate { "android":"4" } + web.dom.iterable { "android":"4" } diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs2-electron/in/in.js b/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-electron/input.mjs similarity index 100% rename from packages/babel-preset-env/test/debug-fixtures/entry-corejs2-electron/in/in.js rename to packages/babel-preset-env/test/fixtures/debug/entry-corejs2-electron/input.mjs diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-electron/options.json b/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-electron/options.json new file mode 100644 index 000000000000..87ebef4f6836 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-electron/options.json @@ -0,0 +1,17 @@ +{ + "validateLogs": true, + "ignoreOutput": true, + "presets": [ + [ + "env", + { + "debug": true, + "targets": { + "electron": 0.36 + }, + "useBuiltIns": "entry", + "corejs": 2 + } + ] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-electron/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-electron/stdout.txt new file mode 100644 index 000000000000..b97398e635fc --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-electron/stdout.txt @@ -0,0 +1,137 @@ +Warning, the following targets are using a decimal version: + + electron: 0.36 + +We recommend using a string for minor/patch versions to avoid numbers like 6.10 +getting parsed as 6.1, which can lead to unexpected behavior. + +@babel/preset-env: `DEBUG` option + +Using targets: +{ + "electron": "0.36" +} + +Using modules transform: auto + +Using plugins: + transform-function-name { "electron":"0.36" } + transform-for-of { "electron":"0.36" } + transform-sticky-regex { "electron":"0.36" } + transform-dotall-regex { "electron":"0.36" } + transform-unicode-regex { "electron":"0.36" } + transform-parameters { "electron":"0.36" } + transform-destructuring { "electron":"0.36" } + transform-block-scoping { "electron":"0.36" } + transform-regenerator { "electron":"0.36" } + transform-exponentiation-operator { "electron":"0.36" } + transform-async-to-generator { "electron":"0.36" } + proposal-async-generator-functions { "electron":"0.36" } + proposal-object-rest-spread { "electron":"0.36" } + proposal-unicode-property-regex { "electron":"0.36" } + proposal-json-strings { "electron":"0.36" } + proposal-optional-catch-binding { "electron":"0.36" } + proposal-optional-chaining { "electron":"0.36" } + transform-named-capturing-groups-regex { "electron":"0.36" } + transform-member-expression-literals { "electron":"0.36" } + transform-property-literals { "electron":"0.36" } + proposal-nullish-coalescing-operator { "electron":"0.36" } + transform-modules-commonjs { "electron":"0.36" } + proposal-dynamic-import { "electron":"0.36" } + +Using polyfills with `entry` option: + +[/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-electron/input.mjs] Replaced @babel/polyfill entries with the following polyfills: + es6.array.every { "electron":"0.36" } + es6.array.filter { "electron":"0.36" } + es7.array.flat-map { "electron":"0.36" } + es6.array.for-each { "electron":"0.36" } + es6.array.from { "electron":"0.36" } + es6.array.index-of { "electron":"0.36" } + es6.array.is-array { "electron":"0.36" } + es6.array.last-index-of { "electron":"0.36" } + es6.array.map { "electron":"0.36" } + es6.array.reduce { "electron":"0.36" } + es6.array.reduce-right { "electron":"0.36" } + es6.array.some { "electron":"0.36" } + es6.array.sort { "electron":"0.36" } + es6.array.species { "electron":"0.36" } + es6.date.now { "electron":"0.36" } + es6.date.to-iso-string { "electron":"0.36" } + es6.date.to-json { "electron":"0.36" } + es6.date.to-string { "electron":"0.36" } + es6.function.bind { "electron":"0.36" } + es6.function.has-instance { "electron":"0.36" } + es6.function.name { "electron":"0.36" } + es6.map { "electron":"0.36" } + es6.object.assign { "electron":"0.36" } + es6.object.create { "electron":"0.36" } + es7.object.define-getter { "electron":"0.36" } + es7.object.define-setter { "electron":"0.36" } + es6.object.define-property { "electron":"0.36" } + es6.object.define-properties { "electron":"0.36" } + es7.object.entries { "electron":"0.36" } + es7.object.get-own-property-descriptors { "electron":"0.36" } + es7.object.lookup-getter { "electron":"0.36" } + es7.object.lookup-setter { "electron":"0.36" } + es6.object.to-string { "electron":"0.36" } + es7.object.values { "electron":"0.36" } + es6.promise { "electron":"0.36" } + es7.promise.finally { "electron":"0.36" } + es6.reflect.apply { "electron":"0.36" } + es6.reflect.construct { "electron":"0.36" } + es6.reflect.define-property { "electron":"0.36" } + es6.reflect.delete-property { "electron":"0.36" } + es6.reflect.get { "electron":"0.36" } + es6.reflect.get-own-property-descriptor { "electron":"0.36" } + es6.reflect.get-prototype-of { "electron":"0.36" } + es6.reflect.has { "electron":"0.36" } + es6.reflect.is-extensible { "electron":"0.36" } + es6.reflect.own-keys { "electron":"0.36" } + es6.reflect.prevent-extensions { "electron":"0.36" } + es6.reflect.set { "electron":"0.36" } + es6.reflect.set-prototype-of { "electron":"0.36" } + es6.regexp.constructor { "electron":"0.36" } + es6.regexp.flags { "electron":"0.36" } + es6.regexp.match { "electron":"0.36" } + es6.regexp.replace { "electron":"0.36" } + es6.regexp.split { "electron":"0.36" } + es6.regexp.search { "electron":"0.36" } + es6.regexp.to-string { "electron":"0.36" } + es6.set { "electron":"0.36" } + es6.symbol { "electron":"0.36" } + es7.symbol.async-iterator { "electron":"0.36" } + es6.string.anchor { "electron":"0.36" } + es6.string.big { "electron":"0.36" } + es6.string.blink { "electron":"0.36" } + es6.string.bold { "electron":"0.36" } + es6.string.fixed { "electron":"0.36" } + es6.string.fontcolor { "electron":"0.36" } + es6.string.fontsize { "electron":"0.36" } + es6.string.italics { "electron":"0.36" } + es6.string.link { "electron":"0.36" } + es7.string.pad-start { "electron":"0.36" } + es7.string.pad-end { "electron":"0.36" } + es6.string.small { "electron":"0.36" } + es6.string.strike { "electron":"0.36" } + es6.string.sub { "electron":"0.36" } + es6.string.sup { "electron":"0.36" } + es6.string.trim { "electron":"0.36" } + es7.string.trim-left { "electron":"0.36" } + es7.string.trim-right { "electron":"0.36" } + es6.typed.array-buffer { "electron":"0.36" } + es6.typed.data-view { "electron":"0.36" } + es6.typed.int8-array { "electron":"0.36" } + es6.typed.uint8-array { "electron":"0.36" } + es6.typed.uint8-clamped-array { "electron":"0.36" } + es6.typed.int16-array { "electron":"0.36" } + es6.typed.uint16-array { "electron":"0.36" } + es6.typed.int32-array { "electron":"0.36" } + es6.typed.uint32-array { "electron":"0.36" } + es6.typed.float32-array { "electron":"0.36" } + es6.typed.float64-array { "electron":"0.36" } + es6.weak-map { "electron":"0.36" } + es6.weak-set { "electron":"0.36" } + web.timers { "electron":"0.36" } + web.immediate { "electron":"0.36" } + web.dom.iterable { "electron":"0.36" } diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs2-force-all-transforms/in/in.js b/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-force-all-transforms/input.mjs similarity index 100% rename from packages/babel-preset-env/test/debug-fixtures/entry-corejs2-force-all-transforms/in/in.js rename to packages/babel-preset-env/test/fixtures/debug/entry-corejs2-force-all-transforms/input.mjs diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-force-all-transforms/options.json b/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-force-all-transforms/options.json new file mode 100644 index 000000000000..63316b736f5c --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-force-all-transforms/options.json @@ -0,0 +1,19 @@ +{ + "validateLogs": true, + "ignoreOutput": true, + "presets": [ + [ + "env", + { + "debug": true, + "modules": false, + "targets": { + "chrome": 55 + }, + "useBuiltIns": "entry", + "corejs": 2, + "forceAllTransforms": true + } + ] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-force-all-transforms/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-force-all-transforms/stdout.txt new file mode 100644 index 000000000000..86eb78a01155 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-force-all-transforms/stdout.txt @@ -0,0 +1,65 @@ +@babel/preset-env: `DEBUG` option + +Using targets: +{ + "chrome": "55" +} + +Using modules transform: false + +Using plugins: + transform-template-literals {} + transform-literals {} + transform-function-name {} + transform-arrow-functions {} + transform-block-scoped-functions {} + transform-classes {} + transform-object-super {} + transform-shorthand-properties {} + transform-duplicate-keys {} + transform-computed-properties {} + transform-for-of {} + transform-sticky-regex {} + transform-dotall-regex { "chrome":"55" } + transform-unicode-regex {} + transform-spread {} + transform-parameters {} + transform-destructuring {} + transform-block-scoping {} + transform-typeof-symbol {} + transform-new-target {} + transform-regenerator {} + transform-exponentiation-operator {} + transform-async-to-generator {} + proposal-async-generator-functions { "chrome":"55" } + proposal-object-rest-spread { "chrome":"55" } + proposal-unicode-property-regex { "chrome":"55" } + proposal-json-strings { "chrome":"55" } + proposal-optional-catch-binding { "chrome":"55" } + proposal-optional-chaining { "chrome":"55" } + transform-named-capturing-groups-regex { "chrome":"55" } + transform-member-expression-literals {} + transform-property-literals {} + transform-reserved-words {} + proposal-nullish-coalescing-operator { "chrome":"55" } + syntax-dynamic-import { "chrome":"55" } + +Using polyfills with `entry` option: + +[/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-force-all-transforms/input.mjs] Replaced @babel/polyfill entries with the following polyfills: + es7.array.flat-map { "chrome":"55" } + es6.array.sort { "chrome":"55" } + es7.object.define-getter { "chrome":"55" } + es7.object.define-setter { "chrome":"55" } + es7.object.lookup-getter { "chrome":"55" } + es7.object.lookup-setter { "chrome":"55" } + es6.object.to-string { "chrome":"55" } + es7.promise.finally { "chrome":"55" } + es7.symbol.async-iterator { "chrome":"55" } + es7.string.pad-start { "chrome":"55" } + es7.string.pad-end { "chrome":"55" } + es7.string.trim-left { "chrome":"55" } + es7.string.trim-right { "chrome":"55" } + web.timers { "chrome":"55" } + web.immediate { "chrome":"55" } + web.dom.iterable { "chrome":"55" } diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs2-no-import/in/in.js b/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-no-import/input.js similarity index 100% rename from packages/babel-preset-env/test/debug-fixtures/entry-corejs2-no-import/in/in.js rename to packages/babel-preset-env/test/fixtures/debug/entry-corejs2-no-import/input.js diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-no-import/options.json b/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-no-import/options.json new file mode 100644 index 000000000000..c1bb48f690fe --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-no-import/options.json @@ -0,0 +1,17 @@ +{ + "validateLogs": true, + "ignoreOutput": true, + "presets": [ + [ + "env", + { + "debug": true, + "targets": { + "node": 6 + }, + "useBuiltIns": "entry", + "corejs": 2 + } + ] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-no-import/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-no-import/stdout.txt new file mode 100644 index 000000000000..2df247258e0e --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-no-import/stdout.txt @@ -0,0 +1,30 @@ +@babel/preset-env: `DEBUG` option + +Using targets: +{ + "node": "6" +} + +Using modules transform: auto + +Using plugins: + transform-function-name { "node":"6" } + transform-for-of { "node":"6" } + transform-dotall-regex { "node":"6" } + transform-destructuring { "node":"6" } + transform-exponentiation-operator { "node":"6" } + transform-async-to-generator { "node":"6" } + proposal-async-generator-functions { "node":"6" } + proposal-object-rest-spread { "node":"6" } + proposal-unicode-property-regex { "node":"6" } + proposal-json-strings { "node":"6" } + proposal-optional-catch-binding { "node":"6" } + proposal-optional-chaining { "node":"6" } + transform-named-capturing-groups-regex { "node":"6" } + proposal-nullish-coalescing-operator { "node":"6" } + transform-modules-commonjs { "node":"6" } + proposal-dynamic-import { "node":"6" } + +Using polyfills with `entry` option: + +[/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-no-import/input.js] Import of @babel/polyfill was not found. diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs2-proposals-chrome-71/in/in.js b/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-proposals-chrome-71/input.mjs similarity index 100% rename from packages/babel-preset-env/test/debug-fixtures/entry-corejs2-proposals-chrome-71/in/in.js rename to packages/babel-preset-env/test/fixtures/debug/entry-corejs2-proposals-chrome-71/input.mjs diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-proposals-chrome-71/options.json b/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-proposals-chrome-71/options.json new file mode 100644 index 000000000000..c40fbcce5f07 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-proposals-chrome-71/options.json @@ -0,0 +1,17 @@ +{ + "validateLogs": true, + "ignoreOutput": true, + "presets": [ + [ + "env", + { + "debug": true, + "targets": { + "browsers": "chrome 71" + }, + "useBuiltIns": "entry", + "corejs": { "version": 2, "proposals": true } + } + ] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-proposals-chrome-71/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-proposals-chrome-71/stdout.txt new file mode 100644 index 000000000000..cabc2e89b1db --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-proposals-chrome-71/stdout.txt @@ -0,0 +1,25 @@ +@babel/preset-env: `DEBUG` option + +Using targets: +{ + "chrome": "71" +} + +Using modules transform: auto + +Using plugins: + syntax-async-generators { "chrome":"71" } + syntax-object-rest-spread { "chrome":"71" } + syntax-json-strings { "chrome":"71" } + syntax-optional-catch-binding { "chrome":"71" } + proposal-optional-chaining { "chrome":"71" } + proposal-nullish-coalescing-operator { "chrome":"71" } + transform-modules-commonjs { "chrome":"71" } + proposal-dynamic-import { "chrome":"71" } + +Using polyfills with `entry` option: + +[/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-proposals-chrome-71/input.mjs] Replaced @babel/polyfill entries with the following polyfills: + web.timers { "chrome":"71" } + web.immediate { "chrome":"71" } + web.dom.iterable { "chrome":"71" } diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs2-proposals/in/in.js b/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-proposals/input.mjs similarity index 100% rename from packages/babel-preset-env/test/debug-fixtures/entry-corejs2-proposals/in/in.js rename to packages/babel-preset-env/test/fixtures/debug/entry-corejs2-proposals/input.mjs diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-proposals/options.json b/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-proposals/options.json new file mode 100644 index 000000000000..b7911d7ee093 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-proposals/options.json @@ -0,0 +1,14 @@ +{ + "validateLogs": true, + "ignoreOutput": true, + "presets": [ + [ + "env", + { + "debug": true, + "useBuiltIns": "entry", + "corejs": { "version": 2, "proposals": true } + } + ] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-proposals/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-proposals/stdout.txt new file mode 100644 index 000000000000..a43849e003a7 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-proposals/stdout.txt @@ -0,0 +1,196 @@ +@babel/preset-env: `DEBUG` option + +Using targets: +{} + +Using modules transform: auto + +Using plugins: + transform-template-literals {} + transform-literals {} + transform-function-name {} + transform-arrow-functions {} + transform-block-scoped-functions {} + transform-classes {} + transform-object-super {} + transform-shorthand-properties {} + transform-duplicate-keys {} + transform-computed-properties {} + transform-for-of {} + transform-sticky-regex {} + transform-dotall-regex {} + transform-unicode-regex {} + transform-spread {} + transform-parameters {} + transform-destructuring {} + transform-block-scoping {} + transform-typeof-symbol {} + transform-new-target {} + transform-regenerator {} + transform-exponentiation-operator {} + transform-async-to-generator {} + proposal-async-generator-functions {} + proposal-object-rest-spread {} + proposal-unicode-property-regex {} + proposal-json-strings {} + proposal-optional-catch-binding {} + proposal-optional-chaining {} + transform-named-capturing-groups-regex {} + transform-member-expression-literals {} + transform-property-literals {} + transform-reserved-words {} + proposal-nullish-coalescing-operator {} + transform-modules-commonjs {} + proposal-dynamic-import {} + +Using polyfills with `entry` option: + +[/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-proposals/input.mjs] Replaced @babel/polyfill entries with the following polyfills: + es6.array.copy-within {} + es6.array.every {} + es6.array.fill {} + es6.array.filter {} + es6.array.find {} + es6.array.find-index {} + es7.array.flat-map {} + es6.array.for-each {} + es6.array.from {} + es7.array.includes {} + es6.array.index-of {} + es6.array.is-array {} + es6.array.iterator {} + es6.array.last-index-of {} + es6.array.map {} + es6.array.of {} + es6.array.reduce {} + es6.array.reduce-right {} + es6.array.some {} + es6.array.sort {} + es6.array.species {} + es6.date.now {} + es6.date.to-iso-string {} + es6.date.to-json {} + es6.date.to-primitive {} + es6.date.to-string {} + es6.function.bind {} + es6.function.has-instance {} + es6.function.name {} + es6.map {} + es6.math.acosh {} + es6.math.asinh {} + es6.math.atanh {} + es6.math.cbrt {} + es6.math.clz32 {} + es6.math.cosh {} + es6.math.expm1 {} + es6.math.fround {} + es6.math.hypot {} + es6.math.imul {} + es6.math.log1p {} + es6.math.log10 {} + es6.math.log2 {} + es6.math.sign {} + es6.math.sinh {} + es6.math.tanh {} + es6.math.trunc {} + es6.number.constructor {} + es6.number.epsilon {} + es6.number.is-finite {} + es6.number.is-integer {} + es6.number.is-nan {} + es6.number.is-safe-integer {} + es6.number.max-safe-integer {} + es6.number.min-safe-integer {} + es6.number.parse-float {} + es6.number.parse-int {} + es6.object.assign {} + es6.object.create {} + es7.object.define-getter {} + es7.object.define-setter {} + es6.object.define-property {} + es6.object.define-properties {} + es7.object.entries {} + es6.object.freeze {} + es6.object.get-own-property-descriptor {} + es7.object.get-own-property-descriptors {} + es6.object.get-own-property-names {} + es6.object.get-prototype-of {} + es7.object.lookup-getter {} + es7.object.lookup-setter {} + es6.object.prevent-extensions {} + es6.object.to-string {} + es6.object.is {} + es6.object.is-frozen {} + es6.object.is-sealed {} + es6.object.is-extensible {} + es6.object.keys {} + es6.object.seal {} + es6.object.set-prototype-of {} + es7.object.values {} + es6.promise {} + es7.promise.finally {} + es6.reflect.apply {} + es6.reflect.construct {} + es6.reflect.define-property {} + es6.reflect.delete-property {} + es6.reflect.get {} + es6.reflect.get-own-property-descriptor {} + es6.reflect.get-prototype-of {} + es6.reflect.has {} + es6.reflect.is-extensible {} + es6.reflect.own-keys {} + es6.reflect.prevent-extensions {} + es6.reflect.set {} + es6.reflect.set-prototype-of {} + es6.regexp.constructor {} + es6.regexp.flags {} + es6.regexp.match {} + es6.regexp.replace {} + es6.regexp.split {} + es6.regexp.search {} + es6.regexp.to-string {} + es6.set {} + es6.symbol {} + es7.symbol.async-iterator {} + es6.string.anchor {} + es6.string.big {} + es6.string.blink {} + es6.string.bold {} + es6.string.code-point-at {} + es6.string.ends-with {} + es6.string.fixed {} + es6.string.fontcolor {} + es6.string.fontsize {} + es6.string.from-code-point {} + es6.string.includes {} + es6.string.italics {} + es6.string.iterator {} + es6.string.link {} + es7.string.pad-start {} + es7.string.pad-end {} + es6.string.raw {} + es6.string.repeat {} + es6.string.small {} + es6.string.starts-with {} + es6.string.strike {} + es6.string.sub {} + es6.string.sup {} + es6.string.trim {} + es7.string.trim-left {} + es7.string.trim-right {} + es6.typed.array-buffer {} + es6.typed.data-view {} + es6.typed.int8-array {} + es6.typed.uint8-array {} + es6.typed.uint8-clamped-array {} + es6.typed.int16-array {} + es6.typed.uint16-array {} + es6.typed.int32-array {} + es6.typed.uint32-array {} + es6.typed.float32-array {} + es6.typed.float64-array {} + es6.weak-map {} + es6.weak-set {} + web.timers {} + web.immediate {} + web.dom.iterable {} diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs2-shippedProposals-chrome-71/in/in.js b/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-shippedProposals-chrome-71/input.mjs similarity index 100% rename from packages/babel-preset-env/test/debug-fixtures/entry-corejs2-shippedProposals-chrome-71/in/in.js rename to packages/babel-preset-env/test/fixtures/debug/entry-corejs2-shippedProposals-chrome-71/input.mjs diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-shippedProposals-chrome-71/options.json b/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-shippedProposals-chrome-71/options.json new file mode 100644 index 000000000000..eca9a1a6033d --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-shippedProposals-chrome-71/options.json @@ -0,0 +1,18 @@ +{ + "validateLogs": true, + "ignoreOutput": true, + "presets": [ + [ + "env", + { + "debug": true, + "targets": { + "browsers": "chrome 71" + }, + "shippedProposals": true, + "useBuiltIns": "entry", + "corejs": 2 + } + ] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-shippedProposals-chrome-71/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-shippedProposals-chrome-71/stdout.txt new file mode 100644 index 000000000000..1587cd42c1f0 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-shippedProposals-chrome-71/stdout.txt @@ -0,0 +1,25 @@ +@babel/preset-env: `DEBUG` option + +Using targets: +{ + "chrome": "71" +} + +Using modules transform: auto + +Using plugins: + syntax-async-generators { "chrome":"71" } + syntax-object-rest-spread { "chrome":"71" } + syntax-json-strings { "chrome":"71" } + syntax-optional-catch-binding { "chrome":"71" } + proposal-optional-chaining { "chrome":"71" } + proposal-nullish-coalescing-operator { "chrome":"71" } + transform-modules-commonjs { "chrome":"71" } + proposal-dynamic-import { "chrome":"71" } + +Using polyfills with `entry` option: + +[/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-shippedProposals-chrome-71/input.mjs] Replaced @babel/polyfill entries with the following polyfills: + web.timers { "chrome":"71" } + web.immediate { "chrome":"71" } + web.dom.iterable { "chrome":"71" } diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs2-shippedProposals/in/in.js b/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-shippedProposals/input.mjs similarity index 100% rename from packages/babel-preset-env/test/debug-fixtures/entry-corejs2-shippedProposals/in/in.js rename to packages/babel-preset-env/test/fixtures/debug/entry-corejs2-shippedProposals/input.mjs diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-shippedProposals/options.json b/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-shippedProposals/options.json new file mode 100644 index 000000000000..7cc745ffc6f5 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-shippedProposals/options.json @@ -0,0 +1,15 @@ +{ + "validateLogs": true, + "ignoreOutput": true, + "presets": [ + [ + "env", + { + "debug": true, + "shippedProposals": true, + "useBuiltIns": "entry", + "corejs": 2 + } + ] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-shippedProposals/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-shippedProposals/stdout.txt new file mode 100644 index 000000000000..ede20c21f527 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-shippedProposals/stdout.txt @@ -0,0 +1,196 @@ +@babel/preset-env: `DEBUG` option + +Using targets: +{} + +Using modules transform: auto + +Using plugins: + transform-template-literals {} + transform-literals {} + transform-function-name {} + transform-arrow-functions {} + transform-block-scoped-functions {} + transform-classes {} + transform-object-super {} + transform-shorthand-properties {} + transform-duplicate-keys {} + transform-computed-properties {} + transform-for-of {} + transform-sticky-regex {} + transform-dotall-regex {} + transform-unicode-regex {} + transform-spread {} + transform-parameters {} + transform-destructuring {} + transform-block-scoping {} + transform-typeof-symbol {} + transform-new-target {} + transform-regenerator {} + transform-exponentiation-operator {} + transform-async-to-generator {} + proposal-async-generator-functions {} + proposal-object-rest-spread {} + proposal-unicode-property-regex {} + proposal-json-strings {} + proposal-optional-catch-binding {} + proposal-optional-chaining {} + transform-named-capturing-groups-regex {} + transform-member-expression-literals {} + transform-property-literals {} + transform-reserved-words {} + proposal-nullish-coalescing-operator {} + transform-modules-commonjs {} + proposal-dynamic-import {} + +Using polyfills with `entry` option: + +[/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-shippedProposals/input.mjs] Replaced @babel/polyfill entries with the following polyfills: + es6.array.copy-within {} + es6.array.every {} + es6.array.fill {} + es6.array.filter {} + es6.array.find {} + es6.array.find-index {} + es7.array.flat-map {} + es6.array.for-each {} + es6.array.from {} + es7.array.includes {} + es6.array.index-of {} + es6.array.is-array {} + es6.array.iterator {} + es6.array.last-index-of {} + es6.array.map {} + es6.array.of {} + es6.array.reduce {} + es6.array.reduce-right {} + es6.array.some {} + es6.array.sort {} + es6.array.species {} + es6.date.now {} + es6.date.to-iso-string {} + es6.date.to-json {} + es6.date.to-primitive {} + es6.date.to-string {} + es6.function.bind {} + es6.function.has-instance {} + es6.function.name {} + es6.map {} + es6.math.acosh {} + es6.math.asinh {} + es6.math.atanh {} + es6.math.cbrt {} + es6.math.clz32 {} + es6.math.cosh {} + es6.math.expm1 {} + es6.math.fround {} + es6.math.hypot {} + es6.math.imul {} + es6.math.log1p {} + es6.math.log10 {} + es6.math.log2 {} + es6.math.sign {} + es6.math.sinh {} + es6.math.tanh {} + es6.math.trunc {} + es6.number.constructor {} + es6.number.epsilon {} + es6.number.is-finite {} + es6.number.is-integer {} + es6.number.is-nan {} + es6.number.is-safe-integer {} + es6.number.max-safe-integer {} + es6.number.min-safe-integer {} + es6.number.parse-float {} + es6.number.parse-int {} + es6.object.assign {} + es6.object.create {} + es7.object.define-getter {} + es7.object.define-setter {} + es6.object.define-property {} + es6.object.define-properties {} + es7.object.entries {} + es6.object.freeze {} + es6.object.get-own-property-descriptor {} + es7.object.get-own-property-descriptors {} + es6.object.get-own-property-names {} + es6.object.get-prototype-of {} + es7.object.lookup-getter {} + es7.object.lookup-setter {} + es6.object.prevent-extensions {} + es6.object.to-string {} + es6.object.is {} + es6.object.is-frozen {} + es6.object.is-sealed {} + es6.object.is-extensible {} + es6.object.keys {} + es6.object.seal {} + es6.object.set-prototype-of {} + es7.object.values {} + es6.promise {} + es7.promise.finally {} + es6.reflect.apply {} + es6.reflect.construct {} + es6.reflect.define-property {} + es6.reflect.delete-property {} + es6.reflect.get {} + es6.reflect.get-own-property-descriptor {} + es6.reflect.get-prototype-of {} + es6.reflect.has {} + es6.reflect.is-extensible {} + es6.reflect.own-keys {} + es6.reflect.prevent-extensions {} + es6.reflect.set {} + es6.reflect.set-prototype-of {} + es6.regexp.constructor {} + es6.regexp.flags {} + es6.regexp.match {} + es6.regexp.replace {} + es6.regexp.split {} + es6.regexp.search {} + es6.regexp.to-string {} + es6.set {} + es6.symbol {} + es7.symbol.async-iterator {} + es6.string.anchor {} + es6.string.big {} + es6.string.blink {} + es6.string.bold {} + es6.string.code-point-at {} + es6.string.ends-with {} + es6.string.fixed {} + es6.string.fontcolor {} + es6.string.fontsize {} + es6.string.from-code-point {} + es6.string.includes {} + es6.string.italics {} + es6.string.iterator {} + es6.string.link {} + es7.string.pad-start {} + es7.string.pad-end {} + es6.string.raw {} + es6.string.repeat {} + es6.string.small {} + es6.string.starts-with {} + es6.string.strike {} + es6.string.sub {} + es6.string.sup {} + es6.string.trim {} + es7.string.trim-left {} + es7.string.trim-right {} + es6.typed.array-buffer {} + es6.typed.data-view {} + es6.typed.int8-array {} + es6.typed.uint8-array {} + es6.typed.uint8-clamped-array {} + es6.typed.int16-array {} + es6.typed.uint16-array {} + es6.typed.int32-array {} + es6.typed.uint32-array {} + es6.typed.float32-array {} + es6.typed.float64-array {} + es6.weak-map {} + es6.weak-set {} + web.timers {} + web.immediate {} + web.dom.iterable {} diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs2-specific-targets/in/in.js b/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-specific-targets/input.mjs similarity index 100% rename from packages/babel-preset-env/test/debug-fixtures/entry-corejs2-specific-targets/in/in.js rename to packages/babel-preset-env/test/fixtures/debug/entry-corejs2-specific-targets/input.mjs diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-specific-targets/options.json b/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-specific-targets/options.json new file mode 100644 index 000000000000..2c036f8e4d1d --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-specific-targets/options.json @@ -0,0 +1,17 @@ +{ + "validateLogs": true, + "ignoreOutput": true, + "presets": [ + [ + "env", + { + "debug": true, + "targets": { + "browsers": "ie 10, ios 9, safari 7, edge 13, chrome 54, firefox 49" + }, + "useBuiltIns": "entry", + "corejs": 2 + } + ] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-specific-targets/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-specific-targets/stdout.txt new file mode 100644 index 000000000000..9c1a297d0331 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-specific-targets/stdout.txt @@ -0,0 +1,181 @@ +@babel/preset-env: `DEBUG` option + +Using targets: +{ + "chrome": "54", + "edge": "13", + "firefox": "49", + "ie": "10", + "ios": "9", + "safari": "7" +} + +Using modules transform: auto + +Using plugins: + transform-template-literals { "ie":"10", "ios":"9", "safari":"7" } + transform-literals { "firefox":"49", "ie":"10", "safari":"7" } + transform-function-name { "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + transform-arrow-functions { "ie":"10", "ios":"9", "safari":"7" } + transform-block-scoped-functions { "ie":"10", "ios":"9", "safari":"7" } + transform-classes { "ie":"10", "ios":"9", "safari":"7" } + transform-object-super { "ie":"10", "ios":"9", "safari":"7" } + transform-shorthand-properties { "ie":"10", "safari":"7" } + transform-duplicate-keys { "ie":"10", "safari":"7" } + transform-computed-properties { "ie":"10", "safari":"7" } + transform-for-of { "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + transform-sticky-regex { "ie":"10", "ios":"9", "safari":"7" } + transform-dotall-regex { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + transform-unicode-regex { "ie":"10", "ios":"9", "safari":"7" } + transform-spread { "ie":"10", "ios":"9", "safari":"7" } + transform-parameters { "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + transform-destructuring { "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + transform-block-scoping { "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + transform-typeof-symbol { "ie":"10", "safari":"7" } + transform-new-target { "edge":"13", "ie":"10", "ios":"9", "safari":"7" } + transform-regenerator { "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + transform-exponentiation-operator { "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + transform-async-to-generator { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + proposal-async-generator-functions { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + proposal-object-rest-spread { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + proposal-unicode-property-regex { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + proposal-json-strings { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + proposal-optional-catch-binding { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + proposal-optional-chaining { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + transform-named-capturing-groups-regex { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + proposal-nullish-coalescing-operator { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + transform-modules-commonjs { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + proposal-dynamic-import { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + +Using polyfills with `entry` option: + +[/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-specific-targets/input.mjs] Replaced @babel/polyfill entries with the following polyfills: + es6.array.copy-within { "ie":"10", "safari":"7" } + es6.array.fill { "ie":"10", "safari":"7" } + es6.array.find { "ie":"10", "safari":"7" } + es6.array.find-index { "ie":"10", "safari":"7" } + es7.array.flat-map { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + es6.array.from { "edge":"13", "ie":"10", "ios":"9", "safari":"7" } + es7.array.includes { "edge":"13", "ie":"10", "ios":"9", "safari":"7" } + es6.array.iterator { "ie":"10", "safari":"7" } + es6.array.of { "ie":"10", "safari":"7" } + es6.array.sort { "chrome":"54", "ios":"9", "safari":"7" } + es6.array.species { "ie":"10", "ios":"9", "safari":"7" } + es6.date.to-json { "ios":"9", "safari":"7" } + es6.date.to-primitive { "edge":"13", "ie":"10", "ios":"9", "safari":"7" } + es6.function.has-instance { "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + es6.function.name { "edge":"13", "ie":"10" } + es6.map { "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + es6.math.acosh { "ie":"10", "safari":"7" } + es6.math.asinh { "ie":"10", "safari":"7" } + es6.math.atanh { "ie":"10", "safari":"7" } + es6.math.cbrt { "ie":"10", "safari":"7" } + es6.math.clz32 { "ie":"10", "safari":"7" } + es6.math.cosh { "ie":"10", "safari":"7" } + es6.math.expm1 { "ie":"10", "safari":"7" } + es6.math.fround { "ie":"10", "safari":"7" } + es6.math.hypot { "ie":"10", "safari":"7" } + es6.math.imul { "ie":"10" } + es6.math.log1p { "ie":"10", "safari":"7" } + es6.math.log10 { "ie":"10", "safari":"7" } + es6.math.log2 { "ie":"10", "safari":"7" } + es6.math.sign { "ie":"10", "safari":"7" } + es6.math.sinh { "ie":"10", "safari":"7" } + es6.math.tanh { "ie":"10", "safari":"7" } + es6.math.trunc { "ie":"10", "safari":"7" } + es6.number.constructor { "ie":"10", "safari":"7" } + es6.number.epsilon { "ie":"10", "safari":"7" } + es6.number.is-finite { "ie":"10", "safari":"7" } + es6.number.is-integer { "ie":"10", "safari":"7" } + es6.number.is-nan { "ie":"10", "safari":"7" } + es6.number.is-safe-integer { "ie":"10", "safari":"7" } + es6.number.max-safe-integer { "ie":"10", "safari":"7" } + es6.number.min-safe-integer { "ie":"10", "safari":"7" } + es6.number.parse-float { "ie":"10", "safari":"7" } + es6.number.parse-int { "ie":"10", "safari":"7" } + es6.object.assign { "ie":"10", "ios":"9", "safari":"7" } + es7.object.define-getter { "chrome":"54", "edge":"13", "ie":"10", "safari":"7" } + es7.object.define-setter { "chrome":"54", "edge":"13", "ie":"10", "safari":"7" } + es7.object.entries { "edge":"13", "ie":"10", "ios":"9", "safari":"7" } + es6.object.freeze { "ie":"10", "safari":"7" } + es6.object.get-own-property-descriptor { "ie":"10", "safari":"7" } + es7.object.get-own-property-descriptors { "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + es6.object.get-own-property-names { "ie":"10", "safari":"7" } + es6.object.get-prototype-of { "ie":"10", "safari":"7" } + es7.object.lookup-getter { "chrome":"54", "edge":"13", "ie":"10", "safari":"7" } + es7.object.lookup-setter { "chrome":"54", "edge":"13", "ie":"10", "safari":"7" } + es6.object.prevent-extensions { "ie":"10", "safari":"7" } + es6.object.to-string { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + es6.object.is { "ie":"10", "safari":"7" } + es6.object.is-frozen { "ie":"10", "safari":"7" } + es6.object.is-sealed { "ie":"10", "safari":"7" } + es6.object.is-extensible { "ie":"10", "safari":"7" } + es6.object.keys { "ie":"10", "safari":"7" } + es6.object.seal { "ie":"10", "safari":"7" } + es6.object.set-prototype-of { "ie":"10", "safari":"7" } + es7.object.values { "edge":"13", "ie":"10", "ios":"9", "safari":"7" } + es6.promise { "edge":"13", "ie":"10", "ios":"9", "safari":"7" } + es7.promise.finally { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + es6.reflect.apply { "ie":"10", "ios":"9", "safari":"7" } + es6.reflect.construct { "ie":"10", "ios":"9", "safari":"7" } + es6.reflect.define-property { "ie":"10", "ios":"9", "safari":"7" } + es6.reflect.delete-property { "ie":"10", "ios":"9", "safari":"7" } + es6.reflect.get { "ie":"10", "ios":"9", "safari":"7" } + es6.reflect.get-own-property-descriptor { "ie":"10", "ios":"9", "safari":"7" } + es6.reflect.get-prototype-of { "ie":"10", "ios":"9", "safari":"7" } + es6.reflect.has { "ie":"10", "ios":"9", "safari":"7" } + es6.reflect.is-extensible { "ie":"10", "ios":"9", "safari":"7" } + es6.reflect.own-keys { "ie":"10", "ios":"9", "safari":"7" } + es6.reflect.prevent-extensions { "ie":"10", "ios":"9", "safari":"7" } + es6.reflect.set { "ie":"10", "ios":"9", "safari":"7" } + es6.reflect.set-prototype-of { "ie":"10", "ios":"9", "safari":"7" } + es6.regexp.constructor { "edge":"13", "ie":"10", "ios":"9", "safari":"7" } + es6.regexp.flags { "edge":"13", "ie":"10", "safari":"7" } + es6.regexp.match { "edge":"13", "ie":"10", "ios":"9", "safari":"7" } + es6.regexp.replace { "edge":"13", "ie":"10", "ios":"9", "safari":"7" } + es6.regexp.split { "edge":"13", "ie":"10", "ios":"9", "safari":"7" } + es6.regexp.search { "edge":"13", "ie":"10", "ios":"9", "safari":"7" } + es6.regexp.to-string { "edge":"13", "ie":"10", "ios":"9", "safari":"7" } + es6.set { "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + es6.symbol { "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + es7.symbol.async-iterator { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + es6.string.anchor { "ie":"10" } + es6.string.big { "ie":"10" } + es6.string.blink { "ie":"10" } + es6.string.bold { "ie":"10" } + es6.string.code-point-at { "ie":"10", "safari":"7" } + es6.string.ends-with { "ie":"10", "safari":"7" } + es6.string.fixed { "ie":"10" } + es6.string.fontcolor { "ie":"10" } + es6.string.fontsize { "ie":"10" } + es6.string.from-code-point { "ie":"10", "safari":"7" } + es6.string.includes { "ie":"10", "safari":"7" } + es6.string.italics { "ie":"10" } + es6.string.iterator { "ie":"10", "safari":"7" } + es6.string.link { "ie":"10" } + es7.string.pad-start { "chrome":"54", "edge":"13", "ie":"10", "ios":"9", "safari":"7" } + es7.string.pad-end { "chrome":"54", "edge":"13", "ie":"10", "ios":"9", "safari":"7" } + es6.string.raw { "ie":"10", "safari":"7" } + es6.string.repeat { "ie":"10", "safari":"7" } + es6.string.small { "ie":"10" } + es6.string.starts-with { "ie":"10", "safari":"7" } + es6.string.strike { "ie":"10" } + es6.string.sub { "ie":"10" } + es6.string.sup { "ie":"10" } + es7.string.trim-left { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + es7.string.trim-right { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + es6.typed.array-buffer { "ie":"10", "ios":"9", "safari":"7" } + es6.typed.int8-array { "ie":"10", "ios":"9", "safari":"7" } + es6.typed.uint8-array { "ie":"10", "ios":"9", "safari":"7" } + es6.typed.uint8-clamped-array { "ie":"10", "ios":"9", "safari":"7" } + es6.typed.int16-array { "ie":"10", "ios":"9", "safari":"7" } + es6.typed.uint16-array { "ie":"10", "ios":"9", "safari":"7" } + es6.typed.int32-array { "ie":"10", "ios":"9", "safari":"7" } + es6.typed.uint32-array { "ie":"10", "ios":"9", "safari":"7" } + es6.typed.float32-array { "ie":"10", "ios":"9", "safari":"7" } + es6.typed.float64-array { "ie":"10", "ios":"9", "safari":"7" } + es6.weak-map { "edge":"13", "firefox":"49", "ie":"10", "safari":"7" } + es6.weak-set { "edge":"13", "firefox":"49", "ie":"10", "safari":"7" } + web.timers { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + web.immediate { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + web.dom.iterable { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs2-versions-decimals/in/in.js b/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-versions-decimals/input.mjs similarity index 100% rename from packages/babel-preset-env/test/debug-fixtures/entry-corejs2-versions-decimals/in/in.js rename to packages/babel-preset-env/test/fixtures/debug/entry-corejs2-versions-decimals/input.mjs diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-versions-decimals/options.json b/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-versions-decimals/options.json new file mode 100644 index 000000000000..637bfdfe8456 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-versions-decimals/options.json @@ -0,0 +1,20 @@ +{ + "validateLogs": true, + "ignoreOutput": true, + "presets": [ + [ + "env", + { + "useBuiltIns": "entry", + "corejs": 2, + "debug": true, + "targets": { + "chrome": 54, + "electron": 0.36, + "node": 6.1, + "ie": 10 + } + } + ] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-versions-decimals/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-versions-decimals/stdout.txt new file mode 100644 index 000000000000..e19313854516 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-versions-decimals/stdout.txt @@ -0,0 +1,208 @@ +Warning, the following targets are using a decimal version: + + electron: 0.36 + node: 6.1 + +We recommend using a string for minor/patch versions to avoid numbers like 6.10 +getting parsed as 6.1, which can lead to unexpected behavior. + +@babel/preset-env: `DEBUG` option + +Using targets: +{ + "chrome": "54", + "electron": "0.36", + "ie": "10", + "node": "6.1" +} + +Using modules transform: auto + +Using plugins: + transform-template-literals { "ie":"10" } + transform-literals { "ie":"10" } + transform-function-name { "electron":"0.36", "ie":"10", "node":"6.1" } + transform-arrow-functions { "ie":"10" } + transform-block-scoped-functions { "ie":"10" } + transform-classes { "ie":"10" } + transform-object-super { "ie":"10" } + transform-shorthand-properties { "ie":"10" } + transform-duplicate-keys { "ie":"10" } + transform-computed-properties { "ie":"10" } + transform-for-of { "electron":"0.36", "ie":"10", "node":"6.1" } + transform-sticky-regex { "electron":"0.36", "ie":"10" } + transform-dotall-regex { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } + transform-unicode-regex { "electron":"0.36", "ie":"10" } + transform-spread { "ie":"10" } + transform-parameters { "electron":"0.36", "ie":"10" } + transform-destructuring { "electron":"0.36", "ie":"10", "node":"6.1" } + transform-block-scoping { "electron":"0.36", "ie":"10" } + transform-typeof-symbol { "ie":"10" } + transform-new-target { "ie":"10" } + transform-regenerator { "electron":"0.36", "ie":"10" } + transform-exponentiation-operator { "electron":"0.36", "ie":"10", "node":"6.1" } + transform-async-to-generator { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } + proposal-async-generator-functions { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } + proposal-object-rest-spread { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } + proposal-unicode-property-regex { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } + proposal-json-strings { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } + proposal-optional-catch-binding { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } + proposal-optional-chaining { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } + transform-named-capturing-groups-regex { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } + transform-member-expression-literals { "electron":"0.36" } + transform-property-literals { "electron":"0.36" } + proposal-nullish-coalescing-operator { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } + transform-modules-commonjs { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } + proposal-dynamic-import { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } + +Using polyfills with `entry` option: + +[/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-versions-decimals/input.mjs] Replaced @babel/polyfill entries with the following polyfills: + es6.array.copy-within { "ie":"10" } + es6.array.every { "electron":"0.36" } + es6.array.fill { "ie":"10" } + es6.array.filter { "electron":"0.36" } + es6.array.find { "ie":"10" } + es6.array.find-index { "ie":"10" } + es7.array.flat-map { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } + es6.array.for-each { "electron":"0.36" } + es6.array.from { "electron":"0.36", "ie":"10", "node":"6.1" } + es7.array.includes { "ie":"10" } + es6.array.index-of { "electron":"0.36" } + es6.array.is-array { "electron":"0.36" } + es6.array.iterator { "ie":"10" } + es6.array.last-index-of { "electron":"0.36" } + es6.array.map { "electron":"0.36" } + es6.array.of { "ie":"10" } + es6.array.reduce { "electron":"0.36" } + es6.array.reduce-right { "electron":"0.36" } + es6.array.some { "electron":"0.36" } + es6.array.sort { "chrome":"54", "electron":"0.36", "node":"6.1" } + es6.array.species { "electron":"0.36", "ie":"10", "node":"6.1" } + es6.date.now { "electron":"0.36" } + es6.date.to-iso-string { "electron":"0.36" } + es6.date.to-json { "electron":"0.36" } + es6.date.to-primitive { "ie":"10" } + es6.date.to-string { "electron":"0.36" } + es6.function.bind { "electron":"0.36" } + es6.function.has-instance { "electron":"0.36", "ie":"10", "node":"6.1" } + es6.function.name { "electron":"0.36", "ie":"10" } + es6.map { "electron":"0.36", "ie":"10", "node":"6.1" } + es6.math.acosh { "ie":"10" } + es6.math.asinh { "ie":"10" } + es6.math.atanh { "ie":"10" } + es6.math.cbrt { "ie":"10" } + es6.math.clz32 { "ie":"10" } + es6.math.cosh { "ie":"10" } + es6.math.expm1 { "ie":"10" } + es6.math.fround { "ie":"10" } + es6.math.hypot { "ie":"10" } + es6.math.imul { "ie":"10" } + es6.math.log1p { "ie":"10" } + es6.math.log10 { "ie":"10" } + es6.math.log2 { "ie":"10" } + es6.math.sign { "ie":"10" } + es6.math.sinh { "ie":"10" } + es6.math.tanh { "ie":"10" } + es6.math.trunc { "ie":"10" } + es6.number.constructor { "ie":"10" } + es6.number.epsilon { "ie":"10" } + es6.number.is-finite { "ie":"10" } + es6.number.is-integer { "ie":"10" } + es6.number.is-nan { "ie":"10" } + es6.number.is-safe-integer { "ie":"10" } + es6.number.max-safe-integer { "ie":"10" } + es6.number.min-safe-integer { "ie":"10" } + es6.number.parse-float { "ie":"10" } + es6.number.parse-int { "ie":"10" } + es6.object.assign { "electron":"0.36", "ie":"10" } + es6.object.create { "electron":"0.36" } + es7.object.define-getter { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } + es7.object.define-setter { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } + es6.object.define-property { "electron":"0.36" } + es6.object.define-properties { "electron":"0.36" } + es7.object.entries { "electron":"0.36", "ie":"10", "node":"6.1" } + es6.object.freeze { "ie":"10" } + es6.object.get-own-property-descriptor { "ie":"10" } + es7.object.get-own-property-descriptors { "electron":"0.36", "ie":"10", "node":"6.1" } + es6.object.get-own-property-names { "ie":"10" } + es6.object.get-prototype-of { "ie":"10" } + es7.object.lookup-getter { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } + es7.object.lookup-setter { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } + es6.object.prevent-extensions { "ie":"10" } + es6.object.to-string { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } + es6.object.is { "ie":"10" } + es6.object.is-frozen { "ie":"10" } + es6.object.is-sealed { "ie":"10" } + es6.object.is-extensible { "ie":"10" } + es6.object.keys { "ie":"10" } + es6.object.seal { "ie":"10" } + es6.object.set-prototype-of { "ie":"10" } + es7.object.values { "electron":"0.36", "ie":"10", "node":"6.1" } + es6.promise { "electron":"0.36", "ie":"10", "node":"6.1" } + es7.promise.finally { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } + es6.reflect.apply { "electron":"0.36", "ie":"10" } + es6.reflect.construct { "electron":"0.36", "ie":"10" } + es6.reflect.define-property { "electron":"0.36", "ie":"10" } + es6.reflect.delete-property { "electron":"0.36", "ie":"10" } + es6.reflect.get { "electron":"0.36", "ie":"10" } + es6.reflect.get-own-property-descriptor { "electron":"0.36", "ie":"10" } + es6.reflect.get-prototype-of { "electron":"0.36", "ie":"10" } + es6.reflect.has { "electron":"0.36", "ie":"10" } + es6.reflect.is-extensible { "electron":"0.36", "ie":"10" } + es6.reflect.own-keys { "electron":"0.36", "ie":"10" } + es6.reflect.prevent-extensions { "electron":"0.36", "ie":"10" } + es6.reflect.set { "electron":"0.36", "ie":"10" } + es6.reflect.set-prototype-of { "electron":"0.36", "ie":"10" } + es6.regexp.constructor { "electron":"0.36", "ie":"10" } + es6.regexp.flags { "electron":"0.36", "ie":"10" } + es6.regexp.match { "electron":"0.36", "ie":"10" } + es6.regexp.replace { "electron":"0.36", "ie":"10" } + es6.regexp.split { "electron":"0.36", "ie":"10" } + es6.regexp.search { "electron":"0.36", "ie":"10" } + es6.regexp.to-string { "electron":"0.36", "ie":"10" } + es6.set { "electron":"0.36", "ie":"10", "node":"6.1" } + es6.symbol { "electron":"0.36", "ie":"10", "node":"6.1" } + es7.symbol.async-iterator { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } + es6.string.anchor { "electron":"0.36", "ie":"10" } + es6.string.big { "electron":"0.36", "ie":"10" } + es6.string.blink { "electron":"0.36", "ie":"10" } + es6.string.bold { "electron":"0.36", "ie":"10" } + es6.string.code-point-at { "ie":"10" } + es6.string.ends-with { "ie":"10" } + es6.string.fixed { "electron":"0.36", "ie":"10" } + es6.string.fontcolor { "electron":"0.36", "ie":"10" } + es6.string.fontsize { "electron":"0.36", "ie":"10" } + es6.string.from-code-point { "ie":"10" } + es6.string.includes { "ie":"10" } + es6.string.italics { "electron":"0.36", "ie":"10" } + es6.string.iterator { "ie":"10" } + es6.string.link { "electron":"0.36", "ie":"10" } + es7.string.pad-start { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } + es7.string.pad-end { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } + es6.string.raw { "ie":"10" } + es6.string.repeat { "ie":"10" } + es6.string.small { "electron":"0.36", "ie":"10" } + es6.string.starts-with { "ie":"10" } + es6.string.strike { "electron":"0.36", "ie":"10" } + es6.string.sub { "electron":"0.36", "ie":"10" } + es6.string.sup { "electron":"0.36", "ie":"10" } + es6.string.trim { "electron":"0.36" } + es7.string.trim-left { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } + es7.string.trim-right { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } + es6.typed.array-buffer { "electron":"0.36", "ie":"10", "node":"6.1" } + es6.typed.data-view { "electron":"0.36" } + es6.typed.int8-array { "electron":"0.36", "ie":"10", "node":"6.1" } + es6.typed.uint8-array { "electron":"0.36", "ie":"10", "node":"6.1" } + es6.typed.uint8-clamped-array { "electron":"0.36", "ie":"10", "node":"6.1" } + es6.typed.int16-array { "electron":"0.36", "ie":"10", "node":"6.1" } + es6.typed.uint16-array { "electron":"0.36", "ie":"10", "node":"6.1" } + es6.typed.int32-array { "electron":"0.36", "ie":"10", "node":"6.1" } + es6.typed.uint32-array { "electron":"0.36", "ie":"10", "node":"6.1" } + es6.typed.float32-array { "electron":"0.36", "ie":"10", "node":"6.1" } + es6.typed.float64-array { "electron":"0.36", "ie":"10", "node":"6.1" } + es6.weak-map { "electron":"0.36", "ie":"10", "node":"6.1" } + es6.weak-set { "electron":"0.36", "ie":"10", "node":"6.1" } + web.timers { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } + web.immediate { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } + web.dom.iterable { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs2-versions-strings/in/in.js b/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-versions-strings/input.mjs similarity index 100% rename from packages/babel-preset-env/test/debug-fixtures/entry-corejs2-versions-strings/in/in.js rename to packages/babel-preset-env/test/fixtures/debug/entry-corejs2-versions-strings/input.mjs diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-versions-strings/options.json b/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-versions-strings/options.json new file mode 100644 index 000000000000..7fcba34b836c --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-versions-strings/options.json @@ -0,0 +1,19 @@ +{ + "validateLogs": true, + "ignoreOutput": true, + "presets": [ + [ + "env", + { + "useBuiltIns": "entry", + "corejs": 2, + "debug": true, + "targets": { + "chrome": "54", + "node": "6.10", + "ie": "10" + } + } + ] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-versions-strings/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-versions-strings/stdout.txt new file mode 100644 index 000000000000..2d8d7d79f36f --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-versions-strings/stdout.txt @@ -0,0 +1,177 @@ +@babel/preset-env: `DEBUG` option + +Using targets: +{ + "chrome": "54", + "ie": "10", + "node": "6.10" +} + +Using modules transform: auto + +Using plugins: + transform-template-literals { "ie":"10" } + transform-literals { "ie":"10" } + transform-function-name { "ie":"10" } + transform-arrow-functions { "ie":"10" } + transform-block-scoped-functions { "ie":"10" } + transform-classes { "ie":"10" } + transform-object-super { "ie":"10" } + transform-shorthand-properties { "ie":"10" } + transform-duplicate-keys { "ie":"10" } + transform-computed-properties { "ie":"10" } + transform-for-of { "ie":"10" } + transform-sticky-regex { "ie":"10" } + transform-dotall-regex { "chrome":"54", "ie":"10", "node":"6.10" } + transform-unicode-regex { "ie":"10" } + transform-spread { "ie":"10" } + transform-parameters { "ie":"10" } + transform-destructuring { "ie":"10" } + transform-block-scoping { "ie":"10" } + transform-typeof-symbol { "ie":"10" } + transform-new-target { "ie":"10" } + transform-regenerator { "ie":"10" } + transform-exponentiation-operator { "ie":"10", "node":"6.10" } + transform-async-to-generator { "chrome":"54", "ie":"10", "node":"6.10" } + proposal-async-generator-functions { "chrome":"54", "ie":"10", "node":"6.10" } + proposal-object-rest-spread { "chrome":"54", "ie":"10", "node":"6.10" } + proposal-unicode-property-regex { "chrome":"54", "ie":"10", "node":"6.10" } + proposal-json-strings { "chrome":"54", "ie":"10", "node":"6.10" } + proposal-optional-catch-binding { "chrome":"54", "ie":"10", "node":"6.10" } + proposal-optional-chaining { "chrome":"54", "ie":"10", "node":"6.10" } + transform-named-capturing-groups-regex { "chrome":"54", "ie":"10", "node":"6.10" } + proposal-nullish-coalescing-operator { "chrome":"54", "ie":"10", "node":"6.10" } + transform-modules-commonjs { "chrome":"54", "ie":"10", "node":"6.10" } + proposal-dynamic-import { "chrome":"54", "ie":"10", "node":"6.10" } + +Using polyfills with `entry` option: + +[/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-versions-strings/input.mjs] Replaced @babel/polyfill entries with the following polyfills: + es6.array.copy-within { "ie":"10" } + es6.array.fill { "ie":"10" } + es6.array.find { "ie":"10" } + es6.array.find-index { "ie":"10" } + es7.array.flat-map { "chrome":"54", "ie":"10", "node":"6.10" } + es6.array.from { "ie":"10" } + es7.array.includes { "ie":"10" } + es6.array.iterator { "ie":"10" } + es6.array.of { "ie":"10" } + es6.array.sort { "chrome":"54", "node":"6.10" } + es6.array.species { "ie":"10" } + es6.date.to-primitive { "ie":"10" } + es6.function.has-instance { "ie":"10" } + es6.function.name { "ie":"10" } + es6.map { "ie":"10" } + es6.math.acosh { "ie":"10" } + es6.math.asinh { "ie":"10" } + es6.math.atanh { "ie":"10" } + es6.math.cbrt { "ie":"10" } + es6.math.clz32 { "ie":"10" } + es6.math.cosh { "ie":"10" } + es6.math.expm1 { "ie":"10" } + es6.math.fround { "ie":"10" } + es6.math.hypot { "ie":"10" } + es6.math.imul { "ie":"10" } + es6.math.log1p { "ie":"10" } + es6.math.log10 { "ie":"10" } + es6.math.log2 { "ie":"10" } + es6.math.sign { "ie":"10" } + es6.math.sinh { "ie":"10" } + es6.math.tanh { "ie":"10" } + es6.math.trunc { "ie":"10" } + es6.number.constructor { "ie":"10" } + es6.number.epsilon { "ie":"10" } + es6.number.is-finite { "ie":"10" } + es6.number.is-integer { "ie":"10" } + es6.number.is-nan { "ie":"10" } + es6.number.is-safe-integer { "ie":"10" } + es6.number.max-safe-integer { "ie":"10" } + es6.number.min-safe-integer { "ie":"10" } + es6.number.parse-float { "ie":"10" } + es6.number.parse-int { "ie":"10" } + es6.object.assign { "ie":"10" } + es7.object.define-getter { "chrome":"54", "ie":"10", "node":"6.10" } + es7.object.define-setter { "chrome":"54", "ie":"10", "node":"6.10" } + es7.object.entries { "ie":"10", "node":"6.10" } + es6.object.freeze { "ie":"10" } + es6.object.get-own-property-descriptor { "ie":"10" } + es7.object.get-own-property-descriptors { "ie":"10", "node":"6.10" } + es6.object.get-own-property-names { "ie":"10" } + es6.object.get-prototype-of { "ie":"10" } + es7.object.lookup-getter { "chrome":"54", "ie":"10", "node":"6.10" } + es7.object.lookup-setter { "chrome":"54", "ie":"10", "node":"6.10" } + es6.object.prevent-extensions { "ie":"10" } + es6.object.to-string { "chrome":"54", "ie":"10", "node":"6.10" } + es6.object.is { "ie":"10" } + es6.object.is-frozen { "ie":"10" } + es6.object.is-sealed { "ie":"10" } + es6.object.is-extensible { "ie":"10" } + es6.object.keys { "ie":"10" } + es6.object.seal { "ie":"10" } + es6.object.set-prototype-of { "ie":"10" } + es7.object.values { "ie":"10", "node":"6.10" } + es6.promise { "ie":"10" } + es7.promise.finally { "chrome":"54", "ie":"10", "node":"6.10" } + es6.reflect.apply { "ie":"10" } + es6.reflect.construct { "ie":"10" } + es6.reflect.define-property { "ie":"10" } + es6.reflect.delete-property { "ie":"10" } + es6.reflect.get { "ie":"10" } + es6.reflect.get-own-property-descriptor { "ie":"10" } + es6.reflect.get-prototype-of { "ie":"10" } + es6.reflect.has { "ie":"10" } + es6.reflect.is-extensible { "ie":"10" } + es6.reflect.own-keys { "ie":"10" } + es6.reflect.prevent-extensions { "ie":"10" } + es6.reflect.set { "ie":"10" } + es6.reflect.set-prototype-of { "ie":"10" } + es6.regexp.constructor { "ie":"10" } + es6.regexp.flags { "ie":"10" } + es6.regexp.match { "ie":"10" } + es6.regexp.replace { "ie":"10" } + es6.regexp.split { "ie":"10" } + es6.regexp.search { "ie":"10" } + es6.regexp.to-string { "ie":"10" } + es6.set { "ie":"10" } + es6.symbol { "ie":"10" } + es7.symbol.async-iterator { "chrome":"54", "ie":"10", "node":"6.10" } + es6.string.anchor { "ie":"10" } + es6.string.big { "ie":"10" } + es6.string.blink { "ie":"10" } + es6.string.bold { "ie":"10" } + es6.string.code-point-at { "ie":"10" } + es6.string.ends-with { "ie":"10" } + es6.string.fixed { "ie":"10" } + es6.string.fontcolor { "ie":"10" } + es6.string.fontsize { "ie":"10" } + es6.string.from-code-point { "ie":"10" } + es6.string.includes { "ie":"10" } + es6.string.italics { "ie":"10" } + es6.string.iterator { "ie":"10" } + es6.string.link { "ie":"10" } + es7.string.pad-start { "chrome":"54", "ie":"10", "node":"6.10" } + es7.string.pad-end { "chrome":"54", "ie":"10", "node":"6.10" } + es6.string.raw { "ie":"10" } + es6.string.repeat { "ie":"10" } + es6.string.small { "ie":"10" } + es6.string.starts-with { "ie":"10" } + es6.string.strike { "ie":"10" } + es6.string.sub { "ie":"10" } + es6.string.sup { "ie":"10" } + es7.string.trim-left { "chrome":"54", "ie":"10", "node":"6.10" } + es7.string.trim-right { "chrome":"54", "ie":"10", "node":"6.10" } + es6.typed.array-buffer { "ie":"10" } + es6.typed.int8-array { "ie":"10" } + es6.typed.uint8-array { "ie":"10" } + es6.typed.uint8-clamped-array { "ie":"10" } + es6.typed.int16-array { "ie":"10" } + es6.typed.uint16-array { "ie":"10" } + es6.typed.int32-array { "ie":"10" } + es6.typed.uint32-array { "ie":"10" } + es6.typed.float32-array { "ie":"10" } + es6.typed.float64-array { "ie":"10" } + es6.weak-map { "ie":"10" } + es6.weak-set { "ie":"10" } + web.timers { "chrome":"54", "ie":"10", "node":"6.10" } + web.immediate { "chrome":"54", "ie":"10", "node":"6.10" } + web.dom.iterable { "chrome":"54", "ie":"10", "node":"6.10" } diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs2/in/in.js b/packages/babel-preset-env/test/fixtures/debug/entry-corejs2/input.mjs similarity index 100% rename from packages/babel-preset-env/test/debug-fixtures/entry-corejs2/in/in.js rename to packages/babel-preset-env/test/fixtures/debug/entry-corejs2/input.mjs diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs2/options.json b/packages/babel-preset-env/test/fixtures/debug/entry-corejs2/options.json new file mode 100644 index 000000000000..e8cc67c9ac8e --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs2/options.json @@ -0,0 +1,18 @@ +{ + "validateLogs": true, + "ignoreOutput": true, + "presets": [ + [ + "env", + { + "debug": true, + "targets": { + "browsers": "chrome >= 54, ie 10", + "node": 6 + }, + "useBuiltIns": "entry", + "corejs": 2 + } + ] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs2/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/entry-corejs2/stdout.txt new file mode 100644 index 000000000000..68c9b3ce7d22 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs2/stdout.txt @@ -0,0 +1,177 @@ +@babel/preset-env: `DEBUG` option + +Using targets: +{ + "chrome": "54", + "ie": "10", + "node": "6" +} + +Using modules transform: auto + +Using plugins: + transform-template-literals { "ie":"10" } + transform-literals { "ie":"10" } + transform-function-name { "ie":"10", "node":"6" } + transform-arrow-functions { "ie":"10" } + transform-block-scoped-functions { "ie":"10" } + transform-classes { "ie":"10" } + transform-object-super { "ie":"10" } + transform-shorthand-properties { "ie":"10" } + transform-duplicate-keys { "ie":"10" } + transform-computed-properties { "ie":"10" } + transform-for-of { "ie":"10", "node":"6" } + transform-sticky-regex { "ie":"10" } + transform-dotall-regex { "chrome":"54", "ie":"10", "node":"6" } + transform-unicode-regex { "ie":"10" } + transform-spread { "ie":"10" } + transform-parameters { "ie":"10" } + transform-destructuring { "ie":"10", "node":"6" } + transform-block-scoping { "ie":"10" } + transform-typeof-symbol { "ie":"10" } + transform-new-target { "ie":"10" } + transform-regenerator { "ie":"10" } + transform-exponentiation-operator { "ie":"10", "node":"6" } + transform-async-to-generator { "chrome":"54", "ie":"10", "node":"6" } + proposal-async-generator-functions { "chrome":"54", "ie":"10", "node":"6" } + proposal-object-rest-spread { "chrome":"54", "ie":"10", "node":"6" } + proposal-unicode-property-regex { "chrome":"54", "ie":"10", "node":"6" } + proposal-json-strings { "chrome":"54", "ie":"10", "node":"6" } + proposal-optional-catch-binding { "chrome":"54", "ie":"10", "node":"6" } + proposal-optional-chaining { "chrome":"54", "ie":"10", "node":"6" } + transform-named-capturing-groups-regex { "chrome":"54", "ie":"10", "node":"6" } + proposal-nullish-coalescing-operator { "chrome":"54", "ie":"10", "node":"6" } + transform-modules-commonjs { "chrome":"54", "ie":"10", "node":"6" } + proposal-dynamic-import { "chrome":"54", "ie":"10", "node":"6" } + +Using polyfills with `entry` option: + +[/packages/babel-preset-env/test/fixtures/debug/entry-corejs2/input.mjs] Replaced @babel/polyfill entries with the following polyfills: + es6.array.copy-within { "ie":"10" } + es6.array.fill { "ie":"10" } + es6.array.find { "ie":"10" } + es6.array.find-index { "ie":"10" } + es7.array.flat-map { "chrome":"54", "ie":"10", "node":"6" } + es6.array.from { "ie":"10", "node":"6" } + es7.array.includes { "ie":"10" } + es6.array.iterator { "ie":"10" } + es6.array.of { "ie":"10" } + es6.array.sort { "chrome":"54", "node":"6" } + es6.array.species { "ie":"10", "node":"6" } + es6.date.to-primitive { "ie":"10" } + es6.function.has-instance { "ie":"10", "node":"6" } + es6.function.name { "ie":"10" } + es6.map { "ie":"10", "node":"6" } + es6.math.acosh { "ie":"10" } + es6.math.asinh { "ie":"10" } + es6.math.atanh { "ie":"10" } + es6.math.cbrt { "ie":"10" } + es6.math.clz32 { "ie":"10" } + es6.math.cosh { "ie":"10" } + es6.math.expm1 { "ie":"10" } + es6.math.fround { "ie":"10" } + es6.math.hypot { "ie":"10" } + es6.math.imul { "ie":"10" } + es6.math.log1p { "ie":"10" } + es6.math.log10 { "ie":"10" } + es6.math.log2 { "ie":"10" } + es6.math.sign { "ie":"10" } + es6.math.sinh { "ie":"10" } + es6.math.tanh { "ie":"10" } + es6.math.trunc { "ie":"10" } + es6.number.constructor { "ie":"10" } + es6.number.epsilon { "ie":"10" } + es6.number.is-finite { "ie":"10" } + es6.number.is-integer { "ie":"10" } + es6.number.is-nan { "ie":"10" } + es6.number.is-safe-integer { "ie":"10" } + es6.number.max-safe-integer { "ie":"10" } + es6.number.min-safe-integer { "ie":"10" } + es6.number.parse-float { "ie":"10" } + es6.number.parse-int { "ie":"10" } + es6.object.assign { "ie":"10" } + es7.object.define-getter { "chrome":"54", "ie":"10", "node":"6" } + es7.object.define-setter { "chrome":"54", "ie":"10", "node":"6" } + es7.object.entries { "ie":"10", "node":"6" } + es6.object.freeze { "ie":"10" } + es6.object.get-own-property-descriptor { "ie":"10" } + es7.object.get-own-property-descriptors { "ie":"10", "node":"6" } + es6.object.get-own-property-names { "ie":"10" } + es6.object.get-prototype-of { "ie":"10" } + es7.object.lookup-getter { "chrome":"54", "ie":"10", "node":"6" } + es7.object.lookup-setter { "chrome":"54", "ie":"10", "node":"6" } + es6.object.prevent-extensions { "ie":"10" } + es6.object.to-string { "chrome":"54", "ie":"10", "node":"6" } + es6.object.is { "ie":"10" } + es6.object.is-frozen { "ie":"10" } + es6.object.is-sealed { "ie":"10" } + es6.object.is-extensible { "ie":"10" } + es6.object.keys { "ie":"10" } + es6.object.seal { "ie":"10" } + es6.object.set-prototype-of { "ie":"10" } + es7.object.values { "ie":"10", "node":"6" } + es6.promise { "ie":"10", "node":"6" } + es7.promise.finally { "chrome":"54", "ie":"10", "node":"6" } + es6.reflect.apply { "ie":"10" } + es6.reflect.construct { "ie":"10" } + es6.reflect.define-property { "ie":"10" } + es6.reflect.delete-property { "ie":"10" } + es6.reflect.get { "ie":"10" } + es6.reflect.get-own-property-descriptor { "ie":"10" } + es6.reflect.get-prototype-of { "ie":"10" } + es6.reflect.has { "ie":"10" } + es6.reflect.is-extensible { "ie":"10" } + es6.reflect.own-keys { "ie":"10" } + es6.reflect.prevent-extensions { "ie":"10" } + es6.reflect.set { "ie":"10" } + es6.reflect.set-prototype-of { "ie":"10" } + es6.regexp.constructor { "ie":"10" } + es6.regexp.flags { "ie":"10" } + es6.regexp.match { "ie":"10" } + es6.regexp.replace { "ie":"10" } + es6.regexp.split { "ie":"10" } + es6.regexp.search { "ie":"10" } + es6.regexp.to-string { "ie":"10" } + es6.set { "ie":"10", "node":"6" } + es6.symbol { "ie":"10", "node":"6" } + es7.symbol.async-iterator { "chrome":"54", "ie":"10", "node":"6" } + es6.string.anchor { "ie":"10" } + es6.string.big { "ie":"10" } + es6.string.blink { "ie":"10" } + es6.string.bold { "ie":"10" } + es6.string.code-point-at { "ie":"10" } + es6.string.ends-with { "ie":"10" } + es6.string.fixed { "ie":"10" } + es6.string.fontcolor { "ie":"10" } + es6.string.fontsize { "ie":"10" } + es6.string.from-code-point { "ie":"10" } + es6.string.includes { "ie":"10" } + es6.string.italics { "ie":"10" } + es6.string.iterator { "ie":"10" } + es6.string.link { "ie":"10" } + es7.string.pad-start { "chrome":"54", "ie":"10", "node":"6" } + es7.string.pad-end { "chrome":"54", "ie":"10", "node":"6" } + es6.string.raw { "ie":"10" } + es6.string.repeat { "ie":"10" } + es6.string.small { "ie":"10" } + es6.string.starts-with { "ie":"10" } + es6.string.strike { "ie":"10" } + es6.string.sub { "ie":"10" } + es6.string.sup { "ie":"10" } + es7.string.trim-left { "chrome":"54", "ie":"10", "node":"6" } + es7.string.trim-right { "chrome":"54", "ie":"10", "node":"6" } + es6.typed.array-buffer { "ie":"10", "node":"6" } + es6.typed.int8-array { "ie":"10", "node":"6" } + es6.typed.uint8-array { "ie":"10", "node":"6" } + es6.typed.uint8-clamped-array { "ie":"10", "node":"6" } + es6.typed.int16-array { "ie":"10", "node":"6" } + es6.typed.uint16-array { "ie":"10", "node":"6" } + es6.typed.int32-array { "ie":"10", "node":"6" } + es6.typed.uint32-array { "ie":"10", "node":"6" } + es6.typed.float32-array { "ie":"10", "node":"6" } + es6.typed.float64-array { "ie":"10", "node":"6" } + es6.weak-map { "ie":"10", "node":"6" } + es6.weak-set { "ie":"10", "node":"6" } + web.timers { "chrome":"54", "ie":"10", "node":"6" } + web.immediate { "chrome":"54", "ie":"10", "node":"6" } + web.dom.iterable { "chrome":"54", "ie":"10", "node":"6" } diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-all-chrome-71/in/in.js b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-all-chrome-71/input.mjs similarity index 100% rename from packages/babel-preset-env/test/debug-fixtures/entry-corejs3-all-chrome-71/in/in.js rename to packages/babel-preset-env/test/fixtures/debug/entry-corejs3-all-chrome-71/input.mjs diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-all-chrome-71/options.json b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-all-chrome-71/options.json new file mode 100644 index 000000000000..6e8f4a357b28 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-all-chrome-71/options.json @@ -0,0 +1,18 @@ +{ + "validateLogs": true, + "ignoreOutput": true, + "presets": [ + [ + "env", + { + "debug": true, + "targets": { + "browsers": "chrome 71" + }, + "shippedProposals": true, + "useBuiltIns": "entry", + "corejs": 3 + } + ] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-all-chrome-71/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-all-chrome-71/stdout.txt new file mode 100644 index 000000000000..1c4911d57fa8 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-all-chrome-71/stdout.txt @@ -0,0 +1,110 @@ +@babel/preset-env: `DEBUG` option + +Using targets: +{ + "chrome": "71" +} + +Using modules transform: auto + +Using plugins: + syntax-async-generators { "chrome":"71" } + syntax-object-rest-spread { "chrome":"71" } + syntax-json-strings { "chrome":"71" } + syntax-optional-catch-binding { "chrome":"71" } + proposal-optional-chaining { "chrome":"71" } + proposal-nullish-coalescing-operator { "chrome":"71" } + transform-modules-commonjs { "chrome":"71" } + proposal-dynamic-import { "chrome":"71" } + +Using polyfills with `entry` option: + +[/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-all-chrome-71/input.mjs] Replaced core-js entries with the following polyfills: + es.array.unscopables.flat { "chrome":"71" } + es.array.unscopables.flat-map { "chrome":"71" } + es.math.hypot { "chrome":"71" } + es.object.from-entries { "chrome":"71" } + esnext.aggregate-error { "chrome":"71" } + esnext.array.last-index { "chrome":"71" } + esnext.array.last-item { "chrome":"71" } + esnext.composite-key { "chrome":"71" } + esnext.composite-symbol { "chrome":"71" } + esnext.map.delete-all { "chrome":"71" } + esnext.map.every { "chrome":"71" } + esnext.map.filter { "chrome":"71" } + esnext.map.find { "chrome":"71" } + esnext.map.find-key { "chrome":"71" } + esnext.map.from { "chrome":"71" } + esnext.map.group-by { "chrome":"71" } + esnext.map.includes { "chrome":"71" } + esnext.map.key-by { "chrome":"71" } + esnext.map.key-of { "chrome":"71" } + esnext.map.map-keys { "chrome":"71" } + esnext.map.map-values { "chrome":"71" } + esnext.map.merge { "chrome":"71" } + esnext.map.of { "chrome":"71" } + esnext.map.reduce { "chrome":"71" } + esnext.map.some { "chrome":"71" } + esnext.map.update { "chrome":"71" } + esnext.math.clamp { "chrome":"71" } + esnext.math.deg-per-rad { "chrome":"71" } + esnext.math.degrees { "chrome":"71" } + esnext.math.fscale { "chrome":"71" } + esnext.math.iaddh { "chrome":"71" } + esnext.math.imulh { "chrome":"71" } + esnext.math.isubh { "chrome":"71" } + esnext.math.rad-per-deg { "chrome":"71" } + esnext.math.radians { "chrome":"71" } + esnext.math.scale { "chrome":"71" } + esnext.math.seeded-prng { "chrome":"71" } + esnext.math.signbit { "chrome":"71" } + esnext.math.umulh { "chrome":"71" } + esnext.number.from-string { "chrome":"71" } + esnext.observable { "chrome":"71" } + esnext.promise.all-settled { "chrome":"71" } + esnext.promise.any { "chrome":"71" } + esnext.promise.try { "chrome":"71" } + esnext.reflect.define-metadata { "chrome":"71" } + esnext.reflect.delete-metadata { "chrome":"71" } + esnext.reflect.get-metadata { "chrome":"71" } + esnext.reflect.get-metadata-keys { "chrome":"71" } + esnext.reflect.get-own-metadata { "chrome":"71" } + esnext.reflect.get-own-metadata-keys { "chrome":"71" } + esnext.reflect.has-metadata { "chrome":"71" } + esnext.reflect.has-own-metadata { "chrome":"71" } + esnext.reflect.metadata { "chrome":"71" } + esnext.set.add-all { "chrome":"71" } + esnext.set.delete-all { "chrome":"71" } + esnext.set.difference { "chrome":"71" } + esnext.set.every { "chrome":"71" } + esnext.set.filter { "chrome":"71" } + esnext.set.find { "chrome":"71" } + esnext.set.from { "chrome":"71" } + esnext.set.intersection { "chrome":"71" } + esnext.set.is-disjoint-from { "chrome":"71" } + esnext.set.is-subset-of { "chrome":"71" } + esnext.set.is-superset-of { "chrome":"71" } + esnext.set.join { "chrome":"71" } + esnext.set.map { "chrome":"71" } + esnext.set.of { "chrome":"71" } + esnext.set.reduce { "chrome":"71" } + esnext.set.some { "chrome":"71" } + esnext.set.symmetric-difference { "chrome":"71" } + esnext.set.union { "chrome":"71" } + esnext.string.at { "chrome":"71" } + esnext.string.code-points { "chrome":"71" } + esnext.string.match-all { "chrome":"71" } + esnext.string.replace-all { "chrome":"71" } + esnext.symbol.dispose { "chrome":"71" } + esnext.symbol.observable { "chrome":"71" } + esnext.symbol.pattern-match { "chrome":"71" } + esnext.weak-map.delete-all { "chrome":"71" } + esnext.weak-map.from { "chrome":"71" } + esnext.weak-map.of { "chrome":"71" } + esnext.weak-set.add-all { "chrome":"71" } + esnext.weak-set.delete-all { "chrome":"71" } + esnext.weak-set.from { "chrome":"71" } + esnext.weak-set.of { "chrome":"71" } + web.immediate { "chrome":"71" } + +[/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-all-chrome-71/input.mjs] Based on your targets, regenerator-runtime import excluded. diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-all/in/in.js b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-all/input.mjs similarity index 100% rename from packages/babel-preset-env/test/debug-fixtures/entry-corejs3-all/in/in.js rename to packages/babel-preset-env/test/fixtures/debug/entry-corejs3-all/input.mjs diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-all/options.json b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-all/options.json new file mode 100644 index 000000000000..edf42df8057e --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-all/options.json @@ -0,0 +1,15 @@ +{ + "validateLogs": true, + "ignoreOutput": true, + "presets": [ + [ + "env", + { + "debug": true, + "shippedProposals": true, + "useBuiltIns": "entry", + "corejs": 3 + } + ] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-all/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-all/stdout.txt new file mode 100644 index 000000000000..3af17db4ff02 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-all/stdout.txt @@ -0,0 +1,338 @@ +@babel/preset-env: `DEBUG` option + +Using targets: +{} + +Using modules transform: auto + +Using plugins: + transform-template-literals {} + transform-literals {} + transform-function-name {} + transform-arrow-functions {} + transform-block-scoped-functions {} + transform-classes {} + transform-object-super {} + transform-shorthand-properties {} + transform-duplicate-keys {} + transform-computed-properties {} + transform-for-of {} + transform-sticky-regex {} + transform-dotall-regex {} + transform-unicode-regex {} + transform-spread {} + transform-parameters {} + transform-destructuring {} + transform-block-scoping {} + transform-typeof-symbol {} + transform-new-target {} + transform-regenerator {} + transform-exponentiation-operator {} + transform-async-to-generator {} + proposal-async-generator-functions {} + proposal-object-rest-spread {} + proposal-unicode-property-regex {} + proposal-json-strings {} + proposal-optional-catch-binding {} + proposal-optional-chaining {} + transform-named-capturing-groups-regex {} + transform-member-expression-literals {} + transform-property-literals {} + transform-reserved-words {} + proposal-nullish-coalescing-operator {} + transform-modules-commonjs {} + proposal-dynamic-import {} + +Using polyfills with `entry` option: + +[/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-all/input.mjs] Replaced core-js entries with the following polyfills: + es.symbol {} + es.symbol.description {} + es.symbol.async-iterator {} + es.symbol.has-instance {} + es.symbol.is-concat-spreadable {} + es.symbol.iterator {} + es.symbol.match {} + es.symbol.replace {} + es.symbol.search {} + es.symbol.species {} + es.symbol.split {} + es.symbol.to-primitive {} + es.symbol.to-string-tag {} + es.symbol.unscopables {} + es.array.concat {} + es.array.copy-within {} + es.array.every {} + es.array.fill {} + es.array.filter {} + es.array.find {} + es.array.find-index {} + es.array.flat {} + es.array.flat-map {} + es.array.for-each {} + es.array.from {} + es.array.includes {} + es.array.index-of {} + es.array.is-array {} + es.array.iterator {} + es.array.join {} + es.array.last-index-of {} + es.array.map {} + es.array.of {} + es.array.reduce {} + es.array.reduce-right {} + es.array.reverse {} + es.array.slice {} + es.array.some {} + es.array.sort {} + es.array.species {} + es.array.splice {} + es.array.unscopables.flat {} + es.array.unscopables.flat-map {} + es.array-buffer.constructor {} + es.array-buffer.is-view {} + es.array-buffer.slice {} + es.data-view {} + es.date.now {} + es.date.to-iso-string {} + es.date.to-json {} + es.date.to-primitive {} + es.date.to-string {} + es.function.bind {} + es.function.has-instance {} + es.function.name {} + es.json.to-string-tag {} + es.map {} + es.math.acosh {} + es.math.asinh {} + es.math.atanh {} + es.math.cbrt {} + es.math.clz32 {} + es.math.cosh {} + es.math.expm1 {} + es.math.fround {} + es.math.hypot {} + es.math.imul {} + es.math.log10 {} + es.math.log1p {} + es.math.log2 {} + es.math.sign {} + es.math.sinh {} + es.math.tanh {} + es.math.to-string-tag {} + es.math.trunc {} + es.number.constructor {} + es.number.epsilon {} + es.number.is-finite {} + es.number.is-integer {} + es.number.is-nan {} + es.number.is-safe-integer {} + es.number.max-safe-integer {} + es.number.min-safe-integer {} + es.number.parse-float {} + es.number.parse-int {} + es.number.to-fixed {} + es.number.to-precision {} + es.object.assign {} + es.object.create {} + es.object.define-getter {} + es.object.define-properties {} + es.object.define-property {} + es.object.define-setter {} + es.object.entries {} + es.object.freeze {} + es.object.from-entries {} + es.object.get-own-property-descriptor {} + es.object.get-own-property-descriptors {} + es.object.get-own-property-names {} + es.object.get-prototype-of {} + es.object.is {} + es.object.is-extensible {} + es.object.is-frozen {} + es.object.is-sealed {} + es.object.keys {} + es.object.lookup-getter {} + es.object.lookup-setter {} + es.object.prevent-extensions {} + es.object.seal {} + es.object.set-prototype-of {} + es.object.to-string {} + es.object.values {} + es.parse-float {} + es.parse-int {} + es.promise {} + es.promise.finally {} + es.reflect.apply {} + es.reflect.construct {} + es.reflect.define-property {} + es.reflect.delete-property {} + es.reflect.get {} + es.reflect.get-own-property-descriptor {} + es.reflect.get-prototype-of {} + es.reflect.has {} + es.reflect.is-extensible {} + es.reflect.own-keys {} + es.reflect.prevent-extensions {} + es.reflect.set {} + es.reflect.set-prototype-of {} + es.regexp.constructor {} + es.regexp.exec {} + es.regexp.flags {} + es.regexp.to-string {} + es.set {} + es.string.code-point-at {} + es.string.ends-with {} + es.string.from-code-point {} + es.string.includes {} + es.string.iterator {} + es.string.match {} + es.string.pad-end {} + es.string.pad-start {} + es.string.raw {} + es.string.repeat {} + es.string.replace {} + es.string.search {} + es.string.split {} + es.string.starts-with {} + es.string.trim {} + es.string.trim-end {} + es.string.trim-start {} + es.string.anchor {} + es.string.big {} + es.string.blink {} + es.string.bold {} + es.string.fixed {} + es.string.fontcolor {} + es.string.fontsize {} + es.string.italics {} + es.string.link {} + es.string.small {} + es.string.strike {} + es.string.sub {} + es.string.sup {} + es.typed-array.float32-array {} + es.typed-array.float64-array {} + es.typed-array.int8-array {} + es.typed-array.int16-array {} + es.typed-array.int32-array {} + es.typed-array.uint8-array {} + es.typed-array.uint8-clamped-array {} + es.typed-array.uint16-array {} + es.typed-array.uint32-array {} + es.typed-array.copy-within {} + es.typed-array.every {} + es.typed-array.fill {} + es.typed-array.filter {} + es.typed-array.find {} + es.typed-array.find-index {} + es.typed-array.for-each {} + es.typed-array.from {} + es.typed-array.includes {} + es.typed-array.index-of {} + es.typed-array.iterator {} + es.typed-array.join {} + es.typed-array.last-index-of {} + es.typed-array.map {} + es.typed-array.of {} + es.typed-array.reduce {} + es.typed-array.reduce-right {} + es.typed-array.reverse {} + es.typed-array.set {} + es.typed-array.slice {} + es.typed-array.some {} + es.typed-array.sort {} + es.typed-array.subarray {} + es.typed-array.to-locale-string {} + es.typed-array.to-string {} + es.weak-map {} + es.weak-set {} + esnext.aggregate-error {} + esnext.array.last-index {} + esnext.array.last-item {} + esnext.composite-key {} + esnext.composite-symbol {} + esnext.global-this {} + esnext.map.delete-all {} + esnext.map.every {} + esnext.map.filter {} + esnext.map.find {} + esnext.map.find-key {} + esnext.map.from {} + esnext.map.group-by {} + esnext.map.includes {} + esnext.map.key-by {} + esnext.map.key-of {} + esnext.map.map-keys {} + esnext.map.map-values {} + esnext.map.merge {} + esnext.map.of {} + esnext.map.reduce {} + esnext.map.some {} + esnext.map.update {} + esnext.math.clamp {} + esnext.math.deg-per-rad {} + esnext.math.degrees {} + esnext.math.fscale {} + esnext.math.iaddh {} + esnext.math.imulh {} + esnext.math.isubh {} + esnext.math.rad-per-deg {} + esnext.math.radians {} + esnext.math.scale {} + esnext.math.seeded-prng {} + esnext.math.signbit {} + esnext.math.umulh {} + esnext.number.from-string {} + esnext.observable {} + esnext.promise.all-settled {} + esnext.promise.any {} + esnext.promise.try {} + esnext.reflect.define-metadata {} + esnext.reflect.delete-metadata {} + esnext.reflect.get-metadata {} + esnext.reflect.get-metadata-keys {} + esnext.reflect.get-own-metadata {} + esnext.reflect.get-own-metadata-keys {} + esnext.reflect.has-metadata {} + esnext.reflect.has-own-metadata {} + esnext.reflect.metadata {} + esnext.set.add-all {} + esnext.set.delete-all {} + esnext.set.difference {} + esnext.set.every {} + esnext.set.filter {} + esnext.set.find {} + esnext.set.from {} + esnext.set.intersection {} + esnext.set.is-disjoint-from {} + esnext.set.is-subset-of {} + esnext.set.is-superset-of {} + esnext.set.join {} + esnext.set.map {} + esnext.set.of {} + esnext.set.reduce {} + esnext.set.some {} + esnext.set.symmetric-difference {} + esnext.set.union {} + esnext.string.at {} + esnext.string.code-points {} + esnext.string.match-all {} + esnext.string.replace-all {} + esnext.symbol.dispose {} + esnext.symbol.observable {} + esnext.symbol.pattern-match {} + esnext.weak-map.delete-all {} + esnext.weak-map.from {} + esnext.weak-map.of {} + esnext.weak-set.add-all {} + esnext.weak-set.delete-all {} + esnext.weak-set.from {} + esnext.weak-set.of {} + web.dom-collections.for-each {} + web.dom-collections.iterator {} + web.immediate {} + web.queue-microtask {} + web.timers {} + web.url {} + web.url.to-json {} + web.url-search-params {} diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-android/in/in.js b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-android/input.mjs similarity index 100% rename from packages/babel-preset-env/test/debug-fixtures/entry-corejs3-android/in/in.js rename to packages/babel-preset-env/test/fixtures/debug/entry-corejs3-android/input.mjs diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-android/options.json b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-android/options.json new file mode 100644 index 000000000000..ca76bce5c006 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-android/options.json @@ -0,0 +1,17 @@ +{ + "validateLogs": true, + "ignoreOutput": true, + "presets": [ + [ + "env", + { + "debug": true, + "targets": { + "browsers": ["Android >= 4"] + }, + "useBuiltIns": "entry", + "corejs": 3 + } + ] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-android/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-android/stdout.txt new file mode 100644 index 000000000000..a19089b32198 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-android/stdout.txt @@ -0,0 +1,233 @@ +@babel/preset-env: `DEBUG` option + +Using targets: +{ + "android": "4" +} + +Using modules transform: auto + +Using plugins: + transform-template-literals { "android":"4" } + transform-literals { "android":"4" } + transform-function-name { "android":"4" } + transform-arrow-functions { "android":"4" } + transform-block-scoped-functions { "android":"4" } + transform-classes { "android":"4" } + transform-object-super { "android":"4" } + transform-shorthand-properties { "android":"4" } + transform-duplicate-keys { "android":"4" } + transform-computed-properties { "android":"4" } + transform-for-of { "android":"4" } + transform-sticky-regex { "android":"4" } + transform-dotall-regex { "android":"4" } + transform-unicode-regex { "android":"4" } + transform-spread { "android":"4" } + transform-parameters { "android":"4" } + transform-destructuring { "android":"4" } + transform-block-scoping { "android":"4" } + transform-typeof-symbol { "android":"4" } + transform-new-target { "android":"4" } + transform-regenerator { "android":"4" } + transform-exponentiation-operator { "android":"4" } + transform-async-to-generator { "android":"4" } + proposal-async-generator-functions { "android":"4" } + proposal-object-rest-spread { "android":"4" } + proposal-unicode-property-regex { "android":"4" } + proposal-json-strings { "android":"4" } + proposal-optional-catch-binding { "android":"4" } + proposal-optional-chaining { "android":"4" } + transform-named-capturing-groups-regex { "android":"4" } + transform-reserved-words { "android":"4" } + proposal-nullish-coalescing-operator { "android":"4" } + transform-modules-commonjs { "android":"4" } + proposal-dynamic-import { "android":"4" } + +Using polyfills with `entry` option: + +[/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-android/input.mjs] Replaced core-js entries with the following polyfills: + es.symbol { "android":"4" } + es.symbol.description { "android":"4" } + es.symbol.async-iterator { "android":"4" } + es.symbol.has-instance { "android":"4" } + es.symbol.is-concat-spreadable { "android":"4" } + es.symbol.iterator { "android":"4" } + es.symbol.match { "android":"4" } + es.symbol.replace { "android":"4" } + es.symbol.search { "android":"4" } + es.symbol.species { "android":"4" } + es.symbol.split { "android":"4" } + es.symbol.to-primitive { "android":"4" } + es.symbol.to-string-tag { "android":"4" } + es.symbol.unscopables { "android":"4" } + es.array.concat { "android":"4" } + es.array.copy-within { "android":"4" } + es.array.every { "android":"4" } + es.array.fill { "android":"4" } + es.array.filter { "android":"4" } + es.array.find { "android":"4" } + es.array.find-index { "android":"4" } + es.array.flat { "android":"4" } + es.array.flat-map { "android":"4" } + es.array.for-each { "android":"4" } + es.array.from { "android":"4" } + es.array.includes { "android":"4" } + es.array.index-of { "android":"4" } + es.array.iterator { "android":"4" } + es.array.join { "android":"4" } + es.array.last-index-of { "android":"4" } + es.array.map { "android":"4" } + es.array.of { "android":"4" } + es.array.reduce { "android":"4" } + es.array.reduce-right { "android":"4" } + es.array.slice { "android":"4" } + es.array.some { "android":"4" } + es.array.sort { "android":"4" } + es.array.species { "android":"4" } + es.array.splice { "android":"4" } + es.array.unscopables.flat { "android":"4" } + es.array.unscopables.flat-map { "android":"4" } + es.array-buffer.constructor { "android":"4" } + es.array-buffer.is-view { "android":"4" } + es.array-buffer.slice { "android":"4" } + es.data-view { "android":"4" } + es.date.to-iso-string { "android":"4" } + es.date.to-json { "android":"4" } + es.date.to-primitive { "android":"4" } + es.function.has-instance { "android":"4" } + es.json.to-string-tag { "android":"4" } + es.map { "android":"4" } + es.math.acosh { "android":"4" } + es.math.asinh { "android":"4" } + es.math.atanh { "android":"4" } + es.math.cbrt { "android":"4" } + es.math.clz32 { "android":"4" } + es.math.cosh { "android":"4" } + es.math.expm1 { "android":"4" } + es.math.fround { "android":"4" } + es.math.hypot { "android":"4" } + es.math.imul { "android":"4" } + es.math.log10 { "android":"4" } + es.math.log1p { "android":"4" } + es.math.log2 { "android":"4" } + es.math.sign { "android":"4" } + es.math.sinh { "android":"4" } + es.math.tanh { "android":"4" } + es.math.to-string-tag { "android":"4" } + es.math.trunc { "android":"4" } + es.number.constructor { "android":"4" } + es.number.epsilon { "android":"4" } + es.number.is-finite { "android":"4" } + es.number.is-integer { "android":"4" } + es.number.is-nan { "android":"4" } + es.number.is-safe-integer { "android":"4" } + es.number.max-safe-integer { "android":"4" } + es.number.min-safe-integer { "android":"4" } + es.number.parse-float { "android":"4" } + es.number.parse-int { "android":"4" } + es.number.to-fixed { "android":"4" } + es.number.to-precision { "android":"4" } + es.object.assign { "android":"4" } + es.object.define-getter { "android":"4" } + es.object.define-setter { "android":"4" } + es.object.entries { "android":"4" } + es.object.freeze { "android":"4" } + es.object.from-entries { "android":"4" } + es.object.get-own-property-descriptor { "android":"4" } + es.object.get-own-property-descriptors { "android":"4" } + es.object.get-own-property-names { "android":"4" } + es.object.get-prototype-of { "android":"4" } + es.object.is { "android":"4" } + es.object.is-extensible { "android":"4" } + es.object.is-frozen { "android":"4" } + es.object.is-sealed { "android":"4" } + es.object.keys { "android":"4" } + es.object.lookup-getter { "android":"4" } + es.object.lookup-setter { "android":"4" } + es.object.prevent-extensions { "android":"4" } + es.object.seal { "android":"4" } + es.object.set-prototype-of { "android":"4" } + es.object.to-string { "android":"4" } + es.object.values { "android":"4" } + es.parse-float { "android":"4" } + es.parse-int { "android":"4" } + es.promise { "android":"4" } + es.promise.finally { "android":"4" } + es.reflect.apply { "android":"4" } + es.reflect.construct { "android":"4" } + es.reflect.define-property { "android":"4" } + es.reflect.delete-property { "android":"4" } + es.reflect.get { "android":"4" } + es.reflect.get-own-property-descriptor { "android":"4" } + es.reflect.get-prototype-of { "android":"4" } + es.reflect.has { "android":"4" } + es.reflect.is-extensible { "android":"4" } + es.reflect.own-keys { "android":"4" } + es.reflect.prevent-extensions { "android":"4" } + es.reflect.set { "android":"4" } + es.reflect.set-prototype-of { "android":"4" } + es.regexp.constructor { "android":"4" } + es.regexp.exec { "android":"4" } + es.regexp.flags { "android":"4" } + es.regexp.to-string { "android":"4" } + es.set { "android":"4" } + es.string.code-point-at { "android":"4" } + es.string.ends-with { "android":"4" } + es.string.from-code-point { "android":"4" } + es.string.includes { "android":"4" } + es.string.iterator { "android":"4" } + es.string.match { "android":"4" } + es.string.pad-end { "android":"4" } + es.string.pad-start { "android":"4" } + es.string.raw { "android":"4" } + es.string.repeat { "android":"4" } + es.string.replace { "android":"4" } + es.string.search { "android":"4" } + es.string.split { "android":"4" } + es.string.starts-with { "android":"4" } + es.string.trim { "android":"4" } + es.string.trim-end { "android":"4" } + es.string.trim-start { "android":"4" } + es.typed-array.float32-array { "android":"4" } + es.typed-array.float64-array { "android":"4" } + es.typed-array.int8-array { "android":"4" } + es.typed-array.int16-array { "android":"4" } + es.typed-array.int32-array { "android":"4" } + es.typed-array.uint8-array { "android":"4" } + es.typed-array.uint8-clamped-array { "android":"4" } + es.typed-array.uint16-array { "android":"4" } + es.typed-array.uint32-array { "android":"4" } + es.typed-array.copy-within { "android":"4" } + es.typed-array.every { "android":"4" } + es.typed-array.fill { "android":"4" } + es.typed-array.filter { "android":"4" } + es.typed-array.find { "android":"4" } + es.typed-array.find-index { "android":"4" } + es.typed-array.for-each { "android":"4" } + es.typed-array.from { "android":"4" } + es.typed-array.includes { "android":"4" } + es.typed-array.index-of { "android":"4" } + es.typed-array.iterator { "android":"4" } + es.typed-array.join { "android":"4" } + es.typed-array.last-index-of { "android":"4" } + es.typed-array.map { "android":"4" } + es.typed-array.of { "android":"4" } + es.typed-array.reduce { "android":"4" } + es.typed-array.reduce-right { "android":"4" } + es.typed-array.reverse { "android":"4" } + es.typed-array.set { "android":"4" } + es.typed-array.slice { "android":"4" } + es.typed-array.some { "android":"4" } + es.typed-array.sort { "android":"4" } + es.typed-array.subarray { "android":"4" } + es.typed-array.to-locale-string { "android":"4" } + es.typed-array.to-string { "android":"4" } + es.weak-map { "android":"4" } + es.weak-set { "android":"4" } + web.dom-collections.for-each { "android":"4" } + web.dom-collections.iterator { "android":"4" } + web.immediate { "android":"4" } + web.queue-microtask { "android":"4" } + web.url { "android":"4" } + web.url.to-json { "android":"4" } + web.url-search-params { "android":"4" } diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-babel-polyfill/in/in.js b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-babel-polyfill/input.mjs similarity index 100% rename from packages/babel-preset-env/test/debug-fixtures/entry-corejs3-babel-polyfill/in/in.js rename to packages/babel-preset-env/test/fixtures/debug/entry-corejs3-babel-polyfill/input.mjs diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-babel-polyfill/options.json b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-babel-polyfill/options.json new file mode 100644 index 000000000000..edf42df8057e --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-babel-polyfill/options.json @@ -0,0 +1,15 @@ +{ + "validateLogs": true, + "ignoreOutput": true, + "presets": [ + [ + "env", + { + "debug": true, + "shippedProposals": true, + "useBuiltIns": "entry", + "corejs": 3 + } + ] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-babel-polyfill/stderr.txt b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-babel-polyfill/stderr.txt new file mode 100644 index 000000000000..228f1a052848 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-babel-polyfill/stderr.txt @@ -0,0 +1,2 @@ +`@babel/polyfill` is deprecated. Please, use required parts of `core-js` + and `regenerator-runtime/runtime` separately \ No newline at end of file diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-babel-polyfill/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-babel-polyfill/stdout.txt new file mode 100644 index 000000000000..1dd62898e898 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-babel-polyfill/stdout.txt @@ -0,0 +1,48 @@ +@babel/preset-env: `DEBUG` option + +Using targets: +{} + +Using modules transform: auto + +Using plugins: + transform-template-literals {} + transform-literals {} + transform-function-name {} + transform-arrow-functions {} + transform-block-scoped-functions {} + transform-classes {} + transform-object-super {} + transform-shorthand-properties {} + transform-duplicate-keys {} + transform-computed-properties {} + transform-for-of {} + transform-sticky-regex {} + transform-dotall-regex {} + transform-unicode-regex {} + transform-spread {} + transform-parameters {} + transform-destructuring {} + transform-block-scoping {} + transform-typeof-symbol {} + transform-new-target {} + transform-regenerator {} + transform-exponentiation-operator {} + transform-async-to-generator {} + proposal-async-generator-functions {} + proposal-object-rest-spread {} + proposal-unicode-property-regex {} + proposal-json-strings {} + proposal-optional-catch-binding {} + proposal-optional-chaining {} + transform-named-capturing-groups-regex {} + transform-member-expression-literals {} + transform-property-literals {} + transform-reserved-words {} + proposal-nullish-coalescing-operator {} + transform-modules-commonjs {} + proposal-dynamic-import {} + +Using polyfills with `entry` option: + +[/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-babel-polyfill/input.mjs] Import of core-js was not found. diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-electron/in/in.js b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-electron/input.mjs similarity index 100% rename from packages/babel-preset-env/test/debug-fixtures/entry-corejs3-electron/in/in.js rename to packages/babel-preset-env/test/fixtures/debug/entry-corejs3-electron/input.mjs diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-electron/options.json b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-electron/options.json new file mode 100644 index 000000000000..294459fe21ec --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-electron/options.json @@ -0,0 +1,17 @@ +{ + "validateLogs": true, + "ignoreOutput": true, + "presets": [ + [ + "env", + { + "debug": true, + "targets": { + "electron": 0.36 + }, + "useBuiltIns": "entry", + "corejs": 3 + } + ] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-electron/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-electron/stdout.txt new file mode 100644 index 000000000000..bbbb95df3388 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-electron/stdout.txt @@ -0,0 +1,145 @@ +Warning, the following targets are using a decimal version: + + electron: 0.36 + +We recommend using a string for minor/patch versions to avoid numbers like 6.10 +getting parsed as 6.1, which can lead to unexpected behavior. + +@babel/preset-env: `DEBUG` option + +Using targets: +{ + "electron": "0.36" +} + +Using modules transform: auto + +Using plugins: + transform-function-name { "electron":"0.36" } + transform-for-of { "electron":"0.36" } + transform-sticky-regex { "electron":"0.36" } + transform-dotall-regex { "electron":"0.36" } + transform-unicode-regex { "electron":"0.36" } + transform-parameters { "electron":"0.36" } + transform-destructuring { "electron":"0.36" } + transform-block-scoping { "electron":"0.36" } + transform-regenerator { "electron":"0.36" } + transform-exponentiation-operator { "electron":"0.36" } + transform-async-to-generator { "electron":"0.36" } + proposal-async-generator-functions { "electron":"0.36" } + proposal-object-rest-spread { "electron":"0.36" } + proposal-unicode-property-regex { "electron":"0.36" } + proposal-json-strings { "electron":"0.36" } + proposal-optional-catch-binding { "electron":"0.36" } + proposal-optional-chaining { "electron":"0.36" } + transform-named-capturing-groups-regex { "electron":"0.36" } + transform-member-expression-literals { "electron":"0.36" } + transform-property-literals { "electron":"0.36" } + proposal-nullish-coalescing-operator { "electron":"0.36" } + transform-modules-commonjs { "electron":"0.36" } + proposal-dynamic-import { "electron":"0.36" } + +Using polyfills with `entry` option: + +[/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-electron/input.mjs] Replaced core-js entries with the following polyfills: + es.symbol { "electron":"0.36" } + es.symbol.description { "electron":"0.36" } + es.symbol.async-iterator { "electron":"0.36" } + es.symbol.has-instance { "electron":"0.36" } + es.symbol.is-concat-spreadable { "electron":"0.36" } + es.symbol.match { "electron":"0.36" } + es.symbol.replace { "electron":"0.36" } + es.symbol.search { "electron":"0.36" } + es.symbol.species { "electron":"0.36" } + es.symbol.split { "electron":"0.36" } + es.symbol.to-string-tag { "electron":"0.36" } + es.array.concat { "electron":"0.36" } + es.array.every { "electron":"0.36" } + es.array.filter { "electron":"0.36" } + es.array.flat { "electron":"0.36" } + es.array.flat-map { "electron":"0.36" } + es.array.for-each { "electron":"0.36" } + es.array.from { "electron":"0.36" } + es.array.includes { "electron":"0.36" } + es.array.index-of { "electron":"0.36" } + es.array.iterator { "electron":"0.36" } + es.array.last-index-of { "electron":"0.36" } + es.array.map { "electron":"0.36" } + es.array.reduce { "electron":"0.36" } + es.array.reduce-right { "electron":"0.36" } + es.array.slice { "electron":"0.36" } + es.array.some { "electron":"0.36" } + es.array.sort { "electron":"0.36" } + es.array.species { "electron":"0.36" } + es.array.splice { "electron":"0.36" } + es.array.unscopables.flat { "electron":"0.36" } + es.array.unscopables.flat-map { "electron":"0.36" } + es.function.has-instance { "electron":"0.36" } + es.json.to-string-tag { "electron":"0.36" } + es.map { "electron":"0.36" } + es.math.acosh { "electron":"0.36" } + es.math.hypot { "electron":"0.36" } + es.math.to-string-tag { "electron":"0.36" } + es.object.assign { "electron":"0.36" } + es.object.define-getter { "electron":"0.36" } + es.object.define-setter { "electron":"0.36" } + es.object.entries { "electron":"0.36" } + es.object.from-entries { "electron":"0.36" } + es.object.get-own-property-descriptors { "electron":"0.36" } + es.object.lookup-getter { "electron":"0.36" } + es.object.lookup-setter { "electron":"0.36" } + es.object.to-string { "electron":"0.36" } + es.object.values { "electron":"0.36" } + es.promise { "electron":"0.36" } + es.promise.finally { "electron":"0.36" } + es.reflect.apply { "electron":"0.36" } + es.reflect.construct { "electron":"0.36" } + es.reflect.define-property { "electron":"0.36" } + es.reflect.delete-property { "electron":"0.36" } + es.reflect.get { "electron":"0.36" } + es.reflect.get-own-property-descriptor { "electron":"0.36" } + es.reflect.get-prototype-of { "electron":"0.36" } + es.reflect.has { "electron":"0.36" } + es.reflect.is-extensible { "electron":"0.36" } + es.reflect.own-keys { "electron":"0.36" } + es.reflect.prevent-extensions { "electron":"0.36" } + es.reflect.set { "electron":"0.36" } + es.reflect.set-prototype-of { "electron":"0.36" } + es.regexp.constructor { "electron":"0.36" } + es.regexp.flags { "electron":"0.36" } + es.regexp.to-string { "electron":"0.36" } + es.set { "electron":"0.36" } + es.string.ends-with { "electron":"0.36" } + es.string.includes { "electron":"0.36" } + es.string.match { "electron":"0.36" } + es.string.pad-end { "electron":"0.36" } + es.string.pad-start { "electron":"0.36" } + es.string.replace { "electron":"0.36" } + es.string.search { "electron":"0.36" } + es.string.split { "electron":"0.36" } + es.string.starts-with { "electron":"0.36" } + es.string.trim { "electron":"0.36" } + es.string.trim-end { "electron":"0.36" } + es.string.trim-start { "electron":"0.36" } + es.typed-array.float32-array { "electron":"0.36" } + es.typed-array.float64-array { "electron":"0.36" } + es.typed-array.int8-array { "electron":"0.36" } + es.typed-array.int16-array { "electron":"0.36" } + es.typed-array.int32-array { "electron":"0.36" } + es.typed-array.uint8-array { "electron":"0.36" } + es.typed-array.uint8-clamped-array { "electron":"0.36" } + es.typed-array.uint16-array { "electron":"0.36" } + es.typed-array.uint32-array { "electron":"0.36" } + es.typed-array.from { "electron":"0.36" } + es.typed-array.includes { "electron":"0.36" } + es.typed-array.of { "electron":"0.36" } + es.typed-array.to-string { "electron":"0.36" } + es.weak-map { "electron":"0.36" } + es.weak-set { "electron":"0.36" } + web.dom-collections.for-each { "electron":"0.36" } + web.dom-collections.iterator { "electron":"0.36" } + web.immediate { "electron":"0.36" } + web.queue-microtask { "electron":"0.36" } + web.url { "electron":"0.36" } + web.url.to-json { "electron":"0.36" } + web.url-search-params { "electron":"0.36" } diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-es-chrome-71/in/in.js b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-es-chrome-71/input.mjs similarity index 100% rename from packages/babel-preset-env/test/debug-fixtures/entry-corejs3-es-chrome-71/in/in.js rename to packages/babel-preset-env/test/fixtures/debug/entry-corejs3-es-chrome-71/input.mjs diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-es-chrome-71/options.json b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-es-chrome-71/options.json new file mode 100644 index 000000000000..6e8f4a357b28 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-es-chrome-71/options.json @@ -0,0 +1,18 @@ +{ + "validateLogs": true, + "ignoreOutput": true, + "presets": [ + [ + "env", + { + "debug": true, + "targets": { + "browsers": "chrome 71" + }, + "shippedProposals": true, + "useBuiltIns": "entry", + "corejs": 3 + } + ] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-es-chrome-71/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-es-chrome-71/stdout.txt new file mode 100644 index 000000000000..4b22e928d343 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-es-chrome-71/stdout.txt @@ -0,0 +1,28 @@ +@babel/preset-env: `DEBUG` option + +Using targets: +{ + "chrome": "71" +} + +Using modules transform: auto + +Using plugins: + syntax-async-generators { "chrome":"71" } + syntax-object-rest-spread { "chrome":"71" } + syntax-json-strings { "chrome":"71" } + syntax-optional-catch-binding { "chrome":"71" } + proposal-optional-chaining { "chrome":"71" } + proposal-nullish-coalescing-operator { "chrome":"71" } + transform-modules-commonjs { "chrome":"71" } + proposal-dynamic-import { "chrome":"71" } + +Using polyfills with `entry` option: + +[/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-es-chrome-71/input.mjs] Replaced core-js entries with the following polyfills: + es.array.unscopables.flat { "chrome":"71" } + es.array.unscopables.flat-map { "chrome":"71" } + es.math.hypot { "chrome":"71" } + es.object.from-entries { "chrome":"71" } + +[/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-es-chrome-71/input.mjs] Based on your targets, regenerator-runtime import excluded. diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-es-proposals-chrome-71/in/in.js b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-es-proposals-chrome-71/input.mjs similarity index 100% rename from packages/babel-preset-env/test/debug-fixtures/entry-corejs3-es-proposals-chrome-71/in/in.js rename to packages/babel-preset-env/test/fixtures/debug/entry-corejs3-es-proposals-chrome-71/input.mjs diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-es-proposals-chrome-71/options.json b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-es-proposals-chrome-71/options.json new file mode 100644 index 000000000000..6e8f4a357b28 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-es-proposals-chrome-71/options.json @@ -0,0 +1,18 @@ +{ + "validateLogs": true, + "ignoreOutput": true, + "presets": [ + [ + "env", + { + "debug": true, + "targets": { + "browsers": "chrome 71" + }, + "shippedProposals": true, + "useBuiltIns": "entry", + "corejs": 3 + } + ] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-es-proposals-chrome-71/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-es-proposals-chrome-71/stdout.txt new file mode 100644 index 000000000000..ace678c1f962 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-es-proposals-chrome-71/stdout.txt @@ -0,0 +1,109 @@ +@babel/preset-env: `DEBUG` option + +Using targets: +{ + "chrome": "71" +} + +Using modules transform: auto + +Using plugins: + syntax-async-generators { "chrome":"71" } + syntax-object-rest-spread { "chrome":"71" } + syntax-json-strings { "chrome":"71" } + syntax-optional-catch-binding { "chrome":"71" } + proposal-optional-chaining { "chrome":"71" } + proposal-nullish-coalescing-operator { "chrome":"71" } + transform-modules-commonjs { "chrome":"71" } + proposal-dynamic-import { "chrome":"71" } + +Using polyfills with `entry` option: + +[/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-es-proposals-chrome-71/input.mjs] Replaced core-js entries with the following polyfills: + es.array.unscopables.flat { "chrome":"71" } + es.array.unscopables.flat-map { "chrome":"71" } + es.math.hypot { "chrome":"71" } + es.object.from-entries { "chrome":"71" } + esnext.aggregate-error { "chrome":"71" } + esnext.array.last-index { "chrome":"71" } + esnext.array.last-item { "chrome":"71" } + esnext.composite-key { "chrome":"71" } + esnext.composite-symbol { "chrome":"71" } + esnext.map.delete-all { "chrome":"71" } + esnext.map.every { "chrome":"71" } + esnext.map.filter { "chrome":"71" } + esnext.map.find { "chrome":"71" } + esnext.map.find-key { "chrome":"71" } + esnext.map.from { "chrome":"71" } + esnext.map.group-by { "chrome":"71" } + esnext.map.includes { "chrome":"71" } + esnext.map.key-by { "chrome":"71" } + esnext.map.key-of { "chrome":"71" } + esnext.map.map-keys { "chrome":"71" } + esnext.map.map-values { "chrome":"71" } + esnext.map.merge { "chrome":"71" } + esnext.map.of { "chrome":"71" } + esnext.map.reduce { "chrome":"71" } + esnext.map.some { "chrome":"71" } + esnext.map.update { "chrome":"71" } + esnext.math.clamp { "chrome":"71" } + esnext.math.deg-per-rad { "chrome":"71" } + esnext.math.degrees { "chrome":"71" } + esnext.math.fscale { "chrome":"71" } + esnext.math.iaddh { "chrome":"71" } + esnext.math.imulh { "chrome":"71" } + esnext.math.isubh { "chrome":"71" } + esnext.math.rad-per-deg { "chrome":"71" } + esnext.math.radians { "chrome":"71" } + esnext.math.scale { "chrome":"71" } + esnext.math.seeded-prng { "chrome":"71" } + esnext.math.signbit { "chrome":"71" } + esnext.math.umulh { "chrome":"71" } + esnext.number.from-string { "chrome":"71" } + esnext.observable { "chrome":"71" } + esnext.promise.all-settled { "chrome":"71" } + esnext.promise.any { "chrome":"71" } + esnext.promise.try { "chrome":"71" } + esnext.reflect.define-metadata { "chrome":"71" } + esnext.reflect.delete-metadata { "chrome":"71" } + esnext.reflect.get-metadata { "chrome":"71" } + esnext.reflect.get-metadata-keys { "chrome":"71" } + esnext.reflect.get-own-metadata { "chrome":"71" } + esnext.reflect.get-own-metadata-keys { "chrome":"71" } + esnext.reflect.has-metadata { "chrome":"71" } + esnext.reflect.has-own-metadata { "chrome":"71" } + esnext.reflect.metadata { "chrome":"71" } + esnext.set.add-all { "chrome":"71" } + esnext.set.delete-all { "chrome":"71" } + esnext.set.difference { "chrome":"71" } + esnext.set.every { "chrome":"71" } + esnext.set.filter { "chrome":"71" } + esnext.set.find { "chrome":"71" } + esnext.set.from { "chrome":"71" } + esnext.set.intersection { "chrome":"71" } + esnext.set.is-disjoint-from { "chrome":"71" } + esnext.set.is-subset-of { "chrome":"71" } + esnext.set.is-superset-of { "chrome":"71" } + esnext.set.join { "chrome":"71" } + esnext.set.map { "chrome":"71" } + esnext.set.of { "chrome":"71" } + esnext.set.reduce { "chrome":"71" } + esnext.set.some { "chrome":"71" } + esnext.set.symmetric-difference { "chrome":"71" } + esnext.set.union { "chrome":"71" } + esnext.string.at { "chrome":"71" } + esnext.string.code-points { "chrome":"71" } + esnext.string.match-all { "chrome":"71" } + esnext.string.replace-all { "chrome":"71" } + esnext.symbol.dispose { "chrome":"71" } + esnext.symbol.observable { "chrome":"71" } + esnext.symbol.pattern-match { "chrome":"71" } + esnext.weak-map.delete-all { "chrome":"71" } + esnext.weak-map.from { "chrome":"71" } + esnext.weak-map.of { "chrome":"71" } + esnext.weak-set.add-all { "chrome":"71" } + esnext.weak-set.delete-all { "chrome":"71" } + esnext.weak-set.from { "chrome":"71" } + esnext.weak-set.of { "chrome":"71" } + +[/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-es-proposals-chrome-71/input.mjs] Based on your targets, regenerator-runtime import excluded. diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-es-proposals/in/in.js b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-es-proposals/input.mjs similarity index 100% rename from packages/babel-preset-env/test/debug-fixtures/entry-corejs3-es-proposals/in/in.js rename to packages/babel-preset-env/test/fixtures/debug/entry-corejs3-es-proposals/input.mjs diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-es-proposals/options.json b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-es-proposals/options.json new file mode 100644 index 000000000000..edf42df8057e --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-es-proposals/options.json @@ -0,0 +1,15 @@ +{ + "validateLogs": true, + "ignoreOutput": true, + "presets": [ + [ + "env", + { + "debug": true, + "shippedProposals": true, + "useBuiltIns": "entry", + "corejs": 3 + } + ] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-es-proposals/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-es-proposals/stdout.txt new file mode 100644 index 000000000000..c59a2c298fd5 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-es-proposals/stdout.txt @@ -0,0 +1,333 @@ +@babel/preset-env: `DEBUG` option + +Using targets: +{} + +Using modules transform: auto + +Using plugins: + transform-template-literals {} + transform-literals {} + transform-function-name {} + transform-arrow-functions {} + transform-block-scoped-functions {} + transform-classes {} + transform-object-super {} + transform-shorthand-properties {} + transform-duplicate-keys {} + transform-computed-properties {} + transform-for-of {} + transform-sticky-regex {} + transform-dotall-regex {} + transform-unicode-regex {} + transform-spread {} + transform-parameters {} + transform-destructuring {} + transform-block-scoping {} + transform-typeof-symbol {} + transform-new-target {} + transform-regenerator {} + transform-exponentiation-operator {} + transform-async-to-generator {} + proposal-async-generator-functions {} + proposal-object-rest-spread {} + proposal-unicode-property-regex {} + proposal-json-strings {} + proposal-optional-catch-binding {} + proposal-optional-chaining {} + transform-named-capturing-groups-regex {} + transform-member-expression-literals {} + transform-property-literals {} + transform-reserved-words {} + proposal-nullish-coalescing-operator {} + transform-modules-commonjs {} + proposal-dynamic-import {} + +Using polyfills with `entry` option: + +[/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-es-proposals/input.mjs] Replaced core-js entries with the following polyfills: + es.symbol {} + es.symbol.description {} + es.symbol.async-iterator {} + es.symbol.has-instance {} + es.symbol.is-concat-spreadable {} + es.symbol.iterator {} + es.symbol.match {} + es.symbol.replace {} + es.symbol.search {} + es.symbol.species {} + es.symbol.split {} + es.symbol.to-primitive {} + es.symbol.to-string-tag {} + es.symbol.unscopables {} + es.array.concat {} + es.array.copy-within {} + es.array.every {} + es.array.fill {} + es.array.filter {} + es.array.find {} + es.array.find-index {} + es.array.flat {} + es.array.flat-map {} + es.array.for-each {} + es.array.from {} + es.array.includes {} + es.array.index-of {} + es.array.is-array {} + es.array.iterator {} + es.array.join {} + es.array.last-index-of {} + es.array.map {} + es.array.of {} + es.array.reduce {} + es.array.reduce-right {} + es.array.reverse {} + es.array.slice {} + es.array.some {} + es.array.sort {} + es.array.species {} + es.array.splice {} + es.array.unscopables.flat {} + es.array.unscopables.flat-map {} + es.array-buffer.constructor {} + es.array-buffer.is-view {} + es.array-buffer.slice {} + es.data-view {} + es.date.now {} + es.date.to-iso-string {} + es.date.to-json {} + es.date.to-primitive {} + es.date.to-string {} + es.function.bind {} + es.function.has-instance {} + es.function.name {} + es.json.to-string-tag {} + es.map {} + es.math.acosh {} + es.math.asinh {} + es.math.atanh {} + es.math.cbrt {} + es.math.clz32 {} + es.math.cosh {} + es.math.expm1 {} + es.math.fround {} + es.math.hypot {} + es.math.imul {} + es.math.log10 {} + es.math.log1p {} + es.math.log2 {} + es.math.sign {} + es.math.sinh {} + es.math.tanh {} + es.math.to-string-tag {} + es.math.trunc {} + es.number.constructor {} + es.number.epsilon {} + es.number.is-finite {} + es.number.is-integer {} + es.number.is-nan {} + es.number.is-safe-integer {} + es.number.max-safe-integer {} + es.number.min-safe-integer {} + es.number.parse-float {} + es.number.parse-int {} + es.number.to-fixed {} + es.number.to-precision {} + es.object.assign {} + es.object.create {} + es.object.define-getter {} + es.object.define-properties {} + es.object.define-property {} + es.object.define-setter {} + es.object.entries {} + es.object.freeze {} + es.object.from-entries {} + es.object.get-own-property-descriptor {} + es.object.get-own-property-descriptors {} + es.object.get-own-property-names {} + es.object.get-prototype-of {} + es.object.is {} + es.object.is-extensible {} + es.object.is-frozen {} + es.object.is-sealed {} + es.object.keys {} + es.object.lookup-getter {} + es.object.lookup-setter {} + es.object.prevent-extensions {} + es.object.seal {} + es.object.set-prototype-of {} + es.object.to-string {} + es.object.values {} + es.parse-float {} + es.parse-int {} + es.promise {} + es.promise.finally {} + es.reflect.apply {} + es.reflect.construct {} + es.reflect.define-property {} + es.reflect.delete-property {} + es.reflect.get {} + es.reflect.get-own-property-descriptor {} + es.reflect.get-prototype-of {} + es.reflect.has {} + es.reflect.is-extensible {} + es.reflect.own-keys {} + es.reflect.prevent-extensions {} + es.reflect.set {} + es.reflect.set-prototype-of {} + es.regexp.constructor {} + es.regexp.exec {} + es.regexp.flags {} + es.regexp.to-string {} + es.set {} + es.string.code-point-at {} + es.string.ends-with {} + es.string.from-code-point {} + es.string.includes {} + es.string.iterator {} + es.string.match {} + es.string.pad-end {} + es.string.pad-start {} + es.string.raw {} + es.string.repeat {} + es.string.replace {} + es.string.search {} + es.string.split {} + es.string.starts-with {} + es.string.trim {} + es.string.trim-end {} + es.string.trim-start {} + es.string.anchor {} + es.string.big {} + es.string.blink {} + es.string.bold {} + es.string.fixed {} + es.string.fontcolor {} + es.string.fontsize {} + es.string.italics {} + es.string.link {} + es.string.small {} + es.string.strike {} + es.string.sub {} + es.string.sup {} + es.typed-array.float32-array {} + es.typed-array.float64-array {} + es.typed-array.int8-array {} + es.typed-array.int16-array {} + es.typed-array.int32-array {} + es.typed-array.uint8-array {} + es.typed-array.uint8-clamped-array {} + es.typed-array.uint16-array {} + es.typed-array.uint32-array {} + es.typed-array.copy-within {} + es.typed-array.every {} + es.typed-array.fill {} + es.typed-array.filter {} + es.typed-array.find {} + es.typed-array.find-index {} + es.typed-array.for-each {} + es.typed-array.from {} + es.typed-array.includes {} + es.typed-array.index-of {} + es.typed-array.iterator {} + es.typed-array.join {} + es.typed-array.last-index-of {} + es.typed-array.map {} + es.typed-array.of {} + es.typed-array.reduce {} + es.typed-array.reduce-right {} + es.typed-array.reverse {} + es.typed-array.set {} + es.typed-array.slice {} + es.typed-array.some {} + es.typed-array.sort {} + es.typed-array.subarray {} + es.typed-array.to-locale-string {} + es.typed-array.to-string {} + es.weak-map {} + es.weak-set {} + esnext.aggregate-error {} + esnext.array.last-index {} + esnext.array.last-item {} + esnext.composite-key {} + esnext.composite-symbol {} + esnext.global-this {} + esnext.map.delete-all {} + esnext.map.every {} + esnext.map.filter {} + esnext.map.find {} + esnext.map.find-key {} + esnext.map.from {} + esnext.map.group-by {} + esnext.map.includes {} + esnext.map.key-by {} + esnext.map.key-of {} + esnext.map.map-keys {} + esnext.map.map-values {} + esnext.map.merge {} + esnext.map.of {} + esnext.map.reduce {} + esnext.map.some {} + esnext.map.update {} + esnext.math.clamp {} + esnext.math.deg-per-rad {} + esnext.math.degrees {} + esnext.math.fscale {} + esnext.math.iaddh {} + esnext.math.imulh {} + esnext.math.isubh {} + esnext.math.rad-per-deg {} + esnext.math.radians {} + esnext.math.scale {} + esnext.math.seeded-prng {} + esnext.math.signbit {} + esnext.math.umulh {} + esnext.number.from-string {} + esnext.observable {} + esnext.promise.all-settled {} + esnext.promise.any {} + esnext.promise.try {} + esnext.reflect.define-metadata {} + esnext.reflect.delete-metadata {} + esnext.reflect.get-metadata {} + esnext.reflect.get-metadata-keys {} + esnext.reflect.get-own-metadata {} + esnext.reflect.get-own-metadata-keys {} + esnext.reflect.has-metadata {} + esnext.reflect.has-own-metadata {} + esnext.reflect.metadata {} + esnext.set.add-all {} + esnext.set.delete-all {} + esnext.set.difference {} + esnext.set.every {} + esnext.set.filter {} + esnext.set.find {} + esnext.set.from {} + esnext.set.intersection {} + esnext.set.is-disjoint-from {} + esnext.set.is-subset-of {} + esnext.set.is-superset-of {} + esnext.set.join {} + esnext.set.map {} + esnext.set.of {} + esnext.set.reduce {} + esnext.set.some {} + esnext.set.symmetric-difference {} + esnext.set.union {} + esnext.string.at {} + esnext.string.code-points {} + esnext.string.match-all {} + esnext.string.replace-all {} + esnext.symbol.dispose {} + esnext.symbol.observable {} + esnext.symbol.pattern-match {} + esnext.weak-map.delete-all {} + esnext.weak-map.from {} + esnext.weak-map.of {} + esnext.weak-set.add-all {} + esnext.weak-set.delete-all {} + esnext.weak-set.from {} + esnext.weak-set.of {} + web.url {} + web.url.to-json {} + web.url-search-params {} diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-es/in/in.js b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-es/input.mjs similarity index 100% rename from packages/babel-preset-env/test/debug-fixtures/entry-corejs3-es/in/in.js rename to packages/babel-preset-env/test/fixtures/debug/entry-corejs3-es/input.mjs diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-es/options.json b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-es/options.json new file mode 100644 index 000000000000..edf42df8057e --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-es/options.json @@ -0,0 +1,15 @@ +{ + "validateLogs": true, + "ignoreOutput": true, + "presets": [ + [ + "env", + { + "debug": true, + "shippedProposals": true, + "useBuiltIns": "entry", + "corejs": 3 + } + ] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-es/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-es/stdout.txt new file mode 100644 index 000000000000..be247fafa3e2 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-es/stdout.txt @@ -0,0 +1,248 @@ +@babel/preset-env: `DEBUG` option + +Using targets: +{} + +Using modules transform: auto + +Using plugins: + transform-template-literals {} + transform-literals {} + transform-function-name {} + transform-arrow-functions {} + transform-block-scoped-functions {} + transform-classes {} + transform-object-super {} + transform-shorthand-properties {} + transform-duplicate-keys {} + transform-computed-properties {} + transform-for-of {} + transform-sticky-regex {} + transform-dotall-regex {} + transform-unicode-regex {} + transform-spread {} + transform-parameters {} + transform-destructuring {} + transform-block-scoping {} + transform-typeof-symbol {} + transform-new-target {} + transform-regenerator {} + transform-exponentiation-operator {} + transform-async-to-generator {} + proposal-async-generator-functions {} + proposal-object-rest-spread {} + proposal-unicode-property-regex {} + proposal-json-strings {} + proposal-optional-catch-binding {} + proposal-optional-chaining {} + transform-named-capturing-groups-regex {} + transform-member-expression-literals {} + transform-property-literals {} + transform-reserved-words {} + proposal-nullish-coalescing-operator {} + transform-modules-commonjs {} + proposal-dynamic-import {} + +Using polyfills with `entry` option: + +[/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-es/input.mjs] Replaced core-js entries with the following polyfills: + es.symbol {} + es.symbol.description {} + es.symbol.async-iterator {} + es.symbol.has-instance {} + es.symbol.is-concat-spreadable {} + es.symbol.iterator {} + es.symbol.match {} + es.symbol.replace {} + es.symbol.search {} + es.symbol.species {} + es.symbol.split {} + es.symbol.to-primitive {} + es.symbol.to-string-tag {} + es.symbol.unscopables {} + es.array.concat {} + es.array.copy-within {} + es.array.every {} + es.array.fill {} + es.array.filter {} + es.array.find {} + es.array.find-index {} + es.array.flat {} + es.array.flat-map {} + es.array.for-each {} + es.array.from {} + es.array.includes {} + es.array.index-of {} + es.array.is-array {} + es.array.iterator {} + es.array.join {} + es.array.last-index-of {} + es.array.map {} + es.array.of {} + es.array.reduce {} + es.array.reduce-right {} + es.array.reverse {} + es.array.slice {} + es.array.some {} + es.array.sort {} + es.array.species {} + es.array.splice {} + es.array.unscopables.flat {} + es.array.unscopables.flat-map {} + es.array-buffer.constructor {} + es.array-buffer.is-view {} + es.array-buffer.slice {} + es.data-view {} + es.date.now {} + es.date.to-iso-string {} + es.date.to-json {} + es.date.to-primitive {} + es.date.to-string {} + es.function.bind {} + es.function.has-instance {} + es.function.name {} + es.json.to-string-tag {} + es.map {} + es.math.acosh {} + es.math.asinh {} + es.math.atanh {} + es.math.cbrt {} + es.math.clz32 {} + es.math.cosh {} + es.math.expm1 {} + es.math.fround {} + es.math.hypot {} + es.math.imul {} + es.math.log10 {} + es.math.log1p {} + es.math.log2 {} + es.math.sign {} + es.math.sinh {} + es.math.tanh {} + es.math.to-string-tag {} + es.math.trunc {} + es.number.constructor {} + es.number.epsilon {} + es.number.is-finite {} + es.number.is-integer {} + es.number.is-nan {} + es.number.is-safe-integer {} + es.number.max-safe-integer {} + es.number.min-safe-integer {} + es.number.parse-float {} + es.number.parse-int {} + es.number.to-fixed {} + es.number.to-precision {} + es.object.assign {} + es.object.create {} + es.object.define-getter {} + es.object.define-properties {} + es.object.define-property {} + es.object.define-setter {} + es.object.entries {} + es.object.freeze {} + es.object.from-entries {} + es.object.get-own-property-descriptor {} + es.object.get-own-property-descriptors {} + es.object.get-own-property-names {} + es.object.get-prototype-of {} + es.object.is {} + es.object.is-extensible {} + es.object.is-frozen {} + es.object.is-sealed {} + es.object.keys {} + es.object.lookup-getter {} + es.object.lookup-setter {} + es.object.prevent-extensions {} + es.object.seal {} + es.object.set-prototype-of {} + es.object.to-string {} + es.object.values {} + es.parse-float {} + es.parse-int {} + es.promise {} + es.promise.finally {} + es.reflect.apply {} + es.reflect.construct {} + es.reflect.define-property {} + es.reflect.delete-property {} + es.reflect.get {} + es.reflect.get-own-property-descriptor {} + es.reflect.get-prototype-of {} + es.reflect.has {} + es.reflect.is-extensible {} + es.reflect.own-keys {} + es.reflect.prevent-extensions {} + es.reflect.set {} + es.reflect.set-prototype-of {} + es.regexp.constructor {} + es.regexp.exec {} + es.regexp.flags {} + es.regexp.to-string {} + es.set {} + es.string.code-point-at {} + es.string.ends-with {} + es.string.from-code-point {} + es.string.includes {} + es.string.iterator {} + es.string.match {} + es.string.pad-end {} + es.string.pad-start {} + es.string.raw {} + es.string.repeat {} + es.string.replace {} + es.string.search {} + es.string.split {} + es.string.starts-with {} + es.string.trim {} + es.string.trim-end {} + es.string.trim-start {} + es.string.anchor {} + es.string.big {} + es.string.blink {} + es.string.bold {} + es.string.fixed {} + es.string.fontcolor {} + es.string.fontsize {} + es.string.italics {} + es.string.link {} + es.string.small {} + es.string.strike {} + es.string.sub {} + es.string.sup {} + es.typed-array.float32-array {} + es.typed-array.float64-array {} + es.typed-array.int8-array {} + es.typed-array.int16-array {} + es.typed-array.int32-array {} + es.typed-array.uint8-array {} + es.typed-array.uint8-clamped-array {} + es.typed-array.uint16-array {} + es.typed-array.uint32-array {} + es.typed-array.copy-within {} + es.typed-array.every {} + es.typed-array.fill {} + es.typed-array.filter {} + es.typed-array.find {} + es.typed-array.find-index {} + es.typed-array.for-each {} + es.typed-array.from {} + es.typed-array.includes {} + es.typed-array.index-of {} + es.typed-array.iterator {} + es.typed-array.join {} + es.typed-array.last-index-of {} + es.typed-array.map {} + es.typed-array.of {} + es.typed-array.reduce {} + es.typed-array.reduce-right {} + es.typed-array.reverse {} + es.typed-array.set {} + es.typed-array.slice {} + es.typed-array.some {} + es.typed-array.sort {} + es.typed-array.subarray {} + es.typed-array.to-locale-string {} + es.typed-array.to-string {} + es.weak-map {} + es.weak-set {} diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-force-all-transforms/in/in.js b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-force-all-transforms/input.mjs similarity index 100% rename from packages/babel-preset-env/test/debug-fixtures/entry-corejs3-force-all-transforms/in/in.js rename to packages/babel-preset-env/test/fixtures/debug/entry-corejs3-force-all-transforms/input.mjs diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-force-all-transforms/options.json b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-force-all-transforms/options.json new file mode 100644 index 000000000000..7a7ff504fed3 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-force-all-transforms/options.json @@ -0,0 +1,19 @@ +{ + "validateLogs": true, + "ignoreOutput": true, + "presets": [ + [ + "env", + { + "debug": true, + "modules": false, + "targets": { + "chrome": 55 + }, + "useBuiltIns": "entry", + "corejs": 3, + "forceAllTransforms": true + } + ] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-force-all-transforms/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-force-all-transforms/stdout.txt new file mode 100644 index 000000000000..182501549bcd --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-force-all-transforms/stdout.txt @@ -0,0 +1,78 @@ +@babel/preset-env: `DEBUG` option + +Using targets: +{ + "chrome": "55" +} + +Using modules transform: false + +Using plugins: + transform-template-literals {} + transform-literals {} + transform-function-name {} + transform-arrow-functions {} + transform-block-scoped-functions {} + transform-classes {} + transform-object-super {} + transform-shorthand-properties {} + transform-duplicate-keys {} + transform-computed-properties {} + transform-for-of {} + transform-sticky-regex {} + transform-dotall-regex { "chrome":"55" } + transform-unicode-regex {} + transform-spread {} + transform-parameters {} + transform-destructuring {} + transform-block-scoping {} + transform-typeof-symbol {} + transform-new-target {} + transform-regenerator {} + transform-exponentiation-operator {} + transform-async-to-generator {} + proposal-async-generator-functions { "chrome":"55" } + proposal-object-rest-spread { "chrome":"55" } + proposal-unicode-property-regex { "chrome":"55" } + proposal-json-strings { "chrome":"55" } + proposal-optional-catch-binding { "chrome":"55" } + proposal-optional-chaining { "chrome":"55" } + transform-named-capturing-groups-regex { "chrome":"55" } + transform-member-expression-literals {} + transform-property-literals {} + transform-reserved-words {} + proposal-nullish-coalescing-operator { "chrome":"55" } + syntax-dynamic-import { "chrome":"55" } + +Using polyfills with `entry` option: + +[/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-force-all-transforms/input.mjs] Replaced core-js entries with the following polyfills: + es.symbol.description { "chrome":"55" } + es.symbol.async-iterator { "chrome":"55" } + es.array.flat { "chrome":"55" } + es.array.flat-map { "chrome":"55" } + es.array.iterator { "chrome":"55" } + es.array.sort { "chrome":"55" } + es.array.unscopables.flat { "chrome":"55" } + es.array.unscopables.flat-map { "chrome":"55" } + es.math.hypot { "chrome":"55" } + es.object.define-getter { "chrome":"55" } + es.object.define-setter { "chrome":"55" } + es.object.from-entries { "chrome":"55" } + es.object.lookup-getter { "chrome":"55" } + es.object.lookup-setter { "chrome":"55" } + es.promise { "chrome":"55" } + es.promise.finally { "chrome":"55" } + es.string.pad-end { "chrome":"55" } + es.string.pad-start { "chrome":"55" } + es.string.replace { "chrome":"55" } + es.string.trim { "chrome":"55" } + es.string.trim-end { "chrome":"55" } + es.string.trim-start { "chrome":"55" } + web.dom-collections.for-each { "chrome":"55" } + web.dom-collections.iterator { "chrome":"55" } + web.immediate { "chrome":"55" } + web.queue-microtask { "chrome":"55" } + web.url { "chrome":"55" } + web.url.to-json { "chrome":"55" } + web.url-search-params { "chrome":"55" } diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-no-import/in/in.js b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-no-import/input.js similarity index 100% rename from packages/babel-preset-env/test/debug-fixtures/entry-corejs3-no-import/in/in.js rename to packages/babel-preset-env/test/fixtures/debug/entry-corejs3-no-import/input.js diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-no-import/options.json b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-no-import/options.json new file mode 100644 index 000000000000..06c8e01e63ad --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-no-import/options.json @@ -0,0 +1,17 @@ +{ + "validateLogs": true, + "ignoreOutput": true, + "presets": [ + [ + "env", + { + "debug": true, + "targets": { + "node": 6 + }, + "useBuiltIns": "entry", + "corejs": 3 + } + ] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-no-import/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-no-import/stdout.txt new file mode 100644 index 000000000000..efc3f53ab6e0 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-no-import/stdout.txt @@ -0,0 +1,30 @@ +@babel/preset-env: `DEBUG` option + +Using targets: +{ + "node": "6" +} + +Using modules transform: auto + +Using plugins: + transform-function-name { "node":"6" } + transform-for-of { "node":"6" } + transform-dotall-regex { "node":"6" } + transform-destructuring { "node":"6" } + transform-exponentiation-operator { "node":"6" } + transform-async-to-generator { "node":"6" } + proposal-async-generator-functions { "node":"6" } + proposal-object-rest-spread { "node":"6" } + proposal-unicode-property-regex { "node":"6" } + proposal-json-strings { "node":"6" } + proposal-optional-catch-binding { "node":"6" } + proposal-optional-chaining { "node":"6" } + transform-named-capturing-groups-regex { "node":"6" } + proposal-nullish-coalescing-operator { "node":"6" } + transform-modules-commonjs { "node":"6" } + proposal-dynamic-import { "node":"6" } + +Using polyfills with `entry` option: + +[/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-no-import/input.js] Import of core-js was not found. diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-proposals-chrome-71/in/in.js b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-proposals-chrome-71/input.mjs similarity index 100% rename from packages/babel-preset-env/test/debug-fixtures/entry-corejs3-proposals-chrome-71/in/in.js rename to packages/babel-preset-env/test/fixtures/debug/entry-corejs3-proposals-chrome-71/input.mjs diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-proposals-chrome-71/options.json b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-proposals-chrome-71/options.json new file mode 100644 index 000000000000..c33ddf46d323 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-proposals-chrome-71/options.json @@ -0,0 +1,17 @@ +{ + "validateLogs": true, + "ignoreOutput": true, + "presets": [ + [ + "env", + { + "debug": true, + "targets": { + "browsers": "chrome 71" + }, + "useBuiltIns": "entry", + "corejs": { "version": 3, "proposals": true } + } + ] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-proposals-chrome-71/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-proposals-chrome-71/stdout.txt new file mode 100644 index 000000000000..742d4d311e30 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-proposals-chrome-71/stdout.txt @@ -0,0 +1,105 @@ +@babel/preset-env: `DEBUG` option + +Using targets: +{ + "chrome": "71" +} + +Using modules transform: auto + +Using plugins: + syntax-async-generators { "chrome":"71" } + syntax-object-rest-spread { "chrome":"71" } + syntax-json-strings { "chrome":"71" } + syntax-optional-catch-binding { "chrome":"71" } + proposal-optional-chaining { "chrome":"71" } + proposal-nullish-coalescing-operator { "chrome":"71" } + transform-modules-commonjs { "chrome":"71" } + proposal-dynamic-import { "chrome":"71" } + +Using polyfills with `entry` option: + +[/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-proposals-chrome-71/input.mjs] Replaced core-js entries with the following polyfills: + esnext.aggregate-error { "chrome":"71" } + esnext.array.last-index { "chrome":"71" } + esnext.array.last-item { "chrome":"71" } + esnext.composite-key { "chrome":"71" } + esnext.composite-symbol { "chrome":"71" } + esnext.map.delete-all { "chrome":"71" } + esnext.map.every { "chrome":"71" } + esnext.map.filter { "chrome":"71" } + esnext.map.find { "chrome":"71" } + esnext.map.find-key { "chrome":"71" } + esnext.map.from { "chrome":"71" } + esnext.map.group-by { "chrome":"71" } + esnext.map.includes { "chrome":"71" } + esnext.map.key-by { "chrome":"71" } + esnext.map.key-of { "chrome":"71" } + esnext.map.map-keys { "chrome":"71" } + esnext.map.map-values { "chrome":"71" } + esnext.map.merge { "chrome":"71" } + esnext.map.of { "chrome":"71" } + esnext.map.reduce { "chrome":"71" } + esnext.map.some { "chrome":"71" } + esnext.map.update { "chrome":"71" } + esnext.math.clamp { "chrome":"71" } + esnext.math.deg-per-rad { "chrome":"71" } + esnext.math.degrees { "chrome":"71" } + esnext.math.fscale { "chrome":"71" } + esnext.math.iaddh { "chrome":"71" } + esnext.math.imulh { "chrome":"71" } + esnext.math.isubh { "chrome":"71" } + esnext.math.rad-per-deg { "chrome":"71" } + esnext.math.radians { "chrome":"71" } + esnext.math.scale { "chrome":"71" } + esnext.math.seeded-prng { "chrome":"71" } + esnext.math.signbit { "chrome":"71" } + esnext.math.umulh { "chrome":"71" } + esnext.number.from-string { "chrome":"71" } + esnext.observable { "chrome":"71" } + esnext.promise.all-settled { "chrome":"71" } + esnext.promise.any { "chrome":"71" } + esnext.promise.try { "chrome":"71" } + esnext.reflect.define-metadata { "chrome":"71" } + esnext.reflect.delete-metadata { "chrome":"71" } + esnext.reflect.get-metadata { "chrome":"71" } + esnext.reflect.get-metadata-keys { "chrome":"71" } + esnext.reflect.get-own-metadata { "chrome":"71" } + esnext.reflect.get-own-metadata-keys { "chrome":"71" } + esnext.reflect.has-metadata { "chrome":"71" } + esnext.reflect.has-own-metadata { "chrome":"71" } + esnext.reflect.metadata { "chrome":"71" } + esnext.set.add-all { "chrome":"71" } + esnext.set.delete-all { "chrome":"71" } + esnext.set.difference { "chrome":"71" } + esnext.set.every { "chrome":"71" } + esnext.set.filter { "chrome":"71" } + esnext.set.find { "chrome":"71" } + esnext.set.from { "chrome":"71" } + esnext.set.intersection { "chrome":"71" } + esnext.set.is-disjoint-from { "chrome":"71" } + esnext.set.is-subset-of { "chrome":"71" } + esnext.set.is-superset-of { "chrome":"71" } + esnext.set.join { "chrome":"71" } + esnext.set.map { "chrome":"71" } + esnext.set.of { "chrome":"71" } + esnext.set.reduce { "chrome":"71" } + esnext.set.some { "chrome":"71" } + esnext.set.symmetric-difference { "chrome":"71" } + esnext.set.union { "chrome":"71" } + esnext.string.at { "chrome":"71" } + esnext.string.code-points { "chrome":"71" } + esnext.string.match-all { "chrome":"71" } + esnext.string.replace-all { "chrome":"71" } + esnext.symbol.dispose { "chrome":"71" } + esnext.symbol.observable { "chrome":"71" } + esnext.symbol.pattern-match { "chrome":"71" } + esnext.weak-map.delete-all { "chrome":"71" } + esnext.weak-map.from { "chrome":"71" } + esnext.weak-map.of { "chrome":"71" } + esnext.weak-set.add-all { "chrome":"71" } + esnext.weak-set.delete-all { "chrome":"71" } + esnext.weak-set.from { "chrome":"71" } + esnext.weak-set.of { "chrome":"71" } + +[/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-proposals-chrome-71/input.mjs] Based on your targets, regenerator-runtime import excluded. diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-proposals/in/in.js b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-proposals/input.mjs similarity index 100% rename from packages/babel-preset-env/test/debug-fixtures/entry-corejs3-proposals/in/in.js rename to packages/babel-preset-env/test/fixtures/debug/entry-corejs3-proposals/input.mjs diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-proposals/options.json b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-proposals/options.json new file mode 100644 index 000000000000..be2441059196 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-proposals/options.json @@ -0,0 +1,14 @@ +{ + "validateLogs": true, + "ignoreOutput": true, + "presets": [ + [ + "env", + { + "debug": true, + "useBuiltIns": "entry", + "corejs": { "version": 3, "proposals": true } + } + ] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-proposals/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-proposals/stdout.txt new file mode 100644 index 000000000000..fc866a9de007 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-proposals/stdout.txt @@ -0,0 +1,133 @@ +@babel/preset-env: `DEBUG` option + +Using targets: +{} + +Using modules transform: auto + +Using plugins: + transform-template-literals {} + transform-literals {} + transform-function-name {} + transform-arrow-functions {} + transform-block-scoped-functions {} + transform-classes {} + transform-object-super {} + transform-shorthand-properties {} + transform-duplicate-keys {} + transform-computed-properties {} + transform-for-of {} + transform-sticky-regex {} + transform-dotall-regex {} + transform-unicode-regex {} + transform-spread {} + transform-parameters {} + transform-destructuring {} + transform-block-scoping {} + transform-typeof-symbol {} + transform-new-target {} + transform-regenerator {} + transform-exponentiation-operator {} + transform-async-to-generator {} + proposal-async-generator-functions {} + proposal-object-rest-spread {} + proposal-unicode-property-regex {} + proposal-json-strings {} + proposal-optional-catch-binding {} + proposal-optional-chaining {} + transform-named-capturing-groups-regex {} + transform-member-expression-literals {} + transform-property-literals {} + transform-reserved-words {} + proposal-nullish-coalescing-operator {} + transform-modules-commonjs {} + proposal-dynamic-import {} + +Using polyfills with `entry` option: + +[/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-proposals/input.mjs] Replaced core-js entries with the following polyfills: + esnext.aggregate-error {} + esnext.array.last-index {} + esnext.array.last-item {} + esnext.composite-key {} + esnext.composite-symbol {} + esnext.global-this {} + esnext.map.delete-all {} + esnext.map.every {} + esnext.map.filter {} + esnext.map.find {} + esnext.map.find-key {} + esnext.map.from {} + esnext.map.group-by {} + esnext.map.includes {} + esnext.map.key-by {} + esnext.map.key-of {} + esnext.map.map-keys {} + esnext.map.map-values {} + esnext.map.merge {} + esnext.map.of {} + esnext.map.reduce {} + esnext.map.some {} + esnext.map.update {} + esnext.math.clamp {} + esnext.math.deg-per-rad {} + esnext.math.degrees {} + esnext.math.fscale {} + esnext.math.iaddh {} + esnext.math.imulh {} + esnext.math.isubh {} + esnext.math.rad-per-deg {} + esnext.math.radians {} + esnext.math.scale {} + esnext.math.seeded-prng {} + esnext.math.signbit {} + esnext.math.umulh {} + esnext.number.from-string {} + esnext.observable {} + esnext.promise.all-settled {} + esnext.promise.any {} + esnext.promise.try {} + esnext.reflect.define-metadata {} + esnext.reflect.delete-metadata {} + esnext.reflect.get-metadata {} + esnext.reflect.get-metadata-keys {} + esnext.reflect.get-own-metadata {} + esnext.reflect.get-own-metadata-keys {} + esnext.reflect.has-metadata {} + esnext.reflect.has-own-metadata {} + esnext.reflect.metadata {} + esnext.set.add-all {} + esnext.set.delete-all {} + esnext.set.difference {} + esnext.set.every {} + esnext.set.filter {} + esnext.set.find {} + esnext.set.from {} + esnext.set.intersection {} + esnext.set.is-disjoint-from {} + esnext.set.is-subset-of {} + esnext.set.is-superset-of {} + esnext.set.join {} + esnext.set.map {} + esnext.set.of {} + esnext.set.reduce {} + esnext.set.some {} + esnext.set.symmetric-difference {} + esnext.set.union {} + esnext.string.at {} + esnext.string.code-points {} + esnext.string.match-all {} + esnext.string.replace-all {} + esnext.symbol.dispose {} + esnext.symbol.observable {} + esnext.symbol.pattern-match {} + esnext.weak-map.delete-all {} + esnext.weak-map.from {} + esnext.weak-map.of {} + esnext.weak-set.add-all {} + esnext.weak-set.delete-all {} + esnext.weak-set.from {} + esnext.weak-set.of {} + web.url {} + web.url.to-json {} + web.url-search-params {} diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-runtime-only-chrome-71/in/in.js b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-runtime-only-chrome-71/input.mjs similarity index 100% rename from packages/babel-preset-env/test/debug-fixtures/entry-corejs3-runtime-only-chrome-71/in/in.js rename to packages/babel-preset-env/test/fixtures/debug/entry-corejs3-runtime-only-chrome-71/input.mjs diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-runtime-only-chrome-71/options.json b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-runtime-only-chrome-71/options.json new file mode 100644 index 000000000000..6e8f4a357b28 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-runtime-only-chrome-71/options.json @@ -0,0 +1,18 @@ +{ + "validateLogs": true, + "ignoreOutput": true, + "presets": [ + [ + "env", + { + "debug": true, + "targets": { + "browsers": "chrome 71" + }, + "shippedProposals": true, + "useBuiltIns": "entry", + "corejs": 3 + } + ] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-runtime-only-chrome-71/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-runtime-only-chrome-71/stdout.txt new file mode 100644 index 000000000000..c0caa6231b38 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-runtime-only-chrome-71/stdout.txt @@ -0,0 +1,24 @@ +@babel/preset-env: `DEBUG` option + +Using targets: +{ + "chrome": "71" +} + +Using modules transform: auto + +Using plugins: + syntax-async-generators { "chrome":"71" } + syntax-object-rest-spread { "chrome":"71" } + syntax-json-strings { "chrome":"71" } + syntax-optional-catch-binding { "chrome":"71" } + proposal-optional-chaining { "chrome":"71" } + proposal-nullish-coalescing-operator { "chrome":"71" } + transform-modules-commonjs { "chrome":"71" } + proposal-dynamic-import { "chrome":"71" } + +Using polyfills with `entry` option: + +[/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-runtime-only-chrome-71/input.mjs] Import of core-js was not found. + +[/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-runtime-only-chrome-71/input.mjs] Based on your targets, regenerator-runtime import excluded. diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-runtime-only/in/in.js b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-runtime-only/input.mjs similarity index 100% rename from packages/babel-preset-env/test/debug-fixtures/entry-corejs3-runtime-only/in/in.js rename to packages/babel-preset-env/test/fixtures/debug/entry-corejs3-runtime-only/input.mjs diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-runtime-only/options.json b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-runtime-only/options.json new file mode 100644 index 000000000000..6e8f4a357b28 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-runtime-only/options.json @@ -0,0 +1,18 @@ +{ + "validateLogs": true, + "ignoreOutput": true, + "presets": [ + [ + "env", + { + "debug": true, + "targets": { + "browsers": "chrome 71" + }, + "shippedProposals": true, + "useBuiltIns": "entry", + "corejs": 3 + } + ] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-runtime-only/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-runtime-only/stdout.txt new file mode 100644 index 000000000000..7df51ffb6178 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-runtime-only/stdout.txt @@ -0,0 +1,24 @@ +@babel/preset-env: `DEBUG` option + +Using targets: +{ + "chrome": "71" +} + +Using modules transform: auto + +Using plugins: + syntax-async-generators { "chrome":"71" } + syntax-object-rest-spread { "chrome":"71" } + syntax-json-strings { "chrome":"71" } + syntax-optional-catch-binding { "chrome":"71" } + proposal-optional-chaining { "chrome":"71" } + proposal-nullish-coalescing-operator { "chrome":"71" } + transform-modules-commonjs { "chrome":"71" } + proposal-dynamic-import { "chrome":"71" } + +Using polyfills with `entry` option: + +[/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-runtime-only/input.mjs] Import of core-js was not found. + +[/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-runtime-only/input.mjs] Based on your targets, regenerator-runtime import excluded. diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-specific-entries-chrome-71/in/in.js b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-specific-entries-chrome-71/input.mjs similarity index 100% rename from packages/babel-preset-env/test/debug-fixtures/entry-corejs3-specific-entries-chrome-71/in/in.js rename to packages/babel-preset-env/test/fixtures/debug/entry-corejs3-specific-entries-chrome-71/input.mjs diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-specific-entries-chrome-71/options.json b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-specific-entries-chrome-71/options.json new file mode 100644 index 000000000000..6e8f4a357b28 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-specific-entries-chrome-71/options.json @@ -0,0 +1,18 @@ +{ + "validateLogs": true, + "ignoreOutput": true, + "presets": [ + [ + "env", + { + "debug": true, + "targets": { + "browsers": "chrome 71" + }, + "shippedProposals": true, + "useBuiltIns": "entry", + "corejs": 3 + } + ] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-specific-entries-chrome-71/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-specific-entries-chrome-71/stdout.txt new file mode 100644 index 000000000000..1264913107eb --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-specific-entries-chrome-71/stdout.txt @@ -0,0 +1,34 @@ +@babel/preset-env: `DEBUG` option + +Using targets: +{ + "chrome": "71" +} + +Using modules transform: auto + +Using plugins: + syntax-async-generators { "chrome":"71" } + syntax-object-rest-spread { "chrome":"71" } + syntax-json-strings { "chrome":"71" } + syntax-optional-catch-binding { "chrome":"71" } + proposal-optional-chaining { "chrome":"71" } + proposal-nullish-coalescing-operator { "chrome":"71" } + transform-modules-commonjs { "chrome":"71" } + proposal-dynamic-import { "chrome":"71" } + +Using polyfills with `entry` option: + +[/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-specific-entries-chrome-71/input.mjs] Replaced core-js entries with the following polyfills: + es.object.from-entries { "chrome":"71" } + esnext.reflect.define-metadata { "chrome":"71" } + esnext.reflect.delete-metadata { "chrome":"71" } + esnext.reflect.get-metadata { "chrome":"71" } + esnext.reflect.get-metadata-keys { "chrome":"71" } + esnext.reflect.get-own-metadata { "chrome":"71" } + esnext.reflect.get-own-metadata-keys { "chrome":"71" } + esnext.reflect.has-metadata { "chrome":"71" } + esnext.reflect.has-own-metadata { "chrome":"71" } + esnext.reflect.metadata { "chrome":"71" } + +[/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-specific-entries-chrome-71/input.mjs] Based on your targets, regenerator-runtime import excluded. diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-specific-entries/in/in.js b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-specific-entries/input.mjs similarity index 100% rename from packages/babel-preset-env/test/debug-fixtures/entry-corejs3-specific-entries/in/in.js rename to packages/babel-preset-env/test/fixtures/debug/entry-corejs3-specific-entries/input.mjs diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-specific-entries/options.json b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-specific-entries/options.json new file mode 100644 index 000000000000..edf42df8057e --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-specific-entries/options.json @@ -0,0 +1,15 @@ +{ + "validateLogs": true, + "ignoreOutput": true, + "presets": [ + [ + "env", + { + "debug": true, + "shippedProposals": true, + "useBuiltIns": "entry", + "corejs": 3 + } + ] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-specific-entries/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-specific-entries/stdout.txt new file mode 100644 index 000000000000..71a8cab89def --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-specific-entries/stdout.txt @@ -0,0 +1,98 @@ +@babel/preset-env: `DEBUG` option + +Using targets: +{} + +Using modules transform: auto + +Using plugins: + transform-template-literals {} + transform-literals {} + transform-function-name {} + transform-arrow-functions {} + transform-block-scoped-functions {} + transform-classes {} + transform-object-super {} + transform-shorthand-properties {} + transform-duplicate-keys {} + transform-computed-properties {} + transform-for-of {} + transform-sticky-regex {} + transform-dotall-regex {} + transform-unicode-regex {} + transform-spread {} + transform-parameters {} + transform-destructuring {} + transform-block-scoping {} + transform-typeof-symbol {} + transform-new-target {} + transform-regenerator {} + transform-exponentiation-operator {} + transform-async-to-generator {} + proposal-async-generator-functions {} + proposal-object-rest-spread {} + proposal-unicode-property-regex {} + proposal-json-strings {} + proposal-optional-catch-binding {} + proposal-optional-chaining {} + transform-named-capturing-groups-regex {} + transform-member-expression-literals {} + transform-property-literals {} + transform-reserved-words {} + proposal-nullish-coalescing-operator {} + transform-modules-commonjs {} + proposal-dynamic-import {} + +Using polyfills with `entry` option: + +[/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-specific-entries/input.mjs] Replaced core-js entries with the following polyfills: + es.symbol {} + es.json.to-string-tag {} + es.math.to-string-tag {} + es.object.assign {} + es.object.create {} + es.object.define-getter {} + es.object.define-properties {} + es.object.define-property {} + es.object.define-setter {} + es.object.entries {} + es.object.freeze {} + es.object.from-entries {} + es.object.get-own-property-descriptor {} + es.object.get-own-property-descriptors {} + es.object.get-own-property-names {} + es.object.get-prototype-of {} + es.object.is {} + es.object.is-extensible {} + es.object.is-frozen {} + es.object.is-sealed {} + es.object.keys {} + es.object.lookup-getter {} + es.object.lookup-setter {} + es.object.prevent-extensions {} + es.object.seal {} + es.object.set-prototype-of {} + es.object.to-string {} + es.object.values {} + es.reflect.apply {} + es.reflect.construct {} + es.reflect.define-property {} + es.reflect.delete-property {} + es.reflect.get {} + es.reflect.get-own-property-descriptor {} + es.reflect.get-prototype-of {} + es.reflect.has {} + es.reflect.is-extensible {} + es.reflect.own-keys {} + es.reflect.prevent-extensions {} + es.reflect.set {} + es.reflect.set-prototype-of {} + esnext.reflect.define-metadata {} + esnext.reflect.delete-metadata {} + esnext.reflect.get-metadata {} + esnext.reflect.get-metadata-keys {} + esnext.reflect.get-own-metadata {} + esnext.reflect.get-own-metadata-keys {} + esnext.reflect.has-metadata {} + esnext.reflect.has-own-metadata {} + esnext.reflect.metadata {} diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-specific-targets/in/in.js b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-specific-targets/input.mjs similarity index 100% rename from packages/babel-preset-env/test/debug-fixtures/entry-corejs3-specific-targets/in/in.js rename to packages/babel-preset-env/test/fixtures/debug/entry-corejs3-specific-targets/input.mjs diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-specific-targets/options.json b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-specific-targets/options.json new file mode 100644 index 000000000000..29b3f9326ffb --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-specific-targets/options.json @@ -0,0 +1,17 @@ +{ + "validateLogs": true, + "ignoreOutput": true, + "presets": [ + [ + "env", + { + "debug": true, + "targets": { + "browsers": "ie 10, ios 9, safari 7, edge 13, chrome 54, firefox 49" + }, + "useBuiltIns": "entry", + "corejs": 3 + } + ] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-specific-targets/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-specific-targets/stdout.txt new file mode 100644 index 000000000000..81931d9a365f --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-specific-targets/stdout.txt @@ -0,0 +1,252 @@ +@babel/preset-env: `DEBUG` option + +Using targets: +{ + "chrome": "54", + "edge": "13", + "firefox": "49", + "ie": "10", + "ios": "9", + "safari": "7" +} + +Using modules transform: auto + +Using plugins: + transform-template-literals { "ie":"10", "ios":"9", "safari":"7" } + transform-literals { "firefox":"49", "ie":"10", "safari":"7" } + transform-function-name { "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + transform-arrow-functions { "ie":"10", "ios":"9", "safari":"7" } + transform-block-scoped-functions { "ie":"10", "ios":"9", "safari":"7" } + transform-classes { "ie":"10", "ios":"9", "safari":"7" } + transform-object-super { "ie":"10", "ios":"9", "safari":"7" } + transform-shorthand-properties { "ie":"10", "safari":"7" } + transform-duplicate-keys { "ie":"10", "safari":"7" } + transform-computed-properties { "ie":"10", "safari":"7" } + transform-for-of { "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + transform-sticky-regex { "ie":"10", "ios":"9", "safari":"7" } + transform-dotall-regex { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + transform-unicode-regex { "ie":"10", "ios":"9", "safari":"7" } + transform-spread { "ie":"10", "ios":"9", "safari":"7" } + transform-parameters { "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + transform-destructuring { "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + transform-block-scoping { "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + transform-typeof-symbol { "ie":"10", "safari":"7" } + transform-new-target { "edge":"13", "ie":"10", "ios":"9", "safari":"7" } + transform-regenerator { "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + transform-exponentiation-operator { "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + transform-async-to-generator { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + proposal-async-generator-functions { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + proposal-object-rest-spread { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + proposal-unicode-property-regex { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + proposal-json-strings { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + proposal-optional-catch-binding { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + proposal-optional-chaining { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + transform-named-capturing-groups-regex { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + proposal-nullish-coalescing-operator { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + transform-modules-commonjs { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + proposal-dynamic-import { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + +Using polyfills with `entry` option: + +[/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-specific-targets/input.mjs] Replaced core-js entries with the following polyfills: + es.symbol { "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + es.symbol.description { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + es.symbol.async-iterator { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + es.symbol.has-instance { "edge":"13", "ie":"10", "ios":"9", "safari":"7" } + es.symbol.is-concat-spreadable { "edge":"13", "ie":"10", "ios":"9", "safari":"7" } + es.symbol.iterator { "ie":"10", "safari":"7" } + es.symbol.match { "edge":"13", "ie":"10", "ios":"9", "safari":"7" } + es.symbol.replace { "edge":"13", "ie":"10", "ios":"9", "safari":"7" } + es.symbol.search { "edge":"13", "ie":"10", "ios":"9", "safari":"7" } + es.symbol.species { "ie":"10", "ios":"9", "safari":"7" } + es.symbol.split { "edge":"13", "ie":"10", "ios":"9", "safari":"7" } + es.symbol.to-primitive { "edge":"13", "ie":"10", "ios":"9", "safari":"7" } + es.symbol.to-string-tag { "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + es.symbol.unscopables { "ie":"10", "safari":"7" } + es.array.concat { "edge":"13", "ie":"10", "ios":"9", "safari":"7" } + es.array.copy-within { "ie":"10", "safari":"7" } + es.array.every { "edge":"13", "firefox":"49", "ie":"10", "safari":"7" } + es.array.fill { "ie":"10", "safari":"7" } + es.array.filter { "edge":"13", "ie":"10", "ios":"9", "safari":"7" } + es.array.find { "ie":"10", "safari":"7" } + es.array.find-index { "ie":"10", "safari":"7" } + es.array.flat { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + es.array.flat-map { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + es.array.for-each { "edge":"13", "firefox":"49", "ie":"10", "safari":"7" } + es.array.from { "edge":"13", "firefox":"49", "ie":"10", "safari":"7" } + es.array.includes { "edge":"13", "ie":"10", "ios":"9", "safari":"7" } + es.array.index-of { "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + es.array.iterator { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + es.array.join { "ie":"10", "safari":"7" } + es.array.last-index-of { "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + es.array.map { "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + es.array.of { "ie":"10", "safari":"7" } + es.array.reduce { "edge":"13", "firefox":"49", "ie":"10", "safari":"7" } + es.array.reduce-right { "edge":"13", "firefox":"49", "ie":"10", "safari":"7" } + es.array.reverse { "ios":"9", "safari":"7" } + es.array.slice { "edge":"13", "ie":"10", "ios":"9", "safari":"7" } + es.array.some { "edge":"13", "firefox":"49", "ie":"10", "safari":"7" } + es.array.sort { "chrome":"54", "ios":"9", "safari":"7" } + es.array.species { "ie":"10", "ios":"9", "safari":"7" } + es.array.splice { "edge":"13", "ie":"10", "ios":"9", "safari":"7" } + es.array.unscopables.flat { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + es.array.unscopables.flat-map { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + es.array-buffer.constructor { "edge":"13", "ie":"10", "ios":"9", "safari":"7" } + es.array-buffer.is-view { "ie":"10", "safari":"7" } + es.array-buffer.slice { "ie":"10", "ios":"9", "safari":"7" } + es.data-view { "safari":"7" } + es.date.to-iso-string { "safari":"7" } + es.date.to-json { "ios":"9", "safari":"7" } + es.date.to-primitive { "edge":"13", "ie":"10", "ios":"9", "safari":"7" } + es.function.has-instance { "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + es.function.name { "ie":"10" } + es.json.to-string-tag { "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + es.map { "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + es.math.acosh { "ie":"10", "safari":"7" } + es.math.asinh { "ie":"10", "safari":"7" } + es.math.atanh { "ie":"10", "safari":"7" } + es.math.cbrt { "ie":"10", "safari":"7" } + es.math.clz32 { "ie":"10", "safari":"7" } + es.math.cosh { "ie":"10", "safari":"7" } + es.math.expm1 { "ie":"10", "safari":"7" } + es.math.fround { "ie":"10", "safari":"7" } + es.math.hypot { "chrome":"54", "ie":"10", "safari":"7" } + es.math.imul { "ie":"10", "safari":"7" } + es.math.log10 { "ie":"10", "safari":"7" } + es.math.log1p { "ie":"10", "safari":"7" } + es.math.log2 { "ie":"10", "safari":"7" } + es.math.sign { "ie":"10", "safari":"7" } + es.math.sinh { "ie":"10", "safari":"7" } + es.math.tanh { "ie":"10", "safari":"7" } + es.math.to-string-tag { "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + es.math.trunc { "ie":"10", "safari":"7" } + es.number.constructor { "ie":"10", "safari":"7" } + es.number.epsilon { "ie":"10", "safari":"7" } + es.number.is-finite { "ie":"10", "safari":"7" } + es.number.is-integer { "ie":"10", "safari":"7" } + es.number.is-nan { "ie":"10", "safari":"7" } + es.number.is-safe-integer { "ie":"10", "safari":"7" } + es.number.max-safe-integer { "ie":"10", "safari":"7" } + es.number.min-safe-integer { "ie":"10", "safari":"7" } + es.number.parse-float { "ie":"10", "ios":"9", "safari":"7" } + es.number.parse-int { "ie":"10", "safari":"7" } + es.number.to-fixed { "edge":"13", "ie":"10", "safari":"7" } + es.number.to-precision { "safari":"7" } + es.object.assign { "edge":"13", "ie":"10", "safari":"7" } + es.object.define-getter { "chrome":"54", "edge":"13", "ie":"10", "safari":"7" } + es.object.define-setter { "chrome":"54", "edge":"13", "ie":"10", "safari":"7" } + es.object.entries { "edge":"13", "ie":"10", "ios":"9", "safari":"7" } + es.object.freeze { "ie":"10", "safari":"7" } + es.object.from-entries { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + es.object.get-own-property-descriptor { "ie":"10", "safari":"7" } + es.object.get-own-property-descriptors { "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + es.object.get-own-property-names { "ie":"10", "safari":"7" } + es.object.get-prototype-of { "ie":"10", "safari":"7" } + es.object.is { "ie":"10", "safari":"7" } + es.object.is-extensible { "ie":"10", "safari":"7" } + es.object.is-frozen { "ie":"10", "safari":"7" } + es.object.is-sealed { "ie":"10", "safari":"7" } + es.object.keys { "ie":"10", "safari":"7" } + es.object.lookup-getter { "chrome":"54", "edge":"13", "ie":"10", "safari":"7" } + es.object.lookup-setter { "chrome":"54", "edge":"13", "ie":"10", "safari":"7" } + es.object.prevent-extensions { "ie":"10", "safari":"7" } + es.object.seal { "ie":"10", "safari":"7" } + es.object.set-prototype-of { "ie":"10", "safari":"7" } + es.object.to-string { "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + es.object.values { "edge":"13", "ie":"10", "ios":"9", "safari":"7" } + es.parse-float { "safari":"7" } + es.parse-int { "safari":"7" } + es.promise { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + es.promise.finally { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + es.reflect.apply { "edge":"13", "ie":"10", "ios":"9", "safari":"7" } + es.reflect.construct { "edge":"13", "ie":"10", "ios":"9", "safari":"7" } + es.reflect.define-property { "ie":"10", "ios":"9", "safari":"7" } + es.reflect.delete-property { "ie":"10", "ios":"9", "safari":"7" } + es.reflect.get { "ie":"10", "ios":"9", "safari":"7" } + es.reflect.get-own-property-descriptor { "ie":"10", "ios":"9", "safari":"7" } + es.reflect.get-prototype-of { "ie":"10", "ios":"9", "safari":"7" } + es.reflect.has { "ie":"10", "ios":"9", "safari":"7" } + es.reflect.is-extensible { "ie":"10", "ios":"9", "safari":"7" } + es.reflect.own-keys { "ie":"10", "ios":"9", "safari":"7" } + es.reflect.prevent-extensions { "ie":"10", "ios":"9", "safari":"7" } + es.reflect.set { "edge":"13", "ie":"10", "ios":"9", "safari":"7" } + es.reflect.set-prototype-of { "ie":"10", "ios":"9", "safari":"7" } + es.regexp.constructor { "edge":"13", "ie":"10", "ios":"9", "safari":"7" } + es.regexp.exec { "ie":"10", "ios":"9", "safari":"7" } + es.regexp.flags { "edge":"13", "ie":"10", "safari":"7" } + es.regexp.to-string { "edge":"13", "ie":"10", "ios":"9", "safari":"7" } + es.set { "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + es.string.code-point-at { "ie":"10", "safari":"7" } + es.string.ends-with { "edge":"13", "ie":"10", "ios":"9", "safari":"7" } + es.string.from-code-point { "ie":"10", "safari":"7" } + es.string.includes { "edge":"13", "ie":"10", "ios":"9", "safari":"7" } + es.string.iterator { "ie":"10", "safari":"7" } + es.string.match { "edge":"13", "ie":"10", "ios":"9", "safari":"7" } + es.string.pad-end { "chrome":"54", "edge":"13", "ie":"10", "ios":"9", "safari":"7" } + es.string.pad-start { "chrome":"54", "edge":"13", "ie":"10", "ios":"9", "safari":"7" } + es.string.raw { "ie":"10", "safari":"7" } + es.string.repeat { "ie":"10", "safari":"7" } + es.string.replace { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + es.string.search { "edge":"13", "ie":"10", "ios":"9", "safari":"7" } + es.string.split { "edge":"13", "ie":"10", "ios":"9", "safari":"7" } + es.string.starts-with { "edge":"13", "ie":"10", "ios":"9", "safari":"7" } + es.string.trim { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + es.string.trim-end { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + es.string.trim-start { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + es.string.anchor { "ie":"10" } + es.string.big { "ie":"10" } + es.string.blink { "ie":"10" } + es.string.bold { "ie":"10" } + es.string.fixed { "ie":"10" } + es.string.fontcolor { "ie":"10" } + es.string.fontsize { "ie":"10" } + es.string.italics { "ie":"10" } + es.string.link { "ie":"10" } + es.string.small { "ie":"10" } + es.string.strike { "ie":"10" } + es.string.sub { "ie":"10" } + es.string.sup { "ie":"10" } + es.typed-array.float32-array { "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + es.typed-array.float64-array { "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + es.typed-array.int8-array { "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + es.typed-array.int16-array { "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + es.typed-array.int32-array { "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + es.typed-array.uint8-array { "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + es.typed-array.uint8-clamped-array { "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + es.typed-array.uint16-array { "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + es.typed-array.uint32-array { "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + es.typed-array.copy-within { "ie":"10", "ios":"9", "safari":"7" } + es.typed-array.every { "ie":"10", "ios":"9", "safari":"7" } + es.typed-array.fill { "ie":"10", "ios":"9", "safari":"7" } + es.typed-array.filter { "ie":"10", "ios":"9", "safari":"7" } + es.typed-array.find { "ie":"10", "ios":"9", "safari":"7" } + es.typed-array.find-index { "ie":"10", "ios":"9", "safari":"7" } + es.typed-array.for-each { "ie":"10", "ios":"9", "safari":"7" } + es.typed-array.from { "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + es.typed-array.includes { "edge":"13", "ie":"10", "ios":"9", "safari":"7" } + es.typed-array.index-of { "ie":"10", "ios":"9", "safari":"7" } + es.typed-array.iterator { "ie":"10", "ios":"9", "safari":"7" } + es.typed-array.join { "ie":"10", "ios":"9", "safari":"7" } + es.typed-array.last-index-of { "ie":"10", "ios":"9", "safari":"7" } + es.typed-array.map { "ie":"10", "ios":"9", "safari":"7" } + es.typed-array.of { "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + es.typed-array.reduce { "ie":"10", "ios":"9", "safari":"7" } + es.typed-array.reduce-right { "ie":"10", "ios":"9", "safari":"7" } + es.typed-array.reverse { "ie":"10", "ios":"9", "safari":"7" } + es.typed-array.set { "ie":"10", "safari":"7" } + es.typed-array.slice { "ie":"10", "ios":"9", "safari":"7" } + es.typed-array.some { "ie":"10", "ios":"9", "safari":"7" } + es.typed-array.sort { "ie":"10", "ios":"9", "safari":"7" } + es.typed-array.subarray { "ie":"10", "safari":"7" } + es.typed-array.to-locale-string { "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + es.typed-array.to-string { "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + es.weak-map { "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + es.weak-set { "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + web.dom-collections.for-each { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + web.dom-collections.iterator { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + web.immediate { "chrome":"54", "edge":"13", "firefox":"49", "ios":"9", "safari":"7" } + web.queue-microtask { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + web.url { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + web.url.to-json { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } + web.url-search-params { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-stable-chrome-71/in/in.js b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-stable-chrome-71/input.mjs similarity index 100% rename from packages/babel-preset-env/test/debug-fixtures/entry-corejs3-stable-chrome-71/in/in.js rename to packages/babel-preset-env/test/fixtures/debug/entry-corejs3-stable-chrome-71/input.mjs diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-stable-chrome-71/options.json b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-stable-chrome-71/options.json new file mode 100644 index 000000000000..6e8f4a357b28 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-stable-chrome-71/options.json @@ -0,0 +1,18 @@ +{ + "validateLogs": true, + "ignoreOutput": true, + "presets": [ + [ + "env", + { + "debug": true, + "targets": { + "browsers": "chrome 71" + }, + "shippedProposals": true, + "useBuiltIns": "entry", + "corejs": 3 + } + ] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-stable-chrome-71/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-stable-chrome-71/stdout.txt new file mode 100644 index 000000000000..7a36f94d588d --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-stable-chrome-71/stdout.txt @@ -0,0 +1,29 @@ +@babel/preset-env: `DEBUG` option + +Using targets: +{ + "chrome": "71" +} + +Using modules transform: auto + +Using plugins: + syntax-async-generators { "chrome":"71" } + syntax-object-rest-spread { "chrome":"71" } + syntax-json-strings { "chrome":"71" } + syntax-optional-catch-binding { "chrome":"71" } + proposal-optional-chaining { "chrome":"71" } + proposal-nullish-coalescing-operator { "chrome":"71" } + transform-modules-commonjs { "chrome":"71" } + proposal-dynamic-import { "chrome":"71" } + +Using polyfills with `entry` option: + +[/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-stable-chrome-71/input.mjs] Replaced core-js entries with the following polyfills: + es.array.unscopables.flat { "chrome":"71" } + es.array.unscopables.flat-map { "chrome":"71" } + es.math.hypot { "chrome":"71" } + es.object.from-entries { "chrome":"71" } + web.immediate { "chrome":"71" } + +[/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-stable-chrome-71/input.mjs] Based on your targets, regenerator-runtime import excluded. diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-stable-samsung-8.2/in/in.js b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-stable-samsung-8.2/input.mjs similarity index 100% rename from packages/babel-preset-env/test/debug-fixtures/entry-corejs3-stable-samsung-8.2/in/in.js rename to packages/babel-preset-env/test/fixtures/debug/entry-corejs3-stable-samsung-8.2/input.mjs diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-stable-samsung-8.2/options.json b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-stable-samsung-8.2/options.json new file mode 100644 index 000000000000..016c09c862a2 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-stable-samsung-8.2/options.json @@ -0,0 +1,18 @@ +{ + "validateLogs": true, + "ignoreOutput": true, + "presets": [ + [ + "env", + { + "debug": true, + "targets": { + "browsers": "samsung 8.2" + }, + "shippedProposals": true, + "useBuiltIns": "entry", + "corejs": 3 + } + ] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-stable-samsung-8.2/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-stable-samsung-8.2/stdout.txt new file mode 100644 index 000000000000..33591eb05224 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-stable-samsung-8.2/stdout.txt @@ -0,0 +1,45 @@ +@babel/preset-env: `DEBUG` option + +Using targets: +{ + "samsung": "8.2" +} + +Using modules transform: auto + +Using plugins: + syntax-async-generators { "samsung":"8.2" } + syntax-object-rest-spread { "samsung":"8.2" } + proposal-unicode-property-regex { "samsung":"8.2" } + proposal-json-strings { "samsung":"8.2" } + proposal-optional-catch-binding { "samsung":"8.2" } + proposal-optional-chaining { "samsung":"8.2" } + transform-named-capturing-groups-regex { "samsung":"8.2" } + proposal-nullish-coalescing-operator { "samsung":"8.2" } + transform-modules-commonjs { "samsung":"8.2" } + proposal-dynamic-import { "samsung":"8.2" } + +Using polyfills with `entry` option: + +[/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-stable-samsung-8.2/input.mjs] Replaced core-js entries with the following polyfills: + es.symbol.description { "samsung":"8.2" } + es.array.flat { "samsung":"8.2" } + es.array.flat-map { "samsung":"8.2" } + es.array.iterator { "samsung":"8.2" } + es.array.unscopables.flat { "samsung":"8.2" } + es.array.unscopables.flat-map { "samsung":"8.2" } + es.math.hypot { "samsung":"8.2" } + es.object.from-entries { "samsung":"8.2" } + es.promise { "samsung":"8.2" } + es.promise.finally { "samsung":"8.2" } + es.string.replace { "samsung":"8.2" } + es.string.trim-end { "samsung":"8.2" } + es.string.trim-start { "samsung":"8.2" } + web.dom-collections.iterator { "samsung":"8.2" } + web.immediate { "samsung":"8.2" } + web.queue-microtask { "samsung":"8.2" } + web.url { "samsung":"8.2" } + web.url.to-json { "samsung":"8.2" } + web.url-search-params { "samsung":"8.2" } + +[/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-stable-samsung-8.2/input.mjs] Based on your targets, regenerator-runtime import excluded. diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-stable/in/in.js b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-stable/input.mjs similarity index 100% rename from packages/babel-preset-env/test/debug-fixtures/entry-corejs3-stable/in/in.js rename to packages/babel-preset-env/test/fixtures/debug/entry-corejs3-stable/input.mjs diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-stable/options.json b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-stable/options.json new file mode 100644 index 000000000000..edf42df8057e --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-stable/options.json @@ -0,0 +1,15 @@ +{ + "validateLogs": true, + "ignoreOutput": true, + "presets": [ + [ + "env", + { + "debug": true, + "shippedProposals": true, + "useBuiltIns": "entry", + "corejs": 3 + } + ] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-stable/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-stable/stdout.txt new file mode 100644 index 000000000000..4efa1c978e46 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-stable/stdout.txt @@ -0,0 +1,256 @@ +@babel/preset-env: `DEBUG` option + +Using targets: +{} + +Using modules transform: auto + +Using plugins: + transform-template-literals {} + transform-literals {} + transform-function-name {} + transform-arrow-functions {} + transform-block-scoped-functions {} + transform-classes {} + transform-object-super {} + transform-shorthand-properties {} + transform-duplicate-keys {} + transform-computed-properties {} + transform-for-of {} + transform-sticky-regex {} + transform-dotall-regex {} + transform-unicode-regex {} + transform-spread {} + transform-parameters {} + transform-destructuring {} + transform-block-scoping {} + transform-typeof-symbol {} + transform-new-target {} + transform-regenerator {} + transform-exponentiation-operator {} + transform-async-to-generator {} + proposal-async-generator-functions {} + proposal-object-rest-spread {} + proposal-unicode-property-regex {} + proposal-json-strings {} + proposal-optional-catch-binding {} + proposal-optional-chaining {} + transform-named-capturing-groups-regex {} + transform-member-expression-literals {} + transform-property-literals {} + transform-reserved-words {} + proposal-nullish-coalescing-operator {} + transform-modules-commonjs {} + proposal-dynamic-import {} + +Using polyfills with `entry` option: + +[/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-stable/input.mjs] Replaced core-js entries with the following polyfills: + es.symbol {} + es.symbol.description {} + es.symbol.async-iterator {} + es.symbol.has-instance {} + es.symbol.is-concat-spreadable {} + es.symbol.iterator {} + es.symbol.match {} + es.symbol.replace {} + es.symbol.search {} + es.symbol.species {} + es.symbol.split {} + es.symbol.to-primitive {} + es.symbol.to-string-tag {} + es.symbol.unscopables {} + es.array.concat {} + es.array.copy-within {} + es.array.every {} + es.array.fill {} + es.array.filter {} + es.array.find {} + es.array.find-index {} + es.array.flat {} + es.array.flat-map {} + es.array.for-each {} + es.array.from {} + es.array.includes {} + es.array.index-of {} + es.array.is-array {} + es.array.iterator {} + es.array.join {} + es.array.last-index-of {} + es.array.map {} + es.array.of {} + es.array.reduce {} + es.array.reduce-right {} + es.array.reverse {} + es.array.slice {} + es.array.some {} + es.array.sort {} + es.array.species {} + es.array.splice {} + es.array.unscopables.flat {} + es.array.unscopables.flat-map {} + es.array-buffer.constructor {} + es.array-buffer.is-view {} + es.array-buffer.slice {} + es.data-view {} + es.date.now {} + es.date.to-iso-string {} + es.date.to-json {} + es.date.to-primitive {} + es.date.to-string {} + es.function.bind {} + es.function.has-instance {} + es.function.name {} + es.json.to-string-tag {} + es.map {} + es.math.acosh {} + es.math.asinh {} + es.math.atanh {} + es.math.cbrt {} + es.math.clz32 {} + es.math.cosh {} + es.math.expm1 {} + es.math.fround {} + es.math.hypot {} + es.math.imul {} + es.math.log10 {} + es.math.log1p {} + es.math.log2 {} + es.math.sign {} + es.math.sinh {} + es.math.tanh {} + es.math.to-string-tag {} + es.math.trunc {} + es.number.constructor {} + es.number.epsilon {} + es.number.is-finite {} + es.number.is-integer {} + es.number.is-nan {} + es.number.is-safe-integer {} + es.number.max-safe-integer {} + es.number.min-safe-integer {} + es.number.parse-float {} + es.number.parse-int {} + es.number.to-fixed {} + es.number.to-precision {} + es.object.assign {} + es.object.create {} + es.object.define-getter {} + es.object.define-properties {} + es.object.define-property {} + es.object.define-setter {} + es.object.entries {} + es.object.freeze {} + es.object.from-entries {} + es.object.get-own-property-descriptor {} + es.object.get-own-property-descriptors {} + es.object.get-own-property-names {} + es.object.get-prototype-of {} + es.object.is {} + es.object.is-extensible {} + es.object.is-frozen {} + es.object.is-sealed {} + es.object.keys {} + es.object.lookup-getter {} + es.object.lookup-setter {} + es.object.prevent-extensions {} + es.object.seal {} + es.object.set-prototype-of {} + es.object.to-string {} + es.object.values {} + es.parse-float {} + es.parse-int {} + es.promise {} + es.promise.finally {} + es.reflect.apply {} + es.reflect.construct {} + es.reflect.define-property {} + es.reflect.delete-property {} + es.reflect.get {} + es.reflect.get-own-property-descriptor {} + es.reflect.get-prototype-of {} + es.reflect.has {} + es.reflect.is-extensible {} + es.reflect.own-keys {} + es.reflect.prevent-extensions {} + es.reflect.set {} + es.reflect.set-prototype-of {} + es.regexp.constructor {} + es.regexp.exec {} + es.regexp.flags {} + es.regexp.to-string {} + es.set {} + es.string.code-point-at {} + es.string.ends-with {} + es.string.from-code-point {} + es.string.includes {} + es.string.iterator {} + es.string.match {} + es.string.pad-end {} + es.string.pad-start {} + es.string.raw {} + es.string.repeat {} + es.string.replace {} + es.string.search {} + es.string.split {} + es.string.starts-with {} + es.string.trim {} + es.string.trim-end {} + es.string.trim-start {} + es.string.anchor {} + es.string.big {} + es.string.blink {} + es.string.bold {} + es.string.fixed {} + es.string.fontcolor {} + es.string.fontsize {} + es.string.italics {} + es.string.link {} + es.string.small {} + es.string.strike {} + es.string.sub {} + es.string.sup {} + es.typed-array.float32-array {} + es.typed-array.float64-array {} + es.typed-array.int8-array {} + es.typed-array.int16-array {} + es.typed-array.int32-array {} + es.typed-array.uint8-array {} + es.typed-array.uint8-clamped-array {} + es.typed-array.uint16-array {} + es.typed-array.uint32-array {} + es.typed-array.copy-within {} + es.typed-array.every {} + es.typed-array.fill {} + es.typed-array.filter {} + es.typed-array.find {} + es.typed-array.find-index {} + es.typed-array.for-each {} + es.typed-array.from {} + es.typed-array.includes {} + es.typed-array.index-of {} + es.typed-array.iterator {} + es.typed-array.join {} + es.typed-array.last-index-of {} + es.typed-array.map {} + es.typed-array.of {} + es.typed-array.reduce {} + es.typed-array.reduce-right {} + es.typed-array.reverse {} + es.typed-array.set {} + es.typed-array.slice {} + es.typed-array.some {} + es.typed-array.sort {} + es.typed-array.subarray {} + es.typed-array.to-locale-string {} + es.typed-array.to-string {} + es.weak-map {} + es.weak-set {} + web.dom-collections.for-each {} + web.dom-collections.iterator {} + web.immediate {} + web.queue-microtask {} + web.timers {} + web.url {} + web.url.to-json {} + web.url-search-params {} diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-stage-chrome-71/in/in.js b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-stage-chrome-71/input.mjs similarity index 100% rename from packages/babel-preset-env/test/debug-fixtures/entry-corejs3-stage-chrome-71/in/in.js rename to packages/babel-preset-env/test/fixtures/debug/entry-corejs3-stage-chrome-71/input.mjs diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-stage-chrome-71/options.json b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-stage-chrome-71/options.json new file mode 100644 index 000000000000..6e8f4a357b28 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-stage-chrome-71/options.json @@ -0,0 +1,18 @@ +{ + "validateLogs": true, + "ignoreOutput": true, + "presets": [ + [ + "env", + { + "debug": true, + "targets": { + "browsers": "chrome 71" + }, + "shippedProposals": true, + "useBuiltIns": "entry", + "corejs": 3 + } + ] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-stage-chrome-71/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-stage-chrome-71/stdout.txt new file mode 100644 index 000000000000..071a02b7b2b6 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-stage-chrome-71/stdout.txt @@ -0,0 +1,105 @@ +@babel/preset-env: `DEBUG` option + +Using targets: +{ + "chrome": "71" +} + +Using modules transform: auto + +Using plugins: + syntax-async-generators { "chrome":"71" } + syntax-object-rest-spread { "chrome":"71" } + syntax-json-strings { "chrome":"71" } + syntax-optional-catch-binding { "chrome":"71" } + proposal-optional-chaining { "chrome":"71" } + proposal-nullish-coalescing-operator { "chrome":"71" } + transform-modules-commonjs { "chrome":"71" } + proposal-dynamic-import { "chrome":"71" } + +Using polyfills with `entry` option: + +[/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-stage-chrome-71/input.mjs] Replaced core-js entries with the following polyfills: + esnext.aggregate-error { "chrome":"71" } + esnext.array.last-index { "chrome":"71" } + esnext.array.last-item { "chrome":"71" } + esnext.composite-key { "chrome":"71" } + esnext.composite-symbol { "chrome":"71" } + esnext.map.delete-all { "chrome":"71" } + esnext.map.every { "chrome":"71" } + esnext.map.filter { "chrome":"71" } + esnext.map.find { "chrome":"71" } + esnext.map.find-key { "chrome":"71" } + esnext.map.from { "chrome":"71" } + esnext.map.group-by { "chrome":"71" } + esnext.map.includes { "chrome":"71" } + esnext.map.key-by { "chrome":"71" } + esnext.map.key-of { "chrome":"71" } + esnext.map.map-keys { "chrome":"71" } + esnext.map.map-values { "chrome":"71" } + esnext.map.merge { "chrome":"71" } + esnext.map.of { "chrome":"71" } + esnext.map.reduce { "chrome":"71" } + esnext.map.some { "chrome":"71" } + esnext.map.update { "chrome":"71" } + esnext.math.clamp { "chrome":"71" } + esnext.math.deg-per-rad { "chrome":"71" } + esnext.math.degrees { "chrome":"71" } + esnext.math.fscale { "chrome":"71" } + esnext.math.iaddh { "chrome":"71" } + esnext.math.imulh { "chrome":"71" } + esnext.math.isubh { "chrome":"71" } + esnext.math.rad-per-deg { "chrome":"71" } + esnext.math.radians { "chrome":"71" } + esnext.math.scale { "chrome":"71" } + esnext.math.seeded-prng { "chrome":"71" } + esnext.math.signbit { "chrome":"71" } + esnext.math.umulh { "chrome":"71" } + esnext.number.from-string { "chrome":"71" } + esnext.observable { "chrome":"71" } + esnext.promise.all-settled { "chrome":"71" } + esnext.promise.any { "chrome":"71" } + esnext.promise.try { "chrome":"71" } + esnext.reflect.define-metadata { "chrome":"71" } + esnext.reflect.delete-metadata { "chrome":"71" } + esnext.reflect.get-metadata { "chrome":"71" } + esnext.reflect.get-metadata-keys { "chrome":"71" } + esnext.reflect.get-own-metadata { "chrome":"71" } + esnext.reflect.get-own-metadata-keys { "chrome":"71" } + esnext.reflect.has-metadata { "chrome":"71" } + esnext.reflect.has-own-metadata { "chrome":"71" } + esnext.reflect.metadata { "chrome":"71" } + esnext.set.add-all { "chrome":"71" } + esnext.set.delete-all { "chrome":"71" } + esnext.set.difference { "chrome":"71" } + esnext.set.every { "chrome":"71" } + esnext.set.filter { "chrome":"71" } + esnext.set.find { "chrome":"71" } + esnext.set.from { "chrome":"71" } + esnext.set.intersection { "chrome":"71" } + esnext.set.is-disjoint-from { "chrome":"71" } + esnext.set.is-subset-of { "chrome":"71" } + esnext.set.is-superset-of { "chrome":"71" } + esnext.set.join { "chrome":"71" } + esnext.set.map { "chrome":"71" } + esnext.set.of { "chrome":"71" } + esnext.set.reduce { "chrome":"71" } + esnext.set.some { "chrome":"71" } + esnext.set.symmetric-difference { "chrome":"71" } + esnext.set.union { "chrome":"71" } + esnext.string.at { "chrome":"71" } + esnext.string.code-points { "chrome":"71" } + esnext.string.match-all { "chrome":"71" } + esnext.string.replace-all { "chrome":"71" } + esnext.symbol.dispose { "chrome":"71" } + esnext.symbol.observable { "chrome":"71" } + esnext.symbol.pattern-match { "chrome":"71" } + esnext.weak-map.delete-all { "chrome":"71" } + esnext.weak-map.from { "chrome":"71" } + esnext.weak-map.of { "chrome":"71" } + esnext.weak-set.add-all { "chrome":"71" } + esnext.weak-set.delete-all { "chrome":"71" } + esnext.weak-set.from { "chrome":"71" } + esnext.weak-set.of { "chrome":"71" } + +[/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-stage-chrome-71/input.mjs] Based on your targets, regenerator-runtime import excluded. diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-stage/in/in.js b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-stage/input.mjs similarity index 100% rename from packages/babel-preset-env/test/debug-fixtures/entry-corejs3-stage/in/in.js rename to packages/babel-preset-env/test/fixtures/debug/entry-corejs3-stage/input.mjs diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-stage/options.json b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-stage/options.json new file mode 100644 index 000000000000..edf42df8057e --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-stage/options.json @@ -0,0 +1,15 @@ +{ + "validateLogs": true, + "ignoreOutput": true, + "presets": [ + [ + "env", + { + "debug": true, + "shippedProposals": true, + "useBuiltIns": "entry", + "corejs": 3 + } + ] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-stage/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-stage/stdout.txt new file mode 100644 index 000000000000..07104b5a7818 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-stage/stdout.txt @@ -0,0 +1,133 @@ +@babel/preset-env: `DEBUG` option + +Using targets: +{} + +Using modules transform: auto + +Using plugins: + transform-template-literals {} + transform-literals {} + transform-function-name {} + transform-arrow-functions {} + transform-block-scoped-functions {} + transform-classes {} + transform-object-super {} + transform-shorthand-properties {} + transform-duplicate-keys {} + transform-computed-properties {} + transform-for-of {} + transform-sticky-regex {} + transform-dotall-regex {} + transform-unicode-regex {} + transform-spread {} + transform-parameters {} + transform-destructuring {} + transform-block-scoping {} + transform-typeof-symbol {} + transform-new-target {} + transform-regenerator {} + transform-exponentiation-operator {} + transform-async-to-generator {} + proposal-async-generator-functions {} + proposal-object-rest-spread {} + proposal-unicode-property-regex {} + proposal-json-strings {} + proposal-optional-catch-binding {} + proposal-optional-chaining {} + transform-named-capturing-groups-regex {} + transform-member-expression-literals {} + transform-property-literals {} + transform-reserved-words {} + proposal-nullish-coalescing-operator {} + transform-modules-commonjs {} + proposal-dynamic-import {} + +Using polyfills with `entry` option: + +[/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-stage/input.mjs] Replaced core-js entries with the following polyfills: + esnext.aggregate-error {} + esnext.array.last-index {} + esnext.array.last-item {} + esnext.composite-key {} + esnext.composite-symbol {} + esnext.global-this {} + esnext.map.delete-all {} + esnext.map.every {} + esnext.map.filter {} + esnext.map.find {} + esnext.map.find-key {} + esnext.map.from {} + esnext.map.group-by {} + esnext.map.includes {} + esnext.map.key-by {} + esnext.map.key-of {} + esnext.map.map-keys {} + esnext.map.map-values {} + esnext.map.merge {} + esnext.map.of {} + esnext.map.reduce {} + esnext.map.some {} + esnext.map.update {} + esnext.math.clamp {} + esnext.math.deg-per-rad {} + esnext.math.degrees {} + esnext.math.fscale {} + esnext.math.iaddh {} + esnext.math.imulh {} + esnext.math.isubh {} + esnext.math.rad-per-deg {} + esnext.math.radians {} + esnext.math.scale {} + esnext.math.seeded-prng {} + esnext.math.signbit {} + esnext.math.umulh {} + esnext.number.from-string {} + esnext.observable {} + esnext.promise.all-settled {} + esnext.promise.any {} + esnext.promise.try {} + esnext.reflect.define-metadata {} + esnext.reflect.delete-metadata {} + esnext.reflect.get-metadata {} + esnext.reflect.get-metadata-keys {} + esnext.reflect.get-own-metadata {} + esnext.reflect.get-own-metadata-keys {} + esnext.reflect.has-metadata {} + esnext.reflect.has-own-metadata {} + esnext.reflect.metadata {} + esnext.set.add-all {} + esnext.set.delete-all {} + esnext.set.difference {} + esnext.set.every {} + esnext.set.filter {} + esnext.set.find {} + esnext.set.from {} + esnext.set.intersection {} + esnext.set.is-disjoint-from {} + esnext.set.is-subset-of {} + esnext.set.is-superset-of {} + esnext.set.join {} + esnext.set.map {} + esnext.set.of {} + esnext.set.reduce {} + esnext.set.some {} + esnext.set.symmetric-difference {} + esnext.set.union {} + esnext.string.at {} + esnext.string.code-points {} + esnext.string.match-all {} + esnext.string.replace-all {} + esnext.symbol.dispose {} + esnext.symbol.observable {} + esnext.symbol.pattern-match {} + esnext.weak-map.delete-all {} + esnext.weak-map.from {} + esnext.weak-map.of {} + esnext.weak-set.add-all {} + esnext.weak-set.delete-all {} + esnext.weak-set.from {} + esnext.weak-set.of {} + web.url {} + web.url.to-json {} + web.url-search-params {} diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-versions-decimals/in/in.js b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-versions-decimals/input.mjs similarity index 100% rename from packages/babel-preset-env/test/debug-fixtures/entry-corejs3-versions-decimals/in/in.js rename to packages/babel-preset-env/test/fixtures/debug/entry-corejs3-versions-decimals/input.mjs diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-versions-decimals/options.json b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-versions-decimals/options.json new file mode 100644 index 000000000000..7b937537dd8c --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-versions-decimals/options.json @@ -0,0 +1,20 @@ +{ + "validateLogs": true, + "ignoreOutput": true, + "presets": [ + [ + "env", + { + "useBuiltIns": "entry", + "corejs": 3, + "debug": true, + "targets": { + "chrome": 54, + "electron": 0.36, + "node": 6.1, + "ie": 10 + } + } + ] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-versions-decimals/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-versions-decimals/stdout.txt new file mode 100644 index 000000000000..f038b106a7dd --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-versions-decimals/stdout.txt @@ -0,0 +1,253 @@ +Warning, the following targets are using a decimal version: + + electron: 0.36 + node: 6.1 + +We recommend using a string for minor/patch versions to avoid numbers like 6.10 +getting parsed as 6.1, which can lead to unexpected behavior. + +@babel/preset-env: `DEBUG` option + +Using targets: +{ + "chrome": "54", + "electron": "0.36", + "ie": "10", + "node": "6.1" +} + +Using modules transform: auto + +Using plugins: + transform-template-literals { "ie":"10" } + transform-literals { "ie":"10" } + transform-function-name { "electron":"0.36", "ie":"10", "node":"6.1" } + transform-arrow-functions { "ie":"10" } + transform-block-scoped-functions { "ie":"10" } + transform-classes { "ie":"10" } + transform-object-super { "ie":"10" } + transform-shorthand-properties { "ie":"10" } + transform-duplicate-keys { "ie":"10" } + transform-computed-properties { "ie":"10" } + transform-for-of { "electron":"0.36", "ie":"10", "node":"6.1" } + transform-sticky-regex { "electron":"0.36", "ie":"10" } + transform-dotall-regex { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } + transform-unicode-regex { "electron":"0.36", "ie":"10" } + transform-spread { "ie":"10" } + transform-parameters { "electron":"0.36", "ie":"10" } + transform-destructuring { "electron":"0.36", "ie":"10", "node":"6.1" } + transform-block-scoping { "electron":"0.36", "ie":"10" } + transform-typeof-symbol { "ie":"10" } + transform-new-target { "ie":"10" } + transform-regenerator { "electron":"0.36", "ie":"10" } + transform-exponentiation-operator { "electron":"0.36", "ie":"10", "node":"6.1" } + transform-async-to-generator { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } + proposal-async-generator-functions { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } + proposal-object-rest-spread { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } + proposal-unicode-property-regex { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } + proposal-json-strings { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } + proposal-optional-catch-binding { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } + proposal-optional-chaining { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } + transform-named-capturing-groups-regex { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } + transform-member-expression-literals { "electron":"0.36" } + transform-property-literals { "electron":"0.36" } + proposal-nullish-coalescing-operator { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } + transform-modules-commonjs { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } + proposal-dynamic-import { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } + +Using polyfills with `entry` option: + +[/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-versions-decimals/input.mjs] Replaced core-js entries with the following polyfills: + es.symbol { "electron":"0.36", "ie":"10" } + es.symbol.description { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } + es.symbol.async-iterator { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } + es.symbol.has-instance { "electron":"0.36", "ie":"10" } + es.symbol.is-concat-spreadable { "electron":"0.36", "ie":"10" } + es.symbol.iterator { "ie":"10" } + es.symbol.match { "electron":"0.36", "ie":"10" } + es.symbol.replace { "electron":"0.36", "ie":"10" } + es.symbol.search { "electron":"0.36", "ie":"10" } + es.symbol.species { "electron":"0.36", "ie":"10", "node":"6.1" } + es.symbol.split { "electron":"0.36", "ie":"10" } + es.symbol.to-primitive { "ie":"10" } + es.symbol.to-string-tag { "electron":"0.36", "ie":"10" } + es.symbol.unscopables { "ie":"10" } + es.array.concat { "electron":"0.36", "ie":"10", "node":"6.1" } + es.array.copy-within { "ie":"10" } + es.array.every { "electron":"0.36", "ie":"10" } + es.array.fill { "ie":"10" } + es.array.filter { "electron":"0.36", "ie":"10", "node":"6.1" } + es.array.find { "ie":"10" } + es.array.find-index { "ie":"10" } + es.array.flat { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } + es.array.flat-map { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } + es.array.for-each { "electron":"0.36", "ie":"10" } + es.array.from { "electron":"0.36", "ie":"10", "node":"6.1" } + es.array.includes { "electron":"0.36", "ie":"10", "node":"6.1" } + es.array.index-of { "electron":"0.36", "ie":"10", "node":"6.1" } + es.array.iterator { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } + es.array.join { "ie":"10" } + es.array.last-index-of { "electron":"0.36", "ie":"10", "node":"6.1" } + es.array.map { "electron":"0.36", "ie":"10", "node":"6.1" } + es.array.of { "ie":"10" } + es.array.reduce { "electron":"0.36", "ie":"10" } + es.array.reduce-right { "electron":"0.36", "ie":"10" } + es.array.slice { "electron":"0.36", "ie":"10", "node":"6.1" } + es.array.some { "electron":"0.36", "ie":"10" } + es.array.sort { "chrome":"54", "electron":"0.36", "node":"6.1" } + es.array.species { "electron":"0.36", "ie":"10", "node":"6.1" } + es.array.splice { "electron":"0.36", "ie":"10", "node":"6.1" } + es.array.unscopables.flat { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } + es.array.unscopables.flat-map { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } + es.array-buffer.constructor { "ie":"10" } + es.array-buffer.is-view { "ie":"10" } + es.array-buffer.slice { "ie":"10" } + es.date.to-primitive { "ie":"10" } + es.function.has-instance { "electron":"0.36", "ie":"10", "node":"6.1" } + es.function.name { "ie":"10" } + es.json.to-string-tag { "electron":"0.36", "ie":"10" } + es.map { "electron":"0.36", "ie":"10", "node":"6.1" } + es.math.acosh { "electron":"0.36", "ie":"10", "node":"6.1" } + es.math.asinh { "ie":"10" } + es.math.atanh { "ie":"10" } + es.math.cbrt { "ie":"10" } + es.math.clz32 { "ie":"10" } + es.math.cosh { "ie":"10" } + es.math.expm1 { "ie":"10" } + es.math.fround { "ie":"10" } + es.math.hypot { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } + es.math.imul { "ie":"10" } + es.math.log10 { "ie":"10" } + es.math.log1p { "ie":"10" } + es.math.log2 { "ie":"10" } + es.math.sign { "ie":"10" } + es.math.sinh { "ie":"10" } + es.math.tanh { "ie":"10" } + es.math.to-string-tag { "electron":"0.36", "ie":"10" } + es.math.trunc { "ie":"10" } + es.number.constructor { "ie":"10" } + es.number.epsilon { "ie":"10" } + es.number.is-finite { "ie":"10" } + es.number.is-integer { "ie":"10" } + es.number.is-nan { "ie":"10" } + es.number.is-safe-integer { "ie":"10" } + es.number.max-safe-integer { "ie":"10" } + es.number.min-safe-integer { "ie":"10" } + es.number.parse-float { "ie":"10" } + es.number.parse-int { "ie":"10" } + es.number.to-fixed { "ie":"10" } + es.object.assign { "electron":"0.36", "ie":"10" } + es.object.define-getter { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } + es.object.define-setter { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } + es.object.entries { "electron":"0.36", "ie":"10", "node":"6.1" } + es.object.freeze { "ie":"10" } + es.object.from-entries { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } + es.object.get-own-property-descriptor { "ie":"10" } + es.object.get-own-property-descriptors { "electron":"0.36", "ie":"10", "node":"6.1" } + es.object.get-own-property-names { "ie":"10" } + es.object.get-prototype-of { "ie":"10" } + es.object.is { "ie":"10" } + es.object.is-extensible { "ie":"10" } + es.object.is-frozen { "ie":"10" } + es.object.is-sealed { "ie":"10" } + es.object.keys { "ie":"10" } + es.object.lookup-getter { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } + es.object.lookup-setter { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } + es.object.prevent-extensions { "ie":"10" } + es.object.seal { "ie":"10" } + es.object.set-prototype-of { "ie":"10" } + es.object.to-string { "electron":"0.36", "ie":"10" } + es.object.values { "electron":"0.36", "ie":"10", "node":"6.1" } + es.promise { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } + es.promise.finally { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } + es.reflect.apply { "electron":"0.36", "ie":"10" } + es.reflect.construct { "electron":"0.36", "ie":"10" } + es.reflect.define-property { "electron":"0.36", "ie":"10" } + es.reflect.delete-property { "electron":"0.36", "ie":"10" } + es.reflect.get { "electron":"0.36", "ie":"10" } + es.reflect.get-own-property-descriptor { "electron":"0.36", "ie":"10" } + es.reflect.get-prototype-of { "electron":"0.36", "ie":"10" } + es.reflect.has { "electron":"0.36", "ie":"10" } + es.reflect.is-extensible { "electron":"0.36", "ie":"10" } + es.reflect.own-keys { "electron":"0.36", "ie":"10" } + es.reflect.prevent-extensions { "electron":"0.36", "ie":"10" } + es.reflect.set { "electron":"0.36", "ie":"10" } + es.reflect.set-prototype-of { "electron":"0.36", "ie":"10" } + es.regexp.constructor { "electron":"0.36", "ie":"10", "node":"6.1" } + es.regexp.exec { "ie":"10" } + es.regexp.flags { "electron":"0.36", "ie":"10" } + es.regexp.to-string { "electron":"0.36", "ie":"10" } + es.set { "electron":"0.36", "ie":"10", "node":"6.1" } + es.string.code-point-at { "ie":"10" } + es.string.ends-with { "electron":"0.36", "ie":"10", "node":"6.1" } + es.string.from-code-point { "ie":"10" } + es.string.includes { "electron":"0.36", "ie":"10", "node":"6.1" } + es.string.iterator { "ie":"10" } + es.string.match { "electron":"0.36", "ie":"10", "node":"6.1" } + es.string.pad-end { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } + es.string.pad-start { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } + es.string.raw { "ie":"10" } + es.string.repeat { "ie":"10" } + es.string.replace { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } + es.string.search { "electron":"0.36", "ie":"10", "node":"6.1" } + es.string.split { "electron":"0.36", "ie":"10", "node":"6.1" } + es.string.starts-with { "electron":"0.36", "ie":"10", "node":"6.1" } + es.string.trim { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } + es.string.trim-end { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } + es.string.trim-start { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } + es.string.anchor { "ie":"10" } + es.string.big { "ie":"10" } + es.string.blink { "ie":"10" } + es.string.bold { "ie":"10" } + es.string.fixed { "ie":"10" } + es.string.fontcolor { "ie":"10" } + es.string.fontsize { "ie":"10" } + es.string.italics { "ie":"10" } + es.string.link { "ie":"10" } + es.string.small { "ie":"10" } + es.string.strike { "ie":"10" } + es.string.sub { "ie":"10" } + es.string.sup { "ie":"10" } + es.typed-array.float32-array { "electron":"0.36", "ie":"10", "node":"6.1" } + es.typed-array.float64-array { "electron":"0.36", "ie":"10", "node":"6.1" } + es.typed-array.int8-array { "electron":"0.36", "ie":"10", "node":"6.1" } + es.typed-array.int16-array { "electron":"0.36", "ie":"10", "node":"6.1" } + es.typed-array.int32-array { "electron":"0.36", "ie":"10", "node":"6.1" } + es.typed-array.uint8-array { "electron":"0.36", "ie":"10", "node":"6.1" } + es.typed-array.uint8-clamped-array { "electron":"0.36", "ie":"10", "node":"6.1" } + es.typed-array.uint16-array { "electron":"0.36", "ie":"10", "node":"6.1" } + es.typed-array.uint32-array { "electron":"0.36", "ie":"10", "node":"6.1" } + es.typed-array.copy-within { "ie":"10" } + es.typed-array.every { "ie":"10" } + es.typed-array.fill { "ie":"10" } + es.typed-array.filter { "ie":"10" } + es.typed-array.find { "ie":"10" } + es.typed-array.find-index { "ie":"10" } + es.typed-array.for-each { "ie":"10" } + es.typed-array.from { "electron":"0.36", "ie":"10", "node":"6.1" } + es.typed-array.includes { "electron":"0.36", "ie":"10" } + es.typed-array.index-of { "ie":"10" } + es.typed-array.iterator { "ie":"10" } + es.typed-array.join { "ie":"10" } + es.typed-array.last-index-of { "ie":"10" } + es.typed-array.map { "ie":"10" } + es.typed-array.of { "electron":"0.36", "ie":"10", "node":"6.1" } + es.typed-array.reduce { "ie":"10" } + es.typed-array.reduce-right { "ie":"10" } + es.typed-array.reverse { "ie":"10" } + es.typed-array.set { "ie":"10" } + es.typed-array.slice { "ie":"10" } + es.typed-array.some { "ie":"10" } + es.typed-array.sort { "ie":"10" } + es.typed-array.subarray { "ie":"10" } + es.typed-array.to-locale-string { "ie":"10" } + es.typed-array.to-string { "electron":"0.36", "ie":"10", "node":"6.1" } + es.weak-map { "electron":"0.36", "ie":"10", "node":"6.1" } + es.weak-set { "electron":"0.36", "ie":"10", "node":"6.1" } + web.dom-collections.for-each { "chrome":"54", "electron":"0.36", "ie":"10" } + web.dom-collections.iterator { "chrome":"54", "electron":"0.36", "ie":"10" } + web.immediate { "chrome":"54", "electron":"0.36" } + web.queue-microtask { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } + web.url { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } + web.url.to-json { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } + web.url-search-params { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-versions-strings-minor-3.0/in/in.js b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-versions-strings-minor-3.0/input.mjs similarity index 100% rename from packages/babel-preset-env/test/debug-fixtures/entry-corejs3-versions-strings-minor-3.0/in/in.js rename to packages/babel-preset-env/test/fixtures/debug/entry-corejs3-versions-strings-minor-3.0/input.mjs diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-versions-strings-minor-3.0/options.json b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-versions-strings-minor-3.0/options.json new file mode 100644 index 000000000000..e3f89d06a7a3 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-versions-strings-minor-3.0/options.json @@ -0,0 +1,19 @@ +{ + "validateLogs": true, + "ignoreOutput": true, + "presets": [ + [ + "env", + { + "useBuiltIns": "entry", + "corejs": "3.0", + "debug": true, + "targets": { + "chrome": "54", + "node": "6.10", + "ie": "10" + } + } + ] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-versions-strings-minor-3.0/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-versions-strings-minor-3.0/stdout.txt new file mode 100644 index 000000000000..9a906cc80f6f --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-versions-strings-minor-3.0/stdout.txt @@ -0,0 +1,242 @@ +@babel/preset-env: `DEBUG` option + +Using targets: +{ + "chrome": "54", + "ie": "10", + "node": "6.10" +} + +Using modules transform: auto + +Using plugins: + transform-template-literals { "ie":"10" } + transform-literals { "ie":"10" } + transform-function-name { "ie":"10" } + transform-arrow-functions { "ie":"10" } + transform-block-scoped-functions { "ie":"10" } + transform-classes { "ie":"10" } + transform-object-super { "ie":"10" } + transform-shorthand-properties { "ie":"10" } + transform-duplicate-keys { "ie":"10" } + transform-computed-properties { "ie":"10" } + transform-for-of { "ie":"10" } + transform-sticky-regex { "ie":"10" } + transform-dotall-regex { "chrome":"54", "ie":"10", "node":"6.10" } + transform-unicode-regex { "ie":"10" } + transform-spread { "ie":"10" } + transform-parameters { "ie":"10" } + transform-destructuring { "ie":"10" } + transform-block-scoping { "ie":"10" } + transform-typeof-symbol { "ie":"10" } + transform-new-target { "ie":"10" } + transform-regenerator { "ie":"10" } + transform-exponentiation-operator { "ie":"10", "node":"6.10" } + transform-async-to-generator { "chrome":"54", "ie":"10", "node":"6.10" } + proposal-async-generator-functions { "chrome":"54", "ie":"10", "node":"6.10" } + proposal-object-rest-spread { "chrome":"54", "ie":"10", "node":"6.10" } + proposal-unicode-property-regex { "chrome":"54", "ie":"10", "node":"6.10" } + proposal-json-strings { "chrome":"54", "ie":"10", "node":"6.10" } + proposal-optional-catch-binding { "chrome":"54", "ie":"10", "node":"6.10" } + proposal-optional-chaining { "chrome":"54", "ie":"10", "node":"6.10" } + transform-named-capturing-groups-regex { "chrome":"54", "ie":"10", "node":"6.10" } + proposal-nullish-coalescing-operator { "chrome":"54", "ie":"10", "node":"6.10" } + transform-modules-commonjs { "chrome":"54", "ie":"10", "node":"6.10" } + proposal-dynamic-import { "chrome":"54", "ie":"10", "node":"6.10" } + +Using polyfills with `entry` option: + +[/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-versions-strings-minor-3.0/input.mjs] Replaced core-js entries with the following polyfills: + es.symbol { "ie":"10" } + es.symbol.description { "chrome":"54", "ie":"10", "node":"6.10" } + es.symbol.async-iterator { "chrome":"54", "ie":"10", "node":"6.10" } + es.symbol.has-instance { "ie":"10" } + es.symbol.is-concat-spreadable { "ie":"10" } + es.symbol.iterator { "ie":"10" } + es.symbol.match { "ie":"10" } + es.symbol.replace { "ie":"10" } + es.symbol.search { "ie":"10" } + es.symbol.species { "ie":"10" } + es.symbol.split { "ie":"10" } + es.symbol.to-primitive { "ie":"10" } + es.symbol.to-string-tag { "ie":"10" } + es.symbol.unscopables { "ie":"10" } + es.array.concat { "ie":"10" } + es.array.copy-within { "ie":"10" } + es.array.every { "ie":"10" } + es.array.fill { "ie":"10" } + es.array.filter { "ie":"10" } + es.array.find { "ie":"10" } + es.array.find-index { "ie":"10" } + es.array.flat { "chrome":"54", "ie":"10", "node":"6.10" } + es.array.flat-map { "chrome":"54", "ie":"10", "node":"6.10" } + es.array.for-each { "ie":"10" } + es.array.from { "ie":"10" } + es.array.includes { "ie":"10", "node":"6.10" } + es.array.index-of { "ie":"10" } + es.array.iterator { "chrome":"54", "ie":"10", "node":"6.10" } + es.array.join { "ie":"10" } + es.array.last-index-of { "ie":"10" } + es.array.map { "ie":"10" } + es.array.of { "ie":"10" } + es.array.reduce { "ie":"10" } + es.array.reduce-right { "ie":"10" } + es.array.slice { "ie":"10" } + es.array.some { "ie":"10" } + es.array.sort { "chrome":"54", "node":"6.10" } + es.array.species { "ie":"10" } + es.array.splice { "ie":"10" } + es.array.unscopables.flat { "chrome":"54", "ie":"10", "node":"6.10" } + es.array.unscopables.flat-map { "chrome":"54", "ie":"10", "node":"6.10" } + es.array-buffer.constructor { "ie":"10" } + es.array-buffer.is-view { "ie":"10" } + es.array-buffer.slice { "ie":"10" } + es.date.to-primitive { "ie":"10" } + es.function.has-instance { "ie":"10" } + es.function.name { "ie":"10" } + es.json.to-string-tag { "ie":"10" } + es.map { "ie":"10" } + es.math.acosh { "ie":"10", "node":"6.10" } + es.math.asinh { "ie":"10" } + es.math.atanh { "ie":"10" } + es.math.cbrt { "ie":"10" } + es.math.clz32 { "ie":"10" } + es.math.cosh { "ie":"10" } + es.math.expm1 { "ie":"10" } + es.math.fround { "ie":"10" } + es.math.hypot { "chrome":"54", "ie":"10", "node":"6.10" } + es.math.imul { "ie":"10" } + es.math.log10 { "ie":"10" } + es.math.log1p { "ie":"10" } + es.math.log2 { "ie":"10" } + es.math.sign { "ie":"10" } + es.math.sinh { "ie":"10" } + es.math.tanh { "ie":"10" } + es.math.to-string-tag { "ie":"10" } + es.math.trunc { "ie":"10" } + es.number.constructor { "ie":"10" } + es.number.epsilon { "ie":"10" } + es.number.is-finite { "ie":"10" } + es.number.is-integer { "ie":"10" } + es.number.is-nan { "ie":"10" } + es.number.is-safe-integer { "ie":"10" } + es.number.max-safe-integer { "ie":"10" } + es.number.min-safe-integer { "ie":"10" } + es.number.parse-float { "ie":"10" } + es.number.parse-int { "ie":"10" } + es.number.to-fixed { "ie":"10" } + es.object.assign { "ie":"10" } + es.object.define-getter { "chrome":"54", "ie":"10", "node":"6.10" } + es.object.define-setter { "chrome":"54", "ie":"10", "node":"6.10" } + es.object.entries { "ie":"10", "node":"6.10" } + es.object.freeze { "ie":"10" } + es.object.from-entries { "chrome":"54", "ie":"10", "node":"6.10" } + es.object.get-own-property-descriptor { "ie":"10" } + es.object.get-own-property-descriptors { "ie":"10", "node":"6.10" } + es.object.get-own-property-names { "ie":"10" } + es.object.get-prototype-of { "ie":"10" } + es.object.is { "ie":"10" } + es.object.is-extensible { "ie":"10" } + es.object.is-frozen { "ie":"10" } + es.object.is-sealed { "ie":"10" } + es.object.keys { "ie":"10" } + es.object.lookup-getter { "chrome":"54", "ie":"10", "node":"6.10" } + es.object.lookup-setter { "chrome":"54", "ie":"10", "node":"6.10" } + es.object.prevent-extensions { "ie":"10" } + es.object.seal { "ie":"10" } + es.object.set-prototype-of { "ie":"10" } + es.object.to-string { "ie":"10" } + es.object.values { "ie":"10", "node":"6.10" } + es.promise { "chrome":"54", "ie":"10", "node":"6.10" } + es.promise.finally { "chrome":"54", "ie":"10", "node":"6.10" } + es.reflect.apply { "ie":"10" } + es.reflect.construct { "ie":"10" } + es.reflect.define-property { "ie":"10" } + es.reflect.delete-property { "ie":"10" } + es.reflect.get { "ie":"10" } + es.reflect.get-own-property-descriptor { "ie":"10" } + es.reflect.get-prototype-of { "ie":"10" } + es.reflect.has { "ie":"10" } + es.reflect.is-extensible { "ie":"10" } + es.reflect.own-keys { "ie":"10" } + es.reflect.prevent-extensions { "ie":"10" } + es.reflect.set { "ie":"10" } + es.reflect.set-prototype-of { "ie":"10" } + es.regexp.constructor { "ie":"10" } + es.regexp.exec { "ie":"10" } + es.regexp.flags { "ie":"10" } + es.regexp.to-string { "ie":"10" } + es.set { "ie":"10" } + es.string.code-point-at { "ie":"10" } + es.string.ends-with { "ie":"10" } + es.string.from-code-point { "ie":"10" } + es.string.includes { "ie":"10" } + es.string.iterator { "ie":"10" } + es.string.match { "ie":"10" } + es.string.pad-end { "chrome":"54", "ie":"10", "node":"6.10" } + es.string.pad-start { "chrome":"54", "ie":"10", "node":"6.10" } + es.string.raw { "ie":"10" } + es.string.repeat { "ie":"10" } + es.string.replace { "chrome":"54", "ie":"10", "node":"6.10" } + es.string.search { "ie":"10" } + es.string.split { "ie":"10", "node":"6.10" } + es.string.starts-with { "ie":"10" } + es.string.trim { "chrome":"54", "ie":"10", "node":"6.10" } + es.string.trim-end { "chrome":"54", "ie":"10", "node":"6.10" } + es.string.trim-start { "chrome":"54", "ie":"10", "node":"6.10" } + es.string.anchor { "ie":"10" } + es.string.big { "ie":"10" } + es.string.blink { "ie":"10" } + es.string.bold { "ie":"10" } + es.string.fixed { "ie":"10" } + es.string.fontcolor { "ie":"10" } + es.string.fontsize { "ie":"10" } + es.string.italics { "ie":"10" } + es.string.link { "ie":"10" } + es.string.small { "ie":"10" } + es.string.strike { "ie":"10" } + es.string.sub { "ie":"10" } + es.string.sup { "ie":"10" } + es.typed-array.float32-array { "ie":"10", "node":"6.10" } + es.typed-array.float64-array { "ie":"10", "node":"6.10" } + es.typed-array.int8-array { "ie":"10", "node":"6.10" } + es.typed-array.int16-array { "ie":"10", "node":"6.10" } + es.typed-array.int32-array { "ie":"10", "node":"6.10" } + es.typed-array.uint8-array { "ie":"10", "node":"6.10" } + es.typed-array.uint8-clamped-array { "ie":"10", "node":"6.10" } + es.typed-array.uint16-array { "ie":"10", "node":"6.10" } + es.typed-array.uint32-array { "ie":"10", "node":"6.10" } + es.typed-array.copy-within { "ie":"10" } + es.typed-array.every { "ie":"10" } + es.typed-array.fill { "ie":"10" } + es.typed-array.filter { "ie":"10" } + es.typed-array.find { "ie":"10" } + es.typed-array.find-index { "ie":"10" } + es.typed-array.for-each { "ie":"10" } + es.typed-array.from { "ie":"10", "node":"6.10" } + es.typed-array.includes { "ie":"10" } + es.typed-array.index-of { "ie":"10" } + es.typed-array.iterator { "ie":"10" } + es.typed-array.join { "ie":"10" } + es.typed-array.last-index-of { "ie":"10" } + es.typed-array.map { "ie":"10" } + es.typed-array.of { "ie":"10", "node":"6.10" } + es.typed-array.reduce { "ie":"10" } + es.typed-array.reduce-right { "ie":"10" } + es.typed-array.reverse { "ie":"10" } + es.typed-array.set { "ie":"10" } + es.typed-array.slice { "ie":"10" } + es.typed-array.some { "ie":"10" } + es.typed-array.sort { "ie":"10" } + es.typed-array.subarray { "ie":"10" } + es.typed-array.to-locale-string { "ie":"10" } + es.typed-array.to-string { "ie":"10" } + es.weak-map { "ie":"10" } + es.weak-set { "ie":"10" } + web.dom-collections.for-each { "chrome":"54", "ie":"10" } + web.dom-collections.iterator { "chrome":"54", "ie":"10" } + web.immediate { "chrome":"54" } + web.queue-microtask { "chrome":"54", "ie":"10", "node":"6.10" } + web.url { "chrome":"54", "ie":"10", "node":"6.10" } + web.url.to-json { "chrome":"54", "ie":"10", "node":"6.10" } + web.url-search-params { "chrome":"54", "ie":"10", "node":"6.10" } diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-versions-strings-minor-3.1/in/in.js b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-versions-strings-minor-3.1/input.mjs similarity index 100% rename from packages/babel-preset-env/test/debug-fixtures/entry-corejs3-versions-strings-minor-3.1/in/in.js rename to packages/babel-preset-env/test/fixtures/debug/entry-corejs3-versions-strings-minor-3.1/input.mjs diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-versions-strings-minor-3.1/options.json b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-versions-strings-minor-3.1/options.json new file mode 100644 index 000000000000..69bc8e9d06c3 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-versions-strings-minor-3.1/options.json @@ -0,0 +1,19 @@ +{ + "validateLogs": true, + "ignoreOutput": true, + "presets": [ + [ + "env", + { + "useBuiltIns": "entry", + "corejs": "3.1", + "debug": true, + "targets": { + "chrome": "54", + "node": "6.10", + "ie": "10" + } + } + ] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-versions-strings-minor-3.1/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-versions-strings-minor-3.1/stdout.txt new file mode 100644 index 000000000000..1aa4bce2300c --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-versions-strings-minor-3.1/stdout.txt @@ -0,0 +1,244 @@ +@babel/preset-env: `DEBUG` option + +Using targets: +{ + "chrome": "54", + "ie": "10", + "node": "6.10" +} + +Using modules transform: auto + +Using plugins: + transform-template-literals { "ie":"10" } + transform-literals { "ie":"10" } + transform-function-name { "ie":"10" } + transform-arrow-functions { "ie":"10" } + transform-block-scoped-functions { "ie":"10" } + transform-classes { "ie":"10" } + transform-object-super { "ie":"10" } + transform-shorthand-properties { "ie":"10" } + transform-duplicate-keys { "ie":"10" } + transform-computed-properties { "ie":"10" } + transform-for-of { "ie":"10" } + transform-sticky-regex { "ie":"10" } + transform-dotall-regex { "chrome":"54", "ie":"10", "node":"6.10" } + transform-unicode-regex { "ie":"10" } + transform-spread { "ie":"10" } + transform-parameters { "ie":"10" } + transform-destructuring { "ie":"10" } + transform-block-scoping { "ie":"10" } + transform-typeof-symbol { "ie":"10" } + transform-new-target { "ie":"10" } + transform-regenerator { "ie":"10" } + transform-exponentiation-operator { "ie":"10", "node":"6.10" } + transform-async-to-generator { "chrome":"54", "ie":"10", "node":"6.10" } + proposal-async-generator-functions { "chrome":"54", "ie":"10", "node":"6.10" } + proposal-object-rest-spread { "chrome":"54", "ie":"10", "node":"6.10" } + proposal-unicode-property-regex { "chrome":"54", "ie":"10", "node":"6.10" } + proposal-json-strings { "chrome":"54", "ie":"10", "node":"6.10" } + proposal-optional-catch-binding { "chrome":"54", "ie":"10", "node":"6.10" } + proposal-optional-chaining { "chrome":"54", "ie":"10", "node":"6.10" } + transform-named-capturing-groups-regex { "chrome":"54", "ie":"10", "node":"6.10" } + proposal-nullish-coalescing-operator { "chrome":"54", "ie":"10", "node":"6.10" } + transform-modules-commonjs { "chrome":"54", "ie":"10", "node":"6.10" } + proposal-dynamic-import { "chrome":"54", "ie":"10", "node":"6.10" } + +Using polyfills with `entry` option: + +[/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-versions-strings-minor-3.1/input.mjs] Replaced core-js entries with the following polyfills: + es.symbol { "ie":"10" } + es.symbol.description { "chrome":"54", "ie":"10", "node":"6.10" } + es.symbol.async-iterator { "chrome":"54", "ie":"10", "node":"6.10" } + es.symbol.has-instance { "ie":"10" } + es.symbol.is-concat-spreadable { "ie":"10" } + es.symbol.iterator { "ie":"10" } + es.symbol.match { "ie":"10" } + es.symbol.match-all { "chrome":"54", "ie":"10", "node":"6.10" } + es.symbol.replace { "ie":"10" } + es.symbol.search { "ie":"10" } + es.symbol.species { "ie":"10" } + es.symbol.split { "ie":"10" } + es.symbol.to-primitive { "ie":"10" } + es.symbol.to-string-tag { "ie":"10" } + es.symbol.unscopables { "ie":"10" } + es.array.concat { "ie":"10" } + es.array.copy-within { "ie":"10" } + es.array.every { "ie":"10" } + es.array.fill { "ie":"10" } + es.array.filter { "ie":"10" } + es.array.find { "ie":"10" } + es.array.find-index { "ie":"10" } + es.array.flat { "chrome":"54", "ie":"10", "node":"6.10" } + es.array.flat-map { "chrome":"54", "ie":"10", "node":"6.10" } + es.array.for-each { "ie":"10" } + es.array.from { "ie":"10" } + es.array.includes { "ie":"10", "node":"6.10" } + es.array.index-of { "ie":"10" } + es.array.iterator { "chrome":"54", "ie":"10", "node":"6.10" } + es.array.join { "ie":"10" } + es.array.last-index-of { "ie":"10" } + es.array.map { "ie":"10" } + es.array.of { "ie":"10" } + es.array.reduce { "ie":"10" } + es.array.reduce-right { "ie":"10" } + es.array.slice { "ie":"10" } + es.array.some { "ie":"10" } + es.array.sort { "chrome":"54", "node":"6.10" } + es.array.species { "ie":"10" } + es.array.splice { "ie":"10" } + es.array.unscopables.flat { "chrome":"54", "ie":"10", "node":"6.10" } + es.array.unscopables.flat-map { "chrome":"54", "ie":"10", "node":"6.10" } + es.array-buffer.constructor { "ie":"10" } + es.array-buffer.is-view { "ie":"10" } + es.array-buffer.slice { "ie":"10" } + es.date.to-primitive { "ie":"10" } + es.function.has-instance { "ie":"10" } + es.function.name { "ie":"10" } + es.json.to-string-tag { "ie":"10" } + es.map { "ie":"10" } + es.math.acosh { "ie":"10", "node":"6.10" } + es.math.asinh { "ie":"10" } + es.math.atanh { "ie":"10" } + es.math.cbrt { "ie":"10" } + es.math.clz32 { "ie":"10" } + es.math.cosh { "ie":"10" } + es.math.expm1 { "ie":"10" } + es.math.fround { "ie":"10" } + es.math.hypot { "chrome":"54", "ie":"10", "node":"6.10" } + es.math.imul { "ie":"10" } + es.math.log10 { "ie":"10" } + es.math.log1p { "ie":"10" } + es.math.log2 { "ie":"10" } + es.math.sign { "ie":"10" } + es.math.sinh { "ie":"10" } + es.math.tanh { "ie":"10" } + es.math.to-string-tag { "ie":"10" } + es.math.trunc { "ie":"10" } + es.number.constructor { "ie":"10" } + es.number.epsilon { "ie":"10" } + es.number.is-finite { "ie":"10" } + es.number.is-integer { "ie":"10" } + es.number.is-nan { "ie":"10" } + es.number.is-safe-integer { "ie":"10" } + es.number.max-safe-integer { "ie":"10" } + es.number.min-safe-integer { "ie":"10" } + es.number.parse-float { "ie":"10" } + es.number.parse-int { "ie":"10" } + es.number.to-fixed { "ie":"10" } + es.object.assign { "ie":"10" } + es.object.define-getter { "chrome":"54", "ie":"10", "node":"6.10" } + es.object.define-setter { "chrome":"54", "ie":"10", "node":"6.10" } + es.object.entries { "ie":"10", "node":"6.10" } + es.object.freeze { "ie":"10" } + es.object.from-entries { "chrome":"54", "ie":"10", "node":"6.10" } + es.object.get-own-property-descriptor { "ie":"10" } + es.object.get-own-property-descriptors { "ie":"10", "node":"6.10" } + es.object.get-own-property-names { "ie":"10" } + es.object.get-prototype-of { "ie":"10" } + es.object.is { "ie":"10" } + es.object.is-extensible { "ie":"10" } + es.object.is-frozen { "ie":"10" } + es.object.is-sealed { "ie":"10" } + es.object.keys { "ie":"10" } + es.object.lookup-getter { "chrome":"54", "ie":"10", "node":"6.10" } + es.object.lookup-setter { "chrome":"54", "ie":"10", "node":"6.10" } + es.object.prevent-extensions { "ie":"10" } + es.object.seal { "ie":"10" } + es.object.set-prototype-of { "ie":"10" } + es.object.to-string { "ie":"10" } + es.object.values { "ie":"10", "node":"6.10" } + es.promise { "chrome":"54", "ie":"10", "node":"6.10" } + es.promise.finally { "chrome":"54", "ie":"10", "node":"6.10" } + es.reflect.apply { "ie":"10" } + es.reflect.construct { "ie":"10" } + es.reflect.define-property { "ie":"10" } + es.reflect.delete-property { "ie":"10" } + es.reflect.get { "ie":"10" } + es.reflect.get-own-property-descriptor { "ie":"10" } + es.reflect.get-prototype-of { "ie":"10" } + es.reflect.has { "ie":"10" } + es.reflect.is-extensible { "ie":"10" } + es.reflect.own-keys { "ie":"10" } + es.reflect.prevent-extensions { "ie":"10" } + es.reflect.set { "ie":"10" } + es.reflect.set-prototype-of { "ie":"10" } + es.regexp.constructor { "ie":"10" } + es.regexp.exec { "ie":"10" } + es.regexp.flags { "ie":"10" } + es.regexp.to-string { "ie":"10" } + es.set { "ie":"10" } + es.string.code-point-at { "ie":"10" } + es.string.ends-with { "ie":"10" } + es.string.from-code-point { "ie":"10" } + es.string.includes { "ie":"10" } + es.string.iterator { "ie":"10" } + es.string.match { "ie":"10" } + es.string.match-all { "chrome":"54", "ie":"10", "node":"6.10" } + es.string.pad-end { "chrome":"54", "ie":"10", "node":"6.10" } + es.string.pad-start { "chrome":"54", "ie":"10", "node":"6.10" } + es.string.raw { "ie":"10" } + es.string.repeat { "ie":"10" } + es.string.replace { "chrome":"54", "ie":"10", "node":"6.10" } + es.string.search { "ie":"10" } + es.string.split { "ie":"10", "node":"6.10" } + es.string.starts-with { "ie":"10" } + es.string.trim { "chrome":"54", "ie":"10", "node":"6.10" } + es.string.trim-end { "chrome":"54", "ie":"10", "node":"6.10" } + es.string.trim-start { "chrome":"54", "ie":"10", "node":"6.10" } + es.string.anchor { "ie":"10" } + es.string.big { "ie":"10" } + es.string.blink { "ie":"10" } + es.string.bold { "ie":"10" } + es.string.fixed { "ie":"10" } + es.string.fontcolor { "ie":"10" } + es.string.fontsize { "ie":"10" } + es.string.italics { "ie":"10" } + es.string.link { "ie":"10" } + es.string.small { "ie":"10" } + es.string.strike { "ie":"10" } + es.string.sub { "ie":"10" } + es.string.sup { "ie":"10" } + es.typed-array.float32-array { "ie":"10", "node":"6.10" } + es.typed-array.float64-array { "ie":"10", "node":"6.10" } + es.typed-array.int8-array { "ie":"10", "node":"6.10" } + es.typed-array.int16-array { "ie":"10", "node":"6.10" } + es.typed-array.int32-array { "ie":"10", "node":"6.10" } + es.typed-array.uint8-array { "ie":"10", "node":"6.10" } + es.typed-array.uint8-clamped-array { "ie":"10", "node":"6.10" } + es.typed-array.uint16-array { "ie":"10", "node":"6.10" } + es.typed-array.uint32-array { "ie":"10", "node":"6.10" } + es.typed-array.copy-within { "ie":"10" } + es.typed-array.every { "ie":"10" } + es.typed-array.fill { "ie":"10" } + es.typed-array.filter { "ie":"10" } + es.typed-array.find { "ie":"10" } + es.typed-array.find-index { "ie":"10" } + es.typed-array.for-each { "ie":"10" } + es.typed-array.from { "ie":"10", "node":"6.10" } + es.typed-array.includes { "ie":"10" } + es.typed-array.index-of { "ie":"10" } + es.typed-array.iterator { "ie":"10" } + es.typed-array.join { "ie":"10" } + es.typed-array.last-index-of { "ie":"10" } + es.typed-array.map { "ie":"10" } + es.typed-array.of { "ie":"10", "node":"6.10" } + es.typed-array.reduce { "ie":"10" } + es.typed-array.reduce-right { "ie":"10" } + es.typed-array.reverse { "ie":"10" } + es.typed-array.set { "ie":"10" } + es.typed-array.slice { "ie":"10" } + es.typed-array.some { "ie":"10" } + es.typed-array.sort { "ie":"10" } + es.typed-array.subarray { "ie":"10" } + es.typed-array.to-locale-string { "ie":"10" } + es.typed-array.to-string { "ie":"10" } + es.weak-map { "ie":"10" } + es.weak-set { "ie":"10" } + web.dom-collections.for-each { "chrome":"54", "ie":"10" } + web.dom-collections.iterator { "chrome":"54", "ie":"10" } + web.immediate { "chrome":"54" } + web.queue-microtask { "chrome":"54", "ie":"10", "node":"6.10" } + web.url { "chrome":"54", "ie":"10", "node":"6.10" } + web.url.to-json { "chrome":"54", "ie":"10", "node":"6.10" } + web.url-search-params { "chrome":"54", "ie":"10", "node":"6.10" } diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-versions-strings/in/in.js b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-versions-strings/input.mjs similarity index 100% rename from packages/babel-preset-env/test/debug-fixtures/entry-corejs3-versions-strings/in/in.js rename to packages/babel-preset-env/test/fixtures/debug/entry-corejs3-versions-strings/input.mjs diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-versions-strings/options.json b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-versions-strings/options.json new file mode 100644 index 000000000000..2f72dab2dc93 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-versions-strings/options.json @@ -0,0 +1,19 @@ +{ + "validateLogs": true, + "ignoreOutput": true, + "presets": [ + [ + "env", + { + "useBuiltIns": "entry", + "corejs": 3, + "debug": true, + "targets": { + "chrome": "54", + "node": "6.10", + "ie": "10" + } + } + ] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-versions-strings/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-versions-strings/stdout.txt new file mode 100644 index 000000000000..9a09c03b6d27 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-versions-strings/stdout.txt @@ -0,0 +1,242 @@ +@babel/preset-env: `DEBUG` option + +Using targets: +{ + "chrome": "54", + "ie": "10", + "node": "6.10" +} + +Using modules transform: auto + +Using plugins: + transform-template-literals { "ie":"10" } + transform-literals { "ie":"10" } + transform-function-name { "ie":"10" } + transform-arrow-functions { "ie":"10" } + transform-block-scoped-functions { "ie":"10" } + transform-classes { "ie":"10" } + transform-object-super { "ie":"10" } + transform-shorthand-properties { "ie":"10" } + transform-duplicate-keys { "ie":"10" } + transform-computed-properties { "ie":"10" } + transform-for-of { "ie":"10" } + transform-sticky-regex { "ie":"10" } + transform-dotall-regex { "chrome":"54", "ie":"10", "node":"6.10" } + transform-unicode-regex { "ie":"10" } + transform-spread { "ie":"10" } + transform-parameters { "ie":"10" } + transform-destructuring { "ie":"10" } + transform-block-scoping { "ie":"10" } + transform-typeof-symbol { "ie":"10" } + transform-new-target { "ie":"10" } + transform-regenerator { "ie":"10" } + transform-exponentiation-operator { "ie":"10", "node":"6.10" } + transform-async-to-generator { "chrome":"54", "ie":"10", "node":"6.10" } + proposal-async-generator-functions { "chrome":"54", "ie":"10", "node":"6.10" } + proposal-object-rest-spread { "chrome":"54", "ie":"10", "node":"6.10" } + proposal-unicode-property-regex { "chrome":"54", "ie":"10", "node":"6.10" } + proposal-json-strings { "chrome":"54", "ie":"10", "node":"6.10" } + proposal-optional-catch-binding { "chrome":"54", "ie":"10", "node":"6.10" } + proposal-optional-chaining { "chrome":"54", "ie":"10", "node":"6.10" } + transform-named-capturing-groups-regex { "chrome":"54", "ie":"10", "node":"6.10" } + proposal-nullish-coalescing-operator { "chrome":"54", "ie":"10", "node":"6.10" } + transform-modules-commonjs { "chrome":"54", "ie":"10", "node":"6.10" } + proposal-dynamic-import { "chrome":"54", "ie":"10", "node":"6.10" } + +Using polyfills with `entry` option: + +[/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-versions-strings/input.mjs] Replaced core-js entries with the following polyfills: + es.symbol { "ie":"10" } + es.symbol.description { "chrome":"54", "ie":"10", "node":"6.10" } + es.symbol.async-iterator { "chrome":"54", "ie":"10", "node":"6.10" } + es.symbol.has-instance { "ie":"10" } + es.symbol.is-concat-spreadable { "ie":"10" } + es.symbol.iterator { "ie":"10" } + es.symbol.match { "ie":"10" } + es.symbol.replace { "ie":"10" } + es.symbol.search { "ie":"10" } + es.symbol.species { "ie":"10" } + es.symbol.split { "ie":"10" } + es.symbol.to-primitive { "ie":"10" } + es.symbol.to-string-tag { "ie":"10" } + es.symbol.unscopables { "ie":"10" } + es.array.concat { "ie":"10" } + es.array.copy-within { "ie":"10" } + es.array.every { "ie":"10" } + es.array.fill { "ie":"10" } + es.array.filter { "ie":"10" } + es.array.find { "ie":"10" } + es.array.find-index { "ie":"10" } + es.array.flat { "chrome":"54", "ie":"10", "node":"6.10" } + es.array.flat-map { "chrome":"54", "ie":"10", "node":"6.10" } + es.array.for-each { "ie":"10" } + es.array.from { "ie":"10" } + es.array.includes { "ie":"10", "node":"6.10" } + es.array.index-of { "ie":"10" } + es.array.iterator { "chrome":"54", "ie":"10", "node":"6.10" } + es.array.join { "ie":"10" } + es.array.last-index-of { "ie":"10" } + es.array.map { "ie":"10" } + es.array.of { "ie":"10" } + es.array.reduce { "ie":"10" } + es.array.reduce-right { "ie":"10" } + es.array.slice { "ie":"10" } + es.array.some { "ie":"10" } + es.array.sort { "chrome":"54", "node":"6.10" } + es.array.species { "ie":"10" } + es.array.splice { "ie":"10" } + es.array.unscopables.flat { "chrome":"54", "ie":"10", "node":"6.10" } + es.array.unscopables.flat-map { "chrome":"54", "ie":"10", "node":"6.10" } + es.array-buffer.constructor { "ie":"10" } + es.array-buffer.is-view { "ie":"10" } + es.array-buffer.slice { "ie":"10" } + es.date.to-primitive { "ie":"10" } + es.function.has-instance { "ie":"10" } + es.function.name { "ie":"10" } + es.json.to-string-tag { "ie":"10" } + es.map { "ie":"10" } + es.math.acosh { "ie":"10", "node":"6.10" } + es.math.asinh { "ie":"10" } + es.math.atanh { "ie":"10" } + es.math.cbrt { "ie":"10" } + es.math.clz32 { "ie":"10" } + es.math.cosh { "ie":"10" } + es.math.expm1 { "ie":"10" } + es.math.fround { "ie":"10" } + es.math.hypot { "chrome":"54", "ie":"10", "node":"6.10" } + es.math.imul { "ie":"10" } + es.math.log10 { "ie":"10" } + es.math.log1p { "ie":"10" } + es.math.log2 { "ie":"10" } + es.math.sign { "ie":"10" } + es.math.sinh { "ie":"10" } + es.math.tanh { "ie":"10" } + es.math.to-string-tag { "ie":"10" } + es.math.trunc { "ie":"10" } + es.number.constructor { "ie":"10" } + es.number.epsilon { "ie":"10" } + es.number.is-finite { "ie":"10" } + es.number.is-integer { "ie":"10" } + es.number.is-nan { "ie":"10" } + es.number.is-safe-integer { "ie":"10" } + es.number.max-safe-integer { "ie":"10" } + es.number.min-safe-integer { "ie":"10" } + es.number.parse-float { "ie":"10" } + es.number.parse-int { "ie":"10" } + es.number.to-fixed { "ie":"10" } + es.object.assign { "ie":"10" } + es.object.define-getter { "chrome":"54", "ie":"10", "node":"6.10" } + es.object.define-setter { "chrome":"54", "ie":"10", "node":"6.10" } + es.object.entries { "ie":"10", "node":"6.10" } + es.object.freeze { "ie":"10" } + es.object.from-entries { "chrome":"54", "ie":"10", "node":"6.10" } + es.object.get-own-property-descriptor { "ie":"10" } + es.object.get-own-property-descriptors { "ie":"10", "node":"6.10" } + es.object.get-own-property-names { "ie":"10" } + es.object.get-prototype-of { "ie":"10" } + es.object.is { "ie":"10" } + es.object.is-extensible { "ie":"10" } + es.object.is-frozen { "ie":"10" } + es.object.is-sealed { "ie":"10" } + es.object.keys { "ie":"10" } + es.object.lookup-getter { "chrome":"54", "ie":"10", "node":"6.10" } + es.object.lookup-setter { "chrome":"54", "ie":"10", "node":"6.10" } + es.object.prevent-extensions { "ie":"10" } + es.object.seal { "ie":"10" } + es.object.set-prototype-of { "ie":"10" } + es.object.to-string { "ie":"10" } + es.object.values { "ie":"10", "node":"6.10" } + es.promise { "chrome":"54", "ie":"10", "node":"6.10" } + es.promise.finally { "chrome":"54", "ie":"10", "node":"6.10" } + es.reflect.apply { "ie":"10" } + es.reflect.construct { "ie":"10" } + es.reflect.define-property { "ie":"10" } + es.reflect.delete-property { "ie":"10" } + es.reflect.get { "ie":"10" } + es.reflect.get-own-property-descriptor { "ie":"10" } + es.reflect.get-prototype-of { "ie":"10" } + es.reflect.has { "ie":"10" } + es.reflect.is-extensible { "ie":"10" } + es.reflect.own-keys { "ie":"10" } + es.reflect.prevent-extensions { "ie":"10" } + es.reflect.set { "ie":"10" } + es.reflect.set-prototype-of { "ie":"10" } + es.regexp.constructor { "ie":"10" } + es.regexp.exec { "ie":"10" } + es.regexp.flags { "ie":"10" } + es.regexp.to-string { "ie":"10" } + es.set { "ie":"10" } + es.string.code-point-at { "ie":"10" } + es.string.ends-with { "ie":"10" } + es.string.from-code-point { "ie":"10" } + es.string.includes { "ie":"10" } + es.string.iterator { "ie":"10" } + es.string.match { "ie":"10" } + es.string.pad-end { "chrome":"54", "ie":"10", "node":"6.10" } + es.string.pad-start { "chrome":"54", "ie":"10", "node":"6.10" } + es.string.raw { "ie":"10" } + es.string.repeat { "ie":"10" } + es.string.replace { "chrome":"54", "ie":"10", "node":"6.10" } + es.string.search { "ie":"10" } + es.string.split { "ie":"10", "node":"6.10" } + es.string.starts-with { "ie":"10" } + es.string.trim { "chrome":"54", "ie":"10", "node":"6.10" } + es.string.trim-end { "chrome":"54", "ie":"10", "node":"6.10" } + es.string.trim-start { "chrome":"54", "ie":"10", "node":"6.10" } + es.string.anchor { "ie":"10" } + es.string.big { "ie":"10" } + es.string.blink { "ie":"10" } + es.string.bold { "ie":"10" } + es.string.fixed { "ie":"10" } + es.string.fontcolor { "ie":"10" } + es.string.fontsize { "ie":"10" } + es.string.italics { "ie":"10" } + es.string.link { "ie":"10" } + es.string.small { "ie":"10" } + es.string.strike { "ie":"10" } + es.string.sub { "ie":"10" } + es.string.sup { "ie":"10" } + es.typed-array.float32-array { "ie":"10", "node":"6.10" } + es.typed-array.float64-array { "ie":"10", "node":"6.10" } + es.typed-array.int8-array { "ie":"10", "node":"6.10" } + es.typed-array.int16-array { "ie":"10", "node":"6.10" } + es.typed-array.int32-array { "ie":"10", "node":"6.10" } + es.typed-array.uint8-array { "ie":"10", "node":"6.10" } + es.typed-array.uint8-clamped-array { "ie":"10", "node":"6.10" } + es.typed-array.uint16-array { "ie":"10", "node":"6.10" } + es.typed-array.uint32-array { "ie":"10", "node":"6.10" } + es.typed-array.copy-within { "ie":"10" } + es.typed-array.every { "ie":"10" } + es.typed-array.fill { "ie":"10" } + es.typed-array.filter { "ie":"10" } + es.typed-array.find { "ie":"10" } + es.typed-array.find-index { "ie":"10" } + es.typed-array.for-each { "ie":"10" } + es.typed-array.from { "ie":"10", "node":"6.10" } + es.typed-array.includes { "ie":"10" } + es.typed-array.index-of { "ie":"10" } + es.typed-array.iterator { "ie":"10" } + es.typed-array.join { "ie":"10" } + es.typed-array.last-index-of { "ie":"10" } + es.typed-array.map { "ie":"10" } + es.typed-array.of { "ie":"10", "node":"6.10" } + es.typed-array.reduce { "ie":"10" } + es.typed-array.reduce-right { "ie":"10" } + es.typed-array.reverse { "ie":"10" } + es.typed-array.set { "ie":"10" } + es.typed-array.slice { "ie":"10" } + es.typed-array.some { "ie":"10" } + es.typed-array.sort { "ie":"10" } + es.typed-array.subarray { "ie":"10" } + es.typed-array.to-locale-string { "ie":"10" } + es.typed-array.to-string { "ie":"10" } + es.weak-map { "ie":"10" } + es.weak-set { "ie":"10" } + web.dom-collections.for-each { "chrome":"54", "ie":"10" } + web.dom-collections.iterator { "chrome":"54", "ie":"10" } + web.immediate { "chrome":"54" } + web.queue-microtask { "chrome":"54", "ie":"10", "node":"6.10" } + web.url { "chrome":"54", "ie":"10", "node":"6.10" } + web.url.to-json { "chrome":"54", "ie":"10", "node":"6.10" } + web.url-search-params { "chrome":"54", "ie":"10", "node":"6.10" } diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-web-chrome-71/in/in.js b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-web-chrome-71/input.mjs similarity index 100% rename from packages/babel-preset-env/test/debug-fixtures/entry-corejs3-web-chrome-71/in/in.js rename to packages/babel-preset-env/test/fixtures/debug/entry-corejs3-web-chrome-71/input.mjs diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-web-chrome-71/options.json b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-web-chrome-71/options.json new file mode 100644 index 000000000000..6e8f4a357b28 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-web-chrome-71/options.json @@ -0,0 +1,18 @@ +{ + "validateLogs": true, + "ignoreOutput": true, + "presets": [ + [ + "env", + { + "debug": true, + "targets": { + "browsers": "chrome 71" + }, + "shippedProposals": true, + "useBuiltIns": "entry", + "corejs": 3 + } + ] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-web-chrome-71/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-web-chrome-71/stdout.txt new file mode 100644 index 000000000000..19dfd0af2181 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-web-chrome-71/stdout.txt @@ -0,0 +1,25 @@ +@babel/preset-env: `DEBUG` option + +Using targets: +{ + "chrome": "71" +} + +Using modules transform: auto + +Using plugins: + syntax-async-generators { "chrome":"71" } + syntax-object-rest-spread { "chrome":"71" } + syntax-json-strings { "chrome":"71" } + syntax-optional-catch-binding { "chrome":"71" } + proposal-optional-chaining { "chrome":"71" } + proposal-nullish-coalescing-operator { "chrome":"71" } + transform-modules-commonjs { "chrome":"71" } + proposal-dynamic-import { "chrome":"71" } + +Using polyfills with `entry` option: + +[/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-web-chrome-71/input.mjs] Replaced core-js entries with the following polyfill: + web.immediate { "chrome":"71" } + +[/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-web-chrome-71/input.mjs] Based on your targets, regenerator-runtime import excluded. diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3-web/in/in.js b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-web/input.mjs similarity index 100% rename from packages/babel-preset-env/test/debug-fixtures/entry-corejs3-web/in/in.js rename to packages/babel-preset-env/test/fixtures/debug/entry-corejs3-web/input.mjs diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-web/options.json b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-web/options.json new file mode 100644 index 000000000000..edf42df8057e --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-web/options.json @@ -0,0 +1,15 @@ +{ + "validateLogs": true, + "ignoreOutput": true, + "presets": [ + [ + "env", + { + "debug": true, + "shippedProposals": true, + "useBuiltIns": "entry", + "corejs": 3 + } + ] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-web/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-web/stdout.txt new file mode 100644 index 000000000000..3948c4b7acab --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-web/stdout.txt @@ -0,0 +1,56 @@ +@babel/preset-env: `DEBUG` option + +Using targets: +{} + +Using modules transform: auto + +Using plugins: + transform-template-literals {} + transform-literals {} + transform-function-name {} + transform-arrow-functions {} + transform-block-scoped-functions {} + transform-classes {} + transform-object-super {} + transform-shorthand-properties {} + transform-duplicate-keys {} + transform-computed-properties {} + transform-for-of {} + transform-sticky-regex {} + transform-dotall-regex {} + transform-unicode-regex {} + transform-spread {} + transform-parameters {} + transform-destructuring {} + transform-block-scoping {} + transform-typeof-symbol {} + transform-new-target {} + transform-regenerator {} + transform-exponentiation-operator {} + transform-async-to-generator {} + proposal-async-generator-functions {} + proposal-object-rest-spread {} + proposal-unicode-property-regex {} + proposal-json-strings {} + proposal-optional-catch-binding {} + proposal-optional-chaining {} + transform-named-capturing-groups-regex {} + transform-member-expression-literals {} + transform-property-literals {} + transform-reserved-words {} + proposal-nullish-coalescing-operator {} + transform-modules-commonjs {} + proposal-dynamic-import {} + +Using polyfills with `entry` option: + +[/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-web/input.mjs] Replaced core-js entries with the following polyfills: + web.dom-collections.for-each {} + web.dom-collections.iterator {} + web.immediate {} + web.queue-microtask {} + web.timers {} + web.url {} + web.url.to-json {} + web.url-search-params {} diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-corejs3/in/in.js b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3/input.mjs similarity index 100% rename from packages/babel-preset-env/test/debug-fixtures/entry-corejs3/in/in.js rename to packages/babel-preset-env/test/fixtures/debug/entry-corejs3/input.mjs diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs3/options.json b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3/options.json new file mode 100644 index 000000000000..9dcd68d59ce9 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3/options.json @@ -0,0 +1,18 @@ +{ + "validateLogs": true, + "ignoreOutput": true, + "presets": [ + [ + "env", + { + "debug": true, + "targets": { + "browsers": "chrome >= 54, ie 10", + "node": 6 + }, + "useBuiltIns": "entry", + "corejs": 3 + } + ] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs3/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3/stdout.txt new file mode 100644 index 000000000000..9706b3e7699f --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3/stdout.txt @@ -0,0 +1,242 @@ +@babel/preset-env: `DEBUG` option + +Using targets: +{ + "chrome": "54", + "ie": "10", + "node": "6" +} + +Using modules transform: auto + +Using plugins: + transform-template-literals { "ie":"10" } + transform-literals { "ie":"10" } + transform-function-name { "ie":"10", "node":"6" } + transform-arrow-functions { "ie":"10" } + transform-block-scoped-functions { "ie":"10" } + transform-classes { "ie":"10" } + transform-object-super { "ie":"10" } + transform-shorthand-properties { "ie":"10" } + transform-duplicate-keys { "ie":"10" } + transform-computed-properties { "ie":"10" } + transform-for-of { "ie":"10", "node":"6" } + transform-sticky-regex { "ie":"10" } + transform-dotall-regex { "chrome":"54", "ie":"10", "node":"6" } + transform-unicode-regex { "ie":"10" } + transform-spread { "ie":"10" } + transform-parameters { "ie":"10" } + transform-destructuring { "ie":"10", "node":"6" } + transform-block-scoping { "ie":"10" } + transform-typeof-symbol { "ie":"10" } + transform-new-target { "ie":"10" } + transform-regenerator { "ie":"10" } + transform-exponentiation-operator { "ie":"10", "node":"6" } + transform-async-to-generator { "chrome":"54", "ie":"10", "node":"6" } + proposal-async-generator-functions { "chrome":"54", "ie":"10", "node":"6" } + proposal-object-rest-spread { "chrome":"54", "ie":"10", "node":"6" } + proposal-unicode-property-regex { "chrome":"54", "ie":"10", "node":"6" } + proposal-json-strings { "chrome":"54", "ie":"10", "node":"6" } + proposal-optional-catch-binding { "chrome":"54", "ie":"10", "node":"6" } + proposal-optional-chaining { "chrome":"54", "ie":"10", "node":"6" } + transform-named-capturing-groups-regex { "chrome":"54", "ie":"10", "node":"6" } + proposal-nullish-coalescing-operator { "chrome":"54", "ie":"10", "node":"6" } + transform-modules-commonjs { "chrome":"54", "ie":"10", "node":"6" } + proposal-dynamic-import { "chrome":"54", "ie":"10", "node":"6" } + +Using polyfills with `entry` option: + +[/packages/babel-preset-env/test/fixtures/debug/entry-corejs3/input.mjs] Replaced core-js entries with the following polyfills: + es.symbol { "ie":"10" } + es.symbol.description { "chrome":"54", "ie":"10", "node":"6" } + es.symbol.async-iterator { "chrome":"54", "ie":"10", "node":"6" } + es.symbol.has-instance { "ie":"10" } + es.symbol.is-concat-spreadable { "ie":"10" } + es.symbol.iterator { "ie":"10" } + es.symbol.match { "ie":"10" } + es.symbol.replace { "ie":"10" } + es.symbol.search { "ie":"10" } + es.symbol.species { "ie":"10", "node":"6" } + es.symbol.split { "ie":"10" } + es.symbol.to-primitive { "ie":"10" } + es.symbol.to-string-tag { "ie":"10" } + es.symbol.unscopables { "ie":"10" } + es.array.concat { "ie":"10", "node":"6" } + es.array.copy-within { "ie":"10" } + es.array.every { "ie":"10" } + es.array.fill { "ie":"10" } + es.array.filter { "ie":"10", "node":"6" } + es.array.find { "ie":"10" } + es.array.find-index { "ie":"10" } + es.array.flat { "chrome":"54", "ie":"10", "node":"6" } + es.array.flat-map { "chrome":"54", "ie":"10", "node":"6" } + es.array.for-each { "ie":"10" } + es.array.from { "ie":"10", "node":"6" } + es.array.includes { "ie":"10", "node":"6" } + es.array.index-of { "ie":"10", "node":"6" } + es.array.iterator { "chrome":"54", "ie":"10", "node":"6" } + es.array.join { "ie":"10" } + es.array.last-index-of { "ie":"10", "node":"6" } + es.array.map { "ie":"10", "node":"6" } + es.array.of { "ie":"10" } + es.array.reduce { "ie":"10" } + es.array.reduce-right { "ie":"10" } + es.array.slice { "ie":"10", "node":"6" } + es.array.some { "ie":"10" } + es.array.sort { "chrome":"54", "node":"6" } + es.array.species { "ie":"10", "node":"6" } + es.array.splice { "ie":"10", "node":"6" } + es.array.unscopables.flat { "chrome":"54", "ie":"10", "node":"6" } + es.array.unscopables.flat-map { "chrome":"54", "ie":"10", "node":"6" } + es.array-buffer.constructor { "ie":"10" } + es.array-buffer.is-view { "ie":"10" } + es.array-buffer.slice { "ie":"10" } + es.date.to-primitive { "ie":"10" } + es.function.has-instance { "ie":"10", "node":"6" } + es.function.name { "ie":"10" } + es.json.to-string-tag { "ie":"10" } + es.map { "ie":"10", "node":"6" } + es.math.acosh { "ie":"10", "node":"6" } + es.math.asinh { "ie":"10" } + es.math.atanh { "ie":"10" } + es.math.cbrt { "ie":"10" } + es.math.clz32 { "ie":"10" } + es.math.cosh { "ie":"10" } + es.math.expm1 { "ie":"10" } + es.math.fround { "ie":"10" } + es.math.hypot { "chrome":"54", "ie":"10", "node":"6" } + es.math.imul { "ie":"10" } + es.math.log10 { "ie":"10" } + es.math.log1p { "ie":"10" } + es.math.log2 { "ie":"10" } + es.math.sign { "ie":"10" } + es.math.sinh { "ie":"10" } + es.math.tanh { "ie":"10" } + es.math.to-string-tag { "ie":"10" } + es.math.trunc { "ie":"10" } + es.number.constructor { "ie":"10" } + es.number.epsilon { "ie":"10" } + es.number.is-finite { "ie":"10" } + es.number.is-integer { "ie":"10" } + es.number.is-nan { "ie":"10" } + es.number.is-safe-integer { "ie":"10" } + es.number.max-safe-integer { "ie":"10" } + es.number.min-safe-integer { "ie":"10" } + es.number.parse-float { "ie":"10" } + es.number.parse-int { "ie":"10" } + es.number.to-fixed { "ie":"10" } + es.object.assign { "ie":"10" } + es.object.define-getter { "chrome":"54", "ie":"10", "node":"6" } + es.object.define-setter { "chrome":"54", "ie":"10", "node":"6" } + es.object.entries { "ie":"10", "node":"6" } + es.object.freeze { "ie":"10" } + es.object.from-entries { "chrome":"54", "ie":"10", "node":"6" } + es.object.get-own-property-descriptor { "ie":"10" } + es.object.get-own-property-descriptors { "ie":"10", "node":"6" } + es.object.get-own-property-names { "ie":"10" } + es.object.get-prototype-of { "ie":"10" } + es.object.is { "ie":"10" } + es.object.is-extensible { "ie":"10" } + es.object.is-frozen { "ie":"10" } + es.object.is-sealed { "ie":"10" } + es.object.keys { "ie":"10" } + es.object.lookup-getter { "chrome":"54", "ie":"10", "node":"6" } + es.object.lookup-setter { "chrome":"54", "ie":"10", "node":"6" } + es.object.prevent-extensions { "ie":"10" } + es.object.seal { "ie":"10" } + es.object.set-prototype-of { "ie":"10" } + es.object.to-string { "ie":"10" } + es.object.values { "ie":"10", "node":"6" } + es.promise { "chrome":"54", "ie":"10", "node":"6" } + es.promise.finally { "chrome":"54", "ie":"10", "node":"6" } + es.reflect.apply { "ie":"10" } + es.reflect.construct { "ie":"10" } + es.reflect.define-property { "ie":"10" } + es.reflect.delete-property { "ie":"10" } + es.reflect.get { "ie":"10" } + es.reflect.get-own-property-descriptor { "ie":"10" } + es.reflect.get-prototype-of { "ie":"10" } + es.reflect.has { "ie":"10" } + es.reflect.is-extensible { "ie":"10" } + es.reflect.own-keys { "ie":"10" } + es.reflect.prevent-extensions { "ie":"10" } + es.reflect.set { "ie":"10" } + es.reflect.set-prototype-of { "ie":"10" } + es.regexp.constructor { "ie":"10", "node":"6" } + es.regexp.exec { "ie":"10" } + es.regexp.flags { "ie":"10" } + es.regexp.to-string { "ie":"10" } + es.set { "ie":"10", "node":"6" } + es.string.code-point-at { "ie":"10" } + es.string.ends-with { "ie":"10", "node":"6" } + es.string.from-code-point { "ie":"10" } + es.string.includes { "ie":"10", "node":"6" } + es.string.iterator { "ie":"10" } + es.string.match { "ie":"10", "node":"6" } + es.string.pad-end { "chrome":"54", "ie":"10", "node":"6" } + es.string.pad-start { "chrome":"54", "ie":"10", "node":"6" } + es.string.raw { "ie":"10" } + es.string.repeat { "ie":"10" } + es.string.replace { "chrome":"54", "ie":"10", "node":"6" } + es.string.search { "ie":"10", "node":"6" } + es.string.split { "ie":"10", "node":"6" } + es.string.starts-with { "ie":"10", "node":"6" } + es.string.trim { "chrome":"54", "ie":"10", "node":"6" } + es.string.trim-end { "chrome":"54", "ie":"10", "node":"6" } + es.string.trim-start { "chrome":"54", "ie":"10", "node":"6" } + es.string.anchor { "ie":"10" } + es.string.big { "ie":"10" } + es.string.blink { "ie":"10" } + es.string.bold { "ie":"10" } + es.string.fixed { "ie":"10" } + es.string.fontcolor { "ie":"10" } + es.string.fontsize { "ie":"10" } + es.string.italics { "ie":"10" } + es.string.link { "ie":"10" } + es.string.small { "ie":"10" } + es.string.strike { "ie":"10" } + es.string.sub { "ie":"10" } + es.string.sup { "ie":"10" } + es.typed-array.float32-array { "ie":"10", "node":"6" } + es.typed-array.float64-array { "ie":"10", "node":"6" } + es.typed-array.int8-array { "ie":"10", "node":"6" } + es.typed-array.int16-array { "ie":"10", "node":"6" } + es.typed-array.int32-array { "ie":"10", "node":"6" } + es.typed-array.uint8-array { "ie":"10", "node":"6" } + es.typed-array.uint8-clamped-array { "ie":"10", "node":"6" } + es.typed-array.uint16-array { "ie":"10", "node":"6" } + es.typed-array.uint32-array { "ie":"10", "node":"6" } + es.typed-array.copy-within { "ie":"10" } + es.typed-array.every { "ie":"10" } + es.typed-array.fill { "ie":"10" } + es.typed-array.filter { "ie":"10" } + es.typed-array.find { "ie":"10" } + es.typed-array.find-index { "ie":"10" } + es.typed-array.for-each { "ie":"10" } + es.typed-array.from { "ie":"10", "node":"6" } + es.typed-array.includes { "ie":"10" } + es.typed-array.index-of { "ie":"10" } + es.typed-array.iterator { "ie":"10" } + es.typed-array.join { "ie":"10" } + es.typed-array.last-index-of { "ie":"10" } + es.typed-array.map { "ie":"10" } + es.typed-array.of { "ie":"10", "node":"6" } + es.typed-array.reduce { "ie":"10" } + es.typed-array.reduce-right { "ie":"10" } + es.typed-array.reverse { "ie":"10" } + es.typed-array.set { "ie":"10" } + es.typed-array.slice { "ie":"10" } + es.typed-array.some { "ie":"10" } + es.typed-array.sort { "ie":"10" } + es.typed-array.subarray { "ie":"10" } + es.typed-array.to-locale-string { "ie":"10" } + es.typed-array.to-string { "ie":"10", "node":"6" } + es.weak-map { "ie":"10", "node":"6" } + es.weak-set { "ie":"10", "node":"6" } + web.dom-collections.for-each { "chrome":"54", "ie":"10" } + web.dom-collections.iterator { "chrome":"54", "ie":"10" } + web.immediate { "chrome":"54" } + web.queue-microtask { "chrome":"54", "ie":"10", "node":"6" } + web.url { "chrome":"54", "ie":"10", "node":"6" } + web.url.to-json { "chrome":"54", "ie":"10", "node":"6" } + web.url-search-params { "chrome":"54", "ie":"10", "node":"6" } diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-no-corejs-no-import/in/in.js b/packages/babel-preset-env/test/fixtures/debug/entry-no-corejs-no-import/input.js similarity index 100% rename from packages/babel-preset-env/test/debug-fixtures/entry-no-corejs-no-import/in/in.js rename to packages/babel-preset-env/test/fixtures/debug/entry-no-corejs-no-import/input.js diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-no-corejs-no-import/options.json b/packages/babel-preset-env/test/fixtures/debug/entry-no-corejs-no-import/options.json new file mode 100644 index 000000000000..fd9dfe7fbea6 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/entry-no-corejs-no-import/options.json @@ -0,0 +1,16 @@ +{ + "validateLogs": true, + "ignoreOutput": true, + "presets": [ + [ + "env", + { + "debug": true, + "targets": { + "node": 6 + }, + "useBuiltIns": "entry" + } + ] + ] +} diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-no-corejs-no-import/stderr.txt b/packages/babel-preset-env/test/fixtures/debug/entry-no-corejs-no-import/stderr.txt similarity index 100% rename from packages/babel-preset-env/test/debug-fixtures/entry-no-corejs-no-import/stderr.txt rename to packages/babel-preset-env/test/fixtures/debug/entry-no-corejs-no-import/stderr.txt diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-no-corejs-no-import/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/entry-no-corejs-no-import/stdout.txt new file mode 100644 index 000000000000..24105671f15c --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/entry-no-corejs-no-import/stdout.txt @@ -0,0 +1,30 @@ +@babel/preset-env: `DEBUG` option + +Using targets: +{ + "node": "6" +} + +Using modules transform: auto + +Using plugins: + transform-function-name { "node":"6" } + transform-for-of { "node":"6" } + transform-dotall-regex { "node":"6" } + transform-destructuring { "node":"6" } + transform-exponentiation-operator { "node":"6" } + transform-async-to-generator { "node":"6" } + proposal-async-generator-functions { "node":"6" } + proposal-object-rest-spread { "node":"6" } + proposal-unicode-property-regex { "node":"6" } + proposal-json-strings { "node":"6" } + proposal-optional-catch-binding { "node":"6" } + proposal-optional-chaining { "node":"6" } + transform-named-capturing-groups-regex { "node":"6" } + proposal-nullish-coalescing-operator { "node":"6" } + transform-modules-commonjs { "node":"6" } + proposal-dynamic-import { "node":"6" } + +Using polyfills with `entry` option: + +[/packages/babel-preset-env/test/fixtures/debug/entry-no-corejs-no-import/input.js] Import of @babel/polyfill was not found. diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-no-corejs-shippedProposals/in/in.js b/packages/babel-preset-env/test/fixtures/debug/entry-no-corejs-shippedProposals/input.mjs similarity index 100% rename from packages/babel-preset-env/test/debug-fixtures/entry-no-corejs-shippedProposals/in/in.js rename to packages/babel-preset-env/test/fixtures/debug/entry-no-corejs-shippedProposals/input.mjs diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-no-corejs-shippedProposals/options.json b/packages/babel-preset-env/test/fixtures/debug/entry-no-corejs-shippedProposals/options.json new file mode 100644 index 000000000000..736ae7777264 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/entry-no-corejs-shippedProposals/options.json @@ -0,0 +1,14 @@ +{ + "validateLogs": true, + "ignoreOutput": true, + "presets": [ + [ + "env", + { + "debug": true, + "shippedProposals": true, + "useBuiltIns": "entry" + } + ] + ] +} diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-no-corejs-shippedProposals/stderr.txt b/packages/babel-preset-env/test/fixtures/debug/entry-no-corejs-shippedProposals/stderr.txt similarity index 100% rename from packages/babel-preset-env/test/debug-fixtures/entry-no-corejs-shippedProposals/stderr.txt rename to packages/babel-preset-env/test/fixtures/debug/entry-no-corejs-shippedProposals/stderr.txt diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-no-corejs-shippedProposals/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/entry-no-corejs-shippedProposals/stdout.txt new file mode 100644 index 000000000000..6c02b20b8c27 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/entry-no-corejs-shippedProposals/stdout.txt @@ -0,0 +1,196 @@ +@babel/preset-env: `DEBUG` option + +Using targets: +{} + +Using modules transform: auto + +Using plugins: + transform-template-literals {} + transform-literals {} + transform-function-name {} + transform-arrow-functions {} + transform-block-scoped-functions {} + transform-classes {} + transform-object-super {} + transform-shorthand-properties {} + transform-duplicate-keys {} + transform-computed-properties {} + transform-for-of {} + transform-sticky-regex {} + transform-dotall-regex {} + transform-unicode-regex {} + transform-spread {} + transform-parameters {} + transform-destructuring {} + transform-block-scoping {} + transform-typeof-symbol {} + transform-new-target {} + transform-regenerator {} + transform-exponentiation-operator {} + transform-async-to-generator {} + proposal-async-generator-functions {} + proposal-object-rest-spread {} + proposal-unicode-property-regex {} + proposal-json-strings {} + proposal-optional-catch-binding {} + proposal-optional-chaining {} + transform-named-capturing-groups-regex {} + transform-member-expression-literals {} + transform-property-literals {} + transform-reserved-words {} + proposal-nullish-coalescing-operator {} + transform-modules-commonjs {} + proposal-dynamic-import {} + +Using polyfills with `entry` option: + +[/packages/babel-preset-env/test/fixtures/debug/entry-no-corejs-shippedProposals/input.mjs] Replaced @babel/polyfill entries with the following polyfills: + es6.array.copy-within {} + es6.array.every {} + es6.array.fill {} + es6.array.filter {} + es6.array.find {} + es6.array.find-index {} + es7.array.flat-map {} + es6.array.for-each {} + es6.array.from {} + es7.array.includes {} + es6.array.index-of {} + es6.array.is-array {} + es6.array.iterator {} + es6.array.last-index-of {} + es6.array.map {} + es6.array.of {} + es6.array.reduce {} + es6.array.reduce-right {} + es6.array.some {} + es6.array.sort {} + es6.array.species {} + es6.date.now {} + es6.date.to-iso-string {} + es6.date.to-json {} + es6.date.to-primitive {} + es6.date.to-string {} + es6.function.bind {} + es6.function.has-instance {} + es6.function.name {} + es6.map {} + es6.math.acosh {} + es6.math.asinh {} + es6.math.atanh {} + es6.math.cbrt {} + es6.math.clz32 {} + es6.math.cosh {} + es6.math.expm1 {} + es6.math.fround {} + es6.math.hypot {} + es6.math.imul {} + es6.math.log1p {} + es6.math.log10 {} + es6.math.log2 {} + es6.math.sign {} + es6.math.sinh {} + es6.math.tanh {} + es6.math.trunc {} + es6.number.constructor {} + es6.number.epsilon {} + es6.number.is-finite {} + es6.number.is-integer {} + es6.number.is-nan {} + es6.number.is-safe-integer {} + es6.number.max-safe-integer {} + es6.number.min-safe-integer {} + es6.number.parse-float {} + es6.number.parse-int {} + es6.object.assign {} + es6.object.create {} + es7.object.define-getter {} + es7.object.define-setter {} + es6.object.define-property {} + es6.object.define-properties {} + es7.object.entries {} + es6.object.freeze {} + es6.object.get-own-property-descriptor {} + es7.object.get-own-property-descriptors {} + es6.object.get-own-property-names {} + es6.object.get-prototype-of {} + es7.object.lookup-getter {} + es7.object.lookup-setter {} + es6.object.prevent-extensions {} + es6.object.to-string {} + es6.object.is {} + es6.object.is-frozen {} + es6.object.is-sealed {} + es6.object.is-extensible {} + es6.object.keys {} + es6.object.seal {} + es6.object.set-prototype-of {} + es7.object.values {} + es6.promise {} + es7.promise.finally {} + es6.reflect.apply {} + es6.reflect.construct {} + es6.reflect.define-property {} + es6.reflect.delete-property {} + es6.reflect.get {} + es6.reflect.get-own-property-descriptor {} + es6.reflect.get-prototype-of {} + es6.reflect.has {} + es6.reflect.is-extensible {} + es6.reflect.own-keys {} + es6.reflect.prevent-extensions {} + es6.reflect.set {} + es6.reflect.set-prototype-of {} + es6.regexp.constructor {} + es6.regexp.flags {} + es6.regexp.match {} + es6.regexp.replace {} + es6.regexp.split {} + es6.regexp.search {} + es6.regexp.to-string {} + es6.set {} + es6.symbol {} + es7.symbol.async-iterator {} + es6.string.anchor {} + es6.string.big {} + es6.string.blink {} + es6.string.bold {} + es6.string.code-point-at {} + es6.string.ends-with {} + es6.string.fixed {} + es6.string.fontcolor {} + es6.string.fontsize {} + es6.string.from-code-point {} + es6.string.includes {} + es6.string.italics {} + es6.string.iterator {} + es6.string.link {} + es7.string.pad-start {} + es7.string.pad-end {} + es6.string.raw {} + es6.string.repeat {} + es6.string.small {} + es6.string.starts-with {} + es6.string.strike {} + es6.string.sub {} + es6.string.sup {} + es6.string.trim {} + es7.string.trim-left {} + es7.string.trim-right {} + es6.typed.array-buffer {} + es6.typed.data-view {} + es6.typed.int8-array {} + es6.typed.uint8-array {} + es6.typed.uint8-clamped-array {} + es6.typed.int16-array {} + es6.typed.uint16-array {} + es6.typed.int32-array {} + es6.typed.uint32-array {} + es6.typed.float32-array {} + es6.typed.float64-array {} + es6.weak-map {} + es6.weak-set {} + web.timers {} + web.immediate {} + web.dom.iterable {} diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-no-corejs-uglify/in/in.js b/packages/babel-preset-env/test/fixtures/debug/entry-no-corejs-uglify/input.mjs similarity index 100% rename from packages/babel-preset-env/test/debug-fixtures/entry-no-corejs-uglify/in/in.js rename to packages/babel-preset-env/test/fixtures/debug/entry-no-corejs-uglify/input.mjs diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-no-corejs-uglify/options.json b/packages/babel-preset-env/test/fixtures/debug/entry-no-corejs-uglify/options.json new file mode 100644 index 000000000000..5e37354bd855 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/entry-no-corejs-uglify/options.json @@ -0,0 +1,18 @@ +{ + "validateLogs": true, + "ignoreOutput": true, + "presets": [ + [ + "env", + { + "debug": true, + "targets": { + "chrome": 55, + "uglify": true + }, + "useBuiltIns": "entry", + "modules": false + } + ] + ] +} diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-no-corejs-uglify/stderr.txt b/packages/babel-preset-env/test/fixtures/debug/entry-no-corejs-uglify/stderr.txt similarity index 100% rename from packages/babel-preset-env/test/debug-fixtures/entry-no-corejs-uglify/stderr.txt rename to packages/babel-preset-env/test/fixtures/debug/entry-no-corejs-uglify/stderr.txt diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-no-corejs-uglify/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/entry-no-corejs-uglify/stdout.txt new file mode 100644 index 000000000000..10ac0e1fb2e3 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/entry-no-corejs-uglify/stdout.txt @@ -0,0 +1,68 @@ +The uglify target has been deprecated. Set the top level +option `forceAllTransforms: true` instead. + +@babel/preset-env: `DEBUG` option + +Using targets: +{ + "chrome": "55" +} + +Using modules transform: false + +Using plugins: + transform-template-literals {} + transform-literals {} + transform-function-name {} + transform-arrow-functions {} + transform-block-scoped-functions {} + transform-classes {} + transform-object-super {} + transform-shorthand-properties {} + transform-duplicate-keys {} + transform-computed-properties {} + transform-for-of {} + transform-sticky-regex {} + transform-dotall-regex { "chrome":"55" } + transform-unicode-regex {} + transform-spread {} + transform-parameters {} + transform-destructuring {} + transform-block-scoping {} + transform-typeof-symbol {} + transform-new-target {} + transform-regenerator {} + transform-exponentiation-operator {} + transform-async-to-generator {} + proposal-async-generator-functions { "chrome":"55" } + proposal-object-rest-spread { "chrome":"55" } + proposal-unicode-property-regex { "chrome":"55" } + proposal-json-strings { "chrome":"55" } + proposal-optional-catch-binding { "chrome":"55" } + proposal-optional-chaining { "chrome":"55" } + transform-named-capturing-groups-regex { "chrome":"55" } + transform-member-expression-literals {} + transform-property-literals {} + transform-reserved-words {} + proposal-nullish-coalescing-operator { "chrome":"55" } + syntax-dynamic-import { "chrome":"55" } + +Using polyfills with `entry` option: + +[/packages/babel-preset-env/test/fixtures/debug/entry-no-corejs-uglify/input.mjs] Replaced @babel/polyfill entries with the following polyfills: + es7.array.flat-map { "chrome":"55" } + es6.array.sort { "chrome":"55" } + es7.object.define-getter { "chrome":"55" } + es7.object.define-setter { "chrome":"55" } + es7.object.lookup-getter { "chrome":"55" } + es7.object.lookup-setter { "chrome":"55" } + es6.object.to-string { "chrome":"55" } + es7.promise.finally { "chrome":"55" } + es7.symbol.async-iterator { "chrome":"55" } + es7.string.pad-start { "chrome":"55" } + es7.string.pad-end { "chrome":"55" } + es7.string.trim-left { "chrome":"55" } + es7.string.trim-right { "chrome":"55" } + web.timers { "chrome":"55" } + web.immediate { "chrome":"55" } + web.dom.iterable { "chrome":"55" } diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-no-corejs/in/in.js b/packages/babel-preset-env/test/fixtures/debug/entry-no-corejs/input.mjs similarity index 100% rename from packages/babel-preset-env/test/debug-fixtures/entry-no-corejs/in/in.js rename to packages/babel-preset-env/test/fixtures/debug/entry-no-corejs/input.mjs diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-no-corejs/options.json b/packages/babel-preset-env/test/fixtures/debug/entry-no-corejs/options.json new file mode 100644 index 000000000000..850e0357fd0d --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/entry-no-corejs/options.json @@ -0,0 +1,17 @@ +{ + "validateLogs": true, + "ignoreOutput": true, + "presets": [ + [ + "env", + { + "debug": true, + "targets": { + "browsers": "chrome >= 54, ie 10", + "node": 6 + }, + "useBuiltIns": "entry" + } + ] + ] +} diff --git a/packages/babel-preset-env/test/debug-fixtures/entry-no-corejs/stderr.txt b/packages/babel-preset-env/test/fixtures/debug/entry-no-corejs/stderr.txt similarity index 100% rename from packages/babel-preset-env/test/debug-fixtures/entry-no-corejs/stderr.txt rename to packages/babel-preset-env/test/fixtures/debug/entry-no-corejs/stderr.txt diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-no-corejs/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/entry-no-corejs/stdout.txt new file mode 100644 index 000000000000..1efd0e079c59 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/entry-no-corejs/stdout.txt @@ -0,0 +1,177 @@ +@babel/preset-env: `DEBUG` option + +Using targets: +{ + "chrome": "54", + "ie": "10", + "node": "6" +} + +Using modules transform: auto + +Using plugins: + transform-template-literals { "ie":"10" } + transform-literals { "ie":"10" } + transform-function-name { "ie":"10", "node":"6" } + transform-arrow-functions { "ie":"10" } + transform-block-scoped-functions { "ie":"10" } + transform-classes { "ie":"10" } + transform-object-super { "ie":"10" } + transform-shorthand-properties { "ie":"10" } + transform-duplicate-keys { "ie":"10" } + transform-computed-properties { "ie":"10" } + transform-for-of { "ie":"10", "node":"6" } + transform-sticky-regex { "ie":"10" } + transform-dotall-regex { "chrome":"54", "ie":"10", "node":"6" } + transform-unicode-regex { "ie":"10" } + transform-spread { "ie":"10" } + transform-parameters { "ie":"10" } + transform-destructuring { "ie":"10", "node":"6" } + transform-block-scoping { "ie":"10" } + transform-typeof-symbol { "ie":"10" } + transform-new-target { "ie":"10" } + transform-regenerator { "ie":"10" } + transform-exponentiation-operator { "ie":"10", "node":"6" } + transform-async-to-generator { "chrome":"54", "ie":"10", "node":"6" } + proposal-async-generator-functions { "chrome":"54", "ie":"10", "node":"6" } + proposal-object-rest-spread { "chrome":"54", "ie":"10", "node":"6" } + proposal-unicode-property-regex { "chrome":"54", "ie":"10", "node":"6" } + proposal-json-strings { "chrome":"54", "ie":"10", "node":"6" } + proposal-optional-catch-binding { "chrome":"54", "ie":"10", "node":"6" } + proposal-optional-chaining { "chrome":"54", "ie":"10", "node":"6" } + transform-named-capturing-groups-regex { "chrome":"54", "ie":"10", "node":"6" } + proposal-nullish-coalescing-operator { "chrome":"54", "ie":"10", "node":"6" } + transform-modules-commonjs { "chrome":"54", "ie":"10", "node":"6" } + proposal-dynamic-import { "chrome":"54", "ie":"10", "node":"6" } + +Using polyfills with `entry` option: + +[/packages/babel-preset-env/test/fixtures/debug/entry-no-corejs/input.mjs] Replaced @babel/polyfill entries with the following polyfills: + es6.array.copy-within { "ie":"10" } + es6.array.fill { "ie":"10" } + es6.array.find { "ie":"10" } + es6.array.find-index { "ie":"10" } + es7.array.flat-map { "chrome":"54", "ie":"10", "node":"6" } + es6.array.from { "ie":"10", "node":"6" } + es7.array.includes { "ie":"10" } + es6.array.iterator { "ie":"10" } + es6.array.of { "ie":"10" } + es6.array.sort { "chrome":"54", "node":"6" } + es6.array.species { "ie":"10", "node":"6" } + es6.date.to-primitive { "ie":"10" } + es6.function.has-instance { "ie":"10", "node":"6" } + es6.function.name { "ie":"10" } + es6.map { "ie":"10", "node":"6" } + es6.math.acosh { "ie":"10" } + es6.math.asinh { "ie":"10" } + es6.math.atanh { "ie":"10" } + es6.math.cbrt { "ie":"10" } + es6.math.clz32 { "ie":"10" } + es6.math.cosh { "ie":"10" } + es6.math.expm1 { "ie":"10" } + es6.math.fround { "ie":"10" } + es6.math.hypot { "ie":"10" } + es6.math.imul { "ie":"10" } + es6.math.log1p { "ie":"10" } + es6.math.log10 { "ie":"10" } + es6.math.log2 { "ie":"10" } + es6.math.sign { "ie":"10" } + es6.math.sinh { "ie":"10" } + es6.math.tanh { "ie":"10" } + es6.math.trunc { "ie":"10" } + es6.number.constructor { "ie":"10" } + es6.number.epsilon { "ie":"10" } + es6.number.is-finite { "ie":"10" } + es6.number.is-integer { "ie":"10" } + es6.number.is-nan { "ie":"10" } + es6.number.is-safe-integer { "ie":"10" } + es6.number.max-safe-integer { "ie":"10" } + es6.number.min-safe-integer { "ie":"10" } + es6.number.parse-float { "ie":"10" } + es6.number.parse-int { "ie":"10" } + es6.object.assign { "ie":"10" } + es7.object.define-getter { "chrome":"54", "ie":"10", "node":"6" } + es7.object.define-setter { "chrome":"54", "ie":"10", "node":"6" } + es7.object.entries { "ie":"10", "node":"6" } + es6.object.freeze { "ie":"10" } + es6.object.get-own-property-descriptor { "ie":"10" } + es7.object.get-own-property-descriptors { "ie":"10", "node":"6" } + es6.object.get-own-property-names { "ie":"10" } + es6.object.get-prototype-of { "ie":"10" } + es7.object.lookup-getter { "chrome":"54", "ie":"10", "node":"6" } + es7.object.lookup-setter { "chrome":"54", "ie":"10", "node":"6" } + es6.object.prevent-extensions { "ie":"10" } + es6.object.to-string { "chrome":"54", "ie":"10", "node":"6" } + es6.object.is { "ie":"10" } + es6.object.is-frozen { "ie":"10" } + es6.object.is-sealed { "ie":"10" } + es6.object.is-extensible { "ie":"10" } + es6.object.keys { "ie":"10" } + es6.object.seal { "ie":"10" } + es6.object.set-prototype-of { "ie":"10" } + es7.object.values { "ie":"10", "node":"6" } + es6.promise { "ie":"10", "node":"6" } + es7.promise.finally { "chrome":"54", "ie":"10", "node":"6" } + es6.reflect.apply { "ie":"10" } + es6.reflect.construct { "ie":"10" } + es6.reflect.define-property { "ie":"10" } + es6.reflect.delete-property { "ie":"10" } + es6.reflect.get { "ie":"10" } + es6.reflect.get-own-property-descriptor { "ie":"10" } + es6.reflect.get-prototype-of { "ie":"10" } + es6.reflect.has { "ie":"10" } + es6.reflect.is-extensible { "ie":"10" } + es6.reflect.own-keys { "ie":"10" } + es6.reflect.prevent-extensions { "ie":"10" } + es6.reflect.set { "ie":"10" } + es6.reflect.set-prototype-of { "ie":"10" } + es6.regexp.constructor { "ie":"10" } + es6.regexp.flags { "ie":"10" } + es6.regexp.match { "ie":"10" } + es6.regexp.replace { "ie":"10" } + es6.regexp.split { "ie":"10" } + es6.regexp.search { "ie":"10" } + es6.regexp.to-string { "ie":"10" } + es6.set { "ie":"10", "node":"6" } + es6.symbol { "ie":"10", "node":"6" } + es7.symbol.async-iterator { "chrome":"54", "ie":"10", "node":"6" } + es6.string.anchor { "ie":"10" } + es6.string.big { "ie":"10" } + es6.string.blink { "ie":"10" } + es6.string.bold { "ie":"10" } + es6.string.code-point-at { "ie":"10" } + es6.string.ends-with { "ie":"10" } + es6.string.fixed { "ie":"10" } + es6.string.fontcolor { "ie":"10" } + es6.string.fontsize { "ie":"10" } + es6.string.from-code-point { "ie":"10" } + es6.string.includes { "ie":"10" } + es6.string.italics { "ie":"10" } + es6.string.iterator { "ie":"10" } + es6.string.link { "ie":"10" } + es7.string.pad-start { "chrome":"54", "ie":"10", "node":"6" } + es7.string.pad-end { "chrome":"54", "ie":"10", "node":"6" } + es6.string.raw { "ie":"10" } + es6.string.repeat { "ie":"10" } + es6.string.small { "ie":"10" } + es6.string.starts-with { "ie":"10" } + es6.string.strike { "ie":"10" } + es6.string.sub { "ie":"10" } + es6.string.sup { "ie":"10" } + es7.string.trim-left { "chrome":"54", "ie":"10", "node":"6" } + es7.string.trim-right { "chrome":"54", "ie":"10", "node":"6" } + es6.typed.array-buffer { "ie":"10", "node":"6" } + es6.typed.int8-array { "ie":"10", "node":"6" } + es6.typed.uint8-array { "ie":"10", "node":"6" } + es6.typed.uint8-clamped-array { "ie":"10", "node":"6" } + es6.typed.int16-array { "ie":"10", "node":"6" } + es6.typed.uint16-array { "ie":"10", "node":"6" } + es6.typed.int32-array { "ie":"10", "node":"6" } + es6.typed.uint32-array { "ie":"10", "node":"6" } + es6.typed.float32-array { "ie":"10", "node":"6" } + es6.typed.float64-array { "ie":"10", "node":"6" } + es6.weak-map { "ie":"10", "node":"6" } + es6.weak-set { "ie":"10", "node":"6" } + web.timers { "chrome":"54", "ie":"10", "node":"6" } + web.immediate { "chrome":"54", "ie":"10", "node":"6" } + web.dom.iterable { "chrome":"54", "ie":"10", "node":"6" } diff --git a/packages/babel-preset-env/test/debug-fixtures/plugins-only/in/in.js b/packages/babel-preset-env/test/fixtures/debug/plugins-only/input.mjs similarity index 100% rename from packages/babel-preset-env/test/debug-fixtures/plugins-only/in/in.js rename to packages/babel-preset-env/test/fixtures/debug/plugins-only/input.mjs diff --git a/packages/babel-preset-env/test/fixtures/debug/plugins-only/options.json b/packages/babel-preset-env/test/fixtures/debug/plugins-only/options.json new file mode 100644 index 000000000000..fb4eeeaf5e71 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/plugins-only/options.json @@ -0,0 +1,22 @@ +{ + "validateLogs": true, + "ignoreOutput": true, + "presets": [ + [ + "env", + { + "debug": true, + "exclude": [ + "transform-async-to-generator", + "transform-regenerator", + "transform-parameters" + ], + "targets": { + "firefox": 52, + "node": 7.4 + }, + "useBuiltIns": false + } + ] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/debug/plugins-only/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/plugins-only/stdout.txt new file mode 100644 index 000000000000..91fa70d3ccaa --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/plugins-only/stdout.txt @@ -0,0 +1,35 @@ +Warning, the following targets are using a decimal version: + + node: 7.4 + +We recommend using a string for minor/patch versions to avoid numbers like 6.10 +getting parsed as 6.1, which can lead to unexpected behavior. + +@babel/preset-env: `DEBUG` option + +Using targets: +{ + "firefox": "52", + "node": "7.4" +} + +Using modules transform: auto + +Using plugins: + transform-literals { "firefox":"52" } + transform-function-name { "firefox":"52" } + transform-for-of { "firefox":"52" } + transform-dotall-regex { "firefox":"52", "node":"7.4" } + transform-destructuring { "firefox":"52" } + proposal-async-generator-functions { "firefox":"52", "node":"7.4" } + proposal-object-rest-spread { "firefox":"52", "node":"7.4" } + proposal-unicode-property-regex { "firefox":"52", "node":"7.4" } + proposal-json-strings { "firefox":"52", "node":"7.4" } + proposal-optional-catch-binding { "firefox":"52", "node":"7.4" } + proposal-optional-chaining { "firefox":"52", "node":"7.4" } + transform-named-capturing-groups-regex { "firefox":"52", "node":"7.4" } + proposal-nullish-coalescing-operator { "firefox":"52", "node":"7.4" } + transform-modules-commonjs { "firefox":"52", "node":"7.4" } + proposal-dynamic-import { "firefox":"52", "node":"7.4" } + +Using polyfills: No polyfills were added, since the `useBuiltIns` option was not set. diff --git a/packages/babel-preset-env/test/debug-fixtures/usage-corejs2-chrome-71/in/in.js b/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-1/input.js similarity index 100% rename from packages/babel-preset-env/test/debug-fixtures/usage-corejs2-chrome-71/in/in.js rename to packages/babel-preset-env/test/fixtures/debug/usage-corejs2-1/input.js diff --git a/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-1/options.json b/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-1/options.json new file mode 100644 index 000000000000..bc84c3a017cd --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-1/options.json @@ -0,0 +1,19 @@ +{ + "validateLogs": true, + "ignoreOutput": true, + "presets": [ + [ + "env", + { + "debug": true, + "targets": { + "chrome": 52, + "firefox": 50, + "ie": 11 + }, + "useBuiltIns": "usage", + "corejs": 2 + } + ] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-1/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-1/stdout.txt new file mode 100644 index 000000000000..aa7dfa881f18 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-1/stdout.txt @@ -0,0 +1,54 @@ +@babel/preset-env: `DEBUG` option + +Using targets: +{ + "chrome": "52", + "firefox": "50", + "ie": "11" +} + +Using modules transform: auto + +Using plugins: + transform-template-literals { "ie":"11" } + transform-literals { "firefox":"50", "ie":"11" } + transform-function-name { "firefox":"50", "ie":"11" } + transform-arrow-functions { "ie":"11" } + transform-classes { "ie":"11" } + transform-object-super { "ie":"11" } + transform-shorthand-properties { "ie":"11" } + transform-duplicate-keys { "ie":"11" } + transform-computed-properties { "ie":"11" } + transform-for-of { "firefox":"50", "ie":"11" } + transform-sticky-regex { "ie":"11" } + transform-dotall-regex { "chrome":"52", "firefox":"50", "ie":"11" } + transform-unicode-regex { "ie":"11" } + transform-spread { "ie":"11" } + transform-parameters { "firefox":"50", "ie":"11" } + transform-destructuring { "firefox":"50", "ie":"11" } + transform-block-scoping { "firefox":"50", "ie":"11" } + transform-typeof-symbol { "ie":"11" } + transform-new-target { "ie":"11" } + transform-regenerator { "firefox":"50", "ie":"11" } + transform-exponentiation-operator { "firefox":"50", "ie":"11" } + transform-async-to-generator { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-async-generator-functions { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-object-rest-spread { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-unicode-property-regex { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-json-strings { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-optional-catch-binding { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-optional-chaining { "chrome":"52", "firefox":"50", "ie":"11" } + transform-named-capturing-groups-regex { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-nullish-coalescing-operator { "chrome":"52", "firefox":"50", "ie":"11" } + transform-modules-commonjs { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-dynamic-import { "chrome":"52", "firefox":"50", "ie":"11" } + +Using polyfills with `usage` option: + +[/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-1/input.js] Added following core-js polyfills: + es6.object.to-string { "chrome":"52", "firefox":"50", "ie":"11" } + es6.promise { "ie":"11" } + es6.map { "firefox":"50", "ie":"11" } + es6.string.iterator { "ie":"11" } + es6.array.iterator { "ie":"11" } + web.dom.iterable { "chrome":"52", "firefox":"50", "ie":"11" } diff --git a/packages/babel-preset-env/test/debug-fixtures/usage-corejs2-chrome-71/in/in2.js b/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-2/input.js similarity index 100% rename from packages/babel-preset-env/test/debug-fixtures/usage-corejs2-chrome-71/in/in2.js rename to packages/babel-preset-env/test/fixtures/debug/usage-corejs2-2/input.js diff --git a/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-2/options.json b/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-2/options.json new file mode 100644 index 000000000000..bc84c3a017cd --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-2/options.json @@ -0,0 +1,19 @@ +{ + "validateLogs": true, + "ignoreOutput": true, + "presets": [ + [ + "env", + { + "debug": true, + "targets": { + "chrome": 52, + "firefox": 50, + "ie": 11 + }, + "useBuiltIns": "usage", + "corejs": 2 + } + ] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-2/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-2/stdout.txt new file mode 100644 index 000000000000..499f51879c15 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-2/stdout.txt @@ -0,0 +1,51 @@ +@babel/preset-env: `DEBUG` option + +Using targets: +{ + "chrome": "52", + "firefox": "50", + "ie": "11" +} + +Using modules transform: auto + +Using plugins: + transform-template-literals { "ie":"11" } + transform-literals { "firefox":"50", "ie":"11" } + transform-function-name { "firefox":"50", "ie":"11" } + transform-arrow-functions { "ie":"11" } + transform-classes { "ie":"11" } + transform-object-super { "ie":"11" } + transform-shorthand-properties { "ie":"11" } + transform-duplicate-keys { "ie":"11" } + transform-computed-properties { "ie":"11" } + transform-for-of { "firefox":"50", "ie":"11" } + transform-sticky-regex { "ie":"11" } + transform-dotall-regex { "chrome":"52", "firefox":"50", "ie":"11" } + transform-unicode-regex { "ie":"11" } + transform-spread { "ie":"11" } + transform-parameters { "firefox":"50", "ie":"11" } + transform-destructuring { "firefox":"50", "ie":"11" } + transform-block-scoping { "firefox":"50", "ie":"11" } + transform-typeof-symbol { "ie":"11" } + transform-new-target { "ie":"11" } + transform-regenerator { "firefox":"50", "ie":"11" } + transform-exponentiation-operator { "firefox":"50", "ie":"11" } + transform-async-to-generator { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-async-generator-functions { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-object-rest-spread { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-unicode-property-regex { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-json-strings { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-optional-catch-binding { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-optional-chaining { "chrome":"52", "firefox":"50", "ie":"11" } + transform-named-capturing-groups-regex { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-nullish-coalescing-operator { "chrome":"52", "firefox":"50", "ie":"11" } + transform-modules-commonjs { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-dynamic-import { "chrome":"52", "firefox":"50", "ie":"11" } + +Using polyfills with `usage` option: + +[/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-2/input.js] Added following core-js polyfill: + web.dom.iterable { "chrome":"52", "firefox":"50", "ie":"11" } + +[/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-2/input.js] Based on your code and targets, added regenerator-runtime. diff --git a/packages/babel-preset-env/test/debug-fixtures/usage-corejs2-proposals-chrome-71/in/in.js b/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-chrome-71-1/input.js similarity index 100% rename from packages/babel-preset-env/test/debug-fixtures/usage-corejs2-proposals-chrome-71/in/in.js rename to packages/babel-preset-env/test/fixtures/debug/usage-corejs2-chrome-71-1/input.js diff --git a/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-chrome-71-1/options.json b/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-chrome-71-1/options.json new file mode 100644 index 000000000000..d028d3be910f --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-chrome-71-1/options.json @@ -0,0 +1,17 @@ +{ + "validateLogs": true, + "ignoreOutput": true, + "presets": [ + [ + "env", + { + "debug": true, + "targets": { + "chrome": 71 + }, + "useBuiltIns": "usage", + "corejs": 2 + } + ] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-chrome-71-1/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-chrome-71-1/stdout.txt new file mode 100644 index 000000000000..0290b11fbcd5 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-chrome-71-1/stdout.txt @@ -0,0 +1,23 @@ +@babel/preset-env: `DEBUG` option + +Using targets: +{ + "chrome": "71" +} + +Using modules transform: auto + +Using plugins: + syntax-async-generators { "chrome":"71" } + syntax-object-rest-spread { "chrome":"71" } + syntax-json-strings { "chrome":"71" } + syntax-optional-catch-binding { "chrome":"71" } + proposal-optional-chaining { "chrome":"71" } + proposal-nullish-coalescing-operator { "chrome":"71" } + transform-modules-commonjs { "chrome":"71" } + proposal-dynamic-import { "chrome":"71" } + +Using polyfills with `usage` option: + +[/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-chrome-71-1/input.js] Added following core-js polyfill: + web.dom.iterable { "chrome":"71" } diff --git a/packages/babel-preset-env/test/debug-fixtures/usage-corejs2-proposals-chrome-71/in/in2.js b/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-chrome-71-2/input.js similarity index 100% rename from packages/babel-preset-env/test/debug-fixtures/usage-corejs2-proposals-chrome-71/in/in2.js rename to packages/babel-preset-env/test/fixtures/debug/usage-corejs2-chrome-71-2/input.js diff --git a/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-chrome-71-2/options.json b/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-chrome-71-2/options.json new file mode 100644 index 000000000000..d028d3be910f --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-chrome-71-2/options.json @@ -0,0 +1,17 @@ +{ + "validateLogs": true, + "ignoreOutput": true, + "presets": [ + [ + "env", + { + "debug": true, + "targets": { + "chrome": 71 + }, + "useBuiltIns": "usage", + "corejs": 2 + } + ] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-chrome-71-2/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-chrome-71-2/stdout.txt new file mode 100644 index 000000000000..8ab471d3fc50 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-chrome-71-2/stdout.txt @@ -0,0 +1,23 @@ +@babel/preset-env: `DEBUG` option + +Using targets: +{ + "chrome": "71" +} + +Using modules transform: auto + +Using plugins: + syntax-async-generators { "chrome":"71" } + syntax-object-rest-spread { "chrome":"71" } + syntax-json-strings { "chrome":"71" } + syntax-optional-catch-binding { "chrome":"71" } + proposal-optional-chaining { "chrome":"71" } + proposal-nullish-coalescing-operator { "chrome":"71" } + transform-modules-commonjs { "chrome":"71" } + proposal-dynamic-import { "chrome":"71" } + +Using polyfills with `usage` option: + +[/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-chrome-71-2/input.js] Added following core-js polyfill: + web.dom.iterable { "chrome":"71" } diff --git a/packages/babel-preset-env/test/debug-fixtures/usage-corejs2-none/in/in.js b/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-none-1/input.js similarity index 100% rename from packages/babel-preset-env/test/debug-fixtures/usage-corejs2-none/in/in.js rename to packages/babel-preset-env/test/fixtures/debug/usage-corejs2-none-1/input.js diff --git a/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-none-1/options.json b/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-none-1/options.json new file mode 100644 index 000000000000..bc84c3a017cd --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-none-1/options.json @@ -0,0 +1,19 @@ +{ + "validateLogs": true, + "ignoreOutput": true, + "presets": [ + [ + "env", + { + "debug": true, + "targets": { + "chrome": 52, + "firefox": 50, + "ie": 11 + }, + "useBuiltIns": "usage", + "corejs": 2 + } + ] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-none-1/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-none-1/stdout.txt new file mode 100644 index 000000000000..df82af414b8b --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-none-1/stdout.txt @@ -0,0 +1,48 @@ +@babel/preset-env: `DEBUG` option + +Using targets: +{ + "chrome": "52", + "firefox": "50", + "ie": "11" +} + +Using modules transform: auto + +Using plugins: + transform-template-literals { "ie":"11" } + transform-literals { "firefox":"50", "ie":"11" } + transform-function-name { "firefox":"50", "ie":"11" } + transform-arrow-functions { "ie":"11" } + transform-classes { "ie":"11" } + transform-object-super { "ie":"11" } + transform-shorthand-properties { "ie":"11" } + transform-duplicate-keys { "ie":"11" } + transform-computed-properties { "ie":"11" } + transform-for-of { "firefox":"50", "ie":"11" } + transform-sticky-regex { "ie":"11" } + transform-dotall-regex { "chrome":"52", "firefox":"50", "ie":"11" } + transform-unicode-regex { "ie":"11" } + transform-spread { "ie":"11" } + transform-parameters { "firefox":"50", "ie":"11" } + transform-destructuring { "firefox":"50", "ie":"11" } + transform-block-scoping { "firefox":"50", "ie":"11" } + transform-typeof-symbol { "ie":"11" } + transform-new-target { "ie":"11" } + transform-regenerator { "firefox":"50", "ie":"11" } + transform-exponentiation-operator { "firefox":"50", "ie":"11" } + transform-async-to-generator { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-async-generator-functions { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-object-rest-spread { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-unicode-property-regex { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-json-strings { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-optional-catch-binding { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-optional-chaining { "chrome":"52", "firefox":"50", "ie":"11" } + transform-named-capturing-groups-regex { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-nullish-coalescing-operator { "chrome":"52", "firefox":"50", "ie":"11" } + transform-modules-commonjs { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-dynamic-import { "chrome":"52", "firefox":"50", "ie":"11" } + +Using polyfills with `usage` option: + +[/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-none-1/input.js] Based on your code and targets, core-js polyfills were not added. diff --git a/packages/babel-preset-env/test/debug-fixtures/usage-corejs2-none/in/in2.js b/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-none-2/input.js similarity index 100% rename from packages/babel-preset-env/test/debug-fixtures/usage-corejs2-none/in/in2.js rename to packages/babel-preset-env/test/fixtures/debug/usage-corejs2-none-2/input.js diff --git a/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-none-2/options.json b/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-none-2/options.json new file mode 100644 index 000000000000..bc84c3a017cd --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-none-2/options.json @@ -0,0 +1,19 @@ +{ + "validateLogs": true, + "ignoreOutput": true, + "presets": [ + [ + "env", + { + "debug": true, + "targets": { + "chrome": 52, + "firefox": 50, + "ie": 11 + }, + "useBuiltIns": "usage", + "corejs": 2 + } + ] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-none-2/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-none-2/stdout.txt new file mode 100644 index 000000000000..6b0a947867aa --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-none-2/stdout.txt @@ -0,0 +1,48 @@ +@babel/preset-env: `DEBUG` option + +Using targets: +{ + "chrome": "52", + "firefox": "50", + "ie": "11" +} + +Using modules transform: auto + +Using plugins: + transform-template-literals { "ie":"11" } + transform-literals { "firefox":"50", "ie":"11" } + transform-function-name { "firefox":"50", "ie":"11" } + transform-arrow-functions { "ie":"11" } + transform-classes { "ie":"11" } + transform-object-super { "ie":"11" } + transform-shorthand-properties { "ie":"11" } + transform-duplicate-keys { "ie":"11" } + transform-computed-properties { "ie":"11" } + transform-for-of { "firefox":"50", "ie":"11" } + transform-sticky-regex { "ie":"11" } + transform-dotall-regex { "chrome":"52", "firefox":"50", "ie":"11" } + transform-unicode-regex { "ie":"11" } + transform-spread { "ie":"11" } + transform-parameters { "firefox":"50", "ie":"11" } + transform-destructuring { "firefox":"50", "ie":"11" } + transform-block-scoping { "firefox":"50", "ie":"11" } + transform-typeof-symbol { "ie":"11" } + transform-new-target { "ie":"11" } + transform-regenerator { "firefox":"50", "ie":"11" } + transform-exponentiation-operator { "firefox":"50", "ie":"11" } + transform-async-to-generator { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-async-generator-functions { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-object-rest-spread { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-unicode-property-regex { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-json-strings { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-optional-catch-binding { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-optional-chaining { "chrome":"52", "firefox":"50", "ie":"11" } + transform-named-capturing-groups-regex { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-nullish-coalescing-operator { "chrome":"52", "firefox":"50", "ie":"11" } + transform-modules-commonjs { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-dynamic-import { "chrome":"52", "firefox":"50", "ie":"11" } + +Using polyfills with `usage` option: + +[/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-none-2/input.js] Based on your code and targets, core-js polyfills were not added. diff --git a/packages/babel-preset-env/test/debug-fixtures/usage-corejs2-proposals/in/in.js b/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-proposals-1/input.js similarity index 100% rename from packages/babel-preset-env/test/debug-fixtures/usage-corejs2-proposals/in/in.js rename to packages/babel-preset-env/test/fixtures/debug/usage-corejs2-proposals-1/input.js diff --git a/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-proposals-1/options.json b/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-proposals-1/options.json new file mode 100644 index 000000000000..17e594c8c6f1 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-proposals-1/options.json @@ -0,0 +1,19 @@ +{ + "validateLogs": true, + "ignoreOutput": true, + "presets": [ + [ + "env", + { + "debug": true, + "targets": { + "chrome": 52, + "firefox": 50, + "ie": 11 + }, + "useBuiltIns": "usage", + "corejs": { "version": 2, "proposals": true } + } + ] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-proposals-1/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-proposals-1/stdout.txt new file mode 100644 index 000000000000..31f05aa5a3a2 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-proposals-1/stdout.txt @@ -0,0 +1,54 @@ +@babel/preset-env: `DEBUG` option + +Using targets: +{ + "chrome": "52", + "firefox": "50", + "ie": "11" +} + +Using modules transform: auto + +Using plugins: + transform-template-literals { "ie":"11" } + transform-literals { "firefox":"50", "ie":"11" } + transform-function-name { "firefox":"50", "ie":"11" } + transform-arrow-functions { "ie":"11" } + transform-classes { "ie":"11" } + transform-object-super { "ie":"11" } + transform-shorthand-properties { "ie":"11" } + transform-duplicate-keys { "ie":"11" } + transform-computed-properties { "ie":"11" } + transform-for-of { "firefox":"50", "ie":"11" } + transform-sticky-regex { "ie":"11" } + transform-dotall-regex { "chrome":"52", "firefox":"50", "ie":"11" } + transform-unicode-regex { "ie":"11" } + transform-spread { "ie":"11" } + transform-parameters { "firefox":"50", "ie":"11" } + transform-destructuring { "firefox":"50", "ie":"11" } + transform-block-scoping { "firefox":"50", "ie":"11" } + transform-typeof-symbol { "ie":"11" } + transform-new-target { "ie":"11" } + transform-regenerator { "firefox":"50", "ie":"11" } + transform-exponentiation-operator { "firefox":"50", "ie":"11" } + transform-async-to-generator { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-async-generator-functions { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-object-rest-spread { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-unicode-property-regex { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-json-strings { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-optional-catch-binding { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-optional-chaining { "chrome":"52", "firefox":"50", "ie":"11" } + transform-named-capturing-groups-regex { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-nullish-coalescing-operator { "chrome":"52", "firefox":"50", "ie":"11" } + transform-modules-commonjs { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-dynamic-import { "chrome":"52", "firefox":"50", "ie":"11" } + +Using polyfills with `usage` option: + +[/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-proposals-1/input.js] Added following core-js polyfills: + es6.object.to-string { "chrome":"52", "firefox":"50", "ie":"11" } + es6.promise { "ie":"11" } + es6.map { "firefox":"50", "ie":"11" } + es6.string.iterator { "ie":"11" } + es6.array.iterator { "ie":"11" } + web.dom.iterable { "chrome":"52", "firefox":"50", "ie":"11" } diff --git a/packages/babel-preset-env/test/debug-fixtures/usage-corejs2-proposals/in/in2.js b/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-proposals-2/input.js similarity index 100% rename from packages/babel-preset-env/test/debug-fixtures/usage-corejs2-proposals/in/in2.js rename to packages/babel-preset-env/test/fixtures/debug/usage-corejs2-proposals-2/input.js diff --git a/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-proposals-2/options.json b/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-proposals-2/options.json new file mode 100644 index 000000000000..17e594c8c6f1 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-proposals-2/options.json @@ -0,0 +1,19 @@ +{ + "validateLogs": true, + "ignoreOutput": true, + "presets": [ + [ + "env", + { + "debug": true, + "targets": { + "chrome": 52, + "firefox": 50, + "ie": 11 + }, + "useBuiltIns": "usage", + "corejs": { "version": 2, "proposals": true } + } + ] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-proposals-2/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-proposals-2/stdout.txt new file mode 100644 index 000000000000..64914fe44383 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-proposals-2/stdout.txt @@ -0,0 +1,51 @@ +@babel/preset-env: `DEBUG` option + +Using targets: +{ + "chrome": "52", + "firefox": "50", + "ie": "11" +} + +Using modules transform: auto + +Using plugins: + transform-template-literals { "ie":"11" } + transform-literals { "firefox":"50", "ie":"11" } + transform-function-name { "firefox":"50", "ie":"11" } + transform-arrow-functions { "ie":"11" } + transform-classes { "ie":"11" } + transform-object-super { "ie":"11" } + transform-shorthand-properties { "ie":"11" } + transform-duplicate-keys { "ie":"11" } + transform-computed-properties { "ie":"11" } + transform-for-of { "firefox":"50", "ie":"11" } + transform-sticky-regex { "ie":"11" } + transform-dotall-regex { "chrome":"52", "firefox":"50", "ie":"11" } + transform-unicode-regex { "ie":"11" } + transform-spread { "ie":"11" } + transform-parameters { "firefox":"50", "ie":"11" } + transform-destructuring { "firefox":"50", "ie":"11" } + transform-block-scoping { "firefox":"50", "ie":"11" } + transform-typeof-symbol { "ie":"11" } + transform-new-target { "ie":"11" } + transform-regenerator { "firefox":"50", "ie":"11" } + transform-exponentiation-operator { "firefox":"50", "ie":"11" } + transform-async-to-generator { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-async-generator-functions { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-object-rest-spread { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-unicode-property-regex { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-json-strings { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-optional-catch-binding { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-optional-chaining { "chrome":"52", "firefox":"50", "ie":"11" } + transform-named-capturing-groups-regex { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-nullish-coalescing-operator { "chrome":"52", "firefox":"50", "ie":"11" } + transform-modules-commonjs { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-dynamic-import { "chrome":"52", "firefox":"50", "ie":"11" } + +Using polyfills with `usage` option: + +[/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-proposals-2/input.js] Added following core-js polyfill: + web.dom.iterable { "chrome":"52", "firefox":"50", "ie":"11" } + +[/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-proposals-2/input.js] Based on your code and targets, added regenerator-runtime. diff --git a/packages/babel-preset-env/test/debug-fixtures/usage-corejs2-shippedProposals/in/in.js b/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-proposals-chrome-71-1/input.js similarity index 100% rename from packages/babel-preset-env/test/debug-fixtures/usage-corejs2-shippedProposals/in/in.js rename to packages/babel-preset-env/test/fixtures/debug/usage-corejs2-proposals-chrome-71-1/input.js diff --git a/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-proposals-chrome-71-1/options.json b/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-proposals-chrome-71-1/options.json new file mode 100644 index 000000000000..7239e5721426 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-proposals-chrome-71-1/options.json @@ -0,0 +1,17 @@ +{ + "validateLogs": true, + "ignoreOutput": true, + "presets": [ + [ + "env", + { + "debug": true, + "targets": { + "chrome": 71 + }, + "useBuiltIns": "usage", + "corejs": { "version": 2, "proposals": true } + } + ] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-proposals-chrome-71-1/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-proposals-chrome-71-1/stdout.txt new file mode 100644 index 000000000000..5b846ecf9295 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-proposals-chrome-71-1/stdout.txt @@ -0,0 +1,23 @@ +@babel/preset-env: `DEBUG` option + +Using targets: +{ + "chrome": "71" +} + +Using modules transform: auto + +Using plugins: + syntax-async-generators { "chrome":"71" } + syntax-object-rest-spread { "chrome":"71" } + syntax-json-strings { "chrome":"71" } + syntax-optional-catch-binding { "chrome":"71" } + proposal-optional-chaining { "chrome":"71" } + proposal-nullish-coalescing-operator { "chrome":"71" } + transform-modules-commonjs { "chrome":"71" } + proposal-dynamic-import { "chrome":"71" } + +Using polyfills with `usage` option: + +[/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-proposals-chrome-71-1/input.js] Added following core-js polyfill: + web.dom.iterable { "chrome":"71" } diff --git a/packages/babel-preset-env/test/debug-fixtures/usage-corejs2-shippedProposals/in/in2.js b/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-proposals-chrome-71-2/input.js similarity index 100% rename from packages/babel-preset-env/test/debug-fixtures/usage-corejs2-shippedProposals/in/in2.js rename to packages/babel-preset-env/test/fixtures/debug/usage-corejs2-proposals-chrome-71-2/input.js diff --git a/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-proposals-chrome-71-2/options.json b/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-proposals-chrome-71-2/options.json new file mode 100644 index 000000000000..7239e5721426 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-proposals-chrome-71-2/options.json @@ -0,0 +1,17 @@ +{ + "validateLogs": true, + "ignoreOutput": true, + "presets": [ + [ + "env", + { + "debug": true, + "targets": { + "chrome": 71 + }, + "useBuiltIns": "usage", + "corejs": { "version": 2, "proposals": true } + } + ] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-proposals-chrome-71-2/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-proposals-chrome-71-2/stdout.txt new file mode 100644 index 000000000000..28e1952f4c35 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-proposals-chrome-71-2/stdout.txt @@ -0,0 +1,23 @@ +@babel/preset-env: `DEBUG` option + +Using targets: +{ + "chrome": "71" +} + +Using modules transform: auto + +Using plugins: + syntax-async-generators { "chrome":"71" } + syntax-object-rest-spread { "chrome":"71" } + syntax-json-strings { "chrome":"71" } + syntax-optional-catch-binding { "chrome":"71" } + proposal-optional-chaining { "chrome":"71" } + proposal-nullish-coalescing-operator { "chrome":"71" } + transform-modules-commonjs { "chrome":"71" } + proposal-dynamic-import { "chrome":"71" } + +Using polyfills with `usage` option: + +[/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-proposals-chrome-71-2/input.js] Added following core-js polyfill: + web.dom.iterable { "chrome":"71" } diff --git a/packages/babel-preset-env/test/debug-fixtures/usage-corejs2/in/in.js b/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-shippedProposals-1/input.js similarity index 100% rename from packages/babel-preset-env/test/debug-fixtures/usage-corejs2/in/in.js rename to packages/babel-preset-env/test/fixtures/debug/usage-corejs2-shippedProposals-1/input.js diff --git a/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-shippedProposals-1/options.json b/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-shippedProposals-1/options.json new file mode 100644 index 000000000000..9069c3b78807 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-shippedProposals-1/options.json @@ -0,0 +1,20 @@ +{ + "validateLogs": true, + "ignoreOutput": true, + "presets": [ + [ + "env", + { + "debug": true, + "targets": { + "chrome": 52, + "firefox": 50, + "ie": 11 + }, + "shippedProposals": true, + "useBuiltIns": "usage", + "corejs": 2 + } + ] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-shippedProposals-1/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-shippedProposals-1/stdout.txt new file mode 100644 index 000000000000..a937819d69c5 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-shippedProposals-1/stdout.txt @@ -0,0 +1,54 @@ +@babel/preset-env: `DEBUG` option + +Using targets: +{ + "chrome": "52", + "firefox": "50", + "ie": "11" +} + +Using modules transform: auto + +Using plugins: + transform-template-literals { "ie":"11" } + transform-literals { "firefox":"50", "ie":"11" } + transform-function-name { "firefox":"50", "ie":"11" } + transform-arrow-functions { "ie":"11" } + transform-classes { "ie":"11" } + transform-object-super { "ie":"11" } + transform-shorthand-properties { "ie":"11" } + transform-duplicate-keys { "ie":"11" } + transform-computed-properties { "ie":"11" } + transform-for-of { "firefox":"50", "ie":"11" } + transform-sticky-regex { "ie":"11" } + transform-dotall-regex { "chrome":"52", "firefox":"50", "ie":"11" } + transform-unicode-regex { "ie":"11" } + transform-spread { "ie":"11" } + transform-parameters { "firefox":"50", "ie":"11" } + transform-destructuring { "firefox":"50", "ie":"11" } + transform-block-scoping { "firefox":"50", "ie":"11" } + transform-typeof-symbol { "ie":"11" } + transform-new-target { "ie":"11" } + transform-regenerator { "firefox":"50", "ie":"11" } + transform-exponentiation-operator { "firefox":"50", "ie":"11" } + transform-async-to-generator { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-async-generator-functions { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-object-rest-spread { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-unicode-property-regex { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-json-strings { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-optional-catch-binding { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-optional-chaining { "chrome":"52", "firefox":"50", "ie":"11" } + transform-named-capturing-groups-regex { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-nullish-coalescing-operator { "chrome":"52", "firefox":"50", "ie":"11" } + transform-modules-commonjs { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-dynamic-import { "chrome":"52", "firefox":"50", "ie":"11" } + +Using polyfills with `usage` option: + +[/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-shippedProposals-1/input.js] Added following core-js polyfills: + es6.object.to-string { "chrome":"52", "firefox":"50", "ie":"11" } + es6.promise { "ie":"11" } + es6.map { "firefox":"50", "ie":"11" } + es6.string.iterator { "ie":"11" } + es6.array.iterator { "ie":"11" } + web.dom.iterable { "chrome":"52", "firefox":"50", "ie":"11" } diff --git a/packages/babel-preset-env/test/debug-fixtures/usage-corejs2/in/in2.js b/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-shippedProposals-2/input.js similarity index 100% rename from packages/babel-preset-env/test/debug-fixtures/usage-corejs2/in/in2.js rename to packages/babel-preset-env/test/fixtures/debug/usage-corejs2-shippedProposals-2/input.js diff --git a/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-shippedProposals-2/options.json b/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-shippedProposals-2/options.json new file mode 100644 index 000000000000..9069c3b78807 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-shippedProposals-2/options.json @@ -0,0 +1,20 @@ +{ + "validateLogs": true, + "ignoreOutput": true, + "presets": [ + [ + "env", + { + "debug": true, + "targets": { + "chrome": 52, + "firefox": 50, + "ie": 11 + }, + "shippedProposals": true, + "useBuiltIns": "usage", + "corejs": 2 + } + ] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-shippedProposals-2/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-shippedProposals-2/stdout.txt new file mode 100644 index 000000000000..8fdaecacb2dd --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-shippedProposals-2/stdout.txt @@ -0,0 +1,51 @@ +@babel/preset-env: `DEBUG` option + +Using targets: +{ + "chrome": "52", + "firefox": "50", + "ie": "11" +} + +Using modules transform: auto + +Using plugins: + transform-template-literals { "ie":"11" } + transform-literals { "firefox":"50", "ie":"11" } + transform-function-name { "firefox":"50", "ie":"11" } + transform-arrow-functions { "ie":"11" } + transform-classes { "ie":"11" } + transform-object-super { "ie":"11" } + transform-shorthand-properties { "ie":"11" } + transform-duplicate-keys { "ie":"11" } + transform-computed-properties { "ie":"11" } + transform-for-of { "firefox":"50", "ie":"11" } + transform-sticky-regex { "ie":"11" } + transform-dotall-regex { "chrome":"52", "firefox":"50", "ie":"11" } + transform-unicode-regex { "ie":"11" } + transform-spread { "ie":"11" } + transform-parameters { "firefox":"50", "ie":"11" } + transform-destructuring { "firefox":"50", "ie":"11" } + transform-block-scoping { "firefox":"50", "ie":"11" } + transform-typeof-symbol { "ie":"11" } + transform-new-target { "ie":"11" } + transform-regenerator { "firefox":"50", "ie":"11" } + transform-exponentiation-operator { "firefox":"50", "ie":"11" } + transform-async-to-generator { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-async-generator-functions { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-object-rest-spread { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-unicode-property-regex { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-json-strings { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-optional-catch-binding { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-optional-chaining { "chrome":"52", "firefox":"50", "ie":"11" } + transform-named-capturing-groups-regex { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-nullish-coalescing-operator { "chrome":"52", "firefox":"50", "ie":"11" } + transform-modules-commonjs { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-dynamic-import { "chrome":"52", "firefox":"50", "ie":"11" } + +Using polyfills with `usage` option: + +[/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-shippedProposals-2/input.js] Added following core-js polyfill: + web.dom.iterable { "chrome":"52", "firefox":"50", "ie":"11" } + +[/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-shippedProposals-2/input.js] Based on your code and targets, added regenerator-runtime. diff --git a/packages/babel-preset-env/test/debug-fixtures/usage-corejs2-with-import/in/in.js b/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-with-import/input.mjs similarity index 100% rename from packages/babel-preset-env/test/debug-fixtures/usage-corejs2-with-import/in/in.js rename to packages/babel-preset-env/test/fixtures/debug/usage-corejs2-with-import/input.mjs diff --git a/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-with-import/options.json b/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-with-import/options.json new file mode 100644 index 000000000000..c1118296ce3a --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-with-import/options.json @@ -0,0 +1,17 @@ +{ + "validateLogs": true, + "ignoreOutput": true, + "presets": [ + [ + "env", + { + "debug": true, + "targets": { + "chrome": 55 + }, + "useBuiltIns": "usage", + "corejs": 2 + } + ] + ] +} diff --git a/packages/babel-preset-env/test/debug-fixtures/usage-corejs2-with-import/stderr.txt b/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-with-import/stderr.txt similarity index 100% rename from packages/babel-preset-env/test/debug-fixtures/usage-corejs2-with-import/stderr.txt rename to packages/babel-preset-env/test/fixtures/debug/usage-corejs2-with-import/stderr.txt diff --git a/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-with-import/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-with-import/stdout.txt new file mode 100644 index 000000000000..81f3687e8dac --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-with-import/stdout.txt @@ -0,0 +1,25 @@ +@babel/preset-env: `DEBUG` option + +Using targets: +{ + "chrome": "55" +} + +Using modules transform: auto + +Using plugins: + transform-dotall-regex { "chrome":"55" } + proposal-async-generator-functions { "chrome":"55" } + proposal-object-rest-spread { "chrome":"55" } + proposal-unicode-property-regex { "chrome":"55" } + proposal-json-strings { "chrome":"55" } + proposal-optional-catch-binding { "chrome":"55" } + proposal-optional-chaining { "chrome":"55" } + transform-named-capturing-groups-regex { "chrome":"55" } + proposal-nullish-coalescing-operator { "chrome":"55" } + transform-modules-commonjs { "chrome":"55" } + proposal-dynamic-import { "chrome":"55" } + +Using polyfills with `usage` option: + +[/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-with-import/input.mjs] Based on your code and targets, core-js polyfills were not added. diff --git a/packages/babel-preset-env/test/debug-fixtures/usage-corejs3-chrome-71/in/in.js b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-1/input.js similarity index 100% rename from packages/babel-preset-env/test/debug-fixtures/usage-corejs3-chrome-71/in/in.js rename to packages/babel-preset-env/test/fixtures/debug/usage-corejs3-1/input.js diff --git a/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-1/options.json b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-1/options.json new file mode 100644 index 000000000000..64cd6071b99d --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-1/options.json @@ -0,0 +1,19 @@ +{ + "validateLogs": true, + "ignoreOutput": true, + "presets": [ + [ + "env", + { + "debug": true, + "targets": { + "chrome": 52, + "firefox": 50, + "ie": 11 + }, + "useBuiltIns": "usage", + "corejs": 3 + } + ] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-1/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-1/stdout.txt new file mode 100644 index 000000000000..22d4c56a3256 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-1/stdout.txt @@ -0,0 +1,55 @@ +@babel/preset-env: `DEBUG` option + +Using targets: +{ + "chrome": "52", + "firefox": "50", + "ie": "11" +} + +Using modules transform: auto + +Using plugins: + transform-template-literals { "ie":"11" } + transform-literals { "firefox":"50", "ie":"11" } + transform-function-name { "firefox":"50", "ie":"11" } + transform-arrow-functions { "ie":"11" } + transform-classes { "ie":"11" } + transform-object-super { "ie":"11" } + transform-shorthand-properties { "ie":"11" } + transform-duplicate-keys { "ie":"11" } + transform-computed-properties { "ie":"11" } + transform-for-of { "firefox":"50", "ie":"11" } + transform-sticky-regex { "ie":"11" } + transform-dotall-regex { "chrome":"52", "firefox":"50", "ie":"11" } + transform-unicode-regex { "ie":"11" } + transform-spread { "ie":"11" } + transform-parameters { "firefox":"50", "ie":"11" } + transform-destructuring { "firefox":"50", "ie":"11" } + transform-block-scoping { "firefox":"50", "ie":"11" } + transform-typeof-symbol { "ie":"11" } + transform-new-target { "ie":"11" } + transform-regenerator { "firefox":"50", "ie":"11" } + transform-exponentiation-operator { "firefox":"50", "ie":"11" } + transform-async-to-generator { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-async-generator-functions { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-object-rest-spread { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-unicode-property-regex { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-json-strings { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-optional-catch-binding { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-optional-chaining { "chrome":"52", "firefox":"50", "ie":"11" } + transform-named-capturing-groups-regex { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-nullish-coalescing-operator { "chrome":"52", "firefox":"50", "ie":"11" } + transform-modules-commonjs { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-dynamic-import { "chrome":"52", "firefox":"50", "ie":"11" } + +Using polyfills with `usage` option: + +[/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-1/input.js] Added following core-js polyfills: + es.array.iterator { "chrome":"52", "firefox":"50", "ie":"11" } + es.map { "firefox":"50", "ie":"11" } + es.object.to-string { "firefox":"50", "ie":"11" } + es.promise { "chrome":"52", "firefox":"50", "ie":"11" } + es.string.iterator { "ie":"11" } + web.dom-collections.iterator { "chrome":"52", "firefox":"50", "ie":"11" } + web.queue-microtask { "chrome":"52", "firefox":"50", "ie":"11" } diff --git a/packages/babel-preset-env/test/debug-fixtures/usage-corejs3-chrome-71/in/in2.js b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-2/input.js similarity index 100% rename from packages/babel-preset-env/test/debug-fixtures/usage-corejs3-chrome-71/in/in2.js rename to packages/babel-preset-env/test/fixtures/debug/usage-corejs3-2/input.js diff --git a/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-2/options.json b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-2/options.json new file mode 100644 index 000000000000..64cd6071b99d --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-2/options.json @@ -0,0 +1,19 @@ +{ + "validateLogs": true, + "ignoreOutput": true, + "presets": [ + [ + "env", + { + "debug": true, + "targets": { + "chrome": 52, + "firefox": 50, + "ie": 11 + }, + "useBuiltIns": "usage", + "corejs": 3 + } + ] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-2/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-2/stdout.txt new file mode 100644 index 000000000000..4cce46fe4c30 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-2/stdout.txt @@ -0,0 +1,53 @@ +@babel/preset-env: `DEBUG` option + +Using targets: +{ + "chrome": "52", + "firefox": "50", + "ie": "11" +} + +Using modules transform: auto + +Using plugins: + transform-template-literals { "ie":"11" } + transform-literals { "firefox":"50", "ie":"11" } + transform-function-name { "firefox":"50", "ie":"11" } + transform-arrow-functions { "ie":"11" } + transform-classes { "ie":"11" } + transform-object-super { "ie":"11" } + transform-shorthand-properties { "ie":"11" } + transform-duplicate-keys { "ie":"11" } + transform-computed-properties { "ie":"11" } + transform-for-of { "firefox":"50", "ie":"11" } + transform-sticky-regex { "ie":"11" } + transform-dotall-regex { "chrome":"52", "firefox":"50", "ie":"11" } + transform-unicode-regex { "ie":"11" } + transform-spread { "ie":"11" } + transform-parameters { "firefox":"50", "ie":"11" } + transform-destructuring { "firefox":"50", "ie":"11" } + transform-block-scoping { "firefox":"50", "ie":"11" } + transform-typeof-symbol { "ie":"11" } + transform-new-target { "ie":"11" } + transform-regenerator { "firefox":"50", "ie":"11" } + transform-exponentiation-operator { "firefox":"50", "ie":"11" } + transform-async-to-generator { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-async-generator-functions { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-object-rest-spread { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-unicode-property-regex { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-json-strings { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-optional-catch-binding { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-optional-chaining { "chrome":"52", "firefox":"50", "ie":"11" } + transform-named-capturing-groups-regex { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-nullish-coalescing-operator { "chrome":"52", "firefox":"50", "ie":"11" } + transform-modules-commonjs { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-dynamic-import { "chrome":"52", "firefox":"50", "ie":"11" } + +Using polyfills with `usage` option: + +[/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-2/input.js] Added following core-js polyfills: + es.array.iterator { "chrome":"52", "firefox":"50", "ie":"11" } + es.string.iterator { "ie":"11" } + web.dom-collections.iterator { "chrome":"52", "firefox":"50", "ie":"11" } + +[/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-2/input.js] Based on your code and targets, added regenerator-runtime. diff --git a/packages/babel-preset-env/test/debug-fixtures/usage-corejs3-proposals-chrome-71/in/in.js b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-chrome-71-1/input.js similarity index 100% rename from packages/babel-preset-env/test/debug-fixtures/usage-corejs3-proposals-chrome-71/in/in.js rename to packages/babel-preset-env/test/fixtures/debug/usage-corejs3-chrome-71-1/input.js diff --git a/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-chrome-71-1/options.json b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-chrome-71-1/options.json new file mode 100644 index 000000000000..affda23d0ad5 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-chrome-71-1/options.json @@ -0,0 +1,17 @@ +{ + "validateLogs": true, + "ignoreOutput": true, + "presets": [ + [ + "env", + { + "debug": true, + "targets": { + "chrome": 71 + }, + "useBuiltIns": "usage", + "corejs": 3 + } + ] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-chrome-71-1/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-chrome-71-1/stdout.txt new file mode 100644 index 000000000000..2cbcabd835b9 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-chrome-71-1/stdout.txt @@ -0,0 +1,22 @@ +@babel/preset-env: `DEBUG` option + +Using targets: +{ + "chrome": "71" +} + +Using modules transform: auto + +Using plugins: + syntax-async-generators { "chrome":"71" } + syntax-object-rest-spread { "chrome":"71" } + syntax-json-strings { "chrome":"71" } + syntax-optional-catch-binding { "chrome":"71" } + proposal-optional-chaining { "chrome":"71" } + proposal-nullish-coalescing-operator { "chrome":"71" } + transform-modules-commonjs { "chrome":"71" } + proposal-dynamic-import { "chrome":"71" } + +Using polyfills with `usage` option: + +[/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-chrome-71-1/input.js] Based on your code and targets, core-js polyfills were not added. diff --git a/packages/babel-preset-env/test/debug-fixtures/usage-corejs3-proposals-chrome-71/in/in2.js b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-chrome-71-2/input.js similarity index 100% rename from packages/babel-preset-env/test/debug-fixtures/usage-corejs3-proposals-chrome-71/in/in2.js rename to packages/babel-preset-env/test/fixtures/debug/usage-corejs3-chrome-71-2/input.js diff --git a/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-chrome-71-2/options.json b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-chrome-71-2/options.json new file mode 100644 index 000000000000..affda23d0ad5 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-chrome-71-2/options.json @@ -0,0 +1,17 @@ +{ + "validateLogs": true, + "ignoreOutput": true, + "presets": [ + [ + "env", + { + "debug": true, + "targets": { + "chrome": 71 + }, + "useBuiltIns": "usage", + "corejs": 3 + } + ] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-chrome-71-2/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-chrome-71-2/stdout.txt new file mode 100644 index 000000000000..722599c9cb68 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-chrome-71-2/stdout.txt @@ -0,0 +1,22 @@ +@babel/preset-env: `DEBUG` option + +Using targets: +{ + "chrome": "71" +} + +Using modules transform: auto + +Using plugins: + syntax-async-generators { "chrome":"71" } + syntax-object-rest-spread { "chrome":"71" } + syntax-json-strings { "chrome":"71" } + syntax-optional-catch-binding { "chrome":"71" } + proposal-optional-chaining { "chrome":"71" } + proposal-nullish-coalescing-operator { "chrome":"71" } + transform-modules-commonjs { "chrome":"71" } + proposal-dynamic-import { "chrome":"71" } + +Using polyfills with `usage` option: + +[/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-chrome-71-2/input.js] Based on your code and targets, core-js polyfills were not added. diff --git a/packages/babel-preset-env/test/debug-fixtures/usage-corejs3-none/in/in.js b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-none-1/input.js similarity index 100% rename from packages/babel-preset-env/test/debug-fixtures/usage-corejs3-none/in/in.js rename to packages/babel-preset-env/test/fixtures/debug/usage-corejs3-none-1/input.js diff --git a/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-none-1/options.json b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-none-1/options.json new file mode 100644 index 000000000000..64cd6071b99d --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-none-1/options.json @@ -0,0 +1,19 @@ +{ + "validateLogs": true, + "ignoreOutput": true, + "presets": [ + [ + "env", + { + "debug": true, + "targets": { + "chrome": 52, + "firefox": 50, + "ie": 11 + }, + "useBuiltIns": "usage", + "corejs": 3 + } + ] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-none-1/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-none-1/stdout.txt new file mode 100644 index 000000000000..c75552f22ea2 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-none-1/stdout.txt @@ -0,0 +1,48 @@ +@babel/preset-env: `DEBUG` option + +Using targets: +{ + "chrome": "52", + "firefox": "50", + "ie": "11" +} + +Using modules transform: auto + +Using plugins: + transform-template-literals { "ie":"11" } + transform-literals { "firefox":"50", "ie":"11" } + transform-function-name { "firefox":"50", "ie":"11" } + transform-arrow-functions { "ie":"11" } + transform-classes { "ie":"11" } + transform-object-super { "ie":"11" } + transform-shorthand-properties { "ie":"11" } + transform-duplicate-keys { "ie":"11" } + transform-computed-properties { "ie":"11" } + transform-for-of { "firefox":"50", "ie":"11" } + transform-sticky-regex { "ie":"11" } + transform-dotall-regex { "chrome":"52", "firefox":"50", "ie":"11" } + transform-unicode-regex { "ie":"11" } + transform-spread { "ie":"11" } + transform-parameters { "firefox":"50", "ie":"11" } + transform-destructuring { "firefox":"50", "ie":"11" } + transform-block-scoping { "firefox":"50", "ie":"11" } + transform-typeof-symbol { "ie":"11" } + transform-new-target { "ie":"11" } + transform-regenerator { "firefox":"50", "ie":"11" } + transform-exponentiation-operator { "firefox":"50", "ie":"11" } + transform-async-to-generator { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-async-generator-functions { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-object-rest-spread { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-unicode-property-regex { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-json-strings { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-optional-catch-binding { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-optional-chaining { "chrome":"52", "firefox":"50", "ie":"11" } + transform-named-capturing-groups-regex { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-nullish-coalescing-operator { "chrome":"52", "firefox":"50", "ie":"11" } + transform-modules-commonjs { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-dynamic-import { "chrome":"52", "firefox":"50", "ie":"11" } + +Using polyfills with `usage` option: + +[/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-none-1/input.js] Based on your code and targets, core-js polyfills were not added. diff --git a/packages/babel-preset-env/test/debug-fixtures/usage-corejs3-none/in/in2.js b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-none-2/input.js similarity index 100% rename from packages/babel-preset-env/test/debug-fixtures/usage-corejs3-none/in/in2.js rename to packages/babel-preset-env/test/fixtures/debug/usage-corejs3-none-2/input.js diff --git a/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-none-2/options.json b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-none-2/options.json new file mode 100644 index 000000000000..64cd6071b99d --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-none-2/options.json @@ -0,0 +1,19 @@ +{ + "validateLogs": true, + "ignoreOutput": true, + "presets": [ + [ + "env", + { + "debug": true, + "targets": { + "chrome": 52, + "firefox": 50, + "ie": 11 + }, + "useBuiltIns": "usage", + "corejs": 3 + } + ] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-none-2/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-none-2/stdout.txt new file mode 100644 index 000000000000..dc523ad918ee --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-none-2/stdout.txt @@ -0,0 +1,48 @@ +@babel/preset-env: `DEBUG` option + +Using targets: +{ + "chrome": "52", + "firefox": "50", + "ie": "11" +} + +Using modules transform: auto + +Using plugins: + transform-template-literals { "ie":"11" } + transform-literals { "firefox":"50", "ie":"11" } + transform-function-name { "firefox":"50", "ie":"11" } + transform-arrow-functions { "ie":"11" } + transform-classes { "ie":"11" } + transform-object-super { "ie":"11" } + transform-shorthand-properties { "ie":"11" } + transform-duplicate-keys { "ie":"11" } + transform-computed-properties { "ie":"11" } + transform-for-of { "firefox":"50", "ie":"11" } + transform-sticky-regex { "ie":"11" } + transform-dotall-regex { "chrome":"52", "firefox":"50", "ie":"11" } + transform-unicode-regex { "ie":"11" } + transform-spread { "ie":"11" } + transform-parameters { "firefox":"50", "ie":"11" } + transform-destructuring { "firefox":"50", "ie":"11" } + transform-block-scoping { "firefox":"50", "ie":"11" } + transform-typeof-symbol { "ie":"11" } + transform-new-target { "ie":"11" } + transform-regenerator { "firefox":"50", "ie":"11" } + transform-exponentiation-operator { "firefox":"50", "ie":"11" } + transform-async-to-generator { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-async-generator-functions { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-object-rest-spread { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-unicode-property-regex { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-json-strings { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-optional-catch-binding { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-optional-chaining { "chrome":"52", "firefox":"50", "ie":"11" } + transform-named-capturing-groups-regex { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-nullish-coalescing-operator { "chrome":"52", "firefox":"50", "ie":"11" } + transform-modules-commonjs { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-dynamic-import { "chrome":"52", "firefox":"50", "ie":"11" } + +Using polyfills with `usage` option: + +[/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-none-2/input.js] Based on your code and targets, core-js polyfills were not added. diff --git a/packages/babel-preset-env/test/debug-fixtures/usage-corejs3-proposals/in/in.js b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-proposals-1/input.js similarity index 100% rename from packages/babel-preset-env/test/debug-fixtures/usage-corejs3-proposals/in/in.js rename to packages/babel-preset-env/test/fixtures/debug/usage-corejs3-proposals-1/input.js diff --git a/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-proposals-1/options.json b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-proposals-1/options.json new file mode 100644 index 000000000000..06974bf0dca0 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-proposals-1/options.json @@ -0,0 +1,19 @@ +{ + "validateLogs": true, + "ignoreOutput": true, + "presets": [ + [ + "env", + { + "debug": true, + "targets": { + "chrome": 52, + "firefox": 50, + "ie": 11 + }, + "useBuiltIns": "usage", + "corejs": { "version": 3, "proposals": true } + } + ] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-proposals-1/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-proposals-1/stdout.txt new file mode 100644 index 000000000000..15abd57b6a9d --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-proposals-1/stdout.txt @@ -0,0 +1,71 @@ +@babel/preset-env: `DEBUG` option + +Using targets: +{ + "chrome": "52", + "firefox": "50", + "ie": "11" +} + +Using modules transform: auto + +Using plugins: + transform-template-literals { "ie":"11" } + transform-literals { "firefox":"50", "ie":"11" } + transform-function-name { "firefox":"50", "ie":"11" } + transform-arrow-functions { "ie":"11" } + transform-classes { "ie":"11" } + transform-object-super { "ie":"11" } + transform-shorthand-properties { "ie":"11" } + transform-duplicate-keys { "ie":"11" } + transform-computed-properties { "ie":"11" } + transform-for-of { "firefox":"50", "ie":"11" } + transform-sticky-regex { "ie":"11" } + transform-dotall-regex { "chrome":"52", "firefox":"50", "ie":"11" } + transform-unicode-regex { "ie":"11" } + transform-spread { "ie":"11" } + transform-parameters { "firefox":"50", "ie":"11" } + transform-destructuring { "firefox":"50", "ie":"11" } + transform-block-scoping { "firefox":"50", "ie":"11" } + transform-typeof-symbol { "ie":"11" } + transform-new-target { "ie":"11" } + transform-regenerator { "firefox":"50", "ie":"11" } + transform-exponentiation-operator { "firefox":"50", "ie":"11" } + transform-async-to-generator { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-async-generator-functions { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-object-rest-spread { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-unicode-property-regex { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-json-strings { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-optional-catch-binding { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-optional-chaining { "chrome":"52", "firefox":"50", "ie":"11" } + transform-named-capturing-groups-regex { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-nullish-coalescing-operator { "chrome":"52", "firefox":"50", "ie":"11" } + transform-modules-commonjs { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-dynamic-import { "chrome":"52", "firefox":"50", "ie":"11" } + +Using polyfills with `usage` option: + +[/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-proposals-1/input.js] Added following core-js polyfills: + es.array.iterator { "chrome":"52", "firefox":"50", "ie":"11" } + es.map { "firefox":"50", "ie":"11" } + es.object.to-string { "firefox":"50", "ie":"11" } + es.promise { "chrome":"52", "firefox":"50", "ie":"11" } + es.string.iterator { "ie":"11" } + esnext.global-this { "chrome":"52", "firefox":"50", "ie":"11" } + esnext.map.delete-all { "chrome":"52", "firefox":"50", "ie":"11" } + esnext.map.every { "chrome":"52", "firefox":"50", "ie":"11" } + esnext.map.filter { "chrome":"52", "firefox":"50", "ie":"11" } + esnext.map.find { "chrome":"52", "firefox":"50", "ie":"11" } + esnext.map.find-key { "chrome":"52", "firefox":"50", "ie":"11" } + esnext.map.includes { "chrome":"52", "firefox":"50", "ie":"11" } + esnext.map.key-of { "chrome":"52", "firefox":"50", "ie":"11" } + esnext.map.map-keys { "chrome":"52", "firefox":"50", "ie":"11" } + esnext.map.map-values { "chrome":"52", "firefox":"50", "ie":"11" } + esnext.map.merge { "chrome":"52", "firefox":"50", "ie":"11" } + esnext.map.reduce { "chrome":"52", "firefox":"50", "ie":"11" } + esnext.map.some { "chrome":"52", "firefox":"50", "ie":"11" } + esnext.map.update { "chrome":"52", "firefox":"50", "ie":"11" } + esnext.observable { "chrome":"52", "firefox":"50", "ie":"11" } + esnext.symbol.observable { "chrome":"52", "firefox":"50", "ie":"11" } + web.dom-collections.iterator { "chrome":"52", "firefox":"50", "ie":"11" } + web.queue-microtask { "chrome":"52", "firefox":"50", "ie":"11" } diff --git a/packages/babel-preset-env/test/debug-fixtures/usage-corejs3-proposals/in/in2.js b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-proposals-2/input.js similarity index 100% rename from packages/babel-preset-env/test/debug-fixtures/usage-corejs3-proposals/in/in2.js rename to packages/babel-preset-env/test/fixtures/debug/usage-corejs3-proposals-2/input.js diff --git a/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-proposals-2/options.json b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-proposals-2/options.json new file mode 100644 index 000000000000..06974bf0dca0 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-proposals-2/options.json @@ -0,0 +1,19 @@ +{ + "validateLogs": true, + "ignoreOutput": true, + "presets": [ + [ + "env", + { + "debug": true, + "targets": { + "chrome": 52, + "firefox": 50, + "ie": 11 + }, + "useBuiltIns": "usage", + "corejs": { "version": 3, "proposals": true } + } + ] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-proposals-2/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-proposals-2/stdout.txt new file mode 100644 index 000000000000..d59dec1f9b70 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-proposals-2/stdout.txt @@ -0,0 +1,53 @@ +@babel/preset-env: `DEBUG` option + +Using targets: +{ + "chrome": "52", + "firefox": "50", + "ie": "11" +} + +Using modules transform: auto + +Using plugins: + transform-template-literals { "ie":"11" } + transform-literals { "firefox":"50", "ie":"11" } + transform-function-name { "firefox":"50", "ie":"11" } + transform-arrow-functions { "ie":"11" } + transform-classes { "ie":"11" } + transform-object-super { "ie":"11" } + transform-shorthand-properties { "ie":"11" } + transform-duplicate-keys { "ie":"11" } + transform-computed-properties { "ie":"11" } + transform-for-of { "firefox":"50", "ie":"11" } + transform-sticky-regex { "ie":"11" } + transform-dotall-regex { "chrome":"52", "firefox":"50", "ie":"11" } + transform-unicode-regex { "ie":"11" } + transform-spread { "ie":"11" } + transform-parameters { "firefox":"50", "ie":"11" } + transform-destructuring { "firefox":"50", "ie":"11" } + transform-block-scoping { "firefox":"50", "ie":"11" } + transform-typeof-symbol { "ie":"11" } + transform-new-target { "ie":"11" } + transform-regenerator { "firefox":"50", "ie":"11" } + transform-exponentiation-operator { "firefox":"50", "ie":"11" } + transform-async-to-generator { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-async-generator-functions { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-object-rest-spread { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-unicode-property-regex { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-json-strings { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-optional-catch-binding { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-optional-chaining { "chrome":"52", "firefox":"50", "ie":"11" } + transform-named-capturing-groups-regex { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-nullish-coalescing-operator { "chrome":"52", "firefox":"50", "ie":"11" } + transform-modules-commonjs { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-dynamic-import { "chrome":"52", "firefox":"50", "ie":"11" } + +Using polyfills with `usage` option: + +[/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-proposals-2/input.js] Added following core-js polyfills: + es.array.iterator { "chrome":"52", "firefox":"50", "ie":"11" } + es.string.iterator { "ie":"11" } + web.dom-collections.iterator { "chrome":"52", "firefox":"50", "ie":"11" } + +[/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-proposals-2/input.js] Based on your code and targets, added regenerator-runtime. diff --git a/packages/babel-preset-env/test/debug-fixtures/usage-corejs3-shippedProposals/in/in.js b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-proposals-chrome-71-1/input.js similarity index 100% rename from packages/babel-preset-env/test/debug-fixtures/usage-corejs3-shippedProposals/in/in.js rename to packages/babel-preset-env/test/fixtures/debug/usage-corejs3-proposals-chrome-71-1/input.js diff --git a/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-proposals-chrome-71-1/options.json b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-proposals-chrome-71-1/options.json new file mode 100644 index 000000000000..18332716ece1 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-proposals-chrome-71-1/options.json @@ -0,0 +1,17 @@ +{ + "validateLogs": true, + "ignoreOutput": true, + "presets": [ + [ + "env", + { + "debug": true, + "targets": { + "chrome": 71 + }, + "useBuiltIns": "usage", + "corejs": { "version": 3, "proposals": true } + } + ] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-proposals-chrome-71-1/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-proposals-chrome-71-1/stdout.txt new file mode 100644 index 000000000000..ecb943009f2d --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-proposals-chrome-71-1/stdout.txt @@ -0,0 +1,37 @@ +@babel/preset-env: `DEBUG` option + +Using targets: +{ + "chrome": "71" +} + +Using modules transform: auto + +Using plugins: + syntax-async-generators { "chrome":"71" } + syntax-object-rest-spread { "chrome":"71" } + syntax-json-strings { "chrome":"71" } + syntax-optional-catch-binding { "chrome":"71" } + proposal-optional-chaining { "chrome":"71" } + proposal-nullish-coalescing-operator { "chrome":"71" } + transform-modules-commonjs { "chrome":"71" } + proposal-dynamic-import { "chrome":"71" } + +Using polyfills with `usage` option: + +[/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-proposals-chrome-71-1/input.js] Added following core-js polyfills: + esnext.map.delete-all { "chrome":"71" } + esnext.map.every { "chrome":"71" } + esnext.map.filter { "chrome":"71" } + esnext.map.find { "chrome":"71" } + esnext.map.find-key { "chrome":"71" } + esnext.map.includes { "chrome":"71" } + esnext.map.key-of { "chrome":"71" } + esnext.map.map-keys { "chrome":"71" } + esnext.map.map-values { "chrome":"71" } + esnext.map.merge { "chrome":"71" } + esnext.map.reduce { "chrome":"71" } + esnext.map.some { "chrome":"71" } + esnext.map.update { "chrome":"71" } + esnext.observable { "chrome":"71" } + esnext.symbol.observable { "chrome":"71" } diff --git a/packages/babel-preset-env/test/debug-fixtures/usage-corejs3-shippedProposals/in/in2.js b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-proposals-chrome-71-2/input.js similarity index 100% rename from packages/babel-preset-env/test/debug-fixtures/usage-corejs3-shippedProposals/in/in2.js rename to packages/babel-preset-env/test/fixtures/debug/usage-corejs3-proposals-chrome-71-2/input.js diff --git a/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-proposals-chrome-71-2/options.json b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-proposals-chrome-71-2/options.json new file mode 100644 index 000000000000..18332716ece1 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-proposals-chrome-71-2/options.json @@ -0,0 +1,17 @@ +{ + "validateLogs": true, + "ignoreOutput": true, + "presets": [ + [ + "env", + { + "debug": true, + "targets": { + "chrome": 71 + }, + "useBuiltIns": "usage", + "corejs": { "version": 3, "proposals": true } + } + ] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-proposals-chrome-71-2/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-proposals-chrome-71-2/stdout.txt new file mode 100644 index 000000000000..4a7b2514c4f4 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-proposals-chrome-71-2/stdout.txt @@ -0,0 +1,22 @@ +@babel/preset-env: `DEBUG` option + +Using targets: +{ + "chrome": "71" +} + +Using modules transform: auto + +Using plugins: + syntax-async-generators { "chrome":"71" } + syntax-object-rest-spread { "chrome":"71" } + syntax-json-strings { "chrome":"71" } + syntax-optional-catch-binding { "chrome":"71" } + proposal-optional-chaining { "chrome":"71" } + proposal-nullish-coalescing-operator { "chrome":"71" } + transform-modules-commonjs { "chrome":"71" } + proposal-dynamic-import { "chrome":"71" } + +Using polyfills with `usage` option: + +[/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-proposals-chrome-71-2/input.js] Based on your code and targets, core-js polyfills were not added. diff --git a/packages/babel-preset-env/test/debug-fixtures/usage-corejs3-versions-strings-minor-3.0/in/in.js b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-shippedProposals-1/input.js similarity index 100% rename from packages/babel-preset-env/test/debug-fixtures/usage-corejs3-versions-strings-minor-3.0/in/in.js rename to packages/babel-preset-env/test/fixtures/debug/usage-corejs3-shippedProposals-1/input.js diff --git a/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-shippedProposals-1/options.json b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-shippedProposals-1/options.json new file mode 100644 index 000000000000..5bd93bb47155 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-shippedProposals-1/options.json @@ -0,0 +1,20 @@ +{ + "validateLogs": true, + "ignoreOutput": true, + "presets": [ + [ + "env", + { + "debug": true, + "targets": { + "chrome": 52, + "firefox": 50, + "ie": 11 + }, + "shippedProposals": true, + "useBuiltIns": "usage", + "corejs": 3 + } + ] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-shippedProposals-1/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-shippedProposals-1/stdout.txt new file mode 100644 index 000000000000..e5b75a9a1c5a --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-shippedProposals-1/stdout.txt @@ -0,0 +1,56 @@ +@babel/preset-env: `DEBUG` option + +Using targets: +{ + "chrome": "52", + "firefox": "50", + "ie": "11" +} + +Using modules transform: auto + +Using plugins: + transform-template-literals { "ie":"11" } + transform-literals { "firefox":"50", "ie":"11" } + transform-function-name { "firefox":"50", "ie":"11" } + transform-arrow-functions { "ie":"11" } + transform-classes { "ie":"11" } + transform-object-super { "ie":"11" } + transform-shorthand-properties { "ie":"11" } + transform-duplicate-keys { "ie":"11" } + transform-computed-properties { "ie":"11" } + transform-for-of { "firefox":"50", "ie":"11" } + transform-sticky-regex { "ie":"11" } + transform-dotall-regex { "chrome":"52", "firefox":"50", "ie":"11" } + transform-unicode-regex { "ie":"11" } + transform-spread { "ie":"11" } + transform-parameters { "firefox":"50", "ie":"11" } + transform-destructuring { "firefox":"50", "ie":"11" } + transform-block-scoping { "firefox":"50", "ie":"11" } + transform-typeof-symbol { "ie":"11" } + transform-new-target { "ie":"11" } + transform-regenerator { "firefox":"50", "ie":"11" } + transform-exponentiation-operator { "firefox":"50", "ie":"11" } + transform-async-to-generator { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-async-generator-functions { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-object-rest-spread { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-unicode-property-regex { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-json-strings { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-optional-catch-binding { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-optional-chaining { "chrome":"52", "firefox":"50", "ie":"11" } + transform-named-capturing-groups-regex { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-nullish-coalescing-operator { "chrome":"52", "firefox":"50", "ie":"11" } + transform-modules-commonjs { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-dynamic-import { "chrome":"52", "firefox":"50", "ie":"11" } + +Using polyfills with `usage` option: + +[/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-shippedProposals-1/input.js] Added following core-js polyfills: + es.array.iterator { "chrome":"52", "firefox":"50", "ie":"11" } + es.map { "firefox":"50", "ie":"11" } + es.object.to-string { "firefox":"50", "ie":"11" } + es.promise { "chrome":"52", "firefox":"50", "ie":"11" } + es.string.iterator { "ie":"11" } + web.dom-collections.iterator { "chrome":"52", "firefox":"50", "ie":"11" } + web.queue-microtask { "chrome":"52", "firefox":"50", "ie":"11" } + esnext.global-this { "chrome":"52", "firefox":"50", "ie":"11" } diff --git a/packages/babel-preset-env/test/debug-fixtures/usage-corejs3-versions-strings-minor-3.0/in/in2.js b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-shippedProposals-2/input.js similarity index 100% rename from packages/babel-preset-env/test/debug-fixtures/usage-corejs3-versions-strings-minor-3.0/in/in2.js rename to packages/babel-preset-env/test/fixtures/debug/usage-corejs3-shippedProposals-2/input.js diff --git a/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-shippedProposals-2/options.json b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-shippedProposals-2/options.json new file mode 100644 index 000000000000..5bd93bb47155 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-shippedProposals-2/options.json @@ -0,0 +1,20 @@ +{ + "validateLogs": true, + "ignoreOutput": true, + "presets": [ + [ + "env", + { + "debug": true, + "targets": { + "chrome": 52, + "firefox": 50, + "ie": 11 + }, + "shippedProposals": true, + "useBuiltIns": "usage", + "corejs": 3 + } + ] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-shippedProposals-2/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-shippedProposals-2/stdout.txt new file mode 100644 index 000000000000..eb190794737f --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-shippedProposals-2/stdout.txt @@ -0,0 +1,53 @@ +@babel/preset-env: `DEBUG` option + +Using targets: +{ + "chrome": "52", + "firefox": "50", + "ie": "11" +} + +Using modules transform: auto + +Using plugins: + transform-template-literals { "ie":"11" } + transform-literals { "firefox":"50", "ie":"11" } + transform-function-name { "firefox":"50", "ie":"11" } + transform-arrow-functions { "ie":"11" } + transform-classes { "ie":"11" } + transform-object-super { "ie":"11" } + transform-shorthand-properties { "ie":"11" } + transform-duplicate-keys { "ie":"11" } + transform-computed-properties { "ie":"11" } + transform-for-of { "firefox":"50", "ie":"11" } + transform-sticky-regex { "ie":"11" } + transform-dotall-regex { "chrome":"52", "firefox":"50", "ie":"11" } + transform-unicode-regex { "ie":"11" } + transform-spread { "ie":"11" } + transform-parameters { "firefox":"50", "ie":"11" } + transform-destructuring { "firefox":"50", "ie":"11" } + transform-block-scoping { "firefox":"50", "ie":"11" } + transform-typeof-symbol { "ie":"11" } + transform-new-target { "ie":"11" } + transform-regenerator { "firefox":"50", "ie":"11" } + transform-exponentiation-operator { "firefox":"50", "ie":"11" } + transform-async-to-generator { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-async-generator-functions { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-object-rest-spread { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-unicode-property-regex { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-json-strings { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-optional-catch-binding { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-optional-chaining { "chrome":"52", "firefox":"50", "ie":"11" } + transform-named-capturing-groups-regex { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-nullish-coalescing-operator { "chrome":"52", "firefox":"50", "ie":"11" } + transform-modules-commonjs { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-dynamic-import { "chrome":"52", "firefox":"50", "ie":"11" } + +Using polyfills with `usage` option: + +[/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-shippedProposals-2/input.js] Added following core-js polyfills: + es.array.iterator { "chrome":"52", "firefox":"50", "ie":"11" } + es.string.iterator { "ie":"11" } + web.dom-collections.iterator { "chrome":"52", "firefox":"50", "ie":"11" } + +[/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-shippedProposals-2/input.js] Based on your code and targets, added regenerator-runtime. diff --git a/packages/babel-preset-env/test/debug-fixtures/usage-corejs3-versions-strings-minor-3.1/in/in.js b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-versions-strings-minor-3.0-1/input.js similarity index 100% rename from packages/babel-preset-env/test/debug-fixtures/usage-corejs3-versions-strings-minor-3.1/in/in.js rename to packages/babel-preset-env/test/fixtures/debug/usage-corejs3-versions-strings-minor-3.0-1/input.js diff --git a/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-versions-strings-minor-3.0-1/options.json b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-versions-strings-minor-3.0-1/options.json new file mode 100644 index 000000000000..14e2af08bf42 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-versions-strings-minor-3.0-1/options.json @@ -0,0 +1,19 @@ +{ + "validateLogs": true, + "ignoreOutput": true, + "presets": [ + [ + "env", + { + "debug": true, + "targets": { + "chrome": 52, + "firefox": 50, + "ie": 11 + }, + "useBuiltIns": "usage", + "corejs": "3.0" + } + ] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-versions-strings-minor-3.0-1/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-versions-strings-minor-3.0-1/stdout.txt new file mode 100644 index 000000000000..0c7ee55a05b0 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-versions-strings-minor-3.0-1/stdout.txt @@ -0,0 +1,55 @@ +@babel/preset-env: `DEBUG` option + +Using targets: +{ + "chrome": "52", + "firefox": "50", + "ie": "11" +} + +Using modules transform: auto + +Using plugins: + transform-template-literals { "ie":"11" } + transform-literals { "firefox":"50", "ie":"11" } + transform-function-name { "firefox":"50", "ie":"11" } + transform-arrow-functions { "ie":"11" } + transform-classes { "ie":"11" } + transform-object-super { "ie":"11" } + transform-shorthand-properties { "ie":"11" } + transform-duplicate-keys { "ie":"11" } + transform-computed-properties { "ie":"11" } + transform-for-of { "firefox":"50", "ie":"11" } + transform-sticky-regex { "ie":"11" } + transform-dotall-regex { "chrome":"52", "firefox":"50", "ie":"11" } + transform-unicode-regex { "ie":"11" } + transform-spread { "ie":"11" } + transform-parameters { "firefox":"50", "ie":"11" } + transform-destructuring { "firefox":"50", "ie":"11" } + transform-block-scoping { "firefox":"50", "ie":"11" } + transform-typeof-symbol { "ie":"11" } + transform-new-target { "ie":"11" } + transform-regenerator { "firefox":"50", "ie":"11" } + transform-exponentiation-operator { "firefox":"50", "ie":"11" } + transform-async-to-generator { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-async-generator-functions { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-object-rest-spread { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-unicode-property-regex { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-json-strings { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-optional-catch-binding { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-optional-chaining { "chrome":"52", "firefox":"50", "ie":"11" } + transform-named-capturing-groups-regex { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-nullish-coalescing-operator { "chrome":"52", "firefox":"50", "ie":"11" } + transform-modules-commonjs { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-dynamic-import { "chrome":"52", "firefox":"50", "ie":"11" } + +Using polyfills with `usage` option: + +[/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-versions-strings-minor-3.0-1/input.js] Added following core-js polyfills: + es.array.iterator { "chrome":"52", "firefox":"50", "ie":"11" } + es.map { "firefox":"50", "ie":"11" } + es.object.to-string { "firefox":"50", "ie":"11" } + es.promise { "chrome":"52", "firefox":"50", "ie":"11" } + es.string.iterator { "ie":"11" } + web.dom-collections.iterator { "chrome":"52", "firefox":"50", "ie":"11" } + web.queue-microtask { "chrome":"52", "firefox":"50", "ie":"11" } diff --git a/packages/babel-preset-env/test/debug-fixtures/usage-corejs3-versions-strings-minor-3.1/in/in2.js b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-versions-strings-minor-3.0-2/input.js similarity index 100% rename from packages/babel-preset-env/test/debug-fixtures/usage-corejs3-versions-strings-minor-3.1/in/in2.js rename to packages/babel-preset-env/test/fixtures/debug/usage-corejs3-versions-strings-minor-3.0-2/input.js diff --git a/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-versions-strings-minor-3.0-2/options.json b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-versions-strings-minor-3.0-2/options.json new file mode 100644 index 000000000000..14e2af08bf42 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-versions-strings-minor-3.0-2/options.json @@ -0,0 +1,19 @@ +{ + "validateLogs": true, + "ignoreOutput": true, + "presets": [ + [ + "env", + { + "debug": true, + "targets": { + "chrome": 52, + "firefox": 50, + "ie": 11 + }, + "useBuiltIns": "usage", + "corejs": "3.0" + } + ] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-versions-strings-minor-3.0-2/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-versions-strings-minor-3.0-2/stdout.txt new file mode 100644 index 000000000000..f27eb55333ca --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-versions-strings-minor-3.0-2/stdout.txt @@ -0,0 +1,53 @@ +@babel/preset-env: `DEBUG` option + +Using targets: +{ + "chrome": "52", + "firefox": "50", + "ie": "11" +} + +Using modules transform: auto + +Using plugins: + transform-template-literals { "ie":"11" } + transform-literals { "firefox":"50", "ie":"11" } + transform-function-name { "firefox":"50", "ie":"11" } + transform-arrow-functions { "ie":"11" } + transform-classes { "ie":"11" } + transform-object-super { "ie":"11" } + transform-shorthand-properties { "ie":"11" } + transform-duplicate-keys { "ie":"11" } + transform-computed-properties { "ie":"11" } + transform-for-of { "firefox":"50", "ie":"11" } + transform-sticky-regex { "ie":"11" } + transform-dotall-regex { "chrome":"52", "firefox":"50", "ie":"11" } + transform-unicode-regex { "ie":"11" } + transform-spread { "ie":"11" } + transform-parameters { "firefox":"50", "ie":"11" } + transform-destructuring { "firefox":"50", "ie":"11" } + transform-block-scoping { "firefox":"50", "ie":"11" } + transform-typeof-symbol { "ie":"11" } + transform-new-target { "ie":"11" } + transform-regenerator { "firefox":"50", "ie":"11" } + transform-exponentiation-operator { "firefox":"50", "ie":"11" } + transform-async-to-generator { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-async-generator-functions { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-object-rest-spread { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-unicode-property-regex { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-json-strings { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-optional-catch-binding { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-optional-chaining { "chrome":"52", "firefox":"50", "ie":"11" } + transform-named-capturing-groups-regex { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-nullish-coalescing-operator { "chrome":"52", "firefox":"50", "ie":"11" } + transform-modules-commonjs { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-dynamic-import { "chrome":"52", "firefox":"50", "ie":"11" } + +Using polyfills with `usage` option: + +[/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-versions-strings-minor-3.0-2/input.js] Added following core-js polyfills: + es.array.iterator { "chrome":"52", "firefox":"50", "ie":"11" } + es.string.iterator { "ie":"11" } + web.dom-collections.iterator { "chrome":"52", "firefox":"50", "ie":"11" } + +[/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-versions-strings-minor-3.0-2/input.js] Based on your code and targets, added regenerator-runtime. diff --git a/packages/babel-preset-env/test/debug-fixtures/usage-corejs3/in/in.js b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-versions-strings-minor-3.1-1/input.js similarity index 100% rename from packages/babel-preset-env/test/debug-fixtures/usage-corejs3/in/in.js rename to packages/babel-preset-env/test/fixtures/debug/usage-corejs3-versions-strings-minor-3.1-1/input.js diff --git a/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-versions-strings-minor-3.1-1/options.json b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-versions-strings-minor-3.1-1/options.json new file mode 100644 index 000000000000..de96a9fb2a2f --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-versions-strings-minor-3.1-1/options.json @@ -0,0 +1,19 @@ +{ + "validateLogs": true, + "ignoreOutput": true, + "presets": [ + [ + "env", + { + "debug": true, + "targets": { + "chrome": 52, + "firefox": 50, + "ie": 11 + }, + "useBuiltIns": "usage", + "corejs": "3.1" + } + ] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-versions-strings-minor-3.1-1/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-versions-strings-minor-3.1-1/stdout.txt new file mode 100644 index 000000000000..c5bdcb00878c --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-versions-strings-minor-3.1-1/stdout.txt @@ -0,0 +1,55 @@ +@babel/preset-env: `DEBUG` option + +Using targets: +{ + "chrome": "52", + "firefox": "50", + "ie": "11" +} + +Using modules transform: auto + +Using plugins: + transform-template-literals { "ie":"11" } + transform-literals { "firefox":"50", "ie":"11" } + transform-function-name { "firefox":"50", "ie":"11" } + transform-arrow-functions { "ie":"11" } + transform-classes { "ie":"11" } + transform-object-super { "ie":"11" } + transform-shorthand-properties { "ie":"11" } + transform-duplicate-keys { "ie":"11" } + transform-computed-properties { "ie":"11" } + transform-for-of { "firefox":"50", "ie":"11" } + transform-sticky-regex { "ie":"11" } + transform-dotall-regex { "chrome":"52", "firefox":"50", "ie":"11" } + transform-unicode-regex { "ie":"11" } + transform-spread { "ie":"11" } + transform-parameters { "firefox":"50", "ie":"11" } + transform-destructuring { "firefox":"50", "ie":"11" } + transform-block-scoping { "firefox":"50", "ie":"11" } + transform-typeof-symbol { "ie":"11" } + transform-new-target { "ie":"11" } + transform-regenerator { "firefox":"50", "ie":"11" } + transform-exponentiation-operator { "firefox":"50", "ie":"11" } + transform-async-to-generator { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-async-generator-functions { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-object-rest-spread { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-unicode-property-regex { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-json-strings { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-optional-catch-binding { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-optional-chaining { "chrome":"52", "firefox":"50", "ie":"11" } + transform-named-capturing-groups-regex { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-nullish-coalescing-operator { "chrome":"52", "firefox":"50", "ie":"11" } + transform-modules-commonjs { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-dynamic-import { "chrome":"52", "firefox":"50", "ie":"11" } + +Using polyfills with `usage` option: + +[/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-versions-strings-minor-3.1-1/input.js] Added following core-js polyfills: + es.array.iterator { "chrome":"52", "firefox":"50", "ie":"11" } + es.map { "firefox":"50", "ie":"11" } + es.object.to-string { "firefox":"50", "ie":"11" } + es.promise { "chrome":"52", "firefox":"50", "ie":"11" } + es.string.iterator { "ie":"11" } + web.dom-collections.iterator { "chrome":"52", "firefox":"50", "ie":"11" } + web.queue-microtask { "chrome":"52", "firefox":"50", "ie":"11" } diff --git a/packages/babel-preset-env/test/debug-fixtures/usage-corejs3/in/in2.js b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-versions-strings-minor-3.1-2/input.js similarity index 100% rename from packages/babel-preset-env/test/debug-fixtures/usage-corejs3/in/in2.js rename to packages/babel-preset-env/test/fixtures/debug/usage-corejs3-versions-strings-minor-3.1-2/input.js diff --git a/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-versions-strings-minor-3.1-2/options.json b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-versions-strings-minor-3.1-2/options.json new file mode 100644 index 000000000000..de96a9fb2a2f --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-versions-strings-minor-3.1-2/options.json @@ -0,0 +1,19 @@ +{ + "validateLogs": true, + "ignoreOutput": true, + "presets": [ + [ + "env", + { + "debug": true, + "targets": { + "chrome": 52, + "firefox": 50, + "ie": 11 + }, + "useBuiltIns": "usage", + "corejs": "3.1" + } + ] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-versions-strings-minor-3.1-2/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-versions-strings-minor-3.1-2/stdout.txt new file mode 100644 index 000000000000..911a19104672 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-versions-strings-minor-3.1-2/stdout.txt @@ -0,0 +1,53 @@ +@babel/preset-env: `DEBUG` option + +Using targets: +{ + "chrome": "52", + "firefox": "50", + "ie": "11" +} + +Using modules transform: auto + +Using plugins: + transform-template-literals { "ie":"11" } + transform-literals { "firefox":"50", "ie":"11" } + transform-function-name { "firefox":"50", "ie":"11" } + transform-arrow-functions { "ie":"11" } + transform-classes { "ie":"11" } + transform-object-super { "ie":"11" } + transform-shorthand-properties { "ie":"11" } + transform-duplicate-keys { "ie":"11" } + transform-computed-properties { "ie":"11" } + transform-for-of { "firefox":"50", "ie":"11" } + transform-sticky-regex { "ie":"11" } + transform-dotall-regex { "chrome":"52", "firefox":"50", "ie":"11" } + transform-unicode-regex { "ie":"11" } + transform-spread { "ie":"11" } + transform-parameters { "firefox":"50", "ie":"11" } + transform-destructuring { "firefox":"50", "ie":"11" } + transform-block-scoping { "firefox":"50", "ie":"11" } + transform-typeof-symbol { "ie":"11" } + transform-new-target { "ie":"11" } + transform-regenerator { "firefox":"50", "ie":"11" } + transform-exponentiation-operator { "firefox":"50", "ie":"11" } + transform-async-to-generator { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-async-generator-functions { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-object-rest-spread { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-unicode-property-regex { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-json-strings { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-optional-catch-binding { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-optional-chaining { "chrome":"52", "firefox":"50", "ie":"11" } + transform-named-capturing-groups-regex { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-nullish-coalescing-operator { "chrome":"52", "firefox":"50", "ie":"11" } + transform-modules-commonjs { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-dynamic-import { "chrome":"52", "firefox":"50", "ie":"11" } + +Using polyfills with `usage` option: + +[/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-versions-strings-minor-3.1-2/input.js] Added following core-js polyfills: + es.array.iterator { "chrome":"52", "firefox":"50", "ie":"11" } + es.string.iterator { "ie":"11" } + web.dom-collections.iterator { "chrome":"52", "firefox":"50", "ie":"11" } + +[/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-versions-strings-minor-3.1-2/input.js] Based on your code and targets, added regenerator-runtime. diff --git a/packages/babel-preset-env/test/debug-fixtures/usage-corejs3-with-import/in/in.js b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-with-import/input.mjs similarity index 100% rename from packages/babel-preset-env/test/debug-fixtures/usage-corejs3-with-import/in/in.js rename to packages/babel-preset-env/test/fixtures/debug/usage-corejs3-with-import/input.mjs diff --git a/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-with-import/options.json b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-with-import/options.json new file mode 100644 index 000000000000..a1d0ee8004f5 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-with-import/options.json @@ -0,0 +1,17 @@ +{ + "validateLogs": true, + "ignoreOutput": true, + "presets": [ + [ + "env", + { + "debug": true, + "targets": { + "chrome": 55 + }, + "useBuiltIns": "usage", + "corejs": 3 + } + ] + ] +} diff --git a/packages/babel-preset-env/test/debug-fixtures/usage-corejs3-with-import/stderr.txt b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-with-import/stderr.txt similarity index 100% rename from packages/babel-preset-env/test/debug-fixtures/usage-corejs3-with-import/stderr.txt rename to packages/babel-preset-env/test/fixtures/debug/usage-corejs3-with-import/stderr.txt diff --git a/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-with-import/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-with-import/stdout.txt new file mode 100644 index 000000000000..45066fccbc34 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-with-import/stdout.txt @@ -0,0 +1,25 @@ +@babel/preset-env: `DEBUG` option + +Using targets: +{ + "chrome": "55" +} + +Using modules transform: auto + +Using plugins: + transform-dotall-regex { "chrome":"55" } + proposal-async-generator-functions { "chrome":"55" } + proposal-object-rest-spread { "chrome":"55" } + proposal-unicode-property-regex { "chrome":"55" } + proposal-json-strings { "chrome":"55" } + proposal-optional-catch-binding { "chrome":"55" } + proposal-optional-chaining { "chrome":"55" } + transform-named-capturing-groups-regex { "chrome":"55" } + proposal-nullish-coalescing-operator { "chrome":"55" } + transform-modules-commonjs { "chrome":"55" } + proposal-dynamic-import { "chrome":"55" } + +Using polyfills with `usage` option: + +[/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-with-import/input.mjs] Based on your code and targets, core-js polyfills were not added. diff --git a/packages/babel-preset-env/test/debug-fixtures/usage-no-corejs/in/in.js b/packages/babel-preset-env/test/fixtures/debug/usage-no-corejs-1/input.js similarity index 100% rename from packages/babel-preset-env/test/debug-fixtures/usage-no-corejs/in/in.js rename to packages/babel-preset-env/test/fixtures/debug/usage-no-corejs-1/input.js diff --git a/packages/babel-preset-env/test/fixtures/debug/usage-no-corejs-1/options.json b/packages/babel-preset-env/test/fixtures/debug/usage-no-corejs-1/options.json new file mode 100644 index 000000000000..e811528ee105 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/usage-no-corejs-1/options.json @@ -0,0 +1,18 @@ +{ + "validateLogs": true, + "ignoreOutput": true, + "presets": [ + [ + "env", + { + "debug": true, + "targets": { + "chrome": 52, + "firefox": 50, + "ie": 11 + }, + "useBuiltIns": "usage" + } + ] + ] +} diff --git a/packages/babel-preset-env/test/debug-fixtures/usage-no-corejs-none/stderr.txt b/packages/babel-preset-env/test/fixtures/debug/usage-no-corejs-1/stderr.txt similarity index 100% rename from packages/babel-preset-env/test/debug-fixtures/usage-no-corejs-none/stderr.txt rename to packages/babel-preset-env/test/fixtures/debug/usage-no-corejs-1/stderr.txt diff --git a/packages/babel-preset-env/test/fixtures/debug/usage-no-corejs-1/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/usage-no-corejs-1/stdout.txt new file mode 100644 index 000000000000..c26bff7708e0 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/usage-no-corejs-1/stdout.txt @@ -0,0 +1,54 @@ +@babel/preset-env: `DEBUG` option + +Using targets: +{ + "chrome": "52", + "firefox": "50", + "ie": "11" +} + +Using modules transform: auto + +Using plugins: + transform-template-literals { "ie":"11" } + transform-literals { "firefox":"50", "ie":"11" } + transform-function-name { "firefox":"50", "ie":"11" } + transform-arrow-functions { "ie":"11" } + transform-classes { "ie":"11" } + transform-object-super { "ie":"11" } + transform-shorthand-properties { "ie":"11" } + transform-duplicate-keys { "ie":"11" } + transform-computed-properties { "ie":"11" } + transform-for-of { "firefox":"50", "ie":"11" } + transform-sticky-regex { "ie":"11" } + transform-dotall-regex { "chrome":"52", "firefox":"50", "ie":"11" } + transform-unicode-regex { "ie":"11" } + transform-spread { "ie":"11" } + transform-parameters { "firefox":"50", "ie":"11" } + transform-destructuring { "firefox":"50", "ie":"11" } + transform-block-scoping { "firefox":"50", "ie":"11" } + transform-typeof-symbol { "ie":"11" } + transform-new-target { "ie":"11" } + transform-regenerator { "firefox":"50", "ie":"11" } + transform-exponentiation-operator { "firefox":"50", "ie":"11" } + transform-async-to-generator { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-async-generator-functions { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-object-rest-spread { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-unicode-property-regex { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-json-strings { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-optional-catch-binding { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-optional-chaining { "chrome":"52", "firefox":"50", "ie":"11" } + transform-named-capturing-groups-regex { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-nullish-coalescing-operator { "chrome":"52", "firefox":"50", "ie":"11" } + transform-modules-commonjs { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-dynamic-import { "chrome":"52", "firefox":"50", "ie":"11" } + +Using polyfills with `usage` option: + +[/packages/babel-preset-env/test/fixtures/debug/usage-no-corejs-1/input.js] Added following core-js polyfills: + es6.object.to-string { "chrome":"52", "firefox":"50", "ie":"11" } + es6.promise { "ie":"11" } + es6.map { "firefox":"50", "ie":"11" } + es6.string.iterator { "ie":"11" } + es6.array.iterator { "ie":"11" } + web.dom.iterable { "chrome":"52", "firefox":"50", "ie":"11" } diff --git a/packages/babel-preset-env/test/debug-fixtures/usage-no-corejs/in/in2.js b/packages/babel-preset-env/test/fixtures/debug/usage-no-corejs-2/input.js similarity index 100% rename from packages/babel-preset-env/test/debug-fixtures/usage-no-corejs/in/in2.js rename to packages/babel-preset-env/test/fixtures/debug/usage-no-corejs-2/input.js diff --git a/packages/babel-preset-env/test/fixtures/debug/usage-no-corejs-2/options.json b/packages/babel-preset-env/test/fixtures/debug/usage-no-corejs-2/options.json new file mode 100644 index 000000000000..e811528ee105 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/usage-no-corejs-2/options.json @@ -0,0 +1,18 @@ +{ + "validateLogs": true, + "ignoreOutput": true, + "presets": [ + [ + "env", + { + "debug": true, + "targets": { + "chrome": 52, + "firefox": 50, + "ie": 11 + }, + "useBuiltIns": "usage" + } + ] + ] +} diff --git a/packages/babel-preset-env/test/debug-fixtures/usage-no-corejs/stderr.txt b/packages/babel-preset-env/test/fixtures/debug/usage-no-corejs-2/stderr.txt similarity index 100% rename from packages/babel-preset-env/test/debug-fixtures/usage-no-corejs/stderr.txt rename to packages/babel-preset-env/test/fixtures/debug/usage-no-corejs-2/stderr.txt diff --git a/packages/babel-preset-env/test/fixtures/debug/usage-no-corejs-2/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/usage-no-corejs-2/stdout.txt new file mode 100644 index 000000000000..0f3308e0a98c --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/usage-no-corejs-2/stdout.txt @@ -0,0 +1,51 @@ +@babel/preset-env: `DEBUG` option + +Using targets: +{ + "chrome": "52", + "firefox": "50", + "ie": "11" +} + +Using modules transform: auto + +Using plugins: + transform-template-literals { "ie":"11" } + transform-literals { "firefox":"50", "ie":"11" } + transform-function-name { "firefox":"50", "ie":"11" } + transform-arrow-functions { "ie":"11" } + transform-classes { "ie":"11" } + transform-object-super { "ie":"11" } + transform-shorthand-properties { "ie":"11" } + transform-duplicate-keys { "ie":"11" } + transform-computed-properties { "ie":"11" } + transform-for-of { "firefox":"50", "ie":"11" } + transform-sticky-regex { "ie":"11" } + transform-dotall-regex { "chrome":"52", "firefox":"50", "ie":"11" } + transform-unicode-regex { "ie":"11" } + transform-spread { "ie":"11" } + transform-parameters { "firefox":"50", "ie":"11" } + transform-destructuring { "firefox":"50", "ie":"11" } + transform-block-scoping { "firefox":"50", "ie":"11" } + transform-typeof-symbol { "ie":"11" } + transform-new-target { "ie":"11" } + transform-regenerator { "firefox":"50", "ie":"11" } + transform-exponentiation-operator { "firefox":"50", "ie":"11" } + transform-async-to-generator { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-async-generator-functions { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-object-rest-spread { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-unicode-property-regex { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-json-strings { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-optional-catch-binding { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-optional-chaining { "chrome":"52", "firefox":"50", "ie":"11" } + transform-named-capturing-groups-regex { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-nullish-coalescing-operator { "chrome":"52", "firefox":"50", "ie":"11" } + transform-modules-commonjs { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-dynamic-import { "chrome":"52", "firefox":"50", "ie":"11" } + +Using polyfills with `usage` option: + +[/packages/babel-preset-env/test/fixtures/debug/usage-no-corejs-2/input.js] Added following core-js polyfill: + web.dom.iterable { "chrome":"52", "firefox":"50", "ie":"11" } + +[/packages/babel-preset-env/test/fixtures/debug/usage-no-corejs-2/input.js] Based on your code and targets, added regenerator-runtime. diff --git a/packages/babel-preset-env/test/debug-fixtures/usage-no-corejs-none/in/in.js b/packages/babel-preset-env/test/fixtures/debug/usage-no-corejs-none-1/input.js similarity index 100% rename from packages/babel-preset-env/test/debug-fixtures/usage-no-corejs-none/in/in.js rename to packages/babel-preset-env/test/fixtures/debug/usage-no-corejs-none-1/input.js diff --git a/packages/babel-preset-env/test/fixtures/debug/usage-no-corejs-none-1/options.json b/packages/babel-preset-env/test/fixtures/debug/usage-no-corejs-none-1/options.json new file mode 100644 index 000000000000..e811528ee105 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/usage-no-corejs-none-1/options.json @@ -0,0 +1,18 @@ +{ + "validateLogs": true, + "ignoreOutput": true, + "presets": [ + [ + "env", + { + "debug": true, + "targets": { + "chrome": 52, + "firefox": 50, + "ie": 11 + }, + "useBuiltIns": "usage" + } + ] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/debug/usage-no-corejs-none-1/stderr.txt b/packages/babel-preset-env/test/fixtures/debug/usage-no-corejs-none-1/stderr.txt new file mode 100644 index 000000000000..dbee5e8f3eb3 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/usage-no-corejs-none-1/stderr.txt @@ -0,0 +1,6 @@ +WARNING: We noticed you're using the `useBuiltIns` option without declaring a core-js version. Currently, we assume version 2.x when no version is passed. Since this default version will likely change in future versions of Babel, we recommend explicitly setting the core-js version you are using via the `corejs` option. + +You should also be sure that the version you pass to the `corejs` option matches the version specified in your `package.json`'s `dependencies` section. If it doesn't, you need to run one of the following commands: + + npm install --save core-js@2 npm install --save core-js@3 + yarn add core-js@2 yarn add core-js@3 \ No newline at end of file diff --git a/packages/babel-preset-env/test/fixtures/debug/usage-no-corejs-none-1/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/usage-no-corejs-none-1/stdout.txt new file mode 100644 index 000000000000..a6ab295bf699 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/usage-no-corejs-none-1/stdout.txt @@ -0,0 +1,48 @@ +@babel/preset-env: `DEBUG` option + +Using targets: +{ + "chrome": "52", + "firefox": "50", + "ie": "11" +} + +Using modules transform: auto + +Using plugins: + transform-template-literals { "ie":"11" } + transform-literals { "firefox":"50", "ie":"11" } + transform-function-name { "firefox":"50", "ie":"11" } + transform-arrow-functions { "ie":"11" } + transform-classes { "ie":"11" } + transform-object-super { "ie":"11" } + transform-shorthand-properties { "ie":"11" } + transform-duplicate-keys { "ie":"11" } + transform-computed-properties { "ie":"11" } + transform-for-of { "firefox":"50", "ie":"11" } + transform-sticky-regex { "ie":"11" } + transform-dotall-regex { "chrome":"52", "firefox":"50", "ie":"11" } + transform-unicode-regex { "ie":"11" } + transform-spread { "ie":"11" } + transform-parameters { "firefox":"50", "ie":"11" } + transform-destructuring { "firefox":"50", "ie":"11" } + transform-block-scoping { "firefox":"50", "ie":"11" } + transform-typeof-symbol { "ie":"11" } + transform-new-target { "ie":"11" } + transform-regenerator { "firefox":"50", "ie":"11" } + transform-exponentiation-operator { "firefox":"50", "ie":"11" } + transform-async-to-generator { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-async-generator-functions { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-object-rest-spread { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-unicode-property-regex { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-json-strings { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-optional-catch-binding { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-optional-chaining { "chrome":"52", "firefox":"50", "ie":"11" } + transform-named-capturing-groups-regex { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-nullish-coalescing-operator { "chrome":"52", "firefox":"50", "ie":"11" } + transform-modules-commonjs { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-dynamic-import { "chrome":"52", "firefox":"50", "ie":"11" } + +Using polyfills with `usage` option: + +[/packages/babel-preset-env/test/fixtures/debug/usage-no-corejs-none-1/input.js] Based on your code and targets, core-js polyfills were not added. diff --git a/packages/babel-preset-env/test/debug-fixtures/usage-no-corejs-none/in/in2.js b/packages/babel-preset-env/test/fixtures/debug/usage-no-corejs-none-2/input.js similarity index 100% rename from packages/babel-preset-env/test/debug-fixtures/usage-no-corejs-none/in/in2.js rename to packages/babel-preset-env/test/fixtures/debug/usage-no-corejs-none-2/input.js diff --git a/packages/babel-preset-env/test/fixtures/debug/usage-no-corejs-none-2/options.json b/packages/babel-preset-env/test/fixtures/debug/usage-no-corejs-none-2/options.json new file mode 100644 index 000000000000..e811528ee105 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/usage-no-corejs-none-2/options.json @@ -0,0 +1,18 @@ +{ + "validateLogs": true, + "ignoreOutput": true, + "presets": [ + [ + "env", + { + "debug": true, + "targets": { + "chrome": 52, + "firefox": 50, + "ie": 11 + }, + "useBuiltIns": "usage" + } + ] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/debug/usage-no-corejs-none-2/stderr.txt b/packages/babel-preset-env/test/fixtures/debug/usage-no-corejs-none-2/stderr.txt new file mode 100644 index 000000000000..dbee5e8f3eb3 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/usage-no-corejs-none-2/stderr.txt @@ -0,0 +1,6 @@ +WARNING: We noticed you're using the `useBuiltIns` option without declaring a core-js version. Currently, we assume version 2.x when no version is passed. Since this default version will likely change in future versions of Babel, we recommend explicitly setting the core-js version you are using via the `corejs` option. + +You should also be sure that the version you pass to the `corejs` option matches the version specified in your `package.json`'s `dependencies` section. If it doesn't, you need to run one of the following commands: + + npm install --save core-js@2 npm install --save core-js@3 + yarn add core-js@2 yarn add core-js@3 \ No newline at end of file diff --git a/packages/babel-preset-env/test/fixtures/debug/usage-no-corejs-none-2/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/usage-no-corejs-none-2/stdout.txt new file mode 100644 index 000000000000..09bb267f456e --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/debug/usage-no-corejs-none-2/stdout.txt @@ -0,0 +1,48 @@ +@babel/preset-env: `DEBUG` option + +Using targets: +{ + "chrome": "52", + "firefox": "50", + "ie": "11" +} + +Using modules transform: auto + +Using plugins: + transform-template-literals { "ie":"11" } + transform-literals { "firefox":"50", "ie":"11" } + transform-function-name { "firefox":"50", "ie":"11" } + transform-arrow-functions { "ie":"11" } + transform-classes { "ie":"11" } + transform-object-super { "ie":"11" } + transform-shorthand-properties { "ie":"11" } + transform-duplicate-keys { "ie":"11" } + transform-computed-properties { "ie":"11" } + transform-for-of { "firefox":"50", "ie":"11" } + transform-sticky-regex { "ie":"11" } + transform-dotall-regex { "chrome":"52", "firefox":"50", "ie":"11" } + transform-unicode-regex { "ie":"11" } + transform-spread { "ie":"11" } + transform-parameters { "firefox":"50", "ie":"11" } + transform-destructuring { "firefox":"50", "ie":"11" } + transform-block-scoping { "firefox":"50", "ie":"11" } + transform-typeof-symbol { "ie":"11" } + transform-new-target { "ie":"11" } + transform-regenerator { "firefox":"50", "ie":"11" } + transform-exponentiation-operator { "firefox":"50", "ie":"11" } + transform-async-to-generator { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-async-generator-functions { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-object-rest-spread { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-unicode-property-regex { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-json-strings { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-optional-catch-binding { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-optional-chaining { "chrome":"52", "firefox":"50", "ie":"11" } + transform-named-capturing-groups-regex { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-nullish-coalescing-operator { "chrome":"52", "firefox":"50", "ie":"11" } + transform-modules-commonjs { "chrome":"52", "firefox":"50", "ie":"11" } + proposal-dynamic-import { "chrome":"52", "firefox":"50", "ie":"11" } + +Using polyfills with `usage` option: + +[/packages/babel-preset-env/test/fixtures/debug/usage-no-corejs-none-2/input.js] Based on your code and targets, core-js polyfills were not added. diff --git a/packages/babel-preset-env/test/fixtures/dynamic-import/auto-esm-supported-import-supported/options.json b/packages/babel-preset-env/test/fixtures/dynamic-import/auto-esm-supported-import-supported/options.json index 154ea4199025..65df7ec7a7d3 100644 --- a/packages/babel-preset-env/test/fixtures/dynamic-import/auto-esm-supported-import-supported/options.json +++ b/packages/babel-preset-env/test/fixtures/dynamic-import/auto-esm-supported-import-supported/options.json @@ -1,4 +1,5 @@ { + "validateLogs": true, "caller": { "name": "test-fixture", "supportsStaticESM": true, diff --git a/packages/babel-preset-env/test/fixtures/dynamic-import/auto-esm-supported-import-unsupported/options.json b/packages/babel-preset-env/test/fixtures/dynamic-import/auto-esm-supported-import-unsupported/options.json index c444f60ae955..85b4d7deafad 100644 --- a/packages/babel-preset-env/test/fixtures/dynamic-import/auto-esm-supported-import-unsupported/options.json +++ b/packages/babel-preset-env/test/fixtures/dynamic-import/auto-esm-supported-import-unsupported/options.json @@ -1,4 +1,5 @@ { + "validateLogs": true, "caller": { "name": "test-fixture", "supportsStaticESM": true, diff --git a/packages/babel-preset-env/test/fixtures/dynamic-import/auto-esm-supported-import-unsupported/stderr.txt b/packages/babel-preset-env/test/fixtures/dynamic-import/auto-esm-supported-import-unsupported/stderr.txt new file mode 100644 index 000000000000..f3e3df470839 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/dynamic-import/auto-esm-supported-import-unsupported/stderr.txt @@ -0,0 +1 @@ +Dynamic import can only be supported when transforming ES modules to AMD, CommonJS or SystemJS. Only the parser plugin will be enabled. diff --git a/packages/babel-preset-env/test/fixtures/dynamic-import/auto-esm-unsupported-import-unsupported/options.json b/packages/babel-preset-env/test/fixtures/dynamic-import/auto-esm-unsupported-import-unsupported/options.json index 370b48e76fb2..60d72e63221a 100644 --- a/packages/babel-preset-env/test/fixtures/dynamic-import/auto-esm-unsupported-import-unsupported/options.json +++ b/packages/babel-preset-env/test/fixtures/dynamic-import/auto-esm-unsupported-import-unsupported/options.json @@ -1,4 +1,5 @@ { + "validateLogs": true, "caller": { "name": "test-fixture", "supportsStaticESM": false, diff --git a/packages/babel-preset-env/test/fixtures/dynamic-import/auto-esm-unsupported-import-unsupported/output.js b/packages/babel-preset-env/test/fixtures/dynamic-import/auto-esm-unsupported-import-unsupported/output.js index 9c2292edabb1..a7f2edabb858 100644 --- a/packages/babel-preset-env/test/fixtures/dynamic-import/auto-esm-unsupported-import-unsupported/output.js +++ b/packages/babel-preset-env/test/fixtures/dynamic-import/auto-esm-unsupported-import-unsupported/output.js @@ -1,6 +1,10 @@ "use strict"; -function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj["default"] = obj; return newObj; } } +function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } + +function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; } + +function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; } Promise.resolve().then(function () { return _interopRequireWildcard(require("foo")); diff --git a/packages/babel-preset-env/test/fixtures/dynamic-import/modules-amd/options.json b/packages/babel-preset-env/test/fixtures/dynamic-import/modules-amd/options.json index e34f77e9664c..dad5640aa571 100644 --- a/packages/babel-preset-env/test/fixtures/dynamic-import/modules-amd/options.json +++ b/packages/babel-preset-env/test/fixtures/dynamic-import/modules-amd/options.json @@ -1,3 +1,4 @@ { + "validateLogs": true, "presets": [["env", { "modules": "amd" }]] } diff --git a/packages/babel-preset-env/test/fixtures/dynamic-import/modules-amd/output.js b/packages/babel-preset-env/test/fixtures/dynamic-import/modules-amd/output.js index 07297795f680..f1ca949bbcb1 100644 --- a/packages/babel-preset-env/test/fixtures/dynamic-import/modules-amd/output.js +++ b/packages/babel-preset-env/test/fixtures/dynamic-import/modules-amd/output.js @@ -1,5 +1,9 @@ define(["require"], function (_require) { - function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj["default"] = obj; return newObj; } } + function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } + + function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; } + + function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; } new Promise(function (_resolve, _reject) { return _require(["foo"], function (imported) { diff --git a/packages/babel-preset-env/test/fixtures/dynamic-import/modules-cjs/options.json b/packages/babel-preset-env/test/fixtures/dynamic-import/modules-cjs/options.json index 1b03b37c6f6d..091b0e2a32c6 100644 --- a/packages/babel-preset-env/test/fixtures/dynamic-import/modules-cjs/options.json +++ b/packages/babel-preset-env/test/fixtures/dynamic-import/modules-cjs/options.json @@ -1,3 +1,4 @@ { + "validateLogs": true, "presets": [["env", { "modules": "cjs" }]] } diff --git a/packages/babel-preset-env/test/fixtures/dynamic-import/modules-cjs/output.js b/packages/babel-preset-env/test/fixtures/dynamic-import/modules-cjs/output.js index 9c2292edabb1..a7f2edabb858 100644 --- a/packages/babel-preset-env/test/fixtures/dynamic-import/modules-cjs/output.js +++ b/packages/babel-preset-env/test/fixtures/dynamic-import/modules-cjs/output.js @@ -1,6 +1,10 @@ "use strict"; -function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj["default"] = obj; return newObj; } } +function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } + +function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; } + +function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; } Promise.resolve().then(function () { return _interopRequireWildcard(require("foo")); diff --git a/packages/babel-preset-env/test/fixtures/dynamic-import/modules-false/options.json b/packages/babel-preset-env/test/fixtures/dynamic-import/modules-false/options.json index 3c22b6872e58..c7c066f78489 100644 --- a/packages/babel-preset-env/test/fixtures/dynamic-import/modules-false/options.json +++ b/packages/babel-preset-env/test/fixtures/dynamic-import/modules-false/options.json @@ -1,3 +1,4 @@ { + "validateLogs": true, "presets": [["env", { "modules": false }]] } diff --git a/packages/babel-preset-env/test/fixtures/dynamic-import/modules-systemjs/options.json b/packages/babel-preset-env/test/fixtures/dynamic-import/modules-systemjs/options.json index 9be6fdb3812e..206e080b9c53 100644 --- a/packages/babel-preset-env/test/fixtures/dynamic-import/modules-systemjs/options.json +++ b/packages/babel-preset-env/test/fixtures/dynamic-import/modules-systemjs/options.json @@ -1,3 +1,4 @@ { + "validateLogs": true, "presets": [["env", { "modules": "systemjs" }]] } diff --git a/packages/babel-preset-env/test/fixtures/dynamic-import/modules-umd/options.json b/packages/babel-preset-env/test/fixtures/dynamic-import/modules-umd/options.json index da7772e2d584..6315da5c545a 100644 --- a/packages/babel-preset-env/test/fixtures/dynamic-import/modules-umd/options.json +++ b/packages/babel-preset-env/test/fixtures/dynamic-import/modules-umd/options.json @@ -1,3 +1,4 @@ { + "validateLogs": true, "presets": [["env", { "modules": "umd" }]] } diff --git a/packages/babel-preset-env/test/fixtures/dynamic-import/modules-umd/output.js b/packages/babel-preset-env/test/fixtures/dynamic-import/modules-umd/output.js index f66adb1fb317..f4b267b43c0b 100644 --- a/packages/babel-preset-env/test/fixtures/dynamic-import/modules-umd/output.js +++ b/packages/babel-preset-env/test/fixtures/dynamic-import/modules-umd/output.js @@ -10,7 +10,7 @@ factory(); global.input = mod.exports; } -})(this, function () { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function () { "use strict"; import("foo"); // warns diff --git a/packages/babel-preset-env/test/fixtures/dynamic-import/modules-umd/stderr.txt b/packages/babel-preset-env/test/fixtures/dynamic-import/modules-umd/stderr.txt new file mode 100644 index 000000000000..f3e3df470839 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/dynamic-import/modules-umd/stderr.txt @@ -0,0 +1 @@ +Dynamic import can only be supported when transforming ES modules to AMD, CommonJS or SystemJS. Only the parser plugin will be enabled. diff --git a/packages/babel-preset-env/test/fixtures/modules/auto-esm/options.json b/packages/babel-preset-env/test/fixtures/modules/auto-esm/options.json index c4294fee0e57..154ea4199025 100644 --- a/packages/babel-preset-env/test/fixtures/modules/auto-esm/options.json +++ b/packages/babel-preset-env/test/fixtures/modules/auto-esm/options.json @@ -1,7 +1,8 @@ { "caller": { "name": "test-fixture", - "supportsStaticESM": true + "supportsStaticESM": true, + "supportsDynamicImport": true }, "presets": ["env"] } diff --git a/packages/babel-preset-env/test/fixtures/modules/modules-umd/options.json b/packages/babel-preset-env/test/fixtures/modules/modules-umd/options.json index 18b39b6fa2e9..d4838a7e7e06 100644 --- a/packages/babel-preset-env/test/fixtures/modules/modules-umd/options.json +++ b/packages/babel-preset-env/test/fixtures/modules/modules-umd/options.json @@ -1,4 +1,5 @@ { + "validateLogs": true, "presets": [ [ "../../../../lib", diff --git a/packages/babel-preset-env/test/fixtures/modules/modules-umd/output.js b/packages/babel-preset-env/test/fixtures/modules/modules-umd/output.js index 231614902dde..f4afd867e11a 100644 --- a/packages/babel-preset-env/test/fixtures/modules/modules-umd/output.js +++ b/packages/babel-preset-env/test/fixtures/modules/modules-umd/output.js @@ -10,7 +10,7 @@ factory(global.a); global.input = mod.exports; } -})(this, function (_a) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_a) { "use strict"; _a = _interopRequireDefault(_a); diff --git a/packages/babel-preset-env/test/fixtures/modules/modules-umd/stderr.txt b/packages/babel-preset-env/test/fixtures/modules/modules-umd/stderr.txt new file mode 100644 index 000000000000..f3e3df470839 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/modules/modules-umd/stderr.txt @@ -0,0 +1 @@ +Dynamic import can only be supported when transforming ES modules to AMD, CommonJS or SystemJS. Only the parser plugin will be enabled. diff --git a/packages/babel-preset-env/test/fixtures/plugins-integration/issue-10662/input.mjs b/packages/babel-preset-env/test/fixtures/plugins-integration/issue-10662/input.mjs new file mode 100644 index 000000000000..99f2bc766393 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/plugins-integration/issue-10662/input.mjs @@ -0,0 +1,2 @@ +var globalThis = {}; +typeof globalThis; diff --git a/packages/babel-preset-env/test/fixtures/plugins-integration/issue-10662/options.json b/packages/babel-preset-env/test/fixtures/plugins-integration/issue-10662/options.json new file mode 100644 index 000000000000..8d2b3b33f359 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/plugins-integration/issue-10662/options.json @@ -0,0 +1,11 @@ +{ + "presets": [ + [ + "env", + { + "modules": "umd", + "targets": ["Safari 8", "IE 11"] + } + ] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/plugins-integration/issue-10662/output.js b/packages/babel-preset-env/test/fixtures/plugins-integration/issue-10662/output.js new file mode 100644 index 000000000000..e13f6d324d73 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/plugins-integration/issue-10662/output.js @@ -0,0 +1,21 @@ +(function (global, factory) { + if (typeof define === "function" && define.amd) { + define([], factory); + } else if (typeof exports !== "undefined") { + factory(); + } else { + var mod = { + exports: {} + }; + factory(); + global.input = mod.exports; + } +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function () { + "use strict"; + + function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } + + var globalThis = {}; + + _typeof(globalThis); +}); diff --git a/packages/babel-preset-env/test/fixtures/plugins-integration/issue-8951/exec.js b/packages/babel-preset-env/test/fixtures/plugins-integration/issue-8951/exec.js new file mode 100644 index 000000000000..0372fa5d04ee --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/plugins-integration/issue-8951/exec.js @@ -0,0 +1,3 @@ +expect(/.(?\p{ASCII})/su.exec("\nA").groups).toEqual({ + code: "A" +}); diff --git a/packages/babel-preset-env/test/fixtures/plugins-integration/issue-8951/options.json b/packages/babel-preset-env/test/fixtures/plugins-integration/issue-8951/options.json new file mode 100644 index 000000000000..26bf537b2805 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/plugins-integration/issue-8951/options.json @@ -0,0 +1,4 @@ +{ + "plugins": [], + "presets": ["../../../../lib"] +} diff --git a/packages/babel-preset-env/test/fixtures/plugins-integration/issue-9892/exec.js b/packages/babel-preset-env/test/fixtures/plugins-integration/issue-9892/exec.js new file mode 100644 index 000000000000..dad5dc1ba34f --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/plugins-integration/issue-9892/exec.js @@ -0,0 +1 @@ +expect(/[\p{L}\d_]+/u.test('ŁŻŹĆ')).toBe(true); diff --git a/packages/babel-preset-env/test/fixtures/plugins-integration/issue-9892/options.json b/packages/babel-preset-env/test/fixtures/plugins-integration/issue-9892/options.json new file mode 100644 index 000000000000..26bf537b2805 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/plugins-integration/issue-9892/options.json @@ -0,0 +1,4 @@ +{ + "plugins": [], + "presets": ["../../../../lib"] +} diff --git a/packages/babel-preset-env/test/fixtures/plugins-integration/issue-9935/input.js b/packages/babel-preset-env/test/fixtures/plugins-integration/issue-9935/input.js new file mode 100644 index 000000000000..af57902922e0 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/plugins-integration/issue-9935/input.js @@ -0,0 +1,7 @@ +class MyClass extends BaseClass { + async loadEntity() { + this.website = await this.loadWebsite(); + this.report.setCompany(this.website.company); + super.loadEntity(); + } +} diff --git a/packages/babel-preset-env/test/fixtures/plugins-integration/issue-9935/options.json b/packages/babel-preset-env/test/fixtures/plugins-integration/issue-9935/options.json new file mode 100644 index 000000000000..70f242c2ca72 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/plugins-integration/issue-9935/options.json @@ -0,0 +1,16 @@ +{ + "presets": [ + [ + "env", + { + "targets": [ + "Chrome >= 60", + "Safari >= 11", + "iOS >= 10.3", + "Firefox >= 55", + "Edge >= 16" + ] + } + ] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/plugins-integration/issue-9935/output.js b/packages/babel-preset-env/test/fixtures/plugins-integration/issue-9935/output.js new file mode 100644 index 000000000000..c955d4e85a46 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/plugins-integration/issue-9935/output.js @@ -0,0 +1,19 @@ +function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } } + +function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; } + +class MyClass extends BaseClass { + loadEntity() { + var _superprop_getLoadEntity = () => super.loadEntity, + _this = this; + + return _asyncToGenerator(function* () { + _this.website = yield _this.loadWebsite(); + + _this.report.setCompany(_this.website.company); + + _superprop_getLoadEntity().call(_this); + })(); + } + +} diff --git a/packages/babel-preset-env/test/fixtures/preset-options/browserslist-defaults-2/options.json b/packages/babel-preset-env/test/fixtures/preset-options/browserslist-defaults-2/options.json deleted file mode 100644 index 7ee0ee1a8a81..000000000000 --- a/packages/babel-preset-env/test/fixtures/preset-options/browserslist-defaults-2/options.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "presets": [ - [ - "../../../../lib", - { - "targets": { - "node": "current", - "browsers": ["defaults", "not ie <= 10"] - } - } - ] - ] -} diff --git a/packages/babel-preset-env/test/fixtures/preset-options/browserslist-defaults-2/output.js b/packages/babel-preset-env/test/fixtures/preset-options/browserslist-defaults-2/output.js deleted file mode 100644 index f894dda6a490..000000000000 --- a/packages/babel-preset-env/test/fixtures/preset-options/browserslist-defaults-2/output.js +++ /dev/null @@ -1,16 +0,0 @@ -"use strict"; - -function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); } - -function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } - -function _iterableToArrayLimit(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } - -function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } - -var test = function test(a, _ref, c) { - var _ref2 = _slicedToArray(_ref, 1), - b = _ref2[0]; - - return ""; -}; diff --git a/packages/babel-preset-env/test/fixtures/preset-options/browserslist-defaults-2/input.mjs b/packages/babel-preset-env/test/fixtures/preset-options/browserslist-defaults-not-ie/input.mjs similarity index 100% rename from packages/babel-preset-env/test/fixtures/preset-options/browserslist-defaults-2/input.mjs rename to packages/babel-preset-env/test/fixtures/preset-options/browserslist-defaults-not-ie/input.mjs diff --git a/packages/babel-preset-env/test/fixtures/preset-options/browserslist-defaults-not-ie/options.json b/packages/babel-preset-env/test/fixtures/preset-options/browserslist-defaults-not-ie/options.json new file mode 100644 index 000000000000..63828ae6c658 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/preset-options/browserslist-defaults-not-ie/options.json @@ -0,0 +1,13 @@ +{ + "presets": [ + [ + "../../../../lib", + { + "targets": { + "node": "current", + "browsers": ["defaults", "not ie <= 10", "not ie_mob <= 10"] + } + } + ] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/preset-options/browserslist-defaults-not-ie/output.js b/packages/babel-preset-env/test/fixtures/preset-options/browserslist-defaults-not-ie/output.js new file mode 100644 index 000000000000..27a1db8f8775 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/preset-options/browserslist-defaults-not-ie/output.js @@ -0,0 +1,16 @@ +"use strict"; + +function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); } + +function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } + +function _iterableToArrayLimit(arr, i) { if (!(Symbol.iterator in Object(arr) || Object.prototype.toString.call(arr) === "[object Arguments]")) { return; } var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } + +function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } + +var test = function test(a, _ref, c) { + var _ref2 = _slicedToArray(_ref, 1), + b = _ref2[0]; + + return ""; +}; diff --git a/packages/babel-preset-env/test/fixtures/preset-options/safari-10_3-block-scoped/options.json b/packages/babel-preset-env/test/fixtures/preset-options/safari-10_3-block-scoped/options.json index 7eca9afc37fe..daee94dc032e 100644 --- a/packages/babel-preset-env/test/fixtures/preset-options/safari-10_3-block-scoped/options.json +++ b/packages/babel-preset-env/test/fixtures/preset-options/safari-10_3-block-scoped/options.json @@ -1,4 +1,5 @@ { + "validateLogs": true, "presets": [ [ "../../../../lib", diff --git a/packages/babel-preset-env/test/fixtures/preset-options/safari-10_3-block-scoped/stdout.txt b/packages/babel-preset-env/test/fixtures/preset-options/safari-10_3-block-scoped/stdout.txt new file mode 100644 index 000000000000..3d7c5bed33ce --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/preset-options/safari-10_3-block-scoped/stdout.txt @@ -0,0 +1,28 @@ +@babel/preset-env: `DEBUG` option + +Using targets: +{ + "safari": "10" +} + +Using modules transform: auto + +Using plugins: + transform-template-literals { "safari":"10" } + transform-dotall-regex { "safari":"10" } + transform-unicode-regex { "safari":"10" } + transform-block-scoping { "safari":"10" } + transform-exponentiation-operator { "safari":"10" } + transform-async-to-generator { "safari":"10" } + proposal-async-generator-functions { "safari":"10" } + proposal-object-rest-spread { "safari":"10" } + proposal-unicode-property-regex { "safari":"10" } + proposal-json-strings { "safari":"10" } + proposal-optional-catch-binding { "safari":"10" } + proposal-optional-chaining { "safari":"10" } + transform-named-capturing-groups-regex { "safari":"10" } + proposal-nullish-coalescing-operator { "safari":"10" } + transform-modules-commonjs { "safari":"10" } + proposal-dynamic-import { "safari":"10" } + +Using polyfills: No polyfills were added, since the `useBuiltIns` option was not set. diff --git a/packages/babel-preset-env/test/fixtures/preset-options/shippedProposals/output.js b/packages/babel-preset-env/test/fixtures/preset-options/shippedProposals/output.js index 4719ee3716e8..36fd231345ab 100644 --- a/packages/babel-preset-env/test/fixtures/preset-options/shippedProposals/output.js +++ b/packages/babel-preset-env/test/fixtures/preset-options/shippedProposals/output.js @@ -1,6 +1,6 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } -function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } +function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } @@ -12,7 +12,7 @@ function _awaitAsyncGenerator(value) { return new _AwaitValue(value); } function _wrapAsyncGenerator(fn) { return function () { return new _AsyncGenerator(fn.apply(this, arguments)); }; } -function _AsyncGenerator(gen) { var front, back; function send(key, arg) { return new Promise(function (resolve, reject) { var request = { key: key, arg: arg, resolve: resolve, reject: reject, next: null }; if (back) { back = back.next = request; } else { front = back = request; resume(key, arg); } }); } function resume(key, arg) { try { var result = gen[key](arg); var value = result.value; var wrappedAwait = value instanceof _AwaitValue; Promise.resolve(wrappedAwait ? value.wrapped : value).then(function (arg) { if (wrappedAwait) { resume("next", arg); return; } settle(result.done ? "return" : "normal", arg); }, function (err) { resume("throw", err); }); } catch (err) { settle("throw", err); } } function settle(type, value) { switch (type) { case "return": front.resolve({ value: value, done: true }); break; case "throw": front.reject(value); break; default: front.resolve({ value: value, done: false }); break; } front = front.next; if (front) { resume(front.key, front.arg); } else { back = null; } } this._invoke = send; if (typeof gen["return"] !== "function") { this["return"] = undefined; } } +function _AsyncGenerator(gen) { var front, back; function send(key, arg) { return new Promise(function (resolve, reject) { var request = { key: key, arg: arg, resolve: resolve, reject: reject, next: null }; if (back) { back = back.next = request; } else { front = back = request; resume(key, arg); } }); } function resume(key, arg) { try { var result = gen[key](arg); var value = result.value; var wrappedAwait = value instanceof _AwaitValue; Promise.resolve(wrappedAwait ? value.wrapped : value).then(function (arg) { if (wrappedAwait) { resume(key === "return" ? "return" : "next", arg); return; } settle(result.done ? "return" : "normal", arg); }, function (err) { resume("throw", err); }); } catch (err) { settle("throw", err); } } function settle(type, value) { switch (type) { case "return": front.resolve({ value: value, done: true }); break; case "throw": front.reject(value); break; default: front.resolve({ value: value, done: false }); break; } front = front.next; if (front) { resume(front.key, front.arg); } else { back = null; } } this._invoke = send; if (typeof gen["return"] !== "function") { this["return"] = undefined; } } if (typeof Symbol === "function" && Symbol.asyncIterator) { _AsyncGenerator.prototype[Symbol.asyncIterator] = function () { return this; }; } diff --git a/packages/babel-preset-env/test/fixtures/preset-options/unicode-property-regex-chrome-49/input.js b/packages/babel-preset-env/test/fixtures/preset-options/unicode-property-regex-chrome-49/input.js new file mode 100644 index 000000000000..4dc88814e7a9 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/preset-options/unicode-property-regex-chrome-49/input.js @@ -0,0 +1 @@ +/\p{Script_Extensions=Greek}/u; diff --git a/packages/babel-preset-env/test/fixtures/preset-options/unicode-property-regex-chrome-49/options.json b/packages/babel-preset-env/test/fixtures/preset-options/unicode-property-regex-chrome-49/options.json new file mode 100644 index 000000000000..0594e8b2ce13 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/preset-options/unicode-property-regex-chrome-49/options.json @@ -0,0 +1,10 @@ +{ + "presets": [ + [ + "../../../../lib", + { + "targets": "chrome 49" + } + ] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/preset-options/unicode-property-regex-chrome-49/output.js b/packages/babel-preset-env/test/fixtures/preset-options/unicode-property-regex-chrome-49/output.js new file mode 100644 index 000000000000..ca4cbfc0fb21 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/preset-options/unicode-property-regex-chrome-49/output.js @@ -0,0 +1 @@ +/(?:[\u0342\u0345\u0370-\u0373\u0375-\u0377\u037A-\u037D\u037F\u0384\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03E1\u03F0-\u03FF\u1D26-\u1D2A\u1D5D-\u1D61\u1D66-\u1D6A\u1DBF-\u1DC1\u1F00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FC4\u1FC6-\u1FD3\u1FD6-\u1FDB\u1FDD-\u1FEF\u1FF2-\u1FF4\u1FF6-\u1FFE\u2126\uAB65]|\uD800[\uDD40-\uDD8E\uDDA0]|\uD834[\uDE00-\uDE45])/; diff --git a/packages/babel-preset-env/test/fixtures/sanity/block-scoping-for-of/output.js b/packages/babel-preset-env/test/fixtures/sanity/block-scoping-for-of/output.js index 391887c3e15c..6fc0a62bd42f 100644 --- a/packages/babel-preset-env/test/fixtures/sanity/block-scoping-for-of/output.js +++ b/packages/babel-preset-env/test/fixtures/sanity/block-scoping-for-of/output.js @@ -2,7 +2,7 @@ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArra function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } -function _iterableToArrayLimit(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } +function _iterableToArrayLimit(arr, i) { if (!(Symbol.iterator in Object(arr) || Object.prototype.toString.call(arr) === "[object Arguments]")) { return; } var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } diff --git a/packages/babel-preset-env/test/fixtures/sanity/issue-10142-corejs2-entry/input.mjs b/packages/babel-preset-env/test/fixtures/sanity/issue-10142-corejs2-entry/input.mjs new file mode 100644 index 000000000000..bd6332b8bac3 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/sanity/issue-10142-corejs2-entry/input.mjs @@ -0,0 +1 @@ +import "core-js"; \ No newline at end of file diff --git a/packages/babel-preset-env/test/fixtures/sanity/issue-10142-corejs2-entry/options.json b/packages/babel-preset-env/test/fixtures/sanity/issue-10142-corejs2-entry/options.json new file mode 100644 index 000000000000..786316f22efb --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/sanity/issue-10142-corejs2-entry/options.json @@ -0,0 +1,14 @@ +{ + "presets": [ + [ + "env", + { + "useBuiltIns": "entry", + "corejs": 2, + "modules": false, + "targets": { "chrome": 65 } + } + ] + ], + "plugins": ["./plugin.js"] +} diff --git a/packages/babel-preset-env/test/fixtures/sanity/issue-10142-corejs2-entry/output.mjs b/packages/babel-preset-env/test/fixtures/sanity/issue-10142-corejs2-entry/output.mjs new file mode 100644 index 000000000000..05407cabf92a --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/sanity/issue-10142-corejs2-entry/output.mjs @@ -0,0 +1,6 @@ +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; diff --git a/packages/babel-preset-env/test/fixtures/sanity/issue-10142-corejs2-entry/plugin.js b/packages/babel-preset-env/test/fixtures/sanity/issue-10142-corejs2-entry/plugin.js new file mode 100644 index 000000000000..931322f3b71d --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/sanity/issue-10142-corejs2-entry/plugin.js @@ -0,0 +1,8 @@ +module.exports = () => ({ + visitor: { + ImportDeclaration(path) { + if (path.node.source.value === "core-js") return; + path.node.source.value = "MODIFIED"; + }, + }, +}); diff --git a/packages/babel-preset-env/test/fixtures/sanity/issue-10142-corejs2-usage/input.mjs b/packages/babel-preset-env/test/fixtures/sanity/issue-10142-corejs2-usage/input.mjs new file mode 100644 index 000000000000..b24e09f0c2fd --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/sanity/issue-10142-corejs2-usage/input.mjs @@ -0,0 +1 @@ +new Map(); \ No newline at end of file diff --git a/packages/babel-preset-env/test/fixtures/sanity/issue-10142-corejs2-usage/options.json b/packages/babel-preset-env/test/fixtures/sanity/issue-10142-corejs2-usage/options.json new file mode 100644 index 000000000000..d7ce4a4a7218 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/sanity/issue-10142-corejs2-usage/options.json @@ -0,0 +1,6 @@ +{ + "presets": [ + ["env", { "useBuiltIns": "usage", "corejs": 2, "modules": false }] + ], + "plugins": ["./plugin.js"] +} diff --git a/packages/babel-preset-env/test/fixtures/sanity/issue-10142-corejs2-usage/output.mjs b/packages/babel-preset-env/test/fixtures/sanity/issue-10142-corejs2-usage/output.mjs new file mode 100644 index 000000000000..2e074eea8b62 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/sanity/issue-10142-corejs2-usage/output.mjs @@ -0,0 +1,6 @@ +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +new Map(); diff --git a/packages/babel-preset-env/test/fixtures/sanity/issue-10142-corejs2-usage/plugin.js b/packages/babel-preset-env/test/fixtures/sanity/issue-10142-corejs2-usage/plugin.js new file mode 100644 index 000000000000..ddfe181cf61e --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/sanity/issue-10142-corejs2-usage/plugin.js @@ -0,0 +1,7 @@ +module.exports = () => ({ + visitor: { + ImportDeclaration(path) { + path.node.source.value = "MODIFIED"; + }, + }, +}); diff --git a/packages/babel-preset-env/test/fixtures/sanity/issue-10142-corejs3-entry/input.mjs b/packages/babel-preset-env/test/fixtures/sanity/issue-10142-corejs3-entry/input.mjs new file mode 100644 index 000000000000..bd6332b8bac3 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/sanity/issue-10142-corejs3-entry/input.mjs @@ -0,0 +1 @@ +import "core-js"; \ No newline at end of file diff --git a/packages/babel-preset-env/test/fixtures/sanity/issue-10142-corejs3-entry/options.json b/packages/babel-preset-env/test/fixtures/sanity/issue-10142-corejs3-entry/options.json new file mode 100644 index 000000000000..79d8456fac83 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/sanity/issue-10142-corejs3-entry/options.json @@ -0,0 +1,14 @@ +{ + "presets": [ + [ + "env", + { + "useBuiltIns": "entry", + "corejs": 3, + "modules": false, + "targets": { "chrome": 65 } + } + ] + ], + "plugins": ["./plugin.js"] +} diff --git a/packages/babel-preset-env/test/fixtures/sanity/issue-10142-corejs3-entry/output.mjs b/packages/babel-preset-env/test/fixtures/sanity/issue-10142-corejs3-entry/output.mjs new file mode 100644 index 000000000000..da903d0b0539 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/sanity/issue-10142-corejs3-entry/output.mjs @@ -0,0 +1,100 @@ +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; diff --git a/packages/babel-preset-env/test/fixtures/sanity/issue-10142-corejs3-entry/plugin.js b/packages/babel-preset-env/test/fixtures/sanity/issue-10142-corejs3-entry/plugin.js new file mode 100644 index 000000000000..931322f3b71d --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/sanity/issue-10142-corejs3-entry/plugin.js @@ -0,0 +1,8 @@ +module.exports = () => ({ + visitor: { + ImportDeclaration(path) { + if (path.node.source.value === "core-js") return; + path.node.source.value = "MODIFIED"; + }, + }, +}); diff --git a/packages/babel-preset-env/test/fixtures/sanity/issue-10142-corejs3-usage/input.mjs b/packages/babel-preset-env/test/fixtures/sanity/issue-10142-corejs3-usage/input.mjs new file mode 100644 index 000000000000..b24e09f0c2fd --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/sanity/issue-10142-corejs3-usage/input.mjs @@ -0,0 +1 @@ +new Map(); \ No newline at end of file diff --git a/packages/babel-preset-env/test/fixtures/sanity/issue-10142-corejs3-usage/options.json b/packages/babel-preset-env/test/fixtures/sanity/issue-10142-corejs3-usage/options.json new file mode 100644 index 000000000000..3d488206b51d --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/sanity/issue-10142-corejs3-usage/options.json @@ -0,0 +1,6 @@ +{ + "presets": [ + ["env", { "useBuiltIns": "usage", "corejs": 3, "modules": false }] + ], + "plugins": ["./plugin.js"] +} diff --git a/packages/babel-preset-env/test/fixtures/sanity/issue-10142-corejs3-usage/output.mjs b/packages/babel-preset-env/test/fixtures/sanity/issue-10142-corejs3-usage/output.mjs new file mode 100644 index 000000000000..2e074eea8b62 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/sanity/issue-10142-corejs3-usage/output.mjs @@ -0,0 +1,6 @@ +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +import "MODIFIED"; +new Map(); diff --git a/packages/babel-preset-env/test/fixtures/sanity/issue-10142-corejs3-usage/plugin.js b/packages/babel-preset-env/test/fixtures/sanity/issue-10142-corejs3-usage/plugin.js new file mode 100644 index 000000000000..ddfe181cf61e --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/sanity/issue-10142-corejs3-usage/plugin.js @@ -0,0 +1,7 @@ +module.exports = () => ({ + visitor: { + ImportDeclaration(path) { + path.node.source.value = "MODIFIED"; + }, + }, +}); diff --git a/packages/babel-preset-env/test/fixtures/sanity/regex-dot-all/output.js b/packages/babel-preset-env/test/fixtures/sanity/regex-dot-all/output.js index a83a16174172..e11606be750b 100644 --- a/packages/babel-preset-env/test/fixtures/sanity/regex-dot-all/output.js +++ b/packages/babel-preset-env/test/fixtures/sanity/regex-dot-all/output.js @@ -1,2 +1,2 @@ -/[\0-\uFFFF]/; +/[\s\S]/; /(?:[\0-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/; diff --git a/packages/babel-preset-env/test/fixtures/top-level-await/supported/input.mjs b/packages/babel-preset-env/test/fixtures/top-level-await/supported/input.mjs new file mode 100644 index 000000000000..d8ddd6c0ad0b --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/top-level-await/supported/input.mjs @@ -0,0 +1 @@ +await 0; \ No newline at end of file diff --git a/packages/babel-preset-env/test/fixtures/top-level-await/supported/options.json b/packages/babel-preset-env/test/fixtures/top-level-await/supported/options.json new file mode 100644 index 000000000000..9307569540d9 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/top-level-await/supported/options.json @@ -0,0 +1,8 @@ +{ + "caller": { + "name": "test-fixture", + "supportsStaticESM": true, + "supportsTopLevelAwait": true + }, + "presets": ["env"] +} diff --git a/packages/babel-preset-env/test/fixtures/top-level-await/supported/output.mjs b/packages/babel-preset-env/test/fixtures/top-level-await/supported/output.mjs new file mode 100644 index 000000000000..0a5e432fc91c --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/top-level-await/supported/output.mjs @@ -0,0 +1 @@ +await 0; diff --git a/packages/babel-preset-env/test/fixtures/top-level-await/unsupported/input.mjs b/packages/babel-preset-env/test/fixtures/top-level-await/unsupported/input.mjs new file mode 100644 index 000000000000..0a5e432fc91c --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/top-level-await/unsupported/input.mjs @@ -0,0 +1 @@ +await 0; diff --git a/packages/babel-preset-env/test/fixtures/top-level-await/unsupported/options.json b/packages/babel-preset-env/test/fixtures/top-level-await/unsupported/options.json new file mode 100644 index 000000000000..65ac70b9a5f7 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/top-level-await/unsupported/options.json @@ -0,0 +1,9 @@ +{ + "caller": { + "name": "test-fixture", + "supportsStaticESM": true, + "supportsTopLevelAwait": false + }, + "presets": ["env"], + "throws": "Can not use keyword 'await' outside an async function (1:0)" +} diff --git a/packages/babel-preset-env/test/index.spec.js b/packages/babel-preset-env/test/index.spec.js index 7b281f4e1885..ded00e6c2e14 100644 --- a/packages/babel-preset-env/test/index.spec.js +++ b/packages/babel-preset-env/test/index.spec.js @@ -1,6 +1,19 @@ "use strict"; const babelPresetEnv = require("../lib/index"); +const addCoreJS2UsagePlugin = require("../lib/polyfills/corejs2/usage-plugin") + .default; +const addCoreJS3UsagePlugin = require("../lib/polyfills/corejs3/usage-plugin") + .default; +const addRegeneratorUsagePlugin = require("../lib/polyfills/regenerator/usage-plugin") + .default; +const replaceCoreJS2EntryPlugin = require("../lib/polyfills/corejs2/entry-plugin") + .default; +const replaceCoreJS3EntryPlugin = require("../lib/polyfills/corejs3/entry-plugin") + .default; +const removeRegeneratorEntryPlugin = require("../lib/polyfills/regenerator/entry-plugin") + .default; +const transformations = require("../lib/module-transformations").default; describe("babel-preset-env", () => { describe("transformIncludesAndExcludes", () => { @@ -24,4 +37,215 @@ describe("babel-preset-env", () => { }); }); }); + describe("getModulesPluginNames", () => { + describe("modules is set to false", () => { + it("returns only syntax-dynamic-import", () => { + expect( + babelPresetEnv.getModulesPluginNames({ + modules: false, + transformations, + shouldTransformESM: false, + shouldTransformDynamicImport: false, + }), + ).toEqual(["syntax-dynamic-import"]); + }); + }); + describe("modules is not set to false", () => { + describe("ESMs should not be transformed", () => { + it("returns syntax-dynamic-import", () => { + expect( + babelPresetEnv.getModulesPluginNames({ + modules: "commonjs", + transformations, + shouldTransformESM: false, + shouldTransformDynamicImport: false, + }), + ).toEqual(["syntax-dynamic-import"]); + }); + }); + describe("ESMs should be transformed", () => { + describe("dynamic imports should not be transformed", () => { + it("returns specified modules transform and syntax-dynamic-import", () => { + expect( + babelPresetEnv.getModulesPluginNames({ + modules: "commonjs", + transformations, + shouldTransformESM: true, + shouldTransformDynamicImport: false, + }), + ).toEqual(["transform-modules-commonjs", "syntax-dynamic-import"]); + }); + }); + describe("dynamic imports should be transformed", () => { + it("returns specified modules transform and proposal-dynamic-import", () => { + expect( + babelPresetEnv.getModulesPluginNames({ + modules: "systemjs", + transformations, + shouldTransformESM: true, + shouldTransformDynamicImport: true, + }), + ).toEqual([ + "transform-modules-systemjs", + "proposal-dynamic-import", + ]); + }); + }); + }); + }); + }); + describe("getPolyfillPlugins", () => { + const staticProps = { + polyfillTargets: [], + include: new Set(), + exclude: new Set(), + proposals: false, + shippedProposals: false, + debug: false, + }; + describe("useBuiltIns is false", () => { + it("returns no polyfill plugins", () => { + expect( + babelPresetEnv.getPolyfillPlugins( + Object.assign( + { + useBuiltIns: false, + corejs: false, + regenerator: false, + }, + staticProps, + ), + ), + ).toEqual([]); + }); + }); + describe("useBuiltIns is not false", () => { + describe("corejs is not given", () => { + it("returns no polyfill plugins", () => { + expect( + babelPresetEnv.getPolyfillPlugins( + Object.assign( + { + useBuiltIns: "usage", + corejs: false, + regenerator: false, + }, + staticProps, + ), + ), + ).toEqual([]); + }); + }); + describe("useBuiltIns is set to usage", () => { + describe("using corejs 2", () => { + it("returns an array with core js 2 usage plugin", () => { + const polyfillPlugins = babelPresetEnv.getPolyfillPlugins( + Object.assign( + { + useBuiltIns: "usage", + corejs: { major: 2 }, + regenerator: false, + }, + staticProps, + ), + ); + expect(polyfillPlugins.length).toBe(1); + expect(polyfillPlugins[0][0]).toEqual(addCoreJS2UsagePlugin); + }); + }); + describe("using corejs 3", () => { + describe("regenerator is set to false", () => { + it("returns an array with core js 3 usage plugin", () => { + const polyfillPlugins = babelPresetEnv.getPolyfillPlugins( + Object.assign( + { + useBuiltIns: "usage", + corejs: { major: 3 }, + regenerator: false, + }, + staticProps, + ), + ); + expect(polyfillPlugins.length).toBe(1); + expect(polyfillPlugins[0][0]).toEqual(addCoreJS3UsagePlugin); + }); + }); + + describe("regenerator is set to true", () => { + it("returns an array with core js 3 usage plugin and add regenerator usage plugin", () => { + const polyfillPlugins = babelPresetEnv.getPolyfillPlugins( + Object.assign( + { + useBuiltIns: "usage", + corejs: { major: 3 }, + regenerator: true, + }, + staticProps, + ), + ); + expect(polyfillPlugins.length).toBe(2); + expect(polyfillPlugins[0][0]).toEqual(addCoreJS3UsagePlugin); + expect(polyfillPlugins[1][0]).toEqual(addRegeneratorUsagePlugin); + }); + }); + }); + }); + describe("useBuiltIns is set to entry", () => { + describe("using corejs 2", () => { + it("returns an array with core js 2 entry plugin", () => { + const polyfillPlugins = babelPresetEnv.getPolyfillPlugins( + Object.assign( + { + useBuiltIns: "entry", + corejs: { major: 2 }, + regenerator: true, + }, + staticProps, + ), + ); + expect(polyfillPlugins.length).toBe(1); + expect(polyfillPlugins[0][0]).toEqual(replaceCoreJS2EntryPlugin); + }); + }); + describe("using corejs 3", () => { + describe("regenerator is set to true", () => { + it("returns an array with core js 3 entry plugin", () => { + const polyfillPlugins = babelPresetEnv.getPolyfillPlugins( + Object.assign( + { + useBuiltIns: "entry", + corejs: { major: 3 }, + regenerator: true, + }, + staticProps, + ), + ); + expect(polyfillPlugins.length).toBe(1); + expect(polyfillPlugins[0][0]).toEqual(replaceCoreJS3EntryPlugin); + }); + }); + + describe("regenerator is set to false", () => { + it("returns an array with core js 3 entry plugin and remove regenerator entry plugin", () => { + const polyfillPlugins = babelPresetEnv.getPolyfillPlugins( + Object.assign( + { + useBuiltIns: "entry", + corejs: { major: 3 }, + regenerator: false, + }, + staticProps, + ), + ); + expect(polyfillPlugins.length).toBe(2); + expect(polyfillPlugins[0][0]).toEqual(replaceCoreJS3EntryPlugin); + expect(polyfillPlugins[1][0]).toEqual( + removeRegeneratorEntryPlugin, + ); + }); + }); + }); + }); + }); + }); }); diff --git a/packages/babel-preset-env/test/is-plugin-required.js b/packages/babel-preset-env/test/is-plugin-required.js deleted file mode 100644 index be999b7c9828..000000000000 --- a/packages/babel-preset-env/test/is-plugin-required.js +++ /dev/null @@ -1,82 +0,0 @@ -"use strict"; - -const presetEnv = require("../"); - -describe("isPluginRequired", () => { - const MAX_VERSION = `${Number.MAX_SAFE_INTEGER}.0.0`; - - it("returns true if no targets are specified", () => { - expect(presetEnv.isPluginRequired({}, {})).toBe(true); - }); - - it("returns true if plugin feature is not implemented in one or more targets", () => { - let targets; - const plugin = { - edge: false, - firefox: 45, - chrome: 49, - }; - - targets = { - chrome: MAX_VERSION, - firefox: MAX_VERSION, - }; - expect(presetEnv.isPluginRequired(targets, plugin)).toBe(false); - - targets = { - edge: "12", - }; - expect(presetEnv.isPluginRequired(targets, plugin)).toBe(true); - }); - - it("returns false if plugin feature is implemented by lower than target", () => { - const plugin = { - chrome: 49, - }; - const targets = { - chrome: MAX_VERSION, - }; - - expect(presetEnv.isPluginRequired(targets, plugin)).toBe(false); - }); - - it("returns false if plugin feature is implemented is equal to target", () => { - const plugin = { - chrome: 49, - }; - const targets = { - chrome: "49.0.0", - }; - expect(presetEnv.isPluginRequired(targets, plugin)).toBe(false); - }); - - it("returns true if plugin feature is implemented is greater than target", () => { - const plugin = { - chrome: 50, - }; - const targets = { - chrome: "49.0.0", - }; - expect(presetEnv.isPluginRequired(targets, plugin)).toBe(true); - }); - - it("returns when target is a decimal", () => { - const plugin = { - node: 6.9, - }; - const targets = { - node: "6.10.0", - }; - expect(presetEnv.isPluginRequired(targets, plugin)).toBe(false); - }); - - it("throws an error if target version is invalid", () => { - const plugin = { - chrome: 50, - }; - const targets = { - chrome: 55, - }; - expect(() => presetEnv.isPluginRequired(targets, plugin)).toThrow(); - }); -}); diff --git a/packages/babel-preset-env/test/normalize-options.spec.js b/packages/babel-preset-env/test/normalize-options.spec.js index eefb69e45f46..abe1ba25b9ea 100644 --- a/packages/babel-preset-env/test/normalize-options.spec.js +++ b/packages/babel-preset-env/test/normalize-options.spec.js @@ -84,6 +84,24 @@ describe("normalize-options", () => { }); }); }); + + it("throws when including module plugins", () => { + expect(() => + normalizeOptions.default({ include: ["proposal-dynamic-import"] }), + ).toThrow(); + expect(() => + normalizeOptions.default({ include: ["transform-modules-amd"] }), + ).toThrow(); + }); + + it("allows exclusion of module plugins ", () => { + expect(() => + normalizeOptions.default({ exclude: ["proposal-dynamic-import"] }), + ).not.toThrow(); + expect(() => + normalizeOptions.default({ exclude: ["transform-modules-commonjs"] }), + ).not.toThrow(); + }); }); describe("Config format validation", () => { diff --git a/packages/babel-preset-env/test/utils.spec.js b/packages/babel-preset-env/test/utils.spec.js deleted file mode 100644 index 2dce5f76c504..000000000000 --- a/packages/babel-preset-env/test/utils.spec.js +++ /dev/null @@ -1,61 +0,0 @@ -"use strict"; - -const utils = require("../lib/utils"); - -const { prettifyTargets, prettifyVersion, semverify, findSuggestion } = utils; - -describe("utils", () => { - describe("semverify", () => { - it("returns", () => { - expect(semverify("1")).toBe("1.0.0"); - expect(semverify("1.0")).toBe("1.0.0"); - expect(semverify("1.0.0")).toBe("1.0.0"); - expect(semverify(1)).toBe("1.0.0"); - expect(semverify(1.2)).toBe("1.2.0"); - }); - - it("throws", () => { - const invalidSemver = () => { - semverify("invalid"); - }; - expect(invalidSemver).toThrow(); - }); - }); - - describe("prettifyVersion", () => { - it("returns", () => { - expect(prettifyVersion(true)).toBe(true); - expect(prettifyVersion("0.16.0")).toBe("0.16"); - expect(prettifyVersion("1.0.0")).toBe("1"); - expect(prettifyVersion("1.1.0")).toBe("1.1"); - expect(prettifyVersion("1.0.2")).toBe("1.0.2"); - expect(prettifyVersion("1.2.3")).toBe("1.2.3"); - }); - }); - - describe("prettifyTargets", () => { - it("returns", () => { - expect(prettifyTargets({})).toEqual({}); - - expect( - prettifyTargets({ - chrome: "54.0.0", - electron: "1.6.0", - node: "0.12.0", - }), - ).toEqual({ - chrome: "54", - electron: "1.6", - node: "0.12", - }); - }); - }); - - describe("findSuggestion", () => { - it("returns", () => { - const options = ["one", "two", "three"]; - expect(findSuggestion(options, "onr")).toEqual("one"); - expect(findSuggestion(options, "tree")).toEqual("three"); - }); - }); -}); diff --git a/packages/babel-preset-flow/package.json b/packages/babel-preset-flow/package.json index 80db216b5fdc..aa3125767b10 100644 --- a/packages/babel-preset-flow/package.json +++ b/packages/babel-preset-flow/package.json @@ -1,6 +1,6 @@ { "name": "@babel/preset-flow", - "version": "7.0.0", + "version": "7.8.3", "description": "Babel preset for all Flow plugins.", "author": "James Kyle ", "repository": "https://github.com/babel/babel/tree/master/packages/babel-preset-flow", @@ -16,14 +16,14 @@ "types" ], "dependencies": { - "@babel/helper-plugin-utils": "^7.0.0", - "@babel/plugin-transform-flow-strip-types": "^7.0.0" + "@babel/helper-plugin-utils": "^7.8.3", + "@babel/plugin-transform-flow-strip-types": "^7.8.3" }, "peerDependencies": { "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.0.0", - "@babel/helper-plugin-test-runner": "^7.0.0" + "@babel/core": "^7.8.3", + "@babel/helper-plugin-test-runner": "^7.8.3" } } diff --git a/packages/babel-preset-react/package.json b/packages/babel-preset-react/package.json index a7c6e195a5ad..ef7f424bee06 100644 --- a/packages/babel-preset-react/package.json +++ b/packages/babel-preset-react/package.json @@ -1,6 +1,6 @@ { "name": "@babel/preset-react", - "version": "7.0.0", + "version": "7.8.3", "description": "Babel preset for all React plugins.", "author": "Sebastian McKenzie ", "homepage": "https://babeljs.io/", @@ -11,18 +11,18 @@ "repository": "https://github.com/babel/babel/tree/master/packages/babel-preset-react", "main": "lib/index.js", "dependencies": { - "@babel/helper-plugin-utils": "^7.0.0", - "@babel/plugin-transform-react-display-name": "^7.0.0", - "@babel/plugin-transform-react-jsx": "^7.0.0", - "@babel/plugin-transform-react-jsx-self": "^7.0.0", - "@babel/plugin-transform-react-jsx-source": "^7.0.0" + "@babel/helper-plugin-utils": "^7.8.3", + "@babel/plugin-transform-react-display-name": "^7.8.3", + "@babel/plugin-transform-react-jsx": "^7.8.3", + "@babel/plugin-transform-react-jsx-self": "^7.8.3", + "@babel/plugin-transform-react-jsx-source": "^7.8.3" }, "peerDependencies": { "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.0.0", - "@babel/helper-plugin-test-runner": "^7.0.0", - "@babel/helper-transform-fixture-test-runner": "^7.0.0" + "@babel/core": "^7.8.3", + "@babel/helper-plugin-test-runner": "^7.8.3", + "@babel/helper-transform-fixture-test-runner": "^7.8.3" } } diff --git a/packages/babel-preset-react/src/index.js b/packages/babel-preset-react/src/index.js index f99fe36e0b1c..aaf358ea5979 100644 --- a/packages/babel-preset-react/src/index.js +++ b/packages/babel-preset-react/src/index.js @@ -13,6 +13,7 @@ export default declare((api, opts) => { opts.throwIfNamespace === undefined ? true : !!opts.throwIfNamespace; const development = !!opts.development; const useBuiltIns = !!opts.useBuiltIns; + const { useSpread } = opts; if (typeof development !== "boolean") { throw new Error( @@ -24,7 +25,7 @@ export default declare((api, opts) => { plugins: [ [ transformReactJSX, - { pragma, pragmaFrag, throwIfNamespace, useBuiltIns }, + { pragma, pragmaFrag, throwIfNamespace, useBuiltIns, useSpread }, ], transformReactDisplayName, diff --git a/packages/babel-preset-react/test/fixtures/preset-options/development-windows/exec.js b/packages/babel-preset-react/test/fixtures/preset-options/development-windows/exec.js new file mode 100644 index 000000000000..3b7eb0d8ede5 --- /dev/null +++ b/packages/babel-preset-react/test/fixtures/preset-options/development-windows/exec.js @@ -0,0 +1,19 @@ +const actual = transform( + '', + Object.assign({}, opts, { filename: 'C:\\fake\\path\\mock.js' }) +).code; + +const expected = multiline([ + 'var _jsxFileName = "C:\\\\fake\\\\path\\\\mock.js";', + 'React.createElement(Foo, {', + ' bar: "baz",', + ' __source: {', + ' fileName: _jsxFileName,', + ' lineNumber: 1', + ' },', + ' __self: this', + '});', +]); + + +expect(actual).toBe(expected); diff --git a/packages/babel-preset-react/test/fixtures/preset-options/development-windows/options.json b/packages/babel-preset-react/test/fixtures/preset-options/development-windows/options.json new file mode 100644 index 000000000000..6ca8659a61e3 --- /dev/null +++ b/packages/babel-preset-react/test/fixtures/preset-options/development-windows/options.json @@ -0,0 +1,4 @@ +{ + "presets": [["react", { "development": true }]], + "os": ["win32"] +} diff --git a/packages/babel-preset-react/test/fixtures/preset-options/development/options.json b/packages/babel-preset-react/test/fixtures/preset-options/development/options.json index 20fb8a7d4beb..69900e734466 100644 --- a/packages/babel-preset-react/test/fixtures/preset-options/development/options.json +++ b/packages/babel-preset-react/test/fixtures/preset-options/development/options.json @@ -1,3 +1,4 @@ { - "presets": [["react", { "development": true }]] + "presets": [["react", { "development": true }]], + "os": ["linux", "darwin"] } diff --git a/packages/babel-preset-stage-0/package.json b/packages/babel-preset-stage-0/package.json index dc2ea43dc886..89f3a492dd69 100644 --- a/packages/babel-preset-stage-0/package.json +++ b/packages/babel-preset-stage-0/package.json @@ -1,6 +1,6 @@ { "name": "@babel/preset-stage-0", - "version": "7.0.0", + "version": "7.8.3", "description": "Babel preset for stage 0 plugins", "author": "Sebastian McKenzie ", "homepage": "https://babeljs.io/", diff --git a/packages/babel-preset-stage-1/package.json b/packages/babel-preset-stage-1/package.json index 377959f83400..fdfb4a3ed66f 100644 --- a/packages/babel-preset-stage-1/package.json +++ b/packages/babel-preset-stage-1/package.json @@ -1,6 +1,6 @@ { "name": "@babel/preset-stage-1", - "version": "7.0.0", + "version": "7.8.3", "description": "Babel preset for stage 1 plugins", "author": "Sebastian McKenzie ", "homepage": "https://babeljs.io/", diff --git a/packages/babel-preset-stage-2/package.json b/packages/babel-preset-stage-2/package.json index af2594050681..25a0d454614a 100644 --- a/packages/babel-preset-stage-2/package.json +++ b/packages/babel-preset-stage-2/package.json @@ -1,6 +1,6 @@ { "name": "@babel/preset-stage-2", - "version": "7.0.0", + "version": "7.8.3", "description": "Babel preset for stage 2 plugins", "author": "Sebastian McKenzie ", "homepage": "https://babeljs.io/", diff --git a/packages/babel-preset-stage-3/package.json b/packages/babel-preset-stage-3/package.json index 2bb6507112e9..ca966abd9b05 100644 --- a/packages/babel-preset-stage-3/package.json +++ b/packages/babel-preset-stage-3/package.json @@ -1,6 +1,6 @@ { "name": "@babel/preset-stage-3", - "version": "7.0.0", + "version": "7.8.3", "description": "Babel preset for stage 3 plugins", "author": "Sebastian McKenzie ", "homepage": "https://babeljs.io/", diff --git a/packages/babel-preset-typescript/.npmignore b/packages/babel-preset-typescript/.npmignore new file mode 100644 index 000000000000..2b1fceba679b --- /dev/null +++ b/packages/babel-preset-typescript/.npmignore @@ -0,0 +1,3 @@ +*.log +src +test diff --git a/packages/babel-preset-typescript/package.json b/packages/babel-preset-typescript/package.json index b4db8bc25602..79c25e30b79d 100644 --- a/packages/babel-preset-typescript/package.json +++ b/packages/babel-preset-typescript/package.json @@ -1,6 +1,6 @@ { "name": "@babel/preset-typescript", - "version": "7.3.3", + "version": "7.8.3", "description": "Babel preset for TypeScript.", "repository": "https://github.com/babel/babel/tree/master/packages/babel-preset-typescript", "license": "MIT", @@ -13,14 +13,14 @@ "typescript" ], "dependencies": { - "@babel/helper-plugin-utils": "^7.0.0", - "@babel/plugin-transform-typescript": "^7.3.2" + "@babel/helper-plugin-utils": "^7.8.3", + "@babel/plugin-transform-typescript": "^7.8.3" }, "peerDependencies": { "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.3.3", - "@babel/helper-plugin-test-runner": "^7.0.0" + "@babel/core": "^7.8.3", + "@babel/helper-plugin-test-runner": "^7.8.3" } } diff --git a/packages/babel-preset-typescript/src/index.js b/packages/babel-preset-typescript/src/index.js index ebbb2390fde1..f3159543f66d 100644 --- a/packages/babel-preset-typescript/src/index.js +++ b/packages/babel-preset-typescript/src/index.js @@ -2,12 +2,22 @@ import { declare } from "@babel/helper-plugin-utils"; import transformTypeScript from "@babel/plugin-transform-typescript"; export default declare( - (api, { jsxPragma, allExtensions = false, isTSX = false }) => { + ( + api, + { + jsxPragma, + allExtensions = false, + isTSX = false, + allowNamespaces, + allowDeclareFields, + }, + ) => { api.assertVersion(7); if (typeof allExtensions !== "boolean") { throw new Error(".allExtensions must be a boolean, or undefined"); } + if (typeof isTSX !== "boolean") { throw new Error(".isTSX must be a boolean, or undefined"); } @@ -16,11 +26,18 @@ export default declare( throw new Error("isTSX:true requires allExtensions:true"); } + const pluginOptions = isTSX => ({ + jsxPragma, + isTSX, + allowNamespaces, + allowDeclareFields, + }); + return { overrides: allExtensions ? [ { - plugins: [[transformTypeScript, { jsxPragma, isTSX }]], + plugins: [[transformTypeScript, pluginOptions(isTSX)]], }, ] : [ @@ -28,13 +45,13 @@ export default declare( // Only set 'test' if explicitly requested, since it requires that // Babel is being called` test: /\.ts$/, - plugins: [[transformTypeScript, { jsxPragma }]], + plugins: [[transformTypeScript, pluginOptions(false)]], }, { // Only set 'test' if explicitly requested, since it requires that // Babel is being called` test: /\.tsx$/, - plugins: [[transformTypeScript, { jsxPragma, isTSX: true }]], + plugins: [[transformTypeScript, pluginOptions(true)]], }, ], }; diff --git a/packages/babel-preset-typescript/test/fixtures/jsx-compat/ts-invalid/options.json b/packages/babel-preset-typescript/test/fixtures/jsx-compat/ts-invalid/options.json index 4c0aa124656f..c11cb6fdfbdf 100644 --- a/packages/babel-preset-typescript/test/fixtures/jsx-compat/ts-invalid/options.json +++ b/packages/babel-preset-typescript/test/fixtures/jsx-compat/ts-invalid/options.json @@ -1,3 +1,3 @@ { - "throws": "Unexpected token, expected \"/<=/>=\" (1:6)" + "throws": "Unexpected token, expected \",\" (1:6)" } diff --git a/packages/babel-register/package.json b/packages/babel-register/package.json index 28923cfdd186..38a6a05c0063 100644 --- a/packages/babel-register/package.json +++ b/packages/babel-register/package.json @@ -1,6 +1,6 @@ { "name": "@babel/register", - "version": "7.5.5", + "version": "7.8.3", "description": "babel require hook", "license": "MIT", "publishConfig": { @@ -13,18 +13,19 @@ "./lib/node.js": "./lib/browser.js" }, "dependencies": { - "core-js": "^3.0.0", "find-cache-dir": "^2.0.0", "lodash": "^4.17.13", - "mkdirp": "^0.5.1", + "make-dir": "^2.1.0", "pirates": "^4.0.0", - "source-map-support": "^0.5.9" + "source-map-support": "^0.5.16" }, "peerDependencies": { "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.5.5", + "@babel/core": "^7.8.3", + "@babel/plugin-transform-modules-commonjs": "^7.8.3", + "browserify": "16.5.0", "default-require-extensions": "^2.0.0" } } diff --git a/packages/babel-register/src/cache.js b/packages/babel-register/src/cache.js index 439c92c30851..b505bb4943c7 100644 --- a/packages/babel-register/src/cache.js +++ b/packages/babel-register/src/cache.js @@ -1,7 +1,7 @@ import path from "path"; import fs from "fs"; import os from "os"; -import { sync as mkdirpSync } from "mkdirp"; +import { sync as makeDirSync } from "make-dir"; import * as babel from "@babel/core"; import findCacheDir from "find-cache-dir"; @@ -14,11 +14,17 @@ const DEFAULT_FILENAME = path.join( const FILENAME: string = process.env.BABEL_CACHE_PATH || DEFAULT_FILENAME; let data: Object = {}; +let cacheDisabled = false; + +function isCacheDisabled() { + return process.env.BABEL_DISABLE_CACHE ?? cacheDisabled; +} /** * Write stringified cache to disk. */ export function save() { + if (isCacheDisabled()) return; let serialised: string = "{}"; try { @@ -32,8 +38,30 @@ export function save() { } } - mkdirpSync(path.dirname(FILENAME)); - fs.writeFileSync(FILENAME, serialised); + try { + makeDirSync(path.dirname(FILENAME)); + fs.writeFileSync(FILENAME, serialised); + } catch (e) { + switch (e.code) { + case "EACCES": + case "EPERM": + console.warn( + `Babel could not write cache to file: ${FILENAME} +due to a permission issue. Cache is disabled.`, + ); + cacheDisabled = true; + break; + case "EROFS": + console.warn( + `Babel could not write cache to file: ${FILENAME} +because it resides in a readonly filesystem. Cache is disabled.`, + ); + cacheDisabled = true; + break; + default: + throw e; + } + } } /** @@ -41,18 +69,37 @@ export function save() { */ export function load() { - if (process.env.BABEL_DISABLE_CACHE) return; + if (isCacheDisabled()) { + data = {}; + return; + } process.on("exit", save); process.nextTick(save); - if (!fs.existsSync(FILENAME)) return; + let cacheContent; try { - data = JSON.parse(fs.readFileSync(FILENAME)); - } catch (err) { - return; + cacheContent = fs.readFileSync(FILENAME); + } catch (e) { + switch (e.code) { + // check EACCES only as fs.readFileSync will never throw EPERM on Windows + // https://github.com/libuv/libuv/blob/076df64dbbda4320f93375913a728efc40e12d37/src/win/fs.c#L735 + case "EACCES": + console.warn( + `Babel could not read cache file: ${FILENAME} +due to a permission issue. Cache is disabled.`, + ); + cacheDisabled = true; + /* fall through */ + default: + return; + } } + + try { + data = JSON.parse(cacheContent); + } catch {} } /** diff --git a/packages/babel-core/test/browserify.js b/packages/babel-register/test/browserify.js similarity index 100% rename from packages/babel-core/test/browserify.js rename to packages/babel-register/test/browserify.js diff --git a/packages/babel-register/test/cache.js b/packages/babel-register/test/cache.js index c9704cbdd3ab..f4fb2de2e8ec 100644 --- a/packages/babel-register/test/cache.js +++ b/packages/babel-register/test/cache.js @@ -7,12 +7,12 @@ const oldBabelDisableCacheValue = process.env.BABEL_DISABLE_CACHE; process.env.BABEL_CACHE_PATH = testCacheFilename; delete process.env.BABEL_DISABLE_CACHE; -function writeCache(data) { +function writeCache(data, mode = 0o666) { if (typeof data === "object") { data = JSON.stringify(data); } - fs.writeFileSync(testCacheFilename, data); + fs.writeFileSync(testCacheFilename, data, { mode }); } function cleanCache() { @@ -73,5 +73,39 @@ describe("@babel/register - caching", () => { expect(fs.existsSync(testCacheFilename)).toBe(true); expect(get()).toEqual({}); }); + + it("should create the cache after load", cb => { + load(); + + process.nextTick(() => { + expect(fs.existsSync(testCacheFilename)).toBe(true); + expect(get()).toEqual({}); + cb(); + }); + }); + + // Only write mode is effective on Windows + if (process.platform !== "win32") { + it("should be disabled when CACHE_PATH is not allowed to read", () => { + writeCache({ foo: "bar" }, 0o266); + + load(); + + expect(get()).toEqual({}); + }); + } + + it("should be disabled when CACHE_PATH is not allowed to write", cb => { + writeCache({ foo: "bar" }, 0o466); + + load(); + + expect(get()).toEqual({ foo: "bar" }); + process.nextTick(() => { + load(); + expect(get()).toEqual({}); + cb(); + }); + }); }); }); diff --git a/packages/babel-register/test/__data__/.babelrc b/packages/babel-register/test/fixtures/babelrc/.babelrc similarity index 100% rename from packages/babel-register/test/__data__/.babelrc rename to packages/babel-register/test/fixtures/babelrc/.babelrc diff --git a/packages/babel-register/test/__data__/es2015.js b/packages/babel-register/test/fixtures/babelrc/es2015.js similarity index 100% rename from packages/babel-register/test/__data__/es2015.js rename to packages/babel-register/test/fixtures/babelrc/es2015.js diff --git a/packages/babel-core/test/fixtures/browserify/register.js b/packages/babel-register/test/fixtures/browserify/register.js similarity index 100% rename from packages/babel-core/test/fixtures/browserify/register.js rename to packages/babel-register/test/fixtures/browserify/register.js diff --git a/packages/babel-register/test/index.js b/packages/babel-register/test/index.js index 1f54094e9d9a..a61a8cb19163 100644 --- a/packages/babel-register/test/index.js +++ b/packages/babel-register/test/index.js @@ -6,7 +6,7 @@ let currentOptions; let sourceMapSupport = false; const registerFile = require.resolve("../lib/node"); -const testFile = require.resolve("./__data__/es2015"); +const testFile = require.resolve("./fixtures/babelrc/es2015"); const testFileContent = fs.readFileSync(testFile); jest.mock("pirates", () => { diff --git a/packages/babel-runtime-corejs2/helpers/esm/package.json b/packages/babel-runtime-corejs2/helpers/esm/package.json new file mode 100644 index 000000000000..aead43de364c --- /dev/null +++ b/packages/babel-runtime-corejs2/helpers/esm/package.json @@ -0,0 +1,3 @@ +{ + "type": "module" +} \ No newline at end of file diff --git a/packages/babel-runtime-corejs2/helpers/esm/temporalRef.js b/packages/babel-runtime-corejs2/helpers/esm/temporalRef.js index 4b0679c64cfc..6d167a30397b 100644 --- a/packages/babel-runtime-corejs2/helpers/esm/temporalRef.js +++ b/packages/babel-runtime-corejs2/helpers/esm/temporalRef.js @@ -1,8 +1,5 @@ import undef from "./temporalUndefined"; +import err from "./tdz"; export default function _temporalRef(val, name) { - if (val === undef) { - throw new ReferenceError(name + " is not defined - temporal dead zone"); - } else { - return val; - } + return val === undef ? err(name) : val; } \ No newline at end of file diff --git a/packages/babel-runtime-corejs2/helpers/temporalRef.js b/packages/babel-runtime-corejs2/helpers/temporalRef.js index 20b2652a1f8c..8aa5e5e58dcb 100644 --- a/packages/babel-runtime-corejs2/helpers/temporalRef.js +++ b/packages/babel-runtime-corejs2/helpers/temporalRef.js @@ -1,11 +1,9 @@ var temporalUndefined = require("./temporalUndefined"); +var tdz = require("./tdz"); + function _temporalRef(val, name) { - if (val === temporalUndefined) { - throw new ReferenceError(name + " is not defined - temporal dead zone"); - } else { - return val; - } + return val === temporalUndefined ? tdz(name) : val; } module.exports = _temporalRef; \ No newline at end of file diff --git a/packages/babel-runtime-corejs2/package.json b/packages/babel-runtime-corejs2/package.json index 5ae56e822e16..fe25979a754b 100644 --- a/packages/babel-runtime-corejs2/package.json +++ b/packages/babel-runtime-corejs2/package.json @@ -1,6 +1,6 @@ { "name": "@babel/runtime-corejs2", - "version": "7.5.5", + "version": "7.8.3", "description": "babel's modular runtime helpers with core-js@2 polyfilling", "license": "MIT", "publishConfig": { @@ -13,6 +13,6 @@ "regenerator-runtime": "^0.13.2" }, "devDependencies": { - "@babel/helpers": "^7.5.5" + "@babel/helpers": "^7.8.3" } } diff --git a/packages/babel-runtime-corejs3/helpers/esm/package.json b/packages/babel-runtime-corejs3/helpers/esm/package.json new file mode 100644 index 000000000000..aead43de364c --- /dev/null +++ b/packages/babel-runtime-corejs3/helpers/esm/package.json @@ -0,0 +1,3 @@ +{ + "type": "module" +} \ No newline at end of file diff --git a/packages/babel-runtime-corejs3/package.json b/packages/babel-runtime-corejs3/package.json index 5a0f640973d6..94ca4bb46d97 100644 --- a/packages/babel-runtime-corejs3/package.json +++ b/packages/babel-runtime-corejs3/package.json @@ -1,6 +1,6 @@ { "name": "@babel/runtime-corejs3", - "version": "7.5.5", + "version": "7.8.3", "description": "babel's modular runtime helpers with core-js@3 polyfilling", "license": "MIT", "publishConfig": { diff --git a/packages/babel-runtime-corejs3/test/index.spec.js b/packages/babel-runtime-corejs3/test/index.spec.js index 5f58d25022aa..88af741b9b43 100644 --- a/packages/babel-runtime-corejs3/test/index.spec.js +++ b/packages/babel-runtime-corejs3/test/index.spec.js @@ -274,7 +274,7 @@ describe("babel-runtime", () => { it("matchAll, exists", () => { expect( - typeof require("../core-js/instance/match-all")("").call("qwe", /./).next, + typeof require("../core-js/instance/match-all")("").call("qwe", /./g).next, ).toEqual("function"); }); diff --git a/packages/babel-runtime/helpers/esm/package.json b/packages/babel-runtime/helpers/esm/package.json new file mode 100644 index 000000000000..aead43de364c --- /dev/null +++ b/packages/babel-runtime/helpers/esm/package.json @@ -0,0 +1,3 @@ +{ + "type": "module" +} \ No newline at end of file diff --git a/packages/babel-runtime/helpers/esm/temporalRef.js b/packages/babel-runtime/helpers/esm/temporalRef.js index 4b0679c64cfc..6d167a30397b 100644 --- a/packages/babel-runtime/helpers/esm/temporalRef.js +++ b/packages/babel-runtime/helpers/esm/temporalRef.js @@ -1,8 +1,5 @@ import undef from "./temporalUndefined"; +import err from "./tdz"; export default function _temporalRef(val, name) { - if (val === undef) { - throw new ReferenceError(name + " is not defined - temporal dead zone"); - } else { - return val; - } + return val === undef ? err(name) : val; } \ No newline at end of file diff --git a/packages/babel-runtime/helpers/temporalRef.js b/packages/babel-runtime/helpers/temporalRef.js index 20b2652a1f8c..8aa5e5e58dcb 100644 --- a/packages/babel-runtime/helpers/temporalRef.js +++ b/packages/babel-runtime/helpers/temporalRef.js @@ -1,11 +1,9 @@ var temporalUndefined = require("./temporalUndefined"); +var tdz = require("./tdz"); + function _temporalRef(val, name) { - if (val === temporalUndefined) { - throw new ReferenceError(name + " is not defined - temporal dead zone"); - } else { - return val; - } + return val === temporalUndefined ? tdz(name) : val; } module.exports = _temporalRef; \ No newline at end of file diff --git a/packages/babel-runtime/package.json b/packages/babel-runtime/package.json index bb097bddded6..7353d4da1cb1 100644 --- a/packages/babel-runtime/package.json +++ b/packages/babel-runtime/package.json @@ -1,17 +1,22 @@ { "name": "@babel/runtime", - "version": "7.5.5", + "version": "7.8.3", "description": "babel's modular runtime helpers", "license": "MIT", "publishConfig": { "access": "public" }, - "repository": "https://github.com/babel/babel/tree/master/packages/babel-runtime", + "repository": { + "type": "git", + "url": "https://github.com/babel/babel.git", + "directory": "packages/babel-runtime" + }, + "homepage": "https://babeljs.io/docs/en/next/babel-runtime", "author": "Sebastian McKenzie ", "dependencies": { "regenerator-runtime": "^0.13.2" }, "devDependencies": { - "@babel/helpers": "^7.5.5" + "@babel/helpers": "^7.8.3" } } diff --git a/packages/babel-standalone/package.json b/packages/babel-standalone/package.json index 7d94b31d7a1c..eb08a86d2c44 100644 --- a/packages/babel-standalone/package.json +++ b/packages/babel-standalone/package.json @@ -1,103 +1,109 @@ { "name": "@babel/standalone", - "version": "7.5.5", + "version": "7.8.3", "description": "Standalone build of Babel for use in non-Node.js environments.", "main": "babel.js", "files": [ "babel.js", - "babel.min.js", - "src" + "babel.min.js" ], + "scripts": { + "prepublishOnly": "cd ../.. && make prepublish-build-standalone" + }, "devDependencies": { - "@babel/core": "^7.5.5", - "@babel/helper-plugin-utils": "^7.0.0", - "@babel/plugin-external-helpers": "^7.2.0", - "@babel/plugin-proposal-async-generator-functions": "^7.2.0", - "@babel/plugin-proposal-class-properties": "^7.5.5", - "@babel/plugin-proposal-decorators": "^7.4.4", - "@babel/plugin-proposal-do-expressions": "^7.5.0", - "@babel/plugin-proposal-export-default-from": "^7.5.2", - "@babel/plugin-proposal-export-namespace-from": "^7.5.2", - "@babel/plugin-proposal-function-bind": "^7.2.0", - "@babel/plugin-proposal-function-sent": "^7.5.0", - "@babel/plugin-proposal-json-strings": "^7.2.0", - "@babel/plugin-proposal-logical-assignment-operators": "^7.2.0", - "@babel/plugin-proposal-nullish-coalescing-operator": "^7.4.4", - "@babel/plugin-proposal-numeric-separator": "^7.2.0", - "@babel/plugin-proposal-object-rest-spread": "^7.5.5", - "@babel/plugin-proposal-optional-catch-binding": "^7.2.0", - "@babel/plugin-proposal-optional-chaining": "^7.2.0", - "@babel/plugin-proposal-pipeline-operator": "^7.5.0", - "@babel/plugin-proposal-private-methods": "^7.4.4", - "@babel/plugin-proposal-throw-expressions": "^7.2.0", - "@babel/plugin-proposal-unicode-property-regex": "^7.4.4", - "@babel/plugin-syntax-async-generators": "^7.2.0", - "@babel/plugin-syntax-class-properties": "^7.2.0", - "@babel/plugin-syntax-decorators": "^7.2.0", - "@babel/plugin-syntax-do-expressions": "^7.2.0", - "@babel/plugin-syntax-dynamic-import": "^7.2.0", - "@babel/plugin-syntax-export-default-from": "^7.2.0", - "@babel/plugin-syntax-export-namespace-from": "^7.2.0", - "@babel/plugin-syntax-flow": "^7.2.0", - "@babel/plugin-syntax-function-bind": "^7.2.0", - "@babel/plugin-syntax-function-sent": "^7.2.0", - "@babel/plugin-syntax-import-meta": "^7.2.0", - "@babel/plugin-syntax-jsx": "^7.2.0", - "@babel/plugin-syntax-object-rest-spread": "^7.2.0", - "@babel/plugin-syntax-optional-catch-binding": "^7.2.0", - "@babel/plugin-syntax-pipeline-operator": "^7.5.0", - "@babel/plugin-syntax-typescript": "^7.3.3", - "@babel/plugin-transform-arrow-functions": "^7.2.0", - "@babel/plugin-transform-async-to-generator": "^7.5.0", - "@babel/plugin-transform-block-scoped-functions": "^7.2.0", - "@babel/plugin-transform-block-scoping": "^7.5.5", - "@babel/plugin-transform-classes": "^7.5.5", - "@babel/plugin-transform-computed-properties": "^7.2.0", - "@babel/plugin-transform-destructuring": "^7.5.0", - "@babel/plugin-transform-dotall-regex": "^7.4.4", - "@babel/plugin-transform-duplicate-keys": "^7.5.0", - "@babel/plugin-transform-exponentiation-operator": "^7.2.0", - "@babel/plugin-transform-flow-comments": "^7.5.5", - "@babel/plugin-transform-flow-strip-types": "^7.4.4", - "@babel/plugin-transform-for-of": "^7.4.4", - "@babel/plugin-transform-function-name": "^7.4.4", - "@babel/plugin-transform-instanceof": "^7.5.5", - "@babel/plugin-transform-jscript": "^7.2.0", - "@babel/plugin-transform-literals": "^7.2.0", - "@babel/plugin-transform-member-expression-literals": "^7.2.0", - "@babel/plugin-transform-modules-amd": "^7.5.0", - "@babel/plugin-transform-modules-commonjs": "^7.5.0", - "@babel/plugin-transform-modules-systemjs": "^7.5.0", - "@babel/plugin-transform-modules-umd": "^7.2.0", - "@babel/plugin-transform-new-target": "^7.4.4", - "@babel/plugin-transform-object-assign": "^7.2.0", - "@babel/plugin-transform-object-set-prototype-of-to-assign": "^7.2.0", - "@babel/plugin-transform-object-super": "^7.5.5", - "@babel/plugin-transform-parameters": "^7.4.4", - "@babel/plugin-transform-property-literals": "^7.2.0", - "@babel/plugin-transform-property-mutators": "^7.2.0", - "@babel/plugin-transform-proto-to-assign": "^7.5.5", - "@babel/plugin-transform-react-constant-elements": "^7.5.0", - "@babel/plugin-transform-react-display-name": "^7.2.0", - "@babel/plugin-transform-react-inline-elements": "^7.2.0", - "@babel/plugin-transform-react-jsx": "^7.3.0", - "@babel/plugin-transform-react-jsx-compat": "^7.2.0", - "@babel/plugin-transform-react-jsx-self": "^7.2.0", - "@babel/plugin-transform-react-jsx-source": "^7.5.0", - "@babel/plugin-transform-regenerator": "^7.4.5", - "@babel/plugin-transform-reserved-words": "^7.2.0", - "@babel/plugin-transform-runtime": "^7.5.5", - "@babel/plugin-transform-shorthand-properties": "^7.2.0", - "@babel/plugin-transform-spread": "^7.2.2", - "@babel/plugin-transform-sticky-regex": "^7.2.0", - "@babel/plugin-transform-strict-mode": "^7.2.0", - "@babel/plugin-transform-template-literals": "^7.4.4", - "@babel/plugin-transform-typeof-symbol": "^7.2.0", - "@babel/plugin-transform-typescript": "^7.5.5", - "@babel/plugin-transform-unicode-regex": "^7.4.4", - "@babel/preset-flow": "^7.0.0", - "@babel/preset-react": "^7.0.0", - "@babel/preset-typescript": "^7.3.3" + "@babel/core": "^7.8.3", + "@babel/helper-plugin-utils": "^7.8.3", + "@babel/plugin-external-helpers": "^7.8.3", + "@babel/plugin-proposal-async-generator-functions": "^7.8.3", + "@babel/plugin-proposal-class-properties": "^7.8.3", + "@babel/plugin-proposal-decorators": "^7.8.3", + "@babel/plugin-proposal-do-expressions": "^7.8.3", + "@babel/plugin-proposal-dynamic-import": "^7.8.3", + "@babel/plugin-proposal-export-default-from": "^7.8.3", + "@babel/plugin-proposal-export-namespace-from": "^7.8.3", + "@babel/plugin-proposal-function-bind": "^7.8.3", + "@babel/plugin-proposal-function-sent": "^7.8.3", + "@babel/plugin-proposal-json-strings": "^7.8.3", + "@babel/plugin-proposal-logical-assignment-operators": "^7.8.3", + "@babel/plugin-proposal-nullish-coalescing-operator": "^7.8.3", + "@babel/plugin-proposal-numeric-separator": "^7.8.3", + "@babel/plugin-proposal-object-rest-spread": "^7.8.3", + "@babel/plugin-proposal-optional-catch-binding": "^7.8.3", + "@babel/plugin-proposal-optional-chaining": "^7.8.3", + "@babel/plugin-proposal-pipeline-operator": "^7.8.3", + "@babel/plugin-proposal-private-methods": "^7.8.3", + "@babel/plugin-proposal-throw-expressions": "^7.8.3", + "@babel/plugin-proposal-unicode-property-regex": "^7.8.3", + "@babel/plugin-syntax-async-generators": "^7.8.0", + "@babel/plugin-syntax-class-properties": "^7.8.3", + "@babel/plugin-syntax-decorators": "^7.8.3", + "@babel/plugin-syntax-do-expressions": "^7.8.3", + "@babel/plugin-syntax-dynamic-import": "^7.8.0", + "@babel/plugin-syntax-export-default-from": "^7.8.3", + "@babel/plugin-syntax-export-namespace-from": "^7.8.3", + "@babel/plugin-syntax-flow": "^7.8.3", + "@babel/plugin-syntax-function-bind": "^7.8.3", + "@babel/plugin-syntax-function-sent": "^7.8.3", + "@babel/plugin-syntax-import-meta": "^7.8.3", + "@babel/plugin-syntax-jsx": "^7.8.3", + "@babel/plugin-syntax-object-rest-spread": "^7.8.0", + "@babel/plugin-syntax-optional-catch-binding": "^7.8.0", + "@babel/plugin-syntax-pipeline-operator": "^7.8.3", + "@babel/plugin-syntax-top-level-await": "^7.8.3", + "@babel/plugin-syntax-typescript": "^7.8.3", + "@babel/plugin-transform-arrow-functions": "^7.8.3", + "@babel/plugin-transform-async-to-generator": "^7.8.3", + "@babel/plugin-transform-block-scoped-functions": "^7.8.3", + "@babel/plugin-transform-block-scoping": "^7.8.3", + "@babel/plugin-transform-classes": "^7.8.3", + "@babel/plugin-transform-computed-properties": "^7.8.3", + "@babel/plugin-transform-destructuring": "^7.8.3", + "@babel/plugin-transform-dotall-regex": "^7.8.3", + "@babel/plugin-transform-duplicate-keys": "^7.8.3", + "@babel/plugin-transform-exponentiation-operator": "^7.8.3", + "@babel/plugin-transform-flow-comments": "^7.8.3", + "@babel/plugin-transform-flow-strip-types": "^7.8.3", + "@babel/plugin-transform-for-of": "^7.8.3", + "@babel/plugin-transform-function-name": "^7.8.3", + "@babel/plugin-transform-instanceof": "^7.8.3", + "@babel/plugin-transform-jscript": "^7.8.3", + "@babel/plugin-transform-literals": "^7.8.3", + "@babel/plugin-transform-member-expression-literals": "^7.8.3", + "@babel/plugin-transform-modules-amd": "^7.8.3", + "@babel/plugin-transform-modules-commonjs": "^7.8.3", + "@babel/plugin-transform-modules-systemjs": "^7.8.3", + "@babel/plugin-transform-modules-umd": "^7.8.3", + "@babel/plugin-transform-named-capturing-groups-regex": "^7.8.3", + "@babel/plugin-transform-new-target": "^7.8.3", + "@babel/plugin-transform-object-assign": "^7.8.3", + "@babel/plugin-transform-object-set-prototype-of-to-assign": "^7.8.3", + "@babel/plugin-transform-object-super": "^7.8.3", + "@babel/plugin-transform-parameters": "^7.8.3", + "@babel/plugin-transform-property-literals": "^7.8.3", + "@babel/plugin-transform-property-mutators": "^7.8.3", + "@babel/plugin-transform-proto-to-assign": "^7.8.3", + "@babel/plugin-transform-react-constant-elements": "^7.8.3", + "@babel/plugin-transform-react-display-name": "^7.8.3", + "@babel/plugin-transform-react-inline-elements": "^7.8.3", + "@babel/plugin-transform-react-jsx": "^7.8.3", + "@babel/plugin-transform-react-jsx-compat": "^7.8.3", + "@babel/plugin-transform-react-jsx-self": "^7.8.3", + "@babel/plugin-transform-react-jsx-source": "^7.8.3", + "@babel/plugin-transform-regenerator": "^7.8.3", + "@babel/plugin-transform-reserved-words": "^7.8.3", + "@babel/plugin-transform-runtime": "^7.8.3", + "@babel/plugin-transform-shorthand-properties": "^7.8.3", + "@babel/plugin-transform-spread": "^7.8.3", + "@babel/plugin-transform-sticky-regex": "^7.8.3", + "@babel/plugin-transform-strict-mode": "^7.8.3", + "@babel/plugin-transform-template-literals": "^7.8.3", + "@babel/plugin-transform-typeof-symbol": "^7.8.3", + "@babel/plugin-transform-typescript": "^7.8.3", + "@babel/plugin-transform-unicode-regex": "^7.8.3", + "@babel/preset-env": "^7.8.3", + "@babel/preset-flow": "^7.8.3", + "@babel/preset-react": "^7.8.3", + "@babel/preset-typescript": "^7.8.3" }, "keywords": [ "babel", diff --git a/packages/babel-standalone/scripts/pluginConfig.json b/packages/babel-standalone/scripts/pluginConfig.json index 338d1d1f1bc9..9d58160962ee 100644 --- a/packages/babel-standalone/scripts/pluginConfig.json +++ b/packages/babel-standalone/scripts/pluginConfig.json @@ -15,11 +15,13 @@ "syntax-object-rest-spread", "syntax-optional-catch-binding", "syntax-pipeline-operator", + "syntax-top-level-await", "syntax-typescript", "proposal-async-generator-functions", "proposal-class-properties", "proposal-decorators", "proposal-do-expressions", + "proposal-dynamic-import", "proposal-export-default-from", "proposal-export-namespace-from", "proposal-function-bind", @@ -57,6 +59,7 @@ "transform-modules-commonjs", "transform-modules-systemjs", "transform-modules-umd", + "transform-named-capturing-groups-regex", "transform-new-target", "transform-object-assign", "transform-object-super", diff --git a/packages/babel-standalone/scripts/prepublish.js b/packages/babel-standalone/scripts/prepublish.js deleted file mode 100644 index daadffb117ef..000000000000 --- a/packages/babel-standalone/scripts/prepublish.js +++ /dev/null @@ -1,7 +0,0 @@ -// This file is executed by lerna before publishing @babel/standalone, -// so that it has the new version and not the old one. - -require("child_process").execSync("make prepublish-build-standalone", { - cwd: require("path").resolve(__dirname, "../../.."), - stdio: "inherit", -}); diff --git a/packages/babel-standalone/src/generated/plugins.js b/packages/babel-standalone/src/generated/plugins.js index 3967a839565c..313ccd07bbc0 100644 --- a/packages/babel-standalone/src/generated/plugins.js +++ b/packages/babel-standalone/src/generated/plugins.js @@ -19,11 +19,13 @@ import syntaxJsx from "@babel/plugin-syntax-jsx"; import syntaxObjectRestSpread from "@babel/plugin-syntax-object-rest-spread"; import syntaxOptionalCatchBinding from "@babel/plugin-syntax-optional-catch-binding"; import syntaxPipelineOperator from "@babel/plugin-syntax-pipeline-operator"; +import syntaxTopLevelAwait from "@babel/plugin-syntax-top-level-await"; import syntaxTypescript from "@babel/plugin-syntax-typescript"; import proposalAsyncGeneratorFunctions from "@babel/plugin-proposal-async-generator-functions"; import proposalClassProperties from "@babel/plugin-proposal-class-properties"; import proposalDecorators from "@babel/plugin-proposal-decorators"; import proposalDoExpressions from "@babel/plugin-proposal-do-expressions"; +import proposalDynamicImport from "@babel/plugin-proposal-dynamic-import"; import proposalExportDefaultFrom from "@babel/plugin-proposal-export-default-from"; import proposalExportNamespaceFrom from "@babel/plugin-proposal-export-namespace-from"; import proposalFunctionBind from "@babel/plugin-proposal-function-bind"; @@ -61,6 +63,7 @@ import transformModulesAmd from "@babel/plugin-transform-modules-amd"; import transformModulesCommonjs from "@babel/plugin-transform-modules-commonjs"; import transformModulesSystemjs from "@babel/plugin-transform-modules-systemjs"; import transformModulesUmd from "@babel/plugin-transform-modules-umd"; +import transformNamedCapturingGroupsRegex from "@babel/plugin-transform-named-capturing-groups-regex"; import transformNewTarget from "@babel/plugin-transform-new-target"; import transformObjectAssign from "@babel/plugin-transform-object-assign"; import transformObjectSuper from "@babel/plugin-transform-object-super"; @@ -105,11 +108,13 @@ export { syntaxObjectRestSpread, syntaxOptionalCatchBinding, syntaxPipelineOperator, + syntaxTopLevelAwait, syntaxTypescript, proposalAsyncGeneratorFunctions, proposalClassProperties, proposalDecorators, proposalDoExpressions, + proposalDynamicImport, proposalExportDefaultFrom, proposalExportNamespaceFrom, proposalFunctionBind, @@ -147,6 +152,7 @@ export { transformModulesCommonjs, transformModulesSystemjs, transformModulesUmd, + transformNamedCapturingGroupsRegex, transformNewTarget, transformObjectAssign, transformObjectSuper, @@ -192,11 +198,13 @@ export const all = { "syntax-object-rest-spread": syntaxObjectRestSpread, "syntax-optional-catch-binding": syntaxOptionalCatchBinding, "syntax-pipeline-operator": syntaxPipelineOperator, + "syntax-top-level-await": syntaxTopLevelAwait, "syntax-typescript": syntaxTypescript, "proposal-async-generator-functions": proposalAsyncGeneratorFunctions, "proposal-class-properties": proposalClassProperties, "proposal-decorators": proposalDecorators, "proposal-do-expressions": proposalDoExpressions, + "proposal-dynamic-import": proposalDynamicImport, "proposal-export-default-from": proposalExportDefaultFrom, "proposal-export-namespace-from": proposalExportNamespaceFrom, "proposal-function-bind": proposalFunctionBind, @@ -234,6 +242,7 @@ export const all = { "transform-modules-commonjs": transformModulesCommonjs, "transform-modules-systemjs": transformModulesSystemjs, "transform-modules-umd": transformModulesUmd, + "transform-named-capturing-groups-regex": transformNamedCapturingGroupsRegex, "transform-new-target": transformNewTarget, "transform-object-assign": transformObjectAssign, "transform-object-super": transformObjectSuper, diff --git a/packages/babel-standalone/src/index.js b/packages/babel-standalone/src/index.js index 1e7c83d30c6c..cc7870028095 100644 --- a/packages/babel-standalone/src/index.js +++ b/packages/babel-standalone/src/index.js @@ -21,8 +21,9 @@ import presetStage0 from "./preset-stage-0"; import presetStage1 from "./preset-stage-1"; import presetStage2 from "./preset-stage-2"; import presetStage3 from "./preset-stage-3"; -import presetReact from "@babel/preset-react"; +import presetEnv from "@babel/preset-env"; import presetFlow from "@babel/preset-flow"; +import presetReact from "@babel/preset-react"; import presetTypescript from "@babel/preset-typescript"; import { runScripts } from "./transformScriptTags"; @@ -40,7 +41,7 @@ const isArray = */ function loadBuiltin(builtinTable, name) { if (isArray(name) && typeof name[0] === "string") { - if (builtinTable.hasOwnProperty(name[0])) { + if (Object.prototype.hasOwnProperty.call(builtinTable, name[0])) { return [builtinTable[name[0]]].concat(name.slice(1)); } return; @@ -66,7 +67,7 @@ function processOptions(options) { if ( isArray(preset) && typeof preset[0] === "object" && - preset[0].hasOwnProperty("buildPreset") + Object.prototype.hasOwnProperty.call(preset[0], "buildPreset") ) { preset[0] = { ...preset[0], buildPreset: preset[0].buildPreset }; } @@ -112,7 +113,7 @@ export const buildExternalHelpers = babelBuildExternalHelpers; * Registers a named plugin for use with Babel. */ export function registerPlugin(name: string, plugin: Object | Function): void { - if (availablePlugins.hasOwnProperty(name)) { + if (Object.prototype.hasOwnProperty.call(availablePlugins, name)) { console.warn( `A plugin named "${name}" is already registered, it will be overridden`, ); @@ -135,10 +136,16 @@ export function registerPlugins(newPlugins: { * Registers a named preset for use with Babel. */ export function registerPreset(name: string, preset: Object | Function): void { - if (availablePresets.hasOwnProperty(name)) { - console.warn( - `A preset named "${name}" is already registered, it will be overridden`, - ); + if (Object.prototype.hasOwnProperty.call(availablePresets, name)) { + if (name === "env") { + console.warn( + "@babel/preset-env is now included in @babel/standalone, please remove @babel/preset-env-standalone", + ); + } else { + console.warn( + `A preset named "${name}" is already registered, it will be overridden`, + ); + } } availablePresets[name] = preset; } @@ -163,6 +170,7 @@ registerPlugins(all); // Want to get rid of this whitelist of presets? // Wait! Please read https://github.com/babel/babel/pull/6177 first. registerPresets({ + env: presetEnv, es2015: preset2015, es2016: () => { return { diff --git a/packages/babel-standalone/src/preset-stage-1.js b/packages/babel-standalone/src/preset-stage-1.js index 0018a48f4334..4f9d6029912b 100644 --- a/packages/babel-standalone/src/preset-stage-1.js +++ b/packages/babel-standalone/src/preset-stage-1.js @@ -21,9 +21,7 @@ export default (_: any, opts: Object = {}) => { plugins: [ babelPlugins.proposalExportDefaultFrom, babelPlugins.proposalLogicalAssignmentOperators, - [babelPlugins.proposalOptionalChaining, { loose }], [babelPlugins.proposalPipelineOperator, { proposal: pipelineProposal }], - [babelPlugins.proposalNullishCoalescingOperator, { loose }], babelPlugins.proposalDoExpressions, ], }; diff --git a/packages/babel-standalone/src/preset-stage-3.js b/packages/babel-standalone/src/preset-stage-3.js index 6885719f2fd2..11e9c3833b66 100644 --- a/packages/babel-standalone/src/preset-stage-3.js +++ b/packages/babel-standalone/src/preset-stage-3.js @@ -12,6 +12,8 @@ export default (_: any, opts: Object) => { plugins: [ babelPlugins.syntaxDynamicImport, babelPlugins.syntaxImportMeta, + [babelPlugins.proposalOptionalChaining, { loose }], + [babelPlugins.proposalNullishCoalescingOperator, { loose }], [babelPlugins.proposalClassProperties, { loose }], babelPlugins.proposalJsonStrings, [babelPlugins.proposalPrivateMethods, { loose }], diff --git a/packages/babel-standalone/test/babel.js b/packages/babel-standalone/test/babel.js index 056bfafca847..8fd2b8a60d56 100644 --- a/packages/babel-standalone/test/babel.js +++ b/packages/babel-standalone/test/babel.js @@ -110,6 +110,61 @@ ).toThrow(/Invalid plugin specified in Babel options: "lolfail"/); }); + describe("env preset", () => { + it("works w/o targets", () => { + const output = Babel.transform("const a = 1;", { + sourceType: "script", + presets: ["env"], + }).code; + expect(output).toBe("var a = 1;"); + }); + + it("doesn't transpile `const` with chrome 60", () => { + const output = Babel.transform("const a = 1;", { + sourceType: "script", + presets: [ + [ + "env", + { + targets: { + chrome: 60, + }, + }, + ], + ], + }).code; + expect(output).toBe("const a = 1;"); + }); + + it("transpiles `const` with chrome 60 and preset-es2015", () => { + const output = Babel.transform("const a = 1;", { + sourceType: "script", + presets: [ + [ + "env", + { + targets: { + chrome: 60, + }, + }, + ], + "es2015", + ], + }).code; + expect(output).toBe("var a = 1;"); + }); + + it("uses transform-new-targets plugin", () => { + const output = Babel.transform("function Foo() {new.target}", { + sourceType: "script", + presets: ["env"], + }).code; + expect(output).toBe( + "function Foo() {\n this instanceof Foo ? this.constructor : void 0;\n}", + ); + }); + }); + describe("custom plugins and presets", () => { const lolizer = () => ({ visitor: { diff --git a/packages/babel-template/package.json b/packages/babel-template/package.json index 40c19ddee051..98035f847c98 100644 --- a/packages/babel-template/package.json +++ b/packages/babel-template/package.json @@ -1,6 +1,6 @@ { "name": "@babel/template", - "version": "7.4.4", + "version": "7.8.3", "description": "Generate an AST from a string template.", "author": "Sebastian McKenzie ", "homepage": "https://babeljs.io/", @@ -11,8 +11,8 @@ "repository": "https://github.com/babel/babel/tree/master/packages/babel-template", "main": "lib/index.js", "dependencies": { - "@babel/code-frame": "^7.0.0", - "@babel/parser": "^7.4.4", - "@babel/types": "^7.4.4" + "@babel/code-frame": "^7.8.3", + "@babel/parser": "^7.8.3", + "@babel/types": "^7.8.3" } } diff --git a/packages/babel-template/src/options.js b/packages/babel-template/src/options.js index cb2639319e51..07230cf1cf0b 100644 --- a/packages/babel-template/src/options.js +++ b/packages/babel-template/src/options.js @@ -149,7 +149,7 @@ export function normalizeReplacements( return acc; }, {}); } else if (typeof replacements === "object" || replacements == null) { - return replacements || undefined; + return (replacements: any) || undefined; } throw new Error( diff --git a/packages/babel-template/src/populate.js b/packages/babel-template/src/populate.js index 93cf4f1b677e..90b13853ba67 100644 --- a/packages/babel-template/src/populate.js +++ b/packages/babel-template/src/populate.js @@ -32,7 +32,7 @@ export default function populatePlaceholders( }); } - // Process in reverse order to AST mutation doesn't change indices that + // Process in reverse order so AST mutation doesn't change indices that // will be needed for later calls to `placeholder.resolve()`. metadata.placeholders .slice() @@ -45,9 +45,7 @@ export default function populatePlaceholders( (replacements && replacements[placeholder.name]) || null, ); } catch (e) { - e.message = `@babel/template placeholder "${placeholder.name}": ${ - e.message - }`; + e.message = `@babel/template placeholder "${placeholder.name}": ${e.message}`; throw e; } }); diff --git a/packages/babel-traverse/package.json b/packages/babel-traverse/package.json index ea0fee988408..713ae2496a67 100644 --- a/packages/babel-traverse/package.json +++ b/packages/babel-traverse/package.json @@ -1,6 +1,6 @@ { "name": "@babel/traverse", - "version": "7.5.5", + "version": "7.8.3", "description": "The Babel Traverse module maintains the overall tree state, and is responsible for replacing, removing, and adding nodes", "author": "Sebastian McKenzie ", "homepage": "https://babeljs.io/", @@ -11,17 +11,17 @@ "repository": "https://github.com/babel/babel/tree/master/packages/babel-traverse", "main": "lib/index.js", "dependencies": { - "@babel/code-frame": "^7.5.5", - "@babel/generator": "^7.5.5", - "@babel/helper-function-name": "^7.1.0", - "@babel/helper-split-export-declaration": "^7.4.4", - "@babel/parser": "^7.5.5", - "@babel/types": "^7.5.5", + "@babel/code-frame": "^7.8.3", + "@babel/generator": "^7.8.3", + "@babel/helper-function-name": "^7.8.3", + "@babel/helper-split-export-declaration": "^7.8.3", + "@babel/parser": "^7.8.3", + "@babel/types": "^7.8.3", "debug": "^4.1.0", "globals": "^11.1.0", "lodash": "^4.17.13" }, "devDependencies": { - "@babel/helper-plugin-test-runner": "^7.0.0" + "@babel/helper-plugin-test-runner": "^7.8.3" } } diff --git a/packages/babel-traverse/src/index.js b/packages/babel-traverse/src/index.js index 5b1ebfdc6ed2..da880632ad40 100644 --- a/packages/babel-traverse/src/index.js +++ b/packages/babel-traverse/src/index.js @@ -25,14 +25,16 @@ export default function traverse( if (parent.type !== "Program" && parent.type !== "File") { throw new Error( "You must pass a scope and parentPath unless traversing a Program/File. " + - `Instead of that you tried to traverse a ${ - parent.type - } node without ` + + `Instead of that you tried to traverse a ${parent.type} node without ` + "passing scope and parentPath.", ); } } + if (!t.VISITOR_KEYS[parent.type]) { + return; + } + visitors.explode(opts); traverse.node(parent, opts, scope, state, parentPath); diff --git a/packages/babel-traverse/src/path/ancestry.js b/packages/babel-traverse/src/path/ancestry.js index 7cc341032255..e2667d1c8dd0 100644 --- a/packages/babel-traverse/src/path/ancestry.js +++ b/packages/babel-traverse/src/path/ancestry.js @@ -4,8 +4,10 @@ import * as t from "@babel/types"; import NodePath from "./index"; /** - * Call the provided `callback` with the `NodePath`s of all the parents. - * When the `callback` returns a truthy value, we return that node path. + * Starting at the parent path of the current `NodePath` and going up the + * tree, return the first `NodePath` that causes the provided `callback` + * to return a truthy value, or `null` if the `callback` never returns a + * truthy value. */ export function findParent(callback): ?NodePath { @@ -18,7 +20,8 @@ export function findParent(callback): ?NodePath { /** * Starting at current `NodePath` and going up the tree, return the first - * `NodePath` that causes the provided `callback` to return a truthy value. + * `NodePath` that causes the provided `callback` to return a truthy value, + * or `null` if the `callback` never returns a truthy value. */ export function find(callback): ?NodePath { diff --git a/packages/babel-traverse/src/path/context.js b/packages/babel-traverse/src/path/context.js index faa5e9d3f15e..4a8c54197bb7 100644 --- a/packages/babel-traverse/src/path/context.js +++ b/packages/babel-traverse/src/path/context.js @@ -1,6 +1,7 @@ // This file contains methods responsible for maintaining a TraversalContext. import traverse from "../index"; +import { SHOULD_SKIP, SHOULD_STOP } from "./index"; export function call(key): boolean { const opts = this.opts; @@ -43,7 +44,8 @@ export function _call(fns?: Array): boolean { // node has been replaced, it will have been requeued if (this.node !== node) return true; - if (this.shouldStop || this.shouldSkip || this.removed) return true; + // this.shouldSkip || this.shouldStop || this.removed + if (this._traverseFlags > 0) return true; } return false; @@ -67,7 +69,12 @@ export function visit(): boolean { return false; } - if (this.call("enter") || this.shouldSkip) { + // Note: We need to check "this.shouldSkip" twice because + // the visitor can set it to true. Usually .shouldSkip is false + // before calling the enter visitor, but it can be true in case of + // a requeued node (e.g. by .replaceWith()) that is then marked + // with .skip(). + if (this.shouldSkip || this.call("enter") || this.shouldSkip) { this.debug("Skip..."); return this.shouldStop; } @@ -92,12 +99,15 @@ export function skip() { } export function skipKey(key) { + if (this.skipKeys == null) { + this.skipKeys = {}; + } this.skipKeys[key] = true; } export function stop() { - this.shouldStop = true; - this.shouldSkip = true; + // this.shouldSkip = true; this.shouldStop = true; + this._traverseFlags |= SHOULD_SKIP | SHOULD_STOP; } export function setScope() { @@ -117,10 +127,11 @@ export function setScope() { } export function setContext(context) { - this.shouldSkip = false; - this.shouldStop = false; - this.removed = false; - this.skipKeys = {}; + if (this.skipKeys != null) { + this.skipKeys = {}; + } + // this.shouldSkip = false; this.shouldStop = false; this.removed = false; + this._traverseFlags = 0; if (context) { this.context = context; @@ -215,9 +226,7 @@ export function pushContext(context) { } export function setup(parentPath, container, listKey, key) { - this.inList = !!listKey; this.listKey = listKey; - this.parentKey = listKey || key; this.container = container; this.parentPath = parentPath || this.parentPath; @@ -233,6 +242,14 @@ export function setKey(key) { export function requeue(pathToQueue = this) { if (pathToQueue.removed) return; + // TODO: Uncomment in Babel 8. If a path is skipped, and then replaced with a + // new one, the new one shouldn't probably be skipped. + // Note that this currently causes an infinite loop because of + // packages/babel-plugin-transform-block-scoping/src/tdz.js#L52-L59 + // (b5b8055cc00756f94bf71deb45f288738520ee3c) + // + // pathToQueue.shouldSkip = false; + // TODO(loganfsmyth): This should be switched back to queue in parent contexts // automatically once #2892 and #4135 have been resolved. See #4140. // let contexts = this._getQueueContexts(); diff --git a/packages/babel-traverse/src/path/conversion.js b/packages/babel-traverse/src/path/conversion.js index 99a2b00a733c..fd149535441a 100644 --- a/packages/babel-traverse/src/path/conversion.js +++ b/packages/babel-traverse/src/path/conversion.js @@ -216,30 +216,6 @@ function hoistFunctionEnvironment( }); } - // Convert all "this" references in the arrow to point at the alias. - let thisBinding; - if (thisPaths.length > 0 || specCompliant) { - thisBinding = getThisBinding(thisEnvFn, inConstructor); - - if ( - !specCompliant || - // In subclass constructors, still need to rewrite because "this" can't be bound in spec mode - // because it might not have been initialized yet. - (inConstructor && hasSuperClass(thisEnvFn)) - ) { - thisPaths.forEach(thisChild => { - const thisRef = thisChild.isJSX() - ? t.jsxIdentifier(thisBinding) - : t.identifier(thisBinding); - - thisRef.loc = thisChild.node.loc; - thisChild.replaceWith(thisRef); - }); - - if (specCompliant) thisBinding = null; - } - } - // Convert all "arguments" references in the arrow to point at the alias. if (argumentsPaths.length > 0) { const argumentsBinding = getBinding(thisEnvFn, "arguments", () => @@ -286,42 +262,64 @@ function hoistFunctionEnvironment( ? "" : superProp.get("property").node.name; - if (superProp.parentPath.isCallExpression({ callee: superProp.node })) { - const superBinding = getSuperPropCallBinding(thisEnvFn, key); + const isAssignment = superProp.parentPath.isAssignmentExpression({ + left: superProp.node, + }); + const isCall = superProp.parentPath.isCallExpression({ + callee: superProp.node, + }); + const superBinding = getSuperPropBinding(thisEnvFn, isAssignment, key); + + const args = []; + if (superProp.node.computed) { + args.push(superProp.get("property").node); + } + + if (isAssignment) { + const value = superProp.parentPath.node.right; + args.push(value); + } + + const call = t.callExpression(t.identifier(superBinding), args); - if (superProp.node.computed) { - const prop = superProp.get("property").node; - superProp.replaceWith(t.identifier(superBinding)); - superProp.parentPath.node.arguments.unshift(prop); - } else { - superProp.replaceWith(t.identifier(superBinding)); - } + if (isCall) { + superProp.parentPath.unshiftContainer("arguments", t.thisExpression()); + superProp.replaceWith(t.memberExpression(call, t.identifier("call"))); + + thisPaths.push(superProp.parentPath.get("arguments.0")); + } else if (isAssignment) { + // Replace not only the super.prop, but the whole assignment + superProp.parentPath.replaceWith(call); } else { - const isAssignment = superProp.parentPath.isAssignmentExpression({ - left: superProp.node, - }); - const superBinding = getSuperPropBinding(thisEnvFn, isAssignment, key); - - const args = []; - if (superProp.node.computed) { - args.push(superProp.get("property").node); - } - - if (isAssignment) { - const value = superProp.parentPath.node.right; - args.push(value); - superProp.parentPath.replaceWith( - t.callExpression(t.identifier(superBinding), args), - ); - } else { - superProp.replaceWith( - t.callExpression(t.identifier(superBinding), args), - ); - } + superProp.replaceWith(call); } }); } + // Convert all "this" references in the arrow to point at the alias. + let thisBinding; + if (thisPaths.length > 0 || specCompliant) { + thisBinding = getThisBinding(thisEnvFn, inConstructor); + + if ( + !specCompliant || + // In subclass constructors, still need to rewrite because "this" can't be bound in spec mode + // because it might not have been initialized yet. + (inConstructor && hasSuperClass(thisEnvFn)) + ) { + thisPaths.forEach(thisChild => { + const thisRef = thisChild.isJSX() + ? t.jsxIdentifier(thisBinding) + : t.identifier(thisBinding); + + thisRef.loc = thisChild.node.loc; + thisChild.replaceWith(thisRef); + }); + + if (specCompliant) thisBinding = null; + } + } + return thisBinding; } @@ -485,37 +483,6 @@ function getSuperBinding(thisEnvFn) { }); } -// Create a binding for a function that will call "super.foo()" or "super[foo]()". -function getSuperPropCallBinding(thisEnvFn, propName) { - return getBinding(thisEnvFn, `superprop_call:${propName || ""}`, () => { - const argsBinding = thisEnvFn.scope.generateUidIdentifier("args"); - const argsList = [t.restElement(argsBinding)]; - - let fnBody; - if (propName) { - // (...args) => super.foo(...args) - fnBody = t.callExpression( - t.memberExpression(t.super(), t.identifier(propName)), - [t.spreadElement(t.identifier(argsBinding.name))], - ); - } else { - const method = thisEnvFn.scope.generateUidIdentifier("prop"); - // (method, ...args) => super[method](...args) - argsList.unshift(method); - fnBody = t.callExpression( - t.memberExpression( - t.super(), - t.identifier(method.name), - true /* computed */, - ), - [t.spreadElement(t.identifier(argsBinding.name))], - ); - } - - return t.arrowFunctionExpression(argsList, fnBody); - }); -} - // Create a binding for a function that will call "super.foo" or "super[foo]". function getSuperPropBinding(thisEnvFn, isAssignment, propName) { const op = isAssignment ? "set" : "get"; diff --git a/packages/babel-traverse/src/path/family.js b/packages/babel-traverse/src/path/family.js index 0af3d2b110cb..b2d9cefc4e1b 100644 --- a/packages/babel-traverse/src/path/family.js +++ b/packages/babel-traverse/src/path/family.js @@ -18,6 +18,61 @@ function addCompletionRecords(path, paths) { return paths; } +function completionRecordForSwitch(cases, paths) { + let isLastCaseWithConsequent = true; + + for (let i = cases.length - 1; i >= 0; i--) { + const switchCase = cases[i]; + const consequent = switchCase.get("consequent"); + + let breakStatement; + findBreak: for (const statement of consequent) { + if (statement.isBlockStatement()) { + for (const statementInBlock of statement.get("body")) { + if (statementInBlock.isBreakStatement()) { + breakStatement = statementInBlock; + break findBreak; + } + } + } else if (statement.isBreakStatement()) { + breakStatement = statement; + break; + } + } + + if (breakStatement) { + while ( + breakStatement.key === 0 && + breakStatement.parentPath.isBlockStatement() + ) { + breakStatement = breakStatement.parentPath; + } + + const prevSibling = breakStatement.getPrevSibling(); + if ( + breakStatement.key > 0 && + (prevSibling.isExpressionStatement() || prevSibling.isBlockStatement()) + ) { + paths = addCompletionRecords(prevSibling, paths); + breakStatement.remove(); + } else { + breakStatement.replaceWith(breakStatement.scope.buildUndefinedNode()); + paths = addCompletionRecords(breakStatement, paths); + } + } else if (isLastCaseWithConsequent) { + const statementFinder = statement => + !statement.isBlockStatement() || + statement.get("body").some(statementFinder); + const hasConsequent = consequent.some(statementFinder); + if (hasConsequent) { + paths = addCompletionRecords(consequent[consequent.length - 1], paths); + isLastCaseWithConsequent = false; + } + } + } + return paths; +} + export function getCompletionRecords(): NodePath[] { let paths = []; @@ -33,9 +88,10 @@ export function getCompletionRecords(): NodePath[] { } else if (this.isTryStatement()) { paths = addCompletionRecords(this.get("block"), paths); paths = addCompletionRecords(this.get("handler"), paths); - paths = addCompletionRecords(this.get("finalizer"), paths); } else if (this.isCatchClause()) { paths = addCompletionRecords(this.get("body"), paths); + } else if (this.isSwitchStatement()) { + paths = completionRecordForSwitch(this.get("cases"), paths); } else { paths.push(this); } diff --git a/packages/babel-traverse/src/path/index.js b/packages/babel-traverse/src/path/index.js index a1be4f5d8d00..79ef05092857 100644 --- a/packages/babel-traverse/src/path/index.js +++ b/packages/babel-traverse/src/path/index.js @@ -23,15 +23,18 @@ import * as NodePath_comments from "./comments"; const debug = buildDebug("babel"); +export const REMOVED = 1 << 0; +export const SHOULD_STOP = 1 << 1; +export const SHOULD_SKIP = 1 << 2; + export default class NodePath { constructor(hub: HubInterface, parent: Object) { this.parent = parent; this.hub = hub; this.contexts = []; - this.data = Object.create(null); - this.shouldSkip = false; - this.shouldStop = false; - this.removed = false; + this.data = null; + // this.shouldSkip = false; this.shouldStop = false; this.removed = false; + this._traverseFlags = 0; this.state = null; this.opts = null; this.skipKeys = null; @@ -39,13 +42,10 @@ export default class NodePath { this.context = null; this.container = null; this.listKey = null; - this.inList = false; - this.parentKey = null; this.key = null; this.node = null; this.scope = null; this.type = null; - this.typeAnnotation = null; } parent: Object; @@ -57,18 +57,16 @@ export default class NodePath { removed: boolean; state: any; opts: ?Object; + _traverseFlags: number; skipKeys: ?Object; parentPath: ?NodePath; context: TraversalContext; container: ?Object | Array; listKey: ?string; - inList: boolean; - parentKey: ?string; key: ?string; node: ?Object; scope: Scope; type: ?string; - typeAnnotation: ?Object; static get({ hub, parentPath, parent, container, listKey, key }): NodePath { if (!hub && parentPath) { @@ -111,10 +109,16 @@ export default class NodePath { } setData(key: string, val: any): any { + if (this.data == null) { + this.data = Object.create(null); + } return (this.data[key] = val); } getData(key: string, def?: any): any { + if (this.data == null) { + this.data = Object.create(null); + } let val = this.data[key]; if (val === undefined && def !== undefined) val = this.data[key] = def; return val; @@ -152,6 +156,56 @@ export default class NodePath { toString() { return generator(this.node).code; } + + get inList() { + return !!this.listKey; + } + + set inList(inList) { + if (!inList) { + this.listKey = null; + } + // ignore inList = true as it should depend on `listKey` + } + + get parentKey() { + return this.listKey || this.key; + } + + get shouldSkip() { + return !!(this._traverseFlags & SHOULD_SKIP); + } + + set shouldSkip(v) { + if (v) { + this._traverseFlags |= SHOULD_SKIP; + } else { + this._traverseFlags &= ~SHOULD_SKIP; + } + } + + get shouldStop() { + return !!(this._traverseFlags & SHOULD_STOP); + } + + set shouldStop(v) { + if (v) { + this._traverseFlags |= SHOULD_STOP; + } else { + this._traverseFlags &= ~SHOULD_STOP; + } + } + + get removed() { + return !!(this._traverseFlags & REMOVED); + } + set removed(v) { + if (v) { + this._traverseFlags |= REMOVED; + } else { + this._traverseFlags &= ~REMOVED; + } + } } Object.assign( diff --git a/packages/babel-traverse/src/path/introspection.js b/packages/babel-traverse/src/path/introspection.js index 5089b0a1d461..b660cf666e94 100644 --- a/packages/babel-traverse/src/path/introspection.js +++ b/packages/babel-traverse/src/path/introspection.js @@ -370,7 +370,12 @@ const executionOrderCheckedNodes = new WeakSet(); export function _guessExecutionStatusRelativeToDifferentFunctions( target: NodePath, ): RelativeExecutionStatus { - if (!target.isFunctionDeclaration()) return "unknown"; + if ( + !target.isFunctionDeclaration() || + target.parentPath.isExportDeclaration() + ) { + return "unknown"; + } // so we're in a completely different function, if this is a function declaration // then we can be a bit smarter and handle cases where the function is either diff --git a/packages/babel-traverse/src/path/lib/hoister.js b/packages/babel-traverse/src/path/lib/hoister.js index 2fd8339eaa7d..7e7f85034628 100644 --- a/packages/babel-traverse/src/path/lib/hoister.js +++ b/packages/babel-traverse/src/path/lib/hoister.js @@ -32,6 +32,15 @@ const referenceVisitor = { const binding = path.scope.getBinding(path.node.name); if (!binding) return; + // we can handle reassignments only if they happen in the same scope as the declaration + for (const violation of binding.constantViolations) { + if (violation.scope !== binding.path.scope) { + state.mutableBinding = true; + path.stop(); + return; + } + } + // this binding isn't accessible from the parent scope so we can safely ignore it // eg. it's in a closure etc if (binding !== state.scope.getBinding(path.node.name)) return; @@ -46,6 +55,9 @@ export default class PathHoister { this.breakOnScopePaths = []; // Storage for bindings that may affect what path we can hoist to. this.bindings = {}; + // "true" if the current path contains a reference to a binding whose + // value can change and thus can't be safely hoisted. + this.mutableBinding = false; // Storage for eligible scopes. this.scopes = []; // Our original scope and path. @@ -195,6 +207,8 @@ export default class PathHoister { run() { this.path.traverse(referenceVisitor, this); + if (this.mutableBinding) return; + this.getCompatibleScopes(); const attachTo = this.getAttachmentPath(); diff --git a/packages/babel-traverse/src/path/lib/virtual-types.js b/packages/babel-traverse/src/path/lib/virtual-types.js index 97cec0e3af99..d7072d6f6e4a 100644 --- a/packages/babel-traverse/src/path/lib/virtual-types.js +++ b/packages/babel-traverse/src/path/lib/virtual-types.js @@ -64,7 +64,8 @@ export const Expression = { }; export const Scope = { - types: ["Scopable"], + // When pattern is inside the function params, it is a scope + types: ["Scopable", "Pattern"], checkPath(path) { return t.isScope(path.node, path.parent); }, diff --git a/packages/babel-traverse/src/path/modification.js b/packages/babel-traverse/src/path/modification.js index 6039a94c6090..1f6d2a0b32db 100644 --- a/packages/babel-traverse/src/path/modification.js +++ b/packages/babel-traverse/src/path/modification.js @@ -115,7 +115,9 @@ export function insertAfter(nodes) { }), ); } else if ( - (this.isNodeType("Expression") && !this.isJSXElement()) || + (this.isNodeType("Expression") && + !this.isJSXElement() && + !parentPath.isJSXElement()) || (parentPath.isForStatement() && this.key === "init") ) { if (this.node) { diff --git a/packages/babel-traverse/src/path/removal.js b/packages/babel-traverse/src/path/removal.js index b4d1330b256d..9ddf0a201448 100644 --- a/packages/babel-traverse/src/path/removal.js +++ b/packages/babel-traverse/src/path/removal.js @@ -1,6 +1,7 @@ // This file contains methods responsible for removing a node. import { hooks } from "./lib/removal-hooks"; +import { REMOVED, SHOULD_SKIP } from "./index"; export function remove() { this._assertUnremoved(); @@ -39,8 +40,8 @@ export function _remove() { } export function _markRemoved() { - this.shouldSkip = true; - this.removed = true; + // this.shouldSkip = true; this.removed = true; + this._traverseFlags |= SHOULD_SKIP | REMOVED; this.node = null; } diff --git a/packages/babel-traverse/src/scope/index.js b/packages/babel-traverse/src/scope/index.js index 375d5827b970..9f9d78667336 100644 --- a/packages/babel-traverse/src/scope/index.js +++ b/packages/babel-traverse/src/scope/index.js @@ -490,12 +490,7 @@ export default class Scope { } buildUndefinedNode() { - if (this.hasBinding("undefined")) { - return t.unaryExpression("void", t.numericLiteral(0), true); - } else { - // eslint-disable-next-line @babel/development/no-undefined-identifier - return t.identifier("undefined"); - } + return t.unaryExpression("void", t.numericLiteral(0), true); } registerConstantViolation(path: NodePath) { @@ -902,10 +897,27 @@ export default class Scope { getBinding(name: string) { let scope = this; + let previousPath; do { const binding = scope.getOwnBinding(name); - if (binding) return binding; + if (binding) { + // Check if a pattern is a part of parameter expressions. + // 9.2.10.28: The closure created by this expression should not have visibility of + // declarations in the function body. If the binding is not a `param`-kind, + // then it must be defined inside the function body, thus it should be skipped + if ( + previousPath && + previousPath.isPattern() && + previousPath.parentPath.isFunction() && + binding.kind !== "param" + ) { + // do nothing + } else { + return binding; + } + } + previousPath = scope.path; } while ((scope = scope.parent)); } diff --git a/packages/babel-traverse/src/visitors.js b/packages/babel-traverse/src/visitors.js index 77c1488d5d55..eb8516a451fa 100644 --- a/packages/babel-traverse/src/visitors.js +++ b/packages/babel-traverse/src/visitors.js @@ -227,6 +227,11 @@ function wrapWithStateOrWrapper(oldVisitor, state, wrapper: ?Function) { newFn = wrapper(state.key, key, newFn); } + // Override toString in case this function is printed, we want to print the wrapped function, same as we do in `wrapCheck` + if (newFn !== fn) { + newFn.toString = () => fn.toString(); + } + return newFn; }); diff --git a/packages/babel-traverse/test/arrow-transform.js b/packages/babel-traverse/test/arrow-transform.js index f21ba52ac3ec..fdeeb4bd66de 100644 --- a/packages/babel-traverse/test/arrow-transform.js +++ b/packages/babel-traverse/test/arrow-transform.js @@ -539,7 +539,7 @@ describe("arrow function conversion", () => { ); }); - it("should convert super.prop() calls", () => { + it("should convert super.prop() calls without params", () => { assertConversion( ` () => { @@ -549,10 +549,11 @@ describe("arrow function conversion", () => { () => super.foo(); `, ` - var _superprop_callFoo = (..._args) => super.foo(..._args); + var _superprop_getFoo = () => super.foo, + _this = this; (function () { - _superprop_callFoo(); + _superprop_getFoo().call(_this); }); super.foo(); () => super.foo(); @@ -560,6 +561,28 @@ describe("arrow function conversion", () => { ); }); + it("should convert super.prop() calls with params", () => { + assertConversion( + ` + () => { + super.foo(a, b, ...c); + }; + super.foo(a, b, ...c); + () => super.foo(a, b, ...c); + `, + ` + var _superprop_getFoo = () => super.foo, + _this = this; + + (function () { + _superprop_getFoo().call(_this, a, b, ...c); + }); + super.foo(a, b, ...c); + () => super.foo(a, b, ...c); + `, + ); + }); + it("should convert super[prop]() calls", () => { assertConversion( ` @@ -570,10 +593,11 @@ describe("arrow function conversion", () => { () => super[foo](); `, ` - var _superprop_call = (_prop, ..._args) => super[_prop](..._args); + var _superprop_get = _prop => super[_prop], + _this = this; (function () { - _superprop_call(foo); + _superprop_get(foo).call(_this); }); super[foo](); () => super[foo](); diff --git a/packages/babel-traverse/test/fixtures/rename/parameter-default-1/input.js b/packages/babel-traverse/test/fixtures/rename/parameter-default-1/input.js new file mode 100644 index 000000000000..c40f808feb63 --- /dev/null +++ b/packages/babel-traverse/test/fixtures/rename/parameter-default-1/input.js @@ -0,0 +1,7 @@ +let a = "outside"; + +function f(g = () => a) { + let a = "inside"; + return g(); +} + diff --git a/packages/babel-traverse/test/fixtures/rename/parameter-default-1/options.json b/packages/babel-traverse/test/fixtures/rename/parameter-default-1/options.json new file mode 100644 index 000000000000..14af0e5feac8 --- /dev/null +++ b/packages/babel-traverse/test/fixtures/rename/parameter-default-1/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["./plugin"] +} diff --git a/packages/babel-traverse/test/fixtures/rename/parameter-default-1/output.js b/packages/babel-traverse/test/fixtures/rename/parameter-default-1/output.js new file mode 100644 index 000000000000..32d258e83c15 --- /dev/null +++ b/packages/babel-traverse/test/fixtures/rename/parameter-default-1/output.js @@ -0,0 +1,6 @@ +let a = "outside"; + +function f(g = () => a) { + let z = "inside"; + return g(); +} diff --git a/packages/babel-traverse/test/fixtures/rename/parameter-default-1/plugin.js b/packages/babel-traverse/test/fixtures/rename/parameter-default-1/plugin.js new file mode 100644 index 000000000000..830481588123 --- /dev/null +++ b/packages/babel-traverse/test/fixtures/rename/parameter-default-1/plugin.js @@ -0,0 +1,9 @@ +module.exports = function() { + return { + visitor: { + FunctionDeclaration(path) { + path.scope.rename("a", "z"); + } + } + }; +}; diff --git a/packages/babel-traverse/test/fixtures/rename/parameter-default-10/input.js b/packages/babel-traverse/test/fixtures/rename/parameter-default-10/input.js new file mode 100644 index 000000000000..60898eb184b6 --- /dev/null +++ b/packages/babel-traverse/test/fixtures/rename/parameter-default-10/input.js @@ -0,0 +1,5 @@ +let a = "outside"; + +function r({ a: b }, { [a]: { c } = a }) { + g(a); +} diff --git a/packages/babel-traverse/test/fixtures/rename/parameter-default-10/options.json b/packages/babel-traverse/test/fixtures/rename/parameter-default-10/options.json new file mode 100644 index 000000000000..14af0e5feac8 --- /dev/null +++ b/packages/babel-traverse/test/fixtures/rename/parameter-default-10/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["./plugin"] +} diff --git a/packages/babel-traverse/test/fixtures/rename/parameter-default-10/output.js b/packages/babel-traverse/test/fixtures/rename/parameter-default-10/output.js new file mode 100644 index 000000000000..91af3aed8340 --- /dev/null +++ b/packages/babel-traverse/test/fixtures/rename/parameter-default-10/output.js @@ -0,0 +1,11 @@ +let z = "outside"; + +function r({ + a: b +}, { + [z]: { + c + } = z +}) { + g(z); +} diff --git a/packages/babel-traverse/test/fixtures/rename/parameter-default-10/plugin.js b/packages/babel-traverse/test/fixtures/rename/parameter-default-10/plugin.js new file mode 100644 index 000000000000..830481588123 --- /dev/null +++ b/packages/babel-traverse/test/fixtures/rename/parameter-default-10/plugin.js @@ -0,0 +1,9 @@ +module.exports = function() { + return { + visitor: { + FunctionDeclaration(path) { + path.scope.rename("a", "z"); + } + } + }; +}; diff --git a/packages/babel-traverse/test/fixtures/rename/parameter-default-2/input.js b/packages/babel-traverse/test/fixtures/rename/parameter-default-2/input.js new file mode 100644 index 000000000000..f80651d80616 --- /dev/null +++ b/packages/babel-traverse/test/fixtures/rename/parameter-default-2/input.js @@ -0,0 +1,5 @@ +let a = "outside"; + +function h(a, g = () => a) { + return g(); +} diff --git a/packages/babel-traverse/test/fixtures/rename/parameter-default-2/options.json b/packages/babel-traverse/test/fixtures/rename/parameter-default-2/options.json new file mode 100644 index 000000000000..14af0e5feac8 --- /dev/null +++ b/packages/babel-traverse/test/fixtures/rename/parameter-default-2/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["./plugin"] +} diff --git a/packages/babel-traverse/test/fixtures/rename/parameter-default-2/output.js b/packages/babel-traverse/test/fixtures/rename/parameter-default-2/output.js new file mode 100644 index 000000000000..dd64606a5b19 --- /dev/null +++ b/packages/babel-traverse/test/fixtures/rename/parameter-default-2/output.js @@ -0,0 +1,5 @@ +let a = "outside"; + +function h(z, g = () => z) { + return g(); +} diff --git a/packages/babel-traverse/test/fixtures/rename/parameter-default-2/plugin.js b/packages/babel-traverse/test/fixtures/rename/parameter-default-2/plugin.js new file mode 100644 index 000000000000..830481588123 --- /dev/null +++ b/packages/babel-traverse/test/fixtures/rename/parameter-default-2/plugin.js @@ -0,0 +1,9 @@ +module.exports = function() { + return { + visitor: { + FunctionDeclaration(path) { + path.scope.rename("a", "z"); + } + } + }; +}; diff --git a/packages/babel-traverse/test/fixtures/rename/parameter-default-3/input.js b/packages/babel-traverse/test/fixtures/rename/parameter-default-3/input.js new file mode 100644 index 000000000000..a6a4bdd4c336 --- /dev/null +++ b/packages/babel-traverse/test/fixtures/rename/parameter-default-3/input.js @@ -0,0 +1,6 @@ +let a = "outside"; + +function j(g = a) { + let a = "inside"; + return g; +} diff --git a/packages/babel-traverse/test/fixtures/rename/parameter-default-3/options.json b/packages/babel-traverse/test/fixtures/rename/parameter-default-3/options.json new file mode 100644 index 000000000000..14af0e5feac8 --- /dev/null +++ b/packages/babel-traverse/test/fixtures/rename/parameter-default-3/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["./plugin"] +} diff --git a/packages/babel-traverse/test/fixtures/rename/parameter-default-3/output.js b/packages/babel-traverse/test/fixtures/rename/parameter-default-3/output.js new file mode 100644 index 000000000000..a5cb0dab0cc3 --- /dev/null +++ b/packages/babel-traverse/test/fixtures/rename/parameter-default-3/output.js @@ -0,0 +1,6 @@ +let a = "outside"; + +function j(g = a) { + let z = "inside"; + return g; +} diff --git a/packages/babel-traverse/test/fixtures/rename/parameter-default-3/plugin.js b/packages/babel-traverse/test/fixtures/rename/parameter-default-3/plugin.js new file mode 100644 index 000000000000..830481588123 --- /dev/null +++ b/packages/babel-traverse/test/fixtures/rename/parameter-default-3/plugin.js @@ -0,0 +1,9 @@ +module.exports = function() { + return { + visitor: { + FunctionDeclaration(path) { + path.scope.rename("a", "z"); + } + } + }; +}; diff --git a/packages/babel-traverse/test/fixtures/rename/parameter-default-4/input.js b/packages/babel-traverse/test/fixtures/rename/parameter-default-4/input.js new file mode 100644 index 000000000000..0f7ddb008ef1 --- /dev/null +++ b/packages/babel-traverse/test/fixtures/rename/parameter-default-4/input.js @@ -0,0 +1,8 @@ +let a = "outside"; + +function k([{ + g = a +}]) { + let a = "inside"; + return g; +} diff --git a/packages/babel-traverse/test/fixtures/rename/parameter-default-4/options.json b/packages/babel-traverse/test/fixtures/rename/parameter-default-4/options.json new file mode 100644 index 000000000000..14af0e5feac8 --- /dev/null +++ b/packages/babel-traverse/test/fixtures/rename/parameter-default-4/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["./plugin"] +} diff --git a/packages/babel-traverse/test/fixtures/rename/parameter-default-4/output.js b/packages/babel-traverse/test/fixtures/rename/parameter-default-4/output.js new file mode 100644 index 000000000000..65ab1aa82f5f --- /dev/null +++ b/packages/babel-traverse/test/fixtures/rename/parameter-default-4/output.js @@ -0,0 +1,8 @@ +let a = "outside"; + +function k([{ + g = a +}]) { + let z = "inside"; + return g; +} diff --git a/packages/babel-traverse/test/fixtures/rename/parameter-default-4/plugin.js b/packages/babel-traverse/test/fixtures/rename/parameter-default-4/plugin.js new file mode 100644 index 000000000000..830481588123 --- /dev/null +++ b/packages/babel-traverse/test/fixtures/rename/parameter-default-4/plugin.js @@ -0,0 +1,9 @@ +module.exports = function() { + return { + visitor: { + FunctionDeclaration(path) { + path.scope.rename("a", "z"); + } + } + }; +}; diff --git a/packages/babel-traverse/test/fixtures/rename/parameter-default-5/input.js b/packages/babel-traverse/test/fixtures/rename/parameter-default-5/input.js new file mode 100644 index 000000000000..9586b93c5fcb --- /dev/null +++ b/packages/babel-traverse/test/fixtures/rename/parameter-default-5/input.js @@ -0,0 +1,8 @@ +let a = "outside"; + +function f([{ + [a]: g +}]) { + let a = "inside"; + return g; +} diff --git a/packages/babel-traverse/test/fixtures/rename/parameter-default-5/options.json b/packages/babel-traverse/test/fixtures/rename/parameter-default-5/options.json new file mode 100644 index 000000000000..14af0e5feac8 --- /dev/null +++ b/packages/babel-traverse/test/fixtures/rename/parameter-default-5/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["./plugin"] +} diff --git a/packages/babel-traverse/test/fixtures/rename/parameter-default-5/output.js b/packages/babel-traverse/test/fixtures/rename/parameter-default-5/output.js new file mode 100644 index 000000000000..f703a83d601b --- /dev/null +++ b/packages/babel-traverse/test/fixtures/rename/parameter-default-5/output.js @@ -0,0 +1,8 @@ +let a = "outside"; + +function f([{ + [a]: g +}]) { + let z = "inside"; + return g; +} diff --git a/packages/babel-traverse/test/fixtures/rename/parameter-default-5/plugin.js b/packages/babel-traverse/test/fixtures/rename/parameter-default-5/plugin.js new file mode 100644 index 000000000000..830481588123 --- /dev/null +++ b/packages/babel-traverse/test/fixtures/rename/parameter-default-5/plugin.js @@ -0,0 +1,9 @@ +module.exports = function() { + return { + visitor: { + FunctionDeclaration(path) { + path.scope.rename("a", "z"); + } + } + }; +}; diff --git a/packages/babel-traverse/test/fixtures/rename/parameter-default-6/input.js b/packages/babel-traverse/test/fixtures/rename/parameter-default-6/input.js new file mode 100644 index 000000000000..d33571e9a053 --- /dev/null +++ b/packages/babel-traverse/test/fixtures/rename/parameter-default-6/input.js @@ -0,0 +1,5 @@ +let a = "outside"; + +function n(g = (a = a) => {}) { + let a = "inside"; +} diff --git a/packages/babel-traverse/test/fixtures/rename/parameter-default-6/options.json b/packages/babel-traverse/test/fixtures/rename/parameter-default-6/options.json new file mode 100644 index 000000000000..14af0e5feac8 --- /dev/null +++ b/packages/babel-traverse/test/fixtures/rename/parameter-default-6/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["./plugin"] +} diff --git a/packages/babel-traverse/test/fixtures/rename/parameter-default-6/output.js b/packages/babel-traverse/test/fixtures/rename/parameter-default-6/output.js new file mode 100644 index 000000000000..917b0bb1c749 --- /dev/null +++ b/packages/babel-traverse/test/fixtures/rename/parameter-default-6/output.js @@ -0,0 +1,5 @@ +let a = "outside"; + +function n(g = (a = a) => {}) { + let z = "inside"; +} diff --git a/packages/babel-traverse/test/fixtures/rename/parameter-default-6/plugin.js b/packages/babel-traverse/test/fixtures/rename/parameter-default-6/plugin.js new file mode 100644 index 000000000000..830481588123 --- /dev/null +++ b/packages/babel-traverse/test/fixtures/rename/parameter-default-6/plugin.js @@ -0,0 +1,9 @@ +module.exports = function() { + return { + visitor: { + FunctionDeclaration(path) { + path.scope.rename("a", "z"); + } + } + }; +}; diff --git a/packages/babel-traverse/test/fixtures/rename/parameter-default-7/input.js b/packages/babel-traverse/test/fixtures/rename/parameter-default-7/input.js new file mode 100644 index 000000000000..273324bf46df --- /dev/null +++ b/packages/babel-traverse/test/fixtures/rename/parameter-default-7/input.js @@ -0,0 +1,5 @@ +let a = "outside"; + +function n(a, g = (a = a) => {}) { + a = "inside"; +} diff --git a/packages/babel-traverse/test/fixtures/rename/parameter-default-7/options.json b/packages/babel-traverse/test/fixtures/rename/parameter-default-7/options.json new file mode 100644 index 000000000000..14af0e5feac8 --- /dev/null +++ b/packages/babel-traverse/test/fixtures/rename/parameter-default-7/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["./plugin"] +} diff --git a/packages/babel-traverse/test/fixtures/rename/parameter-default-7/output.js b/packages/babel-traverse/test/fixtures/rename/parameter-default-7/output.js new file mode 100644 index 000000000000..5d6b37398318 --- /dev/null +++ b/packages/babel-traverse/test/fixtures/rename/parameter-default-7/output.js @@ -0,0 +1,5 @@ +let a = "outside"; + +function n(z, g = (a = a) => {}) { + z = "inside"; +} diff --git a/packages/babel-traverse/test/fixtures/rename/parameter-default-7/plugin.js b/packages/babel-traverse/test/fixtures/rename/parameter-default-7/plugin.js new file mode 100644 index 000000000000..830481588123 --- /dev/null +++ b/packages/babel-traverse/test/fixtures/rename/parameter-default-7/plugin.js @@ -0,0 +1,9 @@ +module.exports = function() { + return { + visitor: { + FunctionDeclaration(path) { + path.scope.rename("a", "z"); + } + } + }; +}; diff --git a/packages/babel-traverse/test/fixtures/rename/parameter-default-8/input.js b/packages/babel-traverse/test/fixtures/rename/parameter-default-8/input.js new file mode 100644 index 000000000000..3349776fcb77 --- /dev/null +++ b/packages/babel-traverse/test/fixtures/rename/parameter-default-8/input.js @@ -0,0 +1,5 @@ +let a = "outside"; + +function q(a, g = (b = a) => b) { + g(a); +} diff --git a/packages/babel-traverse/test/fixtures/rename/parameter-default-8/options.json b/packages/babel-traverse/test/fixtures/rename/parameter-default-8/options.json new file mode 100644 index 000000000000..14af0e5feac8 --- /dev/null +++ b/packages/babel-traverse/test/fixtures/rename/parameter-default-8/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["./plugin"] +} diff --git a/packages/babel-traverse/test/fixtures/rename/parameter-default-8/output.js b/packages/babel-traverse/test/fixtures/rename/parameter-default-8/output.js new file mode 100644 index 000000000000..3894a8a76152 --- /dev/null +++ b/packages/babel-traverse/test/fixtures/rename/parameter-default-8/output.js @@ -0,0 +1,5 @@ +let a = "outside"; + +function q(z, g = (b = z) => b) { + g(z); +} diff --git a/packages/babel-traverse/test/fixtures/rename/parameter-default-8/plugin.js b/packages/babel-traverse/test/fixtures/rename/parameter-default-8/plugin.js new file mode 100644 index 000000000000..830481588123 --- /dev/null +++ b/packages/babel-traverse/test/fixtures/rename/parameter-default-8/plugin.js @@ -0,0 +1,9 @@ +module.exports = function() { + return { + visitor: { + FunctionDeclaration(path) { + path.scope.rename("a", "z"); + } + } + }; +}; diff --git a/packages/babel-traverse/test/fixtures/rename/parameter-default-9/input.js b/packages/babel-traverse/test/fixtures/rename/parameter-default-9/input.js new file mode 100644 index 000000000000..4a57005f1db1 --- /dev/null +++ b/packages/babel-traverse/test/fixtures/rename/parameter-default-9/input.js @@ -0,0 +1,5 @@ +let a = "outside"; + +function r(a, g = (a, b = a) => a) { + g(a); +} diff --git a/packages/babel-traverse/test/fixtures/rename/parameter-default-9/options.json b/packages/babel-traverse/test/fixtures/rename/parameter-default-9/options.json new file mode 100644 index 000000000000..14af0e5feac8 --- /dev/null +++ b/packages/babel-traverse/test/fixtures/rename/parameter-default-9/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["./plugin"] +} diff --git a/packages/babel-traverse/test/fixtures/rename/parameter-default-9/output.js b/packages/babel-traverse/test/fixtures/rename/parameter-default-9/output.js new file mode 100644 index 000000000000..886bfcd11375 --- /dev/null +++ b/packages/babel-traverse/test/fixtures/rename/parameter-default-9/output.js @@ -0,0 +1,5 @@ +let a = "outside"; + +function r(z, g = (a, b = a) => a) { + g(z); +} diff --git a/packages/babel-traverse/test/fixtures/rename/parameter-default-9/plugin.js b/packages/babel-traverse/test/fixtures/rename/parameter-default-9/plugin.js new file mode 100644 index 000000000000..830481588123 --- /dev/null +++ b/packages/babel-traverse/test/fixtures/rename/parameter-default-9/plugin.js @@ -0,0 +1,9 @@ +module.exports = function() { + return { + visitor: { + FunctionDeclaration(path) { + path.scope.rename("a", "z"); + } + } + }; +}; diff --git a/packages/babel-traverse/test/replacement.js b/packages/babel-traverse/test/replacement.js index 3454937fe506..6d54972611f2 100644 --- a/packages/babel-traverse/test/replacement.js +++ b/packages/babel-traverse/test/replacement.js @@ -1,5 +1,6 @@ import traverse from "../lib"; import { parse } from "@babel/parser"; +import generate from "@babel/generator"; import * as t from "@babel/types"; describe("path/replacement", function() { @@ -97,4 +98,19 @@ describe("path/replacement", function() { ); }); }); + describe("replaceWithMultiple", () => { + it("does not add extra parentheses for a JSXElement with a JSXElement parent", () => { + const ast = parse(`

`, { + plugins: ["jsx"], + }); + traverse(ast, { + JSXElement: path => { + if (path.node.openingElement.name.name === "span") { + path.replaceWithMultiple(path.node.children.filter(t.isJSXElement)); + } + }, + }); + expect(generate(ast).code).toBe("

;"); + }); + }); }); diff --git a/packages/babel-traverse/test/scope.js b/packages/babel-traverse/test/scope.js index aa7c0dba2752..b796dbf682f5 100644 --- a/packages/babel-traverse/test/scope.js +++ b/packages/babel-traverse/test/scope.js @@ -73,6 +73,25 @@ describe("scope", () => { ).toBe("Identifier"); }); + describe("function parameter expression", function() { + it("should not have visibility of declarations inside function body", () => { + expect( + getPath( + `var a = "outside"; (function foo(b = a) { let a = "inside" })`, + ) + .get("body.1.expression.params.0") + .scope.getBinding("a").path.node.init.value, + ).toBe("outside"); + }); + it("should have visibility on parameter bindings", () => { + expect( + getPath(`var a = "outside"; (function foo(b = a, a = "inside") {})`) + .get("body.1.expression.params.0") + .scope.getBinding("a").path.node.right.value, + ).toBe("inside"); + }); + }); + it("variable declaration", function() { expect(getPath("var foo = null;").scope.getBinding("foo").path.type).toBe( "VariableDeclarator", diff --git a/packages/babel-traverse/test/traverse.js b/packages/babel-traverse/test/traverse.js index a4b391c0b2fa..316c2e12c0d8 100644 --- a/packages/babel-traverse/test/traverse.js +++ b/packages/babel-traverse/test/traverse.js @@ -1,6 +1,7 @@ import cloneDeep from "lodash/cloneDeep"; import traverse from "../lib"; import { parse } from "@babel/parser"; +import * as t from "@babel/types"; describe("traverse", function() { const code = ` @@ -174,4 +175,45 @@ describe("traverse", function() { expect(p).not.toBe(scopes[i]); }); }); + + describe("path.skip()", function() { + it("replaced paths can be skipped", function() { + const ast = parse("id"); + + let skipped; + traverse(ast, { + noScope: true, + Identifier(path) { + path.replaceWith(t.numericLiteral(0)); + path.skip(); + skipped = true; + }, + NumericLiteral() { + skipped = false; + }, + }); + + expect(skipped).toBe(true); + }); + + // Skipped: see the comment in the `NodePath.requque` method. + it.skip("skipped and requeued paths should be visited", function() { + const ast = parse("id"); + + let visited = false; + traverse(ast, { + noScope: true, + Identifier(path) { + path.replaceWith(t.numericLiteral(0)); + path.skip(); + path.requeue(); + }, + NumericLiteral() { + visited = true; + }, + }); + + expect(visited).toBe(true); + }); + }); }); diff --git a/packages/babel-types/package.json b/packages/babel-types/package.json index 66694f3b90f6..44840c33dfd6 100644 --- a/packages/babel-types/package.json +++ b/packages/babel-types/package.json @@ -1,10 +1,13 @@ { "name": "@babel/types", - "version": "7.5.5", + "version": "7.8.3", "description": "Babel Types is a Lodash-esque utility library for AST nodes", "author": "Sebastian McKenzie ", "homepage": "https://babeljs.io/", "license": "MIT", + "publishConfig": { + "access": "public" + }, "repository": "https://github.com/babel/babel/tree/master/packages/babel-types", "main": "lib/index.js", "types": "lib/index.d.ts", @@ -14,7 +17,7 @@ "to-fast-properties": "^2.0.0" }, "devDependencies": { - "@babel/generator": "^7.5.5", - "@babel/parser": "^7.5.5" + "@babel/generator": "^7.8.3", + "@babel/parser": "^7.8.3" } } diff --git a/packages/babel-types/scripts/generators/docs.js b/packages/babel-types/scripts/generators/docs.js index 3bbb52362400..340dbbc11315 100644 --- a/packages/babel-types/scripts/generators/docs.js +++ b/packages/babel-types/scripts/generators/docs.js @@ -101,8 +101,12 @@ Object.keys(types.BUILDER_KEYS) } if (defaultValue !== null || types.NODE_FIELDS[key][field].optional) { fieldDescription.push( - " (default: `" + util.inspect(defaultValue) + "`)" + " (default: `" + util.inspect(defaultValue) + "`" ); + if (types.BUILDER_KEYS[key].indexOf(field) < 0) { + fieldDescription.push(", excluded from builder function"); + } + fieldDescription.push(")"); } else { fieldDescription.push(" (required)"); } diff --git a/packages/babel-types/scripts/generators/flow.js b/packages/babel-types/scripts/generators/flow.js index daab2411d742..6c81a28af71f 100644 --- a/packages/babel-types/scripts/generators/flow.js +++ b/packages/babel-types/scripts/generators/flow.js @@ -54,6 +54,7 @@ for (const type in t.NODE_FIELDS) { const struct = ['type: "' + type + '";']; const args = []; + const builderNames = t.BUILDER_KEYS[type]; Object.keys(t.NODE_FIELDS[type]) .sort((fieldA, fieldB) => { @@ -80,8 +81,9 @@ for (const type in t.NODE_FIELDS) { if (typeAnnotation) { suffix += ": " + typeAnnotation; } - - args.push(t.toBindingIdentifierName(fieldName) + suffix); + if (builderNames.includes(fieldName)) { + args.push(t.toBindingIdentifierName(fieldName) + suffix); + } if (t.isValidIdentifier(fieldName)) { struct.push(fieldName + suffix + ";"); @@ -99,13 +101,19 @@ for (const type in t.NODE_FIELDS) { ", " )}): ${NODE_PREFIX}${type};` ); + } else { + const functionName = toFunctionName(type); + lines.push( + `declare function _${functionName}(${args.join( + ", " + )}): ${NODE_PREFIX}${type};`, + `declare export { _${functionName} as ${functionName} }` + ); } } for (let i = 0; i < t.TYPES.length; i++) { - let decl = `declare function is${ - t.TYPES[i] - }(node: ?Object, opts?: ?Object): boolean`; + let decl = `declare function is${t.TYPES[i]}(node: ?Object, opts?: ?Object): boolean`; if (t.NODE_FIELDS[t.TYPES[i]]) { decl += ` %checks (node instanceof ${NODE_PREFIX}${t.TYPES[i]})`; @@ -115,11 +123,69 @@ for (let i = 0; i < t.TYPES.length; i++) { } lines.push( - `declare function validate(n: BabelNode, key: string, value: mixed): void;`, + // builders/ + // eslint-disable-next-line max-len + `declare function createTypeAnnotationBasedOnTypeof(type: 'string' | 'number' | 'undefined' | 'boolean' | 'function' | 'object' | 'symbol'): ${NODE_PREFIX}TypeAnnotation`, + // eslint-disable-next-line max-len + `declare function createUnionTypeAnnotation(types: Array<${NODE_PREFIX}FlowType>): ${NODE_PREFIX}UnionTypeAnnotation`, + // this smells like "internal API" + // eslint-disable-next-line max-len + `declare function buildChildren(node: { children: Array<${NODE_PREFIX}JSXText | ${NODE_PREFIX}JSXExpressionContainer | ${NODE_PREFIX}JSXSpreadChild | ${NODE_PREFIX}JSXElement | ${NODE_PREFIX}JSXFragment | ${NODE_PREFIX}JSXEmptyExpression> }): Array<${NODE_PREFIX}JSXText | ${NODE_PREFIX}JSXExpressionContainer | ${NODE_PREFIX}JSXSpreadChild | ${NODE_PREFIX}JSXElement | ${NODE_PREFIX}JSXFragment>`, + + // clone/ `declare function clone(n: T): T;`, `declare function cloneDeep(n: T): T;`, + `declare function cloneNode(n: T, deep?: boolean): T;`, + `declare function cloneWithoutLoc(n: T): T;`, + + // comments/ + `declare type CommentTypeShorthand = 'leading' | 'inner' | 'trailing'`, + // eslint-disable-next-line max-len + `declare function addComment(node: T, type: CommentTypeShorthand, content: string, line?: boolean): T`, + // eslint-disable-next-line max-len + `declare function addComments(node: T, type: CommentTypeShorthand, comments: Array): T`, + `declare function inheritInnerComments(node: Node, parent: Node): void`, + `declare function inheritLeadingComments(node: Node, parent: Node): void`, + `declare function inheritsComments(node: T, parent: Node): void`, + `declare function inheritTrailingComments(node: Node, parent: Node): void`, + `declare function removeComments(node: T): T`, + + // converters/ + `declare function ensureBlock(node: ${NODE_PREFIX}, key: string): ${NODE_PREFIX}BlockStatement`, + `declare function toBindingIdentifierName(name?: ?string): string`, + // eslint-disable-next-line max-len + `declare function toBlock(node: ${NODE_PREFIX}Statement | ${NODE_PREFIX}Expression, parent?: ${NODE_PREFIX}Function | null): ${NODE_PREFIX}BlockStatement`, + // eslint-disable-next-line max-len + `declare function toComputedKey(node: ${NODE_PREFIX}Method | ${NODE_PREFIX}Property, key?: ${NODE_PREFIX}Expression | ${NODE_PREFIX}Identifier): ${NODE_PREFIX}Expression`, + // eslint-disable-next-line max-len + `declare function toExpression(node: ${NODE_PREFIX}ExpressionStatement | ${NODE_PREFIX}Expression | ${NODE_PREFIX}Class | ${NODE_PREFIX}Function): ${NODE_PREFIX}Expression`, + `declare function toIdentifier(name?: ?string): string`, + // eslint-disable-next-line max-len + `declare function toKeyAlias(node: ${NODE_PREFIX}Method | ${NODE_PREFIX}Property, key?: ${NODE_PREFIX}): string`, + // toSequenceExpression relies on types that aren't declared in flow + // eslint-disable-next-line max-len + `declare function toStatement(node: ${NODE_PREFIX}Statement | ${NODE_PREFIX}Class | ${NODE_PREFIX}Function | ${NODE_PREFIX}AssignmentExpression, ignore?: boolean): ${NODE_PREFIX}Statement | void`, + `declare function valueToNode(value: any): ${NODE_PREFIX}Expression`, + + // modifications/ + // eslint-disable-next-line max-len + `declare function removeTypeDuplicates(types: Array<${NODE_PREFIX}FlowType>): Array<${NODE_PREFIX}FlowType>`, + // eslint-disable-next-line max-len + `declare function appendToMemberExpression(member: ${NODE_PREFIX}MemberExpression, append: ${NODE_PREFIX}, computed?: boolean): ${NODE_PREFIX}MemberExpression`, + // eslint-disable-next-line max-len + `declare function inherits(child: T, parent: ${NODE_PREFIX} | null | void): T`, + // eslint-disable-next-line max-len + `declare function prependToMemberExpression(member: ${NODE_PREFIX}MemberExpression, prepend: ${NODE_PREFIX}Expression): ${NODE_PREFIX}MemberExpression`, `declare function removeProperties(n: T, opts: ?{}): void;`, `declare function removePropertiesDeep(n: T, opts: ?{}): T;`, + + // retrievers/ + // eslint-disable-next-line max-len + `declare function getBindingIdentifiers(node: ${NODE_PREFIX}, duplicates: boolean, outerOnly?: boolean): { [key: string]: ${NODE_PREFIX}Identifier | Array<${NODE_PREFIX}Identifier> }`, + // eslint-disable-next-line max-len + `declare function getOuterBindingIdentifiers(node: Node, duplicates: boolean): { [key: string]: ${NODE_PREFIX}Identifier | Array<${NODE_PREFIX}Identifier> }`, + + // traverse/ `declare type TraversalAncestors = Array<{ node: BabelNode, key: string, @@ -131,7 +197,36 @@ lines.push( exit?: TraversalHandler, };`.replace(/(^|\n) {2}/g, "$1"), // eslint-disable-next-line - `declare function traverse(n: BabelNode, TraversalHandler | TraversalHandlers, state?: T): void;` + `declare function traverse(n: BabelNode, TraversalHandler | TraversalHandlers, state?: T): void;`, + `declare function traverseFast(n: Node, h: TraversalHandler, state?: T): void;`, + + // utils/ + // cleanJSXElementLiteralChild is not exported + // inherit is not exported + `declare function shallowEqual(actual: Object, expected: Object): boolean`, + + // validators/ + // eslint-disable-next-line max-len + `declare function buildMatchMemberExpression(match: string, allowPartial?: boolean): (?BabelNode) => boolean`, + `declare function is(type: string, n: BabelNode, opts: Object): boolean;`, + `declare function isBinding(node: BabelNode, parent: BabelNode, grandparent?: BabelNode): boolean`, + `declare function isBlockScoped(node: BabelNode): boolean`, + `declare function isImmutable(node: BabelNode): boolean`, + `declare function isLet(node: BabelNode): boolean`, + `declare function isNode(node: ?Object): boolean`, + `declare function isNodesEquivalent(a: any, b: any): boolean`, + `declare function isPlaceholderType(placeholderType: string, targetType: string): boolean`, + `declare function isReferenced(node: BabelNode, parent: BabelNode, grandparent?: BabelNode): boolean`, + `declare function isScope(node: BabelNode, parent: BabelNode): boolean`, + `declare function isSpecifierDefault(specifier: BabelNodeModuleSpecifier): boolean`, + `declare function isType(nodetype: ?string, targetType: string): boolean`, + `declare function isValidES3Identifier(name: string): boolean`, + `declare function isValidES3Identifier(name: string): boolean`, + `declare function isValidIdentifier(name: string): boolean`, + `declare function isVar(node: BabelNode): boolean`, + // eslint-disable-next-line max-len + `declare function matchesPattern(node: ?BabelNode, match: string | Array, allowPartial?: boolean): boolean`, + `declare function validate(n: BabelNode, key: string, value: mixed): void;` ); for (const type in t.FLIPPED_ALIAS_KEYS) { diff --git a/packages/babel-types/scripts/generators/generateAsserts.js b/packages/babel-types/scripts/generators/generateAsserts.js index 150e8557c733..26bdb8dccbed 100644 --- a/packages/babel-types/scripts/generators/generateAsserts.js +++ b/packages/babel-types/scripts/generators/generateAsserts.js @@ -18,7 +18,8 @@ import is from "../../validators/is"; function assert(type: string, node: Object, opts?: Object): void { if (!is(type, node, opts)) { throw new Error( - \`Expected type "\${type}" with option \${JSON.stringify(opts)}, but instead got "\${node.type}".\`, + \`Expected type "\${type}" with option \${JSON.stringify((opts: any))}, \` + + \`but instead got "\${node.type}".\`, ); } }\n\n`; diff --git a/packages/babel-types/scripts/generators/typescript.js b/packages/babel-types/scripts/generators/typescript.js index b6019ec37324..1b2707aff04d 100644 --- a/packages/babel-types/scripts/generators/typescript.js +++ b/packages/babel-types/scripts/generators/typescript.js @@ -56,30 +56,40 @@ const lines = []; for (const type in t.NODE_FIELDS) { const fields = t.NODE_FIELDS[type]; const fieldNames = sortFieldNames(Object.keys(t.NODE_FIELDS[type]), type); + const builderNames = t.BUILDER_KEYS[type]; const struct = ['type: "' + type + '";']; const args = []; fieldNames.forEach(fieldName => { const field = fields[fieldName]; + // Future / annoying TODO: + // MemberExpression.property, ObjectProperty.key and ObjectMethod.key need special cases; either: + // - convert the declaration to chain() like ClassProperty.key and ClassMethod.key, + // - declare an alias type for valid keys, detect the case and reuse it here, + // - declare a disjoint union with, for example, ObjectPropertyBase, + // ObjectPropertyLiteralKey and ObjectPropertyComputedKey, and declare ObjectProperty + // as "ObjectPropertyBase & (ObjectPropertyLiteralKey | ObjectPropertyComputedKey)" let typeAnnotation = stringifyValidator(field.validate, ""); if (isNullable(field) && !hasDefault(field)) { typeAnnotation += " | null"; } - if (areAllRemainingFieldsNullable(fieldName, fieldNames, fields)) { - args.push( - `${t.toBindingIdentifierName(fieldName)}${ - isNullable(field) ? "?:" : ":" - } ${typeAnnotation}` - ); - } else { - args.push( - `${t.toBindingIdentifierName(fieldName)}: ${typeAnnotation}${ - isNullable(field) ? " | undefined" : "" - }` - ); + if (builderNames.includes(fieldName)) { + if (areAllRemainingFieldsNullable(fieldName, builderNames, fields)) { + args.push( + `${t.toBindingIdentifierName(fieldName)}${ + isNullable(field) ? "?:" : ":" + } ${typeAnnotation}` + ); + } else { + args.push( + `${t.toBindingIdentifierName(fieldName)}: ${typeAnnotation}${ + isNullable(field) ? " | undefined" : "" + }` + ); + } } const alphaNumeric = /^\w+$/; @@ -100,29 +110,122 @@ for (const type in t.NODE_FIELDS) { lines.push( `export function ${toFunctionName(type)}(${args.join(", ")}): ${type};` ); - } -} - -for (let i = 0; i < t.TYPES.length; i++) { - let decl = `export function is${ - t.TYPES[i] - }(node: object | null | undefined, opts?: object | null): `; - - if (t.NODE_FIELDS[t.TYPES[i]]) { - decl += `node is ${t.TYPES[i]};`; - } else if (t.FLIPPED_ALIAS_KEYS[t.TYPES[i]]) { - decl += `node is ${t.TYPES[i]};`; } else { - decl += `boolean;`; + const functionName = toFunctionName(type); + lines.push( + `declare function _${functionName}(${args.join(", ")}): ${type};`, + `export { _${functionName} as ${functionName}}` + ); } +} - lines.push(decl); +for (const typeName of t.TYPES) { + const result = + t.NODE_FIELDS[typeName] || t.FLIPPED_ALIAS_KEYS[typeName] + ? `node is ${typeName}` + : "boolean"; + + lines.push( + `export function is${typeName}(node: object | null | undefined, opts?: object | null): ${result};`, + // TypeScript 3.7: https://github.com/microsoft/TypeScript/pull/32695 will allow assert declarations + // eslint-disable-next-line max-len + `// export function assert${typeName}(node: object | null | undefined, opts?: object | null): asserts ${ + result === "boolean" ? "node" : result + };` + ); } lines.push( - `export function validate(n: Node, key: string, value: any): void;`, + // assert/ + // Commented out as this declaration requires TypeScript 3.7 (what do?) + `// export function assertNode(obj: any): asserts obj is Node`, + + // builders/ + // eslint-disable-next-line max-len + `export function createTypeAnnotationBasedOnTypeof(type: 'string' | 'number' | 'undefined' | 'boolean' | 'function' | 'object' | 'symbol'): StringTypeAnnotation | VoidTypeAnnotation | NumberTypeAnnotation | BooleanTypeAnnotation | GenericTypeAnnotation`, + `export function createUnionTypeAnnotation(types: [T]): T`, + // this probably misbehaves if there are 0 elements, and it's not a UnionTypeAnnotation if there's only 1 + // it is possible to require "2 or more" for this overload ([T, T, ...T[]]) but it requires typescript 3.0 + `export function createUnionTypeAnnotation(types: ReadonlyArray): UnionTypeAnnotation`, + // this smells like "internal API" + // eslint-disable-next-line max-len + `export function buildChildren(node: { children: ReadonlyArray }): JSXElement['children']`, + + // clone/ `export function clone(n: T): T;`, `export function cloneDeep(n: T): T;`, + `export function cloneNode(n: T, deep?: boolean): T;`, + `export function cloneWithoutLoc(n: T): T;`, + + // comments/ + `export type CommentTypeShorthand = 'leading' | 'inner' | 'trailing'`, + // eslint-disable-next-line max-len + `export function addComment(node: T, type: CommentTypeShorthand, content: string, line?: boolean): T`, + // eslint-disable-next-line max-len + `export function addComments(node: T, type: CommentTypeShorthand, comments: ReadonlyArray): T`, + `export function inheritInnerComments(node: Node, parent: Node): void`, + `export function inheritLeadingComments(node: Node, parent: Node): void`, + `export function inheritsComments(node: T, parent: Node): void`, + `export function inheritTrailingComments(node: Node, parent: Node): void`, + `export function removeComments(node: T): T`, + + // converters/ + // eslint-disable-next-line max-len + `export function ensureBlock(node: Extract): BlockStatement`, + // too complex? + // eslint-disable-next-line max-len + `export function ensureBlock = 'body'>(node: Extract>, key: K): BlockStatement`, + // gatherSequenceExpressions is not exported + `export function toBindingIdentifierName(name: { toString(): string } | null | undefined): string`, + `export function toBlock(node: Statement | Expression, parent?: Function | null): BlockStatement`, + // it is possible for `node` to be an arbitrary object if `key` is always provided, + // but that doesn't look like intended API + // eslint-disable-next-line max-len + `export function toComputedKey>(node: T, key?: Expression | Identifier): Expression`, + `export function toExpression(node: Function): FunctionExpression`, + `export function toExpression(node: Class): ClassExpression`, + `export function toExpression(node: ExpressionStatement | Expression | Class | Function): Expression`, + `export function toIdentifier(name: { toString(): string } | null | undefined): string`, + `export function toKeyAlias(node: Method | Property, key?: Node): string`, + // NOTE: this actually uses Scope from @babel/traverse, but we can't add a dependency on its types, + // as they live in @types. Declare the structural subset that is required. + // eslint-disable-next-line max-len + `export function toSequenceExpression(nodes: ReadonlyArray, scope: { push(value: { id: LVal; kind: 'var'; init?: Expression}): void; buildUndefinedNode(): Node }): SequenceExpression | undefined`, + `export function toStatement(node: AssignmentExpression, ignore?: boolean): ExpressionStatement`, + `export function toStatement(node: Statement | AssignmentExpression, ignore?: boolean): Statement`, + `export function toStatement(node: Class, ignore: true): ClassDeclaration | undefined`, + `export function toStatement(node: Class, ignore?: boolean): ClassDeclaration`, + `export function toStatement(node: Function, ignore: true): FunctionDeclaration | undefined`, + `export function toStatement(node: Function, ignore?: boolean): FunctionDeclaration`, + // eslint-disable-next-line max-len + `export function toStatement(node: Statement | Class | Function | AssignmentExpression, ignore: true): Statement | undefined`, + // eslint-disable-next-line max-len + `export function toStatement(node: Statement | Class | Function | AssignmentExpression, ignore?: boolean): Statement`, + // eslint-disable-next-line max-len + `export function valueToNode(value: undefined): Identifier`, // (should this not be a UnaryExpression to avoid shadowing?) + `export function valueToNode(value: boolean): BooleanLiteral`, + `export function valueToNode(value: null): NullLiteral`, + `export function valueToNode(value: string): StringLiteral`, + // Infinities and NaN need to use a BinaryExpression; negative values must be wrapped in UnaryExpression + `export function valueToNode(value: number): NumericLiteral | BinaryExpression | UnaryExpression`, + `export function valueToNode(value: RegExp): RegExpLiteral`, + // eslint-disable-next-line max-len + `export function valueToNode(value: ReadonlyArray): ArrayExpression`, + // this throws with objects that are not PlainObject according to lodash, + // or if there are non-valueToNode-able values + `export function valueToNode(value: object): ObjectExpression`, + // eslint-disable-next-line max-len + `export function valueToNode(value: undefined | boolean | null | string | number | RegExp | object): Expression`, + + // modifications/ + // eslint-disable-next-line max-len + `export function removeTypeDuplicates(types: ReadonlyArray): FlowType[]`, + // eslint-disable-next-line max-len + `export function appendToMemberExpression>(member: T, append: MemberExpression['property'], computed?: boolean): T`, + // eslint-disable-next-line max-len + `export function inherits(child: T, parent: Node | null | undefined): T`, + // eslint-disable-next-line max-len + `export function prependToMemberExpression>(member: T, prepend: MemberExpression['object']): T`, `export function removeProperties( n: Node, opts?: { preserveComments: boolean } | null @@ -131,18 +234,76 @@ lines.push( n: T, opts?: { preserveComments: boolean } | null ): T;`, + + // retrievers/ + // eslint-disable-next-line max-len + `export function getBindingIdentifiers(node: Node, duplicates: true, outerOnly?: boolean): Record>`, + // eslint-disable-next-line max-len + `export function getBindingIdentifiers(node: Node, duplicates?: false, outerOnly?: boolean): Record`, + // eslint-disable-next-line max-len + `export function getBindingIdentifiers(node: Node, duplicates: boolean, outerOnly?: boolean): Record>`, + // eslint-disable-next-line max-len + `export function getOuterBindingIdentifiers(node: Node, duplicates: true): Record>`, + `export function getOuterBindingIdentifiers(node: Node, duplicates?: false): Record`, + // eslint-disable-next-line max-len + `export function getOuterBindingIdentifiers(node: Node, duplicates: boolean): Record>`, + + // traverse/ `export type TraversalAncestors = ReadonlyArray<{ node: Node, key: string, index?: number, }>; - export type TraversalHandler = (node: Node, parent: TraversalAncestors, type: T) => void; + export type TraversalHandler = ( + this: undefined, node: Node, parent: TraversalAncestors, type: T + ) => void; export type TraversalHandlers = { enter?: TraversalHandler, exit?: TraversalHandler, };`.replace(/(^|\n) {2}/g, "$1"), // eslint-disable-next-line - `export function traverse(n: Node, h: TraversalHandler | TraversalHandlers, state?: T): void;` + `export function traverse(n: Node, h: TraversalHandler | TraversalHandlers, state?: T): void;`, + `export function traverseFast(n: Node, h: TraversalHandler, state?: T): void;`, + + // utils/ + // cleanJSXElementLiteralChild is not exported + // inherit is not exported + `export function shallowEqual(actual: object, expected: T): actual is T`, + + // validators/ + // eslint-disable-next-line max-len + `export function buildMatchMemberExpression(match: string, allowPartial?: boolean): (node: Node | null | undefined) => node is MemberExpression`, + // eslint-disable-next-line max-len + `export function is(type: T, n: Node | null | undefined, required?: undefined): n is Extract`, + // eslint-disable-next-line max-len + `export function is>(type: T, n: Node | null | undefined, required: Partial

): n is P`, + // eslint-disable-next-line max-len + `export function is

(type: string, n: Node | null | undefined, required: Partial

): n is P`, + `export function is(type: string, n: Node | null | undefined, required?: Partial): n is Node`, + `export function isBinding(node: Node, parent: Node, grandparent?: Node): boolean`, + // eslint-disable-next-line max-len + `export function isBlockScoped(node: Node): node is FunctionDeclaration | ClassDeclaration | VariableDeclaration`, + `export function isImmutable(node: Node): node is Immutable`, + `export function isLet(node: Node): node is VariableDeclaration`, + `export function isNode(node: object | null | undefined): node is Node`, + `export function isNodesEquivalent>(a: T, b: any): b is T`, + `export function isNodesEquivalent(a: any, b: any): boolean`, + `export function isPlaceholderType(placeholderType: Node['type'], targetType: Node['type']): boolean`, + `export function isReferenced(node: Node, parent: Node, grandparent?: Node): boolean`, + `export function isScope(node: Node, parent: Node): node is Scopable`, + `export function isSpecifierDefault(specifier: ModuleSpecifier): boolean`, + `export function isType(nodetype: string, targetType: T): nodetype is T`, + `export function isType(nodetype: string | null | undefined, targetType: string): boolean`, + `export function isValidES3Identifier(name: string): boolean`, + `export function isValidIdentifier(name: string): boolean`, + `export function isVar(node: Node): node is VariableDeclaration`, + // the MemberExpression implication is incidental, but it follows from the implementation + // eslint-disable-next-line max-len + `export function matchesPattern(node: Node | null | undefined, match: string | ReadonlyArray, allowPartial?: boolean): node is MemberExpression`, + // TypeScript 3.7: ": asserts n is T" + // eslint-disable-next-line max-len + `export function validate(n: Node | null | undefined, key: K, value: T[K]): void`, + `export function validate(n: Node, key: string, value: any): void;` ); for (const type in t.DEPRECATED_KEYS) { diff --git a/packages/babel-types/scripts/utils/formatBuilderName.js b/packages/babel-types/scripts/utils/formatBuilderName.js index 1b543a9bfaf5..621c46821951 100644 --- a/packages/babel-types/scripts/utils/formatBuilderName.js +++ b/packages/babel-types/scripts/utils/formatBuilderName.js @@ -5,5 +5,6 @@ const toLowerCase = Function.call.bind("".toLowerCase); module.exports = function formatBuilderName(type) { // FunctionExpression -> functionExpression // JSXIdentifier -> jsxIdentifier - return type.replace(/^([A-Z](?=[a-z])|[A-Z]+(?=[A-Z]))/, toLowerCase); + // V8IntrinsicIdentifier -> v8IntrinsicIdentifier + return type.replace(/^([A-Z](?=[a-z0-9])|[A-Z]+(?=[A-Z]))/, toLowerCase); }; diff --git a/packages/babel-types/src/asserts/assertNode.js b/packages/babel-types/src/asserts/assertNode.js index 61891e54de40..0097871ebc94 100644 --- a/packages/babel-types/src/asserts/assertNode.js +++ b/packages/babel-types/src/asserts/assertNode.js @@ -4,6 +4,6 @@ import isNode from "../validators/isNode"; export default function assertNode(node?: Object): void { if (!isNode(node)) { const type = (node && node.type) || JSON.stringify(node); - throw new TypeError(`Not a valid node of type "${type}"`); + throw new TypeError(`Not a valid node of type "${(type: any)}"`); } } diff --git a/packages/babel-types/src/asserts/generated/index.js b/packages/babel-types/src/asserts/generated/index.js index 3a4e81d34700..9f2ebce70e4a 100644 --- a/packages/babel-types/src/asserts/generated/index.js +++ b/packages/babel-types/src/asserts/generated/index.js @@ -8,9 +8,8 @@ import is from "../../validators/is"; function assert(type: string, node: Object, opts?: Object): void { if (!is(type, node, opts)) { throw new Error( - `Expected type "${type}" with option ${JSON.stringify( - opts, - )}, but instead got "${node.type}".`, + `Expected type "${type}" with option ${JSON.stringify((opts: any))}, ` + + `but instead got "${node.type}".`, ); } } @@ -225,12 +224,12 @@ export function assertArrowFunctionExpression( export function assertClassBody(node: Object, opts?: Object = {}): void { assert("ClassBody", node, opts); } -export function assertClassDeclaration(node: Object, opts?: Object = {}): void { - assert("ClassDeclaration", node, opts); -} export function assertClassExpression(node: Object, opts?: Object = {}): void { assert("ClassExpression", node, opts); } +export function assertClassDeclaration(node: Object, opts?: Object = {}): void { + assert("ClassDeclaration", node, opts); +} export function assertExportAllDeclaration( node: Object, opts?: Object = {}, @@ -585,6 +584,39 @@ export function assertVoidTypeAnnotation( ): void { assert("VoidTypeAnnotation", node, opts); } +export function assertEnumDeclaration(node: Object, opts?: Object = {}): void { + assert("EnumDeclaration", node, opts); +} +export function assertEnumBooleanBody(node: Object, opts?: Object = {}): void { + assert("EnumBooleanBody", node, opts); +} +export function assertEnumNumberBody(node: Object, opts?: Object = {}): void { + assert("EnumNumberBody", node, opts); +} +export function assertEnumStringBody(node: Object, opts?: Object = {}): void { + assert("EnumStringBody", node, opts); +} +export function assertEnumSymbolBody(node: Object, opts?: Object = {}): void { + assert("EnumSymbolBody", node, opts); +} +export function assertEnumBooleanMember( + node: Object, + opts?: Object = {}, +): void { + assert("EnumBooleanMember", node, opts); +} +export function assertEnumNumberMember(node: Object, opts?: Object = {}): void { + assert("EnumNumberMember", node, opts); +} +export function assertEnumStringMember(node: Object, opts?: Object = {}): void { + assert("EnumStringMember", node, opts); +} +export function assertEnumDefaultedMember( + node: Object, + opts?: Object = {}, +): void { + assert("EnumDefaultedMember", node, opts); +} export function assertJSXAttribute(node: Object, opts?: Object = {}): void { assert("JSXAttribute", node, opts); } @@ -663,6 +695,12 @@ export function assertNoop(node: Object, opts?: Object = {}): void { export function assertPlaceholder(node: Object, opts?: Object = {}): void { assert("Placeholder", node, opts); } +export function assertV8IntrinsicIdentifier( + node: Object, + opts?: Object = {}, +): void { + assert("V8IntrinsicIdentifier", node, opts); +} export function assertArgumentPlaceholder( node: Object, opts?: Object = {}, @@ -795,8 +833,17 @@ export function assertTSIndexSignature(node: Object, opts?: Object = {}): void { export function assertTSAnyKeyword(node: Object, opts?: Object = {}): void { assert("TSAnyKeyword", node, opts); } -export function assertTSUnknownKeyword(node: Object, opts?: Object = {}): void { - assert("TSUnknownKeyword", node, opts); +export function assertTSBooleanKeyword(node: Object, opts?: Object = {}): void { + assert("TSBooleanKeyword", node, opts); +} +export function assertTSBigIntKeyword(node: Object, opts?: Object = {}): void { + assert("TSBigIntKeyword", node, opts); +} +export function assertTSNeverKeyword(node: Object, opts?: Object = {}): void { + assert("TSNeverKeyword", node, opts); +} +export function assertTSNullKeyword(node: Object, opts?: Object = {}): void { + assert("TSNullKeyword", node, opts); } export function assertTSNumberKeyword(node: Object, opts?: Object = {}): void { assert("TSNumberKeyword", node, opts); @@ -804,29 +851,23 @@ export function assertTSNumberKeyword(node: Object, opts?: Object = {}): void { export function assertTSObjectKeyword(node: Object, opts?: Object = {}): void { assert("TSObjectKeyword", node, opts); } -export function assertTSBooleanKeyword(node: Object, opts?: Object = {}): void { - assert("TSBooleanKeyword", node, opts); -} export function assertTSStringKeyword(node: Object, opts?: Object = {}): void { assert("TSStringKeyword", node, opts); } export function assertTSSymbolKeyword(node: Object, opts?: Object = {}): void { assert("TSSymbolKeyword", node, opts); } -export function assertTSVoidKeyword(node: Object, opts?: Object = {}): void { - assert("TSVoidKeyword", node, opts); -} export function assertTSUndefinedKeyword( node: Object, opts?: Object = {}, ): void { assert("TSUndefinedKeyword", node, opts); } -export function assertTSNullKeyword(node: Object, opts?: Object = {}): void { - assert("TSNullKeyword", node, opts); +export function assertTSUnknownKeyword(node: Object, opts?: Object = {}): void { + assert("TSUnknownKeyword", node, opts); } -export function assertTSNeverKeyword(node: Object, opts?: Object = {}): void { - assert("TSNeverKeyword", node, opts); +export function assertTSVoidKeyword(node: Object, opts?: Object = {}): void { + assert("TSVoidKeyword", node, opts); } export function assertTSThisType(node: Object, opts?: Object = {}): void { assert("TSThisType", node, opts); @@ -1131,6 +1172,12 @@ export function assertFlowDeclaration(node: Object, opts?: Object = {}): void { export function assertFlowPredicate(node: Object, opts?: Object = {}): void { assert("FlowPredicate", node, opts); } +export function assertEnumBody(node: Object, opts?: Object = {}): void { + assert("EnumBody", node, opts); +} +export function assertEnumMember(node: Object, opts?: Object = {}): void { + assert("EnumMember", node, opts); +} export function assertJSX(node: Object, opts?: Object = {}): void { assert("JSX", node, opts); } diff --git a/packages/babel-types/src/builders/builder.js b/packages/babel-types/src/builders/builder.js index e01cf9fd97d6..04b5df08b888 100644 --- a/packages/babel-types/src/builders/builder.js +++ b/packages/babel-types/src/builders/builder.js @@ -8,9 +8,7 @@ export default function builder(type: string, ...args: Array): Object { const countArgs = args.length; if (countArgs > keys.length) { throw new Error( - `${type}: Too many arguments passed. Received ${countArgs} but can receive no more than ${ - keys.length - }`, + `${type}: Too many arguments passed. Received ${countArgs} but can receive no more than ${keys.length}`, ); } diff --git a/packages/babel-types/src/builders/generated/index.js b/packages/babel-types/src/builders/generated/index.js index e4ca375762cc..8aebb3a8d830 100644 --- a/packages/babel-types/src/builders/generated/index.js +++ b/packages/babel-types/src/builders/generated/index.js @@ -225,14 +225,14 @@ export function ClassBody(...args: Array): Object { return builder("ClassBody", ...args); } export { ClassBody as classBody }; -export function ClassDeclaration(...args: Array): Object { - return builder("ClassDeclaration", ...args); -} -export { ClassDeclaration as classDeclaration }; export function ClassExpression(...args: Array): Object { return builder("ClassExpression", ...args); } export { ClassExpression as classExpression }; +export function ClassDeclaration(...args: Array): Object { + return builder("ClassDeclaration", ...args); +} +export { ClassDeclaration as classDeclaration }; export function ExportAllDeclaration(...args: Array): Object { return builder("ExportAllDeclaration", ...args); } @@ -517,6 +517,42 @@ export function VoidTypeAnnotation(...args: Array): Object { return builder("VoidTypeAnnotation", ...args); } export { VoidTypeAnnotation as voidTypeAnnotation }; +export function EnumDeclaration(...args: Array): Object { + return builder("EnumDeclaration", ...args); +} +export { EnumDeclaration as enumDeclaration }; +export function EnumBooleanBody(...args: Array): Object { + return builder("EnumBooleanBody", ...args); +} +export { EnumBooleanBody as enumBooleanBody }; +export function EnumNumberBody(...args: Array): Object { + return builder("EnumNumberBody", ...args); +} +export { EnumNumberBody as enumNumberBody }; +export function EnumStringBody(...args: Array): Object { + return builder("EnumStringBody", ...args); +} +export { EnumStringBody as enumStringBody }; +export function EnumSymbolBody(...args: Array): Object { + return builder("EnumSymbolBody", ...args); +} +export { EnumSymbolBody as enumSymbolBody }; +export function EnumBooleanMember(...args: Array): Object { + return builder("EnumBooleanMember", ...args); +} +export { EnumBooleanMember as enumBooleanMember }; +export function EnumNumberMember(...args: Array): Object { + return builder("EnumNumberMember", ...args); +} +export { EnumNumberMember as enumNumberMember }; +export function EnumStringMember(...args: Array): Object { + return builder("EnumStringMember", ...args); +} +export { EnumStringMember as enumStringMember }; +export function EnumDefaultedMember(...args: Array): Object { + return builder("EnumDefaultedMember", ...args); +} +export { EnumDefaultedMember as enumDefaultedMember }; export function JSXAttribute(...args: Array): Object { return builder("JSXAttribute", ...args); } @@ -600,6 +636,10 @@ export function Placeholder(...args: Array): Object { return builder("Placeholder", ...args); } export { Placeholder as placeholder }; +export function V8IntrinsicIdentifier(...args: Array): Object { + return builder("V8IntrinsicIdentifier", ...args); +} +export { V8IntrinsicIdentifier as v8IntrinsicIdentifier }; export function ArgumentPlaceholder(...args: Array): Object { return builder("ArgumentPlaceholder", ...args); } @@ -722,11 +762,26 @@ export function TSAnyKeyword(...args: Array): Object { } export { TSAnyKeyword as tsAnyKeyword }; export { TSAnyKeyword as tSAnyKeyword }; -export function TSUnknownKeyword(...args: Array): Object { - return builder("TSUnknownKeyword", ...args); +export function TSBooleanKeyword(...args: Array): Object { + return builder("TSBooleanKeyword", ...args); } -export { TSUnknownKeyword as tsUnknownKeyword }; -export { TSUnknownKeyword as tSUnknownKeyword }; +export { TSBooleanKeyword as tsBooleanKeyword }; +export { TSBooleanKeyword as tSBooleanKeyword }; +export function TSBigIntKeyword(...args: Array): Object { + return builder("TSBigIntKeyword", ...args); +} +export { TSBigIntKeyword as tsBigIntKeyword }; +export { TSBigIntKeyword as tSBigIntKeyword }; +export function TSNeverKeyword(...args: Array): Object { + return builder("TSNeverKeyword", ...args); +} +export { TSNeverKeyword as tsNeverKeyword }; +export { TSNeverKeyword as tSNeverKeyword }; +export function TSNullKeyword(...args: Array): Object { + return builder("TSNullKeyword", ...args); +} +export { TSNullKeyword as tsNullKeyword }; +export { TSNullKeyword as tSNullKeyword }; export function TSNumberKeyword(...args: Array): Object { return builder("TSNumberKeyword", ...args); } @@ -737,11 +792,6 @@ export function TSObjectKeyword(...args: Array): Object { } export { TSObjectKeyword as tsObjectKeyword }; export { TSObjectKeyword as tSObjectKeyword }; -export function TSBooleanKeyword(...args: Array): Object { - return builder("TSBooleanKeyword", ...args); -} -export { TSBooleanKeyword as tsBooleanKeyword }; -export { TSBooleanKeyword as tSBooleanKeyword }; export function TSStringKeyword(...args: Array): Object { return builder("TSStringKeyword", ...args); } @@ -752,26 +802,21 @@ export function TSSymbolKeyword(...args: Array): Object { } export { TSSymbolKeyword as tsSymbolKeyword }; export { TSSymbolKeyword as tSSymbolKeyword }; -export function TSVoidKeyword(...args: Array): Object { - return builder("TSVoidKeyword", ...args); -} -export { TSVoidKeyword as tsVoidKeyword }; -export { TSVoidKeyword as tSVoidKeyword }; export function TSUndefinedKeyword(...args: Array): Object { return builder("TSUndefinedKeyword", ...args); } export { TSUndefinedKeyword as tsUndefinedKeyword }; export { TSUndefinedKeyword as tSUndefinedKeyword }; -export function TSNullKeyword(...args: Array): Object { - return builder("TSNullKeyword", ...args); +export function TSUnknownKeyword(...args: Array): Object { + return builder("TSUnknownKeyword", ...args); } -export { TSNullKeyword as tsNullKeyword }; -export { TSNullKeyword as tSNullKeyword }; -export function TSNeverKeyword(...args: Array): Object { - return builder("TSNeverKeyword", ...args); +export { TSUnknownKeyword as tsUnknownKeyword }; +export { TSUnknownKeyword as tSUnknownKeyword }; +export function TSVoidKeyword(...args: Array): Object { + return builder("TSVoidKeyword", ...args); } -export { TSNeverKeyword as tsNeverKeyword }; -export { TSNeverKeyword as tSNeverKeyword }; +export { TSVoidKeyword as tsVoidKeyword }; +export { TSVoidKeyword as tSVoidKeyword }; export function TSThisType(...args: Array): Object { return builder("TSThisType", ...args); } diff --git a/packages/babel-types/src/constants/generated/index.js b/packages/babel-types/src/constants/generated/index.js index eedb7038ed28..1f4b576a87b6 100644 --- a/packages/babel-types/src/constants/generated/index.js +++ b/packages/babel-types/src/constants/generated/index.js @@ -45,6 +45,8 @@ export const FLOWBASEANNOTATION_TYPES = FLIPPED_ALIAS_KEYS["FlowBaseAnnotation"]; export const FLOWDECLARATION_TYPES = FLIPPED_ALIAS_KEYS["FlowDeclaration"]; export const FLOWPREDICATE_TYPES = FLIPPED_ALIAS_KEYS["FlowPredicate"]; +export const ENUMBODY_TYPES = FLIPPED_ALIAS_KEYS["EnumBody"]; +export const ENUMMEMBER_TYPES = FLIPPED_ALIAS_KEYS["EnumMember"]; export const JSX_TYPES = FLIPPED_ALIAS_KEYS["JSX"]; export const PRIVATE_TYPES = FLIPPED_ALIAS_KEYS["Private"]; export const TSTYPEELEMENT_TYPES = FLIPPED_ALIAS_KEYS["TSTypeElement"]; diff --git a/packages/babel-types/src/constants/index.js b/packages/babel-types/src/constants/index.js index b777caa0f11e..4dfe13d65adb 100644 --- a/packages/babel-types/src/constants/index.js +++ b/packages/babel-types/src/constants/index.js @@ -41,6 +41,12 @@ export const BINARY_OPERATORS = [ ...BOOLEAN_BINARY_OPERATORS, ]; +export const ASSIGNMENT_OPERATORS = [ + "=", + "+=", + ...NUMBER_BINARY_OPERATORS.map(op => op + "="), +]; + export const BOOLEAN_UNARY_OPERATORS = ["delete", "!"]; export const NUMBER_UNARY_OPERATORS = ["+", "-", "~"]; export const STRING_UNARY_OPERATORS = ["typeof"]; diff --git a/packages/babel-types/src/definitions/core.js b/packages/babel-types/src/definitions/core.js index 1e4de3ebbfa0..9461e36d3cc2 100644 --- a/packages/babel-types/src/definitions/core.js +++ b/packages/babel-types/src/definitions/core.js @@ -1,9 +1,13 @@ // @flow -import isValidIdentifier from "../validators/isValidIdentifier"; + +import esutils from "esutils"; + +import is from "../validators/is"; import { BINARY_OPERATORS, LOGICAL_OPERATORS, + ASSIGNMENT_OPERATORS, UNARY_OPERATORS, UPDATE_OPERATORS, } from "../constants"; @@ -26,7 +30,7 @@ defineType("ArrayExpression", { assertNodeOrValueType("null", "Expression", "SpreadElement"), ), ), - default: [], + default: !process.env.BABEL_TYPES_8_BREAKING ? [] : undefined, }, }, visitor: ["elements"], @@ -36,10 +40,29 @@ defineType("ArrayExpression", { defineType("AssignmentExpression", { fields: { operator: { - validate: assertValueType("string"), + validate: (function() { + if (!process.env.BABEL_TYPES_8_BREAKING) { + return assertValueType("string"); + } + + const identifier = assertOneOf(...ASSIGNMENT_OPERATORS); + const pattern = assertOneOf("="); + + return function(node, key, val) { + const validator = is("Pattern", node.left) ? pattern : identifier; + validator(node, key, val); + }; + })(), }, left: { - validate: assertNodeType("LVal"), + validate: !process.env.BABEL_TYPES_8_BREAKING + ? assertNodeType("LVal") + : assertNodeType( + "Identifier", + "MemberExpression", + "ArrayPattern", + "ObjectPattern", + ), }, right: { validate: assertNodeType("Expression"), @@ -132,7 +155,7 @@ defineType("CallExpression", { aliases: ["Expression"], fields: { callee: { - validate: assertNodeType("Expression"), + validate: assertNodeType("Expression", "V8IntrinsicIdentifier"), }, arguments: { validate: chain( @@ -147,10 +170,14 @@ defineType("CallExpression", { ), ), }, - optional: { - validate: assertOneOf(true, false), - optional: true, - }, + ...(!process.env.BABEL_TYPES_8_BREAKING + ? { + optional: { + validate: assertOneOf(true, false), + optional: true, + }, + } + : {}), typeArguments: { validate: assertNodeType("TypeParameterInstantiation"), optional: true, @@ -166,7 +193,7 @@ defineType("CatchClause", { visitor: ["param", "body"], fields: { param: { - validate: assertNodeType("Identifier"), + validate: assertNodeType("Identifier", "ArrayPattern", "ObjectPattern"), optional: true, }, body: { @@ -256,7 +283,15 @@ defineType("ForInStatement", { ], fields: { left: { - validate: assertNodeType("VariableDeclaration", "LVal"), + validate: !process.env.BABEL_TYPES_8_BREAKING + ? assertNodeType("VariableDeclaration", "LVal") + : assertNodeType( + "VariableDeclaration", + "Identifier", + "MemberExpression", + "ArrayPattern", + "ObjectPattern", + ), }, right: { validate: assertNodeType("Expression"), @@ -305,10 +340,8 @@ export const functionCommon = { }, generator: { default: false, - validate: assertValueType("boolean"), }, async: { - validate: assertValueType("boolean"), default: false, }, }; @@ -359,6 +392,17 @@ defineType("FunctionDeclaration", { "Pureish", "Declaration", ], + validate: (function() { + if (!process.env.BABEL_TYPES_8_BREAKING) return () => {}; + + const identifier = assertNodeType("Identifier"); + + return function(parent, key, node) { + if (!is("ExportDefaultDeclaration", parent)) { + identifier(node, "id", node.id); + } + }; + })(), }); defineType("FunctionExpression", { @@ -405,17 +449,55 @@ defineType("Identifier", { fields: { ...patternLikeCommon, name: { - validate: chain(function(node, key, val) { - if (!isValidIdentifier(val)) { - // throw new TypeError(`"${val}" is not a valid identifer name`); + validate: chain(assertValueType("string"), function(node, key, val) { + if (!process.env.BABEL_TYPES_8_BREAKING) return; + + if (!esutils.keyword.isIdentifierNameES6(val)) { + throw new TypeError(`"${val}" is not a valid identifier name`); } - }, assertValueType("string")), + }), }, optional: { validate: assertValueType("boolean"), optional: true, }, }, + validate(parent, key, node) { + if (!process.env.BABEL_TYPES_8_BREAKING) return; + + const match = /\.(\w+)$/.exec(key); + if (!match) return; + + const [, parentKey] = match; + const nonComp = { computed: false }; + + // We can't check if `parent.property === node`, because nodes are validated + // before replacing them in the AST. + if (parentKey === "property") { + if (is("MemberExpression", parent, nonComp)) return; + if (is("OptionalMemberExpression", parent, nonComp)) return; + } else if (parentKey === "key") { + if (is("Property", parent, nonComp)) return; + if (is("Method", parent, nonComp)) return; + } else if (parentKey === "exported") { + if (is("ExportSpecifier", parent)) return; + } else if (parentKey === "imported") { + if (is("ImportSpecifier", parent, { imported: node })) return; + } else if (parentKey === "meta") { + if (is("MetaProperty", parent, { meta: node })) return; + } + + if ( + // Ideally this should be strict if this node is a descendant of a block + // in strict mode. Also, we should disallow "await" in modules. + esutils.keyword.isReservedWordES6(node.name, /* strict */ false) && + // Even if "this" is a keyword, we are using the Identifier + // node to represent it. + node.name !== "this" + ) { + throw new TypeError(`"${node.name}" is not a valid identifer`); + } + }, }); defineType("IfStatement", { @@ -492,7 +574,14 @@ defineType("RegExpLiteral", { validate: assertValueType("string"), }, flags: { - validate: assertValueType("string"), + validate: chain(assertValueType("string"), function(node, key, val) { + if (!process.env.BABEL_TYPES_8_BREAKING) return; + + const invalid = /[^gimsuy]/.exec(val); + if (invalid) { + throw new TypeError(`"${invalid[0]}" is not a valid RegExp flag`); + } + }), default: "", }, }, @@ -537,10 +626,14 @@ defineType("MemberExpression", { computed: { default: false, }, - optional: { - validate: assertOneOf(true, false), - optional: true, - }, + ...(!process.env.BABEL_TYPES_8_BREAKING + ? { + optional: { + validate: assertOneOf(true, false), + optional: true, + }, + } + : {}), }, }); @@ -597,19 +690,15 @@ defineType("ObjectExpression", { }); defineType("ObjectMethod", { - builder: ["kind", "key", "params", "body", "computed"], + builder: ["kind", "key", "params", "body", "computed", "generator", "async"], fields: { ...functionCommon, ...functionTypeAnnotationCommon, kind: { - validate: chain( - assertValueType("string"), - assertOneOf("method", "get", "set"), - ), - default: "method", + validate: assertOneOf("method", "get", "set"), + ...(!process.env.BABEL_TYPES_8_BREAKING ? { default: "method" } : {}), }, computed: { - validate: assertValueType("boolean"), default: false, }, key: { @@ -632,6 +721,7 @@ defineType("ObjectMethod", { assertValueType("array"), assertEach(assertNodeType("Decorator")), ), + optional: true, }, body: { validate: assertNodeType("BlockStatement"), @@ -657,10 +747,15 @@ defineType("ObjectMethod", { }); defineType("ObjectProperty", { - builder: ["key", "value", "computed", "shorthand", "decorators"], + builder: [ + "key", + "value", + "computed", + "shorthand", + ...(!process.env.BABEL_TYPES_8_BREAKING ? ["decorators"] : []), + ], fields: { computed: { - validate: assertValueType("boolean"), default: false, }, key: { @@ -684,7 +779,27 @@ defineType("ObjectProperty", { validate: assertNodeType("Expression", "PatternLike"), }, shorthand: { - validate: assertValueType("boolean"), + validate: chain( + assertValueType("boolean"), + function(node, key, val) { + if (!process.env.BABEL_TYPES_8_BREAKING) return; + + if (val && node.computed) { + throw new TypeError( + "Property shorthand of ObjectProperty cannot be true if computed is true", + ); + } + }, + function(node, key, val) { + if (!process.env.BABEL_TYPES_8_BREAKING) return; + + if (val && !is("Identifier", node.key)) { + throw new TypeError( + "Property shorthand of ObjectProperty cannot be true if key is not an Identifier", + ); + } + }, + ), default: false, }, decorators: { @@ -697,6 +812,17 @@ defineType("ObjectProperty", { }, visitor: ["key", "value", "decorators"], aliases: ["UserWhitespacable", "Property", "ObjectMember"], + validate: (function() { + const pattern = assertNodeType("Identifier", "Pattern"); + const expression = assertNodeType("Expression"); + + return function(parent, key, node) { + if (!process.env.BABEL_TYPES_8_BREAKING) return; + + const validator = is("ObjectPattern", parent) ? pattern : expression; + validator(node, "value", node.value); + }; + })(), }); defineType("RestElement", { @@ -707,9 +833,22 @@ defineType("RestElement", { fields: { ...patternLikeCommon, argument: { - validate: assertNodeType("LVal"), + validate: !process.env.BABEL_TYPES_8_BREAKING + ? assertNodeType("LVal") + : assertNodeType("Identifier", "Pattern", "MemberExpression"), }, }, + validate(parent, key) { + if (!process.env.BABEL_TYPES_8_BREAKING) return; + + const match = /(\w+)\[(\d+)\]/.exec(key); + if (!match) throw new Error("Internal Babel error: malformed key."); + + const [, listKey, index] = match; + if (parent[listKey].length > index + 1) { + throw new TypeError(`RestElement must be last element of ${listKey}`); + } + }, }); defineType("ReturnStatement", { @@ -792,13 +931,23 @@ defineType("ThrowStatement", { }, }); -// todo: at least handler or finalizer should be set to be valid defineType("TryStatement", { visitor: ["block", "handler", "finalizer"], aliases: ["Statement"], fields: { block: { - validate: assertNodeType("BlockStatement"), + validate: chain(assertNodeType("BlockStatement"), function(node) { + if (!process.env.BABEL_TYPES_8_BREAKING) return; + + // This validator isn't put at the top level because we can run it + // even if this node doesn't have a parent. + + if (!node.handler && !node.finalizer) { + throw new TypeError( + "TryStatement expects either a handler or finalizer, or both", + ); + } + }), }, handler: { optional: true, @@ -835,7 +984,9 @@ defineType("UpdateExpression", { default: false, }, argument: { - validate: assertNodeType("Expression"), + validate: !process.env.BABEL_TYPES_8_BREAKING + ? assertNodeType("Expression") + : assertNodeType("Identifier", "MemberExpression"), }, operator: { validate: assertOneOf(...UPDATE_OPERATORS), @@ -855,10 +1006,7 @@ defineType("VariableDeclaration", { optional: true, }, kind: { - validate: chain( - assertValueType("string"), - assertOneOf("var", "let", "const"), - ), + validate: assertOneOf("var", "let", "const"), }, declarations: { validate: chain( @@ -867,13 +1015,39 @@ defineType("VariableDeclaration", { ), }, }, + validate(parent, key, node) { + if (!process.env.BABEL_TYPES_8_BREAKING) return; + + if (!is("ForXStatement", parent, { left: node })) return; + if (node.declarations.length !== 1) { + throw new TypeError( + `Exactly one VariableDeclarator is required in the VariableDeclaration of a ${parent.type}`, + ); + } + }, }); defineType("VariableDeclarator", { visitor: ["id", "init"], fields: { id: { - validate: assertNodeType("LVal"), + validate: (function() { + if (!process.env.BABEL_TYPES_8_BREAKING) { + return assertNodeType("LVal"); + } + + const normal = assertNodeType( + "Identifier", + "ArrayPattern", + "ObjectPattern", + ); + const without = assertNodeType("Identifier"); + + return function(node, key, val) { + const validator = node.init ? normal : without; + validator(node, key, val); + }; + })(), }, definite: { optional: true, @@ -894,7 +1068,7 @@ defineType("WhileStatement", { validate: assertNodeType("Expression"), }, body: { - validate: assertNodeType("BlockStatement", "Statement"), + validate: assertNodeType("Statement"), }, }, }); @@ -907,7 +1081,7 @@ defineType("WithStatement", { validate: assertNodeType("Expression"), }, body: { - validate: assertNodeType("BlockStatement", "Statement"), + validate: assertNodeType("Statement"), }, }, }); diff --git a/packages/babel-types/src/definitions/es2015.js b/packages/babel-types/src/definitions/es2015.js index 18649b1df19e..853af1b12e65 100644 --- a/packages/babel-types/src/definitions/es2015.js +++ b/packages/babel-types/src/definitions/es2015.js @@ -3,6 +3,7 @@ import defineType, { assertShape, assertNodeType, assertValueType, + assertNodeOrValueType, chain, assertEach, assertOneOf, @@ -13,6 +14,7 @@ import { functionTypeAnnotationCommon, patternLikeCommon, } from "./core"; +import is from "../validators/is"; defineType("AssignmentPattern", { visitor: ["left", "right", "decorators" /* for legacy param decorators */], @@ -31,11 +33,13 @@ defineType("AssignmentPattern", { right: { validate: assertNodeType("Expression"), }, + // For TypeScript decorators: { validate: chain( assertValueType("array"), assertEach(assertNodeType("Decorator")), ), + optional: true, }, }, }); @@ -49,14 +53,16 @@ defineType("ArrayPattern", { elements: { validate: chain( assertValueType("array"), - assertEach(assertNodeType("PatternLike")), + assertEach(assertNodeOrValueType("null", "PatternLike")), ), }, + // For TypeScript decorators: { validate: chain( assertValueType("array"), assertEach(assertNodeType("Decorator")), ), + optional: true, }, }, }); @@ -106,41 +112,7 @@ defineType("ClassBody", { }, }); -const classCommon = { - typeParameters: { - validate: assertNodeType( - "TypeParameterDeclaration", - "TSTypeParameterDeclaration", - "Noop", - ), - optional: true, - }, - body: { - validate: assertNodeType("ClassBody"), - }, - superClass: { - optional: true, - validate: assertNodeType("Expression"), - }, - superTypeParameters: { - validate: assertNodeType( - "TypeParameterInstantiation", - "TSTypeParameterInstantiation", - ), - optional: true, - }, - implements: { - validate: chain( - assertValueType("array"), - assertEach( - assertNodeType("TSExpressionWithTypeArguments", "ClassImplements"), - ), - ), - optional: true, - }, -}; - -defineType("ClassDeclaration", { +defineType("ClassExpression", { builder: ["id", "superClass", "body", "decorators"], visitor: [ "id", @@ -152,39 +124,21 @@ defineType("ClassDeclaration", { "implements", "decorators", ], - aliases: ["Scopable", "Class", "Statement", "Declaration", "Pureish"], + aliases: ["Scopable", "Class", "Expression", "Pureish"], fields: { - ...classCommon, - declare: { - validate: assertValueType("boolean"), - optional: true, - }, - abstract: { - validate: assertValueType("boolean"), - optional: true, - }, id: { validate: assertNodeType("Identifier"), - optional: true, // Missing if this is the child of an ExportDefaultDeclaration. - }, - decorators: { - validate: chain( - assertValueType("array"), - assertEach(assertNodeType("Decorator")), - ), + // In declarations, this is missing if this is the + // child of an ExportDefaultDeclaration. optional: true, }, - }, -}); - -defineType("ClassExpression", { - inherits: "ClassDeclaration", - aliases: ["Scopable", "Class", "Expression", "Pureish"], - fields: { - ...classCommon, - id: { + typeParameters: { + validate: assertNodeType( + "TypeParameterDeclaration", + "TSTypeParameterDeclaration", + "Noop", + ), optional: true, - validate: assertNodeType("Identifier"), }, body: { validate: assertNodeType("ClassBody"), @@ -193,6 +147,22 @@ defineType("ClassExpression", { optional: true, validate: assertNodeType("Expression"), }, + superTypeParameters: { + validate: assertNodeType( + "TypeParameterInstantiation", + "TSTypeParameterInstantiation", + ), + optional: true, + }, + implements: { + validate: chain( + assertValueType("array"), + assertEach( + assertNodeType("TSExpressionWithTypeArguments", "ClassImplements"), + ), + ), + optional: true, + }, decorators: { validate: chain( assertValueType("array"), @@ -203,6 +173,32 @@ defineType("ClassExpression", { }, }); +defineType("ClassDeclaration", { + inherits: "ClassExpression", + aliases: ["Scopable", "Class", "Statement", "Declaration", "Pureish"], + fields: { + declare: { + validate: assertValueType("boolean"), + optional: true, + }, + abstract: { + validate: assertValueType("boolean"), + optional: true, + }, + }, + validate: (function() { + const identifier = assertNodeType("Identifier"); + + return function(parent, key, node) { + if (!process.env.BABEL_TYPES_8_BREAKING) return; + + if (!is("ExportDefaultDeclaration", parent)) { + identifier(node, "id", node.id); + } + }; + })(), +}); + defineType("ExportAllDeclaration", { visitor: ["source"], aliases: [ @@ -248,18 +244,53 @@ defineType("ExportNamedDeclaration", { ], fields: { declaration: { - validate: assertNodeType("Declaration"), optional: true, + validate: chain( + assertNodeType("Declaration"), + function(node, key, val) { + if (!process.env.BABEL_TYPES_8_BREAKING) return; + + // This validator isn't put at the top level because we can run it + // even if this node doesn't have a parent. + + if (val && node.specifiers.length) { + throw new TypeError( + "Only declaration or specifiers is allowed on ExportNamedDeclaration", + ); + } + }, + function(node, key, val) { + if (!process.env.BABEL_TYPES_8_BREAKING) return; + + // This validator isn't put at the top level because we can run it + // even if this node doesn't have a parent. + + if (val && node.source) { + throw new TypeError("Cannot export a declaration from a source"); + } + }, + ), }, specifiers: { + default: [], validate: chain( assertValueType("array"), assertEach( - assertNodeType( - "ExportSpecifier", - "ExportDefaultSpecifier", - "ExportNamespaceSpecifier", - ), + (function() { + const sourced = assertNodeType( + "ExportSpecifier", + "ExportDefaultSpecifier", + "ExportNamespaceSpecifier", + ); + const sourceless = assertNodeType("ExportSpecifier"); + + if (!process.env.BABEL_TYPES_8_BREAKING) return sourced; + + return function(node, key, val) { + const validator = node.source ? sourced : sourceless; + validator(node, key, val); + }; + })(), ), ), }, @@ -286,6 +317,7 @@ defineType("ExportSpecifier", { defineType("ForOfStatement", { visitor: ["left", "right", "body"], + builder: ["left", "right", "body", "await"], aliases: [ "Scopable", "Statement", @@ -296,7 +328,27 @@ defineType("ForOfStatement", { ], fields: { left: { - validate: assertNodeType("VariableDeclaration", "LVal"), + validate: (function() { + if (!process.env.BABEL_TYPES_8_BREAKING) { + return assertNodeType("VariableDeclaration", "LVal"); + } + + const declaration = assertNodeType("VariableDeclaration"); + const lval = assertNodeType( + "Identifier", + "MemberExpression", + "ArrayPattern", + "ObjectPattern", + ); + + return function(node, key, val) { + if (is("VariableDeclaration", val)) { + declaration(node, key, val); + } else { + lval(node, key, val); + } + }; + })(), }, right: { validate: assertNodeType("Expression"), @@ -306,7 +358,6 @@ defineType("ForOfStatement", { }, await: { default: false, - validate: assertValueType("boolean"), }, }, }); @@ -380,9 +431,26 @@ defineType("MetaProperty", { visitor: ["meta", "property"], aliases: ["Expression"], fields: { - // todo: limit to new.target meta: { - validate: assertNodeType("Identifier"), + validate: chain(assertNodeType("Identifier"), function(node, key, val) { + if (!process.env.BABEL_TYPES_8_BREAKING) return; + + let property; + switch (val.name) { + case "function": + property = "sent"; + break; + case "new": + property = "target"; + break; + case "import": + property = "meta"; + break; + } + if (!is("Identifier", node.property, { name: property })) { + throw new TypeError("Unrecognised MetaProperty"); + } + }), }, property: { validate: assertNodeType("Identifier"), @@ -396,19 +464,14 @@ export const classMethodOrPropertyCommon = { optional: true, }, accessibility: { - validate: chain( - assertValueType("string"), - assertOneOf("public", "private", "protected"), - ), + validate: assertOneOf("public", "private", "protected"), optional: true, }, static: { default: false, - validate: assertValueType("boolean"), }, computed: { default: false, - validate: assertValueType("boolean"), }, optional: { validate: assertValueType("boolean"), @@ -443,10 +506,7 @@ export const classMethodOrDeclareMethodCommon = { ...functionCommon, ...classMethodOrPropertyCommon, kind: { - validate: chain( - assertValueType("string"), - assertOneOf("get", "set", "method", "constructor"), - ), + validate: assertOneOf("get", "set", "method", "constructor"), default: "method", }, access: { @@ -467,7 +527,16 @@ export const classMethodOrDeclareMethodCommon = { defineType("ClassMethod", { aliases: ["Function", "Scopable", "BlockParent", "FunctionParent", "Method"], - builder: ["kind", "key", "params", "body", "computed", "static"], + builder: [ + "kind", + "key", + "params", + "body", + "computed", + "static", + "generator", + "async", + ], visitor: [ "key", "params", @@ -554,7 +623,6 @@ defineType("TemplateElement", { }), }, tail: { - validate: assertValueType("boolean"), default: false, }, }, @@ -574,6 +642,16 @@ defineType("TemplateLiteral", { validate: chain( assertValueType("array"), assertEach(assertNodeType("Expression")), + function(node, key, val) { + if (node.quasis.length !== val.length + 1) { + throw new TypeError( + `Number of ${ + node.type + } quasis should be exactly one more than the number of expressions.\nExpected ${val.length + + 1} quasis but got ${node.quasis.length}`, + ); + } + }, ), }, }, @@ -585,7 +663,15 @@ defineType("YieldExpression", { aliases: ["Expression", "Terminatorless"], fields: { delegate: { - validate: assertValueType("boolean"), + validate: chain(assertValueType("boolean"), function(node, key, val) { + if (!process.env.BABEL_TYPES_8_BREAKING) return; + + if (val && !node.argument) { + throw new TypeError( + "Property delegate of YieldExpression cannot be true if there is no argument", + ); + } + }), default: false, }, argument: { diff --git a/packages/babel-types/src/definitions/experimental.js b/packages/babel-types/src/definitions/experimental.js index 32481fffd31b..a77350105a5b 100644 --- a/packages/babel-types/src/definitions/experimental.js +++ b/packages/babel-types/src/definitions/experimental.js @@ -26,9 +26,16 @@ defineType("AwaitExpression", { defineType("BindExpression", { visitor: ["object", "callee"], aliases: ["Expression"], - fields: { - // todo - }, + fields: !process.env.BABEL_TYPES_8_BREAKING + ? {} + : { + object: { + validate: assertNodeType("Expression"), + }, + callee: { + validate: assertNodeType("Expression"), + }, + }, }); defineType("ClassProperty", { @@ -67,6 +74,10 @@ defineType("ClassProperty", { validate: assertValueType("boolean"), optional: true, }, + declare: { + validate: assertValueType("boolean"), + optional: true, + }, }, }); @@ -153,8 +164,8 @@ defineType("OptionalCallExpression", { }); defineType("ClassPrivateProperty", { - visitor: ["key", "value"], - builder: ["key", "value"], + visitor: ["key", "value", "decorators"], + builder: ["key", "value", "decorators"], aliases: ["Property", "Private"], fields: { key: { @@ -164,6 +175,13 @@ defineType("ClassPrivateProperty", { validate: assertNodeType("Expression"), optional: true, }, + decorators: { + validate: chain( + assertValueType("array"), + assertEach(assertNodeType("Decorator")), + ), + optional: true, + }, }, }); diff --git a/packages/babel-types/src/definitions/flow.js b/packages/babel-types/src/definitions/flow.js index 75f6c8801966..e04d16886d07 100644 --- a/packages/babel-types/src/definitions/flow.js +++ b/packages/babel-types/src/definitions/flow.js @@ -4,6 +4,7 @@ import defineType, { assertOneOf, assertValueType, validate, + validateArrayOfType, validateOptional, validateOptionalType, validateType, @@ -464,3 +465,88 @@ defineType("Variance", { defineType("VoidTypeAnnotation", { aliases: ["Flow", "FlowType", "FlowBaseAnnotation"], }); + +// Enums +defineType("EnumDeclaration", { + aliases: ["Declaration"], + visitor: ["id", "body"], + fields: { + id: validateType("Identifier"), + body: validateType([ + "EnumBooleanBody", + "EnumNumberBody", + "EnumStringBody", + "EnumSymbolBody", + ]), + }, +}); + +defineType("EnumBooleanBody", { + aliases: ["EnumBody"], + visitor: ["members"], + fields: { + explicit: validate(assertValueType("boolean")), + members: validateArrayOfType("EnumBooleanMember"), + }, +}); + +defineType("EnumNumberBody", { + aliases: ["EnumBody"], + visitor: ["members"], + fields: { + explicit: validate(assertValueType("boolean")), + members: validateArrayOfType("EnumNumberMember"), + }, +}); + +defineType("EnumStringBody", { + aliases: ["EnumBody"], + visitor: ["members"], + fields: { + explicit: validate(assertValueType("boolean")), + members: validateArrayOfType(["EnumStringMember", "EnumDefaultedMember"]), + }, +}); + +defineType("EnumSymbolBody", { + aliases: ["EnumBody"], + visitor: ["members"], + fields: { + members: validateArrayOfType("EnumDefaultedMember"), + }, +}); + +defineType("EnumBooleanMember", { + aliases: ["EnumMember"], + visitor: ["id"], + fields: { + id: validateType("Identifier"), + init: validateType("BooleanLiteral"), + }, +}); + +defineType("EnumNumberMember", { + aliases: ["EnumMember"], + visitor: ["id", "init"], + fields: { + id: validateType("Identifier"), + init: validateType("NumericLiteral"), + }, +}); + +defineType("EnumStringMember", { + aliases: ["EnumMember"], + visitor: ["id", "init"], + fields: { + id: validateType("Identifier"), + init: validateType("StringLiteral"), + }, +}); + +defineType("EnumDefaultedMember", { + aliases: ["EnumMember"], + visitor: ["id"], + fields: { + id: validateType("Identifier"), + }, +}); diff --git a/packages/babel-types/src/definitions/index.js b/packages/babel-types/src/definitions/index.js index d6e1763ebdf0..7341c67369a9 100644 --- a/packages/babel-types/src/definitions/index.js +++ b/packages/babel-types/src/definitions/index.js @@ -14,6 +14,7 @@ import { NODE_FIELDS, BUILDER_KEYS, DEPRECATED_KEYS, + NODE_PARENT_VALIDATIONS, } from "./utils"; import { PLACEHOLDERS, @@ -43,6 +44,7 @@ export { NODE_FIELDS, BUILDER_KEYS, DEPRECATED_KEYS, + NODE_PARENT_VALIDATIONS, PLACEHOLDERS, PLACEHOLDERS_ALIAS, PLACEHOLDERS_FLIPPED_ALIAS, diff --git a/packages/babel-types/src/definitions/jsx.js b/packages/babel-types/src/definitions/jsx.js index 776714c873f7..9b74dd52f488 100644 --- a/packages/babel-types/src/definitions/jsx.js +++ b/packages/babel-types/src/definitions/jsx.js @@ -30,7 +30,11 @@ defineType("JSXClosingElement", { aliases: ["JSX", "Immutable"], fields: { name: { - validate: assertNodeType("JSXIdentifier", "JSXMemberExpression"), + validate: assertNodeType( + "JSXIdentifier", + "JSXMemberExpression", + "JSXNamespacedName", + ), }, }, }); @@ -130,11 +134,14 @@ defineType("JSXOpeningElement", { aliases: ["JSX", "Immutable"], fields: { name: { - validate: assertNodeType("JSXIdentifier", "JSXMemberExpression"), + validate: assertNodeType( + "JSXIdentifier", + "JSXMemberExpression", + "JSXNamespacedName", + ), }, selfClosing: { default: false, - validate: assertValueType("boolean"), }, attributes: { validate: chain( diff --git a/packages/babel-types/src/definitions/misc.js b/packages/babel-types/src/definitions/misc.js index e319235b2c15..da67c68706fc 100644 --- a/packages/babel-types/src/definitions/misc.js +++ b/packages/babel-types/src/definitions/misc.js @@ -1,5 +1,9 @@ // @flow -import defineType, { assertNodeType, assertOneOf } from "./utils"; +import defineType, { + assertNodeType, + assertOneOf, + assertValueType, +} from "./utils"; import { PLACEHOLDERS } from "./placeholders"; defineType("Noop", { @@ -19,3 +23,12 @@ defineType("Placeholder", { }, }, }); + +defineType("V8IntrinsicIdentifier", { + builder: ["name"], + fields: { + name: { + validate: assertValueType("string"), + }, + }, +}); diff --git a/packages/babel-types/src/definitions/typescript.js b/packages/babel-types/src/definitions/typescript.js index 843f2408ecc9..608ea8ab2207 100644 --- a/packages/babel-types/src/definitions/typescript.js +++ b/packages/babel-types/src/definitions/typescript.js @@ -128,16 +128,17 @@ defineType("TSIndexSignature", { const tsKeywordTypes = [ "TSAnyKeyword", - "TSUnknownKeyword", + "TSBooleanKeyword", + "TSBigIntKeyword", + "TSNeverKeyword", + "TSNullKeyword", "TSNumberKeyword", "TSObjectKeyword", - "TSBooleanKeyword", "TSStringKeyword", "TSSymbolKeyword", - "TSVoidKeyword", "TSUndefinedKeyword", - "TSNullKeyword", - "TSNeverKeyword", + "TSUnknownKeyword", + "TSVoidKeyword", ]; for (const type of tsKeywordTypes) { @@ -175,9 +176,11 @@ defineType("TSTypeReference", { defineType("TSTypePredicate", { aliases: ["TSType"], visitor: ["parameterName", "typeAnnotation"], + builder: ["parameterName", "typeAnnotation", "asserts"], fields: { parameterName: validateType(["Identifier", "TSThisType"]), - typeAnnotation: validateType("TSTypeAnnotation"), + typeAnnotation: validateOptionalType("TSTypeAnnotation"), + asserts: validateOptional(bool), }, }); @@ -494,6 +497,7 @@ defineType("TSTypeParameterDeclaration", { }); defineType("TSTypeParameter", { + builder: ["constraint", "default", "name"], visitor: ["constraint", "default"], fields: { name: { diff --git a/packages/babel-types/src/definitions/utils.js b/packages/babel-types/src/definitions/utils.js index 3f7225bd50b2..cc3a347cca4a 100644 --- a/packages/babel-types/src/definitions/utils.js +++ b/packages/babel-types/src/definitions/utils.js @@ -1,6 +1,6 @@ // @flow import is from "../validators/is"; -import { validateField } from "../validators/validate"; +import { validateField, validateChild } from "../validators/validate"; export const VISITOR_KEYS: { [string]: Array } = {}; export const ALIAS_KEYS: { [string]: Array } = {}; @@ -8,14 +8,13 @@ export const FLIPPED_ALIAS_KEYS: { [string]: Array } = {}; export const NODE_FIELDS: { [string]: {} } = {}; export const BUILDER_KEYS: { [string]: Array } = {}; export const DEPRECATED_KEYS: { [string]: string } = {}; +export const NODE_PARENT_VALIDATIONS = {}; function getType(val) { if (Array.isArray(val)) { return "array"; } else if (val === null) { return "null"; - } else if (val === undefined) { - return "undefined"; } else { return typeof val; } @@ -71,7 +70,10 @@ export function assertEach(callback: Validator): Validator { if (!Array.isArray(val)) return; for (let i = 0; i < val.length; i++) { - callback(node, `${key}[${i}]`, val[i]); + const subkey = `${key}[${i}]`; + const v = val[i]; + callback(node, subkey, v); + if (process.env.BABEL_TYPES_8_BREAKING) validateChild(node, subkey, v); } } validator.each = callback; @@ -96,23 +98,20 @@ export function assertOneOf(...values: Array): Validator { export function assertNodeType(...types: Array): Validator { function validate(node, key, val) { - let valid = false; - for (const type of types) { if (is(type, val)) { - valid = true; - break; + validateChild(node, key, val); + return; } } - if (!valid) { - throw new TypeError( - `Property ${key} of ${ - node.type - } expected node to be of a type ${JSON.stringify(types)} ` + - `but instead got ${JSON.stringify(val && val.type)}`, - ); - } + throw new TypeError( + `Property ${key} of ${ + node.type + } expected node to be of a type ${JSON.stringify( + types, + )} but instead got ${JSON.stringify(val && val.type)}`, + ); } validate.oneOfNodeTypes = types; @@ -122,23 +121,20 @@ export function assertNodeType(...types: Array): Validator { export function assertNodeOrValueType(...types: Array): Validator { function validate(node, key, val) { - let valid = false; - for (const type of types) { if (getType(val) === type || is(type, val)) { - valid = true; - break; + validateChild(node, key, val); + return; } } - if (!valid) { - throw new TypeError( - `Property ${key} of ${ - node.type - } expected node to be of a type ${JSON.stringify(types)} ` + - `but instead got ${JSON.stringify(val && val.type)}`, - ); - } + throw new TypeError( + `Property ${key} of ${ + node.type + } expected node to be of a type ${JSON.stringify( + types, + )} but instead got ${JSON.stringify(val && val.type)}`, + ); } validate.oneOfNodeOrValueTypes = types; @@ -200,6 +196,17 @@ export function chain(...fns: Array): Validator { return validate; } +const validTypeOpts = [ + "aliases", + "builder", + "deprecatedAlias", + "fields", + "inherits", + "visitor", + "validate", +]; +const validFieldKeys = ["default", "optional", "validate"]; + export default function defineType( type: string, opts: { @@ -211,16 +218,38 @@ export default function defineType( builder?: Array, inherits?: string, deprecatedAlias?: string, + validate?: Validator, } = {}, ) { const inherits = (opts.inherits && store[opts.inherits]) || {}; - const fields: Object = opts.fields || inherits.fields || {}; + let fields = opts.fields; + if (!fields) { + fields = {}; + if (inherits.fields) { + const keys = Object.getOwnPropertyNames(inherits.fields); + for (const key of (keys: Array)) { + const field = inherits.fields[key]; + fields[key] = { + default: field.default, + optional: field.optional, + validate: field.validate, + }; + } + } + } + const visitor: Array = opts.visitor || inherits.visitor || []; const aliases: Array = opts.aliases || inherits.aliases || []; const builder: Array = opts.builder || inherits.builder || opts.visitor || []; + for (const k of (Object.keys(opts): Array)) { + if (validTypeOpts.indexOf(k) === -1) { + throw new Error(`Unknown type option "${k}" on ${type}`); + } + } + if (opts.deprecatedAlias) { DEPRECATED_KEYS[opts.deprecatedAlias] = type; } @@ -233,14 +262,20 @@ export default function defineType( for (const key of Object.keys(fields)) { const field = fields[key]; - if (builder.indexOf(key) === -1) { + if (field.default !== undefined && builder.indexOf(key) === -1) { field.optional = true; } if (field.default === undefined) { field.default = null; - } else if (!field.validate) { + } else if (!field.validate && field.default != null) { field.validate = assertValueType(getType(field.default)); } + + for (const k of (Object.keys(field): Array)) { + if (validFieldKeys.indexOf(k) === -1) { + throw new Error(`Unknown field key "${k}" on ${type}.${key}`); + } + } } VISITOR_KEYS[type] = opts.visitor = visitor; @@ -252,6 +287,10 @@ export default function defineType( FLIPPED_ALIAS_KEYS[alias].push(type); }); + if (opts.validate) { + NODE_PARENT_VALIDATIONS[type] = opts.validate; + } + store[type] = opts; } diff --git a/packages/babel-types/src/index.js b/packages/babel-types/src/index.js index d3311dfc9f2f..51fd0b9846ff 100644 --- a/packages/babel-types/src/index.js +++ b/packages/babel-types/src/index.js @@ -7,13 +7,9 @@ import buildChildren from "./builders/react/buildChildren"; export { default as assertNode } from "./asserts/assertNode"; export * from "./asserts/generated"; -//builders -export { - default as createTypeAnnotationBasedOnTypeof, -} from "./builders/flow/createTypeAnnotationBasedOnTypeof"; -export { - default as createUnionTypeAnnotation, -} from "./builders/flow/createUnionTypeAnnotation"; +// builders +export { default as createTypeAnnotationBasedOnTypeof } from "./builders/flow/createTypeAnnotationBasedOnTypeof"; +export { default as createUnionTypeAnnotation } from "./builders/flow/createUnionTypeAnnotation"; export * from "./builders/generated"; // clone @@ -25,16 +21,10 @@ export { default as cloneWithoutLoc } from "./clone/cloneWithoutLoc"; // comments export { default as addComment } from "./comments/addComment"; export { default as addComments } from "./comments/addComments"; -export { - default as inheritInnerComments, -} from "./comments/inheritInnerComments"; -export { - default as inheritLeadingComments, -} from "./comments/inheritLeadingComments"; +export { default as inheritInnerComments } from "./comments/inheritInnerComments"; +export { default as inheritLeadingComments } from "./comments/inheritLeadingComments"; export { default as inheritsComments } from "./comments/inheritsComments"; -export { - default as inheritTrailingComments, -} from "./comments/inheritTrailingComments"; +export { default as inheritTrailingComments } from "./comments/inheritTrailingComments"; export { default as removeComments } from "./comments/removeComments"; // constants @@ -43,17 +33,13 @@ export * from "./constants"; // converters export { default as ensureBlock } from "./converters/ensureBlock"; -export { - default as toBindingIdentifierName, -} from "./converters/toBindingIdentifierName"; +export { default as toBindingIdentifierName } from "./converters/toBindingIdentifierName"; export { default as toBlock } from "./converters/toBlock"; export { default as toComputedKey } from "./converters/toComputedKey"; export { default as toExpression } from "./converters/toExpression"; export { default as toIdentifier } from "./converters/toIdentifier"; export { default as toKeyAlias } from "./converters/toKeyAlias"; -export { - default as toSequenceExpression, -} from "./converters/toSequenceExpression"; +export { default as toSequenceExpression } from "./converters/toSequenceExpression"; export { default as toStatement } from "./converters/toStatement"; export { default as valueToNode } from "./converters/valueToNode"; @@ -61,28 +47,16 @@ export { default as valueToNode } from "./converters/valueToNode"; export * from "./definitions"; // modifications -export { - default as appendToMemberExpression, -} from "./modifications/appendToMemberExpression"; +export { default as appendToMemberExpression } from "./modifications/appendToMemberExpression"; export { default as inherits } from "./modifications/inherits"; -export { - default as prependToMemberExpression, -} from "./modifications/prependToMemberExpression"; +export { default as prependToMemberExpression } from "./modifications/prependToMemberExpression"; export { default as removeProperties } from "./modifications/removeProperties"; -export { - default as removePropertiesDeep, -} from "./modifications/removePropertiesDeep"; -export { - default as removeTypeDuplicates, -} from "./modifications/flow/removeTypeDuplicates"; +export { default as removePropertiesDeep } from "./modifications/removePropertiesDeep"; +export { default as removeTypeDuplicates } from "./modifications/flow/removeTypeDuplicates"; // retrievers -export { - default as getBindingIdentifiers, -} from "./retrievers/getBindingIdentifiers"; -export { - default as getOuterBindingIdentifiers, -} from "./retrievers/getOuterBindingIdentifiers"; +export { default as getBindingIdentifiers } from "./retrievers/getBindingIdentifiers"; +export { default as getOuterBindingIdentifiers } from "./retrievers/getOuterBindingIdentifiers"; // traverse export { default as traverse } from "./traverse/traverse"; @@ -105,16 +79,12 @@ export { default as isReferenced } from "./validators/isReferenced"; export { default as isScope } from "./validators/isScope"; export { default as isSpecifierDefault } from "./validators/isSpecifierDefault"; export { default as isType } from "./validators/isType"; -export { - default as isValidES3Identifier, -} from "./validators/isValidES3Identifier"; +export { default as isValidES3Identifier } from "./validators/isValidES3Identifier"; export { default as isValidIdentifier } from "./validators/isValidIdentifier"; export { default as isVar } from "./validators/isVar"; export { default as matchesPattern } from "./validators/matchesPattern"; export { default as validate } from "./validators/validate"; -export { - default as buildMatchMemberExpression, -} from "./validators/buildMatchMemberExpression"; +export { default as buildMatchMemberExpression } from "./validators/buildMatchMemberExpression"; export * from "./validators/generated"; // react diff --git a/packages/babel-types/src/traverse/traverseFast.js b/packages/babel-types/src/traverse/traverseFast.js index 580628343cfb..e262c10ad47d 100644 --- a/packages/babel-types/src/traverse/traverseFast.js +++ b/packages/babel-types/src/traverse/traverseFast.js @@ -7,7 +7,7 @@ import { VISITOR_KEYS } from "../definitions"; */ export default function traverseFast( node: Object, - enter: (node: Node, opts?: Object) => void, + enter: (node: BabelNode, opts?: Object) => void, opts?: Object, ): void { if (!node) return; diff --git a/packages/babel-types/src/validators/generated/index.js b/packages/babel-types/src/validators/generated/index.js index 076495d5cb28..7c78934dfe8c 100644 --- a/packages/babel-types/src/validators/generated/index.js +++ b/packages/babel-types/src/validators/generated/index.js @@ -781,11 +781,11 @@ export function isClassBody(node: ?Object, opts?: Object): boolean { return false; } -export function isClassDeclaration(node: ?Object, opts?: Object): boolean { +export function isClassExpression(node: ?Object, opts?: Object): boolean { if (!node) return false; const nodeType = node.type; - if (nodeType === "ClassDeclaration") { + if (nodeType === "ClassExpression") { if (typeof opts === "undefined") { return true; } else { @@ -795,11 +795,11 @@ export function isClassDeclaration(node: ?Object, opts?: Object): boolean { return false; } -export function isClassExpression(node: ?Object, opts?: Object): boolean { +export function isClassDeclaration(node: ?Object, opts?: Object): boolean { if (!node) return false; const nodeType = node.type; - if (nodeType === "ClassExpression") { + if (nodeType === "ClassDeclaration") { if (typeof opts === "undefined") { return true; } else { @@ -1866,6 +1866,132 @@ export function isVoidTypeAnnotation(node: ?Object, opts?: Object): boolean { return false; } +export function isEnumDeclaration(node: ?Object, opts?: Object): boolean { + if (!node) return false; + + const nodeType = node.type; + if (nodeType === "EnumDeclaration") { + if (typeof opts === "undefined") { + return true; + } else { + return shallowEqual(node, opts); + } + } + + return false; +} +export function isEnumBooleanBody(node: ?Object, opts?: Object): boolean { + if (!node) return false; + + const nodeType = node.type; + if (nodeType === "EnumBooleanBody") { + if (typeof opts === "undefined") { + return true; + } else { + return shallowEqual(node, opts); + } + } + + return false; +} +export function isEnumNumberBody(node: ?Object, opts?: Object): boolean { + if (!node) return false; + + const nodeType = node.type; + if (nodeType === "EnumNumberBody") { + if (typeof opts === "undefined") { + return true; + } else { + return shallowEqual(node, opts); + } + } + + return false; +} +export function isEnumStringBody(node: ?Object, opts?: Object): boolean { + if (!node) return false; + + const nodeType = node.type; + if (nodeType === "EnumStringBody") { + if (typeof opts === "undefined") { + return true; + } else { + return shallowEqual(node, opts); + } + } + + return false; +} +export function isEnumSymbolBody(node: ?Object, opts?: Object): boolean { + if (!node) return false; + + const nodeType = node.type; + if (nodeType === "EnumSymbolBody") { + if (typeof opts === "undefined") { + return true; + } else { + return shallowEqual(node, opts); + } + } + + return false; +} +export function isEnumBooleanMember(node: ?Object, opts?: Object): boolean { + if (!node) return false; + + const nodeType = node.type; + if (nodeType === "EnumBooleanMember") { + if (typeof opts === "undefined") { + return true; + } else { + return shallowEqual(node, opts); + } + } + + return false; +} +export function isEnumNumberMember(node: ?Object, opts?: Object): boolean { + if (!node) return false; + + const nodeType = node.type; + if (nodeType === "EnumNumberMember") { + if (typeof opts === "undefined") { + return true; + } else { + return shallowEqual(node, opts); + } + } + + return false; +} +export function isEnumStringMember(node: ?Object, opts?: Object): boolean { + if (!node) return false; + + const nodeType = node.type; + if (nodeType === "EnumStringMember") { + if (typeof opts === "undefined") { + return true; + } else { + return shallowEqual(node, opts); + } + } + + return false; +} +export function isEnumDefaultedMember(node: ?Object, opts?: Object): boolean { + if (!node) return false; + + const nodeType = node.type; + if (nodeType === "EnumDefaultedMember") { + if (typeof opts === "undefined") { + return true; + } else { + return shallowEqual(node, opts); + } + } + + return false; +} export function isJSXAttribute(node: ?Object, opts?: Object): boolean { if (!node) return false; @@ -2107,6 +2233,20 @@ export function isPlaceholder(node: ?Object, opts?: Object): boolean { return false; } +export function isV8IntrinsicIdentifier(node: ?Object, opts?: Object): boolean { + if (!node) return false; + + const nodeType = node.type; + if (nodeType === "V8IntrinsicIdentifier") { + if (typeof opts === "undefined") { + return true; + } else { + return shallowEqual(node, opts); + } + } + + return false; +} export function isArgumentPlaceholder(node: ?Object, opts?: Object): boolean { if (!node) return false; @@ -2523,11 +2663,11 @@ export function isTSAnyKeyword(node: ?Object, opts?: Object): boolean { return false; } -export function isTSUnknownKeyword(node: ?Object, opts?: Object): boolean { +export function isTSBooleanKeyword(node: ?Object, opts?: Object): boolean { if (!node) return false; const nodeType = node.type; - if (nodeType === "TSUnknownKeyword") { + if (nodeType === "TSBooleanKeyword") { if (typeof opts === "undefined") { return true; } else { @@ -2537,11 +2677,11 @@ export function isTSUnknownKeyword(node: ?Object, opts?: Object): boolean { return false; } -export function isTSNumberKeyword(node: ?Object, opts?: Object): boolean { +export function isTSBigIntKeyword(node: ?Object, opts?: Object): boolean { if (!node) return false; const nodeType = node.type; - if (nodeType === "TSNumberKeyword") { + if (nodeType === "TSBigIntKeyword") { if (typeof opts === "undefined") { return true; } else { @@ -2551,11 +2691,11 @@ export function isTSNumberKeyword(node: ?Object, opts?: Object): boolean { return false; } -export function isTSObjectKeyword(node: ?Object, opts?: Object): boolean { +export function isTSNeverKeyword(node: ?Object, opts?: Object): boolean { if (!node) return false; const nodeType = node.type; - if (nodeType === "TSObjectKeyword") { + if (nodeType === "TSNeverKeyword") { if (typeof opts === "undefined") { return true; } else { @@ -2565,11 +2705,11 @@ export function isTSObjectKeyword(node: ?Object, opts?: Object): boolean { return false; } -export function isTSBooleanKeyword(node: ?Object, opts?: Object): boolean { +export function isTSNullKeyword(node: ?Object, opts?: Object): boolean { if (!node) return false; const nodeType = node.type; - if (nodeType === "TSBooleanKeyword") { + if (nodeType === "TSNullKeyword") { if (typeof opts === "undefined") { return true; } else { @@ -2579,11 +2719,11 @@ export function isTSBooleanKeyword(node: ?Object, opts?: Object): boolean { return false; } -export function isTSStringKeyword(node: ?Object, opts?: Object): boolean { +export function isTSNumberKeyword(node: ?Object, opts?: Object): boolean { if (!node) return false; const nodeType = node.type; - if (nodeType === "TSStringKeyword") { + if (nodeType === "TSNumberKeyword") { if (typeof opts === "undefined") { return true; } else { @@ -2593,11 +2733,11 @@ export function isTSStringKeyword(node: ?Object, opts?: Object): boolean { return false; } -export function isTSSymbolKeyword(node: ?Object, opts?: Object): boolean { +export function isTSObjectKeyword(node: ?Object, opts?: Object): boolean { if (!node) return false; const nodeType = node.type; - if (nodeType === "TSSymbolKeyword") { + if (nodeType === "TSObjectKeyword") { if (typeof opts === "undefined") { return true; } else { @@ -2607,11 +2747,25 @@ export function isTSSymbolKeyword(node: ?Object, opts?: Object): boolean { return false; } -export function isTSVoidKeyword(node: ?Object, opts?: Object): boolean { +export function isTSStringKeyword(node: ?Object, opts?: Object): boolean { if (!node) return false; const nodeType = node.type; - if (nodeType === "TSVoidKeyword") { + if (nodeType === "TSStringKeyword") { + if (typeof opts === "undefined") { + return true; + } else { + return shallowEqual(node, opts); + } + } + + return false; +} +export function isTSSymbolKeyword(node: ?Object, opts?: Object): boolean { + if (!node) return false; + + const nodeType = node.type; + if (nodeType === "TSSymbolKeyword") { if (typeof opts === "undefined") { return true; } else { @@ -2635,11 +2789,11 @@ export function isTSUndefinedKeyword(node: ?Object, opts?: Object): boolean { return false; } -export function isTSNullKeyword(node: ?Object, opts?: Object): boolean { +export function isTSUnknownKeyword(node: ?Object, opts?: Object): boolean { if (!node) return false; const nodeType = node.type; - if (nodeType === "TSNullKeyword") { + if (nodeType === "TSUnknownKeyword") { if (typeof opts === "undefined") { return true; } else { @@ -2649,11 +2803,11 @@ export function isTSNullKeyword(node: ?Object, opts?: Object): boolean { return false; } -export function isTSNeverKeyword(node: ?Object, opts?: Object): boolean { +export function isTSVoidKeyword(node: ?Object, opts?: Object): boolean { if (!node) return false; const nodeType = node.type; - if (nodeType === "TSNeverKeyword") { + if (nodeType === "TSVoidKeyword") { if (typeof opts === "undefined") { return true; } else { @@ -3345,8 +3499,8 @@ export function isScopable(node: ?Object, opts?: Object): boolean { "SwitchStatement" === nodeType || "WhileStatement" === nodeType || "ArrowFunctionExpression" === nodeType || - "ClassDeclaration" === nodeType || "ClassExpression" === nodeType || + "ClassDeclaration" === nodeType || "ForOfStatement" === nodeType || "ClassMethod" === nodeType || "ClassPrivateMethod" === nodeType || @@ -3693,8 +3847,8 @@ export function isPureish(node: ?Object, opts?: Object): boolean { "NullLiteral" === nodeType || "BooleanLiteral" === nodeType || "ArrowFunctionExpression" === nodeType || - "ClassDeclaration" === nodeType || "ClassExpression" === nodeType || + "ClassDeclaration" === nodeType || "BigIntLiteral" === nodeType || (nodeType === "Placeholder" && "StringLiteral" === node.expectedNode) ) { @@ -3733,6 +3887,7 @@ export function isDeclaration(node: ?Object, opts?: Object): boolean { "InterfaceDeclaration" === nodeType || "OpaqueType" === nodeType || "TypeAlias" === nodeType || + "EnumDeclaration" === nodeType || "TSDeclareFunction" === nodeType || "TSInterfaceDeclaration" === nodeType || "TSTypeAliasDeclaration" === nodeType || @@ -3995,8 +4150,8 @@ export function isClass(node: ?Object, opts?: Object): boolean { const nodeType = node.type; if ( nodeType === "Class" || - "ClassDeclaration" === nodeType || - "ClassExpression" === nodeType + "ClassExpression" === nodeType || + "ClassDeclaration" === nodeType ) { if (typeof opts === "undefined") { return true; @@ -4248,6 +4403,46 @@ export function isFlowPredicate(node: ?Object, opts?: Object): boolean { return false; } +export function isEnumBody(node: ?Object, opts?: Object): boolean { + if (!node) return false; + + const nodeType = node.type; + if ( + nodeType === "EnumBody" || + "EnumBooleanBody" === nodeType || + "EnumNumberBody" === nodeType || + "EnumStringBody" === nodeType || + "EnumSymbolBody" === nodeType + ) { + if (typeof opts === "undefined") { + return true; + } else { + return shallowEqual(node, opts); + } + } + + return false; +} +export function isEnumMember(node: ?Object, opts?: Object): boolean { + if (!node) return false; + + const nodeType = node.type; + if ( + nodeType === "EnumMember" || + "EnumBooleanMember" === nodeType || + "EnumNumberMember" === nodeType || + "EnumStringMember" === nodeType || + "EnumDefaultedMember" === nodeType + ) { + if (typeof opts === "undefined") { + return true; + } else { + return shallowEqual(node, opts); + } + } + + return false; +} export function isJSX(node: ?Object, opts?: Object): boolean { if (!node) return false; @@ -4326,16 +4521,17 @@ export function isTSType(node: ?Object, opts?: Object): boolean { if ( nodeType === "TSType" || "TSAnyKeyword" === nodeType || - "TSUnknownKeyword" === nodeType || + "TSBooleanKeyword" === nodeType || + "TSBigIntKeyword" === nodeType || + "TSNeverKeyword" === nodeType || + "TSNullKeyword" === nodeType || "TSNumberKeyword" === nodeType || "TSObjectKeyword" === nodeType || - "TSBooleanKeyword" === nodeType || "TSStringKeyword" === nodeType || "TSSymbolKeyword" === nodeType || - "TSVoidKeyword" === nodeType || "TSUndefinedKeyword" === nodeType || - "TSNullKeyword" === nodeType || - "TSNeverKeyword" === nodeType || + "TSUnknownKeyword" === nodeType || + "TSVoidKeyword" === nodeType || "TSThisType" === nodeType || "TSFunctionType" === nodeType || "TSConstructorType" === nodeType || diff --git a/packages/babel-types/src/validators/isPlaceholderType.js b/packages/babel-types/src/validators/isPlaceholderType.js index fa775b7ed803..fac93b274532 100644 --- a/packages/babel-types/src/validators/isPlaceholderType.js +++ b/packages/babel-types/src/validators/isPlaceholderType.js @@ -5,7 +5,7 @@ import { PLACEHOLDERS_ALIAS } from "../definitions"; * Test if a `placeholderType` is a `targetType` or if `targetType` is an alias of `placeholderType`. */ export default function isPlaceholderType( - placeholderType: ?string, + placeholderType: string, targetType: string, ): boolean { if (placeholderType === targetType) return true; diff --git a/packages/babel-types/src/validators/isScope.js b/packages/babel-types/src/validators/isScope.js index 51d6c91924ec..dfd2f5edd96f 100644 --- a/packages/babel-types/src/validators/isScope.js +++ b/packages/babel-types/src/validators/isScope.js @@ -4,6 +4,7 @@ import { isCatchClause, isBlockStatement, isScopable, + isPattern, } from "./generated"; /** @@ -18,5 +19,11 @@ export default function isScope(node: Object, parent: Object): boolean { return false; } + // If a Pattern is an immediate descendent of a Function, it must be in the params. + // Hence we skipped the parentKey === "params" check + if (isPattern(node) && isFunction(parent)) { + return true; + } + return isScopable(node); } diff --git a/packages/babel-types/src/validators/isValidIdentifier.js b/packages/babel-types/src/validators/isValidIdentifier.js index 6dbbb7c32cd0..d8aaf8c36372 100644 --- a/packages/babel-types/src/validators/isValidIdentifier.js +++ b/packages/babel-types/src/validators/isValidIdentifier.js @@ -5,16 +5,20 @@ import esutils from "esutils"; * Check if the input `name` is a valid identifier name * and isn't a reserved word. */ -export default function isValidIdentifier(name: string): boolean { - if ( - typeof name !== "string" || - esutils.keyword.isReservedWordES6(name, true) - ) { - return false; - } else if (name === "await") { - // invalid in module, valid in script; better be safe (see #4952) - return false; - } else { - return esutils.keyword.isIdentifierNameES6(name); +export default function isValidIdentifier( + name: string, + reserved: boolean = true, +): boolean { + if (typeof name !== "string") return false; + + if (reserved) { + if (esutils.keyword.isReservedWordES6(name, true)) { + return false; + } else if (name === "await") { + // invalid in module, valid in script; better be safe (see #4952) + return false; + } } + + return esutils.keyword.isIdentifierNameES6(name); } diff --git a/packages/babel-types/src/validators/validate.js b/packages/babel-types/src/validators/validate.js index 738683849927..0ec35b684a0f 100644 --- a/packages/babel-types/src/validators/validate.js +++ b/packages/babel-types/src/validators/validate.js @@ -1,5 +1,5 @@ // @flow -import { NODE_FIELDS } from "../definitions"; +import { NODE_FIELDS, NODE_PARENT_VALIDATIONS } from "../definitions"; export default function validate(node?: Object, key: string, val: any): void { if (!node) return; @@ -9,6 +9,7 @@ export default function validate(node?: Object, key: string, val: any): void { const field = fields[key]; validateField(node, key, val, field); + validateChild(node, key, val); } export function validateField( @@ -22,3 +23,10 @@ export function validateField( field.validate(node, key, val); } + +export function validateChild(node?: Object, key: string, val?: Object) { + if (val == null) return; + const validate = NODE_PARENT_VALIDATIONS[val.type]; + if (!validate) return; + validate(node, key, val); +} diff --git a/packages/babel-types/test/builders/es2015/__snapshots__/templateElement.js.snap b/packages/babel-types/test/builders/es2015/__snapshots__/templateElement.js.snap index a2f178169233..2915dd37948f 100644 --- a/packages/babel-types/test/builders/es2015/__snapshots__/templateElement.js.snap +++ b/packages/babel-types/test/builders/es2015/__snapshots__/templateElement.js.snap @@ -35,3 +35,61 @@ exports[`builders es2015 templateElement should validate 5`] = ` "Property value of TemplateElement expected to have the following: Property raw expected type of string but got undefined" `; + +exports[`builders es2015 templateLiteral should validate 1`] = ` +Object { + "expressions": Array [], + "quasis": Array [ + Object { + "tail": false, + "type": "TemplateElement", + "value": Object { + "raw": "foo", + }, + }, + ], + "type": "TemplateLiteral", +} +`; + +exports[`builders es2015 templateLiteral should validate 2`] = ` +Object { + "expressions": Array [ + Object { + "type": "StringLiteral", + "value": "baz", + }, + ], + "quasis": Array [ + Object { + "tail": false, + "type": "TemplateElement", + "value": Object { + "raw": "foo", + }, + }, + Object { + "tail": false, + "type": "TemplateElement", + "value": Object { + "raw": "bar", + }, + }, + ], + "type": "TemplateLiteral", +} +`; + +exports[`builders es2015 templateLiteral should validate 3`] = ` +"Number of TemplateLiteral quasis should be exactly one more than the number of expressions. +Expected 3 quasis but got 2" +`; + +exports[`builders es2015 templateLiteral should validate 4`] = ` +"Number of TemplateLiteral quasis should be exactly one more than the number of expressions. +Expected 1 quasis but got 2" +`; + +exports[`builders es2015 templateLiteral should validate 5`] = `"Property quasis expected type of array but got object"`; + +exports[`builders es2015 templateLiteral should validate 6`] = `"Property expressions expected type of array but got null"`; diff --git a/packages/babel-types/test/builders/es2015/templateElement.js b/packages/babel-types/test/builders/es2015/templateElement.js index 0a93e7c8662a..0e5985ae89de 100644 --- a/packages/babel-types/test/builders/es2015/templateElement.js +++ b/packages/babel-types/test/builders/es2015/templateElement.js @@ -21,5 +21,34 @@ describe("builders", function() { expect(() => t.templateElement("foo")).toThrowErrorMatchingSnapshot(); }); }); + describe("templateLiteral", function() { + it("should validate", function() { + const foo = t.templateElement({ raw: "foo" }); + const bar = t.templateElement({ raw: "bar" }); + + const baz = t.stringLiteral("baz"); + const qux = t.stringLiteral("qux"); + + expect(t.templateLiteral([foo], [])).toMatchSnapshot(); + + expect(t.templateLiteral([foo, bar], [baz])).toMatchSnapshot(); + + expect(() => + t.templateLiteral([foo, bar], [baz, qux]), + ).toThrowErrorMatchingSnapshot(); + + expect(() => + t.templateLiteral([foo, bar], []), + ).toThrowErrorMatchingSnapshot(); + + expect(() => + t.templateLiteral({}, [baz]), + ).toThrowErrorMatchingSnapshot(); + + expect(() => + t.templateLiteral([foo, bar]), + ).toThrowErrorMatchingSnapshot(); + }); + }); }); }); diff --git a/packages/babel-types/test/builders/typescript/__snapshots__/tsTypeParameter.js.snap b/packages/babel-types/test/builders/typescript/__snapshots__/tsTypeParameter.js.snap new file mode 100644 index 000000000000..51940ca2d50a --- /dev/null +++ b/packages/babel-types/test/builders/typescript/__snapshots__/tsTypeParameter.js.snap @@ -0,0 +1,24 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`builders typescript tsTypeParameter accept name as argument for tsTypeParameter 1`] = ` +Object { + "constraint": Object { + "type": "TSTypeReference", + "typeName": Object { + "name": "bar", + "type": "Identifier", + }, + "typeParameters": null, + }, + "default": Object { + "type": "TSTypeReference", + "typeName": Object { + "name": "baz", + "type": "Identifier", + }, + "typeParameters": null, + }, + "name": "foo", + "type": "TSTypeParameter", +} +`; diff --git a/packages/babel-types/test/builders/typescript/tsTypeParameter.js b/packages/babel-types/test/builders/typescript/tsTypeParameter.js new file mode 100644 index 000000000000..985d67909c2a --- /dev/null +++ b/packages/babel-types/test/builders/typescript/tsTypeParameter.js @@ -0,0 +1,24 @@ +import * as t from "../../.."; + +describe("builders", function() { + describe("typescript", function() { + describe("tsTypeParameter", function() { + it("accept name as argument for tsTypeParameter", function() { + const tsTypeParameter = t.tsTypeParameter( + t.tsTypeReference(t.identifier("bar")), + t.tsTypeReference(t.identifier("baz")), + "foo", + ); + expect(tsTypeParameter).toMatchSnapshot(); + }); + it("throws when name is missing", function() { + expect(() => { + t.tsTypeParameter( + t.tsTypeReference(t.identifier("bar")), + t.tsTypeReference(t.identifier("baz")), + ); + }).toThrow("Property name expected type of string but got null"); + }); + }); + }); +}); diff --git a/scripts/clone-license.sh b/scripts/clone-license.sh index e901ca00ba01..8c025097cbcb 100755 --- a/scripts/clone-license.sh +++ b/scripts/clone-license.sh @@ -1,3 +1,4 @@ echo "Cloning LICENSE to babel packages" cat LICENSE ls -db ./packages/*/ | egrep -v '.*packages\/(babel-parser|babel-plugin-transform-object-assign)\/?$' | xargs -n 1 cp LICENSE +ls -db ./eslint/*/ | egrep -v '.*eslint\/(babel-eslint-plugin)\/?$' | xargs -n 1 cp LICENSE diff --git a/scripts/gulp-tasks.js b/scripts/gulp-tasks.js deleted file mode 100644 index 73c1f7db2e3f..000000000000 --- a/scripts/gulp-tasks.js +++ /dev/null @@ -1,170 +0,0 @@ -"use strict"; - -/** - * This file contains the Gulp tasks for babel-standalone. Note that - * babel-standalone is compiled using Webpack, and performs its own Babel - * compilation of all the JavaScript files. This is because it targets web - * browsers, so more transforms are needed than the regular Babel builds that - * only target Node.js. - * - * The tasks in this file are designed to be reusable, so that they can be used - * to make standalone builds of other Babel plugins/presets (such as babel-minify) - */ - -const path = require("path"); -const pump = require("pump"); -const chalk = require("chalk"); -const through = require("through2"); -const fancyLog = require("fancy-log"); -const rename = require("gulp-rename"); -const webpack = require("webpack"); -const { RootMostResolvePlugin } = require("webpack-dependency-suite"); -const DuplicatePackageCheckerPlugin = require("duplicate-package-checker-webpack-plugin"); -const WarningsToErrorsPlugin = require("warnings-to-errors-webpack-plugin"); -const webpackStream = require("webpack-stream"); -const uglify = require("gulp-uglify"); - -function webpackBuild(opts) { - const plugins = opts.plugins || []; - let babelVersion = require("../packages/babel-core/package.json").version; - let version = opts.version || babelVersion; - // If this build is part of a pull request, include the pull request number in - // the version number. - if (process.env.CIRCLE_PR_NUMBER) { - const prVersion = "+pr." + process.env.CIRCLE_PR_NUMBER; - babelVersion += prVersion; - version += prVersion; - } - - const config = { - module: { - rules: [ - { - test: /\.js$/, - loader: "babel-loader", - options: { - // Use the bundled config so that module syntax is passed through - // for Webpack. - envName: "standalone", - }, - }, - ], - }, - node: { - // Mock Node.js modules that Babel require()s but that we don't - // particularly care about. - fs: "empty", - module: "empty", - net: "empty", - }, - output: { - filename: opts.filename, - library: opts.library, - libraryTarget: "umd", - }, - plugins: [ - new WarningsToErrorsPlugin(), - new DuplicatePackageCheckerPlugin({ - exclude(instance) { - return instance.name === "semver"; - }, - }), - new webpack.DefinePlugin({ - "process.env.NODE_ENV": '"production"', - "process.env": JSON.stringify({ NODE_ENV: "production" }), - BABEL_VERSION: JSON.stringify(babelVersion), - VERSION: JSON.stringify(version), - }), - /*new webpack.NormalModuleReplacementPlugin( - /..\/..\/package/, - "../../../../src/babel-package-shim" - ),*/ - new webpack.optimize.ModuleConcatenationPlugin(), - ].concat(plugins), - resolve: { - plugins: [ - // Dedupe packages that are used across multiple plugins. - // This replaces DedupePlugin from Webpack 1.x - new RootMostResolvePlugin(__dirname, true), - ], - }, - }; - - if (opts.library !== "Babel") { - config.externals = { - "@babel/standalone": "Babel", - }; - } - - return webpackStream(config, webpack); - // To write JSON for debugging: - /*return webpackStream(config, webpack, (err, stats) => { - require("fancy-log")(stats.toString({ colors: true })); - require("fs").writeFileSync( - "webpack-debug.json", - JSON.stringify(stats.toJson()) - ); - });*/ -} - -function logUglify() { - return through.obj(function(file, enc, callback) { - fancyLog( - `Minifying '${chalk.cyan( - path.relative(path.join(__dirname, ".."), file.path) - )}'...` - ); - callback(null, file); - }); -} - -function logNoUglify() { - return through.obj(function(file, enc, callback) { - fancyLog( - chalk.yellow( - `Skipped minification of '${chalk.cyan( - path.relative(path.join(__dirname, ".."), file.path) - )}' because not publishing` - ) - ); - callback(null, file); - }); -} - -function registerStandalonePackageTask( - gulp, - name, - exportName, - pathname, - version, - plugins -) { - const standaloneName = name + "-standalone"; - const standalonePath = path.join(pathname, standaloneName); - gulp.task("build-" + standaloneName, cb => { - pump( - [ - gulp.src(path.join(standalonePath, "src/index.js")), - webpackBuild({ - filename: name + ".js", - library: exportName, - version, - plugins, - }), - gulp.dest(standalonePath), - ].concat( - // Minification is super slow, so we skip it unless we are publishing - process.env.IS_PUBLISH ? logUglify() : logNoUglify(), - process.env.IS_PUBLISH ? uglify() : [], - rename({ extname: ".min.js" }), - gulp.dest(standalonePath) - ), - cb - ); - }); -} - -module.exports = { - webpackBuild: webpackBuild, - registerStandalonePackageTask: registerStandalonePackageTask, -}; diff --git a/scripts/integration-tests/e2e-babel.sh b/scripts/integration-tests/e2e-babel.sh new file mode 100755 index 000000000000..f73b75f95bd5 --- /dev/null +++ b/scripts/integration-tests/e2e-babel.sh @@ -0,0 +1,29 @@ +#!/bin/bash + +#==============================================================================# +# SETUP # +#==============================================================================# + +# Start in scripts/integration-tests/ even if run from root directory +cd "$(dirname "$0")" || exit + +source utils/local-registry.sh +source utils/cleanup.sh + +# Echo every command being executed +set -x + +# Go to the root of the monorepo +cd ../.. + +#==============================================================================# +# TEST # +#==============================================================================# + +startLocalRegistry "$PWD"/scripts/integration-tests/verdaccio-config.yml +yarn upgrade --scope @babel + +# Test +make test-ci + +cleanup diff --git a/scripts/integration-tests/e2e-create-react-app.sh b/scripts/integration-tests/e2e-create-react-app.sh new file mode 100755 index 000000000000..1c956f240cee --- /dev/null +++ b/scripts/integration-tests/e2e-create-react-app.sh @@ -0,0 +1,33 @@ +#!/bin/bash + +#==============================================================================# +# SETUP # +#==============================================================================# + +# Start in scripts/integration-tests/ even if run from root directory +cd "$(dirname "$0")" || exit + +source utils/local-registry.sh +source utils/cleanup.sh + +# Echo every command being executed +set -x + +# Clone create-react-app +git clone --depth=1 https://github.com/facebook/create-react-app.git tmp/create-react-app +cd tmp/create-react-app || exit + +#==============================================================================# +# TEST # +#==============================================================================# + +startLocalRegistry "$PWD"/../../verdaccio-config.yml +yarn install +# "yarn upgrade --scope @babel --latest" doesn't seem to work. +# a means "all", while \n is the enter needed to confirm the selection. +printf "a\n" | yarn upgrade-interactive --scope @babel --latest + +# Test +CI=true yarn test + +cleanup diff --git a/scripts/integration-tests/e2e-vue-cli.sh b/scripts/integration-tests/e2e-vue-cli.sh new file mode 100755 index 000000000000..018f7fb13287 --- /dev/null +++ b/scripts/integration-tests/e2e-vue-cli.sh @@ -0,0 +1,35 @@ +#!/bin/bash + +#==============================================================================# +# SETUP # +#==============================================================================# + +# Start in scripts/integration-tests/ even if run from root directory +cd "$(dirname "$0")" || exit + +source utils/local-registry.sh +source utils/cleanup.sh + +# Echo every command being executed +set -x + +# Clone vue-cli +git clone --depth=1 https://github.com/vuejs/vue-cli tmp/vue-cli +cd tmp/vue-cli || exit + +#==============================================================================# +# TEST # +#==============================================================================# + +startLocalRegistry "$PWD"/../../verdaccio-config.yml +yarn install +# Workaround https://github.com/yarnpkg/yarn/issues/7797 +yarn add --dev -W @babel/core +# "yarn upgrade --scope @babel --latest" doesn't seem to work. +# a means "all", while \n is the enter needed to confirm the selection. +printf "a\n" | yarn upgrade-interactive --scope @babel --latest + +# Test +CI=true yarn test -p babel,babel-preset-app + +cleanup diff --git a/scripts/integration-tests/publish-local.sh b/scripts/integration-tests/publish-local.sh new file mode 100755 index 000000000000..c2e16da37517 --- /dev/null +++ b/scripts/integration-tests/publish-local.sh @@ -0,0 +1,45 @@ +#!/bin/bash + +#==============================================================================# +# SETUP # +#==============================================================================# + +# Start in scripts/integration-tests/ even if run from root directory +cd "$(dirname "$0")" + +source utils/local-registry.sh +source utils/git.sh +source utils/cleanup.sh + +function publishESLintPkg { + cd eslint/$1 + yarn version --patch --no-git-tag-version + cd ../.. + make -j publish-eslint PKG=$1 +} + +# Echo every command being executed +set -x + +# Go to the root of the monorepo +cd ../.. + +initializeE2Egit + +#==============================================================================# +# PUBLISH # +#==============================================================================# + +make -j bootstrap-only + +startLocalRegistry "$PWD"/scripts/integration-tests/verdaccio-config.yml +loginLocalRegistry + +I_AM_USING_VERDACCIO=I_AM_SURE make publish-test + +publishESLintPkg babel-eslint-config-internal +publishESLintPkg babel-eslint-parser +publishESLintPkg babel-eslint-plugin +publishESLintPkg babel-eslint-plugin-development + +cleanup diff --git a/scripts/integration-tests/utils/cleanup.sh b/scripts/integration-tests/utils/cleanup.sh new file mode 100755 index 000000000000..0a578b79fdc7 --- /dev/null +++ b/scripts/integration-tests/utils/cleanup.sh @@ -0,0 +1,30 @@ +#!/bin/bash + +function cleanup { + echo "Cleaning up." + stopLocalRegistry + + if [ -n "$GIT_E2E_SETUP" ]; then + cleanupE2Egit + fi +} + +# Error messages are redirected to stderr +function handle_error { + echo "$(basename $0): ERROR! An error was encountered executing line $1." 1>&2; + cleanup + echo "Exiting with error." 1>&2; + exit 1 +} + +function handle_exit { + cleanup + echo "Exiting without error." 1>&2; + exit +} + +# Exit the script with a helpful error message when any error is encountered +trap 'set +x; handle_error $LINENO $BASH_COMMAND' ERR + +# Cleanup before exit on any termination signal +trap 'set +x; handle_exit' SIGQUIT SIGTERM SIGINT SIGKILL SIGHUP diff --git a/scripts/integration-tests/utils/git.sh b/scripts/integration-tests/utils/git.sh new file mode 100755 index 000000000000..2cce5ee99077 --- /dev/null +++ b/scripts/integration-tests/utils/git.sh @@ -0,0 +1,29 @@ +#!/bin/bash + +original_git_branch=`git rev-parse --abbrev-ref HEAD` +tmp_branch_name="integration-tests-$(date +'%F-%H-%M-%N')" +original_user_name=`git config user.name` +original_user_email=`git config user.email` + +export GIT_E2E_SETUP="true" + +function initializeE2Egit { + git checkout -b $tmp_branch_name + + # This is needed by lerna, which commits when publishing + git config user.name "Babel E2E Test" + git config user.email "babel-e2e@example.com" +} + +function cleanupE2Egit { + # Delete release tags + git tag -d $(git tag -l "version-e2e-test-*") + + # Checkout the previous branch + git checkout -f $original_git_branch + git branch -D $tmp_branch_name + + # Restore git user + git config user.name "$original_user_name" + git config user.email "$original_user_email" +} diff --git a/scripts/integration-tests/utils/local-registry.sh b/scripts/integration-tests/utils/local-registry.sh new file mode 100755 index 000000000000..e0212d2529b3 --- /dev/null +++ b/scripts/integration-tests/utils/local-registry.sh @@ -0,0 +1,34 @@ +#!/bin/bash + +# Copied from https://github.com/facebook/create-react-app/blob/053f9774d3f592c17741d2a86de66a7ca58f90c0/tasks/local-registry.sh + +custom_registry_url=http://localhost:4873 +original_npm_registry_url=`npm get registry` +original_yarn_registry_url=`yarn config get registry` +default_verdaccio_package=verdaccio@~4.3.3 + +function startLocalRegistry { + # Start local registry + tmp_registry_log=`mktemp` + echo "Registry output file: $tmp_registry_log" + (cd && nohup npx ${VERDACCIO_PACKAGE:-$default_verdaccio_package} -c $1 &>$tmp_registry_log &) + + # Wait for Verdaccio to boot + grep -q "http address" <(tail -f $tmp_registry_log) + + # Set registry to local registry + npm set registry "$custom_registry_url" + yarn config set registry "$custom_registry_url" +} + +function loginLocalRegistry { + # Login so we can publish packages + (cd && npx npm-auth-to-token@1.0.0 -u user -p password -e user@example.com -r "$custom_registry_url") +} + +function stopLocalRegistry { + # Restore the original NPM and Yarn registry URLs and stop Verdaccio + fuser -k 4873/tcp + npm set registry "$original_npm_registry_url" + yarn config set registry "$original_yarn_registry_url" +} diff --git a/scripts/integration-tests/verdaccio-config.yml b/scripts/integration-tests/verdaccio-config.yml new file mode 100755 index 000000000000..69d210aa3933 --- /dev/null +++ b/scripts/integration-tests/verdaccio-config.yml @@ -0,0 +1,61 @@ +# +# This is the default config file. It allows all users to do anything, +# so don't use it on production systems. +# +# Look here for more config file examples: +# https://github.com/verdaccio/verdaccio/tree/master/conf +# + +# path to a directory with all packages +storage: /tmp/verdaccio-workspace/storage + +auth: + htpasswd: + file: /tmp/verdaccio-workspace/htpasswd + # Maximum amount of users allowed to register, defaults to "+inf". + # You can set this to -1 to disable registration. + # max_users: 1000 + +# a list of other known repositories we can talk to +uplinks: + npmjs: + url: https://registry.npmjs.org/ + +packages: + '@*/*': + # scoped packages + access: $all + publish: $all + unpublish: $all + proxy: npmjs + + '**': + # allow all users (including non-authenticated users) to read and + # publish all packages + # + # you can specify usernames/groupnames (depending on your auth plugin) + # and three keywords: "$all", "$anonymous", "$authenticated" + access: $all + publish: $all + unpublish: $all + + # if package is not available locally, proxy requests to 'npmjs' registry + proxy: npmjs + +# You can specify HTTP/1.1 server keep alive timeout in seconds for incoming connections. +# A value of 0 makes the http server behave similarly to Node.js versions prior to 8.0.0, which did not have a keep-alive timeout. +# WORKAROUND: Through given configuration you can workaround following issue https://github.com/verdaccio/verdaccio/issues/301. Set to 0 in case 60 is not enough. +server: + keepAliveTimeout: 60 + +middlewares: + audit: + enabled: true + +# log settings +logs: + - { type: stdout, format: pretty, level: http } + #- {type: file, path: verdaccio.log, level: info} +#experiments: +# # support for npm token command +# token: false diff --git a/scripts/lint-ts-typings.sh b/scripts/lint-ts-typings.sh new file mode 100755 index 000000000000..1e308cd44ce8 --- /dev/null +++ b/scripts/lint-ts-typings.sh @@ -0,0 +1,6 @@ +#!/bin/bash +set -e + +tsFlags="--strict" + +yarn --silent tsc $tsFlags ./packages/babel-types/lib/index.d.ts diff --git a/scripts/parser-tests/flow/index.js b/scripts/parser-tests/flow/index.js new file mode 100644 index 000000000000..1a18471ded03 --- /dev/null +++ b/scripts/parser-tests/flow/index.js @@ -0,0 +1,136 @@ +const fs = require("fs").promises; +const path = require("path"); +const merge = require("mergeiterator"); +const TestRunner = require("../utils/parser-test-runner"); + +const flowOptionsMapping = { + esproposal_class_instance_fields: "classProperties", + esproposal_class_static_fields: "classProperties", + esproposal_export_star_as: "exportNamespaceFrom", + esproposal_decorators: "decorators-legacy", + esproposal_nullish_coalescing: "nullishCoalescingOperator", + esproposal_optional_chaining: "optionalChaining", + types: "flowComments", + intern_comments: false, +}; + +function getPlugins(test) { + const flowOptions = { all: true }; + + const plugins = [ + "dynamicImport", + ["flow", flowOptions], + "flowComments", + "jsx", + "classProperties", + "classPrivateProperties", + "classPrivateMethods", + "bigInt", + "numericSeparator", + ]; + + if (!test.options) return plugins; + + for (const [option, enabled] of Object.entries(test.options)) { + if (!enabled) { + const idx = plugins.indexOf(flowOptionsMapping[option]); + if (idx !== -1) plugins.splice(idx, 1); + } else if (option === "enums") { + flowOptions.enums = true; + } else if (!(option in flowOptionsMapping)) { + throw new Error("Parser options not mapped " + option); + } else if (flowOptionsMapping[option]) { + plugins.push(flowOptionsMapping[option]); + } + } + + return plugins; +} + +async function* readdirRecursive(root, dir = ".") { + const names = await fs.readdir(path.join(root, dir)); + + const dirs = []; + + for (const name of names) { + const file = path.join(dir, name); + const stats = await fs.stat(path.join(root, file)); + if (!stats.isDirectory()) { + if (!file) continue; + yield file; + } else { + dirs.push(readdirRecursive(root, file)); + } + } + + yield* merge(dirs); +} + +async function* loadTests(root) { + for await (const file of readdirRecursive(root)) { + if (file.slice(-3) === ".js") { + const noExt = path.join(root, file).slice(0, -3); + + const [contents, tree, options] = await Promise.all([ + fs.readFile(noExt + ".js", "utf8"), + fs.readFile(noExt + ".tree.json", "utf8").catch(() => null), + fs.readFile(noExt + ".options.json", "utf8").catch(() => null), + ]); + + yield { + file, + contents, + tree: JSON.parse(tree), + options: JSON.parse(options), + }; + } + } +} + +const runner = new TestRunner({ + testDir: path.join(__dirname, "../../../build/flow/src/parser/test/flow"), + whitelist: path.join(__dirname, "whitelist.txt"), + shouldUpdate: process.argv.includes("--update-whitelist"), + + async *getTests() { + for await (const test of loadTests(this.testDir)) { + const shouldSuccess = + test.tree && (!test.tree.errors || !test.tree.errors.length); + + yield { + contents: test.contents, + fileName: test.file, + id: test.file, + expectedError: !shouldSuccess, + plugins: getPlugins(test), + }; + } + }, + + parse(test, parser) { + try { + parser(test.contents, { + sourceType: "module", + plugins: test.plugins, + }); + } catch (e) { + // lets retry in script mode + if (!test.expectedError) { + try { + parser(test.contents, { + sourceType: "script", + plugins: test.plugins, + }); + return; + } catch {} + } + + throw e; + } + }, +}); + +runner.run().catch(err => { + console.error(err); + process.exitCode = 1; +}); diff --git a/scripts/parser-tests/flow/whitelist.txt b/scripts/parser-tests/flow/whitelist.txt new file mode 100644 index 000000000000..b2f98acd0b89 --- /dev/null +++ b/scripts/parser-tests/flow/whitelist.txt @@ -0,0 +1,21 @@ +ES6/modules/export_default_class_implements.js +ES6/modules/migrated_0020.js +JSX/invalid_unpaired_gt.js +JSX/invalid_unpaired_rcurly.js +JSX_invalid/migrated_0000.js +arrow_function/object_return_type.js +arrow_function_invalid/migrated_0002.js +async_await/migrated_0020.js +async_await/migrated_0024.js +async_await/migrated_0027.js +async_generators/migrated_0007.js +class_expression/anonymous_implements.js +class_method_kinds/polymorphic_getter.js +class_properties/migrated_0021.js +class_properties/migrated_0026.js +decorators/migrated_0003.js +export_import_reserved_words/migrated_0003.js +export_statements/export_trailing_comma.js +nullish_coalescing/missing-plugin.js +optional_chaining/missing-plugin.js +types/member/reserved_words.js diff --git a/scripts/parser-tests/test262/index.js b/scripts/parser-tests/test262/index.js new file mode 100644 index 000000000000..e2f8b08fcae0 --- /dev/null +++ b/scripts/parser-tests/test262/index.js @@ -0,0 +1,198 @@ +const path = require("path"); +const TestStream = require("test262-stream"); +const TestRunner = require("../utils/parser-test-runner"); + +const ignoredFeatures = [ + "AggregateError", + "Array.prototype.flat", + "Array.prototype.flatMap", + "Array.prototype.values", + "ArrayBuffer", + "async-functions", + "async-iteration", + "arrow-function", + "Atomics", + "caller", + "class", + "computed-property-names", + "const", + "cross-realm", + "DataView", + "DataView.prototype.getFloat32", + "DataView.prototype.getFloat64", + "DataView.prototype.getInt8", + "DataView.prototype.getInt16", + "DataView.prototype.getInt32", + "DataView.prototype.getUint16", + "DataView.prototype.getUint32", + "DataView.prototype.setUint8", + "default-parameters", + "destructuring-assignment", + "destructuring-binding", + "FinalizationGroup", + "Float32Array", + "Float64Array", + "for-in-order", + "for-of", + "generators", + "globalThis", + "hashbang", + "host-gc-required", + "Int8Array", + "Int32Array", + "Intl.DateTimeFormat-datetimestyle", + "Intl.DateTimeFormat-dayPeriod", + "Intl.DateTimeFormat-fractionalSecondDigits", + "Intl.DateTimeFormat-formatRange", + "Intl.DisplayNames", + "Intl.ListFormat", + "Intl.Locale", + "Intl.NumberFormat-unified", + "Intl.RelativeTimeFormat", + "Intl.Segmenter", + "IsHTMLDDA", + "json-superset", + "let", + "Map", + "new.target", + "Object.fromEntries", + "Object.is", + "object-rest", + "object-spread", + "optional-catch-binding", + "Promise.allSettled", + "Promise.prototype.finally", + "Proxy", + "proxy-missing-checks", + "Reflect", + "Reflect.construct", + "Reflect.set", + "Reflect.setPrototypeOf", + "regexp-dotall", + "regexp-lookbehind", + "regexp-named-groups", + "regexp-unicode-property-escapes", + "rest-parameters", + "SharedArrayBuffer", + "Set", + "String.fromCodePoint", + "String.prototype.endsWith", + "String.prototype.includes", + "String.prototype.matchAll", + "String.prototype.replaceAll", + "String.prototype.trimEnd", + "String.prototype.trimStart", + "string-trimming", + "super", + "Symbol", + "Symbol.asyncIterator", + "Symbol.hasInstance", + "Symbol.isConcatSpreadable", + "Symbol.iterator", + "Symbol.match", + "Symbol.matchAll", + "Symbol.prototype.description", + "Symbol.replace", + "Symbol.search", + "Symbol.split", + "Symbol.species", + "Symbol.toPrimitive", + "Symbol.toStringTag", + "Symbol.unscopables", + "tail-call-optimization", + "template", + "TypedArray", + "u180e", + "Uint8Array", + "Uint8ClampedArray", + "Uint16Array", + "WeakMap", + "WeakSet", + "WeakRef", + "well-formed-json-stringify", +]; + +const ignoredTests = ["built-ins/RegExp/", "language/literals/regexp/"]; + +const featuresToPlugins = { + BigInt: "bigInt", + "class-fields-private": "classPrivateProperties", + "class-fields-public": "classProperties", + "class-methods-private": "classPrivateMethods", + "class-static-fields-public": "classProperties", + "class-static-fields-private": "classPrivateProperties", + "class-static-methods-private": "classPrivateMethods", + "coalesce-expression": "nullishCoalescingOperator", + "dynamic-import": "dynamicImport", + "export-star-as-namespace-from-module": "exportNamespaceFrom", + "import.meta": "importMeta", + "numeric-separator-literal": "numericSeparator", + "optional-chaining": "optionalChaining", + "top-level-await": "topLevelAwait", +}; + +const unmappedFeatures = new Set(); + +function* getPlugins(features) { + if (!features) return; + + for (const f of features) { + if (featuresToPlugins[f]) { + yield featuresToPlugins[f]; + } else if (!ignoredFeatures.includes(f)) { + unmappedFeatures.add(f); + } + } +} + +const runner = new TestRunner({ + testDir: path.join(__dirname, "../../../build/test262"), + whitelist: path.join(__dirname, "whitelist.txt"), + logInterval: 500, + shouldUpdate: process.argv.includes("--update-whitelist"), + + async *getTests() { + const stream = new TestStream(this.testDir, { + omitRuntime: true, + }); + + for await (const test of stream) { + // strip test/ + const fileName = test.file.substr(5); + + if (ignoredTests.some(start => fileName.startsWith(start))) continue; + + yield { + contents: test.contents, + fileName, + id: `${fileName}(${test.scenario})`, + sourceType: test.attrs.flags.module ? "module" : "script", + plugins: Array.from(getPlugins(test.attrs.features)), + expectedError: + !!test.attrs.negative && + (test.attrs.negative.phase === "parse" || + test.attrs.negative.phase === "early"), + }; + } + }, +}); + +runner + .run() + .then(() => { + if (unmappedFeatures.size) { + console.log(""); + console.log( + "The following Features are not currently mapped or ignored:" + ); + console.log( + Array.from(unmappedFeatures) + .join("\n") + .replace(/^/gm, " ") + ); + } + }) + .catch(err => { + console.error(err); + process.exitCode = 1; + }); diff --git a/scripts/parser-tests/test262/whitelist.txt b/scripts/parser-tests/test262/whitelist.txt new file mode 100644 index 000000000000..8b137891791f --- /dev/null +++ b/scripts/parser-tests/test262/whitelist.txt @@ -0,0 +1 @@ + diff --git a/scripts/parser-tests/typescript/error-codes.js b/scripts/parser-tests/typescript/error-codes.js new file mode 100644 index 000000000000..2a2580dfb8a2 --- /dev/null +++ b/scripts/parser-tests/typescript/error-codes.js @@ -0,0 +1,71 @@ +/* +This file includes the code of TS Diagnostics error that should also be thrown from babel-parser. +The TypeScript parser is highly tolerant on errors so these error would not produce parseDiagnostics which can be checked +in the parser test runner. We check these error codes against the stderr log in the build/typescript/tests/baselines/reference + +Note that babel-parser should not throw for the TypeChecking Diagnostics + +The commented out diagnostic codes will introduce false positive cases that should be addressed in separate PRs. +*/ + +module.exports = [ + // "TS1005", // '{0}' expected. + "TS1009", // Trailing comma not allowed. + "TS1014", // A rest parameter must be last in a parameter list. + "TS1019", // An index signature parameter cannot have a question mark. + "TS1028", // Accessibility modifier already seen. + "TS1029", // '{0}' modifier must precede '{1}' modifier. + "TS1030", // '{0}' modifier already seen. + "TS1031", // '{0}' modifier cannot appear on a class element. + "TS1042", // '{0}' modifier cannot be used here. + "TS1048", // A rest parameter cannot have an initializer. + "TS1053", // A 'set' accessor cannot have rest parameter. + "TS1054", // A 'get' accessor cannot have parameters. + // "TS1071", // '{0}' modifier cannot appear on an index signature. + "TS1089", // '{0}' modifier cannot appear on a constructor declaration. + "TS1090", // '{0}' modifier cannot appear on a parameter. + "TS1100", // Invalid use of 'arguments' in strict mode. + "TS1101", // 'with' statements are not allowed in strict mode. + "TS1104", // A 'continue' statement can only be used within an enclosing iteration statement. + "TS1105", // A 'break' statement can only be used within an enclosing iteration or switch statement. + "TS1107", // Jump target cannot cross function boundary. + "TS1108", // A 'return' statement can only be used within a function body. + "TS1113", // A 'default' clause cannot appear more than once in a 'switch' statement. + "TS1115", // A 'continue' statement can only jump to a label of an enclosing iteration statement. + "TS1116", // A 'break' statement can only jump to a label of an enclosing statement. + "TS1123", // Variable declaration list cannot be empty. + "TS1141", // String literal expected. + "TS1142", // Line break not permitted here. + "TS1162", // An object member cannot be declared optional. + "TS1163", // A 'yield' expression is only allowed in a generator body. + "TS1184", // Modifiers cannot appear here. + "TS1191", // An import declaration cannot have modifiers. + "TS1196", // Catch clause variable cannot have a type annotation. + "TS1197", // Catch clause variable cannot have an initializer. + "TS1200", // Line terminator not permitted before arrow. + "TS1312", // '=' can only be used in an object literal property inside a destructuring assignment. + // "TS1212", // Identifier expected. '{0}' is a reserved word in strict mode." + // "TS1213", // Identifier expected. '{0}' is a reserved word in strict mode. Class definitions are automatically in strict mode. + // "TS1214", // Identifier expected. '{0}' is a reserved word in strict mode. Modules are automatically in strict mode. + "TS1246", // An interface property cannot have an initializer. + "TS1247", // A type literal property cannot have an initializer. + "TS1248", // A class member cannot have the 'const' keyword. + "TS1308", // 'await' expression is only allowed within an async function. + "TS2337", // Super calls are not permitted outside constructors or in nested functions inside constructors. + // "TS2300", // Duplicate identifier '{0}'. + "TS2364", // The left-hand side of an assignment expression must be a variable or a property access. + // "TS2371", // A parameter initializer is only allowed in a function or constructor implementation. + // "TS2393", // Duplicate function implementation. + "TS2396", // Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters. + // "TS2440", // Import declaration conflicts with local declaration of '{0}'. + // "TS2451", // Cannot redeclare block-scoped variable '{0}'. + "TS2452", // An enum member cannot have a numeric name. + "TS2566", // A rest element cannot have a property name. + "TS2481", // Cannot initialize outer scoped variable '{0}' in the same scope as block scoped declaration '{0}'. + // "TS2567", // Enum declarations can only merge with namespace or other enum declarations. + "TS2659", // 'super' is only allowed in members of object literal expressions when option 'target' is 'ES2015' or higher. + "TS2660", // 'super' can only be referenced in members of derived classes or object literal expressions. + "TS2699", // Static property '{0}' conflicts with built-in property 'Function.{0}' of constructor function '{1}'. + "TS8018", // Octal literals are not allowed in enums members initializer. + // "TS17012", // '{0}' is not a valid meta-property for keyword '{1}'. Did you mean '{2}'? +]; diff --git a/scripts/parser-tests/typescript/index.js b/scripts/parser-tests/typescript/index.js new file mode 100644 index 000000000000..5e3e4b2a9d63 --- /dev/null +++ b/scripts/parser-tests/typescript/index.js @@ -0,0 +1,81 @@ +const path = require("path"); +const fs = require("fs").promises; +const ts = require("../../../build/typescript"); +const TestRunner = require("../utils/parser-test-runner"); +const parsingErrorCodes = require("./error-codes"); + +async function* loadTests(dir) { + const names = await fs.readdir(dir); + + for (const name of names) { + const contents = await fs.readFile(path.join(dir, name), "utf8"); + yield { name, contents }; + } +} + +const plugins = [ + "typescript", + "classProperties", + "decorators-legacy", + "bigInt", + "dynamicImport", +]; + +const TSTestsPath = path.join(__dirname, "../../../build/typescript/tests"); + +// Check if the baseline errors contain the codes that should also be thrown from babel-parser +async function baselineContainsParserErrorCodes(testName) { + try { + const baselineErrors = await fs.readFile( + path.join( + TSTestsPath, + "baselines/reference", + testName.replace(/\.tsx?$/, ".errors.txt") + ), + "utf8" + ); + return parsingErrorCodes.some(code => baselineErrors.includes(code)); + } catch (e) { + if (e.code !== "ENOENT") { + throw e; + } + return false; + } +} + +const runner = new TestRunner({ + testDir: path.join(TSTestsPath, "./cases/compiler"), + whitelist: path.join(__dirname, "whitelist.txt"), + logInterval: 50, + shouldUpdate: process.argv.includes("--update-whitelist"), + + async *getTests() { + for await (const test of loadTests(this.testDir)) { + const isTSX = test.name.slice(-4) === ".tsx"; + + const ast = ts.createSourceFile( + test.name, + test.contents, + ts.ScriptTarget.Latest, + false, + isTSX ? ts.ScriptKind.TSX : ts.ScriptKind.TS + ); + + yield { + contents: test.contents, + fileName: test.name, + id: test.name, + expectedError: + ast.parseDiagnostics.length > 0 || + (await baselineContainsParserErrorCodes(test.name)), + sourceType: "module", + plugins: isTSX ? plugins.concat("jsx") : plugins, + }; + } + }, +}); + +runner.run().catch(err => { + console.error(err); + process.exitCode = 1; +}); diff --git a/scripts/parser-tests/typescript/whitelist.txt b/scripts/parser-tests/typescript/whitelist.txt new file mode 100644 index 000000000000..36d525c171eb --- /dev/null +++ b/scripts/parser-tests/typescript/whitelist.txt @@ -0,0 +1,399 @@ +ArrowFunctionExpression1.ts +MemberAccessorDeclaration15.ts +ParameterList13.ts +ParameterList4.ts +ParameterList5.ts +ParameterList6.ts +accessorParameterAccessibilityModifier.ts +accessorWithoutBody1.ts +accessorWithoutBody2.ts +aliasUsageInAccessorsOfClass.ts +aliasUsageInArray.ts +aliasUsageInFunctionExpression.ts +aliasUsageInGenericFunction.ts +aliasUsageInIndexerOfClass.ts +aliasUsageInObjectLiteral.ts +aliasUsageInOrExpression.ts +aliasUsageInTypeArgumentOfExtendsClause.ts +aliasUsageInVarAssignment.ts +aliasUsedAsNameValue.ts +allowImportClausesToMergeWithTypes.ts +allowJscheckJsTypeParameterNoCrash.ts +amdDeclarationEmitNoExtraDeclare.ts +amdModuleConstEnumUsage.ts +amdModuleName2.ts +anonClassDeclarationEmitIsAnon.ts +anyDeclare.ts +argumentsBindsToFunctionScopeArgumentList.ts +arrayOfExportedClass.ts +asyncFunctionsAcrossFiles.ts +augmentExportEquals1.ts +augmentExportEquals1_1.ts +augmentExportEquals2.ts +augmentExportEquals2_1.ts +augmentExportEquals3.ts +augmentExportEquals3_1.ts +augmentExportEquals4.ts +augmentExportEquals4_1.ts +augmentExportEquals6.ts +augmentExportEquals6_1.ts +augmentExportEquals7.ts +augmentedTypesClass.ts +augmentedTypesClass2.ts +augmentedTypesClass2a.ts +augmentedTypesClass4.ts +augmentedTypesEnum.ts +augmentedTypesEnum2.ts +augmentedTypesFunction.ts +augmentedTypesInterface.ts +augmentedTypesVar.ts +bigIntWithTargetES3.ts +bigintIndex.ts +bigintWithLib.ts +cacheResolutions.ts +cachedModuleResolution1.ts +cachedModuleResolution2.ts +cachedModuleResolution3.ts +cachedModuleResolution4.ts +cachedModuleResolution5.ts +cachedModuleResolution6.ts +cachedModuleResolution7.ts +cachedModuleResolution8.ts +cachedModuleResolution9.ts +callOverloads2.ts +checkSuperCallBeforeThisAccessing9.ts +classCannotExtendVar.ts +classExpressionWithDecorator1.ts +classExtendsAcrossFiles.ts +classExtendsMultipleBaseClasses.ts +classOverloadForFunction.ts +collisionExportsRequireAndClass.ts +commonSourceDir5.ts +commonSourceDir6.ts +commonjsSafeImport.ts +conflictingTypeAnnotatedVar.ts +constDeclarations-invalidContexts.ts +constDeclarations-scopes.ts +constDeclarations-validContexts.ts +constEnumNoEmitReexport.ts +constEnumNoPreserveDeclarationReexport.ts +constEnumPreserveEmitReexport.ts +convertKeywordsYes.ts +declarationEmitAmdModuleNameDirective.ts +declarationEmitComputedNameCausesImportToBePainted.ts +declarationEmitComputedNameConstEnumAlias.ts +declarationEmitCrossFileImportTypeOfAmbientModule.ts +declarationEmitDefaultExportWithStaticAssignment.ts +declarationEmitDestructuring2.ts +declarationEmitDestructuringOptionalBindingParametersInOverloads.ts +declarationEmitDestructuringParameterProperties.ts +declarationEmitDestructuringWithOptionalBindingParameters.ts +declarationEmitExpandoPropertyPrivateName.ts +declarationEmitExportAssignment.ts +declarationEmitExportDeclaration.ts +declarationEmitForTypesWhichNeedImportTypes.ts +declarationEmitInterfaceWithNonEntityNameExpressionHeritage.ts +declarationEmitPrefersPathKindBasedOnBundling.ts +declarationEmitPrefersPathKindBasedOnBundling2.ts +declarationEmitPrivateSymbolCausesVarDeclarationEmit2.ts +declarationImportTypeAliasInferredAndEmittable.ts +declarationMapsMultifile.ts +declarationMapsOutFile.ts +declarationsForInferredTypeFromOtherFile.ts +declareModifierOnImport1.ts +decoratorMetadataRestParameterWithImportedType.ts +decoratorMetadataWithImportDeclarationNameCollision.ts +decoratorMetadataWithImportDeclarationNameCollision3.ts +decoratorMetadataWithImportDeclarationNameCollision4.ts +decoratorMetadataWithImportDeclarationNameCollision5.ts +decoratorMetadataWithImportDeclarationNameCollision7.ts +decoratorReferenceOnOtherProperty.ts +decoratorsOnComputedProperties.ts +decrementAndIncrementOperators.ts +defaultArgsInOverloads.ts +defaultDeclarationEmitDefaultImport.ts +defaultIsNotVisibleInLocalScope.ts +defaultPropsEmptyCurlyBecomesAnyForJs.ts +defaultValueInFunctionTypes.ts +deleteOperator1.ts +deleteOperatorInStrictMode.ts +dependencyViaImportAlias.ts +destructureOptionalParameter.ts +destructuredDeclarationEmit.ts +doubleUnderscoreExportStarConflict.ts +duplicateIdentifierBindingElementInParameterDeclaration1.ts +duplicateIdentifierBindingElementInParameterDeclaration2.ts +duplicateIdentifierEnum.ts +duplicateIdentifierInCatchBlock.ts +duplicateIdentifierRelatedSpans1.ts +duplicateIdentifierRelatedSpans2.ts +duplicateIdentifiersAcrossFileBoundaries.ts +duplicateLabel1.ts +duplicateLabel2.ts +duplicateVarAndImport.ts +duplicateVarAndImport2.ts +duplicateVarsAcrossFileBoundaries.ts +dynamicNames.ts +elidedEmbeddedStatementsReplacedWithSemicolon.ts +emitClassMergedWithConstNamespaceNotElided.ts +emitSuperCallBeforeEmitParameterPropertyDeclaration1.ts +emitSuperCallBeforeEmitParameterPropertyDeclaration1ES6.ts +emitSuperCallBeforeEmitPropertyDeclarationAndParameterPropertyDeclaration1.ts +emitSuperCallBeforeEmitPropertyDeclarationAndParameterPropertyDeclaration1ES6.ts +enumGenericTypeClash.ts +es3-oldStyleOctalLiteralTypes.ts +es3defaultAliasIsQuoted.ts +es5-asyncFunctionWithStatements.ts +es5-importHelpersAsyncFunctions.ts +es5-oldStyleOctalLiteralInEnums.ts +es5ModuleInternalNamedImports.ts +es6ExportAssignment2.ts +es6ExportAssignment3.ts +es6ImportDefaultBindingFollowedWithNamedImport.ts +es6ImportDefaultBindingFollowedWithNamedImport1.ts +es6ImportDefaultBindingFollowedWithNamedImport1InEs5.ts +es6ImportDefaultBindingFollowedWithNamedImportDts.ts +es6ImportDefaultBindingFollowedWithNamedImportDts1.ts +es6ImportDefaultBindingFollowedWithNamedImportInEs5.ts +es6ImportDefaultBindingMergeErrors.ts +es6ImportEqualsDeclaration.ts +es6ImportEqualsExportModuleCommonJsError.ts +es6ImportEqualsExportModuleEs2015Error.ts +es6ImportNameSpaceImportMergeErrors.ts +es6ImportNamedImport.ts +es6ImportNamedImportAmd.ts +es6ImportNamedImportDts.ts +es6ImportNamedImportInEs5.ts +es6ImportNamedImportInExportAssignment.ts +es6ImportNamedImportMergeErrors.ts +es6ImportNamedImportNoExportMember.ts +es6ImportNamedImportNoNamedExports.ts +es6ImportNamedImportWithTypesAndValues.ts +es6ModuleInternalNamedImports.ts +es6ModuleInternalNamedImports2.ts +es6UseOfTopLevelRequire.ts +esModuleInterop.ts +esModuleInteropImportTSLibHasImport.ts +esModuleInteropNamedDefaultImports.ts +esModuleInteropTslibHelpers.ts +exportAssignClassAndModule.ts +exportAssignmentImportMergeNoCrash.ts +exportAssignmentMembersVisibleInAugmentation.ts +exportAssignmentWithDeclareAndExportModifiers.ts +exportAssignmentWithDeclareModifier.ts +exportAssignmentWithExportModifier.ts +exportAssignmentWithoutAllowSyntheticDefaultImportsError.ts +exportClassExtendingIntersection.ts +exportClassWithoutName.ts +exportDeclarationsInAmbientNamespaces.ts +exportDefaultAbstractClass.ts +exportDefaultAsyncFunction2.ts +exportDefaultMarksIdentifierAsUsed.ts +exportDefaultStripsFreshness.ts +exportEqualsOfModule.ts +exportImport.ts +exportImportNonInstantiatedModule2.ts +exportSameNameFuncVar.ts +exportSpecifierAndExportedMemberDeclaration.ts +exportSpecifierAndLocalMemberDeclaration.ts +exportStarFromEmptyModule.ts +expressionsForbiddenInParameterInitializers.ts +extendingClassFromAliasAndUsageInIndexer.ts +extendsClauseAlreadySeen.ts +extendsClauseAlreadySeen2.ts +externalModuleAssignToVar.ts +fileWithNextLine2.ts +funClodule.ts +functionAndImportNameConflict.ts +functionCall15.ts +functionDeclarationWithResolutionOfTypeNamedArguments01.ts +functionExpressionInWithBlock.ts +functionExpressionWithResolutionOfTypeNamedArguments01.ts +gettersAndSettersErrors.ts +giant.ts +implementClausePrecedingExtends.ts +implementsClauseAlreadySeen.ts +importAndVariableDeclarationConflict1.ts +importAndVariableDeclarationConflict3.ts +importAndVariableDeclarationConflict4.ts +importAsBaseClass.ts +importDecl.ts +importDeclWithClassModifiers.ts +importDeclWithDeclareModifierInAmbientContext.ts +importHelpers.ts +importHelpersAmd.ts +importHelpersInAmbientContext.ts +importHelpersInIsolatedModules.ts +importHelpersInTsx.tsx +importHelpersNoHelpers.ts +importHelpersNoModule.ts +importHelpersOutFile.ts +importHelpersSystem.ts +importWithTrailingSlash.ts +importedModuleClassNameClash.ts +indexSignatureWithAccessibilityModifier.ts +indexSignatureWithInitializer1.ts +indexTypeCheck.ts +indexWithoutParamType.ts +indexerSignatureWithRestParam.ts +initializedParameterBeforeNonoptionalNotOptional.ts +interfaceMayNotBeExtendedWitACall.ts +interfaceWithImplements1.ts +invalidReferenceSyntax1.ts +isLiteral1.ts +isLiteral2.ts +isolatedModulesReExportType.ts +jsEnumTagOnObjectFrozen.ts +jsFileCompilationBindDuplicateIdentifier.ts +jsFileCompilationDuplicateFunctionImplementation.ts +jsFileCompilationDuplicateFunctionImplementationFileOrderReversed.ts +jsFileCompilationExternalPackageError.ts +jsNoImplicitAnyNoCascadingReferenceErrors.ts +jsdocAccessEnumType.ts +jsxAttributeWithoutExpressionReact.tsx +jsxIntrinsicElementsExtendsRecord.tsx +letAndVarRedeclaration.ts +letAsIdentifier.ts +letAsIdentifierInStrictMode.ts +letDeclarations-invalidContexts.ts +letDeclarations-scopes-duplicates.ts +letDeclarations-scopes-duplicates2.ts +letDeclarations-scopes-duplicates3.ts +letDeclarations-scopes-duplicates4.ts +letDeclarations-scopes-duplicates5.ts +letDeclarations-scopes-duplicates6.ts +letDeclarations-scopes-duplicates7.ts +letDeclarations-scopes.ts +letDeclarations-validContexts.ts +mergeWithImportedType.ts +mergedDeclarations6.ts +metadataOfClassFromAlias.ts +metadataOfClassFromAlias2.ts +metadataReferencedWithinFilteredUnion.ts +mismatchedClassConstructorVariable.ts +missingSemicolonInModuleSpecifier.ts +misspelledNewMetaProperty.ts +modifiersOnInterfaceIndexSignature1.ts +moduleAugmentationCollidingNamesInAugmentation1.ts +moduleAugmentationDeclarationEmit1.ts +moduleAugmentationDeclarationEmit2.ts +moduleAugmentationDisallowedExtensions.ts +moduleAugmentationDuringSyntheticDefaultCheck.ts +moduleAugmentationExtendAmbientModule1.ts +moduleAugmentationExtendAmbientModule2.ts +moduleAugmentationExtendFileModule1.ts +moduleAugmentationExtendFileModule2.ts +moduleAugmentationGlobal1.ts +moduleAugmentationGlobal2.ts +moduleAugmentationGlobal3.ts +moduleAugmentationImportsAndExports1.ts +moduleAugmentationImportsAndExports2.ts +moduleAugmentationImportsAndExports3.ts +moduleAugmentationImportsAndExports4.ts +moduleAugmentationImportsAndExports5.ts +moduleAugmentationImportsAndExports6.ts +moduleAugmentationNoNewNames.ts +moduleAugmentationsBundledOutput1.ts +moduleAugmentationsImports1.ts +moduleAugmentationsImports2.ts +moduleAugmentationsImports3.ts +moduleAugmentationsImports4.ts +moduleDuplicateIdentifiers.ts +moduleResolutionNoTs.ts +moduleResolutionWithSymlinks.ts +moduleResolutionWithSymlinks_withOutDir.ts +moduleResolution_automaticTypeDirectiveNames.ts +moduleSharesNameWithImportDeclarationInsideIt3.ts +moduleSharesNameWithImportDeclarationInsideIt5.ts +module_augmentUninstantiatedModule2.ts +multiImportExport.ts +multipleInheritance.ts +nameCollisions.ts +namespacesWithTypeAliasOnlyExportsMerge.ts +narrowedImports.ts +newNamesInGlobalAugmentations1.ts +noBundledEmitFromNodeModules.ts +noCrashOnImportShadowing.ts +noImplicitAnyDestructuringVarDeclaration.ts +noSymbolForMergeCrash.ts +nodeResolution4.ts +nodeResolution6.ts +nodeResolution8.ts +nonMergedOverloads.ts +numberVsBigIntOperations.ts +objectLiteralMemberWithoutBlock1.ts +outModuleConcatAmd.ts +outModuleConcatCommonjs.ts +outModuleConcatCommonjsDeclarationOnly.ts +outModuleConcatES6.ts +outModuleConcatSystem.ts +outModuleConcatUmd.ts +outModuleTripleSlashRefs.ts +parameterInitializerBeforeDestructuringEmit.ts +parameterPropertyOutsideConstructor.ts +parseGenericArrowRatherThanLeftShift.ts +pathMappingBasedModuleResolution3_classic.ts +pathMappingBasedModuleResolution3_node.ts +preserveUnusedImports.ts +privacyCheckExternalModuleExportAssignmentOfGenericClass.ts +privacyTopLevelAmbientExternalModuleImportWithExport.ts +privacyTopLevelAmbientExternalModuleImportWithoutExport.ts +reExportGlobalDeclaration1.ts +reExportUndefined1.ts +reExportUndefined2.ts +readonlyInNonPropertyParameters.ts +recursiveExportAssignmentAndFindAliasedType1.ts +recursiveExportAssignmentAndFindAliasedType2.ts +recursiveExportAssignmentAndFindAliasedType3.ts +recursiveExportAssignmentAndFindAliasedType4.ts +recursiveExportAssignmentAndFindAliasedType5.ts +recursiveExportAssignmentAndFindAliasedType6.ts +recursiveExportAssignmentAndFindAliasedType7.ts +redeclareParameterInCatchBlock.ts +reexportedMissingAlias.ts +relativeNamesInClassicResolution.ts +requireAsFunctionInExternalModule.ts +restParamModifier2.ts +shadowedReservedCompilerDeclarationsWithNoEmit.ts +shorthandPropertyAssignmentInES6Module.ts +sourceMap-LineBreaks.ts +sourceMapValidationDecorators.ts +sourceMapValidationStatements.ts +staticIndexer.ts +strictModeReservedWord.ts +strictModeReservedWordInClassDeclaration.ts +superCallFromClassThatHasNoBaseType1.ts +symbolLinkDeclarationEmitModuleNames.ts +symbolMergeValueAndImportedType.ts +systemExportAssignment.ts +systemExportAssignment2.ts +systemModule11.ts +systemModule15.ts +systemModule17.ts +systemModuleWithSuperClass.ts +systemObjectShorthandRename.ts +targetEs6DecoratorMetadataImportNotElided.ts +targetTypeCastTest.ts +tsxDeepAttributeAssignabilityError.tsx +typeReferenceDirectives10.ts +typeReferenceDirectives11.ts +typeReferenceDirectives12.ts +typeReferenceDirectives13.ts +typeReferenceDirectives5.ts +typeReferenceDirectives7.ts +typeReferenceDirectives8.ts +typeReferenceDirectives9.ts +unusedImports1.ts +unusedImports11.ts +unusedImports12.ts +unusedImports2.ts +unusedImports3.ts +unusedImports4.ts +unusedImports5.ts +unusedInvalidTypeArguments.ts +varAndFunctionShareName.ts +varArgConstructorMemberParameter.ts +withStatement.ts +withStatementErrors.ts +withStatementInternalComments.ts +withStatementNestedScope.ts diff --git a/scripts/parser-tests/utils/parser-test-runner.js b/scripts/parser-tests/utils/parser-test-runner.js new file mode 100644 index 000000000000..764ef593d4f5 --- /dev/null +++ b/scripts/parser-tests/utils/parser-test-runner.js @@ -0,0 +1,237 @@ +"use strict"; + +const fs = require("fs").promises; +const chalk = require("chalk"); +const { parse: parser } = require("../../../packages/babel-parser"); + +const dot = chalk.gray("."); + +class TestRunner { + constructor({ + testDir, + whitelist, + logInterval = 1, + shouldUpdate, + getTests, + parse = this.parse, + }) { + this.testDir = testDir; + this.whitelist = whitelist; + this.logInterval = logInterval; + this.shouldUpdate = shouldUpdate; + this.getTests = getTests; + this.parse = parse; + } + + async run() { + const whitelistP = this.getWhitelist(); + + console.log(`Now running tests...`); + + const results = []; + for await (const result of this.runTests()) { + results.push(result); + if (results.length % this.logInterval === 0) process.stdout.write(dot); + } + process.stdout.write("\n"); + + const summary = this.interpret(results, await whitelistP); + + await this.output(summary); + } + + async *runTests() { + for await (const test of this.getTests()) { + yield this.runTest(test); + } + } + + runTest(test) { + try { + this.parse(test, parser); + test.actualError = false; + } catch (err) { + test.actualError = true; + } + + test.result = test.expectedError !== test.actualError ? "fail" : "pass"; + + return test; + } + + parse(test, parser) { + parser(test.contents, { + sourceType: test.sourceType, + plugins: test.plugins, + }); + } + + async getWhitelist() { + const contents = await fs.readFile(this.whitelist, "utf-8"); + const table = new Set(); + + for (const line of contents.split("\n")) { + const filename = line.replace(/#.*$/, "").trim(); + if (filename) table.add(filename); + } + + return table; + } + + async updateWhitelist(summary) { + const contents = await fs.readFile(this.whitelist, "utf-8"); + + const toRemove = summary.disallowed.success + .concat(summary.disallowed.failure) + .map(test => test.id) + .concat(summary.unrecognized); + + const updated = summary.disallowed.falsePositive + .concat(summary.disallowed.falseNegative) + .map(test => test.id); + + for (const line of contents.split("\n")) { + const testId = line.replace(/#.*$/, "").trim(); + if (!toRemove.includes(testId) && line) { + updated.push(line); + } + } + + updated.sort(); + + await fs.writeFile(this.whitelist, updated.join("\n") + "\n", "utf8"); + } + + interpret(results, whitelist) { + const summary = { + passed: true, + allowed: { + success: [], + failure: [], + falsePositive: [], + falseNegative: [], + }, + disallowed: { + success: [], + failure: [], + falsePositive: [], + falseNegative: [], + }, + unrecognized: null, + count: results.length, + }; + + results.forEach(function(result) { + let classification, isAllowed; + const inWhitelist = whitelist.has(result.id); + whitelist.delete(result.id); + + if (!result.expectedError) { + if (!result.actualError) { + classification = "success"; + isAllowed = !inWhitelist; + } else { + classification = "falseNegative"; + isAllowed = inWhitelist; + } + } else { + if (!result.actualError) { + classification = "falsePositive"; + isAllowed = inWhitelist; + } else { + classification = "failure"; + isAllowed = !inWhitelist; + } + } + + summary.passed &= isAllowed; + summary[isAllowed ? "allowed" : "disallowed"][classification].push( + result + ); + }); + + summary.unrecognized = Array.from(whitelist); + summary.passed = !!summary.passed && summary.unrecognized.length === 0; + + return summary; + } + + async output(summary) { + const goodnews = [ + summary.allowed.success.length + " valid programs parsed without error", + summary.allowed.failure.length + + " invalid programs produced a parsing error", + summary.allowed.falsePositive.length + + " invalid programs did not produce a parsing error" + + " (and allowed by the whitelist file)", + summary.allowed.falseNegative.length + + " valid programs produced a parsing error" + + " (and allowed by the whitelist file)", + ]; + const badnews = []; + const badnewsDetails = []; + + void [ + { + tests: summary.disallowed.success, + label: + "valid programs parsed without error" + + " (in violation of the whitelist file)", + }, + { + tests: summary.disallowed.failure, + label: + "invalid programs produced a parsing error" + + " (in violation of the whitelist file)", + }, + { + tests: summary.disallowed.falsePositive, + label: + "invalid programs did not produce a parsing error" + + " (without a corresponding entry in the whitelist file)", + }, + { + tests: summary.disallowed.falseNegative, + label: + "valid programs produced a parsing error" + + " (without a corresponding entry in the whitelist file)", + }, + { + tests: summary.unrecognized, + label: "non-existent programs specified in the whitelist file", + }, + ].forEach(function({ tests, label }) { + if (!tests.length) { + return; + } + + const desc = tests.length + " " + label; + + badnews.push(desc); + badnewsDetails.push(desc + ":"); + badnewsDetails.push(...tests.map(test => ` ${test.id || test}`)); + }); + + console.log(`Testing complete (${summary.count} tests).`); + console.log("Summary:"); + console.log(chalk.green(goodnews.join("\n").replace(/^/gm, " ✔ "))); + + if (!summary.passed) { + console.log(""); + console.log(chalk.red(badnews.join("\n").replace(/^/gm, " ✘ "))); + console.log(""); + console.log("Details:"); + console.log(badnewsDetails.join("\n").replace(/^/gm, " ")); + } + + if (this.shouldUpdate) { + await this.updateWhitelist(summary); + console.log(""); + console.log("Whitelist file updated."); + } else { + process.exitCode = summary.passed ? 0 : 1; + } + } +} + +module.exports = exports = TestRunner; diff --git a/scripts/rollup-plugin-babel-source.js b/scripts/rollup-plugin-babel-source.js new file mode 100644 index 000000000000..892401a21924 --- /dev/null +++ b/scripts/rollup-plugin-babel-source.js @@ -0,0 +1,84 @@ +const path = require("path"); +const fs = require("fs"); +const dirname = path.join(__dirname, ".."); + +module.exports = function() { + return { + name: "babel-source", + load(id) { + const matches = id.match(/packages\/(babel-[^/]+)\/src\//); + if (matches) { + // check if browser field exists for this file and replace + const packageFolder = path.join(dirname, "packages", matches[1]); + const packageJson = require(path.join(packageFolder, "package.json")); + + if ( + packageJson["browser"] && + typeof packageJson["browser"] === "object" + ) { + for (let nodeFile in packageJson["browser"]) { + const browserFile = packageJson["browser"][nodeFile].replace( + /^(\.\/)?lib\//, + "src/" + ); + nodeFile = nodeFile.replace(/^(\.\/)?lib\//, "src/"); + if (id.endsWith(nodeFile)) { + if (browserFile === false) { + return ""; + } + return fs.readFileSync( + path.join(packageFolder, browserFile), + "UTF-8" + ); + } + } + } + } + return null; + }, + resolveId(importee) { + if (importee === "@babel/runtime/regenerator") { + return path.join( + dirname, + "packages", + "babel-runtime", + "regenerator", + "index.js" + ); + } + + const matches = importee.match(/^@babel\/([^/]+)$/); + if (!matches) return null; + + // resolve babel package names to their src index file + const packageFolder = path.join( + dirname, + "packages", + `babel-${matches[1]}` + ); + + let packageJsonSource; + try { + packageJsonSource = fs.readFileSync( + path.join(packageFolder, "package.json") + ); + } catch (e) { + // Some Babel packahes aren't in this repository, but in + return null; + } + + const packageJson = JSON.parse(packageJsonSource); + + const filename = + typeof packageJson["browser"] === "string" + ? packageJson["browser"] + : packageJson["main"]; + + return path.join( + packageFolder, + // replace lib with src in the pkg.json entry + filename.replace(/^(\.\/)?lib\//, "src/") + ); + }, + }; +}; diff --git a/scripts/test-cov.sh b/scripts/test-cov.sh index 6914ef3fb0f9..4d90d4bda385 100755 --- a/scripts/test-cov.sh +++ b/scripts/test-cov.sh @@ -1,10 +1,11 @@ #!/bin/bash set -e +node="yarn --silent node" jestArgs="--coverage" if [ -n "$CI" ]; then jestArgs="${jestArgs} --maxWorkers=4 --ci" fi -node_modules/.bin/jest $jestArgs +$node node_modules/.bin/jest $jestArgs diff --git a/scripts/test.sh b/scripts/test.sh index f9c9e384e2e1..40109fbe3aa3 100755 --- a/scripts/test.sh +++ b/scripts/test.sh @@ -1,11 +1,11 @@ #!/bin/bash set -e -node="node" +node="yarn --silent node" jestArgs=() if [ "$TEST_DEBUG" ]; then - node="node --inspect-brk" + node="$node --inspect-brk" jestArgs+=("--runInBand") fi @@ -20,7 +20,7 @@ if [ -n "$TEST_GREP" ]; then fi if [ -n "$TEST_ONLY" ]; then - jestArgs+=("(packages|codemods)/.*$TEST_ONLY.*/test") + jestArgs+=("(packages|codemods|eslint)/.*$TEST_ONLY.*/test") fi -$node node_modules/jest/bin/jest.js "${jestArgs[@]}" +$node node_modules/.bin/jest "${jestArgs[@]}" diff --git a/scripts/tests/flow/flow_tests_whitelist.txt b/scripts/tests/flow/flow_tests_whitelist.txt deleted file mode 100644 index 7549e6a49ae1..000000000000 --- a/scripts/tests/flow/flow_tests_whitelist.txt +++ /dev/null @@ -1,31 +0,0 @@ -# This file lists tests that are known to produce incorrect results when parsed -# with the babel parser: -# -# - Tests that are expected to parse successfully but for which the babel parser reports -# a syntax error -# - Tests that contain invalid syntax but for which the babel parser reports no syntax -# error -# -# Entries should be removed incrementally as the babel parser is improved. - -JSX_invalid/migrated_0000.js -arrow_function_invalid/migrated_0002.js -async_await/migrated_0007.js -async_await/migrated_0020.js -async_await/migrated_0024.js -async_await/migrated_0027.js -async_generators/migrated_0007.js -class_properties/migrated_0021.js -class_properties/migrated_0026.js -decorators/migrated_0003.js -private_class_properties/multiple.js -private_class_properties/super.js -private_class_properties/getter_and_field.js -private_class_properties/getter_duplicate.js -private_class_properties/setter_and_field.js -private_class_properties/setter_duplicate.js -types/member/reserved_words.js -class_method_kinds/polymorphic_getter.js -ES6/modules/migrated_0020.js -export_import_reserved_words/migrated_0003.js -export_statements/export_trailing_comma.js diff --git a/scripts/tests/flow/run_babel_parser_flow_tests.js b/scripts/tests/flow/run_babel_parser_flow_tests.js deleted file mode 100644 index f087fb6614e3..000000000000 --- a/scripts/tests/flow/run_babel_parser_flow_tests.js +++ /dev/null @@ -1,311 +0,0 @@ -"use strict"; - -const path = require("path"); -const fs = require("fs"); -const chalk = require("chalk"); -const parse = require("../../../packages/babel-parser").parse; - -const TESTS_FOLDER = path.join( - __dirname, - "../../../build/flow/src/parser/test/flow" -); -const WHITELIST_PATH = path.join(__dirname, "./flow_tests_whitelist.txt"); - -const shouldUpdateWhitelist = process.argv.indexOf("--update-whitelist") > 0; - -function map_get_default(map, key, defaultConstructor) { - if (map.has(key)) { - return map.get(key); - } - const value = new defaultConstructor(); - map.set(key, value); - return value; -} - -function get_whitelist(filename) { - return fs - .readFileSync(filename, "utf8") - .split("\n") - .map(line => line.replace(/#.*$/, "").trim()) - .filter(Boolean); -} - -function list_files(root, dir) { - const files = fs.readdirSync(dir ? path.join(root, dir) : root); - let result = []; - for (let i = 0; i < files.length; i++) { - const file = dir ? path.join(dir, files[i]) : files[i]; - const stats = fs.statSync(path.join(root, file)); - if (stats.isDirectory()) { - result = result.concat(list_files(root, file)); - } else { - result.push(file); - } - } - return result.sort(); -} - -function get_tests(root_dir) { - const files = list_files(root_dir); - const tests = new Map(); - for (let i = 0; i < files.length; i++) { - const file = files[i]; - const test_name = path.dirname(file); - const case_parts = path.basename(file).split("."); - const case_name = case_parts[0]; - - // Hack to ignore hidden files. - if (case_name === "") { - continue; - } - - const cases = map_get_default(tests, test_name, Map); - const case_ = map_get_default(cases, case_name, Object); - - const content = fs.readFileSync(path.join(root_dir, file), "utf8"); - const ext = case_parts[case_parts.length - 1]; - const kind = - case_parts.length > 2 ? case_parts[case_parts.length - 2] : null; - - if (ext === "js") { - case_.file = file; - case_.content = content; - } else if (ext === "json" && kind === "tree") { - case_.expected_ast = JSON.parse(content); - } else if (ext === "json" && kind === "options") { - case_.options = JSON.parse(content); - } - } - return tests; -} - -function update_whitelist(summary) { - const contains = (tests, file) => - tests.some(({ test }) => test.file === file); - - const disallowed = summary.disallowed.success.concat( - summary.disallowed.failure - ); - - const oldLines = fs - .readFileSync(WHITELIST_PATH, "utf8") - .trim() - .split("\n") - .filter(line => { - const file = line.replace(/#.*$/, "").trim(); - return ( - !contains(disallowed, file) && summary.unrecognized.indexOf(file) === -1 - ); - }); - - const newLines = summary.disallowed.failure - .map(({ test }) => test.file) - .filter(test => oldLines.indexOf(test) === -1); - - const result = oldLines.concat(newLines).join("\n") + "\n"; - - fs.writeFileSync(WHITELIST_PATH, result); -} - -const options = { - plugins: [ - "dynamicImport", - ["flow", { all: true }], - "flowComments", - "jsx", - "classProperties", - "classPrivateProperties", - "classPrivateMethods", - "bigInt", - "numericSeparator", - ], - sourceType: "module", - ranges: true, -}; - -const flowOptionsMapping = { - esproposal_class_instance_fields: "classProperties", - esproposal_class_static_fields: "classProperties", - esproposal_export_star_as: "exportNamespaceFrom", - esproposal_decorators: "decorators-legacy", - esproposal_nullish_coalescing: "nullishCoalescingOperator", - esproposal_optional_chaining: "optionalChaining", - types: "flowComments", - intern_comments: false, -}; - -const summary = { - passed: true, - allowed: { - success: [], - failure: [], - }, - disallowed: { - success: [], - failure: [], - }, - unrecognized: [], -}; - -const tests = get_tests(TESTS_FOLDER); -const whitelist = get_whitelist(WHITELIST_PATH); - -const unrecognized = new Set(whitelist); - -tests.forEach(section => { - section.forEach(test => { - const shouldSuccess = - test.expected_ast && - (!Array.isArray(test.expected_ast.errors) || - test.expected_ast.errors.length === 0); - const inWhitelist = whitelist.indexOf(test.file) > -1; - - const babelParserOptions = Object.assign({}, options); - babelParserOptions.plugins = babelParserOptions.plugins.slice(); - - if (test.options) { - Object.keys(test.options).forEach(option => { - if (!test.options[option]) { - const idx = babelParserOptions.plugins.indexOf( - flowOptionsMapping[option] - ); - if (idx) { - babelParserOptions.plugins.splice(idx, 1); - } - return; - } - if (!(option in flowOptionsMapping)) { - throw new Error("Parser options not mapped " + option); - } - if (flowOptionsMapping[option]) { - babelParserOptions.plugins.push(flowOptionsMapping[option]); - } - }); - } - - let failed = false; - let exception = null; - try { - parse(test.content, babelParserOptions); - } catch (e) { - exception = e; - failed = true; - - // lets retry in script mode - if (shouldSuccess) { - try { - parse( - test.content, - Object.assign({}, babelParserOptions, { sourceType: "script" }) - ); - exception = null; - failed = false; - } catch (e) {} - } - } - - const isSuccess = shouldSuccess !== failed; - const isAllowed = isSuccess !== inWhitelist; - - summary[isAllowed ? "allowed" : "disallowed"][ - isSuccess ? "success" : "failure" - ].push({ test, exception, shouldSuccess, babelParserOptions }); - summary.passed &= isAllowed; - - unrecognized.delete(test.file); - - process.stdout.write(chalk.gray(".")); - }); -}); - -summary.unrecognized = Array.from(unrecognized); -summary.passed &= summary.unrecognized.length === 0; - -// This is needed because, after the dots written using -// `process.stdout.write(".")` there is no final newline -console.log(); - -if (summary.disallowed.failure.length || summary.disallowed.success.length) { - console.log("\n-- FAILED TESTS --"); - summary.disallowed.failure.forEach( - ({ test, shouldSuccess, exception, babelParserOptions }) => { - console.log(chalk.red(`✘ ${test.file}`)); - if (shouldSuccess) { - console.log(chalk.yellow(" Should parse successfully, but did not")); - console.log(chalk.yellow(` Failed with: \`${exception.message}\``)); - } else { - console.log(chalk.yellow(" Should fail parsing, but did not")); - } - console.log( - chalk.yellow( - ` Active plugins: ${JSON.stringify(babelParserOptions.plugins)}` - ) - ); - } - ); - summary.disallowed.success.forEach( - ({ test, shouldSuccess, babelParserOptions }) => { - console.log(chalk.red(`✘ ${test.file}`)); - if (shouldSuccess) { - console.log( - chalk.yellow( - " Correctly parsed successfully, but" + - " was disallowed by the whitelist" - ) - ); - } else { - console.log( - chalk.yellow( - " Correctly failed parsing, but" + - " was disallowed by the whitelist" - ) - ); - } - console.log( - chalk.yellow( - ` Active plugins: ${JSON.stringify(babelParserOptions.plugins)}` - ) - ); - } - ); -} - -console.log("-- SUMMARY --"); -console.log( - chalk.green("✔ " + summary.allowed.success.length + " tests passed") -); -console.log( - chalk.green( - "✔ " + - summary.allowed.failure.length + - " tests failed but were allowed in the whitelist" - ) -); -console.log( - chalk.red("✘ " + summary.disallowed.failure.length + " tests failed") -); -console.log( - chalk.red( - "✘ " + - summary.disallowed.success.length + - " tests passed but were disallowed in the whitelist" - ) -); -console.log( - chalk.red( - "✘ " + - summary.unrecognized.length + - " tests specified in the whitelist were not found" - ) -); - -// Some padding to separate the output from the message `make` -// adds at the end of failing scripts -console.log(); - -if (shouldUpdateWhitelist) { - update_whitelist(summary); - console.log("\nWhitelist updated"); -} else { - process.exit(summary.passed ? 0 : 1); -} diff --git a/scripts/tests/test262/run_babel_parser_test262.js b/scripts/tests/test262/run_babel_parser_test262.js deleted file mode 100644 index acd0c5122606..000000000000 --- a/scripts/tests/test262/run_babel_parser_test262.js +++ /dev/null @@ -1,126 +0,0 @@ -"use strict"; - -const path = require("path"); -const chalk = require("chalk"); -const utils = require("./run_babel_parser_test262_utils"); - -const testDir = path.join(__dirname, "../../../build/test262"); -const whitelistFile = path.join(__dirname, "test262_whitelist.txt"); -const shouldUpdate = process.argv.indexOf("--update-whitelist") > -1; - -Promise.all([utils.getTests(testDir), utils.getWhitelist(whitelistFile)]) - .then(function([tests, whitelist]) { - const total = tests.length; - const reportInc = Math.floor(total / 20); - - console.log(`Now running ${total} tests...`); - - const results = tests.map(function(test, idx) { - if (idx % reportInc === 0) { - console.log(`> ${Math.round((100 * idx) / total)}% complete`); - } - - return utils.runTest(test); - }); - - return utils.interpret(results, whitelist); - }) - .then(function(summary) { - const goodnews = [ - summary.allowed.success.length + " valid programs parsed without error", - summary.allowed.failure.length + - " invalid programs produced a parsing error", - summary.allowed.falsePositive.length + - " invalid programs did not produce a parsing error" + - " (and allowed by the whitelist file)", - summary.allowed.falseNegative.length + - " valid programs produced a parsing error" + - " (and allowed by the whitelist file)", - ]; - const badnews = []; - const badnewsDetails = []; - - void [ - { - tests: summary.disallowed.success, - label: - "valid programs parsed without error" + - " (in violation of the whitelist file)", - }, - { - tests: summary.disallowed.failure, - label: - "invalid programs produced a parsing error" + - " (in violation of the whitelist file)", - }, - { - tests: summary.disallowed.falsePositive, - label: - "invalid programs did not produce a parsing error" + - " (without a corresponding entry in the whitelist file)", - }, - { - tests: summary.disallowed.falseNegative, - label: - "valid programs produced a parsing error" + - " (without a corresponding entry in the whitelist file)", - }, - { - tests: summary.unrecognized, - label: "non-existent programs specified in the whitelist file", - }, - ].forEach(function({ tests, label }) { - if (!tests.length) { - return; - } - - const desc = tests.length + " " + label; - - badnews.push(desc); - badnewsDetails.push(desc + ":"); - badnewsDetails.push( - ...tests.map(function(test) { - return test.id || test; - }) - ); - }); - - console.log("Testing complete."); - console.log("Summary:"); - console.log(chalk.green(goodnews.join("\n").replace(/^/gm, " ✔ "))); - - if (!summary.passed) { - console.log(""); - console.log(chalk.red(badnews.join("\n").replace(/^/gm, " ✘ "))); - console.log(""); - console.log("Details:"); - console.log(badnewsDetails.join("\n").replace(/^/gm, " ")); - } - - if (shouldUpdate) { - return utils.updateWhitelist(whitelistFile, summary).then(function() { - console.log(""); - console.log("Whitelist file updated."); - }); - } else { - process.exitCode = summary.passed ? 0 : 1; - } - - const unmappedFeatures = utils.getUnmappedFeatures(); - - if (unmappedFeatures.size) { - console.log(""); - console.log( - "The following Features are not currently mapped or ignored:" - ); - console.log( - Array.from(unmappedFeatures) - .join("\n") - .replace(/^/gm, " ") - ); - } - }) - .catch(function(err) { - console.error(err); - process.exitCode = 1; - }); diff --git a/scripts/tests/test262/run_babel_parser_test262_utils.js b/scripts/tests/test262/run_babel_parser_test262_utils.js deleted file mode 100644 index 974e4a88e795..000000000000 --- a/scripts/tests/test262/run_babel_parser_test262_utils.js +++ /dev/null @@ -1,291 +0,0 @@ -"use strict"; - -const fs = require("graceful-fs"); -const promisify = require("util").promisify; -const TestStream = require("test262-stream"); -const pfs = { - readFile: promisify(fs.readFile), - writeFile: promisify(fs.writeFile), - readdir: promisify(fs.readdir), - stat: promisify(fs.stat), -}; - -const parse = require("../../../packages/babel-parser").parse; - -const ignoredFeatures = [ - "Array.prototype.flat", - "Array.prototype.flatMap", - "Array.prototype.values", - "ArrayBuffer", - "async-functions", - "async-iteration", - "arrow-function", - "Atomics", - "caller", - "class", - "computed-property-names", - "const", - "cross-realm", - "DataView", - "DataView.prototype.getFloat32", - "DataView.prototype.getFloat64", - "DataView.prototype.getInt8", - "DataView.prototype.getInt16", - "DataView.prototype.getInt32", - "DataView.prototype.getUint16", - "DataView.prototype.getUint32", - "DataView.prototype.setUint8", - "default-parameters", - "destructuring-assignment", - "destructuring-binding", - "Float32Array", - "Float64Array", - "for-of", - "generators", - "globalThis", - "hashbang", - "Int8Array", - "Int32Array", - "Intl.ListFormat", - "Intl.Locale", - "Intl.NumberFormat-unified", - "Intl.RelativeTimeFormat", - "Intl.Segmenter", - "IsHTMLDDA", - "json-superset", - "let", - "Map", - "new.target", - "Object.fromEntries", - "Object.is", - "object-rest", - "object-spread", - "optional-catch-binding", - "Promise.prototype.finally", - "Proxy", - "Reflect", - "Reflect.construct", - "Reflect.set", - "Reflect.setPrototypeOf", - "regexp-dotall", - "regexp-lookbehind", - "regexp-named-groups", - "regexp-unicode-property-escapes", - "SharedArrayBuffer", - "Set", - "String.fromCodePoint", - "String.prototype.endsWith", - "String.prototype.includes", - "String.prototype.matchAll", - "String.prototype.trimEnd", - "String.prototype.trimStart", - "string-trimming", - "super", - "Symbol", - "Symbol.asyncIterator", - "Symbol.hasInstance", - "Symbol.isConcatSpreadable", - "Symbol.iterator", - "Symbol.match", - "Symbol.matchAll", - "Symbol.prototype.description", - "Symbol.replace", - "Symbol.search", - "Symbol.split", - "Symbol.species", - "Symbol.toPrimitive", - "Symbol.toStringTag", - "Symbol.unscopables", - "tail-call-optimization", - "template", - "TypedArray", - "u180e", - "Uint8Array", - "Uint8ClampedArray", - "Uint16Array", - "WeakMap", - "WeakSet", - "well-formed-json-stringify", -]; - -const featuresToPlugins = { - BigInt: "bigInt", - "class-fields-private": "classPrivateProperties", - "class-fields-public": "classProperties", - "class-methods-private": "classPrivateMethods", - "class-static-fields-public": "classProperties", - "class-static-fields-private": "classPrivateProperties", - "class-static-methods-private": "classPrivateMethods", - "dynamic-import": "dynamicImport", - "export-star-as-namespace-from-module": "exportNamespaceFrom", - "import.meta": "importMeta", - "numeric-separator-literal": "numericSeparator", -}; - -function getPlugins(features) { - return ( - features && - features - .map(f => { - if (!featuresToPlugins[f] && !ignoredFeatures.includes(f)) { - unmappedFeatures.add(f); - } - return featuresToPlugins[f]; - }) - .filter(Boolean) - ); -} - -const unmappedFeatures = new Set(); - -exports.getUnmappedFeatures = function() { - return unmappedFeatures; -}; - -exports.getTests = function(testDir) { - const stream = new TestStream(testDir, { - omitRuntime: true, - }); - const tests = []; - - stream.on("data", test => { - // strip test/ - const fileName = test.file.substr(5); - - tests.push({ - contents: test.contents, - fileName, - id: `${fileName}(${test.scenario})`, - sourceType: test.attrs.flags.module ? "module" : "script", - plugins: getPlugins(test.attrs.features), - expectedError: - !!test.attrs.negative && - (test.attrs.negative.phase === "parse" || - test.attrs.negative.phase === "early"), - }); - }); - - return new Promise((resolve, reject) => { - stream.on("end", () => resolve(tests)); - stream.on("error", reject); - }); -}; - -exports.runTest = function(test) { - try { - parse(test.contents, { - sourceType: test.sourceType, - plugins: test.plugins, - }); - test.actualError = false; - } catch (err) { - test.actualError = true; - } - - test.result = test.expectedError !== test.actualError ? "fail" : "pass"; - - return test; -}; - -exports.getWhitelist = function(filename) { - return pfs.readFile(filename, "utf-8").then(function(contents) { - return contents - .split("\n") - .map(function(line) { - return line.replace(/#.*$/, "").trim(); - }) - .filter(function(line) { - return line.length > 0; - }) - .reduce(function(table, filename) { - table[filename] = true; - return table; - }, Object.create(null)); - }); -}; - -exports.updateWhitelist = function(filename, summary) { - return pfs.readFile(filename, "utf-8").then(function(contents) { - const toRemove = summary.disallowed.success - .concat(summary.disallowed.failure) - .map(function(test) { - return test.id; - }) - .concat(summary.unrecognized); - const toAdd = summary.disallowed.falsePositive - .concat(summary.disallowed.falseNegative) - .map(function(test) { - return test.id; - }); - const newContents = contents - .split("\n") - .map(function(line) { - const testId = line.replace(/#.*$/, "").trim(); - - if (toRemove.indexOf(testId) > -1) { - return null; - } - - return line; - }) - .filter(function(line) { - return line !== null && line !== ""; - }) - .concat(toAdd) - .sort() - .join("\n"); - - return pfs.writeFile(filename, newContents, "utf-8"); - }); -}; - -exports.interpret = function(results, whitelist) { - const summary = { - passed: true, - allowed: { - success: [], - failure: [], - falsePositive: [], - falseNegative: [], - }, - disallowed: { - success: [], - failure: [], - falsePositive: [], - falseNegative: [], - }, - unrecognized: null, - }; - - results.forEach(function(result) { - let classification, isAllowed; - const inWhitelist = result.id in whitelist; - delete whitelist[result.id]; - - if (!result.expectedError) { - if (!result.actualError) { - classification = "success"; - isAllowed = !inWhitelist; - } else { - classification = "falseNegative"; - isAllowed = inWhitelist; - } - } else { - if (!result.actualError) { - classification = "falsePositive"; - isAllowed = inWhitelist; - } else { - classification = "failure"; - isAllowed = !inWhitelist; - } - } - - summary.passed &= isAllowed; - summary[isAllowed ? "allowed" : "disallowed"][classification].push(result); - }); - - summary.unrecognized = Object.keys(whitelist); - summary.passed = !!summary.passed && summary.unrecognized.length === 0; - - return summary; -}; diff --git a/scripts/tests/test262/test262_whitelist.txt b/scripts/tests/test262/test262_whitelist.txt deleted file mode 100644 index b832b67af6ab..000000000000 --- a/scripts/tests/test262/test262_whitelist.txt +++ /dev/null @@ -1,682 +0,0 @@ -built-ins/RegExp/property-escapes/binary-property-with-value-ASCII_-_F-negated.js(default) -built-ins/RegExp/property-escapes/binary-property-with-value-ASCII_-_F-negated.js(strict mode) -built-ins/RegExp/property-escapes/binary-property-with-value-ASCII_-_F.js(default) -built-ins/RegExp/property-escapes/binary-property-with-value-ASCII_-_F.js(strict mode) -built-ins/RegExp/property-escapes/binary-property-with-value-ASCII_-_Invalid-negated.js(default) -built-ins/RegExp/property-escapes/binary-property-with-value-ASCII_-_Invalid-negated.js(strict mode) -built-ins/RegExp/property-escapes/binary-property-with-value-ASCII_-_Invalid.js(default) -built-ins/RegExp/property-escapes/binary-property-with-value-ASCII_-_Invalid.js(strict mode) -built-ins/RegExp/property-escapes/binary-property-with-value-ASCII_-_N-negated.js(default) -built-ins/RegExp/property-escapes/binary-property-with-value-ASCII_-_N-negated.js(strict mode) -built-ins/RegExp/property-escapes/binary-property-with-value-ASCII_-_N.js(default) -built-ins/RegExp/property-escapes/binary-property-with-value-ASCII_-_N.js(strict mode) -built-ins/RegExp/property-escapes/binary-property-with-value-ASCII_-_No-negated.js(default) -built-ins/RegExp/property-escapes/binary-property-with-value-ASCII_-_No-negated.js(strict mode) -built-ins/RegExp/property-escapes/binary-property-with-value-ASCII_-_No.js(default) -built-ins/RegExp/property-escapes/binary-property-with-value-ASCII_-_No.js(strict mode) -built-ins/RegExp/property-escapes/binary-property-with-value-ASCII_-_T-negated.js(default) -built-ins/RegExp/property-escapes/binary-property-with-value-ASCII_-_T-negated.js(strict mode) -built-ins/RegExp/property-escapes/binary-property-with-value-ASCII_-_T.js(default) -built-ins/RegExp/property-escapes/binary-property-with-value-ASCII_-_T.js(strict mode) -built-ins/RegExp/property-escapes/binary-property-with-value-ASCII_-_Y-negated.js(default) -built-ins/RegExp/property-escapes/binary-property-with-value-ASCII_-_Y-negated.js(strict mode) -built-ins/RegExp/property-escapes/binary-property-with-value-ASCII_-_Y.js(default) -built-ins/RegExp/property-escapes/binary-property-with-value-ASCII_-_Y.js(strict mode) -built-ins/RegExp/property-escapes/binary-property-with-value-ASCII_-_Yes-negated.js(default) -built-ins/RegExp/property-escapes/binary-property-with-value-ASCII_-_Yes-negated.js(strict mode) -built-ins/RegExp/property-escapes/binary-property-with-value-ASCII_-_Yes.js(default) -built-ins/RegExp/property-escapes/binary-property-with-value-ASCII_-_Yes.js(strict mode) -built-ins/RegExp/property-escapes/character-class-range-end.js(default) -built-ins/RegExp/property-escapes/character-class-range-end.js(strict mode) -built-ins/RegExp/property-escapes/character-class-range-no-dash-end.js(default) -built-ins/RegExp/property-escapes/character-class-range-no-dash-end.js(strict mode) -built-ins/RegExp/property-escapes/character-class-range-no-dash-start.js(default) -built-ins/RegExp/property-escapes/character-class-range-no-dash-start.js(strict mode) -built-ins/RegExp/property-escapes/character-class-range-start.js(default) -built-ins/RegExp/property-escapes/character-class-range-start.js(strict mode) -built-ins/RegExp/property-escapes/grammar-extension-In-prefix-Block-implicit-negated.js(default) -built-ins/RegExp/property-escapes/grammar-extension-In-prefix-Block-implicit-negated.js(strict mode) -built-ins/RegExp/property-escapes/grammar-extension-In-prefix-Block-implicit.js(default) -built-ins/RegExp/property-escapes/grammar-extension-In-prefix-Block-implicit.js(strict mode) -built-ins/RegExp/property-escapes/grammar-extension-In-prefix-Script-implicit-negated.js(default) -built-ins/RegExp/property-escapes/grammar-extension-In-prefix-Script-implicit-negated.js(strict mode) -built-ins/RegExp/property-escapes/grammar-extension-In-prefix-Script-implicit.js(default) -built-ins/RegExp/property-escapes/grammar-extension-In-prefix-Script-implicit.js(strict mode) -built-ins/RegExp/property-escapes/grammar-extension-In-prefix-Script-negated.js(default) -built-ins/RegExp/property-escapes/grammar-extension-In-prefix-Script-negated.js(strict mode) -built-ins/RegExp/property-escapes/grammar-extension-In-prefix-Script.js(default) -built-ins/RegExp/property-escapes/grammar-extension-In-prefix-Script.js(strict mode) -built-ins/RegExp/property-escapes/grammar-extension-Is-prefix-Script-negated.js(default) -built-ins/RegExp/property-escapes/grammar-extension-Is-prefix-Script-negated.js(strict mode) -built-ins/RegExp/property-escapes/grammar-extension-Is-prefix-Script.js(default) -built-ins/RegExp/property-escapes/grammar-extension-Is-prefix-Script.js(strict mode) -built-ins/RegExp/property-escapes/grammar-extension-circumflex-negation-negated.js(default) -built-ins/RegExp/property-escapes/grammar-extension-circumflex-negation-negated.js(strict mode) -built-ins/RegExp/property-escapes/grammar-extension-circumflex-negation.js(default) -built-ins/RegExp/property-escapes/grammar-extension-circumflex-negation.js(strict mode) -built-ins/RegExp/property-escapes/grammar-extension-empty-negated.js(default) -built-ins/RegExp/property-escapes/grammar-extension-empty-negated.js(strict mode) -built-ins/RegExp/property-escapes/grammar-extension-empty.js(default) -built-ins/RegExp/property-escapes/grammar-extension-empty.js(strict mode) -built-ins/RegExp/property-escapes/grammar-extension-invalid-negated.js(default) -built-ins/RegExp/property-escapes/grammar-extension-invalid-negated.js(strict mode) -built-ins/RegExp/property-escapes/grammar-extension-invalid.js(default) -built-ins/RegExp/property-escapes/grammar-extension-invalid.js(strict mode) -built-ins/RegExp/property-escapes/grammar-extension-no-braces-negated.js(default) -built-ins/RegExp/property-escapes/grammar-extension-no-braces-negated.js(strict mode) -built-ins/RegExp/property-escapes/grammar-extension-no-braces-value-negated.js(default) -built-ins/RegExp/property-escapes/grammar-extension-no-braces-value-negated.js(strict mode) -built-ins/RegExp/property-escapes/grammar-extension-no-braces-value.js(default) -built-ins/RegExp/property-escapes/grammar-extension-no-braces-value.js(strict mode) -built-ins/RegExp/property-escapes/grammar-extension-no-braces.js(default) -built-ins/RegExp/property-escapes/grammar-extension-no-braces.js(strict mode) -built-ins/RegExp/property-escapes/grammar-extension-separator-and-value-only-negated.js(default) -built-ins/RegExp/property-escapes/grammar-extension-separator-and-value-only-negated.js(strict mode) -built-ins/RegExp/property-escapes/grammar-extension-separator-and-value-only.js(default) -built-ins/RegExp/property-escapes/grammar-extension-separator-and-value-only.js(strict mode) -built-ins/RegExp/property-escapes/grammar-extension-separator-negated.js(default) -built-ins/RegExp/property-escapes/grammar-extension-separator-negated.js(strict mode) -built-ins/RegExp/property-escapes/grammar-extension-separator-only-negated.js(default) -built-ins/RegExp/property-escapes/grammar-extension-separator-only-negated.js(strict mode) -built-ins/RegExp/property-escapes/grammar-extension-separator-only.js(default) -built-ins/RegExp/property-escapes/grammar-extension-separator-only.js(strict mode) -built-ins/RegExp/property-escapes/grammar-extension-separator.js(default) -built-ins/RegExp/property-escapes/grammar-extension-separator.js(strict mode) -built-ins/RegExp/property-escapes/grammar-extension-unclosed-negated.js(default) -built-ins/RegExp/property-escapes/grammar-extension-unclosed-negated.js(strict mode) -built-ins/RegExp/property-escapes/grammar-extension-unclosed.js(default) -built-ins/RegExp/property-escapes/grammar-extension-unclosed.js(strict mode) -built-ins/RegExp/property-escapes/grammar-extension-unopened-negated.js(default) -built-ins/RegExp/property-escapes/grammar-extension-unopened-negated.js(strict mode) -built-ins/RegExp/property-escapes/grammar-extension-unopened.js(default) -built-ins/RegExp/property-escapes/grammar-extension-unopened.js(strict mode) -built-ins/RegExp/property-escapes/loose-matching-01-negated.js(default) -built-ins/RegExp/property-escapes/loose-matching-01-negated.js(strict mode) -built-ins/RegExp/property-escapes/loose-matching-01.js(default) -built-ins/RegExp/property-escapes/loose-matching-01.js(strict mode) -built-ins/RegExp/property-escapes/loose-matching-02-negated.js(default) -built-ins/RegExp/property-escapes/loose-matching-02-negated.js(strict mode) -built-ins/RegExp/property-escapes/loose-matching-02.js(default) -built-ins/RegExp/property-escapes/loose-matching-02.js(strict mode) -built-ins/RegExp/property-escapes/loose-matching-03-negated.js(default) -built-ins/RegExp/property-escapes/loose-matching-03-negated.js(strict mode) -built-ins/RegExp/property-escapes/loose-matching-03.js(default) -built-ins/RegExp/property-escapes/loose-matching-03.js(strict mode) -built-ins/RegExp/property-escapes/loose-matching-04-negated.js(default) -built-ins/RegExp/property-escapes/loose-matching-04-negated.js(strict mode) -built-ins/RegExp/property-escapes/loose-matching-04.js(default) -built-ins/RegExp/property-escapes/loose-matching-04.js(strict mode) -built-ins/RegExp/property-escapes/loose-matching-05-negated.js(default) -built-ins/RegExp/property-escapes/loose-matching-05-negated.js(strict mode) -built-ins/RegExp/property-escapes/loose-matching-05.js(default) -built-ins/RegExp/property-escapes/loose-matching-05.js(strict mode) -built-ins/RegExp/property-escapes/loose-matching-06-negated.js(default) -built-ins/RegExp/property-escapes/loose-matching-06-negated.js(strict mode) -built-ins/RegExp/property-escapes/loose-matching-06.js(default) -built-ins/RegExp/property-escapes/loose-matching-06.js(strict mode) -built-ins/RegExp/property-escapes/loose-matching-07-negated.js(default) -built-ins/RegExp/property-escapes/loose-matching-07-negated.js(strict mode) -built-ins/RegExp/property-escapes/loose-matching-07.js(default) -built-ins/RegExp/property-escapes/loose-matching-07.js(strict mode) -built-ins/RegExp/property-escapes/loose-matching-08-negated.js(default) -built-ins/RegExp/property-escapes/loose-matching-08-negated.js(strict mode) -built-ins/RegExp/property-escapes/loose-matching-08.js(default) -built-ins/RegExp/property-escapes/loose-matching-08.js(strict mode) -built-ins/RegExp/property-escapes/loose-matching-09-negated.js(default) -built-ins/RegExp/property-escapes/loose-matching-09-negated.js(strict mode) -built-ins/RegExp/property-escapes/loose-matching-09.js(default) -built-ins/RegExp/property-escapes/loose-matching-09.js(strict mode) -built-ins/RegExp/property-escapes/loose-matching-10-negated.js(default) -built-ins/RegExp/property-escapes/loose-matching-10-negated.js(strict mode) -built-ins/RegExp/property-escapes/loose-matching-10.js(default) -built-ins/RegExp/property-escapes/loose-matching-10.js(strict mode) -built-ins/RegExp/property-escapes/loose-matching-11-negated.js(default) -built-ins/RegExp/property-escapes/loose-matching-11-negated.js(strict mode) -built-ins/RegExp/property-escapes/loose-matching-11.js(default) -built-ins/RegExp/property-escapes/loose-matching-11.js(strict mode) -built-ins/RegExp/property-escapes/loose-matching-12-negated.js(default) -built-ins/RegExp/property-escapes/loose-matching-12-negated.js(strict mode) -built-ins/RegExp/property-escapes/loose-matching-12.js(default) -built-ins/RegExp/property-escapes/loose-matching-12.js(strict mode) -built-ins/RegExp/property-escapes/loose-matching-13-negated.js(default) -built-ins/RegExp/property-escapes/loose-matching-13-negated.js(strict mode) -built-ins/RegExp/property-escapes/loose-matching-13.js(default) -built-ins/RegExp/property-escapes/loose-matching-13.js(strict mode) -built-ins/RegExp/property-escapes/loose-matching-14-negated.js(default) -built-ins/RegExp/property-escapes/loose-matching-14-negated.js(strict mode) -built-ins/RegExp/property-escapes/loose-matching-14.js(default) -built-ins/RegExp/property-escapes/loose-matching-14.js(strict mode) -built-ins/RegExp/property-escapes/non-binary-property-without-value-General_Category-equals-negated.js(default) -built-ins/RegExp/property-escapes/non-binary-property-without-value-General_Category-equals-negated.js(strict mode) -built-ins/RegExp/property-escapes/non-binary-property-without-value-General_Category-equals.js(default) -built-ins/RegExp/property-escapes/non-binary-property-without-value-General_Category-equals.js(strict mode) -built-ins/RegExp/property-escapes/non-binary-property-without-value-General_Category-negated.js(default) -built-ins/RegExp/property-escapes/non-binary-property-without-value-General_Category-negated.js(strict mode) -built-ins/RegExp/property-escapes/non-binary-property-without-value-General_Category.js(default) -built-ins/RegExp/property-escapes/non-binary-property-without-value-General_Category.js(strict mode) -built-ins/RegExp/property-escapes/non-binary-property-without-value-Script-equals-negated.js(default) -built-ins/RegExp/property-escapes/non-binary-property-without-value-Script-equals-negated.js(strict mode) -built-ins/RegExp/property-escapes/non-binary-property-without-value-Script-equals.js(default) -built-ins/RegExp/property-escapes/non-binary-property-without-value-Script-equals.js(strict mode) -built-ins/RegExp/property-escapes/non-binary-property-without-value-Script-negated.js(default) -built-ins/RegExp/property-escapes/non-binary-property-without-value-Script-negated.js(strict mode) -built-ins/RegExp/property-escapes/non-binary-property-without-value-Script.js(default) -built-ins/RegExp/property-escapes/non-binary-property-without-value-Script.js(strict mode) -built-ins/RegExp/property-escapes/non-binary-property-without-value-Script_Extensions-equals-negated.js(default) -built-ins/RegExp/property-escapes/non-binary-property-without-value-Script_Extensions-equals-negated.js(strict mode) -built-ins/RegExp/property-escapes/non-binary-property-without-value-Script_Extensions-equals.js(default) -built-ins/RegExp/property-escapes/non-binary-property-without-value-Script_Extensions-equals.js(strict mode) -built-ins/RegExp/property-escapes/non-binary-property-without-value-Script_Extensions-negated.js(default) -built-ins/RegExp/property-escapes/non-binary-property-without-value-Script_Extensions-negated.js(strict mode) -built-ins/RegExp/property-escapes/non-binary-property-without-value-Script_Extensions.js(default) -built-ins/RegExp/property-escapes/non-binary-property-without-value-Script_Extensions.js(strict mode) -built-ins/RegExp/property-escapes/non-existent-binary-property-negated.js(default) -built-ins/RegExp/property-escapes/non-existent-binary-property-negated.js(strict mode) -built-ins/RegExp/property-escapes/non-existent-binary-property.js(default) -built-ins/RegExp/property-escapes/non-existent-binary-property.js(strict mode) -built-ins/RegExp/property-escapes/non-existent-property-and-value-negated.js(default) -built-ins/RegExp/property-escapes/non-existent-property-and-value-negated.js(strict mode) -built-ins/RegExp/property-escapes/non-existent-property-and-value.js(default) -built-ins/RegExp/property-escapes/non-existent-property-and-value.js(strict mode) -built-ins/RegExp/property-escapes/non-existent-property-existing-value-negated.js(default) -built-ins/RegExp/property-escapes/non-existent-property-existing-value-negated.js(strict mode) -built-ins/RegExp/property-escapes/non-existent-property-existing-value.js(default) -built-ins/RegExp/property-escapes/non-existent-property-existing-value.js(strict mode) -built-ins/RegExp/property-escapes/non-existent-property-value-General_Category-negated.js(default) -built-ins/RegExp/property-escapes/non-existent-property-value-General_Category-negated.js(strict mode) -built-ins/RegExp/property-escapes/non-existent-property-value-Script-negated.js(default) -built-ins/RegExp/property-escapes/non-existent-property-value-Script-negated.js(strict mode) -built-ins/RegExp/property-escapes/non-existent-property-value-Script.js(default) -built-ins/RegExp/property-escapes/non-existent-property-value-Script.js(strict mode) -built-ins/RegExp/property-escapes/non-existent-property-value-Script_Extensions-negated.js(default) -built-ins/RegExp/property-escapes/non-existent-property-value-Script_Extensions-negated.js(strict mode) -built-ins/RegExp/property-escapes/non-existent-property-value-Script_Extensions.js(default) -built-ins/RegExp/property-escapes/non-existent-property-value-Script_Extensions.js(strict mode) -built-ins/RegExp/property-escapes/non-existent-property-value-general-category.js(default) -built-ins/RegExp/property-escapes/non-existent-property-value-general-category.js(strict mode) -built-ins/RegExp/property-escapes/unsupported-binary-property-Composition_Exclusion-negated.js(default) -built-ins/RegExp/property-escapes/unsupported-binary-property-Composition_Exclusion-negated.js(strict mode) -built-ins/RegExp/property-escapes/unsupported-binary-property-Composition_Exclusion.js(default) -built-ins/RegExp/property-escapes/unsupported-binary-property-Composition_Exclusion.js(strict mode) -built-ins/RegExp/property-escapes/unsupported-binary-property-Expands_On_NFC-negated.js(default) -built-ins/RegExp/property-escapes/unsupported-binary-property-Expands_On_NFC-negated.js(strict mode) -built-ins/RegExp/property-escapes/unsupported-binary-property-Expands_On_NFC.js(default) -built-ins/RegExp/property-escapes/unsupported-binary-property-Expands_On_NFC.js(strict mode) -built-ins/RegExp/property-escapes/unsupported-binary-property-Expands_On_NFD-negated.js(default) -built-ins/RegExp/property-escapes/unsupported-binary-property-Expands_On_NFD-negated.js(strict mode) -built-ins/RegExp/property-escapes/unsupported-binary-property-Expands_On_NFD.js(default) -built-ins/RegExp/property-escapes/unsupported-binary-property-Expands_On_NFD.js(strict mode) -built-ins/RegExp/property-escapes/unsupported-binary-property-Expands_On_NFKC-negated.js(default) -built-ins/RegExp/property-escapes/unsupported-binary-property-Expands_On_NFKC-negated.js(strict mode) -built-ins/RegExp/property-escapes/unsupported-binary-property-Expands_On_NFKC.js(default) -built-ins/RegExp/property-escapes/unsupported-binary-property-Expands_On_NFKC.js(strict mode) -built-ins/RegExp/property-escapes/unsupported-binary-property-Expands_On_NFKD-negated.js(default) -built-ins/RegExp/property-escapes/unsupported-binary-property-Expands_On_NFKD-negated.js(strict mode) -built-ins/RegExp/property-escapes/unsupported-binary-property-Expands_On_NFKD.js(default) -built-ins/RegExp/property-escapes/unsupported-binary-property-Expands_On_NFKD.js(strict mode) -built-ins/RegExp/property-escapes/unsupported-binary-property-FC_NFKC_Closure-negated.js(default) -built-ins/RegExp/property-escapes/unsupported-binary-property-FC_NFKC_Closure-negated.js(strict mode) -built-ins/RegExp/property-escapes/unsupported-binary-property-FC_NFKC_Closure.js(default) -built-ins/RegExp/property-escapes/unsupported-binary-property-FC_NFKC_Closure.js(strict mode) -built-ins/RegExp/property-escapes/unsupported-binary-property-Full_Composition_Exclusion-negated.js(default) -built-ins/RegExp/property-escapes/unsupported-binary-property-Full_Composition_Exclusion-negated.js(strict mode) -built-ins/RegExp/property-escapes/unsupported-binary-property-Full_Composition_Exclusion.js(default) -built-ins/RegExp/property-escapes/unsupported-binary-property-Full_Composition_Exclusion.js(strict mode) -built-ins/RegExp/property-escapes/unsupported-binary-property-Grapheme_Link-negated.js(default) -built-ins/RegExp/property-escapes/unsupported-binary-property-Grapheme_Link-negated.js(strict mode) -built-ins/RegExp/property-escapes/unsupported-binary-property-Grapheme_Link.js(default) -built-ins/RegExp/property-escapes/unsupported-binary-property-Grapheme_Link.js(strict mode) -built-ins/RegExp/property-escapes/unsupported-binary-property-Hyphen-negated.js(default) -built-ins/RegExp/property-escapes/unsupported-binary-property-Hyphen-negated.js(strict mode) -built-ins/RegExp/property-escapes/unsupported-binary-property-Hyphen.js(default) -built-ins/RegExp/property-escapes/unsupported-binary-property-Hyphen.js(strict mode) -built-ins/RegExp/property-escapes/unsupported-binary-property-Other_Alphabetic-negated.js(default) -built-ins/RegExp/property-escapes/unsupported-binary-property-Other_Alphabetic-negated.js(strict mode) -built-ins/RegExp/property-escapes/unsupported-binary-property-Other_Alphabetic.js(default) -built-ins/RegExp/property-escapes/unsupported-binary-property-Other_Alphabetic.js(strict mode) -built-ins/RegExp/property-escapes/unsupported-binary-property-Other_Default_Ignorable_Code_Point-negated.js(default) -built-ins/RegExp/property-escapes/unsupported-binary-property-Other_Default_Ignorable_Code_Point-negated.js(strict mode) -built-ins/RegExp/property-escapes/unsupported-binary-property-Other_Default_Ignorable_Code_Point.js(default) -built-ins/RegExp/property-escapes/unsupported-binary-property-Other_Default_Ignorable_Code_Point.js(strict mode) -built-ins/RegExp/property-escapes/unsupported-binary-property-Other_Grapheme_Extend-negated.js(default) -built-ins/RegExp/property-escapes/unsupported-binary-property-Other_Grapheme_Extend-negated.js(strict mode) -built-ins/RegExp/property-escapes/unsupported-binary-property-Other_Grapheme_Extend.js(default) -built-ins/RegExp/property-escapes/unsupported-binary-property-Other_Grapheme_Extend.js(strict mode) -built-ins/RegExp/property-escapes/unsupported-binary-property-Other_ID_Continue-negated.js(default) -built-ins/RegExp/property-escapes/unsupported-binary-property-Other_ID_Continue-negated.js(strict mode) -built-ins/RegExp/property-escapes/unsupported-binary-property-Other_ID_Continue.js(default) -built-ins/RegExp/property-escapes/unsupported-binary-property-Other_ID_Continue.js(strict mode) -built-ins/RegExp/property-escapes/unsupported-binary-property-Other_ID_Start-negated.js(default) -built-ins/RegExp/property-escapes/unsupported-binary-property-Other_ID_Start-negated.js(strict mode) -built-ins/RegExp/property-escapes/unsupported-binary-property-Other_ID_Start.js(default) -built-ins/RegExp/property-escapes/unsupported-binary-property-Other_ID_Start.js(strict mode) -built-ins/RegExp/property-escapes/unsupported-binary-property-Other_Lowercase-negated.js(default) -built-ins/RegExp/property-escapes/unsupported-binary-property-Other_Lowercase-negated.js(strict mode) -built-ins/RegExp/property-escapes/unsupported-binary-property-Other_Lowercase.js(default) -built-ins/RegExp/property-escapes/unsupported-binary-property-Other_Lowercase.js(strict mode) -built-ins/RegExp/property-escapes/unsupported-binary-property-Other_Math-negated.js(default) -built-ins/RegExp/property-escapes/unsupported-binary-property-Other_Math-negated.js(strict mode) -built-ins/RegExp/property-escapes/unsupported-binary-property-Other_Math.js(default) -built-ins/RegExp/property-escapes/unsupported-binary-property-Other_Math.js(strict mode) -built-ins/RegExp/property-escapes/unsupported-binary-property-Other_Uppercase-negated.js(default) -built-ins/RegExp/property-escapes/unsupported-binary-property-Other_Uppercase-negated.js(strict mode) -built-ins/RegExp/property-escapes/unsupported-binary-property-Other_Uppercase.js(default) -built-ins/RegExp/property-escapes/unsupported-binary-property-Other_Uppercase.js(strict mode) -built-ins/RegExp/property-escapes/unsupported-binary-property-Prepended_Concatenation_Mark-negated.js(default) -built-ins/RegExp/property-escapes/unsupported-binary-property-Prepended_Concatenation_Mark-negated.js(strict mode) -built-ins/RegExp/property-escapes/unsupported-binary-property-Prepended_Concatenation_Mark.js(default) -built-ins/RegExp/property-escapes/unsupported-binary-property-Prepended_Concatenation_Mark.js(strict mode) -built-ins/RegExp/property-escapes/unsupported-property-Block-with-value-negated.js(default) -built-ins/RegExp/property-escapes/unsupported-property-Block-with-value-negated.js(strict mode) -built-ins/RegExp/property-escapes/unsupported-property-Block-with-value.js(default) -built-ins/RegExp/property-escapes/unsupported-property-Block-with-value.js(strict mode) -built-ins/RegExp/property-escapes/unsupported-property-FC_NFKC_Closure-negated.js(default) -built-ins/RegExp/property-escapes/unsupported-property-FC_NFKC_Closure-negated.js(strict mode) -built-ins/RegExp/property-escapes/unsupported-property-FC_NFKC_Closure.js(default) -built-ins/RegExp/property-escapes/unsupported-property-FC_NFKC_Closure.js(strict mode) -built-ins/RegExp/property-escapes/unsupported-property-Line_Break-negated.js(default) -built-ins/RegExp/property-escapes/unsupported-property-Line_Break-negated.js(strict mode) -built-ins/RegExp/property-escapes/unsupported-property-Line_Break-with-value-negated.js(default) -built-ins/RegExp/property-escapes/unsupported-property-Line_Break-with-value-negated.js(strict mode) -built-ins/RegExp/property-escapes/unsupported-property-Line_Break-with-value.js(default) -built-ins/RegExp/property-escapes/unsupported-property-Line_Break-with-value.js(strict mode) -built-ins/RegExp/property-escapes/unsupported-property-Line_Break.js(default) -built-ins/RegExp/property-escapes/unsupported-property-Line_Break.js(strict mode) -language/comments/hashbang/escaped-bang-041.js(default) -language/comments/hashbang/escaped-bang-u0021.js(default) -language/comments/hashbang/escaped-bang-u21.js(default) -language/comments/hashbang/escaped-bang-x21.js(default) -language/comments/hashbang/escaped-hash-043.js(default) -language/comments/hashbang/escaped-hash-u0023.js(default) -language/comments/hashbang/escaped-hash-u23.js(default) -language/comments/hashbang/escaped-hash-x23.js(default) -language/comments/hashbang/escaped-hashbang.js(default) -language/comments/hashbang/multi-line-comment.js(default) -language/comments/hashbang/preceding-directive-prologue-sc.js(default) -language/comments/hashbang/preceding-directive-prologue.js(default) -language/comments/hashbang/preceding-empty-statement.js(default) -language/comments/hashbang/preceding-hashbang.js(default) -language/comments/hashbang/preceding-line-comment.js(default) -language/comments/hashbang/preceding-multi-line-comment.js(default) -language/comments/hashbang/preceding-whitespace.js(default) -language/expressions/assignment/destructuring/obj-prop-__proto__dup.js(default) -language/expressions/assignment/destructuring/obj-prop-__proto__dup.js(strict mode) -language/expressions/async-arrow-function/await-as-param-ident-nested-arrow-parameter-position.js(default) -language/expressions/async-arrow-function/await-as-param-ident-nested-arrow-parameter-position.js(strict mode) -language/expressions/async-arrow-function/await-as-param-nested-arrow-parameter-position.js(default) -language/expressions/async-arrow-function/await-as-param-nested-arrow-parameter-position.js(strict mode) -language/expressions/async-arrow-function/await-as-param-rest-nested-arrow-parameter-position.js(default) -language/expressions/async-arrow-function/await-as-param-rest-nested-arrow-parameter-position.js(strict mode) -language/expressions/async-arrow-function/early-errors-arrow-await-in-formals-default.js(default) -language/expressions/async-arrow-function/early-errors-arrow-await-in-formals-default.js(strict mode) -language/expressions/async-arrow-function/early-errors-arrow-await-in-formals.js(default) -language/expressions/async-arrow-function/early-errors-arrow-await-in-formals.js(strict mode) -language/expressions/class/elements/fields-duplicate-privatenames.js(default) -language/expressions/class/elements/fields-duplicate-privatenames.js(strict mode) -language/expressions/class/elements/fields-literal-name-static-propname-constructor.js(default) -language/expressions/class/elements/fields-literal-name-static-propname-constructor.js(strict mode) -language/expressions/class/elements/fields-string-name-static-propname-constructor.js(default) -language/expressions/class/elements/fields-string-name-static-propname-constructor.js(strict mode) -language/expressions/class/elements/private-methods/prod-private-method-initialize-order.js(default) -language/expressions/class/elements/private-methods/prod-private-method-initialize-order.js(strict mode) -language/expressions/class/elements/syntax/early-errors/grammar-private-field-on-object-destructuring.js(default) -language/expressions/class/elements/syntax/early-errors/grammar-private-field-on-object-destructuring.js(strict mode) -language/expressions/class/elements/syntax/early-errors/grammar-privatemeth-duplicate-get-field.js(default) -language/expressions/class/elements/syntax/early-errors/grammar-privatemeth-duplicate-get-field.js(strict mode) -language/expressions/class/elements/syntax/early-errors/grammar-privatemeth-duplicate-get-get.js(default) -language/expressions/class/elements/syntax/early-errors/grammar-privatemeth-duplicate-get-get.js(strict mode) -language/expressions/class/elements/syntax/early-errors/grammar-privatemeth-duplicate-meth-field.js(default) -language/expressions/class/elements/syntax/early-errors/grammar-privatemeth-duplicate-meth-field.js(strict mode) -language/expressions/class/elements/syntax/early-errors/grammar-privatemeth-duplicate-meth-get.js(default) -language/expressions/class/elements/syntax/early-errors/grammar-privatemeth-duplicate-meth-get.js(strict mode) -language/expressions/class/elements/syntax/early-errors/grammar-privatemeth-duplicate-meth-meth.js(default) -language/expressions/class/elements/syntax/early-errors/grammar-privatemeth-duplicate-meth-meth.js(strict mode) -language/expressions/class/elements/syntax/early-errors/grammar-privatemeth-duplicate-meth-set.js(default) -language/expressions/class/elements/syntax/early-errors/grammar-privatemeth-duplicate-meth-set.js(strict mode) -language/expressions/class/elements/syntax/early-errors/grammar-privatemeth-duplicate-meth-staticfield.js(default) -language/expressions/class/elements/syntax/early-errors/grammar-privatemeth-duplicate-meth-staticfield.js(strict mode) -language/expressions/class/elements/syntax/early-errors/grammar-privatemeth-duplicate-meth-staticmeth.js(default) -language/expressions/class/elements/syntax/early-errors/grammar-privatemeth-duplicate-meth-staticmeth.js(strict mode) -language/expressions/class/elements/syntax/early-errors/grammar-privatemeth-duplicate-set-field.js(default) -language/expressions/class/elements/syntax/early-errors/grammar-privatemeth-duplicate-set-field.js(strict mode) -language/expressions/class/elements/syntax/early-errors/grammar-privatemeth-duplicate-set-set.js(default) -language/expressions/class/elements/syntax/early-errors/grammar-privatemeth-duplicate-set-set.js(strict mode) -language/expressions/class/elements/syntax/early-errors/invalid-names/field-init-call-expression-bad-reference.js(default) -language/expressions/class/elements/syntax/early-errors/invalid-names/field-init-call-expression-bad-reference.js(strict mode) -language/expressions/class/elements/syntax/early-errors/invalid-names/field-init-call-expression-this.js(default) -language/expressions/class/elements/syntax/early-errors/invalid-names/field-init-call-expression-this.js(strict mode) -language/expressions/class/elements/syntax/early-errors/invalid-names/field-init-fn-call-expression-bad-reference.js(default) -language/expressions/class/elements/syntax/early-errors/invalid-names/field-init-fn-call-expression-bad-reference.js(strict mode) -language/expressions/class/elements/syntax/early-errors/invalid-names/field-init-fn-call-expression-this.js(default) -language/expressions/class/elements/syntax/early-errors/invalid-names/field-init-fn-call-expression-this.js(strict mode) -language/expressions/class/elements/syntax/early-errors/invalid-names/field-init-fn-member-expression-bad-reference.js(default) -language/expressions/class/elements/syntax/early-errors/invalid-names/field-init-fn-member-expression-bad-reference.js(strict mode) -language/expressions/class/elements/syntax/early-errors/invalid-names/field-init-fn-member-expression-this.js(default) -language/expressions/class/elements/syntax/early-errors/invalid-names/field-init-fn-member-expression-this.js(strict mode) -language/expressions/class/elements/syntax/early-errors/invalid-names/field-init-member-expression-bad-reference.js(default) -language/expressions/class/elements/syntax/early-errors/invalid-names/field-init-member-expression-bad-reference.js(strict mode) -language/expressions/class/elements/syntax/early-errors/invalid-names/field-init-member-expression-this.js(default) -language/expressions/class/elements/syntax/early-errors/invalid-names/field-init-member-expression-this.js(strict mode) -language/expressions/class/elements/syntax/early-errors/invalid-names/method-call-expression-bad-reference.js(default) -language/expressions/class/elements/syntax/early-errors/invalid-names/method-call-expression-bad-reference.js(strict mode) -language/expressions/class/elements/syntax/early-errors/invalid-names/method-call-expression-this.js(default) -language/expressions/class/elements/syntax/early-errors/invalid-names/method-call-expression-this.js(strict mode) -language/expressions/class/elements/syntax/early-errors/invalid-names/method-fn-call-expression-bad-reference.js(default) -language/expressions/class/elements/syntax/early-errors/invalid-names/method-fn-call-expression-bad-reference.js(strict mode) -language/expressions/class/elements/syntax/early-errors/invalid-names/method-fn-call-expression-this.js(default) -language/expressions/class/elements/syntax/early-errors/invalid-names/method-fn-call-expression-this.js(strict mode) -language/expressions/class/elements/syntax/early-errors/invalid-names/method-fn-member-expression-bad-reference.js(default) -language/expressions/class/elements/syntax/early-errors/invalid-names/method-fn-member-expression-bad-reference.js(strict mode) -language/expressions/class/elements/syntax/early-errors/invalid-names/method-fn-member-expression-this.js(default) -language/expressions/class/elements/syntax/early-errors/invalid-names/method-fn-member-expression-this.js(strict mode) -language/expressions/class/elements/syntax/early-errors/invalid-names/method-heritage-call-expression-bad-reference.js(default) -language/expressions/class/elements/syntax/early-errors/invalid-names/method-heritage-call-expression-bad-reference.js(strict mode) -language/expressions/class/elements/syntax/early-errors/invalid-names/method-heritage-call-expression-this.js(default) -language/expressions/class/elements/syntax/early-errors/invalid-names/method-heritage-call-expression-this.js(strict mode) -language/expressions/class/elements/syntax/early-errors/invalid-names/method-heritage-member-expression-bad-reference.js(default) -language/expressions/class/elements/syntax/early-errors/invalid-names/method-heritage-member-expression-bad-reference.js(strict mode) -language/expressions/class/elements/syntax/early-errors/invalid-names/method-heritage-member-expression-this.js(default) -language/expressions/class/elements/syntax/early-errors/invalid-names/method-heritage-member-expression-this.js(strict mode) -language/expressions/class/elements/syntax/early-errors/invalid-names/method-member-expression-bad-reference.js(default) -language/expressions/class/elements/syntax/early-errors/invalid-names/method-member-expression-bad-reference.js(strict mode) -language/expressions/class/elements/syntax/early-errors/invalid-names/method-member-expression-this.js(default) -language/expressions/class/elements/syntax/early-errors/invalid-names/method-member-expression-this.js(strict mode) -language/expressions/class/elements/syntax/early-errors/invalid-names/method-outter-call-expression-bad-reference.js(default) -language/expressions/class/elements/syntax/early-errors/invalid-names/method-outter-call-expression-bad-reference.js(strict mode) -language/expressions/class/elements/syntax/early-errors/invalid-names/method-outter-call-expression-this.js(default) -language/expressions/class/elements/syntax/early-errors/invalid-names/method-outter-call-expression-this.js(strict mode) -language/expressions/class/elements/syntax/early-errors/invalid-names/method-outter-member-expression-bad-reference.js(default) -language/expressions/class/elements/syntax/early-errors/invalid-names/method-outter-member-expression-bad-reference.js(strict mode) -language/expressions/class/elements/syntax/early-errors/invalid-names/method-outter-member-expression-this.js(default) -language/expressions/class/elements/syntax/early-errors/invalid-names/method-outter-member-expression-this.js(strict mode) -language/expressions/class/elements/syntax/early-errors/super-private-access-invalid.js(default) -language/expressions/class/elements/syntax/early-errors/super-private-access-invalid.js(strict mode) -language/expressions/object/method-definition/private-name-early-error-async-gen-inside-class.js(default) -language/expressions/object/method-definition/private-name-early-error-async-gen-inside-class.js(strict mode) -language/expressions/object/method-definition/private-name-early-error-gen-inside-class.js(default) -language/expressions/object/method-definition/private-name-early-error-gen-inside-class.js(strict mode) -language/expressions/object/method-definition/private-name-early-error-method-inside-class.js(default) -language/expressions/object/method-definition/private-name-early-error-method-inside-class.js(strict mode) -language/expressions/template-literal/unicode-escape-nls-err.js(default) -language/expressions/template-literal/unicode-escape-nls-err.js(strict mode) -language/identifiers/unicode-escape-nls-err.js(default) -language/identifiers/unicode-escape-nls-err.js(strict mode) -language/literals/numeric/numeric-separator-literal-nzd-nsl-dds-leading-zero-err.js(default) -language/literals/regexp/early-err-pattern.js(default) -language/literals/regexp/early-err-pattern.js(strict mode) -language/literals/regexp/invalid-braced-quantifier-exact.js(default) -language/literals/regexp/invalid-braced-quantifier-exact.js(strict mode) -language/literals/regexp/invalid-braced-quantifier-lower.js(default) -language/literals/regexp/invalid-braced-quantifier-lower.js(strict mode) -language/literals/regexp/invalid-braced-quantifier-range.js(default) -language/literals/regexp/invalid-braced-quantifier-range.js(strict mode) -language/literals/regexp/invalid-optional-lookbehind.js(default) -language/literals/regexp/invalid-optional-lookbehind.js(strict mode) -language/literals/regexp/invalid-optional-negative-lookbehind.js(default) -language/literals/regexp/invalid-optional-negative-lookbehind.js(strict mode) -language/literals/regexp/invalid-range-lookbehind.js(default) -language/literals/regexp/invalid-range-lookbehind.js(strict mode) -language/literals/regexp/invalid-range-negative-lookbehind.js(default) -language/literals/regexp/invalid-range-negative-lookbehind.js(strict mode) -language/literals/regexp/named-groups/invalid-dangling-groupname-2-u.js(default) -language/literals/regexp/named-groups/invalid-dangling-groupname-2-u.js(strict mode) -language/literals/regexp/named-groups/invalid-dangling-groupname-2.js(default) -language/literals/regexp/named-groups/invalid-dangling-groupname-2.js(strict mode) -language/literals/regexp/named-groups/invalid-dangling-groupname-3-u.js(default) -language/literals/regexp/named-groups/invalid-dangling-groupname-3-u.js(strict mode) -language/literals/regexp/named-groups/invalid-dangling-groupname-3.js(default) -language/literals/regexp/named-groups/invalid-dangling-groupname-3.js(strict mode) -language/literals/regexp/named-groups/invalid-dangling-groupname-4-u.js(default) -language/literals/regexp/named-groups/invalid-dangling-groupname-4-u.js(strict mode) -language/literals/regexp/named-groups/invalid-dangling-groupname-4.js(default) -language/literals/regexp/named-groups/invalid-dangling-groupname-4.js(strict mode) -language/literals/regexp/named-groups/invalid-dangling-groupname-5.js(default) -language/literals/regexp/named-groups/invalid-dangling-groupname-5.js(strict mode) -language/literals/regexp/named-groups/invalid-dangling-groupname-u.js(default) -language/literals/regexp/named-groups/invalid-dangling-groupname-u.js(strict mode) -language/literals/regexp/named-groups/invalid-dangling-groupname-without-group-u.js(default) -language/literals/regexp/named-groups/invalid-dangling-groupname-without-group-u.js(strict mode) -language/literals/regexp/named-groups/invalid-dangling-groupname.js(default) -language/literals/regexp/named-groups/invalid-dangling-groupname.js(strict mode) -language/literals/regexp/named-groups/invalid-duplicate-groupspecifier-2-u.js(default) -language/literals/regexp/named-groups/invalid-duplicate-groupspecifier-2-u.js(strict mode) -language/literals/regexp/named-groups/invalid-duplicate-groupspecifier-2.js(default) -language/literals/regexp/named-groups/invalid-duplicate-groupspecifier-2.js(strict mode) -language/literals/regexp/named-groups/invalid-duplicate-groupspecifier-u.js(default) -language/literals/regexp/named-groups/invalid-duplicate-groupspecifier-u.js(strict mode) -language/literals/regexp/named-groups/invalid-duplicate-groupspecifier.js(default) -language/literals/regexp/named-groups/invalid-duplicate-groupspecifier.js(strict mode) -language/literals/regexp/named-groups/invalid-empty-groupspecifier-u.js(default) -language/literals/regexp/named-groups/invalid-empty-groupspecifier-u.js(strict mode) -language/literals/regexp/named-groups/invalid-empty-groupspecifier.js(default) -language/literals/regexp/named-groups/invalid-empty-groupspecifier.js(strict mode) -language/literals/regexp/named-groups/invalid-identity-escape-in-capture-u.js(default) -language/literals/regexp/named-groups/invalid-identity-escape-in-capture-u.js(strict mode) -language/literals/regexp/named-groups/invalid-incomplete-groupname-2-u.js(default) -language/literals/regexp/named-groups/invalid-incomplete-groupname-2-u.js(strict mode) -language/literals/regexp/named-groups/invalid-incomplete-groupname-2.js(default) -language/literals/regexp/named-groups/invalid-incomplete-groupname-2.js(strict mode) -language/literals/regexp/named-groups/invalid-incomplete-groupname-3-u.js(default) -language/literals/regexp/named-groups/invalid-incomplete-groupname-3-u.js(strict mode) -language/literals/regexp/named-groups/invalid-incomplete-groupname-3.js(default) -language/literals/regexp/named-groups/invalid-incomplete-groupname-3.js(strict mode) -language/literals/regexp/named-groups/invalid-incomplete-groupname-4.js(default) -language/literals/regexp/named-groups/invalid-incomplete-groupname-4.js(strict mode) -language/literals/regexp/named-groups/invalid-incomplete-groupname-5.js(default) -language/literals/regexp/named-groups/invalid-incomplete-groupname-5.js(strict mode) -language/literals/regexp/named-groups/invalid-incomplete-groupname-6.js(default) -language/literals/regexp/named-groups/invalid-incomplete-groupname-6.js(strict mode) -language/literals/regexp/named-groups/invalid-incomplete-groupname-u.js(default) -language/literals/regexp/named-groups/invalid-incomplete-groupname-u.js(strict mode) -language/literals/regexp/named-groups/invalid-incomplete-groupname-without-group-2-u.js(default) -language/literals/regexp/named-groups/invalid-incomplete-groupname-without-group-2-u.js(strict mode) -language/literals/regexp/named-groups/invalid-incomplete-groupname-without-group-3-u.js(default) -language/literals/regexp/named-groups/invalid-incomplete-groupname-without-group-3-u.js(strict mode) -language/literals/regexp/named-groups/invalid-incomplete-groupname-without-group-u.js(default) -language/literals/regexp/named-groups/invalid-incomplete-groupname-without-group-u.js(strict mode) -language/literals/regexp/named-groups/invalid-incomplete-groupname.js(default) -language/literals/regexp/named-groups/invalid-incomplete-groupname.js(strict mode) -language/literals/regexp/named-groups/invalid-non-id-continue-groupspecifier-4-u.js(default) -language/literals/regexp/named-groups/invalid-non-id-continue-groupspecifier-4-u.js(strict mode) -language/literals/regexp/named-groups/invalid-non-id-continue-groupspecifier-4.js(default) -language/literals/regexp/named-groups/invalid-non-id-continue-groupspecifier-4.js(strict mode) -language/literals/regexp/named-groups/invalid-non-id-continue-groupspecifier.js(default) -language/literals/regexp/named-groups/invalid-non-id-continue-groupspecifier.js(strict mode) -language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-2-u.js(default) -language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-2-u.js(strict mode) -language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-2.js(default) -language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-2.js(strict mode) -language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-3.js(default) -language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-3.js(strict mode) -language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-4-u.js(default) -language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-4-u.js(strict mode) -language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-4.js(default) -language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-4.js(strict mode) -language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-5-u.js(default) -language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-5-u.js(strict mode) -language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-5.js(default) -language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-5.js(strict mode) -language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-6.js(default) -language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-6.js(strict mode) -language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-7.js(default) -language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-7.js(strict mode) -language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-8-u.js(default) -language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-8-u.js(strict mode) -language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-8.js(default) -language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-8.js(strict mode) -language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-9-u.js(default) -language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-9-u.js(strict mode) -language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-u.js(default) -language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-u.js(strict mode) -language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier.js(default) -language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier.js(strict mode) -language/literals/regexp/named-groups/invalid-numeric-groupspecifier-u.js(default) -language/literals/regexp/named-groups/invalid-numeric-groupspecifier-u.js(strict mode) -language/literals/regexp/named-groups/invalid-numeric-groupspecifier.js(default) -language/literals/regexp/named-groups/invalid-numeric-groupspecifier.js(strict mode) -language/literals/regexp/named-groups/invalid-punctuator-starting-groupspecifier-u.js(default) -language/literals/regexp/named-groups/invalid-punctuator-starting-groupspecifier-u.js(strict mode) -language/literals/regexp/named-groups/invalid-punctuator-starting-groupspecifier.js(default) -language/literals/regexp/named-groups/invalid-punctuator-starting-groupspecifier.js(strict mode) -language/literals/regexp/named-groups/invalid-punctuator-within-groupspecifier-u.js(default) -language/literals/regexp/named-groups/invalid-punctuator-within-groupspecifier-u.js(strict mode) -language/literals/regexp/named-groups/invalid-punctuator-within-groupspecifier.js(default) -language/literals/regexp/named-groups/invalid-punctuator-within-groupspecifier.js(strict mode) -language/literals/regexp/named-groups/invalid-u-escape-in-groupspecifier-2.js(default) -language/literals/regexp/named-groups/invalid-u-escape-in-groupspecifier-2.js(strict mode) -language/literals/regexp/named-groups/invalid-u-escape-in-groupspecifier.js(default) -language/literals/regexp/named-groups/invalid-u-escape-in-groupspecifier.js(strict mode) -language/literals/regexp/named-groups/invalid-unterminated-groupspecifier-u.js(default) -language/literals/regexp/named-groups/invalid-unterminated-groupspecifier-u.js(strict mode) -language/literals/regexp/named-groups/invalid-unterminated-groupspecifier.js(default) -language/literals/regexp/named-groups/invalid-unterminated-groupspecifier.js(strict mode) -language/literals/regexp/u-dec-esc.js(default) -language/literals/regexp/u-dec-esc.js(strict mode) -language/literals/regexp/u-invalid-class-escape.js(default) -language/literals/regexp/u-invalid-class-escape.js(strict mode) -language/literals/regexp/u-invalid-extended-pattern-char.js(default) -language/literals/regexp/u-invalid-extended-pattern-char.js(strict mode) -language/literals/regexp/u-invalid-identity-escape.js(default) -language/literals/regexp/u-invalid-identity-escape.js(strict mode) -language/literals/regexp/u-invalid-legacy-octal-escape.js(default) -language/literals/regexp/u-invalid-legacy-octal-escape.js(strict mode) -language/literals/regexp/u-invalid-non-empty-class-ranges-no-dash-a.js(default) -language/literals/regexp/u-invalid-non-empty-class-ranges-no-dash-a.js(strict mode) -language/literals/regexp/u-invalid-non-empty-class-ranges-no-dash-ab.js(default) -language/literals/regexp/u-invalid-non-empty-class-ranges-no-dash-ab.js(strict mode) -language/literals/regexp/u-invalid-non-empty-class-ranges-no-dash-b.js(default) -language/literals/regexp/u-invalid-non-empty-class-ranges-no-dash-b.js(strict mode) -language/literals/regexp/u-invalid-non-empty-class-ranges.js(default) -language/literals/regexp/u-invalid-non-empty-class-ranges.js(strict mode) -language/literals/regexp/u-invalid-oob-decimal-escape.js(default) -language/literals/regexp/u-invalid-oob-decimal-escape.js(strict mode) -language/literals/regexp/u-invalid-optional-lookahead.js(default) -language/literals/regexp/u-invalid-optional-lookahead.js(strict mode) -language/literals/regexp/u-invalid-optional-lookbehind.js(default) -language/literals/regexp/u-invalid-optional-lookbehind.js(strict mode) -language/literals/regexp/u-invalid-optional-negative-lookahead.js(default) -language/literals/regexp/u-invalid-optional-negative-lookahead.js(strict mode) -language/literals/regexp/u-invalid-optional-negative-lookbehind.js(default) -language/literals/regexp/u-invalid-optional-negative-lookbehind.js(strict mode) -language/literals/regexp/u-invalid-range-lookahead.js(default) -language/literals/regexp/u-invalid-range-lookahead.js(strict mode) -language/literals/regexp/u-invalid-range-lookbehind.js(default) -language/literals/regexp/u-invalid-range-lookbehind.js(strict mode) -language/literals/regexp/u-invalid-range-negative-lookahead.js(default) -language/literals/regexp/u-invalid-range-negative-lookahead.js(strict mode) -language/literals/regexp/u-invalid-range-negative-lookbehind.js(default) -language/literals/regexp/u-invalid-range-negative-lookbehind.js(strict mode) -language/literals/regexp/u-unicode-esc-bounds.js(default) -language/literals/regexp/u-unicode-esc-bounds.js(strict mode) -language/literals/regexp/u-unicode-esc-non-hex.js(default) -language/literals/regexp/u-unicode-esc-non-hex.js(strict mode) -language/literals/regexp/unicode-escape-nls-err.js(default) -language/literals/regexp/unicode-escape-nls-err.js(strict mode) -language/literals/string/unicode-escape-nls-err-double.js(default) -language/literals/string/unicode-escape-nls-err-double.js(strict mode) -language/literals/string/unicode-escape-nls-err-single.js(default) -language/literals/string/unicode-escape-nls-err-single.js(strict mode) -language/module-code/privatename-not-valid-earlyerr-module-1.js(default) -language/module-code/privatename-not-valid-earlyerr-module-1.js(strict mode) -language/module-code/privatename-not-valid-earlyerr-module-2.js(default) -language/module-code/privatename-not-valid-earlyerr-module-2.js(strict mode) -language/module-code/privatename-not-valid-earlyerr-module-3.js(default) -language/module-code/privatename-not-valid-earlyerr-module-3.js(strict mode) -language/module-code/privatename-not-valid-earlyerr-module-4.js(default) -language/module-code/privatename-not-valid-earlyerr-module-4.js(strict mode) -language/statements/class/elements/fields-duplicate-privatenames.js(default) -language/statements/class/elements/fields-duplicate-privatenames.js(strict mode) -language/statements/class/elements/fields-literal-name-static-propname-constructor.js(default) -language/statements/class/elements/fields-literal-name-static-propname-constructor.js(strict mode) -language/statements/class/elements/fields-string-name-static-propname-constructor.js(default) -language/statements/class/elements/fields-string-name-static-propname-constructor.js(strict mode) -language/statements/class/elements/private-methods/prod-private-method-initialize-order.js(default) -language/statements/class/elements/private-methods/prod-private-method-initialize-order.js(strict mode) -language/statements/class/elements/privatename-not-valid-earlyerr-script-1.js(default) -language/statements/class/elements/privatename-not-valid-earlyerr-script-1.js(strict mode) -language/statements/class/elements/privatename-not-valid-earlyerr-script-2.js(default) -language/statements/class/elements/privatename-not-valid-earlyerr-script-2.js(strict mode) -language/statements/class/elements/privatename-not-valid-earlyerr-script-3.js(default) -language/statements/class/elements/privatename-not-valid-earlyerr-script-3.js(strict mode) -language/statements/class/elements/privatename-not-valid-earlyerr-script-4.js(default) -language/statements/class/elements/privatename-not-valid-earlyerr-script-4.js(strict mode) -language/statements/class/elements/syntax/early-errors/grammar-private-field-on-object-destructuring.js(default) -language/statements/class/elements/syntax/early-errors/grammar-private-field-on-object-destructuring.js(strict mode) -language/statements/class/elements/syntax/early-errors/grammar-privatemeth-duplicate-get-field.js(default) -language/statements/class/elements/syntax/early-errors/grammar-privatemeth-duplicate-get-field.js(strict mode) -language/statements/class/elements/syntax/early-errors/grammar-privatemeth-duplicate-get-get.js(default) -language/statements/class/elements/syntax/early-errors/grammar-privatemeth-duplicate-get-get.js(strict mode) -language/statements/class/elements/syntax/early-errors/grammar-privatemeth-duplicate-meth-field.js(default) -language/statements/class/elements/syntax/early-errors/grammar-privatemeth-duplicate-meth-field.js(strict mode) -language/statements/class/elements/syntax/early-errors/grammar-privatemeth-duplicate-meth-get.js(default) -language/statements/class/elements/syntax/early-errors/grammar-privatemeth-duplicate-meth-get.js(strict mode) -language/statements/class/elements/syntax/early-errors/grammar-privatemeth-duplicate-meth-meth.js(default) -language/statements/class/elements/syntax/early-errors/grammar-privatemeth-duplicate-meth-meth.js(strict mode) -language/statements/class/elements/syntax/early-errors/grammar-privatemeth-duplicate-meth-set.js(default) -language/statements/class/elements/syntax/early-errors/grammar-privatemeth-duplicate-meth-set.js(strict mode) -language/statements/class/elements/syntax/early-errors/grammar-privatemeth-duplicate-meth-staticfield.js(default) -language/statements/class/elements/syntax/early-errors/grammar-privatemeth-duplicate-meth-staticfield.js(strict mode) -language/statements/class/elements/syntax/early-errors/grammar-privatemeth-duplicate-meth-staticmeth.js(default) -language/statements/class/elements/syntax/early-errors/grammar-privatemeth-duplicate-meth-staticmeth.js(strict mode) -language/statements/class/elements/syntax/early-errors/grammar-privatemeth-duplicate-set-field.js(default) -language/statements/class/elements/syntax/early-errors/grammar-privatemeth-duplicate-set-field.js(strict mode) -language/statements/class/elements/syntax/early-errors/grammar-privatemeth-duplicate-set-set.js(default) -language/statements/class/elements/syntax/early-errors/grammar-privatemeth-duplicate-set-set.js(strict mode) -language/statements/class/elements/syntax/early-errors/invalid-names/field-init-call-expression-bad-reference.js(default) -language/statements/class/elements/syntax/early-errors/invalid-names/field-init-call-expression-bad-reference.js(strict mode) -language/statements/class/elements/syntax/early-errors/invalid-names/field-init-call-expression-this.js(default) -language/statements/class/elements/syntax/early-errors/invalid-names/field-init-call-expression-this.js(strict mode) -language/statements/class/elements/syntax/early-errors/invalid-names/field-init-fn-call-expression-bad-reference.js(default) -language/statements/class/elements/syntax/early-errors/invalid-names/field-init-fn-call-expression-bad-reference.js(strict mode) -language/statements/class/elements/syntax/early-errors/invalid-names/field-init-fn-call-expression-this.js(default) -language/statements/class/elements/syntax/early-errors/invalid-names/field-init-fn-call-expression-this.js(strict mode) -language/statements/class/elements/syntax/early-errors/invalid-names/field-init-fn-member-expression-bad-reference.js(default) -language/statements/class/elements/syntax/early-errors/invalid-names/field-init-fn-member-expression-bad-reference.js(strict mode) -language/statements/class/elements/syntax/early-errors/invalid-names/field-init-fn-member-expression-this.js(default) -language/statements/class/elements/syntax/early-errors/invalid-names/field-init-fn-member-expression-this.js(strict mode) -language/statements/class/elements/syntax/early-errors/invalid-names/field-init-member-expression-bad-reference.js(default) -language/statements/class/elements/syntax/early-errors/invalid-names/field-init-member-expression-bad-reference.js(strict mode) -language/statements/class/elements/syntax/early-errors/invalid-names/field-init-member-expression-this.js(default) -language/statements/class/elements/syntax/early-errors/invalid-names/field-init-member-expression-this.js(strict mode) -language/statements/class/elements/syntax/early-errors/invalid-names/method-call-expression-bad-reference.js(default) -language/statements/class/elements/syntax/early-errors/invalid-names/method-call-expression-bad-reference.js(strict mode) -language/statements/class/elements/syntax/early-errors/invalid-names/method-call-expression-this.js(default) -language/statements/class/elements/syntax/early-errors/invalid-names/method-call-expression-this.js(strict mode) -language/statements/class/elements/syntax/early-errors/invalid-names/method-fn-call-expression-bad-reference.js(default) -language/statements/class/elements/syntax/early-errors/invalid-names/method-fn-call-expression-bad-reference.js(strict mode) -language/statements/class/elements/syntax/early-errors/invalid-names/method-fn-call-expression-this.js(default) -language/statements/class/elements/syntax/early-errors/invalid-names/method-fn-call-expression-this.js(strict mode) -language/statements/class/elements/syntax/early-errors/invalid-names/method-fn-member-expression-bad-reference.js(default) -language/statements/class/elements/syntax/early-errors/invalid-names/method-fn-member-expression-bad-reference.js(strict mode) -language/statements/class/elements/syntax/early-errors/invalid-names/method-fn-member-expression-this.js(default) -language/statements/class/elements/syntax/early-errors/invalid-names/method-fn-member-expression-this.js(strict mode) -language/statements/class/elements/syntax/early-errors/invalid-names/method-heritage-call-expression-bad-reference.js(default) -language/statements/class/elements/syntax/early-errors/invalid-names/method-heritage-call-expression-bad-reference.js(strict mode) -language/statements/class/elements/syntax/early-errors/invalid-names/method-heritage-call-expression-this.js(default) -language/statements/class/elements/syntax/early-errors/invalid-names/method-heritage-call-expression-this.js(strict mode) -language/statements/class/elements/syntax/early-errors/invalid-names/method-heritage-member-expression-bad-reference.js(default) -language/statements/class/elements/syntax/early-errors/invalid-names/method-heritage-member-expression-bad-reference.js(strict mode) -language/statements/class/elements/syntax/early-errors/invalid-names/method-heritage-member-expression-this.js(default) -language/statements/class/elements/syntax/early-errors/invalid-names/method-heritage-member-expression-this.js(strict mode) -language/statements/class/elements/syntax/early-errors/invalid-names/method-member-expression-bad-reference.js(default) -language/statements/class/elements/syntax/early-errors/invalid-names/method-member-expression-bad-reference.js(strict mode) -language/statements/class/elements/syntax/early-errors/invalid-names/method-member-expression-this.js(default) -language/statements/class/elements/syntax/early-errors/invalid-names/method-member-expression-this.js(strict mode) -language/statements/class/elements/syntax/early-errors/invalid-names/method-outter-call-expression-bad-reference.js(default) -language/statements/class/elements/syntax/early-errors/invalid-names/method-outter-call-expression-bad-reference.js(strict mode) -language/statements/class/elements/syntax/early-errors/invalid-names/method-outter-call-expression-this.js(default) -language/statements/class/elements/syntax/early-errors/invalid-names/method-outter-call-expression-this.js(strict mode) -language/statements/class/elements/syntax/early-errors/invalid-names/method-outter-member-expression-bad-reference.js(default) -language/statements/class/elements/syntax/early-errors/invalid-names/method-outter-member-expression-bad-reference.js(strict mode) -language/statements/class/elements/syntax/early-errors/invalid-names/method-outter-member-expression-this.js(default) -language/statements/class/elements/syntax/early-errors/invalid-names/method-outter-member-expression-this.js(strict mode) -language/statements/class/elements/syntax/early-errors/super-private-access-invalid.js(default) -language/statements/class/elements/syntax/early-errors/super-private-access-invalid.js(strict mode) -language/statements/for-in/dstr/array-rest-before-elision.js(default) -language/statements/for-in/dstr/array-rest-before-elision.js(strict mode) -language/statements/for-in/dstr/array-rest-elision-invalid.js(default) -language/statements/for-in/dstr/array-rest-elision-invalid.js(strict mode) -language/statements/for-of/dstr/array-rest-before-elision.js(default) -language/statements/for-of/dstr/array-rest-before-elision.js(strict mode) -language/statements/for-of/dstr/array-rest-elision-invalid.js(default) -language/statements/for-of/dstr/array-rest-elision-invalid.js(strict mode) \ No newline at end of file diff --git a/yarn.lock b/yarn.lock index b9d237c25ec1..6f75361bf1c6 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2,46 +2,45 @@ # yarn lockfile v1 -"@babel/cli@^7.4.4": - version "7.4.4" - resolved "https://registry.yarnpkg.com/@babel/cli/-/cli-7.4.4.tgz#5454bb7112f29026a4069d8e6f0e1794e651966c" - integrity sha512-XGr5YjQSjgTa6OzQZY57FAJsdeVSAKR/u/KA5exWIz66IKtv/zXtHy+fIZcMry/EgYegwuHE7vzGnrFhjdIAsQ== +"@babel/cli@^7.7.0": + version "7.7.5" + resolved "https://registry.yarnpkg.com/@babel/cli/-/cli-7.7.5.tgz#25702cc65418efc06989af3727897b9f4c8690b6" + integrity sha512-y2YrMGXM3NUyu1Myg0pxg+Lx6g8XhEyvLHYNRwTBV6fDek3H7Io6b7N/LXscLs4HWn4HxMdy7f2rM1rTMp2mFg== dependencies: - commander "^2.8.1" + commander "^4.0.1" convert-source-map "^1.1.0" fs-readdir-recursive "^1.1.0" glob "^7.0.0" - lodash "^4.17.11" - mkdirp "^0.5.1" - output-file-sync "^2.0.0" + lodash "^4.17.13" + make-dir "^2.1.0" slash "^2.0.0" source-map "^0.5.0" optionalDependencies: - chokidar "^2.0.4" + chokidar "^2.1.8" -"@babel/code-frame@^7.0.0": - version "7.0.0" - resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.0.0.tgz#06e2ab19bdb535385559aabb5ba59729482800f8" - integrity sha512-OfC2uemaknXr87bdLUkWog7nYuliM9Ij5HUcajsVcMCpQrcLmtxRbVFTIqmcSkSeYRBFBRxs2FiUqFJDLdiebA== +"@babel/code-frame@^7.0.0", "@babel/code-frame@^7.5.5": + version "7.5.5" + resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.5.5.tgz#bc0782f6d69f7b7d49531219699b988f669a8f9d" + integrity sha512-27d4lZoomVyo51VegxI20xZPuSHusqbQag/ztrBC7wegWoQ1nLREPVSKSW8byhTlzTKyNE4ifaTA6lCp7JjpFw== dependencies: "@babel/highlight" "^7.0.0" -"@babel/core@^7.1.0", "@babel/core@^7.4.5": - version "7.4.5" - resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.4.5.tgz#081f97e8ffca65a9b4b0fdc7e274e703f000c06a" - integrity sha512-OvjIh6aqXtlsA8ujtGKfC7LYWksYSX8yQcM8Ay3LuvVeQ63lcOKgoZWVqcpFwkd29aYU9rVx7jxhfhiEDV9MZA== - dependencies: - "@babel/code-frame" "^7.0.0" - "@babel/generator" "^7.4.4" - "@babel/helpers" "^7.4.4" - "@babel/parser" "^7.4.5" - "@babel/template" "^7.4.4" - "@babel/traverse" "^7.4.5" - "@babel/types" "^7.4.4" - convert-source-map "^1.1.0" +"@babel/core@^7.1.0", "@babel/core@^7.7.2": + version "7.7.5" + resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.7.5.tgz#ae1323cd035b5160293307f50647e83f8ba62f7e" + integrity sha512-M42+ScN4+1S9iB6f+TL7QBpoQETxbclx+KNoKJABghnKYE+fMzSGqst0BZJc8CpI625bwPwYgUyRvxZ+0mZzpw== + dependencies: + "@babel/code-frame" "^7.5.5" + "@babel/generator" "^7.7.4" + "@babel/helpers" "^7.7.4" + "@babel/parser" "^7.7.5" + "@babel/template" "^7.7.4" + "@babel/traverse" "^7.7.4" + "@babel/types" "^7.7.4" + convert-source-map "^1.7.0" debug "^4.1.0" json5 "^2.1.0" - lodash "^4.17.11" + lodash "^4.17.13" resolve "^1.3.2" semver "^5.4.1" source-map "^0.5.0" @@ -51,125 +50,132 @@ resolved "https://registry.yarnpkg.com/@babel/eslint-plugin-development/-/eslint-plugin-development-1.0.1.tgz#1f5206ae95795db09b65e7dbc2b158d66497a44c" integrity sha512-ioEhN8HgKr4Yx8ef+XryNpKN4FimSFceb0qVVxvoUzpFn3xyq17MlY5AquEqtXObE7Nu7WKq7QL9INzjCrugyw== -"@babel/generator@^7.0.0", "@babel/generator@^7.4.4": - version "7.4.4" - resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.4.4.tgz#174a215eb843fc392c7edcaabeaa873de6e8f041" - integrity sha512-53UOLK6TVNqKxf7RUh8NE851EHRxOOeVXKbK2bivdb+iziMyk03Sr4eaE9OELCbyZAAafAKPDwF2TPUES5QbxQ== +"@babel/generator@^7.4.0", "@babel/generator@^7.7.4": + version "7.7.4" + resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.7.4.tgz#db651e2840ca9aa66f327dcec1dc5f5fa9611369" + integrity sha512-m5qo2WgdOJeyYngKImbkyQrnUN1mPceaG5BV+G0E3gWsa4l/jCSryWJdM2x8OuGAOyh+3d5pVYfZWCiNFtynxg== dependencies: - "@babel/types" "^7.4.4" + "@babel/types" "^7.7.4" jsesc "^2.5.1" - lodash "^4.17.11" + lodash "^4.17.13" source-map "^0.5.0" - trim-right "^1.0.1" -"@babel/helper-annotate-as-pure@^7.0.0": - version "7.0.0" - resolved "https://registry.yarnpkg.com/@babel/helper-annotate-as-pure/-/helper-annotate-as-pure-7.0.0.tgz#323d39dd0b50e10c7c06ca7d7638e6864d8c5c32" - integrity sha512-3UYcJUj9kvSLbLbUIfQTqzcy5VX7GRZ/CCDrnOaZorFFM01aXp1+GJwuFGV4NDDoAS+mOUyHcO6UD/RfqOks3Q== +"@babel/helper-annotate-as-pure@^7.7.4": + version "7.7.4" + resolved "https://registry.yarnpkg.com/@babel/helper-annotate-as-pure/-/helper-annotate-as-pure-7.7.4.tgz#bb3faf1e74b74bd547e867e48f551fa6b098b6ce" + integrity sha512-2BQmQgECKzYKFPpiycoF9tlb5HA4lrVyAmLLVK177EcQAqjVLciUb2/R+n1boQ9y5ENV3uz2ZqiNw7QMBBw1Og== dependencies: - "@babel/types" "^7.0.0" + "@babel/types" "^7.7.4" -"@babel/helper-builder-binary-assignment-operator-visitor@^7.1.0": - version "7.1.0" - resolved "https://registry.yarnpkg.com/@babel/helper-builder-binary-assignment-operator-visitor/-/helper-builder-binary-assignment-operator-visitor-7.1.0.tgz#6b69628dfe4087798e0c4ed98e3d4a6b2fbd2f5f" - integrity sha512-qNSR4jrmJ8M1VMM9tibvyRAHXQs2PmaksQF7c1CGJNipfe3D8p+wgNwgso/P2A2r2mdgBWAXljNWR0QRZAMW8w== +"@babel/helper-builder-binary-assignment-operator-visitor@^7.7.4": + version "7.7.4" + resolved "https://registry.yarnpkg.com/@babel/helper-builder-binary-assignment-operator-visitor/-/helper-builder-binary-assignment-operator-visitor-7.7.4.tgz#5f73f2b28580e224b5b9bd03146a4015d6217f5f" + integrity sha512-Biq/d/WtvfftWZ9Uf39hbPBYDUo986m5Bb4zhkeYDGUllF43D+nUe5M6Vuo6/8JDK/0YX/uBdeoQpyaNhNugZQ== dependencies: - "@babel/helper-explode-assignable-expression" "^7.1.0" - "@babel/types" "^7.0.0" + "@babel/helper-explode-assignable-expression" "^7.7.4" + "@babel/types" "^7.7.4" -"@babel/helper-call-delegate@^7.4.4": - version "7.4.4" - resolved "https://registry.yarnpkg.com/@babel/helper-call-delegate/-/helper-call-delegate-7.4.4.tgz#87c1f8ca19ad552a736a7a27b1c1fcf8b1ff1f43" - integrity sha512-l79boDFJ8S1c5hvQvG+rc+wHw6IuH7YldmRKsYtpbawsxURu/paVy57FZMomGK22/JckepaikOkY0MoAmdyOlQ== +"@babel/helper-call-delegate@^7.7.4": + version "7.7.4" + resolved "https://registry.yarnpkg.com/@babel/helper-call-delegate/-/helper-call-delegate-7.7.4.tgz#621b83e596722b50c0066f9dc37d3232e461b801" + integrity sha512-8JH9/B7J7tCYJ2PpWVpw9JhPuEVHztagNVuQAFBVFYluRMlpG7F1CgKEgGeL6KFqcsIa92ZYVj6DSc0XwmN1ZA== dependencies: - "@babel/helper-hoist-variables" "^7.4.4" - "@babel/traverse" "^7.4.4" - "@babel/types" "^7.4.4" + "@babel/helper-hoist-variables" "^7.7.4" + "@babel/traverse" "^7.7.4" + "@babel/types" "^7.7.4" -"@babel/helper-create-class-features-plugin@^7.4.4": - version "7.4.4" - resolved "https://registry.yarnpkg.com/@babel/helper-create-class-features-plugin/-/helper-create-class-features-plugin-7.4.4.tgz#fc3d690af6554cc9efc607364a82d48f58736dba" - integrity sha512-UbBHIa2qeAGgyiNR9RszVF7bUHEdgS4JAUNT8SiqrAN6YJVxlOxeLr5pBzb5kan302dejJ9nla4RyKcR1XT6XA== +"@babel/helper-create-class-features-plugin@^7.7.4": + version "7.7.4" + resolved "https://registry.yarnpkg.com/@babel/helper-create-class-features-plugin/-/helper-create-class-features-plugin-7.7.4.tgz#fce60939fd50618610942320a8d951b3b639da2d" + integrity sha512-l+OnKACG4uiDHQ/aJT8dwpR+LhCJALxL0mJ6nzjB25e5IPwqV1VOsY7ah6UB1DG+VOXAIMtuC54rFJGiHkxjgA== dependencies: - "@babel/helper-function-name" "^7.1.0" - "@babel/helper-member-expression-to-functions" "^7.0.0" - "@babel/helper-optimise-call-expression" "^7.0.0" + "@babel/helper-function-name" "^7.7.4" + "@babel/helper-member-expression-to-functions" "^7.7.4" + "@babel/helper-optimise-call-expression" "^7.7.4" "@babel/helper-plugin-utils" "^7.0.0" - "@babel/helper-replace-supers" "^7.4.4" - "@babel/helper-split-export-declaration" "^7.4.4" + "@babel/helper-replace-supers" "^7.7.4" + "@babel/helper-split-export-declaration" "^7.7.4" -"@babel/helper-define-map@^7.4.4": - version "7.4.4" - resolved "https://registry.yarnpkg.com/@babel/helper-define-map/-/helper-define-map-7.4.4.tgz#6969d1f570b46bdc900d1eba8e5d59c48ba2c12a" - integrity sha512-IX3Ln8gLhZpSuqHJSnTNBWGDE9kdkTEWl21A/K7PQ00tseBwbqCHTvNLHSBd9M0R5rER4h5Rsvj9vw0R5SieBg== +"@babel/helper-create-regexp-features-plugin@^7.7.4": + version "7.7.4" + resolved "https://registry.yarnpkg.com/@babel/helper-create-regexp-features-plugin/-/helper-create-regexp-features-plugin-7.7.4.tgz#6d5762359fd34f4da1500e4cff9955b5299aaf59" + integrity sha512-Mt+jBKaxL0zfOIWrfQpnfYCN7/rS6GKx6CCCfuoqVVd+17R8zNDlzVYmIi9qyb2wOk002NsmSTDymkIygDUH7A== dependencies: - "@babel/helper-function-name" "^7.1.0" - "@babel/types" "^7.4.4" - lodash "^4.17.11" + "@babel/helper-regex" "^7.4.4" + regexpu-core "^4.6.0" -"@babel/helper-explode-assignable-expression@^7.1.0": - version "7.1.0" - resolved "https://registry.yarnpkg.com/@babel/helper-explode-assignable-expression/-/helper-explode-assignable-expression-7.1.0.tgz#537fa13f6f1674df745b0c00ec8fe4e99681c8f6" - integrity sha512-NRQpfHrJ1msCHtKjbzs9YcMmJZOg6mQMmGRB+hbamEdG5PNpaSm95275VD92DvJKuyl0s2sFiDmMZ+EnnvufqA== +"@babel/helper-define-map@^7.7.4": + version "7.7.4" + resolved "https://registry.yarnpkg.com/@babel/helper-define-map/-/helper-define-map-7.7.4.tgz#2841bf92eb8bd9c906851546fe6b9d45e162f176" + integrity sha512-v5LorqOa0nVQUvAUTUF3KPastvUt/HzByXNamKQ6RdJRTV7j8rLL+WB5C/MzzWAwOomxDhYFb1wLLxHqox86lg== dependencies: - "@babel/traverse" "^7.1.0" - "@babel/types" "^7.0.0" + "@babel/helper-function-name" "^7.7.4" + "@babel/types" "^7.7.4" + lodash "^4.17.13" -"@babel/helper-function-name@^7.1.0": - version "7.1.0" - resolved "https://registry.yarnpkg.com/@babel/helper-function-name/-/helper-function-name-7.1.0.tgz#a0ceb01685f73355d4360c1247f582bfafc8ff53" - integrity sha512-A95XEoCpb3TO+KZzJ4S/5uW5fNe26DjBGqf1o9ucyLyCmi1dXq/B3c8iaWTfBk3VvetUxl16e8tIrd5teOCfGw== +"@babel/helper-explode-assignable-expression@^7.7.4": + version "7.7.4" + resolved "https://registry.yarnpkg.com/@babel/helper-explode-assignable-expression/-/helper-explode-assignable-expression-7.7.4.tgz#fa700878e008d85dc51ba43e9fb835cddfe05c84" + integrity sha512-2/SicuFrNSXsZNBxe5UGdLr+HZg+raWBLE9vC98bdYOKX/U6PY0mdGlYUJdtTDPSU0Lw0PNbKKDpwYHJLn2jLg== dependencies: - "@babel/helper-get-function-arity" "^7.0.0" - "@babel/template" "^7.1.0" - "@babel/types" "^7.0.0" + "@babel/traverse" "^7.7.4" + "@babel/types" "^7.7.4" -"@babel/helper-get-function-arity@^7.0.0": - version "7.0.0" - resolved "https://registry.yarnpkg.com/@babel/helper-get-function-arity/-/helper-get-function-arity-7.0.0.tgz#83572d4320e2a4657263734113c42868b64e49c3" - integrity sha512-r2DbJeg4svYvt3HOS74U4eWKsUAMRH01Z1ds1zx8KNTPtpTL5JAsdFv8BNyOpVqdFhHkkRDIg5B4AsxmkjAlmQ== +"@babel/helper-function-name@^7.7.4": + version "7.7.4" + resolved "https://registry.yarnpkg.com/@babel/helper-function-name/-/helper-function-name-7.7.4.tgz#ab6e041e7135d436d8f0a3eca15de5b67a341a2e" + integrity sha512-AnkGIdiBhEuiwdoMnKm7jfPfqItZhgRaZfMg1XX3bS25INOnLPjPG1Ppnajh8eqgt5kPJnfqrRHqFqmjKDZLzQ== dependencies: - "@babel/types" "^7.0.0" + "@babel/helper-get-function-arity" "^7.7.4" + "@babel/template" "^7.7.4" + "@babel/types" "^7.7.4" -"@babel/helper-hoist-variables@^7.4.4": - version "7.4.4" - resolved "https://registry.yarnpkg.com/@babel/helper-hoist-variables/-/helper-hoist-variables-7.4.4.tgz#0298b5f25c8c09c53102d52ac4a98f773eb2850a" - integrity sha512-VYk2/H/BnYbZDDg39hr3t2kKyifAm1W6zHRfhx8jGjIHpQEBv9dry7oQ2f3+J703TLu69nYdxsovl0XYfcnK4w== +"@babel/helper-get-function-arity@^7.7.4": + version "7.7.4" + resolved "https://registry.yarnpkg.com/@babel/helper-get-function-arity/-/helper-get-function-arity-7.7.4.tgz#cb46348d2f8808e632f0ab048172130e636005f0" + integrity sha512-QTGKEdCkjgzgfJ3bAyRwF4yyT3pg+vDgan8DSivq1eS0gwi+KGKE5x8kRcbeFTb/673mkO5SN1IZfmCfA5o+EA== dependencies: - "@babel/types" "^7.4.4" + "@babel/types" "^7.7.4" -"@babel/helper-member-expression-to-functions@^7.0.0": - version "7.0.0" - resolved "https://registry.yarnpkg.com/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.0.0.tgz#8cd14b0a0df7ff00f009e7d7a436945f47c7a16f" - integrity sha512-avo+lm/QmZlv27Zsi0xEor2fKcqWG56D5ae9dzklpIaY7cQMK5N8VSpaNVPPagiqmy7LrEjK1IWdGMOqPu5csg== +"@babel/helper-hoist-variables@^7.7.4": + version "7.7.4" + resolved "https://registry.yarnpkg.com/@babel/helper-hoist-variables/-/helper-hoist-variables-7.7.4.tgz#612384e3d823fdfaaf9fce31550fe5d4db0f3d12" + integrity sha512-wQC4xyvc1Jo/FnLirL6CEgPgPCa8M74tOdjWpRhQYapz5JC7u3NYU1zCVoVAGCE3EaIP9T1A3iW0WLJ+reZlpQ== dependencies: - "@babel/types" "^7.0.0" + "@babel/types" "^7.7.4" -"@babel/helper-module-imports@^7.0.0": - version "7.0.0" - resolved "https://registry.yarnpkg.com/@babel/helper-module-imports/-/helper-module-imports-7.0.0.tgz#96081b7111e486da4d2cd971ad1a4fe216cc2e3d" - integrity sha512-aP/hlLq01DWNEiDg4Jn23i+CXxW/owM4WpDLFUbpjxe4NS3BhLVZQ5i7E0ZrxuQ/vwekIeciyamgB1UIYxxM6A== +"@babel/helper-member-expression-to-functions@^7.7.4": + version "7.7.4" + resolved "https://registry.yarnpkg.com/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.7.4.tgz#356438e2569df7321a8326644d4b790d2122cb74" + integrity sha512-9KcA1X2E3OjXl/ykfMMInBK+uVdfIVakVe7W7Lg3wfXUNyS3Q1HWLFRwZIjhqiCGbslummPDnmb7vIekS0C1vw== dependencies: - "@babel/types" "^7.0.0" + "@babel/types" "^7.7.4" -"@babel/helper-module-transforms@^7.1.0", "@babel/helper-module-transforms@^7.4.4": - version "7.4.4" - resolved "https://registry.yarnpkg.com/@babel/helper-module-transforms/-/helper-module-transforms-7.4.4.tgz#96115ea42a2f139e619e98ed46df6019b94414b8" - integrity sha512-3Z1yp8TVQf+B4ynN7WoHPKS8EkdTbgAEy0nU0rs/1Kw4pDgmvYH3rz3aI11KgxKCba2cn7N+tqzV1mY2HMN96w== +"@babel/helper-module-imports@^7.0.0", "@babel/helper-module-imports@^7.7.4": + version "7.7.4" + resolved "https://registry.yarnpkg.com/@babel/helper-module-imports/-/helper-module-imports-7.7.4.tgz#e5a92529f8888bf319a6376abfbd1cebc491ad91" + integrity sha512-dGcrX6K9l8258WFjyDLJwuVKxR4XZfU0/vTUgOQYWEnRD8mgr+p4d6fCUMq/ys0h4CCt/S5JhbvtyErjWouAUQ== dependencies: - "@babel/helper-module-imports" "^7.0.0" - "@babel/helper-simple-access" "^7.1.0" - "@babel/helper-split-export-declaration" "^7.4.4" - "@babel/template" "^7.4.4" - "@babel/types" "^7.4.4" - lodash "^4.17.11" + "@babel/types" "^7.7.4" -"@babel/helper-optimise-call-expression@^7.0.0": - version "7.0.0" - resolved "https://registry.yarnpkg.com/@babel/helper-optimise-call-expression/-/helper-optimise-call-expression-7.0.0.tgz#a2920c5702b073c15de51106200aa8cad20497d5" - integrity sha512-u8nd9NQePYNQV8iPWu/pLLYBqZBa4ZaY1YWRFMuxrid94wKI1QNt67NEZ7GAe5Kc/0LLScbim05xZFWkAdrj9g== +"@babel/helper-module-transforms@^7.7.4", "@babel/helper-module-transforms@^7.7.5": + version "7.7.5" + resolved "https://registry.yarnpkg.com/@babel/helper-module-transforms/-/helper-module-transforms-7.7.5.tgz#d044da7ffd91ec967db25cd6748f704b6b244835" + integrity sha512-A7pSxyJf1gN5qXVcidwLWydjftUN878VkalhXX5iQDuGyiGK3sOrrKKHF4/A4fwHtnsotv/NipwAeLzY4KQPvw== dependencies: - "@babel/types" "^7.0.0" + "@babel/helper-module-imports" "^7.7.4" + "@babel/helper-simple-access" "^7.7.4" + "@babel/helper-split-export-declaration" "^7.7.4" + "@babel/template" "^7.7.4" + "@babel/types" "^7.7.4" + lodash "^4.17.13" + +"@babel/helper-optimise-call-expression@^7.7.4": + version "7.7.4" + resolved "https://registry.yarnpkg.com/@babel/helper-optimise-call-expression/-/helper-optimise-call-expression-7.7.4.tgz#034af31370d2995242aa4df402c3b7794b2dcdf2" + integrity sha512-VB7gWZ2fDkSuqW6b1AKXkJWO5NyNI3bFL/kK79/30moK57blr6NbH8xcl2XcKCwOmJosftWunZqfO84IGq3ZZg== + dependencies: + "@babel/types" "^7.7.4" "@babel/helper-plugin-utils@^7.0.0": version "7.0.0" @@ -177,569 +183,623 @@ integrity sha512-CYAOUCARwExnEixLdB6sDm2dIJ/YgEAKDM1MOeMeZu9Ld/bDgVo8aiWrXwcY7OBh+1Ea2uUcVRcxKk0GJvW7QA== "@babel/helper-regex@^7.0.0", "@babel/helper-regex@^7.4.4": - version "7.4.4" - resolved "https://registry.yarnpkg.com/@babel/helper-regex/-/helper-regex-7.4.4.tgz#a47e02bc91fb259d2e6727c2a30013e3ac13c4a2" - integrity sha512-Y5nuB/kESmR3tKjU8Nkn1wMGEx1tjJX076HBMeL3XLQCu6vA/YRzuTW0bbb+qRnXvQGn+d6Rx953yffl8vEy7Q== - dependencies: - lodash "^4.17.11" + version "7.5.5" + resolved "https://registry.yarnpkg.com/@babel/helper-regex/-/helper-regex-7.5.5.tgz#0aa6824f7100a2e0e89c1527c23936c152cab351" + integrity sha512-CkCYQLkfkiugbRDO8eZn6lRuR8kzZoGXCg3149iTk5se7g6qykSpy3+hELSwquhu+TgHn8nkLiBwHvNX8Hofcw== + dependencies: + lodash "^4.17.13" + +"@babel/helper-remap-async-to-generator@^7.7.4": + version "7.7.4" + resolved "https://registry.yarnpkg.com/@babel/helper-remap-async-to-generator/-/helper-remap-async-to-generator-7.7.4.tgz#c68c2407350d9af0e061ed6726afb4fff16d0234" + integrity sha512-Sk4xmtVdM9sA/jCI80f+KS+Md+ZHIpjuqmYPk1M7F/upHou5e4ReYmExAiu6PVe65BhJPZA2CY9x9k4BqE5klw== + dependencies: + "@babel/helper-annotate-as-pure" "^7.7.4" + "@babel/helper-wrap-function" "^7.7.4" + "@babel/template" "^7.7.4" + "@babel/traverse" "^7.7.4" + "@babel/types" "^7.7.4" + +"@babel/helper-replace-supers@^7.7.4": + version "7.7.4" + resolved "https://registry.yarnpkg.com/@babel/helper-replace-supers/-/helper-replace-supers-7.7.4.tgz#3c881a6a6a7571275a72d82e6107126ec9e2cdd2" + integrity sha512-pP0tfgg9hsZWo5ZboYGuBn/bbYT/hdLPVSS4NMmiRJdwWhP0IznPwN9AE1JwyGsjSPLC364I0Qh5p+EPkGPNpg== + dependencies: + "@babel/helper-member-expression-to-functions" "^7.7.4" + "@babel/helper-optimise-call-expression" "^7.7.4" + "@babel/traverse" "^7.7.4" + "@babel/types" "^7.7.4" + +"@babel/helper-simple-access@^7.7.4": + version "7.7.4" + resolved "https://registry.yarnpkg.com/@babel/helper-simple-access/-/helper-simple-access-7.7.4.tgz#a169a0adb1b5f418cfc19f22586b2ebf58a9a294" + integrity sha512-zK7THeEXfan7UlWsG2A6CI/L9jVnI5+xxKZOdej39Y0YtDYKx9raHk5F2EtK9K8DHRTihYwg20ADt9S36GR78A== + dependencies: + "@babel/template" "^7.7.4" + "@babel/types" "^7.7.4" + +"@babel/helper-split-export-declaration@^7.7.4": + version "7.7.4" + resolved "https://registry.yarnpkg.com/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.7.4.tgz#57292af60443c4a3622cf74040ddc28e68336fd8" + integrity sha512-guAg1SXFcVr04Guk9eq0S4/rWS++sbmyqosJzVs8+1fH5NI+ZcmkaSkc7dmtAFbHFva6yRJnjW3yAcGxjueDug== + dependencies: + "@babel/types" "^7.7.4" + +"@babel/helper-wrap-function@^7.7.4": + version "7.7.4" + resolved "https://registry.yarnpkg.com/@babel/helper-wrap-function/-/helper-wrap-function-7.7.4.tgz#37ab7fed5150e22d9d7266e830072c0cdd8baace" + integrity sha512-VsfzZt6wmsocOaVU0OokwrIytHND55yvyT4BPB9AIIgwr8+x7617hetdJTsuGwygN5RC6mxA9EJztTjuwm2ofg== + dependencies: + "@babel/helper-function-name" "^7.7.4" + "@babel/template" "^7.7.4" + "@babel/traverse" "^7.7.4" + "@babel/types" "^7.7.4" + +"@babel/helpers@^7.7.4": + version "7.7.4" + resolved "https://registry.yarnpkg.com/@babel/helpers/-/helpers-7.7.4.tgz#62c215b9e6c712dadc15a9a0dcab76c92a940302" + integrity sha512-ak5NGZGJ6LV85Q1Zc9gn2n+ayXOizryhjSUBTdu5ih1tlVCJeuQENzc4ItyCVhINVXvIT/ZQ4mheGIsfBkpskg== + dependencies: + "@babel/template" "^7.7.4" + "@babel/traverse" "^7.7.4" + "@babel/types" "^7.7.4" -"@babel/helper-remap-async-to-generator@^7.1.0": - version "7.1.0" - resolved "https://registry.yarnpkg.com/@babel/helper-remap-async-to-generator/-/helper-remap-async-to-generator-7.1.0.tgz#361d80821b6f38da75bd3f0785ece20a88c5fe7f" - integrity sha512-3fOK0L+Fdlg8S5al8u/hWE6vhufGSn0bN09xm2LXMy//REAF8kDCrYoOBKYmA8m5Nom+sV9LyLCwrFynA8/slg== +"@babel/highlight@^7.0.0": + version "7.5.0" + resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.5.0.tgz#56d11312bd9248fa619591d02472be6e8cb32540" + integrity sha512-7dV4eu9gBxoM0dAnj/BCFDW9LFU0zvTrkq0ugM7pnHEgguOEeOz1so2ZghEdzviYzQEED0r4EAgpsBChKy1TRQ== dependencies: - "@babel/helper-annotate-as-pure" "^7.0.0" - "@babel/helper-wrap-function" "^7.1.0" - "@babel/template" "^7.1.0" - "@babel/traverse" "^7.1.0" - "@babel/types" "^7.0.0" + chalk "^2.0.0" + esutils "^2.0.2" + js-tokens "^4.0.0" -"@babel/helper-replace-supers@^7.1.0", "@babel/helper-replace-supers@^7.4.4": - version "7.4.4" - resolved "https://registry.yarnpkg.com/@babel/helper-replace-supers/-/helper-replace-supers-7.4.4.tgz#aee41783ebe4f2d3ab3ae775e1cc6f1a90cefa27" - integrity sha512-04xGEnd+s01nY1l15EuMS1rfKktNF+1CkKmHoErDppjAAZL+IUBZpzT748x262HF7fibaQPhbvWUl5HeSt1EXg== +"@babel/parser@^7.0.0", "@babel/parser@^7.1.0", "@babel/parser@^7.4.3", "@babel/parser@^7.7.4", "@babel/parser@^7.7.5": + version "7.7.5" + resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.7.5.tgz#cbf45321619ac12d83363fcf9c94bb67fa646d71" + integrity sha512-KNlOe9+/nk4i29g0VXgl8PEXIRms5xKLJeuZ6UptN0fHv+jDiriG+y94X6qAgWTR0h3KaoM1wK5G5h7MHFRSig== + +"@babel/plugin-proposal-async-generator-functions@^7.7.4": + version "7.7.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-async-generator-functions/-/plugin-proposal-async-generator-functions-7.7.4.tgz#0351c5ac0a9e927845fffd5b82af476947b7ce6d" + integrity sha512-1ypyZvGRXriY/QP668+s8sFr2mqinhkRDMPSQLNghCQE+GAkFtp+wkHVvg2+Hdki8gwP+NFzJBJ/N1BfzCCDEw== dependencies: - "@babel/helper-member-expression-to-functions" "^7.0.0" - "@babel/helper-optimise-call-expression" "^7.0.0" - "@babel/traverse" "^7.4.4" - "@babel/types" "^7.4.4" + "@babel/helper-plugin-utils" "^7.0.0" + "@babel/helper-remap-async-to-generator" "^7.7.4" + "@babel/plugin-syntax-async-generators" "^7.7.4" -"@babel/helper-simple-access@^7.1.0": - version "7.1.0" - resolved "https://registry.yarnpkg.com/@babel/helper-simple-access/-/helper-simple-access-7.1.0.tgz#65eeb954c8c245beaa4e859da6188f39d71e585c" - integrity sha512-Vk+78hNjRbsiu49zAPALxTb+JUQCz1aolpd8osOF16BGnLtseD21nbHgLPGUwrXEurZgiCOUmvs3ExTu4F5x6w== +"@babel/plugin-proposal-class-properties@^7.7.0": + version "7.7.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-class-properties/-/plugin-proposal-class-properties-7.7.4.tgz#2f964f0cb18b948450362742e33e15211e77c2ba" + integrity sha512-EcuXeV4Hv1X3+Q1TsuOmyyxeTRiSqurGJ26+I/FW1WbymmRRapVORm6x1Zl3iDIHyRxEs+VXWp6qnlcfcJSbbw== dependencies: - "@babel/template" "^7.1.0" - "@babel/types" "^7.0.0" + "@babel/helper-create-class-features-plugin" "^7.7.4" + "@babel/helper-plugin-utils" "^7.0.0" -"@babel/helper-split-export-declaration@^7.4.4": - version "7.4.4" - resolved "https://registry.yarnpkg.com/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.4.4.tgz#ff94894a340be78f53f06af038b205c49d993677" - integrity sha512-Ro/XkzLf3JFITkW6b+hNxzZ1n5OQ80NvIUdmHspih1XAhtN3vPTuUFT4eQnela+2MaZ5ulH+iyP513KJrxbN7Q== +"@babel/plugin-proposal-dynamic-import@^7.7.4": + version "7.7.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-dynamic-import/-/plugin-proposal-dynamic-import-7.7.4.tgz#dde64a7f127691758cbfed6cf70de0fa5879d52d" + integrity sha512-StH+nGAdO6qDB1l8sZ5UBV8AC3F2VW2I8Vfld73TMKyptMU9DY5YsJAS8U81+vEtxcH3Y/La0wG0btDrhpnhjQ== dependencies: - "@babel/types" "^7.4.4" + "@babel/helper-plugin-utils" "^7.0.0" + "@babel/plugin-syntax-dynamic-import" "^7.7.4" -"@babel/helper-wrap-function@^7.1.0": - version "7.2.0" - resolved "https://registry.yarnpkg.com/@babel/helper-wrap-function/-/helper-wrap-function-7.2.0.tgz#c4e0012445769e2815b55296ead43a958549f6fa" - integrity sha512-o9fP1BZLLSrYlxYEYyl2aS+Flun5gtjTIG8iln+XuEzQTs0PLagAGSXUcqruJwD5fM48jzIEggCKpIfWTcR7pQ== +"@babel/plugin-proposal-export-namespace-from@^7.5.2": + version "7.7.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-export-namespace-from/-/plugin-proposal-export-namespace-from-7.7.4.tgz#9b32a9e3538ba4b0e2fa08942f0a8e5f60899dea" + integrity sha512-3whN5U7iZjKdbwRSFwBOjGBgH7apXCzwielljxVH8D/iYcGRqPPw63vlIbG0GqQoT9bO0QYPcIUVkhQG5hcHtg== dependencies: - "@babel/helper-function-name" "^7.1.0" - "@babel/template" "^7.1.0" - "@babel/traverse" "^7.1.0" - "@babel/types" "^7.2.0" + "@babel/helper-plugin-utils" "^7.0.0" + "@babel/plugin-syntax-export-namespace-from" "^7.7.4" -"@babel/helpers@^7.4.4": - version "7.4.4" - resolved "https://registry.yarnpkg.com/@babel/helpers/-/helpers-7.4.4.tgz#868b0ef59c1dd4e78744562d5ce1b59c89f2f2a5" - integrity sha512-igczbR/0SeuPR8RFfC7tGrbdTbFL3QTvH6D+Z6zNxnTe//GyqmtHmDkzrqDmyZ3eSwPqB/LhyKoU5DXsp+Vp2A== +"@babel/plugin-proposal-json-strings@^7.7.4": + version "7.7.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-json-strings/-/plugin-proposal-json-strings-7.7.4.tgz#7700a6bfda771d8dc81973249eac416c6b4c697d" + integrity sha512-wQvt3akcBTfLU/wYoqm/ws7YOAQKu8EVJEvHip/mzkNtjaclQoCCIqKXFP5/eyfnfbQCDV3OLRIK3mIVyXuZlw== dependencies: - "@babel/template" "^7.4.4" - "@babel/traverse" "^7.4.4" - "@babel/types" "^7.4.4" + "@babel/helper-plugin-utils" "^7.0.0" + "@babel/plugin-syntax-json-strings" "^7.7.4" -"@babel/highlight@^7.0.0": - version "7.0.0" - resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.0.0.tgz#f710c38c8d458e6dd9a201afb637fcb781ce99e4" - integrity sha512-UFMC4ZeFC48Tpvj7C8UgLvtkaUuovQX+5xNWrsIoMG8o2z+XFKjKaN9iVmS84dPwVN00W4wPmqvYoZF3EGAsfw== +"@babel/plugin-proposal-nullish-coalescing-operator@^7.4.4": + version "7.7.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-nullish-coalescing-operator/-/plugin-proposal-nullish-coalescing-operator-7.7.4.tgz#7db302c83bc30caa89e38fee935635ef6bd11c28" + integrity sha512-TbYHmr1Gl1UC7Vo2HVuj/Naci5BEGNZ0AJhzqD2Vpr6QPFWpUmBRLrIDjedzx7/CShq0bRDS2gI4FIs77VHLVQ== dependencies: - chalk "^2.0.0" - esutils "^2.0.2" - js-tokens "^4.0.0" + "@babel/helper-plugin-utils" "^7.0.0" + "@babel/plugin-syntax-nullish-coalescing-operator" "^7.7.4" -"@babel/parser@^7.0.0", "@babel/parser@^7.1.0", "@babel/parser@^7.4.4", "@babel/parser@^7.4.5": - version "7.4.5" - resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.4.5.tgz#04af8d5d5a2b044a2a1bffacc1e5e6673544e872" - integrity sha512-9mUqkL1FF5T7f0WDFfAoDdiMVPWsdD1gZYzSnaXsxUCUqzuch/8of9G3VUSNiZmMBoRxT3neyVsqeiL/ZPcjew== +"@babel/plugin-proposal-numeric-separator@^7.2.0": + version "7.7.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-numeric-separator/-/plugin-proposal-numeric-separator-7.7.4.tgz#7819a17445f4197bb9575e5750ed349776da858a" + integrity sha512-CG605v7lLpVgVldSY6kxsN9ui1DxFOyepBfuX2AzU2TNriMAYApoU55mrGw9Jr4TlrTzPCG10CL8YXyi+E/iPw== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + "@babel/plugin-syntax-numeric-separator" "^7.7.4" -"@babel/plugin-proposal-async-generator-functions@^7.2.0": - version "7.2.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-async-generator-functions/-/plugin-proposal-async-generator-functions-7.2.0.tgz#b289b306669dce4ad20b0252889a15768c9d417e" - integrity sha512-+Dfo/SCQqrwx48ptLVGLdE39YtWRuKc/Y9I5Fy0P1DDBB9lsAHpjcEJQt+4IifuSOSTLBKJObJqMvaO1pIE8LQ== +"@babel/plugin-proposal-object-rest-spread@^7.7.4": + version "7.7.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-object-rest-spread/-/plugin-proposal-object-rest-spread-7.7.4.tgz#cc57849894a5c774214178c8ab64f6334ec8af71" + integrity sha512-rnpnZR3/iWKmiQyJ3LKJpSwLDcX/nSXhdLk4Aq/tXOApIvyu7qoabrige0ylsAJffaUC51WiBu209Q0U+86OWQ== dependencies: "@babel/helper-plugin-utils" "^7.0.0" - "@babel/helper-remap-async-to-generator" "^7.1.0" - "@babel/plugin-syntax-async-generators" "^7.2.0" + "@babel/plugin-syntax-object-rest-spread" "^7.7.4" -"@babel/plugin-proposal-class-properties@^7.4.4": - version "7.4.4" - resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-class-properties/-/plugin-proposal-class-properties-7.4.4.tgz#93a6486eed86d53452ab9bab35e368e9461198ce" - integrity sha512-WjKTI8g8d5w1Bc9zgwSz2nfrsNQsXcCf9J9cdCvrJV6RF56yztwm4TmJC0MgJ9tvwO9gUA/mcYe89bLdGfiXFg== +"@babel/plugin-proposal-optional-catch-binding@^7.7.4": + version "7.7.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-optional-catch-binding/-/plugin-proposal-optional-catch-binding-7.7.4.tgz#ec21e8aeb09ec6711bc0a39ca49520abee1de379" + integrity sha512-DyM7U2bnsQerCQ+sejcTNZh8KQEUuC3ufzdnVnSiUv/qoGJp2Z3hanKL18KDhsBT5Wj6a7CMT5mdyCNJsEaA9w== dependencies: - "@babel/helper-create-class-features-plugin" "^7.4.4" "@babel/helper-plugin-utils" "^7.0.0" + "@babel/plugin-syntax-optional-catch-binding" "^7.7.4" -"@babel/plugin-proposal-export-namespace-from@^7.2.0": - version "7.2.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-export-namespace-from/-/plugin-proposal-export-namespace-from-7.2.0.tgz#308fd4d04ff257fc3e4be090550840eeabad5dd9" - integrity sha512-DZUxbHYxQ5fUFIkMEnh75ogEdBLPfL+mQUqrO2hNY2LGm+tqFnxE924+mhAcCOh/8za8AaZsWHbq6bBoS3TAzA== +"@babel/plugin-proposal-optional-chaining@^7.6.0": + version "7.7.5" + resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-optional-chaining/-/plugin-proposal-optional-chaining-7.7.5.tgz#f0835f044cef85b31071a924010a2a390add11d4" + integrity sha512-sOwFqT8JSchtJeDD+CjmWCaiFoLxY4Ps7NjvwHC/U7l4e9i5pTRNt8nDMIFSOUL+ncFbYSwruHM8WknYItWdXw== dependencies: "@babel/helper-plugin-utils" "^7.0.0" - "@babel/plugin-syntax-export-namespace-from" "^7.2.0" + "@babel/plugin-syntax-optional-chaining" "^7.7.4" -"@babel/plugin-proposal-json-strings@^7.2.0": - version "7.2.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-json-strings/-/plugin-proposal-json-strings-7.2.0.tgz#568ecc446c6148ae6b267f02551130891e29f317" - integrity sha512-MAFV1CA/YVmYwZG0fBQyXhmj0BHCB5egZHCKWIFVv/XCxAeVGIHfos3SwDck4LvCllENIAg7xMKOG5kH0dzyUg== +"@babel/plugin-proposal-unicode-property-regex@^7.7.4": + version "7.7.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-unicode-property-regex/-/plugin-proposal-unicode-property-regex-7.7.4.tgz#7c239ccaf09470dbe1d453d50057460e84517ebb" + integrity sha512-cHgqHgYvffluZk85dJ02vloErm3Y6xtH+2noOBOJ2kXOJH3aVCDnj5eR/lVNlTnYu4hndAPJD3rTFjW3qee0PA== dependencies: + "@babel/helper-create-regexp-features-plugin" "^7.7.4" "@babel/helper-plugin-utils" "^7.0.0" - "@babel/plugin-syntax-json-strings" "^7.2.0" -"@babel/plugin-proposal-numeric-separator@^7.2.0": - version "7.2.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-numeric-separator/-/plugin-proposal-numeric-separator-7.2.0.tgz#646854daf4cd22fd6733f6076013a936310443ac" - integrity sha512-DohMOGDrZiMKS7LthjUZNNcWl8TAf5BZDwZAH4wpm55FuJTHgfqPGdibg7rZDmont/8Yg0zA03IgT6XLeP+4sg== +"@babel/plugin-syntax-async-generators@^7.7.4": + version "7.7.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-async-generators/-/plugin-syntax-async-generators-7.7.4.tgz#331aaf310a10c80c44a66b238b6e49132bd3c889" + integrity sha512-Li4+EjSpBgxcsmeEF8IFcfV/+yJGxHXDirDkEoyFjumuwbmfCVHUt0HuowD/iGM7OhIRyXJH9YXxqiH6N815+g== dependencies: "@babel/helper-plugin-utils" "^7.0.0" - "@babel/plugin-syntax-numeric-separator" "^7.2.0" -"@babel/plugin-proposal-object-rest-spread@^7.4.4": - version "7.4.4" - resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-object-rest-spread/-/plugin-proposal-object-rest-spread-7.4.4.tgz#1ef173fcf24b3e2df92a678f027673b55e7e3005" - integrity sha512-dMBG6cSPBbHeEBdFXeQ2QLc5gUpg4Vkaz8octD4aoW/ISO+jBOcsuxYL7bsb5WSu8RLP6boxrBIALEHgoHtO9g== +"@babel/plugin-syntax-dynamic-import@^7.7.4": + version "7.7.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-dynamic-import/-/plugin-syntax-dynamic-import-7.7.4.tgz#29ca3b4415abfe4a5ec381e903862ad1a54c3aec" + integrity sha512-jHQW0vbRGvwQNgyVxwDh4yuXu4bH1f5/EICJLAhl1SblLs2CDhrsmCk+v5XLdE9wxtAFRyxx+P//Iw+a5L/tTg== dependencies: "@babel/helper-plugin-utils" "^7.0.0" - "@babel/plugin-syntax-object-rest-spread" "^7.2.0" -"@babel/plugin-proposal-optional-catch-binding@^7.2.0": - version "7.2.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-optional-catch-binding/-/plugin-proposal-optional-catch-binding-7.2.0.tgz#135d81edb68a081e55e56ec48541ece8065c38f5" - integrity sha512-mgYj3jCcxug6KUcX4OBoOJz3CMrwRfQELPQ5560F70YQUBZB7uac9fqaWamKR1iWUzGiK2t0ygzjTScZnVz75g== +"@babel/plugin-syntax-export-namespace-from@^7.7.4": + version "7.7.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-export-namespace-from/-/plugin-syntax-export-namespace-from-7.7.4.tgz#116c3e5db0d3e41018665528a468bc0f336044c3" + integrity sha512-YTc2djwMzJjiTTUJxJunRAnK0xW6OrmCSrgBc7QbWtpUo44FCkhZQtNcwZUqVf3sc4JFxhreiJ/P7YkmCTw4rg== dependencies: "@babel/helper-plugin-utils" "^7.0.0" - "@babel/plugin-syntax-optional-catch-binding" "^7.2.0" -"@babel/plugin-proposal-unicode-property-regex@^7.4.4": - version "7.4.4" - resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-unicode-property-regex/-/plugin-proposal-unicode-property-regex-7.4.4.tgz#501ffd9826c0b91da22690720722ac7cb1ca9c78" - integrity sha512-j1NwnOqMG9mFUOH58JTFsA/+ZYzQLUZ/drqWUqxCYLGeu2JFZL8YrNC9hBxKmWtAuOCHPcRpgv7fhap09Fb4kA== +"@babel/plugin-syntax-flow@^7.7.4": + version "7.7.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-flow/-/plugin-syntax-flow-7.7.4.tgz#6d91b59e1a0e4c17f36af2e10dd64ef220919d7b" + integrity sha512-2AMAWl5PsmM5KPkB22cvOkUyWk6MjUaqhHNU5nSPUl/ns3j5qLfw2SuYP5RbVZ0tfLvePr4zUScbICtDP2CUNw== dependencies: "@babel/helper-plugin-utils" "^7.0.0" - "@babel/helper-regex" "^7.4.4" - regexpu-core "^4.5.4" -"@babel/plugin-syntax-async-generators@^7.2.0": - version "7.2.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-async-generators/-/plugin-syntax-async-generators-7.2.0.tgz#69e1f0db34c6f5a0cf7e2b3323bf159a76c8cb7f" - integrity sha512-1ZrIRBv2t0GSlcwVoQ6VgSLpLgiN/FVQUzt9znxo7v2Ov4jJrs8RY8tv0wvDmFN3qIdMKWrmMMW6yZ0G19MfGg== +"@babel/plugin-syntax-json-strings@^7.7.4": + version "7.7.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-json-strings/-/plugin-syntax-json-strings-7.7.4.tgz#86e63f7d2e22f9e27129ac4e83ea989a382e86cc" + integrity sha512-QpGupahTQW1mHRXddMG5srgpHWqRLwJnJZKXTigB9RPFCCGbDGCgBeM/iC82ICXp414WeYx/tD54w7M2qRqTMg== dependencies: "@babel/helper-plugin-utils" "^7.0.0" -"@babel/plugin-syntax-export-namespace-from@^7.2.0": - version "7.2.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-export-namespace-from/-/plugin-syntax-export-namespace-from-7.2.0.tgz#8d257838c6b3b779db52c0224443459bd27fb039" - integrity sha512-1zGA3UNch6A+A11nIzBVEaE3DDJbjfB+eLIcf0GGOh/BJr/8NxL3546MGhV/r0RhH4xADFIEso39TKCfEMlsGA== +"@babel/plugin-syntax-nullish-coalescing-operator@^7.7.4": + version "7.7.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-nullish-coalescing-operator/-/plugin-syntax-nullish-coalescing-operator-7.7.4.tgz#e53b751d0c3061b1ba3089242524b65a7a9da12b" + integrity sha512-XKh/yIRPiQTOeBg0QJjEus5qiSKucKAiApNtO1psqG7D17xmE+X2i5ZqBEuSvo0HRuyPaKaSN/Gy+Ha9KFQolw== dependencies: "@babel/helper-plugin-utils" "^7.0.0" -"@babel/plugin-syntax-flow@^7.2.0": - version "7.2.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-flow/-/plugin-syntax-flow-7.2.0.tgz#a765f061f803bc48f240c26f8747faf97c26bf7c" - integrity sha512-r6YMuZDWLtLlu0kqIim5o/3TNRAlWb073HwT3e2nKf9I8IIvOggPrnILYPsrrKilmn/mYEMCf/Z07w3yQJF6dg== +"@babel/plugin-syntax-numeric-separator@^7.7.4": + version "7.7.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-numeric-separator/-/plugin-syntax-numeric-separator-7.7.4.tgz#39818f8042a09d4c6248d85d82555369da4da5c4" + integrity sha512-vmlUUBlLuFnbpaR+1kKIdo62xQEN+THWbtAHSEilo+0rHl2dKKCn6GLUVKpI848wL/T0ZPQgAy8asRJ9yYEjog== dependencies: "@babel/helper-plugin-utils" "^7.0.0" -"@babel/plugin-syntax-json-strings@^7.2.0": - version "7.2.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-json-strings/-/plugin-syntax-json-strings-7.2.0.tgz#72bd13f6ffe1d25938129d2a186b11fd62951470" - integrity sha512-5UGYnMSLRE1dqqZwug+1LISpA403HzlSfsg6P9VXU6TBjcSHeNlw4DxDx7LgpF+iKZoOG/+uzqoRHTdcUpiZNg== +"@babel/plugin-syntax-object-rest-spread@^7.0.0", "@babel/plugin-syntax-object-rest-spread@^7.7.4": + version "7.7.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-object-rest-spread/-/plugin-syntax-object-rest-spread-7.7.4.tgz#47cf220d19d6d0d7b154304701f468fc1cc6ff46" + integrity sha512-mObR+r+KZq0XhRVS2BrBKBpr5jqrqzlPvS9C9vuOf5ilSwzloAl7RPWLrgKdWS6IreaVrjHxTjtyqFiOisaCwg== dependencies: "@babel/helper-plugin-utils" "^7.0.0" -"@babel/plugin-syntax-numeric-separator@^7.2.0": - version "7.2.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-numeric-separator/-/plugin-syntax-numeric-separator-7.2.0.tgz#7470fe070c2944469a756752a69a6963135018be" - integrity sha512-DroeVNkO/BnGpL2R7+ZNZqW+E24aR/4YWxP3Qb15d6lPU8KDzF8HlIUIRCOJRn4X77/oyW4mJY+7FHfY82NLtQ== +"@babel/plugin-syntax-optional-catch-binding@^7.7.4": + version "7.7.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-optional-catch-binding/-/plugin-syntax-optional-catch-binding-7.7.4.tgz#a3e38f59f4b6233867b4a92dcb0ee05b2c334aa6" + integrity sha512-4ZSuzWgFxqHRE31Glu+fEr/MirNZOMYmD/0BhBWyLyOOQz/gTAl7QmWm2hX1QxEIXsr2vkdlwxIzTyiYRC4xcQ== dependencies: "@babel/helper-plugin-utils" "^7.0.0" -"@babel/plugin-syntax-object-rest-spread@^7.0.0", "@babel/plugin-syntax-object-rest-spread@^7.2.0": - version "7.2.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-object-rest-spread/-/plugin-syntax-object-rest-spread-7.2.0.tgz#3b7a3e733510c57e820b9142a6579ac8b0dfad2e" - integrity sha512-t0JKGgqk2We+9may3t0xDdmneaXmyxq0xieYcKHxIsrJO64n1OiMWNUtc5gQK1PA0NpdCRrtZp4z+IUaKugrSA== +"@babel/plugin-syntax-optional-chaining@^7.7.4": + version "7.7.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-optional-chaining/-/plugin-syntax-optional-chaining-7.7.4.tgz#c91fdde6de85d2eb8906daea7b21944c3610c901" + integrity sha512-2MqYD5WjZSbJdUagnJvIdSfkb/ucOC9/1fRJxm7GAxY6YQLWlUvkfxoNbUPcPLHJyetKUDQ4+yyuUyAoc0HriA== dependencies: "@babel/helper-plugin-utils" "^7.0.0" -"@babel/plugin-syntax-optional-catch-binding@^7.2.0": - version "7.2.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-optional-catch-binding/-/plugin-syntax-optional-catch-binding-7.2.0.tgz#a94013d6eda8908dfe6a477e7f9eda85656ecf5c" - integrity sha512-bDe4xKNhb0LI7IvZHiA13kff0KEfaGX/Hv4lMA9+7TEc63hMNvfKo6ZFpXhKuEp+II/q35Gc4NoMeDZyaUbj9w== +"@babel/plugin-syntax-top-level-await@^7.7.4": + version "7.7.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-top-level-await/-/plugin-syntax-top-level-await-7.7.4.tgz#bd7d8fa7b9fee793a36e4027fd6dd1aa32f946da" + integrity sha512-wdsOw0MvkL1UIgiQ/IFr3ETcfv1xb8RMM0H9wbiDyLaJFyiDg5oZvDLCXosIXmFeIlweML5iOBXAkqddkYNizg== dependencies: "@babel/helper-plugin-utils" "^7.0.0" -"@babel/plugin-transform-arrow-functions@^7.2.0": - version "7.2.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-arrow-functions/-/plugin-transform-arrow-functions-7.2.0.tgz#9aeafbe4d6ffc6563bf8f8372091628f00779550" - integrity sha512-ER77Cax1+8/8jCB9fo4Ud161OZzWN5qawi4GusDuRLcDbDG+bIGYY20zb2dfAFdTRGzrfq2xZPvF0R64EHnimg== +"@babel/plugin-transform-arrow-functions@^7.7.4": + version "7.7.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-arrow-functions/-/plugin-transform-arrow-functions-7.7.4.tgz#76309bd578addd8aee3b379d809c802305a98a12" + integrity sha512-zUXy3e8jBNPiffmqkHRNDdZM2r8DWhCB7HhcoyZjiK1TxYEluLHAvQuYnTT+ARqRpabWqy/NHkO6e3MsYB5YfA== dependencies: "@babel/helper-plugin-utils" "^7.0.0" -"@babel/plugin-transform-async-to-generator@^7.4.4": - version "7.4.4" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-async-to-generator/-/plugin-transform-async-to-generator-7.4.4.tgz#a3f1d01f2f21cadab20b33a82133116f14fb5894" - integrity sha512-YiqW2Li8TXmzgbXw+STsSqPBPFnGviiaSp6CYOq55X8GQ2SGVLrXB6pNid8HkqkZAzOH6knbai3snhP7v0fNwA== +"@babel/plugin-transform-async-to-generator@^7.7.4": + version "7.7.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-async-to-generator/-/plugin-transform-async-to-generator-7.7.4.tgz#694cbeae6d613a34ef0292713fa42fb45c4470ba" + integrity sha512-zpUTZphp5nHokuy8yLlyafxCJ0rSlFoSHypTUWgpdwoDXWQcseaect7cJ8Ppk6nunOM6+5rPMkod4OYKPR5MUg== dependencies: - "@babel/helper-module-imports" "^7.0.0" + "@babel/helper-module-imports" "^7.7.4" "@babel/helper-plugin-utils" "^7.0.0" - "@babel/helper-remap-async-to-generator" "^7.1.0" + "@babel/helper-remap-async-to-generator" "^7.7.4" -"@babel/plugin-transform-block-scoped-functions@^7.2.0": - version "7.2.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-block-scoped-functions/-/plugin-transform-block-scoped-functions-7.2.0.tgz#5d3cc11e8d5ddd752aa64c9148d0db6cb79fd190" - integrity sha512-ntQPR6q1/NKuphly49+QiQiTN0O63uOwjdD6dhIjSWBI5xlrbUFh720TIpzBhpnrLfv2tNH/BXvLIab1+BAI0w== +"@babel/plugin-transform-block-scoped-functions@^7.7.4": + version "7.7.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-block-scoped-functions/-/plugin-transform-block-scoped-functions-7.7.4.tgz#d0d9d5c269c78eaea76227ace214b8d01e4d837b" + integrity sha512-kqtQzwtKcpPclHYjLK//3lH8OFsCDuDJBaFhVwf8kqdnF6MN4l618UDlcA7TfRs3FayrHj+svYnSX8MC9zmUyQ== dependencies: "@babel/helper-plugin-utils" "^7.0.0" -"@babel/plugin-transform-block-scoping@^7.4.4": - version "7.4.4" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-block-scoping/-/plugin-transform-block-scoping-7.4.4.tgz#c13279fabf6b916661531841a23c4b7dae29646d" - integrity sha512-jkTUyWZcTrwxu5DD4rWz6rDB5Cjdmgz6z7M7RLXOJyCUkFBawssDGcGh8M/0FTSB87avyJI1HsTwUXp9nKA1PA== +"@babel/plugin-transform-block-scoping@^7.7.4": + version "7.7.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-block-scoping/-/plugin-transform-block-scoping-7.7.4.tgz#200aad0dcd6bb80372f94d9e628ea062c58bf224" + integrity sha512-2VBe9u0G+fDt9B5OV5DQH4KBf5DoiNkwFKOz0TCvBWvdAN2rOykCTkrL+jTLxfCAm76l9Qo5OqL7HBOx2dWggg== dependencies: "@babel/helper-plugin-utils" "^7.0.0" - lodash "^4.17.11" + lodash "^4.17.13" -"@babel/plugin-transform-classes@^7.4.4": - version "7.4.4" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-classes/-/plugin-transform-classes-7.4.4.tgz#0ce4094cdafd709721076d3b9c38ad31ca715eb6" - integrity sha512-/e44eFLImEGIpL9qPxSRat13I5QNRgBLu2hOQJCF7VLy/otSM/sypV1+XaIw5+502RX/+6YaSAPmldk+nhHDPw== +"@babel/plugin-transform-classes@^7.7.4": + version "7.7.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-classes/-/plugin-transform-classes-7.7.4.tgz#c92c14be0a1399e15df72667067a8f510c9400ec" + integrity sha512-sK1mjWat7K+buWRuImEzjNf68qrKcrddtpQo3swi9j7dUcG6y6R6+Di039QN2bD1dykeswlagupEmpOatFHHUg== dependencies: - "@babel/helper-annotate-as-pure" "^7.0.0" - "@babel/helper-define-map" "^7.4.4" - "@babel/helper-function-name" "^7.1.0" - "@babel/helper-optimise-call-expression" "^7.0.0" + "@babel/helper-annotate-as-pure" "^7.7.4" + "@babel/helper-define-map" "^7.7.4" + "@babel/helper-function-name" "^7.7.4" + "@babel/helper-optimise-call-expression" "^7.7.4" "@babel/helper-plugin-utils" "^7.0.0" - "@babel/helper-replace-supers" "^7.4.4" - "@babel/helper-split-export-declaration" "^7.4.4" + "@babel/helper-replace-supers" "^7.7.4" + "@babel/helper-split-export-declaration" "^7.7.4" globals "^11.1.0" -"@babel/plugin-transform-computed-properties@^7.2.0": - version "7.2.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-computed-properties/-/plugin-transform-computed-properties-7.2.0.tgz#83a7df6a658865b1c8f641d510c6f3af220216da" - integrity sha512-kP/drqTxY6Xt3NNpKiMomfgkNn4o7+vKxK2DDKcBG9sHj51vHqMBGy8wbDS/J4lMxnqs153/T3+DmCEAkC5cpA== +"@babel/plugin-transform-computed-properties@^7.7.4": + version "7.7.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-computed-properties/-/plugin-transform-computed-properties-7.7.4.tgz#e856c1628d3238ffe12d668eb42559f79a81910d" + integrity sha512-bSNsOsZnlpLLyQew35rl4Fma3yKWqK3ImWMSC/Nc+6nGjC9s5NFWAer1YQ899/6s9HxO2zQC1WoFNfkOqRkqRQ== dependencies: "@babel/helper-plugin-utils" "^7.0.0" -"@babel/plugin-transform-destructuring@^7.4.4": - version "7.4.4" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-destructuring/-/plugin-transform-destructuring-7.4.4.tgz#9d964717829cc9e4b601fc82a26a71a4d8faf20f" - integrity sha512-/aOx+nW0w8eHiEHm+BTERB2oJn5D127iye/SUQl7NjHy0lf+j7h4MKMMSOwdazGq9OxgiNADncE+SRJkCxjZpQ== +"@babel/plugin-transform-destructuring@^7.7.4": + version "7.7.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-destructuring/-/plugin-transform-destructuring-7.7.4.tgz#2b713729e5054a1135097b6a67da1b6fe8789267" + integrity sha512-4jFMXI1Cu2aXbcXXl8Lr6YubCn6Oc7k9lLsu8v61TZh+1jny2BWmdtvY9zSUlLdGUvcy9DMAWyZEOqjsbeg/wA== dependencies: "@babel/helper-plugin-utils" "^7.0.0" -"@babel/plugin-transform-dotall-regex@^7.4.4": - version "7.4.4" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-dotall-regex/-/plugin-transform-dotall-regex-7.4.4.tgz#361a148bc951444312c69446d76ed1ea8e4450c3" - integrity sha512-P05YEhRc2h53lZDjRPk/OektxCVevFzZs2Gfjd545Wde3k+yFDbXORgl2e0xpbq8mLcKJ7Idss4fAg0zORN/zg== +"@babel/plugin-transform-dotall-regex@^7.7.4": + version "7.7.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-dotall-regex/-/plugin-transform-dotall-regex-7.7.4.tgz#f7ccda61118c5b7a2599a72d5e3210884a021e96" + integrity sha512-mk0cH1zyMa/XHeb6LOTXTbG7uIJ8Rrjlzu91pUx/KS3JpcgaTDwMS8kM+ar8SLOvlL2Lofi4CGBAjCo3a2x+lw== dependencies: + "@babel/helper-create-regexp-features-plugin" "^7.7.4" "@babel/helper-plugin-utils" "^7.0.0" - "@babel/helper-regex" "^7.4.4" - regexpu-core "^4.5.4" -"@babel/plugin-transform-duplicate-keys@^7.2.0": - version "7.2.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-duplicate-keys/-/plugin-transform-duplicate-keys-7.2.0.tgz#d952c4930f312a4dbfff18f0b2914e60c35530b3" - integrity sha512-q+yuxW4DsTjNceUiTzK0L+AfQ0zD9rWaTLiUqHA8p0gxx7lu1EylenfzjeIWNkPy6e/0VG/Wjw9uf9LueQwLOw== +"@babel/plugin-transform-duplicate-keys@^7.7.4": + version "7.7.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-duplicate-keys/-/plugin-transform-duplicate-keys-7.7.4.tgz#3d21731a42e3f598a73835299dd0169c3b90ac91" + integrity sha512-g1y4/G6xGWMD85Tlft5XedGaZBCIVN+/P0bs6eabmcPP9egFleMAo65OOjlhcz1njpwagyY3t0nsQC9oTFegJA== dependencies: "@babel/helper-plugin-utils" "^7.0.0" -"@babel/plugin-transform-exponentiation-operator@^7.2.0": - version "7.2.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-exponentiation-operator/-/plugin-transform-exponentiation-operator-7.2.0.tgz#a63868289e5b4007f7054d46491af51435766008" - integrity sha512-umh4hR6N7mu4Elq9GG8TOu9M0bakvlsREEC+ialrQN6ABS4oDQ69qJv1VtR3uxlKMCQMCvzk7vr17RHKcjx68A== +"@babel/plugin-transform-exponentiation-operator@^7.7.4": + version "7.7.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-exponentiation-operator/-/plugin-transform-exponentiation-operator-7.7.4.tgz#dd30c0191e3a1ba19bcc7e389bdfddc0729d5db9" + integrity sha512-MCqiLfCKm6KEA1dglf6Uqq1ElDIZwFuzz1WH5mTf8k2uQSxEJMbOIEh7IZv7uichr7PMfi5YVSrr1vz+ipp7AQ== dependencies: - "@babel/helper-builder-binary-assignment-operator-visitor" "^7.1.0" + "@babel/helper-builder-binary-assignment-operator-visitor" "^7.7.4" "@babel/helper-plugin-utils" "^7.0.0" -"@babel/plugin-transform-flow-strip-types@^7.0.0": - version "7.4.4" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-flow-strip-types/-/plugin-transform-flow-strip-types-7.4.4.tgz#d267a081f49a8705fc9146de0768c6b58dccd8f7" - integrity sha512-WyVedfeEIILYEaWGAUWzVNyqG4sfsNooMhXWsu/YzOvVGcsnPb5PguysjJqI3t3qiaYj0BR8T2f5njdjTGe44Q== +"@babel/plugin-transform-flow-strip-types@^7.7.4": + version "7.7.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-flow-strip-types/-/plugin-transform-flow-strip-types-7.7.4.tgz#cc73f85944782df1d77d80977bc097920a8bf31a" + integrity sha512-w9dRNlHY5ElNimyMYy0oQowvQpwt/PRHI0QS98ZJCTZU2bvSnKXo5zEiD5u76FBPigTm8TkqzmnUTg16T7qbkA== dependencies: "@babel/helper-plugin-utils" "^7.0.0" - "@babel/plugin-syntax-flow" "^7.2.0" + "@babel/plugin-syntax-flow" "^7.7.4" -"@babel/plugin-transform-for-of@^7.4.4": - version "7.4.4" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-for-of/-/plugin-transform-for-of-7.4.4.tgz#0267fc735e24c808ba173866c6c4d1440fc3c556" - integrity sha512-9T/5Dlr14Z9TIEXLXkt8T1DU7F24cbhwhMNUziN3hB1AXoZcdzPcTiKGRn/6iOymDqtTKWnr/BtRKN9JwbKtdQ== +"@babel/plugin-transform-for-of@^7.7.4": + version "7.7.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-for-of/-/plugin-transform-for-of-7.7.4.tgz#248800e3a5e507b1f103d8b4ca998e77c63932bc" + integrity sha512-zZ1fD1B8keYtEcKF+M1TROfeHTKnijcVQm0yO/Yu1f7qoDoxEIc/+GX6Go430Bg84eM/xwPFp0+h4EbZg7epAA== dependencies: "@babel/helper-plugin-utils" "^7.0.0" -"@babel/plugin-transform-function-name@^7.4.4": - version "7.4.4" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-function-name/-/plugin-transform-function-name-7.4.4.tgz#e1436116abb0610c2259094848754ac5230922ad" - integrity sha512-iU9pv7U+2jC9ANQkKeNF6DrPy4GBa4NWQtl6dHB4Pb3izX2JOEvDTFarlNsBj/63ZEzNNIAMs3Qw4fNCcSOXJA== +"@babel/plugin-transform-function-name@^7.7.4": + version "7.7.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-function-name/-/plugin-transform-function-name-7.7.4.tgz#75a6d3303d50db638ff8b5385d12451c865025b1" + integrity sha512-E/x09TvjHNhsULs2IusN+aJNRV5zKwxu1cpirZyRPw+FyyIKEHPXTsadj48bVpc1R5Qq1B5ZkzumuFLytnbT6g== dependencies: - "@babel/helper-function-name" "^7.1.0" + "@babel/helper-function-name" "^7.7.4" "@babel/helper-plugin-utils" "^7.0.0" -"@babel/plugin-transform-literals@^7.2.0": - version "7.2.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-literals/-/plugin-transform-literals-7.2.0.tgz#690353e81f9267dad4fd8cfd77eafa86aba53ea1" - integrity sha512-2ThDhm4lI4oV7fVQ6pNNK+sx+c/GM5/SaML0w/r4ZB7sAneD/piDJtwdKlNckXeyGK7wlwg2E2w33C/Hh+VFCg== +"@babel/plugin-transform-literals@^7.7.4": + version "7.7.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-literals/-/plugin-transform-literals-7.7.4.tgz#27fe87d2b5017a2a5a34d1c41a6b9f6a6262643e" + integrity sha512-X2MSV7LfJFm4aZfxd0yLVFrEXAgPqYoDG53Br/tCKiKYfX0MjVjQeWPIhPHHsCqzwQANq+FLN786fF5rgLS+gw== dependencies: "@babel/helper-plugin-utils" "^7.0.0" -"@babel/plugin-transform-member-expression-literals@^7.2.0": - version "7.2.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-member-expression-literals/-/plugin-transform-member-expression-literals-7.2.0.tgz#fa10aa5c58a2cb6afcf2c9ffa8cb4d8b3d489a2d" - integrity sha512-HiU3zKkSU6scTidmnFJ0bMX8hz5ixC93b4MHMiYebmk2lUVNGOboPsqQvx5LzooihijUoLR/v7Nc1rbBtnc7FA== +"@babel/plugin-transform-member-expression-literals@^7.7.4": + version "7.7.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-member-expression-literals/-/plugin-transform-member-expression-literals-7.7.4.tgz#aee127f2f3339fc34ce5e3055d7ffbf7aa26f19a" + integrity sha512-9VMwMO7i69LHTesL0RdGy93JU6a+qOPuvB4F4d0kR0zyVjJRVJRaoaGjhtki6SzQUu8yen/vxPKN6CWnCUw6bA== dependencies: "@babel/helper-plugin-utils" "^7.0.0" -"@babel/plugin-transform-modules-amd@^7.2.0": - version "7.2.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-amd/-/plugin-transform-modules-amd-7.2.0.tgz#82a9bce45b95441f617a24011dc89d12da7f4ee6" - integrity sha512-mK2A8ucqz1qhrdqjS9VMIDfIvvT2thrEsIQzbaTdc5QFzhDjQv2CkJJ5f6BXIkgbmaoax3zBr2RyvV/8zeoUZw== +"@babel/plugin-transform-modules-amd@^7.7.5": + version "7.7.5" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-amd/-/plugin-transform-modules-amd-7.7.5.tgz#39e0fb717224b59475b306402bb8eedab01e729c" + integrity sha512-CT57FG4A2ZUNU1v+HdvDSDrjNWBrtCmSH6YbbgN3Lrf0Di/q/lWRxZrE72p3+HCCz9UjfZOEBdphgC0nzOS6DQ== dependencies: - "@babel/helper-module-transforms" "^7.1.0" + "@babel/helper-module-transforms" "^7.7.5" "@babel/helper-plugin-utils" "^7.0.0" + babel-plugin-dynamic-import-node "^2.3.0" -"@babel/plugin-transform-modules-commonjs@^7.4.4": - version "7.4.4" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-commonjs/-/plugin-transform-modules-commonjs-7.4.4.tgz#0bef4713d30f1d78c2e59b3d6db40e60192cac1e" - integrity sha512-4sfBOJt58sEo9a2BQXnZq+Q3ZTSAUXyK3E30o36BOGnJ+tvJ6YSxF0PG6kERvbeISgProodWuI9UVG3/FMY6iw== +"@babel/plugin-transform-modules-commonjs@^7.7.0", "@babel/plugin-transform-modules-commonjs@^7.7.5": + version "7.7.5" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-commonjs/-/plugin-transform-modules-commonjs-7.7.5.tgz#1d27f5eb0bcf7543e774950e5b2fa782e637b345" + integrity sha512-9Cq4zTFExwFhQI6MT1aFxgqhIsMWQWDVwOgLzl7PTWJHsNaqFvklAU+Oz6AQLAS0dJKTwZSOCo20INwktxpi3Q== dependencies: - "@babel/helper-module-transforms" "^7.4.4" + "@babel/helper-module-transforms" "^7.7.5" "@babel/helper-plugin-utils" "^7.0.0" - "@babel/helper-simple-access" "^7.1.0" + "@babel/helper-simple-access" "^7.7.4" + babel-plugin-dynamic-import-node "^2.3.0" -"@babel/plugin-transform-modules-systemjs@^7.4.4": - version "7.4.4" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-systemjs/-/plugin-transform-modules-systemjs-7.4.4.tgz#dc83c5665b07d6c2a7b224c00ac63659ea36a405" - integrity sha512-MSiModfILQc3/oqnG7NrP1jHaSPryO6tA2kOMmAQApz5dayPxWiHqmq4sWH2xF5LcQK56LlbKByCd8Aah/OIkQ== +"@babel/plugin-transform-modules-systemjs@^7.7.4": + version "7.7.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-systemjs/-/plugin-transform-modules-systemjs-7.7.4.tgz#cd98152339d3e763dfe838b7d4273edaf520bb30" + integrity sha512-y2c96hmcsUi6LrMqvmNDPBBiGCiQu0aYqpHatVVu6kD4mFEXKjyNxd/drc18XXAf9dv7UXjrZwBVmTTGaGP8iw== dependencies: - "@babel/helper-hoist-variables" "^7.4.4" + "@babel/helper-hoist-variables" "^7.7.4" "@babel/helper-plugin-utils" "^7.0.0" + babel-plugin-dynamic-import-node "^2.3.0" -"@babel/plugin-transform-modules-umd@^7.2.0": - version "7.2.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-umd/-/plugin-transform-modules-umd-7.2.0.tgz#7678ce75169f0877b8eb2235538c074268dd01ae" - integrity sha512-BV3bw6MyUH1iIsGhXlOK6sXhmSarZjtJ/vMiD9dNmpY8QXFFQTj+6v92pcfy1iqa8DeAfJFwoxcrS/TUZda6sw== +"@babel/plugin-transform-modules-umd@^7.7.4": + version "7.7.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-umd/-/plugin-transform-modules-umd-7.7.4.tgz#1027c355a118de0aae9fee00ad7813c584d9061f" + integrity sha512-u2B8TIi0qZI4j8q4C51ktfO7E3cQ0qnaXFI1/OXITordD40tt17g/sXqgNNCcMTcBFKrUPcGDx+TBJuZxLx7tw== dependencies: - "@babel/helper-module-transforms" "^7.1.0" + "@babel/helper-module-transforms" "^7.7.4" "@babel/helper-plugin-utils" "^7.0.0" -"@babel/plugin-transform-named-capturing-groups-regex@^7.4.5": - version "7.4.5" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-named-capturing-groups-regex/-/plugin-transform-named-capturing-groups-regex-7.4.5.tgz#9d269fd28a370258199b4294736813a60bbdd106" - integrity sha512-z7+2IsWafTBbjNsOxU/Iv5CvTJlr5w4+HGu1HovKYTtgJ362f7kBcQglkfmlspKKZ3bgrbSGvLfNx++ZJgCWsg== +"@babel/plugin-transform-named-capturing-groups-regex@^7.7.4": + version "7.7.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-named-capturing-groups-regex/-/plugin-transform-named-capturing-groups-regex-7.7.4.tgz#fb3bcc4ee4198e7385805007373d6b6f42c98220" + integrity sha512-jBUkiqLKvUWpv9GLSuHUFYdmHg0ujC1JEYoZUfeOOfNydZXp1sXObgyPatpcwjWgsdBGsagWW0cdJpX/DO2jMw== dependencies: - regexp-tree "^0.1.6" + "@babel/helper-create-regexp-features-plugin" "^7.7.4" -"@babel/plugin-transform-new-target@^7.4.4": - version "7.4.4" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-new-target/-/plugin-transform-new-target-7.4.4.tgz#18d120438b0cc9ee95a47f2c72bc9768fbed60a5" - integrity sha512-r1z3T2DNGQwwe2vPGZMBNjioT2scgWzK9BCnDEh+46z8EEwXBq24uRzd65I7pjtugzPSj921aM15RpESgzsSuA== +"@babel/plugin-transform-new-target@^7.7.4": + version "7.7.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-new-target/-/plugin-transform-new-target-7.7.4.tgz#4a0753d2d60639437be07b592a9e58ee00720167" + integrity sha512-CnPRiNtOG1vRodnsyGX37bHQleHE14B9dnnlgSeEs3ek3fHN1A1SScglTCg1sfbe7sRQ2BUcpgpTpWSfMKz3gg== dependencies: "@babel/helper-plugin-utils" "^7.0.0" -"@babel/plugin-transform-object-super@^7.2.0": - version "7.2.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-object-super/-/plugin-transform-object-super-7.2.0.tgz#b35d4c10f56bab5d650047dad0f1d8e8814b6598" - integrity sha512-VMyhPYZISFZAqAPVkiYb7dUe2AsVi2/wCT5+wZdsNO31FojQJa9ns40hzZ6U9f50Jlq4w6qwzdBB2uwqZ00ebg== +"@babel/plugin-transform-object-super@^7.7.4": + version "7.7.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-object-super/-/plugin-transform-object-super-7.7.4.tgz#48488937a2d586c0148451bf51af9d7dda567262" + integrity sha512-ho+dAEhC2aRnff2JCA0SAK7V2R62zJd/7dmtoe7MHcso4C2mS+vZjn1Pb1pCVZvJs1mgsvv5+7sT+m3Bysb6eg== dependencies: "@babel/helper-plugin-utils" "^7.0.0" - "@babel/helper-replace-supers" "^7.1.0" + "@babel/helper-replace-supers" "^7.7.4" -"@babel/plugin-transform-parameters@^7.4.4": - version "7.4.4" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-parameters/-/plugin-transform-parameters-7.4.4.tgz#7556cf03f318bd2719fe4c922d2d808be5571e16" - integrity sha512-oMh5DUO1V63nZcu/ZVLQFqiihBGo4OpxJxR1otF50GMeCLiRx5nUdtokd+u9SuVJrvvuIh9OosRFPP4pIPnwmw== +"@babel/plugin-transform-parameters@^7.7.4": + version "7.7.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-parameters/-/plugin-transform-parameters-7.7.4.tgz#da4555c97f39b51ac089d31c7380f03bca4075ce" + integrity sha512-VJwhVePWPa0DqE9vcfptaJSzNDKrWU/4FbYCjZERtmqEs05g3UMXnYMZoXja7JAJ7Y7sPZipwm/pGApZt7wHlw== dependencies: - "@babel/helper-call-delegate" "^7.4.4" - "@babel/helper-get-function-arity" "^7.0.0" + "@babel/helper-call-delegate" "^7.7.4" + "@babel/helper-get-function-arity" "^7.7.4" "@babel/helper-plugin-utils" "^7.0.0" -"@babel/plugin-transform-property-literals@^7.2.0": - version "7.2.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-property-literals/-/plugin-transform-property-literals-7.2.0.tgz#03e33f653f5b25c4eb572c98b9485055b389e905" - integrity sha512-9q7Dbk4RhgcLp8ebduOpCbtjh7C0itoLYHXd9ueASKAG/is5PQtMR5VJGka9NKqGhYEGn5ITahd4h9QeBMylWQ== +"@babel/plugin-transform-property-literals@^7.7.4": + version "7.7.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-property-literals/-/plugin-transform-property-literals-7.7.4.tgz#2388d6505ef89b266103f450f9167e6bd73f98c2" + integrity sha512-MatJhlC4iHsIskWYyawl53KuHrt+kALSADLQQ/HkhTjX954fkxIEh4q5slL4oRAnsm/eDoZ4q0CIZpcqBuxhJQ== dependencies: "@babel/helper-plugin-utils" "^7.0.0" -"@babel/plugin-transform-regenerator@^7.4.5": - version "7.4.5" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-regenerator/-/plugin-transform-regenerator-7.4.5.tgz#629dc82512c55cee01341fb27bdfcb210354680f" - integrity sha512-gBKRh5qAaCWntnd09S8QC7r3auLCqq5DI6O0DlfoyDjslSBVqBibrMdsqO+Uhmx3+BlOmE/Kw1HFxmGbv0N9dA== +"@babel/plugin-transform-regenerator@^7.7.5": + version "7.7.5" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-regenerator/-/plugin-transform-regenerator-7.7.5.tgz#3a8757ee1a2780f390e89f246065ecf59c26fce9" + integrity sha512-/8I8tPvX2FkuEyWbjRCt4qTAgZK0DVy8QRguhA524UH48RfGJy94On2ri+dCuwOpcerPRl9O4ebQkRcVzIaGBw== dependencies: regenerator-transform "^0.14.0" -"@babel/plugin-transform-reserved-words@^7.2.0": - version "7.2.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-reserved-words/-/plugin-transform-reserved-words-7.2.0.tgz#4792af87c998a49367597d07fedf02636d2e1634" - integrity sha512-fz43fqW8E1tAB3DKF19/vxbpib1fuyCwSPE418ge5ZxILnBhWyhtPgz8eh1RCGGJlwvksHkyxMxh0eenFi+kFw== +"@babel/plugin-transform-reserved-words@^7.7.4": + version "7.7.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-reserved-words/-/plugin-transform-reserved-words-7.7.4.tgz#6a7cf123ad175bb5c69aec8f6f0770387ed3f1eb" + integrity sha512-OrPiUB5s5XvkCO1lS7D8ZtHcswIC57j62acAnJZKqGGnHP+TIc/ljQSrgdX/QyOTdEK5COAhuc820Hi1q2UgLQ== dependencies: "@babel/helper-plugin-utils" "^7.0.0" -"@babel/plugin-transform-runtime@^7.4.4": - version "7.4.4" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-runtime/-/plugin-transform-runtime-7.4.4.tgz#a50f5d16e9c3a4ac18a1a9f9803c107c380bce08" - integrity sha512-aMVojEjPszvau3NRg+TIH14ynZLvPewH4xhlCW1w6A3rkxTS1m4uwzRclYR9oS+rl/dr+kT+pzbfHuAWP/lc7Q== +"@babel/plugin-transform-runtime@^7.6.2": + version "7.7.6" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-runtime/-/plugin-transform-runtime-7.7.6.tgz#4f2b548c88922fb98ec1c242afd4733ee3e12f61" + integrity sha512-tajQY+YmXR7JjTwRvwL4HePqoL3DYxpYXIHKVvrOIvJmeHe2y1w4tz5qz9ObUDC9m76rCzIMPyn4eERuwA4a4A== dependencies: - "@babel/helper-module-imports" "^7.0.0" + "@babel/helper-module-imports" "^7.7.4" "@babel/helper-plugin-utils" "^7.0.0" resolve "^1.8.1" semver "^5.5.1" -"@babel/plugin-transform-shorthand-properties@^7.2.0": - version "7.2.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-shorthand-properties/-/plugin-transform-shorthand-properties-7.2.0.tgz#6333aee2f8d6ee7e28615457298934a3b46198f0" - integrity sha512-QP4eUM83ha9zmYtpbnyjTLAGKQritA5XW/iG9cjtuOI8s1RuL/3V6a3DeSHfKutJQ+ayUfeZJPcnCYEQzaPQqg== +"@babel/plugin-transform-shorthand-properties@^7.7.4": + version "7.7.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-shorthand-properties/-/plugin-transform-shorthand-properties-7.7.4.tgz#74a0a9b2f6d67a684c6fbfd5f0458eb7ba99891e" + integrity sha512-q+suddWRfIcnyG5YiDP58sT65AJDZSUhXQDZE3r04AuqD6d/XLaQPPXSBzP2zGerkgBivqtQm9XKGLuHqBID6Q== dependencies: "@babel/helper-plugin-utils" "^7.0.0" -"@babel/plugin-transform-spread@^7.2.0": - version "7.2.2" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-spread/-/plugin-transform-spread-7.2.2.tgz#3103a9abe22f742b6d406ecd3cd49b774919b406" - integrity sha512-KWfky/58vubwtS0hLqEnrWJjsMGaOeSBn90Ezn5Jeg9Z8KKHmELbP1yGylMlm5N6TPKeY9A2+UaSYLdxahg01w== +"@babel/plugin-transform-spread@^7.7.4": + version "7.7.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-spread/-/plugin-transform-spread-7.7.4.tgz#aa673b356fe6b7e70d69b6e33a17fef641008578" + integrity sha512-8OSs0FLe5/80cndziPlg4R0K6HcWSM0zyNhHhLsmw/Nc5MaA49cAsnoJ/t/YZf8qkG7fD+UjTRaApVDB526d7Q== dependencies: "@babel/helper-plugin-utils" "^7.0.0" -"@babel/plugin-transform-sticky-regex@^7.2.0": - version "7.2.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-sticky-regex/-/plugin-transform-sticky-regex-7.2.0.tgz#a1e454b5995560a9c1e0d537dfc15061fd2687e1" - integrity sha512-KKYCoGaRAf+ckH8gEL3JHUaFVyNHKe3ASNsZ+AlktgHevvxGigoIttrEJb8iKN03Q7Eazlv1s6cx2B2cQ3Jabw== +"@babel/plugin-transform-sticky-regex@^7.7.4": + version "7.7.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-sticky-regex/-/plugin-transform-sticky-regex-7.7.4.tgz#ffb68c05090c30732076b1285dc1401b404a123c" + integrity sha512-Ls2NASyL6qtVe1H1hXts9yuEeONV2TJZmplLONkMPUG158CtmnrzW5Q5teibM5UVOFjG0D3IC5mzXR6pPpUY7A== dependencies: "@babel/helper-plugin-utils" "^7.0.0" "@babel/helper-regex" "^7.0.0" -"@babel/plugin-transform-template-literals@^7.4.4": - version "7.4.4" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-template-literals/-/plugin-transform-template-literals-7.4.4.tgz#9d28fea7bbce637fb7612a0750989d8321d4bcb0" - integrity sha512-mQrEC4TWkhLN0z8ygIvEL9ZEToPhG5K7KDW3pzGqOfIGZ28Jb0POUkeWcoz8HnHvhFy6dwAT1j8OzqN8s804+g== +"@babel/plugin-transform-template-literals@^7.7.4": + version "7.7.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-template-literals/-/plugin-transform-template-literals-7.7.4.tgz#1eb6411736dd3fe87dbd20cc6668e5121c17d604" + integrity sha512-sA+KxLwF3QwGj5abMHkHgshp9+rRz+oY9uoRil4CyLtgEuE/88dpkeWgNk5qKVsJE9iSfly3nvHapdRiIS2wnQ== dependencies: - "@babel/helper-annotate-as-pure" "^7.0.0" + "@babel/helper-annotate-as-pure" "^7.7.4" "@babel/helper-plugin-utils" "^7.0.0" -"@babel/plugin-transform-typeof-symbol@^7.2.0": - version "7.2.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-typeof-symbol/-/plugin-transform-typeof-symbol-7.2.0.tgz#117d2bcec2fbf64b4b59d1f9819894682d29f2b2" - integrity sha512-2LNhETWYxiYysBtrBTqL8+La0jIoQQnIScUJc74OYvUGRmkskNY4EzLCnjHBzdmb38wqtTaixpo1NctEcvMDZw== +"@babel/plugin-transform-typeof-symbol@^7.7.4": + version "7.7.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-typeof-symbol/-/plugin-transform-typeof-symbol-7.7.4.tgz#3174626214f2d6de322882e498a38e8371b2140e" + integrity sha512-KQPUQ/7mqe2m0B8VecdyaW5XcQYaePyl9R7IsKd+irzj6jvbhoGnRE+M0aNkyAzI07VfUQ9266L5xMARitV3wg== dependencies: "@babel/helper-plugin-utils" "^7.0.0" -"@babel/plugin-transform-unicode-regex@^7.4.4": - version "7.4.4" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-unicode-regex/-/plugin-transform-unicode-regex-7.4.4.tgz#ab4634bb4f14d36728bf5978322b35587787970f" - integrity sha512-il+/XdNw01i93+M9J9u4T7/e/Ue/vWfNZE4IRUQjplu2Mqb/AFTDimkw2tdEdSH50wuQXZAbXSql0UphQke+vA== +"@babel/plugin-transform-unicode-regex@^7.7.4": + version "7.7.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-unicode-regex/-/plugin-transform-unicode-regex-7.7.4.tgz#a3c0f65b117c4c81c5b6484f2a5e7b95346b83ae" + integrity sha512-N77UUIV+WCvE+5yHw+oks3m18/umd7y392Zv7mYTpFqHtkpcc+QUz+gLJNTWVlWROIWeLqY0f3OjZxV5TcXnRw== dependencies: + "@babel/helper-create-regexp-features-plugin" "^7.7.4" "@babel/helper-plugin-utils" "^7.0.0" - "@babel/helper-regex" "^7.4.4" - regexpu-core "^4.5.4" -"@babel/preset-env@^7.4.5": - version "7.4.5" - resolved "https://registry.yarnpkg.com/@babel/preset-env/-/preset-env-7.4.5.tgz#2fad7f62983d5af563b5f3139242755884998a58" - integrity sha512-f2yNVXM+FsR5V8UwcFeIHzHWgnhXg3NpRmy0ADvALpnhB0SLbCvrCRr4BLOUYbQNLS+Z0Yer46x9dJXpXewI7w== +"@babel/preset-env@^7.7.1": + version "7.7.6" + resolved "https://registry.yarnpkg.com/@babel/preset-env/-/preset-env-7.7.6.tgz#39ac600427bbb94eec6b27953f1dfa1d64d457b2" + integrity sha512-k5hO17iF/Q7tR9Jv8PdNBZWYW6RofxhnxKjBMc0nG4JTaWvOTiPoO/RLFwAKcA4FpmuBFm6jkoqaRJLGi0zdaQ== dependencies: - "@babel/helper-module-imports" "^7.0.0" + "@babel/helper-module-imports" "^7.7.4" "@babel/helper-plugin-utils" "^7.0.0" - "@babel/plugin-proposal-async-generator-functions" "^7.2.0" - "@babel/plugin-proposal-json-strings" "^7.2.0" - "@babel/plugin-proposal-object-rest-spread" "^7.4.4" - "@babel/plugin-proposal-optional-catch-binding" "^7.2.0" - "@babel/plugin-proposal-unicode-property-regex" "^7.4.4" - "@babel/plugin-syntax-async-generators" "^7.2.0" - "@babel/plugin-syntax-json-strings" "^7.2.0" - "@babel/plugin-syntax-object-rest-spread" "^7.2.0" - "@babel/plugin-syntax-optional-catch-binding" "^7.2.0" - "@babel/plugin-transform-arrow-functions" "^7.2.0" - "@babel/plugin-transform-async-to-generator" "^7.4.4" - "@babel/plugin-transform-block-scoped-functions" "^7.2.0" - "@babel/plugin-transform-block-scoping" "^7.4.4" - "@babel/plugin-transform-classes" "^7.4.4" - "@babel/plugin-transform-computed-properties" "^7.2.0" - "@babel/plugin-transform-destructuring" "^7.4.4" - "@babel/plugin-transform-dotall-regex" "^7.4.4" - "@babel/plugin-transform-duplicate-keys" "^7.2.0" - "@babel/plugin-transform-exponentiation-operator" "^7.2.0" - "@babel/plugin-transform-for-of" "^7.4.4" - "@babel/plugin-transform-function-name" "^7.4.4" - "@babel/plugin-transform-literals" "^7.2.0" - "@babel/plugin-transform-member-expression-literals" "^7.2.0" - "@babel/plugin-transform-modules-amd" "^7.2.0" - "@babel/plugin-transform-modules-commonjs" "^7.4.4" - "@babel/plugin-transform-modules-systemjs" "^7.4.4" - "@babel/plugin-transform-modules-umd" "^7.2.0" - "@babel/plugin-transform-named-capturing-groups-regex" "^7.4.5" - "@babel/plugin-transform-new-target" "^7.4.4" - "@babel/plugin-transform-object-super" "^7.2.0" - "@babel/plugin-transform-parameters" "^7.4.4" - "@babel/plugin-transform-property-literals" "^7.2.0" - "@babel/plugin-transform-regenerator" "^7.4.5" - "@babel/plugin-transform-reserved-words" "^7.2.0" - "@babel/plugin-transform-shorthand-properties" "^7.2.0" - "@babel/plugin-transform-spread" "^7.2.0" - "@babel/plugin-transform-sticky-regex" "^7.2.0" - "@babel/plugin-transform-template-literals" "^7.4.4" - "@babel/plugin-transform-typeof-symbol" "^7.2.0" - "@babel/plugin-transform-unicode-regex" "^7.4.4" - "@babel/types" "^7.4.4" + "@babel/plugin-proposal-async-generator-functions" "^7.7.4" + "@babel/plugin-proposal-dynamic-import" "^7.7.4" + "@babel/plugin-proposal-json-strings" "^7.7.4" + "@babel/plugin-proposal-object-rest-spread" "^7.7.4" + "@babel/plugin-proposal-optional-catch-binding" "^7.7.4" + "@babel/plugin-proposal-unicode-property-regex" "^7.7.4" + "@babel/plugin-syntax-async-generators" "^7.7.4" + "@babel/plugin-syntax-dynamic-import" "^7.7.4" + "@babel/plugin-syntax-json-strings" "^7.7.4" + "@babel/plugin-syntax-object-rest-spread" "^7.7.4" + "@babel/plugin-syntax-optional-catch-binding" "^7.7.4" + "@babel/plugin-syntax-top-level-await" "^7.7.4" + "@babel/plugin-transform-arrow-functions" "^7.7.4" + "@babel/plugin-transform-async-to-generator" "^7.7.4" + "@babel/plugin-transform-block-scoped-functions" "^7.7.4" + "@babel/plugin-transform-block-scoping" "^7.7.4" + "@babel/plugin-transform-classes" "^7.7.4" + "@babel/plugin-transform-computed-properties" "^7.7.4" + "@babel/plugin-transform-destructuring" "^7.7.4" + "@babel/plugin-transform-dotall-regex" "^7.7.4" + "@babel/plugin-transform-duplicate-keys" "^7.7.4" + "@babel/plugin-transform-exponentiation-operator" "^7.7.4" + "@babel/plugin-transform-for-of" "^7.7.4" + "@babel/plugin-transform-function-name" "^7.7.4" + "@babel/plugin-transform-literals" "^7.7.4" + "@babel/plugin-transform-member-expression-literals" "^7.7.4" + "@babel/plugin-transform-modules-amd" "^7.7.5" + "@babel/plugin-transform-modules-commonjs" "^7.7.5" + "@babel/plugin-transform-modules-systemjs" "^7.7.4" + "@babel/plugin-transform-modules-umd" "^7.7.4" + "@babel/plugin-transform-named-capturing-groups-regex" "^7.7.4" + "@babel/plugin-transform-new-target" "^7.7.4" + "@babel/plugin-transform-object-super" "^7.7.4" + "@babel/plugin-transform-parameters" "^7.7.4" + "@babel/plugin-transform-property-literals" "^7.7.4" + "@babel/plugin-transform-regenerator" "^7.7.5" + "@babel/plugin-transform-reserved-words" "^7.7.4" + "@babel/plugin-transform-shorthand-properties" "^7.7.4" + "@babel/plugin-transform-spread" "^7.7.4" + "@babel/plugin-transform-sticky-regex" "^7.7.4" + "@babel/plugin-transform-template-literals" "^7.7.4" + "@babel/plugin-transform-typeof-symbol" "^7.7.4" + "@babel/plugin-transform-unicode-regex" "^7.7.4" + "@babel/types" "^7.7.4" browserslist "^4.6.0" - core-js-compat "^3.1.1" + core-js-compat "^3.4.7" invariant "^2.2.2" js-levenshtein "^1.1.3" semver "^5.5.0" "@babel/preset-flow@^7.0.0": - version "7.0.0" - resolved "https://registry.yarnpkg.com/@babel/preset-flow/-/preset-flow-7.0.0.tgz#afd764835d9535ec63d8c7d4caf1c06457263da2" - integrity sha512-bJOHrYOPqJZCkPVbG1Lot2r5OSsB+iUOaxiHdlOeB1yPWS6evswVHwvkDLZ54WTaTRIk89ds0iHmGZSnxlPejQ== + version "7.7.4" + resolved "https://registry.yarnpkg.com/@babel/preset-flow/-/preset-flow-7.7.4.tgz#99c1349b6fd7132783196de181e6b32d0949427e" + integrity sha512-6LbUqcHD8BcRtXMOp5bc5nJeU8RlKh6q5U8TgZeCrf9ebBdW8Wyy5ujAUnbJfmzQ56Kkq5XtwErC/5+5RHyFYA== dependencies: "@babel/helper-plugin-utils" "^7.0.0" - "@babel/plugin-transform-flow-strip-types" "^7.0.0" + "@babel/plugin-transform-flow-strip-types" "^7.7.4" -"@babel/register@^7.4.4": - version "7.4.4" - resolved "https://registry.yarnpkg.com/@babel/register/-/register-7.4.4.tgz#370a68ba36f08f015a8b35d4864176c6b65d7a23" - integrity sha512-sn51H88GRa00+ZoMqCVgOphmswG4b7mhf9VOB0LUBAieykq2GnRFerlN+JQkO/ntT7wz4jaHNSRPg9IdMPEUkA== +"@babel/register@^7.7.0": + version "7.7.4" + resolved "https://registry.yarnpkg.com/@babel/register/-/register-7.7.4.tgz#45a4956471a9df3b012b747f5781cc084ee8f128" + integrity sha512-/fmONZqL6ZMl9KJUYajetCrID6m0xmL4odX7v+Xvoxcv0DdbP/oO0TWIeLUCHqczQ6L6njDMqmqHFy2cp3FFsA== dependencies: - core-js "^3.0.0" find-cache-dir "^2.0.0" - lodash "^4.17.11" - mkdirp "^0.5.1" + lodash "^4.17.13" + make-dir "^2.1.0" pirates "^4.0.0" - source-map-support "^0.5.9" + source-map-support "^0.5.16" -"@babel/runtime@^7.0.0", "@babel/runtime@^7.4.5": - version "7.4.5" - resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.4.5.tgz#582bb531f5f9dc67d2fcb682979894f75e253f12" - integrity sha512-TuI4qpWZP6lGOGIuGWtp9sPluqYICmbk8T/1vpSysqJxRPkudh/ofFWyqdcMsDf2s7KvDL4/YHgKyvcS3g9CJQ== +"@babel/runtime@^7.7.2": + version "7.7.6" + resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.7.6.tgz#d18c511121aff1b4f2cd1d452f1bac9601dd830f" + integrity sha512-BWAJxpNVa0QlE5gZdWjSxXtemZyZ9RmrmVozxt3NUXeZhVIJ5ANyqmMc0JDrivBZyxUuQvFxlvH4OWWOogGfUw== dependencies: regenerator-runtime "^0.13.2" -"@babel/template@^7.0.0", "@babel/template@^7.1.0", "@babel/template@^7.4.4": - version "7.4.4" - resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.4.4.tgz#f4b88d1225689a08f5bc3a17483545be9e4ed237" - integrity sha512-CiGzLN9KgAvgZsnivND7rkA+AeJ9JB0ciPOD4U59GKbQP2iQl+olF1l76kJOupqidozfZ32ghwBEJDhnk9MEcw== - dependencies: - "@babel/code-frame" "^7.0.0" - "@babel/parser" "^7.4.4" - "@babel/types" "^7.4.4" - -"@babel/traverse@^7.0.0", "@babel/traverse@^7.1.0", "@babel/traverse@^7.4.4", "@babel/traverse@^7.4.5": - version "7.4.5" - resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.4.5.tgz#4e92d1728fd2f1897dafdd321efbff92156c3216" - integrity sha512-Vc+qjynwkjRmIFGxy0KYoPj4FdVDxLej89kMHFsWScq999uX+pwcX4v9mWRjW0KcAYTPAuVQl2LKP1wEVLsp+A== +"@babel/template@^7.4.0", "@babel/template@^7.7.4": + version "7.7.4" + resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.7.4.tgz#428a7d9eecffe27deac0a98e23bf8e3675d2a77b" + integrity sha512-qUzihgVPguAzXCK7WXw8pqs6cEwi54s3E+HrejlkuWO6ivMKx9hZl3Y2fSXp9i5HgyWmj7RKP+ulaYnKM4yYxw== dependencies: "@babel/code-frame" "^7.0.0" - "@babel/generator" "^7.4.4" - "@babel/helper-function-name" "^7.1.0" - "@babel/helper-split-export-declaration" "^7.4.4" - "@babel/parser" "^7.4.5" - "@babel/types" "^7.4.4" + "@babel/parser" "^7.7.4" + "@babel/types" "^7.7.4" + +"@babel/traverse@^7.0.0", "@babel/traverse@^7.1.0", "@babel/traverse@^7.4.3", "@babel/traverse@^7.7.4": + version "7.7.4" + resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.7.4.tgz#9c1e7c60fb679fe4fcfaa42500833333c2058558" + integrity sha512-P1L58hQyupn8+ezVA2z5KBm4/Zr4lCC8dwKCMYzsa5jFMDMQAzaBNy9W5VjB+KAmBjb40U7a/H6ao+Xo+9saIw== + dependencies: + "@babel/code-frame" "^7.5.5" + "@babel/generator" "^7.7.4" + "@babel/helper-function-name" "^7.7.4" + "@babel/helper-split-export-declaration" "^7.7.4" + "@babel/parser" "^7.7.4" + "@babel/types" "^7.7.4" debug "^4.1.0" globals "^11.1.0" - lodash "^4.17.11" + lodash "^4.17.13" -"@babel/types@^7.0.0", "@babel/types@^7.2.0", "@babel/types@^7.3.0", "@babel/types@^7.4.4": - version "7.4.4" - resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.4.4.tgz#8db9e9a629bb7c29370009b4b779ed93fe57d5f0" - integrity sha512-dOllgYdnEFOebhkKCjzSVFqw/PmmB8pH6RGOWkY4GsboQNd47b1fBThBSwlHAq9alF9vc1M3+6oqR47R50L0tQ== +"@babel/types@^7.0.0", "@babel/types@^7.3.0", "@babel/types@^7.4.0", "@babel/types@^7.7.4": + version "7.7.4" + resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.7.4.tgz#516570d539e44ddf308c07569c258ff94fde9193" + integrity sha512-cz5Ji23KCi4T+YIE/BolWosrJuSmoZeN1EFnRtBwF+KKLi8GG/Z2c2hOJJeCXPk4mwk4QFvTmwIodJowXgttRA== dependencies: esutils "^2.0.2" - lodash "^4.17.11" + lodash "^4.17.13" to-fast-properties "^2.0.0" "@cnakazawa/watch@^1.0.3": @@ -750,23 +810,23 @@ exec-sh "^0.3.2" minimist "^1.2.0" -"@evocateur/libnpmaccess@^3.1.0": - version "3.1.0" - resolved "https://registry.yarnpkg.com/@evocateur/libnpmaccess/-/libnpmaccess-3.1.0.tgz#e546ee4e4bedca54ed9303948ec54c985cec33e4" - integrity sha512-bfrqZ0v+Il5TJBsgF2oyepeJg34K2pBItapzP+UT1QMIGpUh/Zc1pQql4jrafamZTqP3ZvdJxaElat8B5K3ICA== +"@evocateur/libnpmaccess@^3.1.2": + version "3.1.2" + resolved "https://registry.yarnpkg.com/@evocateur/libnpmaccess/-/libnpmaccess-3.1.2.tgz#ecf7f6ce6b004e9f942b098d92200be4a4b1c845" + integrity sha512-KSCAHwNWro0CF2ukxufCitT9K5LjL/KuMmNzSu8wuwN2rjyKHD8+cmOsiybK+W5hdnwc5M1SmRlVCaMHQo+3rg== dependencies: - "@evocateur/npm-registry-fetch" "^3.9.1" + "@evocateur/npm-registry-fetch" "^4.0.0" aproba "^2.0.0" figgy-pudding "^3.5.1" get-stream "^4.0.0" npm-package-arg "^6.1.0" -"@evocateur/libnpmpublish@^1.2.0": - version "1.2.0" - resolved "https://registry.yarnpkg.com/@evocateur/libnpmpublish/-/libnpmpublish-1.2.0.tgz#3e0d79fdc0a75f212adabb7c7e341b017effeac2" - integrity sha512-sezhX9FSnPIyrBBvxVocVJVO1uIWPczf6rOmUZSntCWfQMraO8pWTFlDJbroFqPbEqFFHf3eyw8NQ0Eb7OLd1g== +"@evocateur/libnpmpublish@^1.2.2": + version "1.2.2" + resolved "https://registry.yarnpkg.com/@evocateur/libnpmpublish/-/libnpmpublish-1.2.2.tgz#55df09d2dca136afba9c88c759ca272198db9f1a" + integrity sha512-MJrrk9ct1FeY9zRlyeoyMieBjGDG9ihyyD9/Ft6MMrTxql9NyoEx2hw9casTIP4CdqEVu+3nQ2nXxoJ8RCXyFg== dependencies: - "@evocateur/npm-registry-fetch" "^3.9.1" + "@evocateur/npm-registry-fetch" "^4.0.0" aproba "^2.0.0" figgy-pudding "^3.5.1" get-stream "^4.0.0" @@ -776,122 +836,125 @@ semver "^5.5.1" ssri "^6.0.1" -"@evocateur/npm-registry-fetch@^3.9.1": - version "3.9.1" - resolved "https://registry.yarnpkg.com/@evocateur/npm-registry-fetch/-/npm-registry-fetch-3.9.1.tgz#75b3917320e559f6c91e26af17e62b085ec457a2" - integrity sha512-6v1bHbcAypQ+te/1RGSNL4JkK6mcMtcZrUusqo5iKRtYSAig9UJXlOaCcBR+eLywt2DQMNpEwAj24jwWDX5G/w== +"@evocateur/npm-registry-fetch@^4.0.0": + version "4.0.0" + resolved "https://registry.yarnpkg.com/@evocateur/npm-registry-fetch/-/npm-registry-fetch-4.0.0.tgz#8c4c38766d8d32d3200fcb0a83f064b57365ed66" + integrity sha512-k1WGfKRQyhJpIr+P17O5vLIo2ko1PFLKwoetatdduUSt/aQ4J2sJrJwwatdI5Z3SiYk/mRH9S3JpdmMFd/IK4g== dependencies: JSONStream "^1.3.4" bluebird "^3.5.1" figgy-pudding "^3.4.1" - lru-cache "^4.1.3" - make-fetch-happen "^4.0.1" + lru-cache "^5.1.1" + make-fetch-happen "^5.0.0" npm-package-arg "^6.1.0" safe-buffer "^5.1.2" -"@evocateur/pacote@^9.6.0": - version "9.6.0" - resolved "https://registry.yarnpkg.com/@evocateur/pacote/-/pacote-9.6.0.tgz#3f0d08fb81c572289a2dfa981e7f97b6dd83cef2" - integrity sha512-nKx8EPxXhzqNfePbqC6603z7Kkf6GBS2q+SNGtBS/bCgS5Q+p3OVR6MXKOkpvC3WHse98W2WLu8QaV9axtfxyw== +"@evocateur/pacote@^9.6.3": + version "9.6.5" + resolved "https://registry.yarnpkg.com/@evocateur/pacote/-/pacote-9.6.5.tgz#33de32ba210b6f17c20ebab4d497efc6755f4ae5" + integrity sha512-EI552lf0aG2nOV8NnZpTxNo2PcXKPmDbF9K8eCBFQdIZwHNGN/mi815fxtmUMa2wTa1yndotICIDt/V0vpEx2w== dependencies: - "@evocateur/npm-registry-fetch" "^3.9.1" + "@evocateur/npm-registry-fetch" "^4.0.0" bluebird "^3.5.3" - cacache "^11.3.2" + cacache "^12.0.3" + chownr "^1.1.2" figgy-pudding "^3.5.1" get-stream "^4.1.0" - glob "^7.1.3" + glob "^7.1.4" + infer-owner "^1.0.4" lru-cache "^5.1.1" - make-fetch-happen "^4.0.1" + make-fetch-happen "^5.0.0" minimatch "^3.0.4" minipass "^2.3.5" mississippi "^3.0.0" mkdirp "^0.5.1" - normalize-package-data "^2.4.0" + normalize-package-data "^2.5.0" npm-package-arg "^6.1.0" - npm-packlist "^1.1.12" - npm-pick-manifest "^2.2.3" + npm-packlist "^1.4.4" + npm-pick-manifest "^3.0.0" osenv "^0.1.5" promise-inflight "^1.0.1" promise-retry "^1.1.1" protoduck "^5.0.1" - rimraf "^2.6.2" - safe-buffer "^5.1.2" - semver "^5.6.0" + rimraf "^2.6.3" + safe-buffer "^5.2.0" + semver "^5.7.0" ssri "^6.0.1" - tar "^4.4.8" + tar "^4.4.10" unique-filename "^1.1.1" which "^1.3.1" -"@jest/console@^24.7.1": - version "24.7.1" - resolved "https://registry.yarnpkg.com/@jest/console/-/console-24.7.1.tgz#32a9e42535a97aedfe037e725bd67e954b459545" - integrity sha512-iNhtIy2M8bXlAOULWVTUxmnelTLFneTNEkHCgPmgd+zNwy9zVddJ6oS5rZ9iwoscNdT5mMwUd0C51v/fSlzItg== +"@jest/console@^24.7.1", "@jest/console@^24.9.0": + version "24.9.0" + resolved "https://registry.yarnpkg.com/@jest/console/-/console-24.9.0.tgz#79b1bc06fb74a8cfb01cbdedf945584b1b9707f0" + integrity sha512-Zuj6b8TnKXi3q4ymac8EQfc3ea/uhLeCGThFqXeC8H9/raaH8ARPUTdId+XyGd03Z4In0/VjD2OYFcBF09fNLQ== dependencies: - "@jest/source-map" "^24.3.0" + "@jest/source-map" "^24.9.0" chalk "^2.0.1" slash "^2.0.0" -"@jest/core@^24.8.0": - version "24.8.0" - resolved "https://registry.yarnpkg.com/@jest/core/-/core-24.8.0.tgz#fbbdcd42a41d0d39cddbc9f520c8bab0c33eed5b" - integrity sha512-R9rhAJwCBQzaRnrRgAdVfnglUuATXdwTRsYqs6NMdVcAl5euG8LtWDe+fVkN27YfKVBW61IojVsXKaOmSnqd/A== +"@jest/core@^24.9.0": + version "24.9.0" + resolved "https://registry.yarnpkg.com/@jest/core/-/core-24.9.0.tgz#2ceccd0b93181f9c4850e74f2a9ad43d351369c4" + integrity sha512-Fogg3s4wlAr1VX7q+rhV9RVnUv5tD7VuWfYy1+whMiWUrvl7U3QJSJyWcDio9Lq2prqYsZaeTv2Rz24pWGkJ2A== dependencies: "@jest/console" "^24.7.1" - "@jest/reporters" "^24.8.0" - "@jest/test-result" "^24.8.0" - "@jest/transform" "^24.8.0" - "@jest/types" "^24.8.0" + "@jest/reporters" "^24.9.0" + "@jest/test-result" "^24.9.0" + "@jest/transform" "^24.9.0" + "@jest/types" "^24.9.0" ansi-escapes "^3.0.0" chalk "^2.0.1" exit "^0.1.2" graceful-fs "^4.1.15" - jest-changed-files "^24.8.0" - jest-config "^24.8.0" - jest-haste-map "^24.8.0" - jest-message-util "^24.8.0" + jest-changed-files "^24.9.0" + jest-config "^24.9.0" + jest-haste-map "^24.9.0" + jest-message-util "^24.9.0" jest-regex-util "^24.3.0" - jest-resolve-dependencies "^24.8.0" - jest-runner "^24.8.0" - jest-runtime "^24.8.0" - jest-snapshot "^24.8.0" - jest-util "^24.8.0" - jest-validate "^24.8.0" - jest-watcher "^24.8.0" + jest-resolve "^24.9.0" + jest-resolve-dependencies "^24.9.0" + jest-runner "^24.9.0" + jest-runtime "^24.9.0" + jest-snapshot "^24.9.0" + jest-util "^24.9.0" + jest-validate "^24.9.0" + jest-watcher "^24.9.0" micromatch "^3.1.10" p-each-series "^1.0.0" - pirates "^4.0.1" realpath-native "^1.1.0" rimraf "^2.5.4" + slash "^2.0.0" strip-ansi "^5.0.0" -"@jest/environment@^24.8.0": - version "24.8.0" - resolved "https://registry.yarnpkg.com/@jest/environment/-/environment-24.8.0.tgz#0342261383c776bdd652168f68065ef144af0eac" - integrity sha512-vlGt2HLg7qM+vtBrSkjDxk9K0YtRBi7HfRFaDxoRtyi+DyVChzhF20duvpdAnKVBV6W5tym8jm0U9EfXbDk1tw== - dependencies: - "@jest/fake-timers" "^24.8.0" - "@jest/transform" "^24.8.0" - "@jest/types" "^24.8.0" - jest-mock "^24.8.0" - -"@jest/fake-timers@^24.8.0": - version "24.8.0" - resolved "https://registry.yarnpkg.com/@jest/fake-timers/-/fake-timers-24.8.0.tgz#2e5b80a4f78f284bcb4bd5714b8e10dd36a8d3d1" - integrity sha512-2M4d5MufVXwi6VzZhJ9f5S/wU4ud2ck0kxPof1Iz3zWx6Y+V2eJrES9jEktB6O3o/oEyk+il/uNu9PvASjWXQw== - dependencies: - "@jest/types" "^24.8.0" - jest-message-util "^24.8.0" - jest-mock "^24.8.0" - -"@jest/reporters@^24.8.0": - version "24.8.0" - resolved "https://registry.yarnpkg.com/@jest/reporters/-/reporters-24.8.0.tgz#075169cd029bddec54b8f2c0fc489fd0b9e05729" - integrity sha512-eZ9TyUYpyIIXfYCrw0UHUWUvE35vx5I92HGMgS93Pv7du+GHIzl+/vh8Qj9MCWFK/4TqyttVBPakWMOfZRIfxw== - dependencies: - "@jest/environment" "^24.8.0" - "@jest/test-result" "^24.8.0" - "@jest/transform" "^24.8.0" - "@jest/types" "^24.8.0" +"@jest/environment@^24.9.0": + version "24.9.0" + resolved "https://registry.yarnpkg.com/@jest/environment/-/environment-24.9.0.tgz#21e3afa2d65c0586cbd6cbefe208bafade44ab18" + integrity sha512-5A1QluTPhvdIPFYnO3sZC3smkNeXPVELz7ikPbhUj0bQjB07EoE9qtLrem14ZUYWdVayYbsjVwIiL4WBIMV4aQ== + dependencies: + "@jest/fake-timers" "^24.9.0" + "@jest/transform" "^24.9.0" + "@jest/types" "^24.9.0" + jest-mock "^24.9.0" + +"@jest/fake-timers@^24.9.0": + version "24.9.0" + resolved "https://registry.yarnpkg.com/@jest/fake-timers/-/fake-timers-24.9.0.tgz#ba3e6bf0eecd09a636049896434d306636540c93" + integrity sha512-eWQcNa2YSwzXWIMC5KufBh3oWRIijrQFROsIqt6v/NS9Io/gknw1jsAC9c+ih/RQX4A3O7SeWAhQeN0goKhT9A== + dependencies: + "@jest/types" "^24.9.0" + jest-message-util "^24.9.0" + jest-mock "^24.9.0" + +"@jest/reporters@^24.9.0": + version "24.9.0" + resolved "https://registry.yarnpkg.com/@jest/reporters/-/reporters-24.9.0.tgz#86660eff8e2b9661d042a8e98a028b8d631a5b43" + integrity sha512-mu4X0yjaHrffOsWmVLzitKmmmWSQ3GGuefgNscUSWNiUNcEOSEQk9k3pERKEQVBb0Cnn88+UESIsZEMH3o88Gw== + dependencies: + "@jest/environment" "^24.9.0" + "@jest/test-result" "^24.9.0" + "@jest/transform" "^24.9.0" + "@jest/types" "^24.9.0" chalk "^2.0.1" exit "^0.1.2" glob "^7.1.2" @@ -899,313 +962,307 @@ istanbul-lib-instrument "^3.0.1" istanbul-lib-report "^2.0.4" istanbul-lib-source-maps "^3.0.1" - istanbul-reports "^2.1.1" - jest-haste-map "^24.8.0" - jest-resolve "^24.8.0" - jest-runtime "^24.8.0" - jest-util "^24.8.0" + istanbul-reports "^2.2.6" + jest-haste-map "^24.9.0" + jest-resolve "^24.9.0" + jest-runtime "^24.9.0" + jest-util "^24.9.0" jest-worker "^24.6.0" - node-notifier "^5.2.1" + node-notifier "^5.4.2" slash "^2.0.0" source-map "^0.6.0" string-length "^2.0.0" -"@jest/source-map@^24.3.0": - version "24.3.0" - resolved "https://registry.yarnpkg.com/@jest/source-map/-/source-map-24.3.0.tgz#563be3aa4d224caf65ff77edc95cd1ca4da67f28" - integrity sha512-zALZt1t2ou8le/crCeeiRYzvdnTzaIlpOWaet45lNSqNJUnXbppUUFR4ZUAlzgDmKee4Q5P/tKXypI1RiHwgag== +"@jest/source-map@^24.3.0", "@jest/source-map@^24.9.0": + version "24.9.0" + resolved "https://registry.yarnpkg.com/@jest/source-map/-/source-map-24.9.0.tgz#0e263a94430be4b41da683ccc1e6bffe2a191714" + integrity sha512-/Xw7xGlsZb4MJzNDgB7PW5crou5JqWiBQaz6xyPd3ArOg2nfn/PunV8+olXbbEZzNl591o5rWKE9BRDaFAuIBg== dependencies: callsites "^3.0.0" graceful-fs "^4.1.15" source-map "^0.6.0" -"@jest/test-result@^24.8.0": - version "24.8.0" - resolved "https://registry.yarnpkg.com/@jest/test-result/-/test-result-24.8.0.tgz#7675d0aaf9d2484caa65e048d9b467d160f8e9d3" - integrity sha512-+YdLlxwizlfqkFDh7Mc7ONPQAhA4YylU1s529vVM1rsf67vGZH/2GGm5uO8QzPeVyaVMobCQ7FTxl38QrKRlng== +"@jest/test-result@^24.9.0": + version "24.9.0" + resolved "https://registry.yarnpkg.com/@jest/test-result/-/test-result-24.9.0.tgz#11796e8aa9dbf88ea025757b3152595ad06ba0ca" + integrity sha512-XEFrHbBonBJ8dGp2JmF8kP/nQI/ImPpygKHwQ/SY+es59Z3L5PI4Qb9TQQMAEeYsThG1xF0k6tmG0tIKATNiiA== dependencies: - "@jest/console" "^24.7.1" - "@jest/types" "^24.8.0" + "@jest/console" "^24.9.0" + "@jest/types" "^24.9.0" "@types/istanbul-lib-coverage" "^2.0.0" -"@jest/test-sequencer@^24.8.0": - version "24.8.0" - resolved "https://registry.yarnpkg.com/@jest/test-sequencer/-/test-sequencer-24.8.0.tgz#2f993bcf6ef5eb4e65e8233a95a3320248cf994b" - integrity sha512-OzL/2yHyPdCHXEzhoBuq37CE99nkme15eHkAzXRVqthreWZamEMA0WoetwstsQBCXABhczpK03JNbc4L01vvLg== +"@jest/test-sequencer@^24.9.0": + version "24.9.0" + resolved "https://registry.yarnpkg.com/@jest/test-sequencer/-/test-sequencer-24.9.0.tgz#f8f334f35b625a4f2f355f2fe7e6036dad2e6b31" + integrity sha512-6qqsU4o0kW1dvA95qfNog8v8gkRN9ph6Lz7r96IvZpHdNipP2cBcb07J1Z45mz/VIS01OHJ3pY8T5fUY38tg4A== dependencies: - "@jest/test-result" "^24.8.0" - jest-haste-map "^24.8.0" - jest-runner "^24.8.0" - jest-runtime "^24.8.0" + "@jest/test-result" "^24.9.0" + jest-haste-map "^24.9.0" + jest-runner "^24.9.0" + jest-runtime "^24.9.0" -"@jest/transform@^24.8.0": - version "24.8.0" - resolved "https://registry.yarnpkg.com/@jest/transform/-/transform-24.8.0.tgz#628fb99dce4f9d254c6fd9341e3eea262e06fef5" - integrity sha512-xBMfFUP7TortCs0O+Xtez2W7Zu1PLH9bvJgtraN1CDST6LBM/eTOZ9SfwS/lvV8yOfcDpFmwf9bq5cYbXvqsvA== +"@jest/transform@^24.9.0": + version "24.9.0" + resolved "https://registry.yarnpkg.com/@jest/transform/-/transform-24.9.0.tgz#4ae2768b296553fadab09e9ec119543c90b16c56" + integrity sha512-TcQUmyNRxV94S0QpMOnZl0++6RMiqpbH/ZMccFB/amku6Uwvyb1cjYX7xkp5nGNkbX4QPH/FcB6q1HBTHynLmQ== dependencies: "@babel/core" "^7.1.0" - "@jest/types" "^24.8.0" + "@jest/types" "^24.9.0" babel-plugin-istanbul "^5.1.0" chalk "^2.0.1" convert-source-map "^1.4.0" fast-json-stable-stringify "^2.0.0" graceful-fs "^4.1.15" - jest-haste-map "^24.8.0" - jest-regex-util "^24.3.0" - jest-util "^24.8.0" + jest-haste-map "^24.9.0" + jest-regex-util "^24.9.0" + jest-util "^24.9.0" micromatch "^3.1.10" + pirates "^4.0.1" realpath-native "^1.1.0" slash "^2.0.0" source-map "^0.6.1" write-file-atomic "2.4.1" -"@jest/types@^24.8.0": - version "24.8.0" - resolved "https://registry.yarnpkg.com/@jest/types/-/types-24.8.0.tgz#f31e25948c58f0abd8c845ae26fcea1491dea7ad" - integrity sha512-g17UxVr2YfBtaMUxn9u/4+siG1ptg9IGYAYwvpwn61nBg779RXnjE/m7CxYcIzEt0AbHZZAHSEZNhkE2WxURVg== +"@jest/types@^24.9.0": + version "24.9.0" + resolved "https://registry.yarnpkg.com/@jest/types/-/types-24.9.0.tgz#63cb26cb7500d069e5a389441a7c6ab5e909fc59" + integrity sha512-XKK7ze1apu5JWQ5eZjHITP66AX+QsLlbaJRBGYr8pNzwcAE2JVkwnf0yqjHTsDRcjR0mujy/NmZMXw5kl+kGBw== dependencies: "@types/istanbul-lib-coverage" "^2.0.0" "@types/istanbul-reports" "^1.1.1" - "@types/yargs" "^12.0.9" - -"@lerna/add@3.15.0": - version "3.15.0" - resolved "https://registry.yarnpkg.com/@lerna/add/-/add-3.15.0.tgz#10be562f43cde59b60f299083d54ac39520ec60a" - integrity sha512-+KrG4GFy/6FISZ+DwWf5Fj5YB4ESa4VTnSn/ujf3VEda6dxngHPN629j+TcPbsdOxUYVah+HuZbC/B8NnkrKpQ== - dependencies: - "@evocateur/pacote" "^9.6.0" - "@lerna/bootstrap" "3.15.0" - "@lerna/command" "3.15.0" - "@lerna/filter-options" "3.14.2" - "@lerna/npm-conf" "3.13.0" + "@types/yargs" "^13.0.0" + +"@lerna/add@3.19.0": + version "3.19.0" + resolved "https://registry.yarnpkg.com/@lerna/add/-/add-3.19.0.tgz#33b6251c669895f842c14f05961432d464166249" + integrity sha512-qzhxPyoczvvT1W0wwCK9I0iJ4B9WR+HzYsusmRuzM3mEhWjowhbuvKEl5BjGYuXc9AvEErM/S0Fm5K0RcuS39Q== + dependencies: + "@evocateur/pacote" "^9.6.3" + "@lerna/bootstrap" "3.18.5" + "@lerna/command" "3.18.5" + "@lerna/filter-options" "3.18.4" + "@lerna/npm-conf" "3.16.0" "@lerna/validation-error" "3.13.0" dedent "^0.7.0" npm-package-arg "^6.1.0" - p-map "^1.2.0" - semver "^5.5.0" - -"@lerna/batch-packages@3.14.0": - version "3.14.0" - resolved "https://registry.yarnpkg.com/@lerna/batch-packages/-/batch-packages-3.14.0.tgz#0208663bab3ddbf57956b370aaec4c9ebee6c800" - integrity sha512-RlBkQVNTqk1qvn6PFWiWNiskllUHh6tXbTVm43mZRNd+vhAyvrQC8RWJxH0ECVvnFAt9rSNGRIVbEJ31WnNQLg== - dependencies: - "@lerna/package-graph" "3.14.0" - npmlog "^4.1.2" - -"@lerna/bootstrap@3.15.0": - version "3.15.0" - resolved "https://registry.yarnpkg.com/@lerna/bootstrap/-/bootstrap-3.15.0.tgz#f53e0bbbbfb8367e609a06378409bfc673ff2930" - integrity sha512-4AxsPKKbgj2Ju03qDddQTpOHvpqnwd0yaiEU/aCcWv/4tDTe79NqUne2Z3+P2WZY0Zzb8+nUKcskwYBMTeq+Mw== - dependencies: - "@lerna/batch-packages" "3.14.0" - "@lerna/command" "3.15.0" - "@lerna/filter-options" "3.14.2" - "@lerna/has-npm-version" "3.14.2" - "@lerna/npm-install" "3.14.2" - "@lerna/package-graph" "3.14.0" + p-map "^2.1.0" + semver "^6.2.0" + +"@lerna/bootstrap@3.18.5": + version "3.18.5" + resolved "https://registry.yarnpkg.com/@lerna/bootstrap/-/bootstrap-3.18.5.tgz#cc22a750d6b0402e136926e8b214148dfc2e1390" + integrity sha512-9vD/BfCz8YSF2Dx7sHaMVo6Cy33WjLEmoN1yrHgNkHjm7ykWbLHG5wru0f4Y4pvwa0s5Hf76rvT8aJWzGHk9IQ== + dependencies: + "@lerna/command" "3.18.5" + "@lerna/filter-options" "3.18.4" + "@lerna/has-npm-version" "3.16.5" + "@lerna/npm-install" "3.16.5" + "@lerna/package-graph" "3.18.5" "@lerna/pulse-till-done" "3.13.0" - "@lerna/rimraf-dir" "3.14.2" - "@lerna/run-lifecycle" "3.14.0" - "@lerna/run-parallel-batches" "3.13.0" - "@lerna/symlink-binary" "3.14.2" - "@lerna/symlink-dependencies" "3.14.2" + "@lerna/rimraf-dir" "3.16.5" + "@lerna/run-lifecycle" "3.16.2" + "@lerna/run-topologically" "3.18.5" + "@lerna/symlink-binary" "3.17.0" + "@lerna/symlink-dependencies" "3.17.0" "@lerna/validation-error" "3.13.0" dedent "^0.7.0" - get-port "^3.2.0" - multimatch "^2.1.0" + get-port "^4.2.0" + multimatch "^3.0.0" npm-package-arg "^6.1.0" npmlog "^4.1.2" p-finally "^1.0.0" - p-map "^1.2.0" + p-map "^2.1.0" p-map-series "^1.0.0" p-waterfall "^1.0.0" read-package-tree "^5.1.6" - semver "^5.5.0" + semver "^6.2.0" -"@lerna/changed@3.15.0": - version "3.15.0" - resolved "https://registry.yarnpkg.com/@lerna/changed/-/changed-3.15.0.tgz#20db9d992d697e4288c260aa38b989dcb93f4b40" - integrity sha512-Hns1ssI9T9xOTGVc7PT2jUaqzsSkxV3hV/Y7iFO0uKTk+fduyTwGTHU9A/ybQ/xi/9iaJbvaXyjxKiGoEnzmhg== +"@lerna/changed@3.18.5": + version "3.18.5" + resolved "https://registry.yarnpkg.com/@lerna/changed/-/changed-3.18.5.tgz#ef2c460f5497b8b4cfac7e5165fe46d7181fcdf5" + integrity sha512-IXS7VZ5VDQUfCsgK56WYxd42luMBxL456cNUf1yBgQ1cy1U2FPVMitIdLN4AcP7bJizdPWeG8yDptf47jN/xVw== dependencies: - "@lerna/collect-updates" "3.14.2" - "@lerna/command" "3.15.0" - "@lerna/listable" "3.14.0" + "@lerna/collect-updates" "3.18.0" + "@lerna/command" "3.18.5" + "@lerna/listable" "3.18.5" "@lerna/output" "3.13.0" - "@lerna/version" "3.15.0" -"@lerna/check-working-tree@3.14.2": - version "3.14.2" - resolved "https://registry.yarnpkg.com/@lerna/check-working-tree/-/check-working-tree-3.14.2.tgz#5ce007722180a69643a8456766ed8a91fc7e9ae1" - integrity sha512-7safqxM/MYoAoxZxulUDtIJIbnBIgo0PB/FHytueG+9VaX7GMnDte2Bt1EKa0dz2sAyQdmQ3Q8ZXpf/6JDjaeg== +"@lerna/check-working-tree@3.16.5": + version "3.16.5" + resolved "https://registry.yarnpkg.com/@lerna/check-working-tree/-/check-working-tree-3.16.5.tgz#b4f8ae61bb4523561dfb9f8f8d874dd46bb44baa" + integrity sha512-xWjVBcuhvB8+UmCSb5tKVLB5OuzSpw96WEhS2uz6hkWVa/Euh1A0/HJwn2cemyK47wUrCQXtczBUiqnq9yX5VQ== dependencies: - "@lerna/collect-uncommitted" "3.14.2" - "@lerna/describe-ref" "3.14.2" + "@lerna/collect-uncommitted" "3.16.5" + "@lerna/describe-ref" "3.16.5" "@lerna/validation-error" "3.13.0" -"@lerna/child-process@3.14.2", "@lerna/child-process@^3.3.0": - version "3.14.2" - resolved "https://registry.yarnpkg.com/@lerna/child-process/-/child-process-3.14.2.tgz#950240cba83f7dfe25247cfa6c9cebf30b7d94f6" - integrity sha512-xnq+W5yQb6RkwI0p16ZQnrn6HkloH/MWTw4lGE1nKsBLAUbmSU5oTE93W1nrG0X3IMF/xWc9UYvNdUGMWvZZ4w== +"@lerna/child-process@3.16.5", "@lerna/child-process@^3.3.0": + version "3.16.5" + resolved "https://registry.yarnpkg.com/@lerna/child-process/-/child-process-3.16.5.tgz#38fa3c18064aa4ac0754ad80114776a7b36a69b2" + integrity sha512-vdcI7mzei9ERRV4oO8Y1LHBZ3A5+ampRKg1wq5nutLsUA4mEBN6H7JqjWOMY9xZemv6+kATm2ofjJ3lW5TszQg== dependencies: chalk "^2.3.1" execa "^1.0.0" strong-log-transformer "^2.0.0" -"@lerna/clean@3.15.0": - version "3.15.0" - resolved "https://registry.yarnpkg.com/@lerna/clean/-/clean-3.15.0.tgz#a94da50908a80ba443a0a682706aca79ac2ecf27" - integrity sha512-D1BN7BnJk6YjrSR7E7RiCmWiFVWDo3L+OSe6zDq6rNNYexPBtSi2JOCeF/Dibi3jd2luVu0zkVpUtuEEdPiD+A== +"@lerna/clean@3.18.5": + version "3.18.5" + resolved "https://registry.yarnpkg.com/@lerna/clean/-/clean-3.18.5.tgz#44b4a6db68ae369778f2921c85ec6961bdd86072" + integrity sha512-tHxOj9frTIhB/H2gtgMU3xpIc4IJEhXcUlReko6RJt8TTiDZGPDudCcgjg6i7n15v9jXMOc1y4F+y5/1089bfA== dependencies: - "@lerna/command" "3.15.0" - "@lerna/filter-options" "3.14.2" - "@lerna/prompt" "3.13.0" + "@lerna/command" "3.18.5" + "@lerna/filter-options" "3.18.4" + "@lerna/prompt" "3.18.5" "@lerna/pulse-till-done" "3.13.0" - "@lerna/rimraf-dir" "3.14.2" - p-map "^1.2.0" + "@lerna/rimraf-dir" "3.16.5" + p-map "^2.1.0" p-map-series "^1.0.0" p-waterfall "^1.0.0" -"@lerna/cli@3.13.0": - version "3.13.0" - resolved "https://registry.yarnpkg.com/@lerna/cli/-/cli-3.13.0.tgz#3d7b357fdd7818423e9681a7b7f2abd106c8a266" - integrity sha512-HgFGlyCZbYaYrjOr3w/EsY18PdvtsTmDfpUQe8HwDjXlPeCCUgliZjXLOVBxSjiOvPeOSwvopwIHKWQmYbwywg== +"@lerna/cli@3.18.5": + version "3.18.5" + resolved "https://registry.yarnpkg.com/@lerna/cli/-/cli-3.18.5.tgz#c90c461542fcd35b6d5b015a290fb0dbfb41d242" + integrity sha512-erkbxkj9jfc89vVs/jBLY/fM0I80oLmJkFUV3Q3wk9J3miYhP14zgVEBsPZY68IZlEjT6T3Xlq2xO1AVaatHsA== dependencies: "@lerna/global-options" "3.13.0" dedent "^0.7.0" npmlog "^4.1.2" - yargs "^12.0.1" + yargs "^14.2.2" -"@lerna/collect-uncommitted@3.14.2": - version "3.14.2" - resolved "https://registry.yarnpkg.com/@lerna/collect-uncommitted/-/collect-uncommitted-3.14.2.tgz#b5ed00d800bea26bb0d18404432b051eee8d030e" - integrity sha512-4EkQu4jIOdNL2BMzy/N0ydHB8+Z6syu6xiiKXOoFl0WoWU9H1jEJCX4TH7CmVxXL1+jcs8FIS2pfQz4oew99Eg== +"@lerna/collect-uncommitted@3.16.5": + version "3.16.5" + resolved "https://registry.yarnpkg.com/@lerna/collect-uncommitted/-/collect-uncommitted-3.16.5.tgz#a494d61aac31cdc7aec4bbe52c96550274132e63" + integrity sha512-ZgqnGwpDZiWyzIQVZtQaj9tRizsL4dUOhuOStWgTAw1EMe47cvAY2kL709DzxFhjr6JpJSjXV5rZEAeU3VE0Hg== dependencies: - "@lerna/child-process" "3.14.2" + "@lerna/child-process" "3.16.5" chalk "^2.3.1" figgy-pudding "^3.5.1" npmlog "^4.1.2" -"@lerna/collect-updates@3.14.2", "@lerna/collect-updates@https://github.com/babel/lerna.git#babel-collect-updates": - version "3.14.2" - resolved "https://github.com/babel/lerna.git#89eab830be040fbaabc31ad7206c5efab878c6c3" +"@lerna/collect-updates@3.18.0", "@lerna/collect-updates@https://github.com/babel/lerna.git#babel-collect-updates": + version "3.16.0" + resolved "https://github.com/babel/lerna.git#ae87fff020c5ad00366878c14b749e8ee0a34145" dependencies: "@lerna/child-process" "^3.3.0" "@lerna/describe-ref" "^3.6.0" minimatch "^3.0.4" npmlog "^4.1.2" - slash "^1.0.0" + slash "^2.0.0" -"@lerna/command@3.15.0": - version "3.15.0" - resolved "https://registry.yarnpkg.com/@lerna/command/-/command-3.15.0.tgz#e1dc1319054f1cf0b135aa0c5730f3335641a0ca" - integrity sha512-dZqr4rKFN+veuXakIQ1DcGUpzBgcWKaYFNN4O6/skOdVQaEfGefzo1sZET+q7k/BkypxkhXHXpv5UqqSuL/EHQ== +"@lerna/command@3.18.5": + version "3.18.5" + resolved "https://registry.yarnpkg.com/@lerna/command/-/command-3.18.5.tgz#14c6d2454adbfd365f8027201523e6c289cd3cd9" + integrity sha512-36EnqR59yaTU4HrR1C9XDFti2jRx0BgpIUBeWn129LZZB8kAB3ov1/dJNa1KcNRKp91DncoKHLY99FZ6zTNpMQ== dependencies: - "@lerna/child-process" "3.14.2" - "@lerna/package-graph" "3.14.0" - "@lerna/project" "3.15.0" + "@lerna/child-process" "3.16.5" + "@lerna/package-graph" "3.18.5" + "@lerna/project" "3.18.0" "@lerna/validation-error" "3.13.0" "@lerna/write-log-file" "3.13.0" + clone-deep "^4.0.1" dedent "^0.7.0" execa "^1.0.0" - is-ci "^1.0.10" - lodash "^4.17.5" + is-ci "^2.0.0" npmlog "^4.1.2" -"@lerna/conventional-commits@3.14.0": - version "3.14.0" - resolved "https://registry.yarnpkg.com/@lerna/conventional-commits/-/conventional-commits-3.14.0.tgz#24f643550dc29d4f1249cc26d0eb453d7a1c513d" - integrity sha512-hGZ2qQZ9uEGf2eeIiIpEodSs9Qkkf/2uYEtNT7QN1RYISPUh6/lKGBssc5dpbCF64aEuxmemWLdlDf1ogG6++w== +"@lerna/conventional-commits@3.18.5": + version "3.18.5" + resolved "https://registry.yarnpkg.com/@lerna/conventional-commits/-/conventional-commits-3.18.5.tgz#08efd2e5b45acfaf3f151a53a3ec7ecade58a7bc" + integrity sha512-qcvXIEJ3qSgalxXnQ7Yxp5H9Ta5TVyai6vEor6AAEHc20WiO7UIdbLDCxBtiiHMdGdpH85dTYlsoYUwsCJu3HQ== dependencies: "@lerna/validation-error" "3.13.0" conventional-changelog-angular "^5.0.3" conventional-changelog-core "^3.1.6" - conventional-recommended-bump "^4.0.4" - fs-extra "^7.0.0" + conventional-recommended-bump "^5.0.0" + fs-extra "^8.1.0" get-stream "^4.0.0" + lodash.template "^4.5.0" npm-package-arg "^6.1.0" npmlog "^4.1.2" - pify "^3.0.0" - semver "^5.5.0" + pify "^4.0.1" + semver "^6.2.0" -"@lerna/create-symlink@3.14.0": - version "3.14.0" - resolved "https://registry.yarnpkg.com/@lerna/create-symlink/-/create-symlink-3.14.0.tgz#f40ae06e8cebe70c694368ebf9a4af5ab380fbea" - integrity sha512-Kw51HYOOi6UfCKncqkgEU1k/SYueSBXgkNL91FR8HAZH7EPSRTEtp9mnJo568g0+Hog5C+3cOaWySwhHpRG29A== +"@lerna/create-symlink@3.16.2": + version "3.16.2" + resolved "https://registry.yarnpkg.com/@lerna/create-symlink/-/create-symlink-3.16.2.tgz#412cb8e59a72f5a7d9463e4e4721ad2070149967" + integrity sha512-pzXIJp6av15P325sgiIRpsPXLFmkisLhMBCy4764d+7yjf2bzrJ4gkWVMhsv4AdF0NN3OyZ5jjzzTtLNqfR+Jw== dependencies: - cmd-shim "^2.0.2" - fs-extra "^7.0.0" + "@zkochan/cmd-shim" "^3.1.0" + fs-extra "^8.1.0" npmlog "^4.1.2" -"@lerna/create@3.15.0": - version "3.15.0" - resolved "https://registry.yarnpkg.com/@lerna/create/-/create-3.15.0.tgz#27bfadcbdf71d34226aa82432293f5290f7ab1aa" - integrity sha512-doXGt0HTwTQl8GkC2tOrraA/5OWbz35hJqi7Dsl3Fl0bAxiv9XmF3LykHFJ+YTDHfGpdoJ8tKu66f/VKP16G0w== +"@lerna/create@3.18.5": + version "3.18.5" + resolved "https://registry.yarnpkg.com/@lerna/create/-/create-3.18.5.tgz#11ac539f069248eaf7bc4c42e237784330f4fc47" + integrity sha512-cHpjocbpKmLopCuZFI7cKEM3E/QY8y+yC7VtZ4FQRSaLU8D8i2xXtXmYaP1GOlVNavji0iwoXjuNpnRMInIr2g== dependencies: - "@evocateur/pacote" "^9.6.0" - "@lerna/child-process" "3.14.2" - "@lerna/command" "3.15.0" - "@lerna/npm-conf" "3.13.0" + "@evocateur/pacote" "^9.6.3" + "@lerna/child-process" "3.16.5" + "@lerna/command" "3.18.5" + "@lerna/npm-conf" "3.16.0" "@lerna/validation-error" "3.13.0" camelcase "^5.0.0" dedent "^0.7.0" - fs-extra "^7.0.0" - globby "^8.0.1" + fs-extra "^8.1.0" + globby "^9.2.0" init-package-json "^1.10.3" npm-package-arg "^6.1.0" p-reduce "^1.0.0" - pify "^3.0.0" - semver "^5.5.0" - slash "^1.0.0" + pify "^4.0.1" + semver "^6.2.0" + slash "^2.0.0" validate-npm-package-license "^3.0.3" validate-npm-package-name "^3.0.0" whatwg-url "^7.0.0" -"@lerna/describe-ref@3.14.2", "@lerna/describe-ref@^3.6.0": - version "3.14.2" - resolved "https://registry.yarnpkg.com/@lerna/describe-ref/-/describe-ref-3.14.2.tgz#edc3c973f5ca9728d23358c4f4d3b55a21f65be5" - integrity sha512-qa5pzDRK2oBQXNjyRmRnN7E8a78NMYfQjjlRFB0KNHMsT6mCiL9+8kIS39sSE2NqT8p7xVNo2r2KAS8R/m3CoQ== +"@lerna/describe-ref@3.16.5", "@lerna/describe-ref@^3.6.0": + version "3.16.5" + resolved "https://registry.yarnpkg.com/@lerna/describe-ref/-/describe-ref-3.16.5.tgz#a338c25aaed837d3dc70b8a72c447c5c66346ac0" + integrity sha512-c01+4gUF0saOOtDBzbLMFOTJDHTKbDFNErEY6q6i9QaXuzy9LNN62z+Hw4acAAZuJQhrVWncVathcmkkjvSVGw== dependencies: - "@lerna/child-process" "3.14.2" + "@lerna/child-process" "3.16.5" npmlog "^4.1.2" -"@lerna/diff@3.15.0": - version "3.15.0" - resolved "https://registry.yarnpkg.com/@lerna/diff/-/diff-3.15.0.tgz#573d6f58f6809d16752dcfab74c5e286b6678371" - integrity sha512-N1Pr0M554Bt+DlVoD+DXWGh92gcq6G9icn8sH5GSqfwi0XCpPNJ2i1BNEZpUQ6ulLWOMa1YHR4PypPxecRGBjA== +"@lerna/diff@3.18.5": + version "3.18.5" + resolved "https://registry.yarnpkg.com/@lerna/diff/-/diff-3.18.5.tgz#e9e2cb882f84d5b84f0487c612137305f07accbc" + integrity sha512-u90lGs+B8DRA9Z/2xX4YaS3h9X6GbypmGV6ITzx9+1Ga12UWGTVlKaCXBgONMBjzJDzAQOK8qPTwLA57SeBLgA== dependencies: - "@lerna/child-process" "3.14.2" - "@lerna/command" "3.15.0" + "@lerna/child-process" "3.16.5" + "@lerna/command" "3.18.5" "@lerna/validation-error" "3.13.0" npmlog "^4.1.2" -"@lerna/exec@3.15.0": - version "3.15.0" - resolved "https://registry.yarnpkg.com/@lerna/exec/-/exec-3.15.0.tgz#b31510f47255367eb0d3e4a4f7b6ef8f7e41b985" - integrity sha512-YuXPd64TNG9wbb3lRvyMARQbdlbMZ1bJZ+GCm0enivnIWUyg0qtBDcfPY2dWpIgOif04zx+K/gmOX4lCaGM4UQ== +"@lerna/exec@3.18.5": + version "3.18.5" + resolved "https://registry.yarnpkg.com/@lerna/exec/-/exec-3.18.5.tgz#50f1bd6b8f88f2ec02c0768b8b1d9024feb1a96a" + integrity sha512-Q1nz95MeAxctS9bF+aG8FkjixzqEjRpg6ujtnDW84J42GgxedkPtNcJ2o/MBqLd/mxAlr+fW3UZ6CPC/zgoyCg== dependencies: - "@lerna/child-process" "3.14.2" - "@lerna/command" "3.15.0" - "@lerna/filter-options" "3.14.2" - "@lerna/run-topologically" "3.14.0" + "@lerna/child-process" "3.16.5" + "@lerna/command" "3.18.5" + "@lerna/filter-options" "3.18.4" + "@lerna/run-topologically" "3.18.5" "@lerna/validation-error" "3.13.0" - p-map "^1.2.0" + p-map "^2.1.0" -"@lerna/filter-options@3.14.2": - version "3.14.2" - resolved "https://registry.yarnpkg.com/@lerna/filter-options/-/filter-options-3.14.2.tgz#7ba91cb54ff3fd9f4650ad8d7c40bc1075e44c2d" - integrity sha512-Ct8oYvRttbYB9JalngHhirb8o9ZVyLm5a9MpXNevXoHiu6j0vNhI19BQCwNnrL6wZvEHJnzPuUl/jO23tWxemg== +"@lerna/filter-options@3.18.4": + version "3.18.4" + resolved "https://registry.yarnpkg.com/@lerna/filter-options/-/filter-options-3.18.4.tgz#f5476a7ee2169abed27ad433222e92103f56f9f1" + integrity sha512-4giVQD6tauRwweO/322LP2gfVDOVrt/xN4khkXyfkJDfcsZziFXq+668otD9KSLL8Ps+To4Fah3XbK0MoNuEvA== dependencies: - "@lerna/collect-updates" "3.14.2" - "@lerna/filter-packages" "3.13.0" + "@lerna/collect-updates" "3.18.0" + "@lerna/filter-packages" "3.18.0" dedent "^0.7.0" + figgy-pudding "^3.5.1" + npmlog "^4.1.2" -"@lerna/filter-packages@3.13.0": - version "3.13.0" - resolved "https://registry.yarnpkg.com/@lerna/filter-packages/-/filter-packages-3.13.0.tgz#f5371249e7e1a15928e5e88c544a242e0162c21c" - integrity sha512-RWiZWyGy3Mp7GRVBn//CacSnE3Kw82PxE4+H6bQ3pDUw/9atXn7NRX+gkBVQIYeKamh7HyumJtyOKq3Pp9BADQ== +"@lerna/filter-packages@3.18.0": + version "3.18.0" + resolved "https://registry.yarnpkg.com/@lerna/filter-packages/-/filter-packages-3.18.0.tgz#6a7a376d285208db03a82958cfb8172e179b4e70" + integrity sha512-6/0pMM04bCHNATIOkouuYmPg6KH3VkPCIgTfQmdkPJTullERyEQfNUKikrefjxo1vHOoCACDpy65JYyKiAbdwQ== dependencies: "@lerna/validation-error" "3.13.0" - multimatch "^2.1.0" + multimatch "^3.0.0" npmlog "^4.1.2" "@lerna/get-npm-exec-opts@3.13.0": @@ -1215,23 +1272,23 @@ dependencies: npmlog "^4.1.2" -"@lerna/get-packed@3.13.0": - version "3.13.0" - resolved "https://registry.yarnpkg.com/@lerna/get-packed/-/get-packed-3.13.0.tgz#335e40d77f3c1855aa248587d3e0b2d8f4b06e16" - integrity sha512-EgSim24sjIjqQDC57bgXD9l22/HCS93uQBbGpkzEOzxAVzEgpZVm7Fm1t8BVlRcT2P2zwGnRadIvxTbpQuDPTg== +"@lerna/get-packed@3.16.0": + version "3.16.0" + resolved "https://registry.yarnpkg.com/@lerna/get-packed/-/get-packed-3.16.0.tgz#1b316b706dcee86c7baa55e50b087959447852ff" + integrity sha512-AjsFiaJzo1GCPnJUJZiTW6J1EihrPkc2y3nMu6m3uWFxoleklsSCyImumzVZJssxMi3CPpztj8LmADLedl9kXw== dependencies: - fs-extra "^7.0.0" + fs-extra "^8.1.0" ssri "^6.0.1" tar "^4.4.8" -"@lerna/github-client@3.14.2": - version "3.14.2" - resolved "https://registry.yarnpkg.com/@lerna/github-client/-/github-client-3.14.2.tgz#a743792b51cd9bdfb785186e429568827a6372eb" - integrity sha512-+2Xh7t4qVmXiXE2utPnh5T7YwSltG74JP7c+EiooRY5+3zjh9MpPOcTKxVY3xKclzpsyXMohk2KpTF4tzA5rrg== +"@lerna/github-client@3.16.5": + version "3.16.5" + resolved "https://registry.yarnpkg.com/@lerna/github-client/-/github-client-3.16.5.tgz#2eb0235c3bf7a7e5d92d73e09b3761ab21f35c2e" + integrity sha512-rHQdn8Dv/CJrO3VouOP66zAcJzrHsm+wFuZ4uGAai2At2NkgKH+tpNhQy2H1PSC0Ezj9LxvdaHYrUzULqVK5Hw== dependencies: - "@lerna/child-process" "3.14.2" - "@octokit/plugin-enterprise-rest" "^2.1.1" - "@octokit/rest" "^16.16.0" + "@lerna/child-process" "3.16.5" + "@octokit/plugin-enterprise-rest" "^3.6.1" + "@octokit/rest" "^16.28.4" git-url-parse "^11.1.2" npmlog "^4.1.2" @@ -1249,141 +1306,141 @@ resolved "https://registry.yarnpkg.com/@lerna/global-options/-/global-options-3.13.0.tgz#217662290db06ad9cf2c49d8e3100ee28eaebae1" integrity sha512-SlZvh1gVRRzYLVluz9fryY1nJpZ0FHDGB66U9tFfvnnxmueckRQxLopn3tXj3NU1kc3QANT2I5BsQkOqZ4TEFQ== -"@lerna/has-npm-version@3.14.2": - version "3.14.2" - resolved "https://registry.yarnpkg.com/@lerna/has-npm-version/-/has-npm-version-3.14.2.tgz#ac17f7c68e92114b8332b95ae6cffec9c0d67a7b" - integrity sha512-cG+z5bB8JPd5f+nT2eLN2LmKg06O11AxlnUxgw2W7cLyc7cnsmMSp/rxt2JBMwW2r4Yn+CLLJIRwJZ2Es8jFSw== +"@lerna/has-npm-version@3.16.5": + version "3.16.5" + resolved "https://registry.yarnpkg.com/@lerna/has-npm-version/-/has-npm-version-3.16.5.tgz#ab83956f211d8923ea6afe9b979b38cc73b15326" + integrity sha512-WL7LycR9bkftyqbYop5rEGJ9sRFIV55tSGmbN1HLrF9idwOCD7CLrT64t235t3t4O5gehDnwKI5h2U3oxTrF8Q== dependencies: - "@lerna/child-process" "3.14.2" - semver "^5.5.0" + "@lerna/child-process" "3.16.5" + semver "^6.2.0" -"@lerna/import@3.15.0": - version "3.15.0" - resolved "https://registry.yarnpkg.com/@lerna/import/-/import-3.15.0.tgz#47f2da52059a96bb08a4c09e18d985258fce9ce1" - integrity sha512-4GKQgeTXBTwMbZNkYyPdQIVA41HIISD7D6XRNrDaG0falUfvoPsknijQPCBmGqeh66u1Fcn2+4lkL3OCTj2FMg== +"@lerna/import@3.18.5": + version "3.18.5" + resolved "https://registry.yarnpkg.com/@lerna/import/-/import-3.18.5.tgz#a9c7d8601870729851293c10abd18b3707f7ba5e" + integrity sha512-PH0WVLEgp+ORyNKbGGwUcrueW89K3Iuk/DDCz8mFyG2IG09l/jOF0vzckEyGyz6PO5CMcz4TI1al/qnp3FrahQ== dependencies: - "@lerna/child-process" "3.14.2" - "@lerna/command" "3.15.0" - "@lerna/prompt" "3.13.0" + "@lerna/child-process" "3.16.5" + "@lerna/command" "3.18.5" + "@lerna/prompt" "3.18.5" "@lerna/pulse-till-done" "3.13.0" "@lerna/validation-error" "3.13.0" dedent "^0.7.0" - fs-extra "^7.0.0" + fs-extra "^8.1.0" p-map-series "^1.0.0" -"@lerna/init@3.15.0": - version "3.15.0" - resolved "https://registry.yarnpkg.com/@lerna/init/-/init-3.15.0.tgz#bda36de44c365972f87cbd287fe85b6fb7bb1070" - integrity sha512-VOqH6kFbFtfUbXxhSqXKY6bjnVp9nLuLRI6x9tVHOANX2LmSlXm17OUGBnNt+eM4uJLuiUsAR8nTlpCiz//lPQ== - dependencies: - "@lerna/child-process" "3.14.2" - "@lerna/command" "3.15.0" - fs-extra "^7.0.0" - p-map "^1.2.0" - write-json-file "^2.3.0" - -"@lerna/link@3.15.0": - version "3.15.0" - resolved "https://registry.yarnpkg.com/@lerna/link/-/link-3.15.0.tgz#718b4116a8eacb3fc73414ae8d97f8fdaf8125da" - integrity sha512-yKHuifADINobvDOLljBGkVGpVwy6J3mg5p9lQXBdOLXBoIKC8o/UKBR9JvZMFvT/Iy6zn6FPy1v5lz9iU1Ib0Q== - dependencies: - "@lerna/command" "3.15.0" - "@lerna/package-graph" "3.14.0" - "@lerna/symlink-dependencies" "3.14.2" - p-map "^1.2.0" - slash "^1.0.0" +"@lerna/init@3.18.5": + version "3.18.5" + resolved "https://registry.yarnpkg.com/@lerna/init/-/init-3.18.5.tgz#86dd0b2b3290755a96975069b5cb007f775df9f5" + integrity sha512-oCwipWrha98EcJAHm8AGd2YFFLNI7AW9AWi0/LbClj1+XY9ah+uifXIgYGfTk63LbgophDd8936ZEpHMxBsbAg== + dependencies: + "@lerna/child-process" "3.16.5" + "@lerna/command" "3.18.5" + fs-extra "^8.1.0" + p-map "^2.1.0" + write-json-file "^3.2.0" + +"@lerna/link@3.18.5": + version "3.18.5" + resolved "https://registry.yarnpkg.com/@lerna/link/-/link-3.18.5.tgz#f24347e4f0b71d54575bd37cfa1794bc8ee91b18" + integrity sha512-xTN3vktJpkT7Nqc3QkZRtHO4bT5NvuLMtKNIBDkks0HpGxC9PRyyqwOoCoh1yOGbrWIuDezhfMg3Qow+6I69IQ== + dependencies: + "@lerna/command" "3.18.5" + "@lerna/package-graph" "3.18.5" + "@lerna/symlink-dependencies" "3.17.0" + p-map "^2.1.0" + slash "^2.0.0" -"@lerna/list@3.15.0": - version "3.15.0" - resolved "https://registry.yarnpkg.com/@lerna/list/-/list-3.15.0.tgz#4e401c1ad990bb12bd38298cb61d21136420ff68" - integrity sha512-8SvxnlfAnbEzQDf2NL0IxWyUuqWTykF9cHt5/f5TOzgESClpaOkDtqwh/UlE8nVTzWMnxnQUPQi3UTKyJD3i3g== +"@lerna/list@3.18.5": + version "3.18.5" + resolved "https://registry.yarnpkg.com/@lerna/list/-/list-3.18.5.tgz#58863f17c81e24e2c38018eb8619fc99d7cc5c82" + integrity sha512-qIeomm28C2OCM8TMjEe/chTnQf6XLN54wPVQ6kZy+axMYxANFNt/uhs6GZEmhem7GEVawzkyHSz5ZJPsfH3IFg== dependencies: - "@lerna/command" "3.15.0" - "@lerna/filter-options" "3.14.2" - "@lerna/listable" "3.14.0" + "@lerna/command" "3.18.5" + "@lerna/filter-options" "3.18.4" + "@lerna/listable" "3.18.5" "@lerna/output" "3.13.0" -"@lerna/listable@3.14.0": - version "3.14.0" - resolved "https://registry.yarnpkg.com/@lerna/listable/-/listable-3.14.0.tgz#08f4c78e0466568e8e8a57d4ad09537f2bb7bbb9" - integrity sha512-ZK44Mo8xf/N97eQZ236SPSq0ek6+gk4HqHIx05foEMZVV1iIDH4a/nblLsJNjGQVsIdMYFPaqNJ0z+ZQfiJazQ== +"@lerna/listable@3.18.5": + version "3.18.5" + resolved "https://registry.yarnpkg.com/@lerna/listable/-/listable-3.18.5.tgz#e82798405b5ed8fc51843c8ef1e7a0e497388a1a" + integrity sha512-Sdr3pVyaEv5A7ZkGGYR7zN+tTl2iDcinryBPvtuv20VJrXBE8wYcOks1edBTcOWsPjCE/rMP4bo1pseyk3UTsg== dependencies: - "@lerna/query-graph" "3.14.0" + "@lerna/query-graph" "3.18.5" chalk "^2.3.1" columnify "^1.5.4" -"@lerna/log-packed@3.13.0": - version "3.13.0" - resolved "https://registry.yarnpkg.com/@lerna/log-packed/-/log-packed-3.13.0.tgz#497b5f692a8d0e3f669125da97b0dadfd9e480f3" - integrity sha512-Rmjrcz+6aM6AEcEVWmurbo8+AnHOvYtDpoeMMJh9IZ9SmZr2ClXzmD7wSvjTQc8BwOaiWjjC/ukcT0UYA2m7wg== +"@lerna/log-packed@3.16.0": + version "3.16.0" + resolved "https://registry.yarnpkg.com/@lerna/log-packed/-/log-packed-3.16.0.tgz#f83991041ee77b2495634e14470b42259fd2bc16" + integrity sha512-Fp+McSNBV/P2mnLUYTaSlG8GSmpXM7krKWcllqElGxvAqv6chk2K3c2k80MeVB4WvJ9tRjUUf+i7HUTiQ9/ckQ== dependencies: - byte-size "^4.0.3" + byte-size "^5.0.1" columnify "^1.5.4" has-unicode "^2.0.1" npmlog "^4.1.2" -"@lerna/npm-conf@3.13.0": - version "3.13.0" - resolved "https://registry.yarnpkg.com/@lerna/npm-conf/-/npm-conf-3.13.0.tgz#6b434ed75ff757e8c14381b9bbfe5d5ddec134a7" - integrity sha512-Jg2kANsGnhg+fbPEzE0X9nX5oviEAvWj0nYyOkcE+cgWuT7W0zpnPXC4hA4C5IPQGhwhhh0IxhWNNHtjTuw53g== +"@lerna/npm-conf@3.16.0": + version "3.16.0" + resolved "https://registry.yarnpkg.com/@lerna/npm-conf/-/npm-conf-3.16.0.tgz#1c10a89ae2f6c2ee96962557738685300d376827" + integrity sha512-HbO3DUrTkCAn2iQ9+FF/eisDpWY5POQAOF1m7q//CZjdC2HSW3UYbKEGsSisFxSfaF9Z4jtrV+F/wX6qWs3CuA== dependencies: config-chain "^1.1.11" - pify "^3.0.0" + pify "^4.0.1" -"@lerna/npm-dist-tag@3.15.0": - version "3.15.0" - resolved "https://registry.yarnpkg.com/@lerna/npm-dist-tag/-/npm-dist-tag-3.15.0.tgz#262dd1e67a4cf82ae78fadfe02622ebce4add078" - integrity sha512-lnbdwc4Ebs7/EI9fTIgbH3dxXnP+SuCcGhG7P5ZjOqo67SY09sRZGcygEzabpvIwXvKpBF8vCd4xxzjnF2u+PA== +"@lerna/npm-dist-tag@3.18.5": + version "3.18.5" + resolved "https://registry.yarnpkg.com/@lerna/npm-dist-tag/-/npm-dist-tag-3.18.5.tgz#9ef9abb7c104077b31f6fab22cc73b314d54ac55" + integrity sha512-xw0HDoIG6HreVsJND9/dGls1c+lf6vhu7yJoo56Sz5bvncTloYGLUppIfDHQr4ZvmPCK8rsh0euCVh2giPxzKQ== dependencies: - "@evocateur/npm-registry-fetch" "^3.9.1" - "@lerna/otplease" "3.14.0" + "@evocateur/npm-registry-fetch" "^4.0.0" + "@lerna/otplease" "3.18.5" figgy-pudding "^3.5.1" npm-package-arg "^6.1.0" npmlog "^4.1.2" -"@lerna/npm-install@3.14.2": - version "3.14.2" - resolved "https://registry.yarnpkg.com/@lerna/npm-install/-/npm-install-3.14.2.tgz#fd22ff432f8b7cbe05bedfd36b0506482f1a4732" - integrity sha512-JYJJRtLETrGpcQZa8Rj16vbye399RqnaXmJlZuZ2twjJ2DYVYtwkfsGEOdvdaKw5KVOEpWcAxBA9OMmKQtCLQw== +"@lerna/npm-install@3.16.5": + version "3.16.5" + resolved "https://registry.yarnpkg.com/@lerna/npm-install/-/npm-install-3.16.5.tgz#d6bfdc16f81285da66515ae47924d6e278d637d3" + integrity sha512-hfiKk8Eku6rB9uApqsalHHTHY+mOrrHeWEs+gtg7+meQZMTS3kzv4oVp5cBZigndQr3knTLjwthT/FX4KvseFg== dependencies: - "@lerna/child-process" "3.14.2" + "@lerna/child-process" "3.16.5" "@lerna/get-npm-exec-opts" "3.13.0" - fs-extra "^7.0.0" + fs-extra "^8.1.0" npm-package-arg "^6.1.0" npmlog "^4.1.2" signal-exit "^3.0.2" write-pkg "^3.1.0" -"@lerna/npm-publish@3.15.0": - version "3.15.0" - resolved "https://registry.yarnpkg.com/@lerna/npm-publish/-/npm-publish-3.15.0.tgz#89126d74ec97186475767b852954a5f55b732a71" - integrity sha512-G7rcNcSGjG0La8eHPXDvCvoNXbwNnP6XJ+GPh3CH5xiR/nikfLOa+Bfm4ytdjVWWxnKfCT4qyMTCoV1rROlqQQ== +"@lerna/npm-publish@3.18.5": + version "3.18.5" + resolved "https://registry.yarnpkg.com/@lerna/npm-publish/-/npm-publish-3.18.5.tgz#240e4039959fd9816b49c5b07421e11b5cb000af" + integrity sha512-3etLT9+2L8JAx5F8uf7qp6iAtOLSMj+ZYWY6oUgozPi/uLqU0/gsMsEXh3F0+YVW33q0M61RpduBoAlOOZnaTg== dependencies: - "@evocateur/libnpmpublish" "^1.2.0" - "@lerna/otplease" "3.14.0" - "@lerna/run-lifecycle" "3.14.0" + "@evocateur/libnpmpublish" "^1.2.2" + "@lerna/otplease" "3.18.5" + "@lerna/run-lifecycle" "3.16.2" figgy-pudding "^3.5.1" - fs-extra "^7.0.0" + fs-extra "^8.1.0" npm-package-arg "^6.1.0" npmlog "^4.1.2" - pify "^3.0.0" + pify "^4.0.1" read-package-json "^2.0.13" -"@lerna/npm-run-script@3.14.2": - version "3.14.2" - resolved "https://registry.yarnpkg.com/@lerna/npm-run-script/-/npm-run-script-3.14.2.tgz#8c518ea9d241a641273e77aad6f6fddc16779c3f" - integrity sha512-LbVFv+nvAoRTYLMrJlJ8RiakHXrLslL7Jp/m1R18vYrB8LYWA3ey+nz5Tel2OELzmjUiemAKZsD9h6i+Re5egg== +"@lerna/npm-run-script@3.16.5": + version "3.16.5" + resolved "https://registry.yarnpkg.com/@lerna/npm-run-script/-/npm-run-script-3.16.5.tgz#9c2ec82453a26c0b46edc0bb7c15816c821f5c15" + integrity sha512-1asRi+LjmVn3pMjEdpqKJZFT/3ZNpb+VVeJMwrJaV/3DivdNg7XlPK9LTrORuKU4PSvhdEZvJmSlxCKyDpiXsQ== dependencies: - "@lerna/child-process" "3.14.2" + "@lerna/child-process" "3.16.5" "@lerna/get-npm-exec-opts" "3.13.0" npmlog "^4.1.2" -"@lerna/otplease@3.14.0": - version "3.14.0" - resolved "https://registry.yarnpkg.com/@lerna/otplease/-/otplease-3.14.0.tgz#b539fd3e7a08452fc0db3b10010ca3cf0e4a73e7" - integrity sha512-rYAWzaYZ81bwnrmTkYWGgcc13bl/6DlG7pjWQWNGAJNLzO5zzj0xmXN5sMFJnNvDpSiS/ZS1sIuPvb4xnwLUkg== +"@lerna/otplease@3.18.5": + version "3.18.5" + resolved "https://registry.yarnpkg.com/@lerna/otplease/-/otplease-3.18.5.tgz#b77b8e760b40abad9f7658d988f3ea77d4fd0231" + integrity sha512-S+SldXAbcXTEDhzdxYLU0ZBKuYyURP/ND2/dK6IpKgLxQYh/z4ScljPDMyKymmEvgiEJmBsPZAAPfmNPEzxjog== dependencies: - "@lerna/prompt" "3.13.0" + "@lerna/prompt" "3.18.5" figgy-pudding "^3.5.1" "@lerna/output@3.13.0": @@ -1393,107 +1450,108 @@ dependencies: npmlog "^4.1.2" -"@lerna/pack-directory@3.14.2": - version "3.14.2" - resolved "https://registry.yarnpkg.com/@lerna/pack-directory/-/pack-directory-3.14.2.tgz#577b8ebf867c9b636a2e4659a27552ee24d83b9d" - integrity sha512-b3LnJEmIml3sDj94TQT8R+kVyrDlmE7Su0WwcBYZDySXPMSZ38WA2/2Xjy/EWhXlFxp/nUJKyUG78nDrZ/00Uw== +"@lerna/pack-directory@3.16.4": + version "3.16.4" + resolved "https://registry.yarnpkg.com/@lerna/pack-directory/-/pack-directory-3.16.4.tgz#3eae5f91bdf5acfe0384510ed53faddc4c074693" + integrity sha512-uxSF0HZeGyKaaVHz5FroDY9A5NDDiCibrbYR6+khmrhZtY0Bgn6hWq8Gswl9iIlymA+VzCbshWIMX4o2O8C8ng== dependencies: - "@lerna/get-packed" "3.13.0" - "@lerna/package" "3.14.2" - "@lerna/run-lifecycle" "3.14.0" + "@lerna/get-packed" "3.16.0" + "@lerna/package" "3.16.0" + "@lerna/run-lifecycle" "3.16.2" figgy-pudding "^3.5.1" - npm-packlist "^1.4.1" + npm-packlist "^1.4.4" npmlog "^4.1.2" - tar "^4.4.8" + tar "^4.4.10" temp-write "^3.4.0" -"@lerna/package-graph@3.14.0": - version "3.14.0" - resolved "https://registry.yarnpkg.com/@lerna/package-graph/-/package-graph-3.14.0.tgz#4ccdf446dccedfbbeb4efff3eb720cb6fcb109fc" - integrity sha512-dNpA/64STD5YXhaSlg4gT6Z474WPJVCHoX1ibsVIFu0fVgH609Y69bsdmbvTRdI7r6Dcu4ZfGxdR636RTrH+Eg== +"@lerna/package-graph@3.18.5": + version "3.18.5" + resolved "https://registry.yarnpkg.com/@lerna/package-graph/-/package-graph-3.18.5.tgz#c740e2ea3578d059e551633e950690831b941f6b" + integrity sha512-8QDrR9T+dBegjeLr+n9WZTVxUYUhIUjUgZ0gvNxUBN8S1WB9r6H5Yk56/MVaB64tA3oGAN9IIxX6w0WvTfFudA== dependencies: - "@lerna/prerelease-id-from-version" "3.14.0" + "@lerna/prerelease-id-from-version" "3.16.0" "@lerna/validation-error" "3.13.0" npm-package-arg "^6.1.0" npmlog "^4.1.2" - semver "^5.5.0" + semver "^6.2.0" -"@lerna/package@3.14.2": - version "3.14.2" - resolved "https://registry.yarnpkg.com/@lerna/package/-/package-3.14.2.tgz#f893cb42e26c869df272dafbe1dd5a3473b0bd4d" - integrity sha512-YR/+CzYdufJYfsUlrfuhTjA35iSZpXK7mVOZmeR9iRWhSaqesm4kq2zfxm9vCpZV2oAQQZOwi4eo5h0rQBtdiw== +"@lerna/package@3.16.0": + version "3.16.0" + resolved "https://registry.yarnpkg.com/@lerna/package/-/package-3.16.0.tgz#7e0a46e4697ed8b8a9c14d59c7f890e0d38ba13c" + integrity sha512-2lHBWpaxcBoiNVbtyLtPUuTYEaB/Z+eEqRS9duxpZs6D+mTTZMNy6/5vpEVSCBmzvdYpyqhqaYjjSLvjjr5Riw== dependencies: - load-json-file "^4.0.0" + load-json-file "^5.3.0" npm-package-arg "^6.1.0" write-pkg "^3.1.0" -"@lerna/prerelease-id-from-version@3.14.0": - version "3.14.0" - resolved "https://registry.yarnpkg.com/@lerna/prerelease-id-from-version/-/prerelease-id-from-version-3.14.0.tgz#d5da9c26ac4a0d0ecde09018f06e41ca4dd444c2" - integrity sha512-Ap3Z/dNhqQuSrKmK+JmzYvQYI2vowxHvUVxZJiDVilW8dyNnxkCsYFmkuZytk5sxVz4VeGLNPS2RSsU5eeSS+Q== +"@lerna/prerelease-id-from-version@3.16.0": + version "3.16.0" + resolved "https://registry.yarnpkg.com/@lerna/prerelease-id-from-version/-/prerelease-id-from-version-3.16.0.tgz#b24bfa789f5e1baab914d7b08baae9b7bd7d83a1" + integrity sha512-qZyeUyrE59uOK8rKdGn7jQz+9uOpAaF/3hbslJVFL1NqF9ELDTqjCPXivuejMX/lN4OgD6BugTO4cR7UTq/sZA== dependencies: - semver "^5.5.0" + semver "^6.2.0" -"@lerna/project@3.15.0": - version "3.15.0" - resolved "https://registry.yarnpkg.com/@lerna/project/-/project-3.15.0.tgz#733b0993a849dcf5b68fcd0ec11d8f7de38a6999" - integrity sha512-eNGUWiMbQ9kh9kGkomtMnsLypS0rfLqxKgZP2+VnNVtIXjnLv4paeTm+1lkL+naNJUwhnpMk2NSLEeoxT/20QA== +"@lerna/project@3.18.0": + version "3.18.0" + resolved "https://registry.yarnpkg.com/@lerna/project/-/project-3.18.0.tgz#56feee01daeb42c03cbdf0ed8a2a10cbce32f670" + integrity sha512-+LDwvdAp0BurOAWmeHE3uuticsq9hNxBI0+FMHiIai8jrygpJGahaQrBYWpwbshbQyVLeQgx3+YJdW2TbEdFWA== dependencies: - "@lerna/package" "3.14.2" + "@lerna/package" "3.16.0" "@lerna/validation-error" "3.13.0" cosmiconfig "^5.1.0" dedent "^0.7.0" dot-prop "^4.2.0" - glob-parent "^3.1.0" - globby "^8.0.1" - load-json-file "^4.0.0" + glob-parent "^5.0.0" + globby "^9.2.0" + load-json-file "^5.3.0" npmlog "^4.1.2" - p-map "^1.2.0" + p-map "^2.1.0" resolve-from "^4.0.0" - write-json-file "^2.3.0" + write-json-file "^3.2.0" -"@lerna/prompt@3.13.0": - version "3.13.0" - resolved "https://registry.yarnpkg.com/@lerna/prompt/-/prompt-3.13.0.tgz#53571462bb3f5399cc1ca6d335a411fe093426a5" - integrity sha512-P+lWSFokdyvYpkwC3it9cE0IF2U5yy2mOUbGvvE4iDb9K7TyXGE+7lwtx2thtPvBAfIb7O13POMkv7df03HJeA== +"@lerna/prompt@3.18.5": + version "3.18.5" + resolved "https://registry.yarnpkg.com/@lerna/prompt/-/prompt-3.18.5.tgz#628cd545f225887d060491ab95df899cfc5218a1" + integrity sha512-rkKj4nm1twSbBEb69+Em/2jAERK8htUuV8/xSjN0NPC+6UjzAwY52/x9n5cfmpa9lyKf/uItp7chCI7eDmNTKQ== dependencies: inquirer "^6.2.0" npmlog "^4.1.2" -"@lerna/publish@3.15.0": - version "3.15.0" - resolved "https://registry.yarnpkg.com/@lerna/publish/-/publish-3.15.0.tgz#54f93f8f0820d2d419d0b65df1eb55d8277090c9" - integrity sha512-6tRRBJ8olLSXfrUsR4f7vSfx0cT1oPi6/v06yI3afDSsUX6eQ3ooZh7gMY4RWmd+nM/IJHTUzhlKF6WhTvo+9g== - dependencies: - "@evocateur/libnpmaccess" "^3.1.0" - "@evocateur/npm-registry-fetch" "^3.9.1" - "@evocateur/pacote" "^9.6.0" - "@lerna/check-working-tree" "3.14.2" - "@lerna/child-process" "3.14.2" - "@lerna/collect-updates" "3.14.2" - "@lerna/command" "3.15.0" - "@lerna/describe-ref" "3.14.2" - "@lerna/log-packed" "3.13.0" - "@lerna/npm-conf" "3.13.0" - "@lerna/npm-dist-tag" "3.15.0" - "@lerna/npm-publish" "3.15.0" +"@lerna/publish@3.18.5": + version "3.18.5" + resolved "https://registry.yarnpkg.com/@lerna/publish/-/publish-3.18.5.tgz#8cc708d83a4cb7ab1c4cc020a02e7ebc4b6b0b0e" + integrity sha512-ifYqLX6mvw95T8vYRlhT68UC7Al0flQvnf5uF9lDgdrgR5Bs+BTwzk3D+0ctdqMtfooekrV6pqfW0R3gtwRffQ== + dependencies: + "@evocateur/libnpmaccess" "^3.1.2" + "@evocateur/npm-registry-fetch" "^4.0.0" + "@evocateur/pacote" "^9.6.3" + "@lerna/check-working-tree" "3.16.5" + "@lerna/child-process" "3.16.5" + "@lerna/collect-updates" "3.18.0" + "@lerna/command" "3.18.5" + "@lerna/describe-ref" "3.16.5" + "@lerna/log-packed" "3.16.0" + "@lerna/npm-conf" "3.16.0" + "@lerna/npm-dist-tag" "3.18.5" + "@lerna/npm-publish" "3.18.5" + "@lerna/otplease" "3.18.5" "@lerna/output" "3.13.0" - "@lerna/pack-directory" "3.14.2" - "@lerna/prerelease-id-from-version" "3.14.0" - "@lerna/prompt" "3.13.0" + "@lerna/pack-directory" "3.16.4" + "@lerna/prerelease-id-from-version" "3.16.0" + "@lerna/prompt" "3.18.5" "@lerna/pulse-till-done" "3.13.0" - "@lerna/run-lifecycle" "3.14.0" - "@lerna/run-topologically" "3.14.0" + "@lerna/run-lifecycle" "3.16.2" + "@lerna/run-topologically" "3.18.5" "@lerna/validation-error" "3.13.0" - "@lerna/version" "3.15.0" + "@lerna/version" "3.18.5" figgy-pudding "^3.5.1" - fs-extra "^7.0.0" + fs-extra "^8.1.0" npm-package-arg "^6.1.0" npmlog "^4.1.2" p-finally "^1.0.0" - p-map "^1.2.0" + p-map "^2.1.0" p-pipe "^1.2.0" - semver "^5.5.0" + semver "^6.2.0" "@lerna/pulse-till-done@3.13.0": version "3.13.0" @@ -1502,95 +1560,87 @@ dependencies: npmlog "^4.1.2" -"@lerna/query-graph@3.14.0": - version "3.14.0" - resolved "https://registry.yarnpkg.com/@lerna/query-graph/-/query-graph-3.14.0.tgz#2abb36f445bd924d0f85ac7aec1445e9ef1e2c6c" - integrity sha512-6YTh3vDMW2hUxHdKeRvx4bosc9lZClKaN+DzC1XKTkwDbWrsjmEzLcemKL6QnyyeuryN2f/eto7P9iSe3z3pQQ== +"@lerna/query-graph@3.18.5": + version "3.18.5" + resolved "https://registry.yarnpkg.com/@lerna/query-graph/-/query-graph-3.18.5.tgz#df4830bb5155273003bf35e8dda1c32d0927bd86" + integrity sha512-50Lf4uuMpMWvJ306be3oQDHrWV42nai9gbIVByPBYJuVW8dT8O8pA3EzitNYBUdLL9/qEVbrR0ry1HD7EXwtRA== dependencies: - "@lerna/package-graph" "3.14.0" + "@lerna/package-graph" "3.18.5" figgy-pudding "^3.5.1" -"@lerna/resolve-symlink@3.13.0": - version "3.13.0" - resolved "https://registry.yarnpkg.com/@lerna/resolve-symlink/-/resolve-symlink-3.13.0.tgz#3e6809ef53b63fe914814bfa071cd68012e22fbb" - integrity sha512-Lc0USSFxwDxUs5JvIisS8JegjA6SHSAWJCMvi2osZx6wVRkEDlWG2B1JAfXUzCMNfHoZX0/XX9iYZ+4JIpjAtg== +"@lerna/resolve-symlink@3.16.0": + version "3.16.0" + resolved "https://registry.yarnpkg.com/@lerna/resolve-symlink/-/resolve-symlink-3.16.0.tgz#37fc7095fabdbcf317c26eb74e0d0bde8efd2386" + integrity sha512-Ibj5e7njVHNJ/NOqT4HlEgPFPtPLWsO7iu59AM5bJDcAJcR96mLZ7KGVIsS2tvaO7akMEJvt2P+ErwCdloG3jQ== dependencies: - fs-extra "^7.0.0" + fs-extra "^8.1.0" npmlog "^4.1.2" read-cmd-shim "^1.0.1" -"@lerna/rimraf-dir@3.14.2": - version "3.14.2" - resolved "https://registry.yarnpkg.com/@lerna/rimraf-dir/-/rimraf-dir-3.14.2.tgz#103a49882abd85d42285d05cc76869b89f21ffd2" - integrity sha512-eFNkZsy44Bu9v1Hrj5Zk6omzg8O9h/7W6QYK1TTUHeyrjTEwytaNQlqF0lrTLmEvq55sviV42NC/8P3M2cvq8Q== +"@lerna/rimraf-dir@3.16.5": + version "3.16.5" + resolved "https://registry.yarnpkg.com/@lerna/rimraf-dir/-/rimraf-dir-3.16.5.tgz#04316ab5ffd2909657aaf388ea502cb8c2f20a09" + integrity sha512-bQlKmO0pXUsXoF8lOLknhyQjOZsCc0bosQDoX4lujBXSWxHVTg1VxURtWf2lUjz/ACsJVDfvHZbDm8kyBk5okA== dependencies: - "@lerna/child-process" "3.14.2" + "@lerna/child-process" "3.16.5" npmlog "^4.1.2" path-exists "^3.0.0" rimraf "^2.6.2" -"@lerna/run-lifecycle@3.14.0": - version "3.14.0" - resolved "https://registry.yarnpkg.com/@lerna/run-lifecycle/-/run-lifecycle-3.14.0.tgz#0499eca0e7f393faf4e24e6c8737302a9059c22b" - integrity sha512-GUM3L9MzGRSW0WQ8wbLW1+SYStU1OFjW0GBzShhBnFrO4nGRrU7VchsLpcLu0hk2uCzyhsrDKzifEdOdUyMoEQ== +"@lerna/run-lifecycle@3.16.2": + version "3.16.2" + resolved "https://registry.yarnpkg.com/@lerna/run-lifecycle/-/run-lifecycle-3.16.2.tgz#67b288f8ea964db9ea4fb1fbc7715d5bbb0bce00" + integrity sha512-RqFoznE8rDpyyF0rOJy3+KjZCeTkO8y/OB9orPauR7G2xQ7PTdCpgo7EO6ZNdz3Al+k1BydClZz/j78gNCmL2A== dependencies: - "@lerna/npm-conf" "3.13.0" + "@lerna/npm-conf" "3.16.0" figgy-pudding "^3.5.1" - npm-lifecycle "^2.1.1" + npm-lifecycle "^3.1.2" npmlog "^4.1.2" -"@lerna/run-parallel-batches@3.13.0": - version "3.13.0" - resolved "https://registry.yarnpkg.com/@lerna/run-parallel-batches/-/run-parallel-batches-3.13.0.tgz#0276bb4e7cd0995297db82d134ca2bd08d63e311" - integrity sha512-bICFBR+cYVF1FFW+Tlm0EhWDioTUTM6dOiVziDEGE1UZha1dFkMYqzqdSf4bQzfLS31UW/KBd/2z8jy2OIjEjg== - dependencies: - p-map "^1.2.0" - p-map-series "^1.0.0" - -"@lerna/run-topologically@3.14.0": - version "3.14.0" - resolved "https://registry.yarnpkg.com/@lerna/run-topologically/-/run-topologically-3.14.0.tgz#2a560cb657f0ef1565c680b6001b4b01b872dc07" - integrity sha512-y+KBpC1YExFzGynovt9MY4O/bc3RrJaKeuXieiPfKGKxrdtmZe/r33oj/xePTXZq65jnw3SaU3H8S5CrrdkwDg== +"@lerna/run-topologically@3.18.5": + version "3.18.5" + resolved "https://registry.yarnpkg.com/@lerna/run-topologically/-/run-topologically-3.18.5.tgz#3cd639da20e967d7672cb88db0f756b92f2fdfc3" + integrity sha512-6N1I+6wf4hLOnPW+XDZqwufyIQ6gqoPfHZFkfWlvTQ+Ue7CuF8qIVQ1Eddw5HKQMkxqN10thKOFfq/9NQZ4NUg== dependencies: - "@lerna/query-graph" "3.14.0" + "@lerna/query-graph" "3.18.5" figgy-pudding "^3.5.1" p-queue "^4.0.0" -"@lerna/run@3.15.0": - version "3.15.0" - resolved "https://registry.yarnpkg.com/@lerna/run/-/run-3.15.0.tgz#465028b5b561a050bd760924e4a0749de3f43172" - integrity sha512-KQBkzZYoEKmzILKjbjsm1KKVWFBXwAdwzqJWj/lfxxd3V5LRF8STASk8aiw8bSpB0bUL9TU/pbXakRxiNzjDwQ== +"@lerna/run@3.18.5": + version "3.18.5" + resolved "https://registry.yarnpkg.com/@lerna/run/-/run-3.18.5.tgz#09ae809b16445d3621249c24596cf4ae8e250d5d" + integrity sha512-1S0dZccNJO8+gT5ztYE4rHTEnbXVwThHOfDnlVt2KDxl9cbnBALk3xprGLW7lSzJsxegS849hxrAPUh0UorMgw== dependencies: - "@lerna/command" "3.15.0" - "@lerna/filter-options" "3.14.2" - "@lerna/npm-run-script" "3.14.2" + "@lerna/command" "3.18.5" + "@lerna/filter-options" "3.18.4" + "@lerna/npm-run-script" "3.16.5" "@lerna/output" "3.13.0" - "@lerna/run-topologically" "3.14.0" + "@lerna/run-topologically" "3.18.5" "@lerna/timer" "3.13.0" "@lerna/validation-error" "3.13.0" - p-map "^1.2.0" - -"@lerna/symlink-binary@3.14.2": - version "3.14.2" - resolved "https://registry.yarnpkg.com/@lerna/symlink-binary/-/symlink-binary-3.14.2.tgz#a832fdc6c4b1e5aaf9e6ac9c7e6c322746965eb0" - integrity sha512-tqMwuWi6z1da0AFFbleWyu3H9fqayiV50rjj4anFTfayel9jSjlA1xPG+56sGIP6zUUNuUSc9kLh7oRRmlauoA== - dependencies: - "@lerna/create-symlink" "3.14.0" - "@lerna/package" "3.14.2" - fs-extra "^7.0.0" - p-map "^1.2.0" - -"@lerna/symlink-dependencies@3.14.2": - version "3.14.2" - resolved "https://registry.yarnpkg.com/@lerna/symlink-dependencies/-/symlink-dependencies-3.14.2.tgz#e6b2a9544ff26addc1f4324734595e2f71dfc795" - integrity sha512-Ox7WKXnHZ7IwWlejcCq3n0Hd/yMLv8AwIryhvWxM/RauAge+ML4wg578SsdCyKob8ecgm/R0ytHiU06j81iL1w== - dependencies: - "@lerna/create-symlink" "3.14.0" - "@lerna/resolve-symlink" "3.13.0" - "@lerna/symlink-binary" "3.14.2" - fs-extra "^7.0.0" + p-map "^2.1.0" + +"@lerna/symlink-binary@3.17.0": + version "3.17.0" + resolved "https://registry.yarnpkg.com/@lerna/symlink-binary/-/symlink-binary-3.17.0.tgz#8f8031b309863814883d3f009877f82e38aef45a" + integrity sha512-RLpy9UY6+3nT5J+5jkM5MZyMmjNHxZIZvXLV+Q3MXrf7Eaa1hNqyynyj4RO95fxbS+EZc4XVSk25DGFQbcRNSQ== + dependencies: + "@lerna/create-symlink" "3.16.2" + "@lerna/package" "3.16.0" + fs-extra "^8.1.0" + p-map "^2.1.0" + +"@lerna/symlink-dependencies@3.17.0": + version "3.17.0" + resolved "https://registry.yarnpkg.com/@lerna/symlink-dependencies/-/symlink-dependencies-3.17.0.tgz#48d6360e985865a0e56cd8b51b308a526308784a" + integrity sha512-KmjU5YT1bpt6coOmdFueTJ7DFJL4H1w5eF8yAQ2zsGNTtZ+i5SGFBWpb9AQaw168dydc3s4eu0W0Sirda+F59Q== + dependencies: + "@lerna/create-symlink" "3.16.2" + "@lerna/resolve-symlink" "3.16.0" + "@lerna/symlink-binary" "3.17.0" + fs-extra "^8.1.0" p-finally "^1.0.0" - p-map "^1.2.0" + p-map "^2.1.0" p-map-series "^1.0.0" "@lerna/timer@3.13.0": @@ -1605,35 +1655,37 @@ dependencies: npmlog "^4.1.2" -"@lerna/version@3.15.0": - version "3.15.0" - resolved "https://registry.yarnpkg.com/@lerna/version/-/version-3.15.0.tgz#3c65d223d94f211312995266abb07ee6606d5f73" - integrity sha512-vReYX1NMXZ9PwzTZm97wAl/k3bmRnRZhnQi3mq/m49xTnDavq7p4sbUdFpvu8cVZNKnYS02pNIVGHrQw+K8ZCw== - dependencies: - "@lerna/check-working-tree" "3.14.2" - "@lerna/child-process" "3.14.2" - "@lerna/collect-updates" "3.14.2" - "@lerna/command" "3.15.0" - "@lerna/conventional-commits" "3.14.0" - "@lerna/github-client" "3.14.2" +"@lerna/version@3.18.5": + version "3.18.5" + resolved "https://registry.yarnpkg.com/@lerna/version/-/version-3.18.5.tgz#0c4f0c2f8d23e9c95c2aa77ad9ce5c7ef025fac0" + integrity sha512-eSMxLIDuVxZIq0JZKNih50x1IZuMmViwF59uwOGMx0hHB84N3waE8HXOF9CJXDSjeP6sHB8tS+Y+X5fFpBop2Q== + dependencies: + "@lerna/check-working-tree" "3.16.5" + "@lerna/child-process" "3.16.5" + "@lerna/collect-updates" "3.18.0" + "@lerna/command" "3.18.5" + "@lerna/conventional-commits" "3.18.5" + "@lerna/github-client" "3.16.5" "@lerna/gitlab-client" "3.15.0" "@lerna/output" "3.13.0" - "@lerna/prerelease-id-from-version" "3.14.0" - "@lerna/prompt" "3.13.0" - "@lerna/run-lifecycle" "3.14.0" - "@lerna/run-topologically" "3.14.0" + "@lerna/prerelease-id-from-version" "3.16.0" + "@lerna/prompt" "3.18.5" + "@lerna/run-lifecycle" "3.16.2" + "@lerna/run-topologically" "3.18.5" "@lerna/validation-error" "3.13.0" chalk "^2.3.1" dedent "^0.7.0" + load-json-file "^5.3.0" minimatch "^3.0.4" npmlog "^4.1.2" - p-map "^1.2.0" + p-map "^2.1.0" p-pipe "^1.2.0" p-reduce "^1.0.0" p-waterfall "^1.0.0" - semver "^5.5.0" - slash "^1.0.0" + semver "^6.2.0" + slash "^2.0.0" temp-write "^3.4.0" + write-json-file "^3.2.0" "@lerna/write-log-file@3.13.0": version "3.13.0" @@ -1646,49 +1698,83 @@ "@mrmlnc/readdir-enhanced@^2.2.1": version "2.2.1" resolved "https://registry.yarnpkg.com/@mrmlnc/readdir-enhanced/-/readdir-enhanced-2.2.1.tgz#524af240d1a360527b730475ecfa1344aa540dde" + integrity sha512-bPHp6Ji8b41szTOcaP63VlnbbO5Ny6dwAATtY6JTjh5N2OLrb5Qk/Th5cRkRQhkWCt+EJsYrNB0MiL+Gpn6e3g== dependencies: call-me-maybe "^1.0.1" glob-to-regexp "^0.3.0" +"@nodelib/fs.scandir@2.1.3": + version "2.1.3" + resolved "https://registry.yarnpkg.com/@nodelib/fs.scandir/-/fs.scandir-2.1.3.tgz#3a582bdb53804c6ba6d146579c46e52130cf4a3b" + integrity sha512-eGmwYQn3gxo4r7jdQnkrrN6bY478C3P+a/y72IJukF8LjB6ZHeB3c+Ehacj3sYeSmUXGlnA67/PmbM9CVwL7Dw== + dependencies: + "@nodelib/fs.stat" "2.0.3" + run-parallel "^1.1.9" + +"@nodelib/fs.stat@2.0.3", "@nodelib/fs.stat@^2.0.2": + version "2.0.3" + resolved "https://registry.yarnpkg.com/@nodelib/fs.stat/-/fs.stat-2.0.3.tgz#34dc5f4cabbc720f4e60f75a747e7ecd6c175bd3" + integrity sha512-bQBFruR2TAwoevBEd/NWMoAAtNGzTRgdrqnYCc7dhzfoNvqPzLyqlEQnzZ3kVnNrSp25iyxE00/3h2fqGAGArA== + "@nodelib/fs.stat@^1.1.2": version "1.1.3" resolved "https://registry.yarnpkg.com/@nodelib/fs.stat/-/fs.stat-1.1.3.tgz#2b5a3ab3f918cca48a8c754c08168e3f03eba61b" + integrity sha512-shAmDyaQC4H92APFoIaVDHCx5bStIocgvbwQyxPRrbUY20V1EYTbSDchWbuwlMG3V17cprZhA6+78JfB+3DTPw== -"@octokit/endpoint@^5.1.0": - version "5.1.2" - resolved "https://registry.yarnpkg.com/@octokit/endpoint/-/endpoint-5.1.2.tgz#45fd879e33a25ee10fa4cffc4d098ee04135afe6" - integrity sha512-bBGGmcRFq1x0jrB29G/9KjYmO3cdHfk3476B2JOHRvLsNw1Pn3l+ZvbiqtcO9qAS4Ti+zFedLB84ziHZRZclQA== +"@nodelib/fs.walk@^1.2.3": + version "1.2.4" + resolved "https://registry.yarnpkg.com/@nodelib/fs.walk/-/fs.walk-1.2.4.tgz#011b9202a70a6366e436ca5c065844528ab04976" + integrity sha512-1V9XOY4rDW0rehzbrcqAmHnz8e7SKvX27gh8Gt2WgB0+pdzdiLV83p72kZPU+jvMbS1qU5mauP2iOvO8rhmurQ== + dependencies: + "@nodelib/fs.scandir" "2.1.3" + fastq "^1.6.0" + +"@octokit/endpoint@^5.5.0": + version "5.5.1" + resolved "https://registry.yarnpkg.com/@octokit/endpoint/-/endpoint-5.5.1.tgz#2eea81e110ca754ff2de11c79154ccab4ae16b3f" + integrity sha512-nBFhRUb5YzVTCX/iAK1MgQ4uWo89Gu0TH00qQHoYRCsE12dWcG1OiLd7v2EIo2+tpUKPMOQ62QFy9hy9Vg2ULg== dependencies: - deepmerge "3.2.0" + "@octokit/types" "^2.0.0" is-plain-object "^3.0.0" - universal-user-agent "^2.1.0" - url-template "^2.0.8" + universal-user-agent "^4.0.0" -"@octokit/plugin-enterprise-rest@^2.1.1": - version "2.2.2" - resolved "https://registry.yarnpkg.com/@octokit/plugin-enterprise-rest/-/plugin-enterprise-rest-2.2.2.tgz#c0e22067a043e19f96ff9c7832e2a3019f9be75c" - integrity sha512-CTZr64jZYhGWNTDGlSJ2mvIlFsm9OEO3LqWn9I/gmoHI4jRBp4kpHoFYNemG4oA75zUAcmbuWblb7jjP877YZw== +"@octokit/plugin-enterprise-rest@^3.6.1": + version "3.6.2" + resolved "https://registry.yarnpkg.com/@octokit/plugin-enterprise-rest/-/plugin-enterprise-rest-3.6.2.tgz#74de25bef21e0182b4fa03a8678cd00a4e67e561" + integrity sha512-3wF5eueS5OHQYuAEudkpN+xVeUsg8vYEMMenEzLphUZ7PRZ8OJtDcsreL3ad9zxXmBbaFWzLmFcdob5CLyZftA== -"@octokit/request@3.0.3": - version "3.0.3" - resolved "https://registry.yarnpkg.com/@octokit/request/-/request-3.0.3.tgz#ace63b5ea196cc00ad27f3fbe5c13a9698681ec8" - integrity sha512-M7pUfsiaiiUMEP4/SMysTeWxyGrkoQg6FBPEtCBIFgeDnzHaPboTpUZGTh6u1GQXdrlzMfPVn/vQs98js1QtwQ== +"@octokit/request-error@^1.0.1", "@octokit/request-error@^1.0.2": + version "1.2.0" + resolved "https://registry.yarnpkg.com/@octokit/request-error/-/request-error-1.2.0.tgz#a64d2a9d7a13555570cd79722de4a4d76371baaa" + integrity sha512-DNBhROBYjjV/I9n7A8kVkmQNkqFAMem90dSxqvPq57e2hBr7mNTX98y3R2zDpqMQHVRpBDjsvsfIGgBzy+4PAg== dependencies: - "@octokit/endpoint" "^5.1.0" - deprecation "^1.0.1" + "@octokit/types" "^2.0.0" + deprecation "^2.0.0" + once "^1.4.0" + +"@octokit/request@^5.2.0": + version "5.3.1" + resolved "https://registry.yarnpkg.com/@octokit/request/-/request-5.3.1.tgz#3a1ace45e6f88b1be4749c5da963b3a3b4a2f120" + integrity sha512-5/X0AL1ZgoU32fAepTfEoggFinO3rxsMLtzhlUX+RctLrusn/CApJuGFCd0v7GMFhF+8UiCsTTfsu7Fh1HnEJg== + dependencies: + "@octokit/endpoint" "^5.5.0" + "@octokit/request-error" "^1.0.1" + "@octokit/types" "^2.0.0" + deprecation "^2.0.0" is-plain-object "^3.0.0" node-fetch "^2.3.0" once "^1.4.0" - universal-user-agent "^2.0.1" + universal-user-agent "^4.0.0" -"@octokit/rest@^16.16.0": - version "16.25.5" - resolved "https://registry.yarnpkg.com/@octokit/rest/-/rest-16.25.5.tgz#9268afad252f72a1e39553cf87e1aa0493e355de" - integrity sha512-xemNMkhjSBPnPR7gzGNDelRJvAOu1T9oVABUADyQ2gE9E788qgVOr/xnBPusVLlYfhX7FhGhvGiVrgho/D4pfw== +"@octokit/rest@^16.28.4": + version "16.35.0" + resolved "https://registry.yarnpkg.com/@octokit/rest/-/rest-16.35.0.tgz#7ccc1f802f407d5b8eb21768c6deca44e7b4c0d8" + integrity sha512-9ShFqYWo0CLoGYhA1FdtdykJuMzS/9H6vSbbQWDX4pWr4p9v+15MsH/wpd/3fIU+tSxylaNO48+PIHqOkBRx3w== dependencies: - "@octokit/request" "3.0.3" + "@octokit/request" "^5.2.0" + "@octokit/request-error" "^1.0.2" atob-lite "^2.0.0" - before-after-hook "^1.4.0" + before-after-hook "^2.0.0" btoa-lite "^1.0.0" deprecation "^2.0.0" lodash.get "^4.4.2" @@ -1696,25 +1782,40 @@ lodash.uniq "^4.5.0" octokit-pagination-methods "^1.1.0" once "^1.4.0" - universal-user-agent "^2.0.0" - url-template "^2.0.8" + universal-user-agent "^4.0.0" + +"@octokit/types@^2.0.0": + version "2.0.2" + resolved "https://registry.yarnpkg.com/@octokit/types/-/types-2.0.2.tgz#0888497f5a664e28b0449731d5e88e19b2a74f90" + integrity sha512-StASIL2lgT3TRjxv17z9pAqbnI7HGu9DrJlg3sEBFfCLaMEqp+O3IQPUF6EZtQ4xkAu2ml6kMBBCtGxjvmtmuQ== + dependencies: + "@types/node" ">= 8" + +"@rollup/plugin-alias@^2.2.0": + version "2.2.0" + resolved "https://registry.yarnpkg.com/@rollup/plugin-alias/-/plugin-alias-2.2.0.tgz#3ac52ece8b39583249884adb90fb316484389fe5" + integrity sha512-//6zmlHGbmousaatu4pBlC61gqZykLbH0c2GESBO4JgK5xFZgb/ih0zlg/5/BmTAczX5R/xsHRnsYsu4KyHV5w== + dependencies: + slash "^3.0.0" + +"@rollup/plugin-json@^4.0.0": + version "4.0.0" + resolved "https://registry.yarnpkg.com/@rollup/plugin-json/-/plugin-json-4.0.0.tgz#4462e83c7ad5544bef4a601a6e8450daedc4b69b" + integrity sha512-Z65CtEVWv40+ri4CvmswyhtuUtki9yP5p0UJN/GyCKKyU4jRuDS9CG0ZuV7/XuS7zGkoajyE7E4XBEaC4GW62A== + dependencies: + rollup-pluginutils "^2.5.0" "@samverschueren/stream-to-observable@^0.3.0": version "0.3.0" resolved "https://registry.yarnpkg.com/@samverschueren/stream-to-observable/-/stream-to-observable-0.3.0.tgz#ecdf48d532c58ea477acfcab80348424f8d0662f" + integrity sha512-MI4Xx6LHs4Webyvi6EbspgyAb4D2Q2VtnCQ1blOJcoLS6mVa8lNN2rkIy1CVxfTUpoyIbCTkXES1rLXztFD1lg== dependencies: any-observable "^0.3.0" -"@types/acorn@^4.0.2": - version "4.0.3" - resolved "https://registry.yarnpkg.com/@types/acorn/-/acorn-4.0.3.tgz#d1f3e738dde52536f9aad3d3380d14e448820afd" - dependencies: - "@types/estree" "*" - "@types/babel__core@^7.1.0": - version "7.1.0" - resolved "https://registry.yarnpkg.com/@types/babel__core/-/babel__core-7.1.0.tgz#710f2487dda4dcfd010ca6abb2b4dc7394365c51" - integrity sha512-wJTeJRt7BToFx3USrCDs2BhEi4ijBInTQjOIukj6a/5tEkwpFMVZ+1ppgmE+Q/FQyc5P/VWUbx7I9NELrKruHA== + version "7.1.3" + resolved "https://registry.yarnpkg.com/@types/babel__core/-/babel__core-7.1.3.tgz#e441ea7df63cd080dfcd02ab199e6d16a735fc30" + integrity sha512-8fBo0UR2CcwWxeX7WIIgJ7lXjasFxoYgRnFHUj+hRvKkpiBJbxhdAPTCY6/ZKM0uxANFVzt4yObSLuTiTnazDA== dependencies: "@babel/parser" "^7.1.0" "@babel/types" "^7.0.0" @@ -1723,9 +1824,9 @@ "@types/babel__traverse" "*" "@types/babel__generator@*": - version "7.0.2" - resolved "https://registry.yarnpkg.com/@types/babel__generator/-/babel__generator-7.0.2.tgz#d2112a6b21fad600d7674274293c85dce0cb47fc" - integrity sha512-NHcOfab3Zw4q5sEE2COkpfXjoE7o+PmqD9DQW4koUT3roNxwziUdXGnRndMat/LJNUtePwn1TlP4do3uoe3KZQ== + version "7.6.0" + resolved "https://registry.yarnpkg.com/@types/babel__generator/-/babel__generator-7.6.0.tgz#f1ec1c104d1bb463556ecb724018ab788d0c172a" + integrity sha512-c1mZUu4up5cp9KROs/QAw0gTeHrw/x7m52LcnvMxxOZ03DmLwPV0MlGmlgzV3cnSdjhJOZsj7E7FHeioai+egw== dependencies: "@babel/types" "^7.0.0" @@ -1738,39 +1839,35 @@ "@babel/types" "^7.0.0" "@types/babel__traverse@*", "@types/babel__traverse@^7.0.6": - version "7.0.6" - resolved "https://registry.yarnpkg.com/@types/babel__traverse/-/babel__traverse-7.0.6.tgz#328dd1a8fc4cfe3c8458be9477b219ea158fd7b2" - integrity sha512-XYVgHF2sQ0YblLRMLNPB3CkFMewzFmlDsH/TneZFHUXDlABQgh88uOxuez7ZcXxayLFrqLwtDH1t+FmlFwNZxw== + version "7.0.8" + resolved "https://registry.yarnpkg.com/@types/babel__traverse/-/babel__traverse-7.0.8.tgz#479a4ee3e291a403a1096106013ec22cf9b64012" + integrity sha512-yGeB2dHEdvxjP0y4UbRtQaSkXJ9649fYCmIdRoul5kfAoGCwxuCbMhag0k3RPfnuh9kPGm8x89btcfDEXdVWGw== dependencies: "@babel/types" "^7.3.0" -"@types/cheerio@^0.22.1": - version "0.22.7" - resolved "https://registry.yarnpkg.com/@types/cheerio/-/cheerio-0.22.7.tgz#4a92eafedfb2b9f4437d3a4410006d81114c66ce" - -"@types/debug@^0.0.29": - version "0.0.29" - resolved "https://registry.yarnpkg.com/@types/debug/-/debug-0.0.29.tgz#a1e514adfbd92f03a224ba54d693111dbf1f3754" - -"@types/enhanced-resolve@^3.0.3": - version "3.0.4" - resolved "https://registry.yarnpkg.com/@types/enhanced-resolve/-/enhanced-resolve-3.0.4.tgz#d93cb91b0b14dbcba0f45948bed73db9456697c2" - dependencies: - "@types/node" "*" - "@types/tapable" "*" - -"@types/escape-string-regexp@^0.0.30": - version "0.0.30" - resolved "https://registry.yarnpkg.com/@types/escape-string-regexp/-/escape-string-regexp-0.0.30.tgz#8cfaf0b5d2e46943d6efd77d3f4d18bfa1c9f225" +"@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@*", "@types/estree@0.0.39": +"@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/estree@0.0.35": - version "0.0.35" - resolved "https://registry.yarnpkg.com/@types/estree/-/estree-0.0.35.tgz#8999974b34028686a8d61a719e61c138d3755107" +"@types/events@*": + version "3.0.0" + resolved "https://registry.yarnpkg.com/@types/events/-/events-3.0.0.tgz#2862f3f58a9a7f7c3e78d79f130dd4d71c25c2a7" + integrity sha512-EaObqwIvayI5a8dCzhFrjKzVwKLxjoG9T6Ppd5CEo07LRKfQ8Yokw54r5+Wq7FaBQ+yXRvQAYPrHwya1/UFt9g== + +"@types/glob@^7.1.1": + version "7.1.1" + resolved "https://registry.yarnpkg.com/@types/glob/-/glob-7.1.1.tgz#aa59a1c6e3fbc421e07ccd31a944c30eba521575" + integrity sha512-1Bh06cbWJUHMC97acuD6UMG29nMt0Aqz1vF3guLfG+kHHJhy3AyohZFFxYk2f7Q1SQIrNwvncxAE0N/9s70F2w== + dependencies: + "@types/events" "*" + "@types/minimatch" "*" + "@types/node" "*" "@types/istanbul-lib-coverage@*", "@types/istanbul-lib-coverage@^2.0.0": version "2.0.1" @@ -1792,18 +1889,15 @@ "@types/istanbul-lib-coverage" "*" "@types/istanbul-lib-report" "*" -"@types/lodash@^4.14.67": - version "4.14.104" - resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.14.104.tgz#53ee2357fa2e6e68379341d92eb2ecea4b11bb80" - -"@types/node@*", "@types/node@^12.0.2": - version "12.0.2" - resolved "https://registry.yarnpkg.com/@types/node/-/node-12.0.2.tgz#3452a24edf9fea138b48fad4a0a028a683da1e40" - integrity sha512-5tabW/i+9mhrfEOUcLDu2xBPsHJ+X5Orqy9FKpale3SjDA17j5AEpYq5vfy3oAeAHGcvANRCO3NV3d2D6q3NiA== +"@types/minimatch@*": + version "3.0.3" + resolved "https://registry.yarnpkg.com/@types/minimatch/-/minimatch-3.0.3.tgz#3dca0e3f33b200fc7d1139c0cd96c1268cadfd9d" + integrity sha512-tHq6qdbT9U1IRSGf14CL0pUlULksvY9OZ+5eEgl1N7t+OA3tGvNpxJCzuKQlsNgCVwbAs670L1vcVQi8j9HjnA== -"@types/node@^8.0.0": - version "8.9.4" - resolved "https://registry.yarnpkg.com/@types/node/-/node-8.9.4.tgz#dfd327582a06c114eb6e0441fa3d6fab35edad48" +"@types/node@*", "@types/node@>= 8": + version "12.12.15" + resolved "https://registry.yarnpkg.com/@types/node/-/node-12.12.15.tgz#8dfb6ce22fedd469128137640a3aa8f17415422f" + integrity sha512-Pv+vWicyFd07Hw/SmNnTUguqrHgDfMtjabvD9sQyxeqbpCEg8CmViLBaVPHtNsoBgZECrRf5/pgV6FJIBrGSjw== "@types/normalize-package-data@^2.4.0": version "2.4.0" @@ -1817,147 +1911,164 @@ dependencies: "@types/node" "*" -"@types/semver@^5.3.32": - version "5.5.0" - resolved "https://registry.yarnpkg.com/@types/semver/-/semver-5.5.0.tgz#146c2a29ee7d3bae4bf2fcb274636e264c813c45" - "@types/stack-utils@^1.0.1": version "1.0.1" resolved "https://registry.yarnpkg.com/@types/stack-utils/-/stack-utils-1.0.1.tgz#0a851d3bd96498fa25c33ab7278ed3bd65f06c3e" integrity sha512-l42BggppR6zLmpfU6fq9HEa2oGPEI8yrSPL3GITjfRInppYFahObbIQOQK3UGxEnyQpltZLaPe75046NOZQikw== -"@types/tapable@*": - version "0.2.4" - resolved "https://registry.yarnpkg.com/@types/tapable/-/tapable-0.2.4.tgz#8181a228da46185439300e600c5ae3b3b3982585" +"@types/yargs-parser@*": + version "13.1.0" + resolved "https://registry.yarnpkg.com/@types/yargs-parser/-/yargs-parser-13.1.0.tgz#c563aa192f39350a1d18da36c5a8da382bbd8228" + integrity sha512-gCubfBUZ6KxzoibJ+SCUc/57Ms1jz5NjHe4+dI2krNmU5zCPAphyLJYyTOg06ueIyfj+SaCUqmzun7ImlxDcKg== -"@types/uglify-js@*": - version "2.6.30" - resolved "https://registry.yarnpkg.com/@types/uglify-js/-/uglify-js-2.6.30.tgz#257d2b6dd86673d60da476680fba90f2e30c6eef" +"@types/yargs@^13.0.0": + version "13.0.3" + resolved "https://registry.yarnpkg.com/@types/yargs/-/yargs-13.0.3.tgz#76482af3981d4412d65371a318f992d33464a380" + integrity sha512-K8/LfZq2duW33XW/tFwEAfnZlqIfVsoyRB3kfXdPXYhl0nfM8mmh7GS0jg7WrX2Dgq/0Ha/pR1PaR+BvmWwjiQ== dependencies: - source-map "^0.6.1" + "@types/yargs-parser" "*" -"@types/webpack@^3.0.0": - version "3.8.8" - resolved "https://registry.yarnpkg.com/@types/webpack/-/webpack-3.8.8.tgz#fd9483edf2d6935eaab52aa530b1f737c188cd9a" +"@zkochan/cmd-shim@^3.1.0": + version "3.1.0" + resolved "https://registry.yarnpkg.com/@zkochan/cmd-shim/-/cmd-shim-3.1.0.tgz#2ab8ed81f5bb5452a85f25758eb9b8681982fd2e" + integrity sha512-o8l0+x7C7sMZU3v9GuJIAU10qQLtwR1dtRQIOmlNMtyaqhmpXOzx1HWiYoWfmmf9HHZoAkXpc9TM9PQYF9d4Jg== dependencies: - "@types/node" "*" - "@types/tapable" "*" - "@types/uglify-js" "*" - source-map "^0.6.0" - -"@types/yargs@^12.0.2", "@types/yargs@^12.0.9": - version "12.0.9" - resolved "https://registry.yarnpkg.com/@types/yargs/-/yargs-12.0.9.tgz#693e76a52f61a2f1e7fb48c0eef167b95ea4ffd0" - integrity sha512-sCZy4SxP9rN2w30Hlmg5dtdRwgYQfYRiLo9usw8X9cxlf+H4FqM1xX7+sNH7NNKVdbXMJWqva7iyy+fxh/V7fA== + is-windows "^1.0.0" + mkdirp-promise "^5.0.1" + mz "^2.5.0" JSONStream@^1.0.3, JSONStream@^1.0.4, JSONStream@^1.3.4: version "1.3.5" resolved "https://registry.yarnpkg.com/JSONStream/-/JSONStream-1.3.5.tgz#3208c1f08d3a4d99261ab64f92302bc15e111ca0" + integrity sha512-E+iruNOY8VV9s4JEbe1aNEm6MiszPRr/UfcHMz0TQh1BXSxHK+ASV1R6W4HpjBhSeS+54PIsAMCBmwD06LLsqQ== dependencies: jsonparse "^1.2.0" through ">=2.2.7 <3" -abab@^1.0.4: - version "1.0.4" - resolved "https://registry.yarnpkg.com/abab/-/abab-1.0.4.tgz#5faad9c2c07f60dd76770f71cf025b62a63cfd4e" +abab@^2.0.0: + version "2.0.3" + resolved "https://registry.yarnpkg.com/abab/-/abab-2.0.3.tgz#623e2075e02eb2d3f2475e49f99c91846467907a" + integrity sha512-tsFzPpcttalNjFBCFMqsKYQcWxxen1pgJR56by//QwvJc4/OUS3kPOOttx2tSIfjsylB0pYu7f5D3K1RCxUnUg== abbrev@1: version "1.1.1" resolved "https://registry.yarnpkg.com/abbrev/-/abbrev-1.1.1.tgz#f8f2c887ad10bf67f634f005b6987fed3179aac8" + integrity sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q== -acorn-dynamic-import@^2.0.0: - version "2.0.2" - resolved "https://registry.yarnpkg.com/acorn-dynamic-import/-/acorn-dynamic-import-2.0.2.tgz#c752bd210bef679501b6c6cb7fc84f8f47158cc4" +abstract-leveldown@~0.12.0, abstract-leveldown@~0.12.1: + version "0.12.4" + resolved "https://registry.yarnpkg.com/abstract-leveldown/-/abstract-leveldown-0.12.4.tgz#29e18e632e60e4e221d5810247852a63d7b2e410" + integrity sha1-KeGOYy5g5OIh1YECR4UqY9ey5BA= dependencies: - acorn "^4.0.3" - -acorn-dynamic-import@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/acorn-dynamic-import/-/acorn-dynamic-import-4.0.0.tgz#482210140582a36b83c3e342e1cfebcaa9240948" + xtend "~3.0.0" acorn-globals@^4.1.0: - version "4.1.0" - resolved "https://registry.yarnpkg.com/acorn-globals/-/acorn-globals-4.1.0.tgz#ab716025dbe17c54d3ef81d32ece2b2d99fe2538" + version "4.3.4" + resolved "https://registry.yarnpkg.com/acorn-globals/-/acorn-globals-4.3.4.tgz#9fa1926addc11c97308c4e66d7add0d40c3272e7" + integrity sha512-clfQEh21R+D0leSbUdWf3OcfqyaCSAQ8Ryq00bofSekfr9W8u1jyYZo6ir0xu9Gtcf7BjcHJpnbZH7JOCpP60A== dependencies: - acorn "^5.0.0" + acorn "^6.0.1" + acorn-walk "^6.0.1" -acorn-jsx@^5.0.0: - version "5.0.1" - resolved "https://registry.yarnpkg.com/acorn-jsx/-/acorn-jsx-5.0.1.tgz#32a064fd925429216a09b141102bfdd185fae40e" +acorn-jsx@^5.1.0: + version "5.1.0" + resolved "https://registry.yarnpkg.com/acorn-jsx/-/acorn-jsx-5.1.0.tgz#294adb71b57398b0680015f0a38c563ee1db5384" + integrity sha512-tMUqwBWfLFbJbizRmEcWSLw6HnFzfdJs2sOJEOwwtVPMoH/0Ay+E703oZz78VSXZiiDcZrQ5XKjPIUQixhmgVw== -acorn-node@^1.2.0, acorn-node@^1.3.0: - version "1.6.2" - resolved "https://registry.yarnpkg.com/acorn-node/-/acorn-node-1.6.2.tgz#b7d7ceca6f22e6417af933a62cad4de01048d5d2" +acorn-node@^1.2.0, acorn-node@^1.3.0, acorn-node@^1.5.2, acorn-node@^1.6.1: + version "1.8.2" + resolved "https://registry.yarnpkg.com/acorn-node/-/acorn-node-1.8.2.tgz#114c95d64539e53dede23de8b9d96df7c7ae2af8" + integrity sha512-8mt+fslDufLYntIoPAaIMUe/lrbrehIiwmR3t2k9LljIzoigEPF27eLk2hy8zSGzmR/ogr7zbRKINMo1u0yh5A== dependencies: - acorn "^6.0.2" - acorn-dynamic-import "^4.0.0" - acorn-walk "^6.1.0" - xtend "^4.0.1" + acorn "^7.0.0" + acorn-walk "^7.0.0" + xtend "^4.0.2" -acorn-walk@^6.1.0: - version "6.1.1" - resolved "https://registry.yarnpkg.com/acorn-walk/-/acorn-walk-6.1.1.tgz#d363b66f5fac5f018ff9c3a1e7b6f8e310cc3913" +acorn-walk@^6.0.1: + version "6.2.0" + resolved "https://registry.yarnpkg.com/acorn-walk/-/acorn-walk-6.2.0.tgz#123cb8f3b84c2171f1f7fb252615b1c78a6b1a8c" + integrity sha512-7evsyfH1cLOCdAzZAd43Cic04yKydNx0cF+7tiA19p1XnLLPU4dpCQOqpjqwokFe//vS0QqfqqjCS2JkiIs0cA== + +acorn-walk@^7.0.0: + version "7.0.0" + resolved "https://registry.yarnpkg.com/acorn-walk/-/acorn-walk-7.0.0.tgz#c8ba6f0f1aac4b0a9e32d1f0af12be769528f36b" + integrity sha512-7Bv1We7ZGuU79zZbb6rRqcpxo3OY+zrdtloZWoyD8fmGX+FeXRjE+iuGkZjSXLVovLzrsvMGMy0EkwA0E0umxg== acorn@^4.0.3: version "4.0.13" resolved "https://registry.yarnpkg.com/acorn/-/acorn-4.0.13.tgz#105495ae5361d697bd195c825192e1ad7f253787" + integrity sha1-EFSVrlNh1pe9GVyCUZLhrX8lN4c= -acorn@^5.0.0, acorn@^5.0.3, acorn@^5.3.0: - version "5.5.0" - resolved "https://registry.yarnpkg.com/acorn/-/acorn-5.5.0.tgz#1abb587fbf051f94e3de20e6b26ef910b1828298" +acorn@^5.0.0, acorn@^5.5.3, acorn@^5.7.3: + version "5.7.3" + resolved "https://registry.yarnpkg.com/acorn/-/acorn-5.7.3.tgz#67aa231bf8812974b85235a96771eb6bd07ea279" + integrity sha512-T/zvzYRfbVojPWahDsE5evJdHb3oJoQfFbsrKM7w5Zcs++Tr257tia3BmMP8XYVjp1S9RZXQMh7gao96BlqZOw== -acorn@^6.0.2, acorn@^6.0.7, acorn@^6.1.1: - version "6.1.1" - resolved "https://registry.yarnpkg.com/acorn/-/acorn-6.1.1.tgz#7d25ae05bb8ad1f9b699108e1094ecd7884adc1f" - integrity sha512-jPTiwtOxaHNaAPg/dmrJ/beuzLRnXtB0kQPQ8JpotKJgTB6rX6c8mlf315941pyjBSaPg8NHXS9fhP4u17DpGA== +acorn@^6.0.1: + version "6.4.0" + resolved "https://registry.yarnpkg.com/acorn/-/acorn-6.4.0.tgz#b659d2ffbafa24baf5db1cdbb2c94a983ecd2784" + integrity sha512-gac8OEcQ2Li1dxIEWGZzsp2BitJxwkwcOm0zHAJLcPJaVvm58FRnk6RkuLRpU1EujipU2ZFODv2P9DLMfnV8mw== -agent-base@4, agent-base@^4.1.0, agent-base@~4.2.0: - version "4.2.1" - resolved "https://registry.yarnpkg.com/agent-base/-/agent-base-4.2.1.tgz#d89e5999f797875674c07d87f260fc41e83e8ca9" - dependencies: +acorn@^7.0.0, 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== + +agent-base@4, agent-base@^4.3.0: + version "4.3.0" + resolved "https://registry.yarnpkg.com/agent-base/-/agent-base-4.3.0.tgz#8165f01c436009bccad0b1d122f05ed770efc6ee" + integrity sha512-salcGninV0nPrwpGNn4VTXBb1SOuXQBiqbrNXoeizJsHrsL6ERFM2Ne3JUSBWRE6aeNJI2ROP/WEEIDUiDe3cg== + dependencies: + es6-promisify "^5.0.0" + +agent-base@~4.2.1: + version "4.2.1" + resolved "https://registry.yarnpkg.com/agent-base/-/agent-base-4.2.1.tgz#d89e5999f797875674c07d87f260fc41e83e8ca9" + integrity sha512-JVwXMr9nHYTUXsBFKUqhJwvlcYU/blreOEUkhNR2eXZIvwd+c+o5V4MgDPKWnMS/56awN3TRzIP+KoPn+roQtg== + dependencies: es6-promisify "^5.0.0" agentkeepalive@^3.4.1: version "3.5.2" resolved "https://registry.yarnpkg.com/agentkeepalive/-/agentkeepalive-3.5.2.tgz#a113924dd3fa24a0bc3b78108c450c2abee00f67" + integrity sha512-e0L/HNe6qkQ7H19kTlRRqUibEAwDK5AFk6y3PtMsuut2VAH6+Q4xZml1tNDJD7kSAyqmbG/K08K5WEJYtUrSlQ== dependencies: humanize-ms "^1.2.1" -ajv-keywords@^3.1.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/ajv-keywords/-/ajv-keywords-3.1.0.tgz#ac2b27939c543e95d2c06e7f7f5c27be4aa543be" +aggregate-error@^3.0.0: + version "3.0.1" + resolved "https://registry.yarnpkg.com/aggregate-error/-/aggregate-error-3.0.1.tgz#db2fe7246e536f40d9b5442a39e117d7dd6a24e0" + integrity sha512-quoaXsZ9/BLNae5yiNoUz+Nhkwz83GhWwtYFglcjEQB2NDHCIpApbqXxIFnm4Pq/Nvhrsq5sYJFyohrrxnTGAA== + dependencies: + clean-stack "^2.0.0" + indent-string "^4.0.0" -ajv@^6.1.0, ajv@^6.5.5, ajv@^6.9.1: - version "6.9.2" - resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.9.2.tgz#4927adb83e7f48e5a32b45729744c71ec39c9c7b" - integrity sha512-4UFy0/LgDo7Oa/+wOAlj44tp9K78u38E5/359eSrqEp1Z5PdVfimCcs7SluXMP755RUQu6d2b4AvF0R1C9RZjg== +ajv@^6.10.0, ajv@^6.10.2, ajv@^6.5.5: + version "6.10.2" + resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.10.2.tgz#d3cea04d6b017b2894ad69040fec8b623eb4bd52" + integrity sha512-TXtUUEYHuaTEbLZWIKUr5pmBuhDLy+8KYtPYdcV8qC+pOZL+NKqYwvWSRrVXHn+ZmRRAu8vJTAznH7Oag6RVRw== dependencies: fast-deep-equal "^2.0.1" fast-json-stable-stringify "^2.0.0" json-schema-traverse "^0.4.1" uri-js "^4.2.2" -align-text@^0.1.1, align-text@^0.1.3: - version "0.1.4" - resolved "https://registry.yarnpkg.com/align-text/-/align-text-0.1.4.tgz#0cd90a561093f35d0a99256c22b7069433fad117" - dependencies: - kind-of "^3.0.2" - longest "^1.0.1" - repeat-string "^1.5.2" - amdefine@>=0.0.4: version "1.0.1" resolved "https://registry.yarnpkg.com/amdefine/-/amdefine-1.0.1.tgz#4a5282ac164729e93619bcfd3ad151f817ce91f5" + integrity sha1-SlKCrBZHKek2Gbz9OtFR+BfOkfU= ansi-colors@1.1.0, ansi-colors@^1.0.1: version "1.1.0" resolved "https://registry.yarnpkg.com/ansi-colors/-/ansi-colors-1.1.0.tgz#6374b4dd5d4718ff3ce27a671a3b1cad077132a9" + integrity sha512-SFKX67auSNoVR38N3L+nvsPjOE0bybKTYbkf5tRvushrAPQ9V75huw0ZxBkKVeRU9kqH3d6HA4xTckbwZ4ixmA== dependencies: ansi-wrap "^0.1.0" ansi-cyan@^0.1.1: version "0.1.1" resolved "https://registry.yarnpkg.com/ansi-cyan/-/ansi-cyan-0.1.1.tgz#538ae528af8982f28ae30d86f2f17456d2609873" + integrity sha1-U4rlKK+JgvKK4w2G8vF0VtJgmHM= dependencies: ansi-wrap "0.1.0" @@ -1966,51 +2077,78 @@ ansi-escapes@^3.0.0, ansi-escapes@^3.2.0: resolved "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-3.2.0.tgz#8780b98ff9dbf5638152d1f1fe5c1d7b4442976b" integrity sha512-cBhpre4ma+U0T1oM5fXg7Dy1Jw7zzwv7lt/GoCpr+hDQJoYnKVPLL4dCvSEFMmQurOQvSrwT7SL/DAlhBI97RQ== +ansi-escapes@^4.2.1: + version "4.3.0" + resolved "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-4.3.0.tgz#a4ce2b33d6b214b7950d8595c212f12ac9cc569d" + integrity sha512-EiYhwo0v255HUL6eDyuLrXEkTi7WwVCLAw+SeOQ7M7qdun1z1pum4DEm/nuqIVbPvi9RPPc9k9LbyBv6H0DwVg== + dependencies: + type-fest "^0.8.1" + ansi-gray@^0.1.1: version "0.1.1" resolved "https://registry.yarnpkg.com/ansi-gray/-/ansi-gray-0.1.1.tgz#2962cf54ec9792c48510a3deb524436861ef7251" + integrity sha1-KWLPVOyXksSFEKPetSRDaGHvclE= dependencies: ansi-wrap "0.1.0" ansi-red@^0.1.1: version "0.1.1" resolved "https://registry.yarnpkg.com/ansi-red/-/ansi-red-0.1.1.tgz#8c638f9d1080800a353c9c28c8a81ca4705d946c" + integrity sha1-jGOPnRCAgAo1PJwoyKgcpHBdlGw= dependencies: ansi-wrap "0.1.0" ansi-regex@^2.0.0: version "2.1.1" resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-2.1.1.tgz#c3b33ab5ee360d86e0e628f0468ae7ef27d654df" + integrity sha1-w7M6te42DYbg5ijwRorn7yfWVN8= ansi-regex@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-3.0.0.tgz#ed0317c322064f79466c02966bddb605ab37d998" + integrity sha1-7QMXwyIGT3lGbAKWa922Bas32Zg= -ansi-regex@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-4.0.0.tgz#70de791edf021404c3fd615aa89118ae0432e5a9" +ansi-regex@^4.0.0, ansi-regex@^4.1.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-4.1.0.tgz#8b9f8f08cf1acb843756a839ca8c7e3168c51997" + integrity sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg== + +ansi-regex@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-5.0.0.tgz#388539f55179bf39339c81af30a654d69f87cb75" + integrity sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg== ansi-styles@^2.2.1: version "2.2.1" resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-2.2.1.tgz#b432dd3358b634cf75e1e4664368240533c1ddbe" + integrity sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4= ansi-styles@^3.2.0, ansi-styles@^3.2.1: version "3.2.1" resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-3.2.1.tgz#41fbb20243e50b12be0f04b8dedbf07520ce841d" + integrity sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA== dependencies: color-convert "^1.9.0" ansi-wrap@0.1.0, ansi-wrap@^0.1.0: version "0.1.0" resolved "https://registry.yarnpkg.com/ansi-wrap/-/ansi-wrap-0.1.0.tgz#a82250ddb0015e9a27ca82e82ea603bbfa45efaf" + integrity sha1-qCJQ3bABXponyoLoLqYDu/pF768= any-observable@^0.3.0: version "0.3.0" resolved "https://registry.yarnpkg.com/any-observable/-/any-observable-0.3.0.tgz#af933475e5806a67d0d7df090dd5e8bef65d119b" + integrity sha512-/FQM1EDkTsf63Ub2C6O7GuYFDsSXUwsaZDurV0np41ocwq0jthUAYCmhBX9f+KwlaCgIuWyr/4WlUQUBfKfZog== + +any-promise@^1.0.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/any-promise/-/any-promise-1.3.0.tgz#abc6afeedcea52e809cdc0376aed3ce39635d17f" + integrity sha1-q8av7tzqUugJzcA3au0845Y10X8= anymatch@^1.3.0: version "1.3.2" resolved "https://registry.yarnpkg.com/anymatch/-/anymatch-1.3.2.tgz#553dcb8f91e3c889845dfdba34c77721b90b9d7a" + integrity sha512-0XNayC8lTHQ2OI8aljNCN3sSx6hsr/1+rlcDAotXJR7C1oZZHCNsfpbKwMjRA3Uqb5tF1Rae2oloTr4xpq+WjA== dependencies: micromatch "^2.1.5" normalize-path "^2.0.0" @@ -2018,6 +2156,7 @@ anymatch@^1.3.0: anymatch@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/anymatch/-/anymatch-2.0.0.tgz#bcb24b4f37934d9aa7ac17b4adaf89e7c76ef2eb" + integrity sha512-5teOsQWABXHHBFP9y3skS5P3d/WfWXpv3FUpy+LorMrNYaT9pI4oLMQX7jzQ2KklNpGpWHzdCXTDT2Y3XGlZBw== dependencies: micromatch "^3.1.4" normalize-path "^2.1.1" @@ -2025,24 +2164,29 @@ anymatch@^2.0.0: append-buffer@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/append-buffer/-/append-buffer-1.0.2.tgz#d8220cf466081525efea50614f3de6514dfa58f1" + integrity sha1-2CIM9GYIFSXv6lBhTz3mUU36WPE= dependencies: buffer-equal "^1.0.0" aproba@^1.0.3, aproba@^1.1.1: version "1.2.0" resolved "https://registry.yarnpkg.com/aproba/-/aproba-1.2.0.tgz#6802e6264efd18c790a1b0d517f0f2627bf2c94a" + integrity sha512-Y9J6ZjXtoYh8RnXVCMOU/ttDmk1aBjunq9vO0ta5x85WDQiQfUF9sIPBITdbiiIVcBo03Hi3jMxigBtsddlXRw== aproba@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/aproba/-/aproba-2.0.0.tgz#52520b8ae5b569215b354efc0caa3fe1e45a8adc" + integrity sha512-lYe4Gx7QT+MKGbDsA+Z+he/Wtef0BiwDOlK/XkBrdfsh9J/jPPXbX0tE9x9cl27Tmu5gg3QUbUrQYa/y+KOHPQ== archy@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/archy/-/archy-1.0.0.tgz#f9c8c13757cc1dd7bc379ac77b2c62a5c2868c40" + integrity sha1-+cjBN1fMHde8N5rHeyxipcKGjEA= are-we-there-yet@~1.1.2: - version "1.1.4" - resolved "https://registry.yarnpkg.com/are-we-there-yet/-/are-we-there-yet-1.1.4.tgz#bb5dca382bb94f05e15194373d16fd3ba1ca110d" + version "1.1.5" + resolved "https://registry.yarnpkg.com/are-we-there-yet/-/are-we-there-yet-1.1.5.tgz#4b35c2944f062a8bfcda66410760350fe9ddfc21" + integrity sha512-5hYdAkZlcG8tOLujVDTgCT+uPX0VnpAH28gWsLfzpXYm7wP6mp5Q/gYyR7YQ0cKVJcXJnl3j2kpBan13PtQf6w== dependencies: delegates "^1.0.0" readable-stream "^2.0.6" @@ -2050,12 +2194,14 @@ are-we-there-yet@~1.1.2: argparse@^1.0.7: version "1.0.10" resolved "https://registry.yarnpkg.com/argparse/-/argparse-1.0.10.tgz#bcd6791ea5ae09725e17e5ad988134cd40b3d911" + integrity sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg== dependencies: sprintf-js "~1.0.2" arr-diff@^1.0.1: version "1.1.0" resolved "https://registry.yarnpkg.com/arr-diff/-/arr-diff-1.1.0.tgz#687c32758163588fef7de7b36fabe495eb1a399a" + integrity sha1-aHwydYFjWI/vfeezb6vklesaOZo= dependencies: arr-flatten "^1.0.1" array-slice "^0.2.3" @@ -2063,60 +2209,73 @@ arr-diff@^1.0.1: 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" + integrity sha1-1kYQdP6/7HHn4VI1dhoyml3HxSA= arr-filter@^1.1.1: version "1.1.2" resolved "https://registry.yarnpkg.com/arr-filter/-/arr-filter-1.1.2.tgz#43fdddd091e8ef11aa4c45d9cdc18e2dff1711ee" + integrity sha1-Q/3d0JHo7xGqTEXZzcGOLf8XEe4= dependencies: make-iterator "^1.0.0" arr-flatten@^1.0.1, arr-flatten@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/arr-flatten/-/arr-flatten-1.1.0.tgz#36048bbff4e7b47e136644316c99669ea5ae91f1" + integrity sha512-L3hKV5R/p5o81R7O02IGnwpDmkp6E982XhtbuwSe3O4qOtMMMtodicASA1Cny2U+aCXcNpml+m4dPsvsJ3jatg== arr-map@^2.0.0, arr-map@^2.0.2: version "2.0.2" resolved "https://registry.yarnpkg.com/arr-map/-/arr-map-2.0.2.tgz#3a77345ffc1cf35e2a91825601f9e58f2e24cac4" + integrity sha1-Onc0X/wc814qkYJWAfnljy4kysQ= dependencies: make-iterator "^1.0.0" arr-union@^2.0.1: version "2.1.0" resolved "https://registry.yarnpkg.com/arr-union/-/arr-union-2.1.0.tgz#20f9eab5ec70f5c7d215b1077b1c39161d292c7d" + integrity sha1-IPnqtexw9cfSFbEHexw5Fh0pLH0= arr-union@^3.1.0: version "3.1.0" resolved "https://registry.yarnpkg.com/arr-union/-/arr-union-3.1.0.tgz#e39b09aea9def866a8f206e288af63919bae39c4" + integrity sha1-45sJrqne+Gao8gbiiK9jkZuuOcQ= array-differ@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/array-differ/-/array-differ-1.0.0.tgz#eff52e3758249d33be402b8bb8e564bb2b5d4031" + integrity sha1-7/UuN1gknTO+QCuLuOVkuytdQDE= + +array-differ@^2.0.3: + version "2.1.0" + resolved "https://registry.yarnpkg.com/array-differ/-/array-differ-2.1.0.tgz#4b9c1c3f14b906757082925769e8ab904f4801b1" + integrity sha512-KbUpJgx909ZscOc/7CLATBFam7P1Z1QRQInvgT0UztM9Q72aGKCunKASAl7WNW0tnPmPyEMeMhdsfWhfmW037w== array-each@^1.0.0, array-each@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/array-each/-/array-each-1.0.1.tgz#a794af0c05ab1752846ee753a1f211a05ba0c44f" + integrity sha1-p5SvDAWrF1KEbudTofIRoFugxE8= array-equal@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/array-equal/-/array-equal-1.0.0.tgz#8c2a5ef2472fd9ea742b04c77a75093ba2757c93" - -array-filter@~0.0.0: - version "0.0.1" - resolved "https://registry.yarnpkg.com/array-filter/-/array-filter-0.0.1.tgz#7da8cf2e26628ed732803581fd21f67cacd2eeec" + integrity sha1-jCpe8kcv2ep0KwTHenUJO6J1fJM= array-find-index@^1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/array-find-index/-/array-find-index-1.0.2.tgz#df010aa1287e164bbda6f9723b0a96a1ec4187a1" + integrity sha1-3wEKoSh+Fku9pvlyOwqWoexBh6E= array-ify@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/array-ify/-/array-ify-1.0.0.tgz#9e528762b4a9066ad163a6962a364418e9626ece" + integrity sha1-nlKHYrSpBmrRY6aWKjZEGOlibs4= array-includes@^3.0.3: version "3.0.3" @@ -2129,6 +2288,7 @@ array-includes@^3.0.3: array-initial@^1.0.0: version "1.1.0" resolved "https://registry.yarnpkg.com/array-initial/-/array-initial-1.1.0.tgz#2fa74b26739371c3947bd7a7adc73be334b3d795" + integrity sha1-L6dLJnOTccOUe9enrcc74zSz15U= dependencies: array-slice "^1.0.0" is-number "^4.0.0" @@ -2136,106 +2296,122 @@ array-initial@^1.0.0: array-last@^1.1.1: version "1.3.0" resolved "https://registry.yarnpkg.com/array-last/-/array-last-1.3.0.tgz#7aa77073fec565ddab2493f5f88185f404a9d336" + integrity sha512-eOCut5rXlI6aCOS7Z7kCplKRKyiFQ6dHFBem4PwlwKeNFk2/XxTrhRh5T9PyaEWGy/NHTZWbY+nsZlNFJu9rYg== dependencies: is-number "^4.0.0" -array-map@~0.0.0: - version "0.0.0" - resolved "https://registry.yarnpkg.com/array-map/-/array-map-0.0.0.tgz#88a2bab73d1cf7bcd5c1b118a003f66f665fa662" - -array-reduce@~0.0.0: - version "0.0.0" - resolved "https://registry.yarnpkg.com/array-reduce/-/array-reduce-0.0.0.tgz#173899d3ffd1c7d9383e4479525dbe278cab5f2b" - array-slice@^0.2.3: version "0.2.3" resolved "https://registry.yarnpkg.com/array-slice/-/array-slice-0.2.3.tgz#dd3cfb80ed7973a75117cdac69b0b99ec86186f5" + integrity sha1-3Tz7gO15c6dRF82sabC5nshhhvU= array-slice@^1.0.0: version "1.1.0" resolved "https://registry.yarnpkg.com/array-slice/-/array-slice-1.1.0.tgz#e368ea15f89bc7069f7ffb89aec3a6c7d4ac22d4" + integrity sha512-B1qMD3RBP7O8o0H2KbrXDyB0IccejMF15+87Lvlor12ONPRHP6gTjXMNkt/d3ZuOGbAe66hFmaCfECI24Ufp6w== array-sort@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/array-sort/-/array-sort-1.0.0.tgz#e4c05356453f56f53512a7d1d6123f2c54c0a88a" + integrity sha512-ihLeJkonmdiAsD7vpgN3CRcx2J2S0TiYW+IS/5zHBI7mKUq3ySvBdzzBfD236ubDBQFiiyG3SWCPc+msQ9KoYg== dependencies: default-compare "^1.0.0" get-value "^2.0.6" kind-of "^5.0.2" -array-union@^1.0.1: +array-union@^1.0.1, array-union@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/array-union/-/array-union-1.0.2.tgz#9a34410e4f4e3da23dea375be5be70f24778ec39" + integrity sha1-mjRBDk9OPaI96jdb5b5w8kd47Dk= dependencies: array-uniq "^1.0.1" +array-union@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/array-union/-/array-union-2.1.0.tgz#b798420adbeb1de828d84acd8a2e23d3efe85e8d" + integrity sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw== + array-uniq@^1.0.1: version "1.0.3" 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" + integrity sha1-qJS3XUvE9s1nnvMkSp/Y9Gri1Cg= + +array.prototype.flat@^1.2.1: + version "1.2.2" + resolved "https://registry.yarnpkg.com/array.prototype.flat/-/array.prototype.flat-1.2.2.tgz#8f3c71d245ba349b6b64b4078f76f5576f1fd723" + integrity sha512-VXjh7lAL4KXKF2hY4FnEW9eRW6IhdvFW1sN/JwLbmECbCgACCnBHNyP3lFiYuttr0jxRN9Bsc5+G27dMseSWqQ== + dependencies: + define-properties "^1.1.3" + es-abstract "^1.15.0" + function-bind "^1.1.1" arrify@^1.0.0, arrify@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/arrify/-/arrify-1.0.1.tgz#898508da2226f380df904728456849c1501a4b0d" + integrity sha1-iYUI2iIm84DfkEcoRWhJwVAaSw0= asap@^2.0.0: version "2.0.6" resolved "https://registry.yarnpkg.com/asap/-/asap-2.0.6.tgz#e50347611d7e690943208bbdafebcbc2fb866d46" + integrity sha1-5QNHYR1+aQlDIIu9r+vLwvuGbUY= asn1.js@^4.0.0: version "4.10.1" resolved "https://registry.yarnpkg.com/asn1.js/-/asn1.js-4.10.1.tgz#b9c2bf5805f1e64aadeed6df3a2bfafb5a73f5a0" + integrity sha512-p32cOF5q0Zqs9uBiONKYLm6BClCoBCM5O9JfeUSlnQLBTxYdTK+pW+nXflm8UkKd2UYlEbYz5qEi0JuZR9ckSw== dependencies: bn.js "^4.0.0" inherits "^2.0.1" minimalistic-assert "^1.0.0" asn1@~0.2.3: - version "0.2.3" - resolved "https://registry.yarnpkg.com/asn1/-/asn1-0.2.3.tgz#dac8787713c9966849fc8180777ebe9c1ddf3b86" + version "0.2.4" + resolved "https://registry.yarnpkg.com/asn1/-/asn1-0.2.4.tgz#8d2475dfab553bb33e77b54e59e880bb8ce23136" + integrity sha512-jxwzQpLQjSmWXgwaCZE9Nz+glAG01yF1QnWgbhGwHI5A6FRIEY6IVqtHhIepHqI7/kyEyQEagBC5mBEFlIYvdg== + dependencies: + safer-buffer "~2.1.0" assert-plus@1.0.0, assert-plus@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/assert-plus/-/assert-plus-1.0.0.tgz#f12e0f3c5d77b0b1cdd9146942e4e96c1e4dd525" + integrity sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU= -assert@^1.1.1, assert@^1.4.0: - version "1.4.1" - resolved "https://registry.yarnpkg.com/assert/-/assert-1.4.1.tgz#99912d591836b5a6f5b345c0f07eefc08fc65d91" +assert@^1.4.0: + version "1.5.0" + resolved "https://registry.yarnpkg.com/assert/-/assert-1.5.0.tgz#55c109aaf6e0aefdb3dc4b71240c70bf574b18eb" + integrity sha512-EDsgawzwoun2CZkCgtxJbv392v4nbk9XDD06zI+kQYoBM/3RBWLlEyJARDOmhAAosBjWACEkKL6S+lIZtcAubA== dependencies: + object-assign "^4.1.1" util "0.10.3" assign-symbols@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/assign-symbols/-/assign-symbols-1.0.0.tgz#59667f41fadd4f20ccbc2bb96b8d4f7f78ec0367" - -ast-types@0.9.6: - version "0.9.6" - resolved "https://registry.yarnpkg.com/ast-types/-/ast-types-0.9.6.tgz#102c9e9e9005d3e7e3829bf0c4fa24ee862ee9b9" + integrity sha1-WWZ/QfrdTyDMvCu5a41Pf3jsA2c= astral-regex@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/astral-regex/-/astral-regex-1.0.0.tgz#6c8c3fb827dd43ee3918f27b82782ab7658a6fd9" - -astw@^2.0.0: - version "2.2.0" - resolved "https://registry.yarnpkg.com/astw/-/astw-2.2.0.tgz#7bd41784d32493987aeb239b6b4e1c57a873b917" - dependencies: - acorn "^4.0.3" + integrity sha512-+Ryf6g3BKoRc7jfp7ad8tM4TtMiaWvbF/1/sQcZPkkS7ag3D5nMBCe2UfOTONtAkaG0tO0ij3C5Lwmf1EiyjHg== async-done@^1.2.0, async-done@^1.2.2: - version "1.2.4" - resolved "https://registry.yarnpkg.com/async-done/-/async-done-1.2.4.tgz#17b0fcefb9a33cb9de63daa8904c0a65bd535fa0" + version "1.3.2" + resolved "https://registry.yarnpkg.com/async-done/-/async-done-1.3.2.tgz#5e15aa729962a4b07414f528a88cdf18e0b290a2" + integrity sha512-uYkTP8dw2og1tu1nmza1n1CMW0qb8gWWlwqMmLb7MhBVs4BXrFziT6HXUd+/RlRA/i4H9AkofYloUbs1fwMqlw== dependencies: end-of-stream "^1.1.0" once "^1.3.2" - process-nextick-args "^1.0.7" + process-nextick-args "^2.0.0" stream-exhaust "^1.0.1" async-each@^1.0.1: @@ -2244,106 +2420,108 @@ async-each@^1.0.1: integrity sha512-z/WhQ5FPySLdvREByI2vZiTWwCnF0moMJ1hK9YQwDTHKh6I7/uSckMetoRGb5UBZPC1z0jlw+n/XCgjeH7y1AQ== async-limiter@~1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/async-limiter/-/async-limiter-1.0.0.tgz#78faed8c3d074ab81f22b4e985d79e8738f720f8" + version "1.0.1" + resolved "https://registry.yarnpkg.com/async-limiter/-/async-limiter-1.0.1.tgz#dd379e94f0db8310b08291f9d64c3209766617fd" + integrity sha512-csOlWGAcRFJaI6m+F2WKdnMKr4HhdhFVBk0H/QbJFMCr+uO2kwohwXQPxw/9OCxp05r5ghVBFSyioixx3gfkNQ== async-settle@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/async-settle/-/async-settle-1.0.0.tgz#1d0a914bb02575bec8a8f3a74e5080f72b2c0c6b" + integrity sha1-HQqRS7Aldb7IqPOnTlCA9yssDGs= dependencies: async-done "^1.2.2" -async@^2.1.2, async@^2.5.0: - version "2.6.1" - resolved "https://registry.yarnpkg.com/async/-/async-2.6.1.tgz#b245a23ca71930044ec53fa46aa00a3e87c6a610" - dependencies: - lodash "^4.17.10" - asynckit@^0.4.0: version "0.4.0" resolved "https://registry.yarnpkg.com/asynckit/-/asynckit-0.4.0.tgz#c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79" + integrity sha1-x57Zf380y48robyXkLzDZkdLS3k= atob-lite@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/atob-lite/-/atob-lite-2.0.0.tgz#0fef5ad46f1bd7a8502c65727f0367d5ee43d696" integrity sha1-D+9a1G8b16hQLGVyfwNn1e5D1pY= -atob@^2.0.0: - version "2.0.3" - resolved "https://registry.yarnpkg.com/atob/-/atob-2.0.3.tgz#19c7a760473774468f20b2d2d03372ad7d4cbf5d" +atob@^2.1.1: + version "2.1.2" + resolved "https://registry.yarnpkg.com/atob/-/atob-2.1.2.tgz#6d9517eb9e030d2436666651e86bd9f6f13533c9" + integrity sha512-Wm6ukoaOGJi/73p/cl2GvLjTI5JM1k/O14isD73YML8StrH/7/lRFgmg8nICZgD3bZZvjwCGxtMOD3wWNAu8cg== aws-sign2@~0.7.0: version "0.7.0" resolved "https://registry.yarnpkg.com/aws-sign2/-/aws-sign2-0.7.0.tgz#b46e890934a9591f2d2f6f86d7e6a9f1b3fe76a8" + integrity sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg= aws4@^1.8.0: - version "1.8.0" - resolved "https://registry.yarnpkg.com/aws4/-/aws4-1.8.0.tgz#f0e003d9ca9e7f59c7a508945d7b2ef9a04a542f" - -babel-eslint@^11.0.0-beta.0: - version "11.0.0-beta.0" - resolved "https://registry.yarnpkg.com/babel-eslint/-/babel-eslint-11.0.0-beta.0.tgz#3645b9b84d848e070e0afadc95d0c8ff96f4c63a" - dependencies: - eslint-scope "3.7.1" - eslint-visitor-keys "^1.0.0" - semver "^5.6.0" - -babel-jest@^24.8.0: - version "24.8.0" - resolved "https://registry.yarnpkg.com/babel-jest/-/babel-jest-24.8.0.tgz#5c15ff2b28e20b0f45df43fe6b7f2aae93dba589" - integrity sha512-+5/kaZt4I9efoXzPlZASyK/lN9qdRKmmUav9smVc0ruPQD7IsfucQ87gpOE8mn2jbDuS6M/YOW6n3v9ZoIfgnw== - dependencies: - "@jest/transform" "^24.8.0" - "@jest/types" "^24.8.0" + version "1.9.0" + resolved "https://registry.yarnpkg.com/aws4/-/aws4-1.9.0.tgz#24390e6ad61386b0a747265754d2a17219de862c" + integrity sha512-Uvq6hVe90D0B2WEnUqtdgY1bATGz3mw33nH9Y+dmA+w5DHvUmBgkr5rM/KCHpCsiFNRUfokW/szpPPgMK2hm4A== + +babel-eslint@^11.0.0-beta.2: + version "11.0.0-beta.2" + resolved "https://registry.yarnpkg.com/babel-eslint/-/babel-eslint-11.0.0-beta.2.tgz#de1f06795aa0d8cedcf6ac943e63056f5b4a7048" + integrity sha512-D2tunrOu04XloEdU2XVUminUu25FILlGruZmffqH5OSnLDhCheKNvUoM1ihrexdUvhizlix8bjqRnsss4V/UIQ== + dependencies: + eslint-scope "5.0.0" + eslint-visitor-keys "^1.1.0" + semver "^6.3.0" + +babel-jest@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/babel-jest/-/babel-jest-24.9.0.tgz#3fc327cb8467b89d14d7bc70e315104a783ccd54" + integrity sha512-ntuddfyiN+EhMw58PTNL1ph4C9rECiQXjI4nMMBKBaNjXvqLdkXpPRcMSr4iyBrJg/+wz9brFUD6RhOAT6r4Iw== + dependencies: + "@jest/transform" "^24.9.0" + "@jest/types" "^24.9.0" "@types/babel__core" "^7.1.0" babel-plugin-istanbul "^5.1.0" - babel-preset-jest "^24.6.0" + babel-preset-jest "^24.9.0" chalk "^2.4.2" slash "^2.0.0" -babel-loader@^8.0.6: - version "8.0.6" - resolved "https://registry.yarnpkg.com/babel-loader/-/babel-loader-8.0.6.tgz#e33bdb6f362b03f4bb141a0c21ab87c501b70dfb" - integrity sha512-4BmWKtBOBm13uoUwd08UwjZlaw3O9GWf456R9j+5YykFZ6LUIjIKLc0zEZf+hauxPOJs96C8k6FvYD09vWzhYw== +babel-plugin-dynamic-import-node@^2.3.0: + version "2.3.0" + resolved "https://registry.yarnpkg.com/babel-plugin-dynamic-import-node/-/babel-plugin-dynamic-import-node-2.3.0.tgz#f00f507bdaa3c3e3ff6e7e5e98d90a7acab96f7f" + integrity sha512-o6qFkpeQEBxcqt0XYlWzAVxNCSCZdUgcR8IRlhD/8DylxjjO4foPcvTW0GGKa/cVt3rvxZ7o5ippJ+/0nvLhlQ== dependencies: - find-cache-dir "^2.0.0" - loader-utils "^1.0.2" - mkdirp "^0.5.1" - pify "^4.0.1" + object.assign "^4.1.0" babel-plugin-istanbul@^5.1.0: - version "5.1.0" - resolved "https://registry.yarnpkg.com/babel-plugin-istanbul/-/babel-plugin-istanbul-5.1.0.tgz#6892f529eff65a3e2d33d87dc5888ffa2ecd4a30" + version "5.2.0" + resolved "https://registry.yarnpkg.com/babel-plugin-istanbul/-/babel-plugin-istanbul-5.2.0.tgz#df4ade83d897a92df069c4d9a25cf2671293c854" + integrity sha512-5LphC0USA8t4i1zCtjbbNb6jJj/9+X6P37Qfirc/70EQ34xKlMW+a1RHGwxGI+SwWpNwZ27HqvzAobeqaXwiZw== dependencies: + "@babel/helper-plugin-utils" "^7.0.0" find-up "^3.0.0" - istanbul-lib-instrument "^3.0.0" - test-exclude "^5.0.0" + istanbul-lib-instrument "^3.3.0" + test-exclude "^5.2.3" -babel-plugin-jest-hoist@^24.6.0: - version "24.6.0" - resolved "https://registry.yarnpkg.com/babel-plugin-jest-hoist/-/babel-plugin-jest-hoist-24.6.0.tgz#f7f7f7ad150ee96d7a5e8e2c5da8319579e78019" - integrity sha512-3pKNH6hMt9SbOv0F3WVmy5CWQ4uogS3k0GY5XLyQHJ9EGpAT9XWkFd2ZiXXtkwFHdAHa5j7w7kfxSP5lAIwu7w== +babel-plugin-jest-hoist@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/babel-plugin-jest-hoist/-/babel-plugin-jest-hoist-24.9.0.tgz#4f837091eb407e01447c8843cbec546d0002d756" + integrity sha512-2EMA2P8Vp7lG0RAzr4HXqtYwacfMErOuv1U3wrvxHX6rD1sV6xS3WXG3r8TRQ2r6w8OhvSdWt+z41hQNwNm3Xw== dependencies: "@types/babel__traverse" "^7.0.6" babel-plugin-transform-charcodes@^0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/babel-plugin-transform-charcodes/-/babel-plugin-transform-charcodes-0.2.0.tgz#c17307cc852c979103ceafd97e1799ef10916941" + integrity sha512-owzuAMq9EIampG9G7DqeNDp/fl5i2FQ9RIgP1mTrYORByN0vZiVF9aHl4flDdAecxWtduxb0Peha/Fkd6t4n5A== dependencies: "@babel/parser" "^7.0.0" "@babel/traverse" "^7.0.0" -babel-preset-jest@^24.6.0: - version "24.6.0" - resolved "https://registry.yarnpkg.com/babel-preset-jest/-/babel-preset-jest-24.6.0.tgz#66f06136eefce87797539c0d63f1769cc3915984" - integrity sha512-pdZqLEdmy1ZK5kyRUfvBb2IfTPb2BUvIJczlPspS8fWmBQslNNDBqVfh7BW5leOVJMDZKzjD8XEyABTk6gQ5yw== +babel-preset-jest@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/babel-preset-jest/-/babel-preset-jest-24.9.0.tgz#192b521e2217fb1d1f67cf73f70c336650ad3cdc" + integrity sha512-izTUuhE4TMfTRPF92fFwD2QfdXaZW08qvWTFCI51V8rW5x00UuPgc3ajRoWofXOuxjfcOM5zzSYsQS3H8KGCAg== dependencies: "@babel/plugin-syntax-object-rest-spread" "^7.0.0" - babel-plugin-jest-hoist "^24.6.0" + babel-plugin-jest-hoist "^24.9.0" bach@^1.0.0: version "1.2.0" resolved "https://registry.yarnpkg.com/bach/-/bach-1.2.0.tgz#4b3ce96bf27134f79a1b414a51c14e34c3bd9880" + integrity sha1-Szzpa/JxNPeaG0FKUcFONMO9mIA= dependencies: arr-filter "^1.1.1" arr-flatten "^1.0.1" @@ -2358,14 +2536,17 @@ bach@^1.0.0: balanced-match@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.0.tgz#89b4d199ab2bee49de164ea02b89ce462d71b767" + integrity sha1-ibTRmasr7kneFk6gK4nORi1xt2c= base64-js@^1.0.2: - version "1.2.3" - resolved "https://registry.yarnpkg.com/base64-js/-/base64-js-1.2.3.tgz#fb13668233d9614cf5fb4bce95a9ba4096cdf801" + version "1.3.1" + resolved "https://registry.yarnpkg.com/base64-js/-/base64-js-1.3.1.tgz#58ece8cb75dd07e71ed08c736abc5fac4dbf8df1" + integrity sha512-mLQ4i2QO1ytvGWFWmcngKO//JXAQueZvwEKtjgQFM4jIK0kU+ytMfplL8j+n5mspOfjHwoAg+9yhb7BwAHm36g== base@^0.11.1: version "0.11.2" resolved "https://registry.yarnpkg.com/base/-/base-0.11.2.tgz#7bde5ced145b6d551a90db87f83c558b4eb48a8f" + integrity sha512-5T6P4xPgpp0YDFvSWwEZ4NoE3aM4QBQXDzmVbraCkFj8zHM+mba8SyqB5DbZWyR7mYHo6Y7BdQo3MoA4m0TeQg== dependencies: cache-base "^1.0.1" class-utils "^0.3.5" @@ -2376,39 +2557,43 @@ base@^0.11.1: pascalcase "^0.1.1" bcrypt-pbkdf@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.1.tgz#63bc5dcb61331b92bc05fd528953c33462a06f8d" + version "1.0.2" + resolved "https://registry.yarnpkg.com/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz#a4301d389b6a43f9b67ff3ca11a3f6637e360e9e" + integrity sha1-pDAdOJtqQ/m2f/PKEaP2Y342Dp4= dependencies: tweetnacl "^0.14.3" -before-after-hook@^1.4.0: - version "1.4.0" - resolved "https://registry.yarnpkg.com/before-after-hook/-/before-after-hook-1.4.0.tgz#2b6bf23dca4f32e628fd2747c10a37c74a4b484d" - integrity sha512-l5r9ir56nda3qu14nAXIlyq1MmUSs0meCIaFAh8HwkFwP1F8eToOuS3ah2VAHHcY04jaYD7FpJC5JTXHYRbkzg== - -big.js@^3.1.3: - version "3.2.0" - resolved "https://registry.yarnpkg.com/big.js/-/big.js-3.2.0.tgz#a5fc298b81b9e0dca2e458824784b65c52ba588e" +before-after-hook@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/before-after-hook/-/before-after-hook-2.1.0.tgz#b6c03487f44e24200dd30ca5e6a1979c5d2fb635" + integrity sha512-IWIbu7pMqyw3EAJHzzHbWa85b6oud/yfKYg5rqB5hNE8CeMi3nX+2C2sj0HswfblST86hpVEOAb9x34NZd6P7A== binary-extensions@^1.0.0: - version "1.11.0" - resolved "https://registry.yarnpkg.com/binary-extensions/-/binary-extensions-1.11.0.tgz#46aa1751fb6a2f93ee5e689bb1087d4b14c6c205" + version "1.13.1" + resolved "https://registry.yarnpkg.com/binary-extensions/-/binary-extensions-1.13.1.tgz#598afe54755b2868a5330d2aff9d4ebb53209b65" + integrity sha512-Un7MIEDdUC5gNpcGDV97op1Ywk748MpHcFTHoYs6qnj1Z3j7I53VG3nwZhKzoBZmbdRNnb6WRdFlwl7tSDuZGw== -bluebird@^3.5.1, bluebird@^3.5.3: - version "3.5.3" - resolved "https://registry.yarnpkg.com/bluebird/-/bluebird-3.5.3.tgz#7d01c6f9616c9a51ab0f8c549a79dfe6ec33efa7" +bl@~0.8.1: + version "0.8.2" + resolved "https://registry.yarnpkg.com/bl/-/bl-0.8.2.tgz#c9b6bca08d1bc2ea00fc8afb4f1a5fd1e1c66e4e" + integrity sha1-yba8oI0bwuoA/Ir7Txpf0eHGbk4= + dependencies: + readable-stream "~1.0.26" + +bluebird@^3.5.1, bluebird@^3.5.3, bluebird@^3.5.5: + version "3.7.2" + resolved "https://registry.yarnpkg.com/bluebird/-/bluebird-3.7.2.tgz#9f229c15be272454ffa973ace0dbee79a1b0c36f" + integrity sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg== bn.js@^4.0.0, bn.js@^4.1.0, bn.js@^4.1.1, bn.js@^4.4.0: version "4.11.8" resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-4.11.8.tgz#2cde09eb5ee341f484746bb0309b3253b1b1442f" - -boolbase@~1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/boolbase/-/boolbase-1.0.0.tgz#68dff5fbe60c51eb37725ea9e3ed310dcc1e776e" + integrity sha512-ItfYfPLkWHUjckQCk8xC+LwxgK8NYcXywGigJgSwOP8Y2iyWT4f2vsZnoOXTTbo+o5yXmIUJ4gn5538SO5S3gA== brace-expansion@^1.1.7: version "1.1.11" resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.11.tgz#3c7fcbf529d87226f3d2f52b966ff5271eb441dd" + integrity sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA== dependencies: balanced-match "^1.0.0" concat-map "0.0.1" @@ -2416,6 +2601,7 @@ brace-expansion@^1.1.7: 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" @@ -2437,13 +2623,22 @@ braces@^2.3.1, braces@^2.3.2: split-string "^3.0.2" to-regex "^3.0.1" +braces@^3.0.1: + version "3.0.2" + resolved "https://registry.yarnpkg.com/braces/-/braces-3.0.2.tgz#3454e1a462ee8d599e236df336cd9ea4f8afe107" + integrity sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A== + dependencies: + fill-range "^7.0.1" + brorand@^1.0.1: version "1.1.0" resolved "https://registry.yarnpkg.com/brorand/-/brorand-1.1.0.tgz#12c25efe40a45e3c323eb8675a0a0ce57b22371f" + integrity sha1-EsJe/kCkXjwyPrhnWgoM5XsiNx8= browser-pack@^5.0.1: version "5.0.1" resolved "https://registry.yarnpkg.com/browser-pack/-/browser-pack-5.0.1.tgz#4197719b20c6e0aaa09451c5111e53efb6fbc18d" + integrity sha1-QZdxmyDG4KqglFHFER5T77b7wY0= dependencies: JSONStream "^1.0.3" combine-source-map "~0.6.1" @@ -2452,8 +2647,9 @@ browser-pack@^5.0.1: umd "^3.0.0" browser-pack@^6.0.1: - version "6.0.4" - resolved "https://registry.yarnpkg.com/browser-pack/-/browser-pack-6.0.4.tgz#9a73beb3b48f9e36868be007b64400102c04a99f" + version "6.1.0" + resolved "https://registry.yarnpkg.com/browser-pack/-/browser-pack-6.1.0.tgz#c34ba10d0b9ce162b5af227c7131c92c2ecd5774" + integrity sha512-erYug8XoqzU3IfcU8fUgyHqyOXqIE4tUTTQ+7mqUjQlvnXkOO6OlT9c/ZoJVHYoAaqGxr09CN53G7XIsO4KtWA== dependencies: JSONStream "^1.0.3" combine-source-map "~0.8.0" @@ -2463,8 +2659,9 @@ browser-pack@^6.0.1: umd "^3.0.0" browser-process-hrtime@^0.1.2: - version "0.1.2" - resolved "https://registry.yarnpkg.com/browser-process-hrtime/-/browser-process-hrtime-0.1.2.tgz#425d68a58d3447f02a04aa894187fce8af8b7b8e" + version "0.1.3" + 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.7.0: version "1.11.3" @@ -2474,17 +2671,18 @@ browser-resolve@^1.11.0, browser-resolve@^1.11.3, browser-resolve@^1.7.0: resolve "1.1.7" browser-unpack@^1.1.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/browser-unpack/-/browser-unpack-1.2.0.tgz#357aee31fc467831684d063e4355e070a782970d" + version "1.4.2" + resolved "https://registry.yarnpkg.com/browser-unpack/-/browser-unpack-1.4.2.tgz#7a708774dc7448df1c24a735d65d409708b95ce2" + integrity sha512-uHkiY4bmXjjBBWoKH1aRnEGTQxUUCCcVtoJfH9w1lmGGjETY4u93Zk+GRYkCE/SRMrdoMTINQ/1/manr/3aMVA== dependencies: - acorn "^4.0.3" - browser-pack "^5.0.1" + acorn-node "^1.5.2" concat-stream "^1.5.0" minimist "^1.1.1" browserify-aes@^1.0.0, browserify-aes@^1.0.4: - version "1.1.1" - resolved "https://registry.yarnpkg.com/browserify-aes/-/browserify-aes-1.1.1.tgz#38b7ab55edb806ff2dcda1a7f1620773a477c49f" + version "1.2.0" + resolved "https://registry.yarnpkg.com/browserify-aes/-/browserify-aes-1.2.0.tgz#326734642f403dabc3003209853bb70ad428ef48" + integrity sha512-+7CHXqGuspUn/Sl5aO7Ea0xWGAtETPXNSAjHo48JfLdPWcMng33Xe4znFvQweqc/uzk5zSOI3H52CYnjCfb5hA== dependencies: buffer-xor "^1.0.3" cipher-base "^1.0.0" @@ -2494,24 +2692,37 @@ browserify-aes@^1.0.0, browserify-aes@^1.0.4: safe-buffer "^5.0.1" browserify-cipher@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/browserify-cipher/-/browserify-cipher-1.0.0.tgz#9988244874bf5ed4e28da95666dcd66ac8fc363a" + version "1.0.1" + resolved "https://registry.yarnpkg.com/browserify-cipher/-/browserify-cipher-1.0.1.tgz#8d6474c1b870bfdabcd3bcfcc1934a10e94f15f0" + integrity sha512-sPhkz0ARKbf4rRQt2hTpAHqn47X3llLkUGn+xEJzLjwY8LRs2p0v7ljvI5EyoRO/mexrNunNECisZs+gw2zz1w== dependencies: browserify-aes "^1.0.4" browserify-des "^1.0.0" evp_bytestokey "^1.0.0" browserify-des@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/browserify-des/-/browserify-des-1.0.0.tgz#daa277717470922ed2fe18594118a175439721dd" + version "1.0.2" + resolved "https://registry.yarnpkg.com/browserify-des/-/browserify-des-1.0.2.tgz#3af4f1f59839403572f1c66204375f7a7f703e9c" + integrity sha512-BioO1xf3hFwz4kc6iBhI3ieDFompMhrMlnDFC4/0/vd5MokpuAc3R+LYbwTA9A5Yc9pq9UYPqffKpW2ObuwX5A== dependencies: cipher-base "^1.0.1" des.js "^1.0.0" inherits "^2.0.1" + safe-buffer "^5.1.2" + +browserify-fs@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/browserify-fs/-/browserify-fs-1.0.0.tgz#f075aa8a729d4d1716d066620e386fcc1311a96f" + integrity sha1-8HWqinKdTRcW0GZiDjhvzBMRqW8= + dependencies: + level-filesystem "^1.0.1" + level-js "^2.1.3" + levelup "^0.18.2" browserify-rsa@^4.0.0: version "4.0.1" resolved "https://registry.yarnpkg.com/browserify-rsa/-/browserify-rsa-4.0.1.tgz#21e0abfaf6f2029cf2fafb133567a701d4135524" + integrity sha1-IeCr+vbyApzy+vsTNWenAdQTVSQ= dependencies: bn.js "^4.1.0" randombytes "^2.0.1" @@ -2519,6 +2730,7 @@ browserify-rsa@^4.0.0: browserify-sign@^4.0.0: version "4.0.4" resolved "https://registry.yarnpkg.com/browserify-sign/-/browserify-sign-4.0.4.tgz#aa4eb68e5d7b658baa6bf6a57e630cbd7a93d298" + integrity sha1-qk62jl17ZYuqa/alfmMMvXqT0pg= dependencies: bn.js "^4.1.1" browserify-rsa "^4.0.0" @@ -2528,15 +2740,17 @@ browserify-sign@^4.0.0: inherits "^2.0.1" parse-asn1 "^5.0.0" -browserify-zlib@^0.2.0, browserify-zlib@~0.2.0: +browserify-zlib@~0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/browserify-zlib/-/browserify-zlib-0.2.0.tgz#2869459d9aa3be245fe8fe2ca1f46e2e7f54d73f" + integrity sha512-Z942RysHXmJrhqk88FmKBVq/v5tqmSkDz7p54G/MGyjMnCFFnC79XWNbg+Vta8W6Wb2qtSZTSxIGkJrRpCFEiA== dependencies: pako "~1.0.5" browserify@^16.2.3: - version "16.2.3" - resolved "https://registry.yarnpkg.com/browserify/-/browserify-16.2.3.tgz#7ee6e654ba4f92bce6ab3599c3485b1cc7a0ad0b" + version "16.5.0" + resolved "https://registry.yarnpkg.com/browserify/-/browserify-16.5.0.tgz#a1c2bc0431bec11fd29151941582e3f645ede881" + integrity sha512-6bfI3cl76YLAnCZ75AGu/XPOsqUhRyc0F/olGIJeCxtfxF2HvPKEcmjU9M8oAPxl4uBY1U7Nry33Q6koV3f2iw== dependencies: JSONStream "^1.0.3" assert "^1.4.0" @@ -2575,7 +2789,7 @@ browserify@^16.2.3: shasum "^1.0.0" shell-quote "^1.6.1" stream-browserify "^2.0.0" - stream-http "^2.0.0" + stream-http "^3.0.0" string_decoder "^1.1.1" subarg "^1.0.0" syntax-error "^1.1.1" @@ -2587,18 +2801,19 @@ browserify@^16.2.3: vm-browserify "^1.0.0" xtend "^4.0.0" -browserslist@^4.6.0: - version "4.6.0" - resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.6.0.tgz#5274028c26f4d933d5b1323307c1d1da5084c9ff" - integrity sha512-Jk0YFwXBuMOOol8n6FhgkDzn3mY9PYLYGk29zybF05SbRTsMgPqmTNeQQhOghCxq5oFqAXE3u4sYddr4C0uRhg== +browserslist@^4.6.0, browserslist@^4.8.2: + version "4.8.2" + resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.8.2.tgz#b45720ad5fbc8713b7253c20766f701c9a694289" + integrity sha512-+M4oeaTplPm/f1pXDw84YohEv7B1i/2Aisei8s4s6k3QsoSHa7i5sz8u/cGQkkatCPxMASKxPualR4wwYgVboA== dependencies: - caniuse-lite "^1.0.30000967" - electron-to-chromium "^1.3.133" - node-releases "^1.1.19" + caniuse-lite "^1.0.30001015" + electron-to-chromium "^1.3.322" + node-releases "^1.1.42" -bser@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/bser/-/bser-2.0.0.tgz#9ac78d3ed5d915804fd87acb158bc797147a1719" +bser@2.1.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/bser/-/bser-2.1.1.tgz#e6787da20ece9d07998533cfd9de6f5c38f4bc05" + integrity sha512-gQxTNE/GAfIIrmHLUE3oJyp5FO6HRBfhjnw4/wMmA63ZGDJnWBmgY/lyQBpnDUkGmAhbSe39tx2d/iTOAfglwQ== dependencies: node-int64 "^0.4.0" @@ -2610,26 +2825,27 @@ btoa-lite@^1.0.0: buffer-equal@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/buffer-equal/-/buffer-equal-1.0.0.tgz#59616b498304d556abd466966b22eeda3eca5fbe" + integrity sha1-WWFrSYME1Var1GaWayLu2j7KX74= + +buffer-es6@^4.9.2, buffer-es6@^4.9.3: + version "4.9.3" + resolved "https://registry.yarnpkg.com/buffer-es6/-/buffer-es6-4.9.3.tgz#f26347b82df76fd37e18bcb5288c4970cfd5c404" + integrity sha1-8mNHuC33b9N+GLy1KIxJcM/VxAQ= buffer-from@^1.0.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/buffer-from/-/buffer-from-1.1.0.tgz#87fcaa3a298358e0ade6e442cfce840740d1ad04" + version "1.1.1" + resolved "https://registry.yarnpkg.com/buffer-from/-/buffer-from-1.1.1.tgz#32713bc028f75c02fdb710d7c7bcec1f2c6070ef" + integrity sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A== buffer-xor@^1.0.3: version "1.0.3" resolved "https://registry.yarnpkg.com/buffer-xor/-/buffer-xor-1.0.3.tgz#26e61ed1422fb70dd42e6e36729ed51d855fe8d9" - -buffer@^4.3.0: - version "4.9.1" - resolved "https://registry.yarnpkg.com/buffer/-/buffer-4.9.1.tgz#6d1bb601b07a4efced97094132093027c95bc298" - dependencies: - base64-js "^1.0.2" - ieee754 "^1.1.4" - isarray "^1.0.0" + integrity sha1-JuYe0UIvtw3ULm42cp7VHYVf6Nk= buffer@^5.0.2: - version "5.2.0" - resolved "https://registry.yarnpkg.com/buffer/-/buffer-5.2.0.tgz#53cf98241100099e9eeae20ee6d51d21b16e541e" + version "5.4.3" + resolved "https://registry.yarnpkg.com/buffer/-/buffer-5.4.3.tgz#3fbc9c69eb713d323e3fc1a895eee0710c072115" + integrity sha512-zvj65TkFeIt3i6aj5bIvJDzjjQQGs4o/sNoezg1F1kYap9Nu2jcUdpwzRSJTHMMzG0H7bZkn4rNQpImhuxWX2A== dependencies: base64-js "^1.0.2" ieee754 "^1.1.4" @@ -2642,14 +2858,17 @@ builtin-modules@^3.1.0: builtin-status-codes@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/builtin-status-codes/-/builtin-status-codes-3.0.0.tgz#85982878e21b98e1c66425e03d0174788f569ee8" + integrity sha1-hZgoeOIbmOHGZCXgPQF0eI9Wnug= builtins@^1.0.3: version "1.0.3" resolved "https://registry.yarnpkg.com/builtins/-/builtins-1.0.3.tgz#cb94faeb61c8696451db36534e1422f94f0aee88" + integrity sha1-y5T662HIaWRR2zZTThQi+U8K7og= bundle-collapser@^1.2.1: version "1.3.0" resolved "https://registry.yarnpkg.com/bundle-collapser/-/bundle-collapser-1.3.0.tgz#f4b4ff58b2f22ee7701b20fa76306e23f53a3fb6" + integrity sha1-9LT/WLLyLudwGyD6djBuI/U6P7Y= dependencies: browser-pack "^5.0.1" browser-unpack "^1.1.0" @@ -2661,27 +2880,30 @@ bundle-collapser@^1.2.1: byline@^5.0.0: version "5.0.0" resolved "https://registry.yarnpkg.com/byline/-/byline-5.0.0.tgz#741c5216468eadc457b03410118ad77de8c1ddb1" + integrity sha1-dBxSFkaOrcRXsDQQEYrXfejB3bE= -byte-size@^4.0.3: - version "4.0.4" - resolved "https://registry.yarnpkg.com/byte-size/-/byte-size-4.0.4.tgz#29d381709f41aae0d89c631f1c81aec88cd40b23" +byte-size@^5.0.1: + version "5.0.1" + resolved "https://registry.yarnpkg.com/byte-size/-/byte-size-5.0.1.tgz#4b651039a5ecd96767e71a3d7ed380e48bed4191" + integrity sha512-/XuKeqWocKsYa/cBY1YbSJSWWqTi4cFgr9S6OyM7PBaPbr9zvNGwWP33vt0uqGhwDdN+y3yhbXVILEUpnwEWGw== -cacache@^11.0.1, cacache@^11.3.2: - version "11.3.2" - resolved "https://registry.yarnpkg.com/cacache/-/cacache-11.3.2.tgz#2d81e308e3d258ca38125b676b98b2ac9ce69bfa" - integrity sha512-E0zP4EPGDOaT2chM08Als91eYnf8Z+eH1awwwVsngUmgppfM5jjJ8l3z5vO5p5w/I3LsiXawb1sW0VY65pQABg== +cacache@^12.0.0, cacache@^12.0.3: + version "12.0.3" + resolved "https://registry.yarnpkg.com/cacache/-/cacache-12.0.3.tgz#be99abba4e1bf5df461cd5a2c1071fc432573390" + integrity sha512-kqdmfXEGFepesTuROHMs3MpFLWrPkSSpRqOw80RCflZXy/khxaArvFrQ7uJxSUduzAufc6G0g1VUCOZXxWavPw== dependencies: - bluebird "^3.5.3" + bluebird "^3.5.5" chownr "^1.1.1" figgy-pudding "^3.5.1" - glob "^7.1.3" + glob "^7.1.4" graceful-fs "^4.1.15" + infer-owner "^1.0.3" lru-cache "^5.1.1" mississippi "^3.0.0" mkdirp "^0.5.1" move-concurrently "^1.0.1" promise-inflight "^1.0.1" - rimraf "^2.6.2" + rimraf "^2.6.3" ssri "^6.0.1" unique-filename "^1.1.1" y18n "^4.0.0" @@ -2689,6 +2911,7 @@ cacache@^11.0.1, cacache@^11.3.2: cache-base@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/cache-base/-/cache-base-1.0.1.tgz#0a7f46416831c8b662ee36fe4e7c59d76f666ab2" + integrity sha512-AKcdTnFSWATd5/GCPRxr2ChwIJ85CeyrEyjRHlKxQ56d4XJMGym0uAiKn0xbLOGOl3+yRpOTi484dVCEc5AUzQ== dependencies: collection-visit "^1.0.0" component-emitter "^1.2.1" @@ -2700,44 +2923,44 @@ cache-base@^1.0.1: union-value "^1.0.0" unset-value "^1.0.0" -cached-path-relative@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/cached-path-relative/-/cached-path-relative-1.0.1.tgz#d09c4b52800aa4c078e2dd81a869aac90d2e54e7" +cached-path-relative@^1.0.0, cached-path-relative@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/cached-path-relative/-/cached-path-relative-1.0.2.tgz#a13df4196d26776220cc3356eb147a52dba2c6db" + integrity sha512-5r2GqsoEb4qMTTN9J+WzXfjov+hjxT+j3u5K+kIVNIwAd99DLCJE9pBIMP1qVeybV6JiijL385Oz0DcYxfbOIg== call-me-maybe@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/call-me-maybe/-/call-me-maybe-1.0.1.tgz#26d208ea89e37b5cbde60250a15f031c16a4d66b" + integrity sha1-JtII6onje1y95gJQoV8DHBak1ms= caller-callsite@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/caller-callsite/-/caller-callsite-2.0.0.tgz#847e0fce0a223750a9a027c54b33731ad3154134" + integrity sha1-hH4PzgoiN1CpoCfFSzNzGtMVQTQ= dependencies: callsites "^2.0.0" caller-path@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/caller-path/-/caller-path-2.0.0.tgz#468f83044e369ab2010fac5f06ceee15bb2cb1f4" + integrity sha1-Ro+DBE42mrIBD6xfBs7uFbsssfQ= dependencies: caller-callsite "^2.0.0" callsites@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/callsites/-/callsites-2.0.0.tgz#06eb84f00eea413da86affefacbffb36093b3c50" + integrity sha1-BuuE8A7qQT2oav/vrL/7Ngk7PFA= callsites@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/callsites/-/callsites-3.0.0.tgz#fb7eb569b72ad7a45812f93fd9430a3e410b3dd3" - -camel-case@3.0.x: - version "3.0.0" - resolved "https://registry.yarnpkg.com/camel-case/-/camel-case-3.0.0.tgz#ca3c3688a4e9cf3a4cda777dc4dcbc713249cf73" - dependencies: - no-case "^2.2.0" - upper-case "^1.1.1" + version "3.1.0" + resolved "https://registry.yarnpkg.com/callsites/-/callsites-3.1.0.tgz#b3630abd8943432f54b3f0519238e33cd7df2f73" + integrity sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ== camelcase-keys@^2.0.0: version "2.1.0" resolved "https://registry.yarnpkg.com/camelcase-keys/-/camelcase-keys-2.1.0.tgz#308beeaffdf28119051efa1d932213c91b8f92e7" + integrity sha1-MIvur/3ygRkFHvodkyITyRuPkuc= dependencies: camelcase "^2.0.0" map-obj "^1.0.0" @@ -2745,56 +2968,53 @@ camelcase-keys@^2.0.0: camelcase-keys@^4.0.0: version "4.2.0" resolved "https://registry.yarnpkg.com/camelcase-keys/-/camelcase-keys-4.2.0.tgz#a2aa5fb1af688758259c32c141426d78923b9b77" + integrity sha1-oqpfsa9oh1glnDLBQUJteJI7m3c= dependencies: camelcase "^4.1.0" map-obj "^2.0.0" quick-lru "^1.0.0" -camelcase@^1.0.2: - version "1.2.1" - resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-1.2.1.tgz#9bb5304d2e0b56698b2c758b08a3eaa9daa58a39" - camelcase@^2.0.0: version "2.1.1" resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-2.1.1.tgz#7c1d16d679a1bbe59ca02cacecfb011e201f5a1f" + integrity sha1-fB0W1nmhu+WcoCys7PsBHiAfWh8= camelcase@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-3.0.0.tgz#32fc4b9fcdaf845fcdf7e73bb97cac2261f0ab0a" + integrity sha1-MvxLn82vhF/N9+c7uXysImHwqwo= camelcase@^4.1.0: version "4.1.0" resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-4.1.0.tgz#d545635be1e33c542649c69173e5de6acfae34dd" + integrity sha1-1UVjW+HjPFQmScaRc+Xeas+uNN0= -camelcase@^5.0.0: - version "5.0.0" - resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-5.0.0.tgz#03295527d58bd3cd4aa75363f35b2e8d97be2f42" +camelcase@^5.0.0, camelcase@^5.3.1: + version "5.3.1" + resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-5.3.1.tgz#e3c9b31569e106811df242f715725a1f4c494320" + integrity sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg== -caniuse-lite@^1.0.30000967: - version "1.0.30000967" - resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30000967.tgz#a5039577806fccee80a04aaafb2c0890b1ee2f73" - integrity sha512-rUBIbap+VJfxTzrM4akJ00lkvVb5/n5v3EGXfWzSH5zT8aJmGzjA8HWhJ4U6kCpzxozUSnB+yvAYDRPY6mRpgQ== +caniuse-lite@^1.0.30001015: + version "1.0.30001015" + resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001015.tgz#15a7ddf66aba786a71d99626bc8f2b91c6f0f5f0" + integrity sha512-/xL2AbW/XWHNu1gnIrO8UitBGoFthcsDgU9VLK1/dpsoxbaD5LscHozKze05R6WLsBvLhqv78dAPozMFQBYLbQ== -capture-exit@^1.2.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/capture-exit/-/capture-exit-1.2.0.tgz#1c5fcc489fd0ab00d4f1ac7ae1072e3173fbab6f" +capture-exit@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/capture-exit/-/capture-exit-2.0.0.tgz#fb953bfaebeb781f62898239dabb426d08a509a4" + integrity sha512-PiT/hQmTonHhl/HFGN+Lx3JJUznrVYJ3+AQsnthneZbvW7x+f08Tk7yLJTLEOUvBTbduLeeBkxEaYXUOUrRq6g== dependencies: - rsvp "^3.3.3" + rsvp "^4.8.4" caseless@~0.12.0: version "0.12.0" resolved "https://registry.yarnpkg.com/caseless/-/caseless-0.12.0.tgz#1b681c21ff84033c826543090689420d187151dc" - -center-align@^0.1.1: - version "0.1.3" - resolved "https://registry.yarnpkg.com/center-align/-/center-align-0.1.3.tgz#aa0d32629b6ee972200411cbd4461c907bc2b7ad" - dependencies: - align-text "^0.1.3" - lazy-cache "^1.0.3" + integrity sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw= chalk@^1.0.0, chalk@^1.1.3: version "1.1.3" resolved "https://registry.yarnpkg.com/chalk/-/chalk-1.1.3.tgz#a8115c55e4a702fe4d150abd3872822a7e09fc98" + integrity sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg= dependencies: ansi-styles "^2.2.1" escape-string-regexp "^1.0.2" @@ -2802,7 +3022,7 @@ chalk@^1.0.0, chalk@^1.1.3: strip-ansi "^3.0.0" supports-color "^2.0.0" -chalk@^2.0.0, chalk@^2.0.1, chalk@^2.1.0, chalk@^2.3.0, chalk@^2.3.1, chalk@^2.4.1, chalk@^2.4.2: +chalk@^2.0.0, chalk@^2.0.1, chalk@^2.1.0, chalk@^2.3.1, chalk@^2.4.1, chalk@^2.4.2: version "2.4.2" resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.4.2.tgz#cd42541677a54333cf541a49108c1432b44c9424" integrity sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ== @@ -2814,26 +3034,17 @@ chalk@^2.0.0, chalk@^2.0.1, chalk@^2.1.0, chalk@^2.3.0, chalk@^2.3.1, chalk@^2.4 charcodes@^0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/charcodes/-/charcodes-0.2.0.tgz#5208d327e6cc05f99eb80ffc814707572d1f14e4" + integrity sha512-Y4kiDb+AM4Ecy58YkuZrrSRJBDQdQ2L+NyS1vHHFtNtUjgutcZfx3yp1dAONI/oPaPmyGfCLx5CxL+zauIMyKQ== chardet@^0.7.0: version "0.7.0" resolved "https://registry.yarnpkg.com/chardet/-/chardet-0.7.0.tgz#90094849f0937f2eedc2425d0d28a9e5f0cbad9e" + integrity sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA== -cheerio@^1.0.0-rc.1: - version "1.0.0-rc.2" - resolved "https://registry.yarnpkg.com/cheerio/-/cheerio-1.0.0-rc.2.tgz#4b9f53a81b27e4d5dac31c0ffd0cfa03cc6830db" - dependencies: - css-select "~1.2.0" - dom-serializer "~0.1.0" - entities "~1.1.1" - htmlparser2 "^3.9.1" - lodash "^4.15.0" - parse5 "^3.0.1" - -chokidar@^2.0.0, chokidar@^2.0.2, chokidar@^2.0.4: - version "2.1.6" - resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-2.1.6.tgz#b6cad653a929e244ce8a834244164d241fa954c5" - integrity sha512-V2jUo67OKkc6ySiRpJrjlpJKl9kDuG+Xb8VgsGzb+aEouhgS1D0weyPU4lEzdAcsCAvrih2J2BqyXqHWvVLw5g== +chokidar@^2.0.0, chokidar@^2.1.8: + version "2.1.8" + resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-2.1.8.tgz#804b3a7b6a99358c3c5c61e71d8728f041cff917" + integrity sha512-ZmZUazfOzf0Nve7duiCKD23PFSCs4JPoYyccjUFF3aQkQadqBhfzhjkwBH2mNOG9cTBwhamM37EIsIkZw3nRgg== dependencies: anymatch "^2.0.0" async-each "^1.0.1" @@ -2849,21 +3060,20 @@ chokidar@^2.0.0, chokidar@^2.0.2, chokidar@^2.0.4: optionalDependencies: fsevents "^1.2.7" -chownr@^1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/chownr/-/chownr-1.1.1.tgz#54726b8b8fff4df053c42187e801fb4412df1494" - -ci-info@^1.0.0: - version "1.1.2" - resolved "https://registry.yarnpkg.com/ci-info/-/ci-info-1.1.2.tgz#03561259db48d0474c8bdc90f5b47b068b6bbfb4" +chownr@^1.1.1, chownr@^1.1.2: + version "1.1.3" + resolved "https://registry.yarnpkg.com/chownr/-/chownr-1.1.3.tgz#42d837d5239688d55f303003a508230fa6727142" + integrity sha512-i70fVHhmV3DtTl6nqvZOnIjbY0Pe4kAUjwHj8z0zAdgBtYrJyYwLKCCuRBQ5ppkyL0AkN7HKRnETdmdp1zqNXw== ci-info@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/ci-info/-/ci-info-2.0.0.tgz#67a9e964be31a51e15e5010d58e6f12834002f46" + integrity sha512-5tK7EtrZ0N+OLFMthtqOj4fI2Jeb88C4CAZPu25LDVUgXJ0A3Js4PMGqrn0JU1W0Mh1/Z8wZzYPxqUrXeBboCQ== cipher-base@^1.0.0, cipher-base@^1.0.1, cipher-base@^1.0.3: version "1.0.4" resolved "https://registry.yarnpkg.com/cipher-base/-/cipher-base-1.0.4.tgz#8760e4ecc272f4c363532f926d874aae2c1397de" + integrity sha512-Kkht5ye6ZGmwv40uUDZztayT2ThLQGfnj/T71N/XzeZeo3nf8foyW7zGTsPYkEya3m5f3cAypH+qe7YOrM1U2Q== dependencies: inherits "^2.0.1" safe-buffer "^5.0.1" @@ -2871,27 +3081,36 @@ cipher-base@^1.0.0, cipher-base@^1.0.1, cipher-base@^1.0.3: class-utils@^0.3.5: version "0.3.6" resolved "https://registry.yarnpkg.com/class-utils/-/class-utils-0.3.6.tgz#f93369ae8b9a7ce02fd41faad0ca83033190c463" + integrity sha512-qOhPa/Fj7s6TY8H8esGu5QNpMMQxz79h+urzrNYN6mn+9BnxlDGf5QZ+XeCDsxSjPqsSR56XOZOJmpeurnLMeg== dependencies: arr-union "^3.1.0" define-property "^0.2.5" isobject "^3.0.0" static-extend "^0.1.1" -clean-css@4.1.x: - version "4.1.9" - resolved "https://registry.yarnpkg.com/clean-css/-/clean-css-4.1.9.tgz#35cee8ae7687a49b98034f70de00c4edd3826301" - dependencies: - source-map "0.5.x" +clean-stack@^2.0.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/clean-stack/-/clean-stack-2.2.0.tgz#ee8472dbb129e727b31e8a10a427dee9dfe4008b" + integrity sha512-4diC9HaTE+KRAMWhDhrGOECgWZxoevMc5TlkObMqNSsVU62PYzXZ/SMTjzyGAFF1YusgxGcSWTEXBhp0CPwQ1A== cli-cursor@^2.0.0, cli-cursor@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/cli-cursor/-/cli-cursor-2.1.0.tgz#b35dac376479facc3e94747d41d0d0f5238ffcb5" + integrity sha1-s12sN2R5+sw+lHR9QdDQ9SOP/LU= dependencies: restore-cursor "^2.0.0" +cli-cursor@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/cli-cursor/-/cli-cursor-3.1.0.tgz#264305a7ae490d1d03bf0c9ba7c925d1753af307" + integrity sha512-I/zHAwsKf9FqGoXM4WWRACob9+SNukZTd94DWF57E4toouRulbCxcUh6RKUEOQlYTHJnzkPMySvPNaaSLNfLZw== + dependencies: + restore-cursor "^3.1.0" + cli-truncate@^0.2.1: version "0.2.1" resolved "https://registry.yarnpkg.com/cli-truncate/-/cli-truncate-0.2.1.tgz#9f15cfbb0705005369216c626ac7d05ab90dd574" + integrity sha1-nxXPuwcFAFNpIWxiasfQWrkN1XQ= dependencies: slice-ansi "0.0.4" string-width "^1.0.1" @@ -2899,77 +3118,88 @@ cli-truncate@^0.2.1: cli-width@^2.0.0: version "2.2.0" resolved "https://registry.yarnpkg.com/cli-width/-/cli-width-2.2.0.tgz#ff19ede8a9a5e579324147b0c11f0fbcbabed639" - -cliui@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/cliui/-/cliui-2.1.0.tgz#4b475760ff80264c762c3a1719032e91c7fea0d1" - dependencies: - center-align "^0.1.1" - right-align "^0.1.1" - wordwrap "0.0.2" + integrity sha1-/xnt6Kml5XkyQUewwR8PvLq+1jk= cliui@^3.2.0: version "3.2.0" resolved "https://registry.yarnpkg.com/cliui/-/cliui-3.2.0.tgz#120601537a916d29940f934da3b48d585a39213d" + integrity sha1-EgYBU3qRbSmUD5NNo7SNWFo5IT0= dependencies: string-width "^1.0.1" strip-ansi "^3.0.1" wrap-ansi "^2.0.0" -cliui@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/cliui/-/cliui-4.0.0.tgz#743d4650e05f36d1ed2575b59638d87322bfbbcc" +cliui@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/cliui/-/cliui-5.0.0.tgz#deefcfdb2e800784aa34f46fa08e06851c7bbbc5" + integrity sha512-PYeGSEmmHM6zvoef2w8TPzlrnNpXIjTipYK780YswmIP9vjxmd6Y2a3CB2Ks6/AU8NHjZugXvo8w3oWM2qnwXA== dependencies: - string-width "^2.1.1" - strip-ansi "^4.0.0" - wrap-ansi "^2.0.0" + string-width "^3.1.0" + strip-ansi "^5.2.0" + wrap-ansi "^5.1.0" clone-buffer@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/clone-buffer/-/clone-buffer-1.0.0.tgz#e3e25b207ac4e701af721e2cb5a16792cac3dc58" + integrity sha1-4+JbIHrE5wGvch4staFnksrD3Fg= + +clone-deep@^4.0.1: + version "4.0.1" + resolved "https://registry.yarnpkg.com/clone-deep/-/clone-deep-4.0.1.tgz#c19fd9bdbbf85942b4fd979c84dcf7d5f07c2387" + integrity sha512-neHB9xuzh/wk0dIHweyAXv2aPGZIVk3pLMe+/RNzINf17fe0OG96QroktYAUm7SM1PBnzTabaLboqqxDyMU+SQ== + dependencies: + is-plain-object "^2.0.4" + kind-of "^6.0.2" + shallow-clone "^3.0.0" clone-stats@^0.0.1: version "0.0.1" resolved "https://registry.yarnpkg.com/clone-stats/-/clone-stats-0.0.1.tgz#b88f94a82cf38b8791d58046ea4029ad88ca99d1" + integrity sha1-uI+UqCzzi4eR1YBG6kAprYjKmdE= clone-stats@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/clone-stats/-/clone-stats-1.0.0.tgz#b3782dff8bb5474e18b9b6bf0fdfe782f8777680" + integrity sha1-s3gt/4u1R04Yuba/D9/ngvh3doA= clone@^1.0.0, clone@^1.0.2: - version "1.0.3" - resolved "https://registry.yarnpkg.com/clone/-/clone-1.0.3.tgz#298d7e2231660f40c003c2ed3140decf3f53085f" + version "1.0.4" + resolved "https://registry.yarnpkg.com/clone/-/clone-1.0.4.tgz#da309cc263df15994c688ca902179ca3c7cd7c7e" + integrity sha1-2jCcwmPfFZlMaIypAheco8fNfH4= clone@^2.1.1: - version "2.1.1" - resolved "https://registry.yarnpkg.com/clone/-/clone-2.1.1.tgz#d217d1e961118e3ac9a4b8bba3285553bf647cdb" + version "2.1.2" + resolved "https://registry.yarnpkg.com/clone/-/clone-2.1.2.tgz#1b7f4b9f591f1e8f83670401600345a02887435f" + integrity sha1-G39Ln1kfHo+DZwQBYANFoCiHQ18= + +clone@~0.1.9: + version "0.1.19" + resolved "https://registry.yarnpkg.com/clone/-/clone-0.1.19.tgz#613fb68639b26a494ac53253e15b1a6bd88ada85" + integrity sha1-YT+2hjmyaklKxTJT4Vsaa9iK2oU= cloneable-readable@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/cloneable-readable/-/cloneable-readable-1.0.0.tgz#a6290d413f217a61232f95e458ff38418cfb0117" + version "1.1.3" + resolved "https://registry.yarnpkg.com/cloneable-readable/-/cloneable-readable-1.1.3.tgz#120a00cb053bfb63a222e709f9683ea2e11d8cec" + integrity sha512-2EF8zTQOxYq70Y4XKtorQupqF0m49MBz2/yf5Bj+MHjvpG3Hy7sImifnqD6UA+TKYxeSV+u6qqQPawN5UvnpKQ== dependencies: inherits "^2.0.1" - process-nextick-args "^1.0.6" - through2 "^2.0.1" - -cmd-shim@^2.0.2: - version "2.0.2" - resolved "https://registry.yarnpkg.com/cmd-shim/-/cmd-shim-2.0.2.tgz#6fcbda99483a8fd15d7d30a196ca69d688a2efdb" - dependencies: - graceful-fs "^4.1.2" - mkdirp "~0.5.0" + process-nextick-args "^2.0.0" + readable-stream "^2.3.5" co@^4.6.0: version "4.6.0" resolved "https://registry.yarnpkg.com/co/-/co-4.6.0.tgz#6ea6bdf3d853ae54ccb8e47bfa0bf3f9031fb184" + integrity sha1-bqa989hTrlTMuOR7+gvz+QMfsYQ= code-point-at@^1.0.0: version "1.1.0" resolved "https://registry.yarnpkg.com/code-point-at/-/code-point-at-1.1.0.tgz#0d070b4d043a5bea33a2f1a40e2edb3d9a4ccf77" + integrity sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c= collection-map@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/collection-map/-/collection-map-1.0.0.tgz#aea0f06f8d26c780c2b75494385544b2255af18c" + integrity sha1-rqDwb40mx4DCt1SUOFVEsiVa8Yw= dependencies: arr-map "^2.0.2" for-own "^1.0.0" @@ -2978,154 +3208,164 @@ collection-map@^1.0.0: collection-visit@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/collection-visit/-/collection-visit-1.0.0.tgz#4bc0373c164bc3291b4d368c829cf1a80a59dca0" + integrity sha1-S8A3PBZLwykbTTaMgpzxqApZ3KA= dependencies: map-visit "^1.0.0" object-visit "^1.0.0" color-convert@^1.9.0: - version "1.9.1" - resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-1.9.1.tgz#c1261107aeb2f294ebffec9ed9ecad529a6097ed" + version "1.9.3" + resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-1.9.3.tgz#bb71850690e1f136567de629d2d5471deda4c1e8" + integrity sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg== dependencies: - color-name "^1.1.1" + color-name "1.1.3" -color-name@^1.1.1: +color-name@1.1.3: version "1.1.3" resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.3.tgz#a7d0558bd89c42f795dd42328f740831ca53bc25" + integrity sha1-p9BVi9icQveV3UIyj3QIMcpTvCU= color-support@^1.1.3: version "1.1.3" resolved "https://registry.yarnpkg.com/color-support/-/color-support-1.1.3.tgz#93834379a1cc9a0c61f82f52f0d04322251bd5a2" + integrity sha512-qiBjkpbMLO/HL68y+lh4q0/O1MZFj2RX6X/KmMa3+gJD3z+WwI1ZzDHysvqHGS3mP6mznPckpXmw1nI9cJjyRg== columnify@^1.5.4: version "1.5.4" resolved "https://registry.yarnpkg.com/columnify/-/columnify-1.5.4.tgz#4737ddf1c7b69a8a7c340570782e947eec8e78bb" + integrity sha1-Rzfd8ce2mop8NAVweC6UfuyOeLs= dependencies: strip-ansi "^3.0.0" wcwidth "^1.0.0" -combine-source-map@~0.6.1: - version "0.6.1" - resolved "https://registry.yarnpkg.com/combine-source-map/-/combine-source-map-0.6.1.tgz#9b4a09c316033d768e0f11e029fa2730e079ad96" - dependencies: - convert-source-map "~1.1.0" - inline-source-map "~0.5.0" - lodash.memoize "~3.0.3" - source-map "~0.4.2" - -combine-source-map@~0.7.1: - version "0.7.2" - resolved "https://registry.yarnpkg.com/combine-source-map/-/combine-source-map-0.7.2.tgz#0870312856b307a87cc4ac486f3a9a62aeccc09e" +combine-source-map@^0.8.0, combine-source-map@~0.8.0: + version "0.8.0" + resolved "https://registry.yarnpkg.com/combine-source-map/-/combine-source-map-0.8.0.tgz#a58d0df042c186fcf822a8e8015f5450d2d79a8b" + integrity sha1-pY0N8ELBhvz4IqjoAV9UUNLXmos= dependencies: convert-source-map "~1.1.0" inline-source-map "~0.6.0" lodash.memoize "~3.0.3" source-map "~0.5.3" -combine-source-map@~0.8.0: - version "0.8.0" - resolved "https://registry.yarnpkg.com/combine-source-map/-/combine-source-map-0.8.0.tgz#a58d0df042c186fcf822a8e8015f5450d2d79a8b" +combine-source-map@~0.6.1: + version "0.6.1" + resolved "https://registry.yarnpkg.com/combine-source-map/-/combine-source-map-0.6.1.tgz#9b4a09c316033d768e0f11e029fa2730e079ad96" + integrity sha1-m0oJwxYDPXaODxHgKfonMOB5rZY= dependencies: convert-source-map "~1.1.0" - inline-source-map "~0.6.0" + inline-source-map "~0.5.0" lodash.memoize "~3.0.3" - source-map "~0.5.3" + source-map "~0.4.2" combined-stream@^1.0.6, combined-stream@~1.0.6: - version "1.0.7" - resolved "https://registry.yarnpkg.com/combined-stream/-/combined-stream-1.0.7.tgz#2d1d24317afb8abe95d6d2c0b07b57813539d828" + version "1.0.8" + resolved "https://registry.yarnpkg.com/combined-stream/-/combined-stream-1.0.8.tgz#c3d45a8b34fd730631a110a8a2520682b31d5a7f" + integrity sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg== dependencies: delayed-stream "~1.0.0" -commander@2.14.x, commander@^2.14.1, commander@^2.8.1, commander@^2.9.0, commander@~2.14.1: - version "2.14.1" - resolved "https://registry.yarnpkg.com/commander/-/commander-2.14.1.tgz#2235123e37af8ca3c65df45b026dbd357b01b9aa" +commander@^2.20.0, commander@~2.20.3: + version "2.20.3" + resolved "https://registry.yarnpkg.com/commander/-/commander-2.20.3.tgz#fd485e84c03eb4881c20722ba48035e8531aeb33" + integrity sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ== + +commander@^4.0.1: + version "4.0.1" + resolved "https://registry.yarnpkg.com/commander/-/commander-4.0.1.tgz#b67622721785993182e807f4883633e6401ba53c" + integrity sha512-IPF4ouhCP+qdlcmCedhxX4xiGBPyigb8v5NeUp+0LyhwLgxMqyp3S0vl7TAPfS/hiP7FC3caI/PB9lTmP8r1NA== commondir@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/commondir/-/commondir-1.0.1.tgz#ddd800da0c66127393cca5950ea968a3aaf1253b" + integrity sha1-3dgA2gxmEnOTzKWVDqloo6rxJTs= compare-func@^1.3.1: version "1.3.2" resolved "https://registry.yarnpkg.com/compare-func/-/compare-func-1.3.2.tgz#99dd0ba457e1f9bc722b12c08ec33eeab31fa648" + integrity sha1-md0LpFfh+bxyKxLAjsM+6rMfpkg= dependencies: array-ify "^1.0.0" dot-prop "^3.0.0" component-emitter@^1.2.1: - version "1.2.1" - resolved "https://registry.yarnpkg.com/component-emitter/-/component-emitter-1.2.1.tgz#137918d6d78283f7df7a6b7c5a63e140e69425e6" + version "1.3.0" + resolved "https://registry.yarnpkg.com/component-emitter/-/component-emitter-1.3.0.tgz#16e4070fba8ae29b679f2215853ee181ab2eabc0" + integrity sha512-Rd3se6QB+sO1TwqZjscQrurpEPIfO0/yYnSin6Q/rD3mOutHvUrCAhJub3r90uNb+SESBuE0QYoB90YdfatsRg== concat-map@0.0.1: version "0.0.1" resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" + integrity sha1-2Klr13/Wjfd5OnMDajug1UBdR3s= -concat-stream@^1.4.6, concat-stream@^1.5.0, concat-stream@^1.6.0, concat-stream@~1.6.0: +concat-stream@^1.4.4, concat-stream@^1.4.6, concat-stream@^1.5.0, concat-stream@^1.6.0, concat-stream@^1.6.1, concat-stream@~1.6.0: version "1.6.2" resolved "https://registry.yarnpkg.com/concat-stream/-/concat-stream-1.6.2.tgz#904bdf194cd3122fc675c77fc4ac3d4ff0fd1a34" + integrity sha512-27HBghJxjiZtIk3Ycvn/4kbJk/1uZuJFfuPEns6LaEvpvG1f0hTea8lilrouyo9mVc2GWdcEZ8OLoGmSADlrCw== dependencies: buffer-from "^1.0.0" inherits "^2.0.3" readable-stream "^2.2.2" typedarray "^0.0.6" -concat-stream@~1.5.1: - version "1.5.2" - resolved "https://registry.yarnpkg.com/concat-stream/-/concat-stream-1.5.2.tgz#708978624d856af41a5a741defdd261da752c266" +concat-stream@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/concat-stream/-/concat-stream-2.0.0.tgz#414cf5af790a48c60ab9be4527d56d5e41133cb1" + integrity sha512-MWufYdFw53ccGjCA+Ol7XJYpAlW6/prSMzuPOTRnJGcGzuhLn4Scrz7qf6o8bROZ514ltazcIFJZevcfbo0x7A== dependencies: - inherits "~2.0.1" - readable-stream "~2.0.0" - typedarray "~0.0.5" + buffer-from "^1.0.0" + inherits "^2.0.3" + readable-stream "^3.0.2" + typedarray "^0.0.6" config-chain@^1.1.11: version "1.1.12" resolved "https://registry.yarnpkg.com/config-chain/-/config-chain-1.1.12.tgz#0fde8d091200eb5e808caf25fe618c02f48e4efa" + integrity sha512-a1eOIcu8+7lUInge4Rpf/n4Krkf3Dd9lqhljRzII1/Zno/kRtUWnznPO3jOKBmTEktkt3fkxisUcivoj0ebzoA== dependencies: ini "^1.3.4" proto-list "~1.2.1" console-browserify@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/console-browserify/-/console-browserify-1.1.0.tgz#f0241c45730a9fc6323b206dbf38edc741d0bb10" - dependencies: - date-now "^0.1.4" + version "1.2.0" + resolved "https://registry.yarnpkg.com/console-browserify/-/console-browserify-1.2.0.tgz#67063cef57ceb6cf4993a2ab3a55840ae8c49336" + integrity sha512-ZMkYO/LkF17QvCPqM0gxw8yUzigAOZOSWSHg91FH6orS7vcEj5dVZTidN2fQ14yBSdg97RqhSNwLUXInd52OTA== console-control-strings@^1.0.0, console-control-strings@~1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/console-control-strings/-/console-control-strings-1.1.0.tgz#3d7cf4464db6446ea644bf4b39507f9851008e8e" + integrity sha1-PXz0Rk22RG6mRL9LOVB/mFEAjo4= -constants-browserify@^1.0.0, constants-browserify@~1.0.0: +constants-browserify@~1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/constants-browserify/-/constants-browserify-1.0.0.tgz#c20b96d8c617748aaf1c16021760cd27fcb8cb75" + integrity sha1-wguW2MYXdIqvHBYCF2DNJ/y4y3U= contains-path@^0.1.0: version "0.1.0" resolved "https://registry.yarnpkg.com/contains-path/-/contains-path-0.1.0.tgz#fe8cf184ff6670b6baef01a9d4861a5cbec4120a" integrity sha1-/ozxhP9mcLa67wGp1IYaXL7EEgo= -content-type-parser@^1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/content-type-parser/-/content-type-parser-1.0.2.tgz#caabe80623e63638b2502fd4c7f12ff4ce2352e7" - conventional-changelog-angular@^5.0.3: - version "5.0.3" - resolved "https://registry.yarnpkg.com/conventional-changelog-angular/-/conventional-changelog-angular-5.0.3.tgz#299fdd43df5a1f095283ac16aeedfb0a682ecab0" - integrity sha512-YD1xzH7r9yXQte/HF9JBuEDfvjxxwDGGwZU1+ndanbY0oFgA+Po1T9JDSpPLdP0pZT6MhCAsdvFKC4TJ4MTJTA== + version "5.0.6" + resolved "https://registry.yarnpkg.com/conventional-changelog-angular/-/conventional-changelog-angular-5.0.6.tgz#269540c624553aded809c29a3508fdc2b544c059" + integrity sha512-QDEmLa+7qdhVIv8sFZfVxU1VSyVvnXPsxq8Vam49mKUcO1Z8VTLEJk9uI21uiJUsnmm0I4Hrsdc9TgkOQo9WSA== dependencies: compare-func "^1.3.1" q "^1.5.1" conventional-changelog-core@^3.1.6: - version "3.2.2" - resolved "https://registry.yarnpkg.com/conventional-changelog-core/-/conventional-changelog-core-3.2.2.tgz#de41e6b4a71011a18bcee58e744f6f8f0e7c29c0" - integrity sha512-cssjAKajxaOX5LNAJLB+UOcoWjAIBvXtDMedv/58G+YEmAXMNfC16mmPl0JDOuVJVfIqM0nqQiZ8UCm8IXbE0g== + version "3.2.3" + resolved "https://registry.yarnpkg.com/conventional-changelog-core/-/conventional-changelog-core-3.2.3.tgz#b31410856f431c847086a7dcb4d2ca184a7d88fb" + integrity sha512-LMMX1JlxPIq/Ez5aYAYS5CpuwbOk6QFp8O4HLAcZxe3vxoCtABkhfjetk8IYdRB9CDQGwJFLR3Dr55Za6XKgUQ== dependencies: - conventional-changelog-writer "^4.0.5" - conventional-commits-parser "^3.0.2" + conventional-changelog-writer "^4.0.6" + conventional-commits-parser "^3.0.3" dateformat "^3.0.0" get-pkg-repo "^1.0.0" git-raw-commits "2.0.0" git-remote-origin-url "^2.0.0" - git-semver-tags "^2.0.2" + git-semver-tags "^2.0.3" lodash "^4.2.1" normalize-package-data "^2.3.5" q "^1.5.1" @@ -3133,27 +3373,28 @@ conventional-changelog-core@^3.1.6: read-pkg-up "^3.0.0" through2 "^3.0.0" -conventional-changelog-preset-loader@^2.0.2: - version "2.0.2" - resolved "https://registry.yarnpkg.com/conventional-changelog-preset-loader/-/conventional-changelog-preset-loader-2.0.2.tgz#81d1a07523913f3d17da3a49f0091f967ad345b0" +conventional-changelog-preset-loader@^2.1.1: + version "2.3.0" + resolved "https://registry.yarnpkg.com/conventional-changelog-preset-loader/-/conventional-changelog-preset-loader-2.3.0.tgz#580fa8ab02cef22c24294d25e52d7ccd247a9a6a" + integrity sha512-/rHb32J2EJnEXeK4NpDgMaAVTFZS3o1ExmjKMtYVgIC4MQn0vkNSbYpdGRotkfGGRWiqk3Ri3FBkiZGbAfIfOQ== -conventional-changelog-writer@^4.0.5: - version "4.0.5" - resolved "https://registry.yarnpkg.com/conventional-changelog-writer/-/conventional-changelog-writer-4.0.5.tgz#fb9e384bb294e8e8a9f2568a3f4d1e11953d8641" - integrity sha512-g/Myp4MaJ1A+f7Ai+SnVhkcWtaHk6flw0SYN7A+vQ+MTu0+gSovQWs4Pg4NtcNUcIztYQ9YHsoxHP+GGQplI7Q== +conventional-changelog-writer@^4.0.6: + version "4.0.11" + resolved "https://registry.yarnpkg.com/conventional-changelog-writer/-/conventional-changelog-writer-4.0.11.tgz#9f56d2122d20c96eb48baae0bf1deffaed1edba4" + integrity sha512-g81GQOR392I+57Cw3IyP1f+f42ME6aEkbR+L7v1FBBWolB0xkjKTeCWVguzRrp6UiT1O6gBpJbEy2eq7AnV1rw== dependencies: compare-func "^1.3.1" conventional-commits-filter "^2.0.2" dateformat "^3.0.0" - handlebars "^4.1.0" + handlebars "^4.4.0" json-stringify-safe "^5.0.1" - lodash "^4.2.1" - meow "^4.0.0" - semver "^5.5.0" + lodash "^4.17.15" + meow "^5.0.0" + semver "^6.0.0" split "^1.0.0" through2 "^3.0.0" -conventional-commits-filter@^2.0.1, conventional-commits-filter@^2.0.2: +conventional-commits-filter@^2.0.2: version "2.0.2" resolved "https://registry.yarnpkg.com/conventional-commits-filter/-/conventional-commits-filter-2.0.2.tgz#f122f89fbcd5bb81e2af2fcac0254d062d1039c1" integrity sha512-WpGKsMeXfs21m1zIw4s9H5sys2+9JccTzpN6toXtxhpw2VNF2JUXwIakthKBy+LN4DvJm+TzWhxOMWOs1OFCFQ== @@ -3161,43 +3402,49 @@ conventional-commits-filter@^2.0.1, conventional-commits-filter@^2.0.2: lodash.ismatch "^4.4.0" modify-values "^1.0.0" -conventional-commits-parser@^3.0.1, conventional-commits-parser@^3.0.2: - version "3.0.2" - resolved "https://registry.yarnpkg.com/conventional-commits-parser/-/conventional-commits-parser-3.0.2.tgz#1295590dd195f64f53d6f8eb7c41114bb9a60742" - integrity sha512-y5eqgaKR0F6xsBNVSQ/5cI5qIF3MojddSUi1vKIggRkqUTbkqFKH9P5YX/AT1BVZp9DtSzBTIkvjyVLotLsVog== +conventional-commits-parser@^3.0.3: + version "3.0.8" + resolved "https://registry.yarnpkg.com/conventional-commits-parser/-/conventional-commits-parser-3.0.8.tgz#23310a9bda6c93c874224375e72b09fb275fe710" + integrity sha512-YcBSGkZbYp7d+Cr3NWUeXbPDFUN6g3SaSIzOybi8bjHL5IJ5225OSCxJJ4LgziyEJ7AaJtE9L2/EU6H7Nt/DDQ== dependencies: JSONStream "^1.0.4" - is-text-path "^1.0.0" - lodash "^4.2.1" - meow "^4.0.0" + is-text-path "^1.0.1" + lodash "^4.17.15" + meow "^5.0.0" split2 "^2.0.0" through2 "^3.0.0" trim-off-newlines "^1.0.0" -conventional-recommended-bump@^4.0.4: - version "4.0.4" - resolved "https://registry.yarnpkg.com/conventional-recommended-bump/-/conventional-recommended-bump-4.0.4.tgz#05540584641d3da758c8863c09788fcaeb586872" +conventional-recommended-bump@^5.0.0: + version "5.0.1" + resolved "https://registry.yarnpkg.com/conventional-recommended-bump/-/conventional-recommended-bump-5.0.1.tgz#5af63903947b6e089e77767601cb592cabb106ba" + integrity sha512-RVdt0elRcCxL90IrNP0fYCpq1uGt2MALko0eyeQ+zQuDVWtMGAy9ng6yYn3kax42lCj9+XBxQ8ZN6S9bdKxDhQ== dependencies: - concat-stream "^1.6.0" - conventional-changelog-preset-loader "^2.0.2" - conventional-commits-filter "^2.0.1" - conventional-commits-parser "^3.0.1" + concat-stream "^2.0.0" + conventional-changelog-preset-loader "^2.1.1" + conventional-commits-filter "^2.0.2" + conventional-commits-parser "^3.0.3" git-raw-commits "2.0.0" - git-semver-tags "^2.0.2" + git-semver-tags "^2.0.3" meow "^4.0.0" q "^1.5.1" -convert-source-map@^1.1.0, convert-source-map@^1.4.0, convert-source-map@^1.5.0: - version "1.5.1" - resolved "https://registry.yarnpkg.com/convert-source-map/-/convert-source-map-1.5.1.tgz#b8278097b9bc229365de5c62cf5fcaed8b5599e5" +convert-source-map@^1.1.0, convert-source-map@^1.4.0, convert-source-map@^1.5.0, convert-source-map@^1.7.0: + version "1.7.0" + resolved "https://registry.yarnpkg.com/convert-source-map/-/convert-source-map-1.7.0.tgz#17a2cb882d7f77d3490585e2ce6c524424a3a442" + integrity sha512-4FJkXzKXEDB1snCFZlLP4gpC3JILicCpGbzG9f9G7tGqGCzETQ2hWPrcinA9oU4wtf2biUaEH5065UnMeR33oA== + dependencies: + safe-buffer "~5.1.1" convert-source-map@~1.1.0: version "1.1.3" resolved "https://registry.yarnpkg.com/convert-source-map/-/convert-source-map-1.1.3.tgz#4829c877e9fe49b3161f3bf3673888e204699860" + integrity sha1-SCnId+n+SbMWHzvzZziI4gRpmGA= copy-concurrently@^1.0.0: version "1.0.5" resolved "https://registry.yarnpkg.com/copy-concurrently/-/copy-concurrently-1.0.5.tgz#92297398cae34937fcafd6ec8139c18051f0b5e0" + integrity sha512-f2domd9fsVDFtaFcbaRZuYXwtdmnzqbADSwhSWYxYB/Q8zsdUUFMXVRwXGDMWmbEzAn1kdRrtI1T/KTFOL4X2A== dependencies: aproba "^1.1.1" fs-write-stream-atomic "^1.0.8" @@ -3209,38 +3456,30 @@ copy-concurrently@^1.0.0: copy-descriptor@^0.1.0: version "0.1.1" resolved "https://registry.yarnpkg.com/copy-descriptor/-/copy-descriptor-0.1.1.tgz#676f6eb3c39997c2ee1ac3a924fd6124748f578d" + integrity sha1-Z29us8OZl8LuGsOpJP1hJHSPV40= copy-props@^2.0.1: - version "2.0.2" - resolved "https://registry.yarnpkg.com/copy-props/-/copy-props-2.0.2.tgz#6151fc8fd47fd8703df00f53940a0ebfeb8c2162" + version "2.0.4" + resolved "https://registry.yarnpkg.com/copy-props/-/copy-props-2.0.4.tgz#93bb1cadfafd31da5bb8a9d4b41f471ec3a72dfe" + integrity sha512-7cjuUME+p+S3HZlbllgsn2CDwS+5eCCX16qBgNC4jgSTf49qR1VKy/Zhl400m0IQXl/bPGEVqncgUUMjrr4s8A== dependencies: each-props "^1.3.0" is-plain-object "^2.0.1" -core-js-compat@^3.1.1: - version "3.1.1" - resolved "https://registry.yarnpkg.com/core-js-compat/-/core-js-compat-3.1.1.tgz#a1ae7edd5b791066d6eaa969c1b62986b844fd42" - integrity sha512-RH3kv8NFovFRMdeTEUgu8nMquEWKEVttOY3JFi8mN75sg72zygPqWbpWNTUw4JYEU43562tlzhdWsWqXmdFAnQ== +core-js-compat@^3.4.7: + version "3.4.8" + resolved "https://registry.yarnpkg.com/core-js-compat/-/core-js-compat-3.4.8.tgz#f72e6a4ed76437ea710928f44615f926a81607d5" + integrity sha512-l3WTmnXHV2Sfu5VuD7EHE2w7y+K68+kULKt5RJg8ZJk3YhHF1qLD4O8v8AmNq+8vbOwnPFFDvds25/AoEvMqlQ== dependencies: - browserslist "^4.6.0" - core-js-pure "3.1.1" - semver "^6.0.0" - -core-js-pure@3.1.1: - version "3.1.1" - resolved "https://registry.yarnpkg.com/core-js-pure/-/core-js-pure-3.1.1.tgz#92494ab7bae22f156ae93973a5e2738814efa7f8" - integrity sha512-jH3ZJ0CJ0wwDvWY0olbOComLo6tbWg4kE2x0j4+wlqYnofwF9mYm98YvADuENUzGw69IddmWFCF1FQ2S0jP96A== - -core-js@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/core-js/-/core-js-3.0.0.tgz#a8dbfa978d29bfc263bfb66c556d0ca924c28957" - integrity sha512-WBmxlgH2122EzEJ6GH8o9L/FeoUKxxxZ6q6VUxoTlsE4EvbTWKJb447eyVxTEuq0LpXjlq/kCB2qgBvsYRkLvQ== + browserslist "^4.8.2" + semver "^6.3.0" core-util-is@1.0.2, core-util-is@~1.0.0: version "1.0.2" resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7" + integrity sha1-tf1UIgqivFq1eqtxQMlAdUUDwac= -cosmiconfig@^5.1.0, cosmiconfig@^5.2.0: +cosmiconfig@^5.1.0, cosmiconfig@^5.2.1: version "5.2.1" resolved "https://registry.yarnpkg.com/cosmiconfig/-/cosmiconfig-5.2.1.tgz#040f726809c591e77a17c0a3626ca45b4f168b1a" integrity sha512-H65gsXo1SKjf8zmrJ67eJk8aIRKV5ff2D4uKZIBZShbhGSpEmsQOPW/SKMKYhSTrqR7ufy6RP69rPogdaPh/kA== @@ -3251,24 +3490,28 @@ cosmiconfig@^5.1.0, cosmiconfig@^5.2.0: parse-json "^4.0.0" create-ecdh@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/create-ecdh/-/create-ecdh-4.0.0.tgz#888c723596cdf7612f6498233eebd7a35301737d" + version "4.0.3" + resolved "https://registry.yarnpkg.com/create-ecdh/-/create-ecdh-4.0.3.tgz#c9111b6f33045c4697f144787f9254cdc77c45ff" + integrity sha512-GbEHQPMOswGpKXM9kCWVrremUcBmjteUaQ01T9rkKCPDXfUHX0IoP9LpHYo2NPFampa4e+/pFDc3jQdxrxQLaw== dependencies: bn.js "^4.1.0" elliptic "^6.0.0" create-hash@^1.1.0, create-hash@^1.1.2: - version "1.1.3" - resolved "https://registry.yarnpkg.com/create-hash/-/create-hash-1.1.3.tgz#606042ac8b9262750f483caddab0f5819172d8fd" + version "1.2.0" + resolved "https://registry.yarnpkg.com/create-hash/-/create-hash-1.2.0.tgz#889078af11a63756bcfb59bd221996be3a9ef196" + integrity sha512-z00bCGNHDG8mHAkP7CtT1qVu+bFQUPjYq/4Iv3C3kWjTFV10zIjfSoeqXo9Asws8gwSHDGj/hl2u4OGIjapeCg== dependencies: cipher-base "^1.0.1" inherits "^2.0.1" - ripemd160 "^2.0.0" + md5.js "^1.3.4" + ripemd160 "^2.0.1" sha.js "^2.4.0" create-hmac@^1.1.0, create-hmac@^1.1.2, create-hmac@^1.1.4: - version "1.1.6" - resolved "https://registry.yarnpkg.com/create-hmac/-/create-hmac-1.1.6.tgz#acb9e221a4e17bdb076e90657c42b93e3726cf06" + version "1.1.7" + resolved "https://registry.yarnpkg.com/create-hmac/-/create-hmac-1.1.7.tgz#69170c78b3ab957147b2b8b04572e47ead2243ff" + integrity sha512-MJG9liiZ+ogc4TzUwuvbER1JRdgvUFSB5+VR/g5h82fGaIRWMWddtKBHi7/sVhfjQZ6SehlyhvQYrcYkaUIpLg== dependencies: cipher-base "^1.0.3" create-hash "^1.1.0" @@ -3277,17 +3520,10 @@ create-hmac@^1.1.0, create-hmac@^1.1.2, create-hmac@^1.1.4: safe-buffer "^5.0.1" sha.js "^2.4.8" -cross-spawn@^5.0.1: - version "5.1.0" - resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-5.1.0.tgz#e8bd0efee58fcff6f8f94510a0a554bbfa235449" - dependencies: - lru-cache "^4.0.1" - shebang-command "^1.2.0" - which "^1.2.9" - cross-spawn@^6.0.0, cross-spawn@^6.0.5: version "6.0.5" resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-6.0.5.tgz#4a5ec7c64dfae22c3a14124dbacdee846d80cbc4" + integrity sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ== dependencies: nice-try "^1.0.4" path-key "^2.0.1" @@ -3295,9 +3531,19 @@ cross-spawn@^6.0.0, cross-spawn@^6.0.5: shebang-command "^1.2.0" which "^1.2.9" +cross-spawn@^7.0.0: + version "7.0.1" + resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-7.0.1.tgz#0ab56286e0f7c24e153d04cc2aa027e43a9a5d14" + integrity sha512-u7v4o84SwFpD32Z8IIcPZ6z1/ie24O6RU3RbtL5Y316l3KuHVPx9ItBgWQ6VlfAFnRnTtMUrsQ9MUUTuEZjogg== + dependencies: + path-key "^3.1.0" + shebang-command "^2.0.0" + which "^2.0.1" + crypto-browserify@^3.0.0, crypto-browserify@^3.11.0: version "3.12.0" resolved "https://registry.yarnpkg.com/crypto-browserify/-/crypto-browserify-3.12.0.tgz#396cf9f3137f03e4b8e532c58f698254e00f80ec" + integrity sha512-fz4spIh+znjO2VjL+IdhEpRJ3YN6sMzITSBijk6FK2UvTqruSQW+/cCZTSNsMiZNvUeq0CqurF+dAbyiGOY6Wg== dependencies: browserify-cipher "^1.0.0" browserify-sign "^4.0.0" @@ -3311,161 +3557,193 @@ crypto-browserify@^3.0.0, crypto-browserify@^3.11.0: randombytes "^2.0.0" randomfill "^1.0.3" -css-select@~1.2.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/css-select/-/css-select-1.2.0.tgz#2b3a110539c5355f1cd8d314623e870b121ec858" - dependencies: - boolbase "~1.0.0" - css-what "2.1" - domutils "1.5.1" - nth-check "~1.0.1" - -css-what@2.1: - version "2.1.0" - resolved "https://registry.yarnpkg.com/css-what/-/css-what-2.1.0.tgz#9467d032c38cfaefb9f2d79501253062f87fa1bd" - cssom@0.3.x, "cssom@>= 0.3.2 < 0.4.0": - version "0.3.2" - resolved "https://registry.yarnpkg.com/cssom/-/cssom-0.3.2.tgz#b8036170c79f07a90ff2f16e22284027a243848b" + version "0.3.8" + resolved "https://registry.yarnpkg.com/cssom/-/cssom-0.3.8.tgz#9f1276f5b2b463f2114d3f2c75250af8c1a36f4a" + integrity sha512-b0tGHbfegbhPJpxpiBPU2sCkigAqtM9O121le6bbOlgyV+NyGyCmVfJ6QW9eRjz8CpNfWEOYBIMIGRYkLwsIYg== -"cssstyle@>= 0.2.37 < 0.3.0": - version "0.2.37" - resolved "https://registry.yarnpkg.com/cssstyle/-/cssstyle-0.2.37.tgz#541097234cb2513c83ceed3acddc27ff27987d54" +cssstyle@^1.0.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/cssstyle/-/cssstyle-1.4.0.tgz#9d31328229d3c565c61e586b02041a28fccdccf1" + integrity sha512-GBrLZYZ4X4x6/QEoBnIrqb8B/f5l4+8me2dkom/j1Gtbxy0kBv6OGzKuAsGM75bkGwGAFkt56Iwg28S3XTZgSA== dependencies: cssom "0.3.x" currently-unhandled@^0.4.1: version "0.4.1" resolved "https://registry.yarnpkg.com/currently-unhandled/-/currently-unhandled-0.4.1.tgz#988df33feab191ef799a61369dd76c17adf957ea" + integrity sha1-mI3zP+qxke95mmE2nddsF635V+o= dependencies: array-find-index "^1.0.1" -cyclist@~0.2.2: - version "0.2.2" - resolved "https://registry.yarnpkg.com/cyclist/-/cyclist-0.2.2.tgz#1b33792e11e914a2fd6d6ed6447464444e5fa640" +cyclist@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/cyclist/-/cyclist-1.0.1.tgz#596e9698fd0c80e12038c2b82d6eb1b35b6224d9" + integrity sha1-WW6WmP0MgOEgOMK4LW6xs1tiJNk= -d@1: - version "1.0.0" - resolved "https://registry.yarnpkg.com/d/-/d-1.0.0.tgz#754bb5bfe55451da69a58b94d45f4c5b0462d58f" +d@1, d@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/d/-/d-1.0.1.tgz#8698095372d58dbee346ffd0c7093f99f8f9eb5a" + integrity sha512-m62ShEObQ39CfralilEQRjH6oAMtNCV1xJyEx5LpRYUVN+EviphDgUc/F3hnYbADmkiNs67Y+3ylmlG7Lnu+FA== dependencies: - es5-ext "^0.10.9" + es5-ext "^0.10.50" + type "^1.0.1" dargs@^4.0.1: version "4.1.0" resolved "https://registry.yarnpkg.com/dargs/-/dargs-4.1.0.tgz#03a9dbb4b5c2f139bf14ae53f0b8a2a6a86f4e17" + integrity sha1-A6nbtLXC8Tm/FK5T8LiipqhvThc= dependencies: number-is-nan "^1.0.0" +dash-ast@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/dash-ast/-/dash-ast-1.0.0.tgz#12029ba5fb2f8aa6f0a861795b23c1b4b6c27d37" + integrity sha512-Vy4dx7gquTeMcQR/hDkYLGUnwVil6vk4FOOct+djUnHOUWt+zJPJAaRIXaAFkPXtJjvlY7o3rfRu0/3hpnwoUA== + dashdash@^1.12.0: version "1.14.1" resolved "https://registry.yarnpkg.com/dashdash/-/dashdash-1.14.1.tgz#853cfa0f7cbe2fed5de20326b8dd581035f6e2f0" + integrity sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA= dependencies: assert-plus "^1.0.0" -date-fns@^1.27.2: - version "1.29.0" - resolved "https://registry.yarnpkg.com/date-fns/-/date-fns-1.29.0.tgz#12e609cdcb935127311d04d33334e2960a2a54e6" +data-urls@^1.0.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/data-urls/-/data-urls-1.1.0.tgz#15ee0582baa5e22bb59c77140da8f9c76963bbfe" + integrity sha512-YTWYI9se1P55u58gL5GkQHW4P6VJBJ5iBT+B5a7i2Tjadhv52paJG0qHX4A0OR6/t52odI64KP2YvFpkDOi3eQ== + dependencies: + abab "^2.0.0" + whatwg-mimetype "^2.2.0" + whatwg-url "^7.0.0" -date-now@^0.1.4: - version "0.1.4" - resolved "https://registry.yarnpkg.com/date-now/-/date-now-0.1.4.tgz#eaf439fd4d4848ad74e5cc7dbef200672b9e345b" +date-fns@^1.27.2: + version "1.30.1" + resolved "https://registry.yarnpkg.com/date-fns/-/date-fns-1.30.1.tgz#2e71bf0b119153dbb4cc4e88d9ea5acfb50dc05c" + integrity sha512-hBSVCvSmWC+QypYObzwGOd9wqdDpOt+0wl0KbU+R+uuZBS1jN8VsD1ss3irQDknRj5NvxiTF6oj/nDRnN/UQNw== dateformat@^3.0.0: version "3.0.3" resolved "https://registry.yarnpkg.com/dateformat/-/dateformat-3.0.3.tgz#a6e37499a4d9a9cf85ef5872044d62901c9889ae" + integrity sha512-jyCETtSl3VMZMWeRo7iY1FL19ges1t55hMo5yaam4Jrsm5EPL89UQkoQRyiI+Yf4k8r2ZpdngkV8hr1lIdjb3Q== -debug@3.1.0, debug@^3.0.0, debug@^3.1.0: +debug@3.1.0: version "3.1.0" resolved "https://registry.yarnpkg.com/debug/-/debug-3.1.0.tgz#5bb5a0672628b64149566ba16819e61518c67261" + integrity sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g== dependencies: ms "2.0.0" -debug@^2.1.2, debug@^2.2.0, debug@^2.3.3, debug@^2.6.8, debug@^2.6.9: +debug@^2.2.0, debug@^2.3.3, debug@^2.6.9: version "2.6.9" resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.9.tgz#5d128515df134ff327e90a4c93f4e077a536341f" + integrity sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA== dependencies: ms "2.0.0" +debug@^3.1.0, debug@^3.2.6: + version "3.2.6" + resolved "https://registry.yarnpkg.com/debug/-/debug-3.2.6.tgz#e83d17de16d8a7efb7717edbe5fb10135eee629b" + integrity sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ== + dependencies: + ms "^2.1.1" + debug@^4.0.1, debug@^4.1.0, debug@^4.1.1: version "4.1.1" resolved "https://registry.yarnpkg.com/debug/-/debug-4.1.1.tgz#3b72260255109c6b589cee050f1d516139664791" + integrity sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw== dependencies: ms "^2.1.1" debuglog@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/debuglog/-/debuglog-1.0.1.tgz#aa24ffb9ac3df9a2351837cfb2d279360cd78492" + integrity sha1-qiT/uaw9+aI1GDfPstJ5NgzXhJI= decamelize-keys@^1.0.0: version "1.1.0" resolved "https://registry.yarnpkg.com/decamelize-keys/-/decamelize-keys-1.1.0.tgz#d171a87933252807eb3cb61dc1c1445d078df2d9" + integrity sha1-0XGoeTMlKAfrPLYdwcFEXQeN8tk= dependencies: decamelize "^1.1.0" map-obj "^1.0.0" -decamelize@^1.0.0, decamelize@^1.1.0, decamelize@^1.1.1, decamelize@^1.1.2, decamelize@^1.2.0: +decamelize@^1.1.0, decamelize@^1.1.1, decamelize@^1.1.2, decamelize@^1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-1.2.0.tgz#f6534d15148269b20352e7bee26f501f9a191290" + integrity sha1-9lNNFRSCabIDUue+4m9QH5oZEpA= decode-uri-component@^0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/decode-uri-component/-/decode-uri-component-0.2.0.tgz#eb3913333458775cb84cd1a1fae062106bb87545" + integrity sha1-6zkTMzRYd1y4TNGh+uBiEGu4dUU= dedent@^0.7.0: version "0.7.0" resolved "https://registry.yarnpkg.com/dedent/-/dedent-0.7.0.tgz#2495ddbaf6eb874abb0e1be9df22d2e5a544326c" + integrity sha1-JJXduvbrh0q7Dhvp3yLS5aVEMmw= deep-extend@^0.6.0: version "0.6.0" resolved "https://registry.yarnpkg.com/deep-extend/-/deep-extend-0.6.0.tgz#c4fa7c95404a17a9c3e8ca7e1537312b736330ac" + integrity sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA== deep-is@~0.1.3: version "0.1.3" resolved "https://registry.yarnpkg.com/deep-is/-/deep-is-0.1.3.tgz#b369d6fb5dbc13eecf524f91b070feedc357cf34" - -deepmerge@3.2.0: - version "3.2.0" - resolved "https://registry.yarnpkg.com/deepmerge/-/deepmerge-3.2.0.tgz#58ef463a57c08d376547f8869fdc5bcee957f44e" - integrity sha512-6+LuZGU7QCNUnAJyX8cIrlzoEgggTM6B7mm+znKOX4t5ltluT9KLjN6g61ECMS0LTsLW7yDpNoxhix5FZcrIow== + integrity sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ= default-compare@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/default-compare/-/default-compare-1.0.0.tgz#cb61131844ad84d84788fb68fd01681ca7781a2f" + integrity sha512-QWfXlM0EkAbqOCbD/6HjdwT19j7WCkMyiRhWilc4H9/5h/RzTF9gv5LYh1+CmDV5d1rki6KAWLtQale0xt20eQ== dependencies: kind-of "^5.0.2" default-resolution@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/default-resolution/-/default-resolution-2.0.0.tgz#bcb82baa72ad79b426a76732f1a81ad6df26d684" + integrity sha1-vLgrqnKtebQmp2cy8aga1t8m1oQ= defaults@^1.0.3: version "1.0.3" resolved "https://registry.yarnpkg.com/defaults/-/defaults-1.0.3.tgz#c656051e9817d9ff08ed881477f3fe4019f3ef7d" + integrity sha1-xlYFHpgX2f8I7YgUd/P+QBnz730= dependencies: clone "^1.0.2" -define-properties@^1.1.2: - version "1.1.2" - resolved "https://registry.yarnpkg.com/define-properties/-/define-properties-1.1.2.tgz#83a73f2fea569898fb737193c8f873caf6d45c94" +deferred-leveldown@~0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/deferred-leveldown/-/deferred-leveldown-0.2.0.tgz#2cef1f111e1c57870d8bbb8af2650e587cd2f5b4" + integrity sha1-LO8fER4cV4cNi7uK8mUOWHzS9bQ= dependencies: - foreach "^2.0.5" - object-keys "^1.0.8" + abstract-leveldown "~0.12.1" + +define-properties@^1.1.2, define-properties@^1.1.3: + version "1.1.3" + resolved "https://registry.yarnpkg.com/define-properties/-/define-properties-1.1.3.tgz#cf88da6cbee26fe6db7094f61d870cbd84cee9f1" + integrity sha512-3MqfYKj2lLzdMSf8ZIZE/V+Zuy+BgD6f164e8K2w7dgnpKArBDerGYpM46IYYcjnkdPNMjPk9A6VFB8+3SKlXQ== + dependencies: + object-keys "^1.0.12" define-property@^0.2.5: version "0.2.5" resolved "https://registry.yarnpkg.com/define-property/-/define-property-0.2.5.tgz#c35b1ef918ec3c990f9a5bc57be04aacec5c8116" + integrity sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY= dependencies: is-descriptor "^0.1.0" define-property@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/define-property/-/define-property-1.0.0.tgz#769ebaaf3f4a63aad3af9e8d304c9bbe79bfb0e6" + integrity sha1-dp66rz9KY6rTr56NMEybvnm/sOY= dependencies: is-descriptor "^1.0.0" define-property@^2.0.2: version "2.0.2" resolved "https://registry.yarnpkg.com/define-property/-/define-property-2.0.2.tgz#d459689e8d654ba77e02a817f8710d702cb16e9d" + integrity sha512-jwK2UV4cnPpbcG7+VRARKTZPUWowwXA8bzH5NP6ud0oeAxyYPuGZUAC7hMugpCdz4BeSZl2Dl9k66CHJ/46ZYQ== dependencies: is-descriptor "^1.0.2" isobject "^3.0.1" @@ -3473,48 +3751,51 @@ define-property@^2.0.2: defined@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/defined/-/defined-1.0.0.tgz#c98d9bcef75674188e110969151199e39b1fa693" + integrity sha1-yY2bzvdWdBiOEQlpFRGZ45sfppM= -del@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/del/-/del-3.0.0.tgz#53ecf699ffcbcb39637691ab13baf160819766e5" - dependencies: - globby "^6.1.0" - is-path-cwd "^1.0.0" - is-path-in-cwd "^1.0.0" - p-map "^1.1.1" - pify "^3.0.0" - rimraf "^2.2.8" +del@^5.0.0: + version "5.1.0" + resolved "https://registry.yarnpkg.com/del/-/del-5.1.0.tgz#d9487c94e367410e6eff2925ee58c0c84a75b3a7" + integrity sha512-wH9xOVHnczo9jN2IW68BabcecVPxacIA3g/7z6vhSU/4stOKQzeCRK0yD0A24WiAAUJmmVpWqrERcTxnLo3AnA== + dependencies: + globby "^10.0.1" + graceful-fs "^4.2.2" + is-glob "^4.0.1" + is-path-cwd "^2.2.0" + is-path-inside "^3.0.1" + p-map "^3.0.0" + rimraf "^3.0.0" + slash "^3.0.0" delayed-stream@~1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/delayed-stream/-/delayed-stream-1.0.0.tgz#df3ae199acadfb7d440aaae0b29e2272b24ec619" + integrity sha1-3zrhmayt+31ECqrgsp4icrJOxhk= delegates@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/delegates/-/delegates-1.0.0.tgz#84c6e159b81904fdca59a0ef44cd870d31250f9a" - -deprecation@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/deprecation/-/deprecation-1.0.1.tgz#2df79b79005752180816b7b6e079cbd80490d711" - integrity sha512-ccVHpE72+tcIKaGMql33x5MAjKQIZrk+3x2GbJ7TeraUCZWHoT+KSZpoC+JQFsUBlSTXUrBaGiF0j6zVTepPLg== + integrity sha1-hMbhWbgZBP3KWaDvRM2HDTElD5o= deprecation@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/deprecation/-/deprecation-2.0.0.tgz#dd0427cd920c78bc575ec39dab2f22e7c304fb9d" - integrity sha512-lbQN037mB3VfA2JFuguM5GCJ+zPinMeCrFe+AfSZ6eqrnJA/Fs+EYMnd6Nb2mn9lf2jO9xwEd9o9lic+D4vkcw== + version "2.3.1" + resolved "https://registry.yarnpkg.com/deprecation/-/deprecation-2.3.1.tgz#6368cbdb40abf3373b525ac87e4a260c3a700919" + integrity sha512-xmHIy4F3scKVwMsQ4WnVaS8bHOx0DmVwRywosKhaILI0ywMDWPtBSku2HNxRvF7jtwDRsoEwYQSfbxj8b7RlJQ== deps-sort@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/deps-sort/-/deps-sort-2.0.0.tgz#091724902e84658260eb910748cccd1af6e21fb5" + version "2.0.1" + resolved "https://registry.yarnpkg.com/deps-sort/-/deps-sort-2.0.1.tgz#9dfdc876d2bcec3386b6829ac52162cda9fa208d" + integrity sha512-1orqXQr5po+3KI6kQb9A4jnXT1PBwggGl2d7Sq2xsnOeI9GPcE/tGcF9UiSZtZBM7MukY4cAh7MemS6tZYipfw== dependencies: JSONStream "^1.0.3" - shasum "^1.0.0" + shasum-object "^1.0.0" subarg "^1.0.0" through2 "^2.0.0" derequire@^2.0.2: version "2.0.6" resolved "https://registry.yarnpkg.com/derequire/-/derequire-2.0.6.tgz#31a414bb7ca176239fa78b116636ef77d517e768" + integrity sha1-MaQUu3yhdiOfp4sRZjbvd9UX52g= dependencies: acorn "^4.0.3" concat-stream "^1.4.6" @@ -3523,8 +3804,9 @@ derequire@^2.0.2: yargs "^6.5.0" des.js@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/des.js/-/des.js-1.0.0.tgz#c074d2e2aa6a8a9a07dbd61f9a15c2cd83ec8ecc" + version "1.0.1" + resolved "https://registry.yarnpkg.com/des.js/-/des.js-1.0.1.tgz#5382142e1bdc53f85d86d53e5f4aa7deb91e0843" + integrity sha512-Q0I4pfFrv2VPd34/vfLrFOoRmlYj3OV50i7fskps1jZWK1kApMWWT9G6RRUeYedLcBDIhnSDaUvJMb3AhUlaEA== dependencies: inherits "^2.0.1" minimalistic-assert "^1.0.0" @@ -3532,54 +3814,68 @@ des.js@^1.0.0: detect-file@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/detect-file/-/detect-file-1.0.0.tgz#f0d66d03672a825cb1b73bdb3fe62310c8e552b7" + integrity sha1-8NZtA2cqglyxtzvbP+YjEMjlUrc= detect-indent@^5.0.0: version "5.0.0" resolved "https://registry.yarnpkg.com/detect-indent/-/detect-indent-5.0.0.tgz#3871cc0a6a002e8c3e5b3cf7f336264675f06b9d" + integrity sha1-OHHMCmoALow+Wzz38zYmRnXwa50= detect-libc@^1.0.2: version "1.0.3" resolved "https://registry.yarnpkg.com/detect-libc/-/detect-libc-1.0.3.tgz#fa137c4bd698edf55cd5cd02ac559f91a4c4ba9b" + integrity sha1-+hN8S9aY7fVc1c0CrFWfkaTEups= detect-newline@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/detect-newline/-/detect-newline-2.1.0.tgz#f41f1c10be4b00e87b5f13da680759f2c5bfd3e2" + integrity sha1-9B8cEL5LAOh7XxPaaAdZ8sW/0+I= detective@^5.0.2: - version "5.1.0" - resolved "https://registry.yarnpkg.com/detective/-/detective-5.1.0.tgz#7a20d89236d7b331ccea65832e7123b5551bb7cb" + version "5.2.0" + resolved "https://registry.yarnpkg.com/detective/-/detective-5.2.0.tgz#feb2a77e85b904ecdea459ad897cc90a99bd2a7b" + integrity sha512-6SsIx+nUUbuK0EthKjv0zrdnajCCXVYGmbYYiYjFVpzcjwEs/JMDZ8tPRG29J/HhN56t3GJp2cGSWDRjjot8Pg== dependencies: - acorn-node "^1.3.0" + acorn-node "^1.6.1" defined "^1.0.0" minimist "^1.1.1" dezalgo@^1.0.0: version "1.0.3" resolved "https://registry.yarnpkg.com/dezalgo/-/dezalgo-1.0.3.tgz#7f742de066fc748bc8db820569dddce49bf0d456" + integrity sha1-f3Qt4Gb8dIvI24IFad3c5Jvw1FY= dependencies: asap "^2.0.0" wrappy "1" -diff-sequences@^24.3.0: - version "24.3.0" - resolved "https://registry.yarnpkg.com/diff-sequences/-/diff-sequences-24.3.0.tgz#0f20e8a1df1abddaf4d9c226680952e64118b975" - integrity sha512-xLqpez+Zj9GKSnPWS0WZw1igGocZ+uua8+y+5dDNTT934N3QuY1sp2LkHzwiaYQGz60hMq0pjAshdeXm5VUOEw== +diff-sequences@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/diff-sequences/-/diff-sequences-24.9.0.tgz#5715d6244e2aa65f48bba0bc972db0b0b11e95b5" + integrity sha512-Dj6Wk3tWyTE+Fo1rW8v0Xhwk80um6yFYKbuAxc9c3EZxIHFDYwbi34Uk42u1CdnIiVorvt4RmlSDjIPyzGC2ew== diffie-hellman@^5.0.0: - version "5.0.2" - resolved "https://registry.yarnpkg.com/diffie-hellman/-/diffie-hellman-5.0.2.tgz#b5835739270cfe26acf632099fded2a07f209e5e" + version "5.0.3" + resolved "https://registry.yarnpkg.com/diffie-hellman/-/diffie-hellman-5.0.3.tgz#40e8ee98f55a2149607146921c63e1ae5f3d2875" + integrity sha512-kqag/Nl+f3GwyK25fhUMYj81BUOrZ9IuJsjIcDE5icNM9FJHAVm3VcUDxdLPoQtTuUylWm6ZIknYJwwaPxsUzg== dependencies: bn.js "^4.1.0" miller-rabin "^4.0.0" randombytes "^2.0.0" -dir-glob@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/dir-glob/-/dir-glob-2.0.0.tgz#0b205d2b6aef98238ca286598a8204d29d0a0034" +dir-glob@^2.2.2: + version "2.2.2" + resolved "https://registry.yarnpkg.com/dir-glob/-/dir-glob-2.2.2.tgz#fa09f0694153c8918b18ba0deafae94769fc50c4" + integrity sha512-f9LBi5QWzIW3I6e//uxZoLBlUt9kcp66qo0sSCxL6YZKc75R1c4MFCoe/LaZiBGmgujvQdxc5Bn3QhfyvK5Hsw== dependencies: - arrify "^1.0.1" path-type "^3.0.0" +dir-glob@^3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/dir-glob/-/dir-glob-3.0.1.tgz#56dbf73d992a4a93ba1584f4534063fd2e41717f" + integrity sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA== + dependencies: + path-type "^4.0.0" + doctrine@1.5.0: version "1.5.0" resolved "https://registry.yarnpkg.com/doctrine/-/doctrine-1.5.0.tgz#379dce730f6166f76cefa4e6707a159b02c5a6fa" @@ -3595,110 +3891,84 @@ doctrine@^3.0.0: dependencies: esutils "^2.0.2" -dom-serializer@0, dom-serializer@~0.1.0: - version "0.1.0" - resolved "https://registry.yarnpkg.com/dom-serializer/-/dom-serializer-0.1.0.tgz#073c697546ce0780ce23be4a28e293e40bc30c82" - dependencies: - domelementtype "~1.1.1" - entities "~1.1.1" - -domain-browser@^1.1.1, domain-browser@^1.2.0: +domain-browser@^1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/domain-browser/-/domain-browser-1.2.0.tgz#3d31f50191a6749dd1375a7f522e823d42e54eda" + integrity sha512-jnjyiM6eRyZl2H+W8Q/zLMA481hzi0eszAaBUzIVnmYVDBbnLxVNnfu1HgEBvCbL+71FrxMl3E6lpKH7Ge3OXA== -domelementtype@1, domelementtype@^1.3.0: - version "1.3.0" - resolved "https://registry.yarnpkg.com/domelementtype/-/domelementtype-1.3.0.tgz#b17aed82e8ab59e52dd9c19b1756e0fc187204c2" - -domelementtype@~1.1.1: - version "1.1.3" - resolved "https://registry.yarnpkg.com/domelementtype/-/domelementtype-1.1.3.tgz#bd28773e2642881aec51544924299c5cd822185b" - -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== dependencies: webidl-conversions "^4.0.2" -domhandler@^2.3.0: - version "2.4.1" - resolved "https://registry.yarnpkg.com/domhandler/-/domhandler-2.4.1.tgz#892e47000a99be55bbf3774ffea0561d8879c259" - dependencies: - domelementtype "1" - -domutils@1.5.1, domutils@^1.5.1: - version "1.5.1" - resolved "https://registry.yarnpkg.com/domutils/-/domutils-1.5.1.tgz#dcd8488a26f563d61079e48c9f7b7e32373682cf" - dependencies: - dom-serializer "0" - domelementtype "1" - dot-prop@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/dot-prop/-/dot-prop-3.0.0.tgz#1b708af094a49c9a0e7dbcad790aba539dac1177" + integrity sha1-G3CK8JSknJoOfbyteQq6U52sEXc= dependencies: is-obj "^1.0.0" dot-prop@^4.2.0: version "4.2.0" resolved "https://registry.yarnpkg.com/dot-prop/-/dot-prop-4.2.0.tgz#1f19e0c2e1aa0e32797c49799f2837ac6af69c57" + integrity sha512-tUMXrxlExSW6U2EXiiKGSBVdYgtV8qlHL+C10TsW4PURY/ic+eaysnSkwB4kA/mBlCyy/IKDJ+Lc3wbWeaXtuQ== dependencies: is-obj "^1.0.0" duplexer2@^0.1.2, duplexer2@~0.1.0, duplexer2@~0.1.2: version "0.1.4" resolved "https://registry.yarnpkg.com/duplexer2/-/duplexer2-0.1.4.tgz#8b12dab878c0d69e3e7891051662a32fc6bddcc1" + integrity sha1-ixLauHjA1p4+eJEFFmKjL8a93ME= dependencies: readable-stream "^2.0.2" duplexer@^0.1.1: version "0.1.1" resolved "https://registry.yarnpkg.com/duplexer/-/duplexer-0.1.1.tgz#ace6ff808c1ce66b57d1ebf97977acb02334cfc1" + integrity sha1-rOb/gIwc5mtX0ev5eXessCM0z8E= duplexify@^3.4.2, duplexify@^3.6.0: - version "3.6.1" - resolved "https://registry.yarnpkg.com/duplexify/-/duplexify-3.6.1.tgz#b1a7a29c4abfd639585efaecce80d666b1e34125" + version "3.7.1" + resolved "https://registry.yarnpkg.com/duplexify/-/duplexify-3.7.1.tgz#2a4df5317f6ccfd91f86d6fd25d8d8a103b88309" + integrity sha512-07z8uv2wMyS51kKhD1KsdXJg5WQ6t93RneqRxUHnskXVtlYYkLqM0gqStQZ3pj073g687jPCHrqNfCzawLYh5g== dependencies: end-of-stream "^1.0.0" inherits "^2.0.1" readable-stream "^2.0.0" stream-shift "^1.0.0" -duplicate-package-checker-webpack-plugin@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/duplicate-package-checker-webpack-plugin/-/duplicate-package-checker-webpack-plugin-2.1.0.tgz#6723ee32d89947997470778973c10788cb69e496" - integrity sha512-Blok+Cb8zDavYQyeTtSkmNp/aiyRn5+JV/4EhDDH5VJChnyIzPhq+S5MyWnFpqpv8jNKmD3cXmXFEVU509pzXQ== - dependencies: - chalk "^2.3.0" - find-root "^1.0.0" - lodash "^4.17.4" - semver "^5.4.1" - each-props@^1.3.0: - version "1.3.1" - resolved "https://registry.yarnpkg.com/each-props/-/each-props-1.3.1.tgz#fc138f51e3a2774286d4858e02d6e7de462de158" + version "1.3.2" + resolved "https://registry.yarnpkg.com/each-props/-/each-props-1.3.2.tgz#ea45a414d16dd5cfa419b1a81720d5ca06892333" + integrity sha512-vV0Hem3zAGkJAyU7JSjixeU66rwdynTAa1vofCrSA5fEln+m67Az9CcnkVD776/fsN/UjIWmBDoNRS6t6G9RfA== dependencies: is-plain-object "^2.0.1" object.defaults "^1.1.0" ecc-jsbn@~0.1.1: - version "0.1.1" - resolved "https://registry.yarnpkg.com/ecc-jsbn/-/ecc-jsbn-0.1.1.tgz#0fc73a9ed5f0d53c38193398523ef7e543777505" + version "0.1.2" + resolved "https://registry.yarnpkg.com/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz#3a83a904e54353287874c564b7549386849a98c9" + integrity sha1-OoOpBOVDUyh4dMVkt1SThoSamMk= dependencies: jsbn "~0.1.0" + safer-buffer "^2.1.0" -electron-to-chromium@^1.3.133: - version "1.3.134" - resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.134.tgz#550222bddac43c6bd6c445c3543a0fe8a615021d" - integrity sha512-C3uK2SrtWg/gSWaluLHWSHjyebVZCe4ZC0NVgTAoTq8tCR9FareRK5T7R7AS/nPZShtlEcjVMX1kQ8wi4nU68w== +electron-to-chromium@^1.3.322: + version "1.3.322" + resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.322.tgz#a6f7e1c79025c2b05838e8e344f6e89eb83213a8" + integrity sha512-Tc8JQEfGQ1MzfSzI/bTlSr7btJv/FFO7Yh6tanqVmIWOuNCu6/D1MilIEgLtmWqIrsv+o4IjpLAhgMBr/ncNAA== elegant-spinner@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/elegant-spinner/-/elegant-spinner-1.0.1.tgz#db043521c95d7e303fd8f345bedc3349cfb0729e" + integrity sha1-2wQ1IcldfjA/2PNFvtwzSc+wcp4= elliptic@^6.0.0: - version "6.4.0" - resolved "https://registry.yarnpkg.com/elliptic/-/elliptic-6.4.0.tgz#cac9af8762c85836187003c8dfe193e5e2eae5df" + version "6.5.2" + resolved "https://registry.yarnpkg.com/elliptic/-/elliptic-6.5.2.tgz#05c5678d7173c049d8ca433552224a495d0e3762" + integrity sha512-f4x70okzZbIQl/NSRLkI/+tteV/9WqL98zx+SQ69KbXxmVrmjwsNUPn/gYJJ0sHvEak24cZgHIPegRePAtA/xw== dependencies: bn.js "^4.4.0" brorand "^1.0.1" @@ -3713,82 +3983,97 @@ emoji-regex@^7.0.1: resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-7.0.3.tgz#933a04052860c85e83c122479c4748a8e4c72156" integrity sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA== -emojis-list@^2.0.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/emojis-list/-/emojis-list-2.1.0.tgz#4daa4d9db00f9819880c79fa457ae5b09a1fd389" +emoji-regex@^8.0.0: + version "8.0.0" + resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-8.0.0.tgz#e818fd69ce5ccfcb404594f842963bf53164cc37" + integrity sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A== encoding@^0.1.11: version "0.1.12" resolved "https://registry.yarnpkg.com/encoding/-/encoding-0.1.12.tgz#538b66f3ee62cd1ab51ec323829d1f9480c74beb" + integrity sha1-U4tm8+5izRq1HsMjgp0flIDHS+s= dependencies: iconv-lite "~0.4.13" end-of-stream@^1.0.0, end-of-stream@^1.1.0: - version "1.4.1" - resolved "https://registry.yarnpkg.com/end-of-stream/-/end-of-stream-1.4.1.tgz#ed29634d19baba463b6ce6b80a37213eab71ec43" + version "1.4.4" + resolved "https://registry.yarnpkg.com/end-of-stream/-/end-of-stream-1.4.4.tgz#5ae64a5f45057baf3626ec14da0ca5e4b2431eb0" + integrity sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q== dependencies: once "^1.4.0" -enhanced-resolve@^3.0.0, enhanced-resolve@^3.4.0: +enhanced-resolve@^3.0.0: version "3.4.1" resolved "https://registry.yarnpkg.com/enhanced-resolve/-/enhanced-resolve-3.4.1.tgz#0421e339fd71419b3da13d129b3979040230476e" + integrity sha1-BCHjOf1xQZs9oT0Smzl5BAIwR24= dependencies: graceful-fs "^4.1.2" memory-fs "^0.4.0" object-assign "^4.0.1" tapable "^0.2.7" -entities@^1.1.1, entities@~1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/entities/-/entities-1.1.1.tgz#6e5c2d0a5621b5dadaecef80b90edfb5cd7772f0" +env-paths@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/env-paths/-/env-paths-1.0.0.tgz#4168133b42bb05c38a35b1ae4397c8298ab369e0" + integrity sha1-QWgTO0K7BcOKNbGuQ5fIKYqzaeA= err-code@^1.0.0: version "1.1.2" resolved "https://registry.yarnpkg.com/err-code/-/err-code-1.1.2.tgz#06e0116d3028f6aef4806849eb0ea6a748ae6960" + integrity sha1-BuARbTAo9q70gGhJ6w6mp0iuaWA= -errno@^0.1.3: +errno@^0.1.1, errno@^0.1.3, errno@~0.1.1: version "0.1.7" resolved "https://registry.yarnpkg.com/errno/-/errno-0.1.7.tgz#4684d71779ad39af177e3f007996f7c67c852618" + integrity sha512-MfrRBDWzIWifgq6tJj60gkAwtLNb6sQPlcFrSOflcP1aFmmruKQ2wRnze/8V6kgyz7H3FF8Npzv78mZ7XLLflg== dependencies: prr "~1.0.1" error-ex@^1.2.0, error-ex@^1.3.1: - version "1.3.1" - resolved "https://registry.yarnpkg.com/error-ex/-/error-ex-1.3.1.tgz#f855a86ce61adc4e8621c3cda21e7a7612c3a8dc" + version "1.3.2" + resolved "https://registry.yarnpkg.com/error-ex/-/error-ex-1.3.2.tgz#b4ac40648107fdcdcfae242f428bea8a14d4f1bf" + integrity sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g== dependencies: is-arrayish "^0.2.1" -es-abstract@^1.4.3, es-abstract@^1.5.1, es-abstract@^1.7.0: - version "1.13.0" - resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.13.0.tgz#ac86145fdd5099d8dd49558ccba2eaf9b88e24e9" - integrity sha512-vDZfg/ykNxQVwup/8E1BZhVzFfBxs9NqMzGcvIJrqg5k2/5Za2bWo40dK2J1pgLngZ7c+Shh8lwYtLGyrwPutg== +es-abstract@^1.12.0, es-abstract@^1.15.0, es-abstract@^1.4.3, es-abstract@^1.5.1, es-abstract@^1.7.0: + version "1.16.3" + resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.16.3.tgz#52490d978f96ff9f89ec15b5cf244304a5bca161" + integrity sha512-WtY7Fx5LiOnSYgF5eg/1T+GONaGmpvpPdCpSnYij+U2gDTL0UPfWrhDw7b2IYb+9NQJsYpCA0wOQvZfsd6YwRw== dependencies: - es-to-primitive "^1.2.0" + es-to-primitive "^1.2.1" function-bind "^1.1.1" has "^1.0.3" + has-symbols "^1.0.1" is-callable "^1.1.4" is-regex "^1.0.4" - object-keys "^1.0.12" + object-inspect "^1.7.0" + object-keys "^1.1.1" + string.prototype.trimleft "^2.1.0" + string.prototype.trimright "^2.1.0" -es-to-primitive@^1.2.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/es-to-primitive/-/es-to-primitive-1.2.0.tgz#edf72478033456e8dda8ef09e00ad9650707f377" - integrity sha512-qZryBOJjV//LaxLTV6UC//WewneB3LcXOL9NP++ozKVXsIIIpm/2c13UDiD9Jp2eThsecw9m3jPqDwTyobcdbg== +es-to-primitive@^1.2.1: + version "1.2.1" + resolved "https://registry.yarnpkg.com/es-to-primitive/-/es-to-primitive-1.2.1.tgz#e55cd4c9cdc188bcefb03b366c736323fc5c898a" + integrity sha512-QCOllgZJtaUo9miYBcLChTUaHNjJF3PYs1VidD7AwiEj1kYxKeQTctLAezAOH5ZKRH0g2IgPn6KwB4IT8iRpvA== dependencies: is-callable "^1.1.4" is-date-object "^1.0.1" is-symbol "^1.0.2" -es5-ext@^0.10.14, es5-ext@^0.10.35, es5-ext@^0.10.9, es5-ext@~0.10.14: - version "0.10.39" - resolved "https://registry.yarnpkg.com/es5-ext/-/es5-ext-0.10.39.tgz#fca21b67559277ca4ac1a1ed7048b107b6f76d87" +es5-ext@^0.10.35, es5-ext@^0.10.46, es5-ext@^0.10.50, es5-ext@~0.10.14: + version "0.10.53" + resolved "https://registry.yarnpkg.com/es5-ext/-/es5-ext-0.10.53.tgz#93c5a3acfdbef275220ad72644ad02ee18368de1" + integrity sha512-Xs2Stw6NiNHWypzRTY1MtaG/uJlwCk8kH81920ma8mvN8Xq1gsfhZvpkImLQArw8AHnv8MT2I45J3c0R8slE+Q== dependencies: es6-iterator "~2.0.3" - es6-symbol "~3.1.1" + es6-symbol "~3.1.3" + next-tick "~1.0.0" -es6-iterator@^2.0.1, es6-iterator@~2.0.1, es6-iterator@~2.0.3: +es6-iterator@^2.0.1, es6-iterator@^2.0.3, es6-iterator@~2.0.1, es6-iterator@~2.0.3: version "2.0.3" resolved "https://registry.yarnpkg.com/es6-iterator/-/es6-iterator-2.0.3.tgz#a7de889141a05a94b0854403b2d0a0fbfa98f3b7" + integrity sha1-p96IkUGgWpSwhUQDstCg+/qY87c= dependencies: d "1" es5-ext "^0.10.35" @@ -3797,6 +4082,7 @@ es6-iterator@^2.0.1, es6-iterator@~2.0.1, es6-iterator@~2.0.3: es6-map@^0.1.3: version "0.1.5" resolved "https://registry.yarnpkg.com/es6-map/-/es6-map-0.1.5.tgz#9136e0503dcc06a301690f0bb14ff4e364e949f0" + integrity sha1-kTbgUD3MBqMBaQ8LsU/042TpSfA= dependencies: d "1" es5-ext "~0.10.14" @@ -3806,18 +4092,21 @@ es6-map@^0.1.3: event-emitter "~0.3.5" es6-promise@^4.0.3: - version "4.2.5" - resolved "https://registry.yarnpkg.com/es6-promise/-/es6-promise-4.2.5.tgz#da6d0d5692efb461e082c14817fe2427d8f5d054" + version "4.2.8" + resolved "https://registry.yarnpkg.com/es6-promise/-/es6-promise-4.2.8.tgz#4eb21594c972bc40553d276e510539143db53e0a" + integrity sha512-HJDGx5daxeIvxdBxvG2cb9g4tEvwIk3i8+nhX0yGrYmZUzbkdg8QbDevheDB8gd0//uPj4c1EQua8Q+MViT0/w== es6-promisify@^5.0.0: version "5.0.0" resolved "https://registry.yarnpkg.com/es6-promisify/-/es6-promisify-5.0.0.tgz#5109d62f3e56ea967c4b63505aef08291c8a5203" + integrity sha1-UQnWLz5W6pZ8S2NQWu8IKRyKUgM= dependencies: es6-promise "^4.0.3" es6-set@~0.1.5: version "0.1.5" resolved "https://registry.yarnpkg.com/es6-set/-/es6-set-0.1.5.tgz#d2b3ec5d4d800ced818db538d28974db0a73ccb1" + integrity sha1-0rPsXU2ADO2BjbU40ol02wpzzLE= dependencies: d "1" es5-ext "~0.10.14" @@ -3825,36 +4114,41 @@ es6-set@~0.1.5: es6-symbol "3.1.1" event-emitter "~0.3.5" -es6-symbol@3.1.1, es6-symbol@^3.1.1, es6-symbol@~3.1.1: +es6-symbol@3.1.1: version "3.1.1" resolved "https://registry.yarnpkg.com/es6-symbol/-/es6-symbol-3.1.1.tgz#bf00ef4fdab6ba1b46ecb7b629b4c7ed5715cc77" + integrity sha1-vwDvT9q2uhtG7Le2KbTH7VcVzHc= dependencies: d "1" es5-ext "~0.10.14" -es6-templates@^0.2.2: - version "0.2.3" - resolved "https://registry.yarnpkg.com/es6-templates/-/es6-templates-0.2.3.tgz#5cb9ac9fb1ded6eb1239342b81d792bbb4078ee4" +es6-symbol@^3.1.1, es6-symbol@~3.1.1, es6-symbol@~3.1.3: + version "3.1.3" + resolved "https://registry.yarnpkg.com/es6-symbol/-/es6-symbol-3.1.3.tgz#bad5d3c1bcdac28269f4cb331e431c78ac705d18" + integrity sha512-NJ6Yn3FuDinBaBRWl/q5X/s4koRHBrgKAu+yGI6JCBeiu3qrcbJhwT2GeR/EXVfylRk8dpQVJoLEFhK+Mu31NA== dependencies: - recast "~0.11.12" - through "~2.3.6" + d "^1.0.1" + ext "^1.1.2" es6-weak-map@^2.0.1: - version "2.0.2" - resolved "https://registry.yarnpkg.com/es6-weak-map/-/es6-weak-map-2.0.2.tgz#5e3ab32251ffd1538a1f8e5ffa1357772f92d96f" + version "2.0.3" + resolved "https://registry.yarnpkg.com/es6-weak-map/-/es6-weak-map-2.0.3.tgz#b6da1f16cc2cc0d9be43e6bdbfc5e7dfcdf31d53" + integrity sha512-p5um32HOTO1kP+w7PRnB+5lQ43Z6muuMuIMffvDN8ZB4GcnjLBV6zGStpbASIMk4DCAvEaamhe2zhyCb/QXXsA== dependencies: d "1" - es5-ext "^0.10.14" - es6-iterator "^2.0.1" + es5-ext "^0.10.46" + es6-iterator "^2.0.3" es6-symbol "^3.1.1" -escape-string-regexp@^1.0.2, escape-string-regexp@^1.0.4, escape-string-regexp@^1.0.5: +escape-string-regexp@^1.0.2, escape-string-regexp@^1.0.5: version "1.0.5" resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4" + integrity sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ= -escodegen@^1.9.0: - version "1.9.1" - resolved "https://registry.yarnpkg.com/escodegen/-/escodegen-1.9.1.tgz#dbae17ef96c8e4bedb1356f4504fa4cc2f7cb7e2" +escodegen@^1.9.1: + version "1.12.0" + resolved "https://registry.yarnpkg.com/escodegen/-/escodegen-1.12.0.tgz#f763daf840af172bb3a2b6dd7219c0e17f7ff541" + integrity sha512-TuA+EhsanGcme5T3R0L80u4t8CpbXQjegRmf7+FPTJrtCTErXFeelblRgHQa1FofEzqYYJmJ/OqjTwREp9qgmg== dependencies: esprima "^3.1.3" estraverse "^4.2.0" @@ -3866,6 +4160,7 @@ escodegen@^1.9.0: escope@^3.6.0: version "3.6.0" resolved "https://registry.yarnpkg.com/escope/-/escope-3.6.0.tgz#e01975e812781a163a6dadfdd80398dc64c889c3" + integrity sha1-4Bl16BJ4GhY6ba392AOY3GTIicM= dependencies: es6-map "^0.1.3" es6-weak-map "^2.0.1" @@ -3885,155 +4180,166 @@ eslint-import-resolver-node@^0.3.2: debug "^2.6.9" resolve "^1.5.0" -eslint-module-utils@^2.4.0: - version "2.4.0" - resolved "https://registry.yarnpkg.com/eslint-module-utils/-/eslint-module-utils-2.4.0.tgz#8b93499e9b00eab80ccb6614e69f03678e84e09a" - integrity sha512-14tltLm38Eu3zS+mt0KvILC3q8jyIAH518MlG+HO0p+yK885Lb1UHTY/UgR91eOyGdmxAPb+OLoW4znqIT6Ndw== +eslint-module-utils@^2.4.1: + version "2.5.0" + resolved "https://registry.yarnpkg.com/eslint-module-utils/-/eslint-module-utils-2.5.0.tgz#cdf0b40d623032274ccd2abd7e64c4e524d6e19c" + integrity sha512-kCo8pZaNz2dsAW7nCUjuVoI11EBXXpIzfNxmaoLhXoRDOnqXLC4iSGVRdZPhOitfbdEfMEfKOiENaK6wDPZEGw== dependencies: - debug "^2.6.8" + debug "^2.6.9" pkg-dir "^2.0.0" eslint-plugin-flowtype@^3.8.2: - version "3.8.2" - resolved "https://registry.yarnpkg.com/eslint-plugin-flowtype/-/eslint-plugin-flowtype-3.8.2.tgz#8e1ecaae570d149ba3ba2c73964ebac5582e8ff9" - integrity sha512-3fBLnSQ4WEVKtd+PWuqL9qhciYrJWjLuOGilEIN3LzEYnPtvDcnjQPHP2OFhzTCRlpojSv2EEqoPW+Sol0vn2A== + version "3.13.0" + resolved "https://registry.yarnpkg.com/eslint-plugin-flowtype/-/eslint-plugin-flowtype-3.13.0.tgz#e241ebd39c0ce519345a3f074ec1ebde4cf80f2c" + integrity sha512-bhewp36P+t7cEV0b6OdmoRWJCBYRiHFlqPZAG1oS3SF+Y0LQkeDvFSM4oxoxvczD1OdONCXMlJfQFiWLcV9urw== dependencies: - lodash "^4.17.11" + lodash "^4.17.15" eslint-plugin-import@^2.17.2: - version "2.17.2" - resolved "https://registry.yarnpkg.com/eslint-plugin-import/-/eslint-plugin-import-2.17.2.tgz#d227d5c6dc67eca71eb590d2bb62fb38d86e9fcb" - integrity sha512-m+cSVxM7oLsIpmwNn2WXTJoReOF9f/CtLMo7qOVmKd1KntBy0hEcuNZ3erTmWjx+DxRO0Zcrm5KwAvI9wHcV5g== + version "2.19.1" + resolved "https://registry.yarnpkg.com/eslint-plugin-import/-/eslint-plugin-import-2.19.1.tgz#5654e10b7839d064dd0d46cd1b88ec2133a11448" + integrity sha512-x68131aKoCZlCae7rDXKSAQmbT5DQuManyXo2sK6fJJ0aK5CWAkv6A6HJZGgqC8IhjQxYPgo6/IY4Oz8AFsbBw== dependencies: array-includes "^3.0.3" + array.prototype.flat "^1.2.1" contains-path "^0.1.0" debug "^2.6.9" doctrine "1.5.0" eslint-import-resolver-node "^0.3.2" - eslint-module-utils "^2.4.0" + eslint-module-utils "^2.4.1" has "^1.0.3" - lodash "^4.17.11" minimatch "^3.0.4" + object.values "^1.1.0" read-pkg-up "^2.0.0" - resolve "^1.10.0" + resolve "^1.12.0" eslint-plugin-prettier@^3.1.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/eslint-plugin-prettier/-/eslint-plugin-prettier-3.1.0.tgz#8695188f95daa93b0dc54b249347ca3b79c4686d" - integrity sha512-XWX2yVuwVNLOUhQijAkXz+rMPPoCr7WFiAl8ig6I7Xn+pPVhDhzg4DxHpmbeb0iqjO9UronEA3Tb09ChnFVHHA== + version "3.1.1" + resolved "https://registry.yarnpkg.com/eslint-plugin-prettier/-/eslint-plugin-prettier-3.1.1.tgz#507b8562410d02a03f0ddc949c616f877852f2ba" + integrity sha512-A+TZuHZ0KU0cnn56/9mfR7/KjUJ9QNVXUhwvRFSR7PGPe0zQR6PTkmyqg1AtUUEOzTqeRsUwyKFh0oVZKVCrtA== dependencies: prettier-linter-helpers "^1.0.0" -eslint-scope@3.7.1: - version "3.7.1" - resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-3.7.1.tgz#3d63c3edfda02e06e01a452ad88caacc7cdcb6e8" +eslint-scope@5.0.0, eslint-scope@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-5.0.0.tgz#e87c8887c73e8d1ec84f1ca591645c358bfc8fb9" + integrity sha512-oYrhJW7S0bxAFDvWqzvMPRm6pcgcnWc4QnofCAqRTRfQC0JcwenzGglTtsLyIuuWFfkqDG9vz67cnttSd53djw== dependencies: esrecurse "^4.1.0" estraverse "^4.1.1" -eslint-scope@^4.0.3: - version "4.0.3" - resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-4.0.3.tgz#ca03833310f6889a3264781aa82e63eb9cfe7848" - integrity sha512-p7VutNr1O/QrxysMo3E45FjYDTeXBy0iTltPFNSqKAIfjDSXC+4dj+qfyuD8bfAXrW/y6lW3O76VaYNPKfpKrg== +eslint-utils@^1.4.3: + version "1.4.3" + resolved "https://registry.yarnpkg.com/eslint-utils/-/eslint-utils-1.4.3.tgz#74fec7c54d0776b6f67e0251040b5806564e981f" + integrity sha512-fbBN5W2xdY45KulGXmLHZ3c3FHfVYmKg0IrAKGOkT/464PQsx2UeIzfz1RmEci+KLm1bBaAzZAh8+/E+XAeZ8Q== dependencies: - esrecurse "^4.1.0" - estraverse "^4.1.1" - -eslint-utils@^1.3.1: - version "1.3.1" - resolved "https://registry.yarnpkg.com/eslint-utils/-/eslint-utils-1.3.1.tgz#9a851ba89ee7c460346f97cf8939c7298827e512" + eslint-visitor-keys "^1.1.0" -eslint-visitor-keys@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-1.0.0.tgz#3f3180fb2e291017716acb4c9d6d5b5c34a6a81d" +eslint-visitor-keys@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-1.1.0.tgz#e2a82cea84ff246ad6fb57f9bde5b46621459ec2" + integrity sha512-8y9YjtM1JBJU/A9Kc+SbaOV4y29sSWckBwMHa+FGtVj5gN/sbnKDf6xJUl+8g7FAij9LVaP8C24DUiH/f/2Z9A== -eslint@^5.16.0: - version "5.16.0" - resolved "https://registry.yarnpkg.com/eslint/-/eslint-5.16.0.tgz#a1e3ac1aae4a3fbd8296fcf8f7ab7314cbb6abea" - integrity sha512-S3Rz11i7c8AA5JPv7xAH+dOyq/Cu/VXHiHXBPOU1k/JAM5dXqQPt3qcrhpHSorXmrpu2g0gkIBVXAqCpzfoZIg== +eslint@^6.0.1: + version "6.7.2" + resolved "https://registry.yarnpkg.com/eslint/-/eslint-6.7.2.tgz#c17707ca4ad7b2d8af986a33feba71e18a9fecd1" + integrity sha512-qMlSWJaCSxDFr8fBPvJM9kJwbazrhNcBU3+DszDW1OlEwKBBRWsJc7NJFelvwQpanHCR14cOLD41x8Eqvo3Nng== dependencies: "@babel/code-frame" "^7.0.0" - ajv "^6.9.1" + ajv "^6.10.0" chalk "^2.1.0" cross-spawn "^6.0.5" debug "^4.0.1" doctrine "^3.0.0" - eslint-scope "^4.0.3" - eslint-utils "^1.3.1" - eslint-visitor-keys "^1.0.0" - espree "^5.0.1" + eslint-scope "^5.0.0" + eslint-utils "^1.4.3" + eslint-visitor-keys "^1.1.0" + espree "^6.1.2" esquery "^1.0.1" esutils "^2.0.2" file-entry-cache "^5.0.1" functional-red-black-tree "^1.0.1" - glob "^7.1.2" - globals "^11.7.0" + glob-parent "^5.0.0" + globals "^12.1.0" ignore "^4.0.6" import-fresh "^3.0.0" imurmurhash "^0.1.4" - inquirer "^6.2.2" - js-yaml "^3.13.0" + inquirer "^7.0.0" + is-glob "^4.0.0" + js-yaml "^3.13.1" json-stable-stringify-without-jsonify "^1.0.1" levn "^0.3.0" - lodash "^4.17.11" + lodash "^4.17.14" minimatch "^3.0.4" mkdirp "^0.5.1" natural-compare "^1.4.0" - optionator "^0.8.2" - path-is-inside "^1.0.2" + optionator "^0.8.3" progress "^2.0.0" regexpp "^2.0.1" - semver "^5.5.1" - strip-ansi "^4.0.0" - strip-json-comments "^2.0.1" + semver "^6.1.2" + strip-ansi "^5.2.0" + strip-json-comments "^3.0.1" table "^5.2.3" text-table "^0.2.0" + v8-compile-cache "^2.0.3" -espree@^5.0.1: - version "5.0.1" - resolved "https://registry.yarnpkg.com/espree/-/espree-5.0.1.tgz#5d6526fa4fc7f0788a5cf75b15f30323e2f81f7a" - integrity sha512-qWAZcWh4XE/RwzLJejfcofscgMc9CamR6Tn1+XRXNzrvUSSbiAjGOI/fggztjIi7y9VLPqnICMIPiGyr8JaZ0A== +espree@^6.1.2: + version "6.1.2" + resolved "https://registry.yarnpkg.com/espree/-/espree-6.1.2.tgz#6c272650932b4f91c3714e5e7b5f5e2ecf47262d" + integrity sha512-2iUPuuPP+yW1PZaMSDM9eyVf8D5P0Hi8h83YtZ5bPc/zHYjII5khoixIUTMO794NOY8F/ThF1Bo8ncZILarUTA== dependencies: - acorn "^6.0.7" - acorn-jsx "^5.0.0" - eslint-visitor-keys "^1.0.0" + acorn "^7.1.0" + acorn-jsx "^5.1.0" + eslint-visitor-keys "^1.1.0" -esprima@^3.1.3, esprima@~3.1.0: +esprima@^3.1.3: version "3.1.3" resolved "https://registry.yarnpkg.com/esprima/-/esprima-3.1.3.tgz#fdca51cee6133895e3c88d535ce49dbff62a4633" + integrity sha1-/cpRzuYTOJXjyI1TXOSdv/YqRjM= esprima@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/esprima/-/esprima-4.0.0.tgz#4499eddcd1110e0b218bacf2fa7f7f59f55ca804" + version "4.0.1" + resolved "https://registry.yarnpkg.com/esprima/-/esprima-4.0.1.tgz#13b04cdb3e6c5d19df91ab6987a8695619b0aa71" + integrity sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A== esquery@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/esquery/-/esquery-1.0.1.tgz#406c51658b1f5991a5f9b62b1dc25b00e3e5c708" + integrity sha512-SmiyZ5zIWH9VM+SRUReLS5Q8a7GxtRdxEBVZpm98rJM7Sb+A9DVCndXfkeFUd3byderg+EbDkfnevfCwynWaNA== dependencies: estraverse "^4.0.0" esrecurse@^4.1.0: version "4.2.1" resolved "https://registry.yarnpkg.com/esrecurse/-/esrecurse-4.2.1.tgz#007a3b9fdbc2b3bb87e4879ea19c92fdbd3942cf" + integrity sha512-64RBB++fIOAXPw3P9cy89qfMlvZEXZkqqJkjqqXIvzP5ezRZjW+lPWjw35UX/3EhUPFYbg5ER4JYgDw4007/DQ== dependencies: estraverse "^4.1.0" estraverse@^4.0.0, estraverse@^4.1.0, estraverse@^4.1.1, estraverse@^4.2.0: - version "4.2.0" - resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-4.2.0.tgz#0dee3fed31fcd469618ce7342099fc1afa0bdb13" + version "4.3.0" + resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-4.3.0.tgz#398ad3f3c5a24948be7725e83d11a7de28cdbd1d" + integrity sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw== -estree-walker@^0.6.0: - version "0.6.0" - resolved "https://registry.yarnpkg.com/estree-walker/-/estree-walker-0.6.0.tgz#5d865327c44a618dde5699f763891ae31f257dae" - integrity sha512-peq1RfVAVzr3PU/jL31RaOjUKLoZJpObQWJJ+LgfcxDUifyLZ1RjPQZTl0pzj2uJ45b7A7XpyppXvxdEqzo4rw== +estree-walker@^0.5.2: + version "0.5.2" + resolved "https://registry.yarnpkg.com/estree-walker/-/estree-walker-0.5.2.tgz#d3850be7529c9580d815600b53126515e146dd39" + integrity sha512-XpCnW/AE10ws/kDAs37cngSkvgIR8aN3G0MS85m7dUpuK2EREo9VJ00uvw6Dg/hXEpfsE1I1TvJOJr+Z+TL+ig== + +estree-walker@^0.6.1: + version "0.6.1" + resolved "https://registry.yarnpkg.com/estree-walker/-/estree-walker-0.6.1.tgz#53049143f40c6eb918b23671d1fe3219f3a1b362" + integrity sha512-SqmZANLWS0mnatqbSfRP5g8OXZC12Fgg1IwNtLsyHDzJizORW4khDfjPqJZsemPWBB2uqykUah5YpQ6epsqC/w== esutils@^2.0.2: - version "2.0.2" - resolved "https://registry.yarnpkg.com/esutils/-/esutils-2.0.2.tgz#0abf4f1caa5bcb1f7a9d8acc6dea4faaa04bac9b" + version "2.0.3" + resolved "https://registry.yarnpkg.com/esutils/-/esutils-2.0.3.tgz#74d2eb4de0b8da1293711910d50775b9b710ef64" + integrity sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g== event-emitter@~0.3.5: version "0.3.5" resolved "https://registry.yarnpkg.com/event-emitter/-/event-emitter-0.3.5.tgz#df8c69eef1647923c7157b9ce83840610b02cc39" + integrity sha1-34xp7vFkeSPHFXuc6DhAYQsCzDk= dependencies: d "1" es5-ext "~0.10.14" @@ -4043,53 +4349,28 @@ eventemitter3@^3.1.0: resolved "https://registry.yarnpkg.com/eventemitter3/-/eventemitter3-3.1.2.tgz#2d3d48f9c346698fce83a85d7d664e98535df6e7" integrity sha512-tvtQIeLVHjDkJYnzf2dgVMxfuSGJeM/7UCG17TT4EumTfNtF+0nebF/4zWOIkCreAbtNqhGEboB6BWrwqNaw4Q== -events@^1.0.0: - version "1.1.1" - resolved "https://registry.yarnpkg.com/events/-/events-1.1.1.tgz#9ebdb7635ad099c70dcc4c2a1f5004288e8bd924" - events@^2.0.0: version "2.1.0" resolved "https://registry.yarnpkg.com/events/-/events-2.1.0.tgz#2a9a1e18e6106e0e812aa9ebd4a819b3c29c0ba5" + integrity sha512-3Zmiobend8P9DjmKAty0Era4jV8oJ0yGYe2nJJAxgymF9+N8F2m0hhZiMoWtcfepExzNKZumFU3ksdQbInGWCg== evp_bytestokey@^1.0.0, evp_bytestokey@^1.0.3: version "1.0.3" resolved "https://registry.yarnpkg.com/evp_bytestokey/-/evp_bytestokey-1.0.3.tgz#7fcbdb198dc71959432efe13842684e0525acb02" + integrity sha512-/f2Go4TognH/KvCISP7OUsHn85hT9nUkxxA9BEWxFn+Oj9o8ZNLm/40hdlgSLyuOimsrTKLUMEorQexp/aPQeA== dependencies: md5.js "^1.3.4" safe-buffer "^5.1.1" exec-sh@^0.3.2: - version "0.3.2" - resolved "https://registry.yarnpkg.com/exec-sh/-/exec-sh-0.3.2.tgz#6738de2eb7c8e671d0366aea0b0db8c6f7d7391b" - integrity sha512-9sLAvzhI5nc8TpuQUh4ahMdCrWT00wPWz7j47/emR5+2qEfoZP5zzUXvx+vdx+H6ohhnsYC31iX04QLYJK8zTg== - -execa@^0.10.0: - version "0.10.0" - resolved "https://registry.yarnpkg.com/execa/-/execa-0.10.0.tgz#ff456a8f53f90f8eccc71a96d11bdfc7f082cb50" - dependencies: - cross-spawn "^6.0.0" - get-stream "^3.0.0" - is-stream "^1.1.0" - npm-run-path "^2.0.0" - p-finally "^1.0.0" - signal-exit "^3.0.0" - strip-eof "^1.0.0" - -execa@^0.7.0: - version "0.7.0" - resolved "https://registry.yarnpkg.com/execa/-/execa-0.7.0.tgz#944becd34cc41ee32a63a9faf27ad5a65fc59777" - dependencies: - cross-spawn "^5.0.1" - get-stream "^3.0.0" - is-stream "^1.1.0" - npm-run-path "^2.0.0" - p-finally "^1.0.0" - signal-exit "^3.0.0" - strip-eof "^1.0.0" + version "0.3.4" + resolved "https://registry.yarnpkg.com/exec-sh/-/exec-sh-0.3.4.tgz#3a018ceb526cc6f6df2bb504b2bfe8e3a4934ec5" + integrity sha512-sEFIkc61v75sWeOe72qyrqg2Qg0OuLESziUDk/O/z2qgS15y2gWVFrI6f2Qn/qw/0/NCfCEsmNA4zOjkwEZT1A== execa@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/execa/-/execa-1.0.0.tgz#c6236a5bb4df6d6f15e88e7f017798216749ddd8" + integrity sha512-adbxcyWV46qiHyvSp50TKt05tB4tK3HcmF7/nxfAdhnox83seTDbwnaqKO4sXRy7roHAIFqJP/Rw/AuEbX61LA== dependencies: cross-spawn "^6.0.0" get-stream "^4.0.0" @@ -4099,19 +4380,37 @@ execa@^1.0.0: signal-exit "^3.0.0" strip-eof "^1.0.0" +execa@^2.0.3: + version "2.1.0" + resolved "https://registry.yarnpkg.com/execa/-/execa-2.1.0.tgz#e5d3ecd837d2a60ec50f3da78fd39767747bbe99" + integrity sha512-Y/URAVapfbYy2Xp/gb6A0E7iR8xeqOCXsuuaoMn7A5PzrXUK84E1gyiEfq0wQd/GHA6GsoHWwhNq8anb0mleIw== + dependencies: + cross-spawn "^7.0.0" + get-stream "^5.0.0" + is-stream "^2.0.0" + merge-stream "^2.0.0" + npm-run-path "^3.0.0" + onetime "^5.1.0" + p-finally "^2.0.0" + signal-exit "^3.0.2" + strip-final-newline "^2.0.0" + exit@^0.1.2: version "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" + integrity sha1-t3c14xXOMPa27/D4OwQVGiJEliI= dependencies: debug "^2.3.3" define-property "^0.2.5" @@ -4124,42 +4423,54 @@ expand-brackets@^2.1.4: 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" + integrity sha1-l+gBqgUt8CRU3kawK/YhZCzchQI= dependencies: homedir-polyfill "^1.0.1" -expect@^24.8.0: - version "24.8.0" - resolved "https://registry.yarnpkg.com/expect/-/expect-24.8.0.tgz#471f8ec256b7b6129ca2524b2a62f030df38718d" - integrity sha512-/zYvP8iMDrzaaxHVa724eJBCKqSHmO0FA7EDkBiRHxg6OipmMn1fN+C8T9L9K8yr7UONkOifu6+LLH+z76CnaA== +expect@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/expect/-/expect-24.9.0.tgz#b75165b4817074fa4a157794f46fe9f1ba15b6ca" + integrity sha512-wvVAx8XIol3Z5m9zvZXiyZOQ+sRJqNTIm6sGjdWlaZIeupQGO3WbYI+15D/AmEwZywL6wtJkbAbJtzkOfBuR0Q== dependencies: - "@jest/types" "^24.8.0" + "@jest/types" "^24.9.0" ansi-styles "^3.2.0" - jest-get-type "^24.8.0" - jest-matcher-utils "^24.8.0" - jest-message-util "^24.8.0" - jest-regex-util "^24.3.0" + jest-get-type "^24.9.0" + jest-matcher-utils "^24.9.0" + jest-message-util "^24.9.0" + jest-regex-util "^24.9.0" + +ext@^1.1.2: + version "1.4.0" + resolved "https://registry.yarnpkg.com/ext/-/ext-1.4.0.tgz#89ae7a07158f79d35517882904324077e4379244" + integrity sha512-Key5NIsUxdqKg3vIsdw9dSuXpPCQ297y6wBjL30edxwPgt2E44WcWBZey/ZvUc6sERLTxKdyCu4gZFmUbk1Q7A== + dependencies: + type "^2.0.0" extend-shallow@^1.1.2: version "1.1.4" resolved "https://registry.yarnpkg.com/extend-shallow/-/extend-shallow-1.1.4.tgz#19d6bf94dfc09d76ba711f39b872d21ff4dd9071" + integrity sha1-Gda/lN/AnXa6cR85uHLSH/TdkHE= dependencies: kind-of "^1.1.0" extend-shallow@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/extend-shallow/-/extend-shallow-2.0.1.tgz#51af7d614ad9a9f610ea1bafbb989d6b1c56890f" + integrity sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8= dependencies: is-extendable "^0.1.0" extend-shallow@^3.0.0, extend-shallow@^3.0.2: version "3.0.2" resolved "https://registry.yarnpkg.com/extend-shallow/-/extend-shallow-3.0.2.tgz#26a71aaf073b39fb2127172746131c2704028db8" + integrity sha1-Jqcarwc7OfshJxcnRhMcJwQCjbg= dependencies: assign-symbols "^1.0.0" is-extendable "^1.0.1" @@ -4167,10 +4478,12 @@ extend-shallow@^3.0.0, extend-shallow@^3.0.2: extend@^3.0.0, extend@~3.0.2: version "3.0.2" resolved "https://registry.yarnpkg.com/extend/-/extend-3.0.2.tgz#f8b1136b4071fbd8eb140aff858b1019ec2915fa" + integrity sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g== external-editor@^3.0.3: - version "3.0.3" - resolved "https://registry.yarnpkg.com/external-editor/-/external-editor-3.0.3.tgz#5866db29a97826dbe4bf3afd24070ead9ea43a27" + version "3.1.0" + resolved "https://registry.yarnpkg.com/external-editor/-/external-editor-3.1.0.tgz#cb03f740befae03ea4d283caed2741a83f335495" + integrity sha512-hMQ4CX1p1izmuLYyZqLMO/qGNw10wSv9QDCPfzXfyFrOaCSSoRfqE1Kf1s5an66J5JZC62NewG+mK49jOCtQew== dependencies: chardet "^0.7.0" iconv-lite "^0.4.24" @@ -4179,12 +4492,14 @@ external-editor@^3.0.3: 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" + integrity sha512-Nmb6QXkELsuBr24CJSkilo6UHHgbekK5UiZgfE6UHD3Eb27YC6oD+bhcT+tJ6cl8dmsgdQxnWlcry8ksBIBLpw== dependencies: array-unique "^0.3.2" define-property "^1.0.0" @@ -4195,13 +4510,20 @@ extglob@^2.0.4: snapdragon "^0.8.1" to-regex "^3.0.1" -extsprintf@1.3.0, extsprintf@^1.2.0: +extsprintf@1.3.0: version "1.3.0" resolved "https://registry.yarnpkg.com/extsprintf/-/extsprintf-1.3.0.tgz#96918440e3041a7a414f8c52e3c574eb3c3e1e05" + integrity sha1-lpGEQOMEGnpBT4xS48V06zw+HgU= + +extsprintf@^1.2.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/extsprintf/-/extsprintf-1.4.0.tgz#e2689f8f356fad62cca65a3a91c5df5f9551692f" + integrity sha1-4mifjzVvrWLMplo6kcXfX5VRaS8= falafel@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/falafel/-/falafel-2.1.0.tgz#96bb17761daba94f46d001738b3cedf3a67fe06c" + integrity sha1-lrsXdh2rqU9G0AFzizzt86Z/4Gw= dependencies: acorn "^5.0.0" foreach "^2.0.5" @@ -4211,6 +4533,7 @@ falafel@^2.1.0: fancy-log@1.3.2: version "1.3.2" resolved "https://registry.yarnpkg.com/fancy-log/-/fancy-log-1.3.2.tgz#f41125e3d84f2e7d89a43d06d958c8f78be16be1" + integrity sha1-9BEl49hPLn2JpD0G2VjI94vha+E= dependencies: ansi-gray "^0.1.1" color-support "^1.1.3" @@ -4219,6 +4542,7 @@ fancy-log@1.3.2: fancy-log@^1.3.2, fancy-log@^1.3.3: version "1.3.3" resolved "https://registry.yarnpkg.com/fancy-log/-/fancy-log-1.3.3.tgz#dbc19154f558690150a23953a0adbd035be45fc7" + integrity sha512-k9oEhlyc0FrVh25qYuSELjr8oxsCoc4/LEZfg2iJJrfEk/tZL9bCoJE47gqAvI2m/AUjluCS4+3I0eTx8n3AEw== dependencies: ansi-gray "^0.1.1" color-support "^1.1.3" @@ -4228,14 +4552,17 @@ fancy-log@^1.3.2, fancy-log@^1.3.3: fast-deep-equal@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-2.0.1.tgz#7b05218ddf9667bf7f370bf7fdb2cb15fdd0aa49" + integrity sha1-ewUhjd+WZ79/Nwv3/bLLFf3Qqkk= fast-diff@^1.1.2: version "1.2.0" resolved "https://registry.yarnpkg.com/fast-diff/-/fast-diff-1.2.0.tgz#73ee11982d86caaf7959828d519cfe927fac5f03" + integrity sha512-xJuoT5+L99XlZ8twedaRf6Ax2TgQVxvgZOYoPKqZufmJib0tL2tegPBOZb1pVNgIhlqDlA0eO0c3wBvQcmzx4w== -fast-glob@^2.0.2: - version "2.2.4" - resolved "https://registry.yarnpkg.com/fast-glob/-/fast-glob-2.2.4.tgz#e54f4b66d378040e0e4d6a68ec36bbc5b04363c0" +fast-glob@^2.2.6: + version "2.2.7" + resolved "https://registry.yarnpkg.com/fast-glob/-/fast-glob-2.2.7.tgz#6953857c3afa475fff92ee6015d52da70a4cd39d" + integrity sha512-g1KuQwHOZAmOZMuBtHdxDtju+T2RT8jgCC9aANsbpdiDDTSnjgfuVsIBNKbUeJI3oKMRExcfNDtJl4OhbffMsw== dependencies: "@mrmlnc/readdir-enhanced" "^2.2.1" "@nodelib/fs.stat" "^1.1.2" @@ -4244,31 +4571,55 @@ fast-glob@^2.0.2: merge2 "^1.2.3" micromatch "^3.1.10" +fast-glob@^3.0.3: + version "3.1.1" + resolved "https://registry.yarnpkg.com/fast-glob/-/fast-glob-3.1.1.tgz#87ee30e9e9f3eb40d6f254a7997655da753d7c82" + integrity sha512-nTCREpBY8w8r+boyFYAx21iL6faSsQynliPHM4Uf56SbkyohCNxpVPEH9xrF5TXKy+IsjkPUHDKiUkzBVRXn9g== + dependencies: + "@nodelib/fs.stat" "^2.0.2" + "@nodelib/fs.walk" "^1.2.3" + glob-parent "^5.1.0" + merge2 "^1.3.0" + micromatch "^4.0.2" + fast-json-stable-stringify@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz#d5142c0caee6b1189f87d3a76111064f86c8bbf2" + integrity sha1-1RQsDK7msRifh9OnYREGT4bIu/I= -fast-levenshtein@~2.0.4: +fast-levenshtein@~2.0.6: version "2.0.6" resolved "https://registry.yarnpkg.com/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz#3d8a5c66883a16a30ca8643e851f19baa7797917" + integrity sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc= -fastparse@^1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/fastparse/-/fastparse-1.1.1.tgz#d1e2643b38a94d7583b479060e6c4affc94071f8" +fast-safe-stringify@^2.0.7: + version "2.0.7" + resolved "https://registry.yarnpkg.com/fast-safe-stringify/-/fast-safe-stringify-2.0.7.tgz#124aa885899261f68aedb42a7c080de9da608743" + integrity sha512-Utm6CdzT+6xsDk2m8S6uL8VHxNwI6Jub+e9NYTcAms28T84pTa25GJQV9j0CY0N1rM8hK4x6grpF2BQf+2qwVA== + +fastq@^1.6.0: + version "1.6.0" + resolved "https://registry.yarnpkg.com/fastq/-/fastq-1.6.0.tgz#4ec8a38f4ac25f21492673adb7eae9cfef47d1c2" + integrity sha512-jmxqQ3Z/nXoeyDmWAzF9kH1aGZSis6e/SbfPmJpUnyZ0ogr6iscHQaml4wsEepEWSdtmpy+eVXmCRIMpxaXqOA== + dependencies: + reusify "^1.0.0" fb-watchman@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/fb-watchman/-/fb-watchman-2.0.0.tgz#54e9abf7dfa2f26cd9b1636c588c1afc05de5d58" + version "2.0.1" + resolved "https://registry.yarnpkg.com/fb-watchman/-/fb-watchman-2.0.1.tgz#fc84fb39d2709cf3ff6d743706157bb5708a8a85" + integrity sha512-DkPJKQeY6kKwmuMretBhr7G6Vodr7bFwDYTXIkfG1gjvNpaxBTQV3PbXg6bR1c1UP4jPOX0jHUbbHANL9vRjVg== dependencies: - bser "^2.0.0" + bser "2.1.1" figgy-pudding@^3.4.1, figgy-pudding@^3.5.1: version "3.5.1" resolved "https://registry.yarnpkg.com/figgy-pudding/-/figgy-pudding-3.5.1.tgz#862470112901c727a0e495a80744bd5baa1d6790" + integrity sha512-vNKxJHTEKNThjfrdJwHc7brvM6eVevuO5nTj6ez8ZQ1qbXTvGthucRF7S4vf2cr71QVnT70V34v0S1DyQsti0w== figures@^1.7.0: version "1.7.0" resolved "https://registry.yarnpkg.com/figures/-/figures-1.7.0.tgz#cbe1e3affcf1cd44b80cadfed28dc793a9701d2e" + integrity sha1-y+Hjr/zxzUS4DK3+0o3Hk6lwHS4= dependencies: escape-string-regexp "^1.0.5" object-assign "^4.1.0" @@ -4276,6 +4627,14 @@ figures@^1.7.0: figures@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/figures/-/figures-2.0.0.tgz#3ab1a2d2a62c8bfb431a0c94cb797a2fce27c962" + integrity sha1-OrGi0qYsi/tDGgyUy3l6L84nyWI= + dependencies: + escape-string-regexp "^1.0.5" + +figures@^3.0.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/figures/-/figures-3.1.0.tgz#4b198dd07d8d71530642864af2d45dd9e459c4ec" + integrity sha512-ravh8VRXqHuMvZt/d8GblBeqDMkdJMBdv/2KntFH+ra5MXkO7nxNKpzQ3n6QD/2da1kH0aWmNISdvhM7gl2gVg== dependencies: escape-string-regexp "^1.0.5" @@ -4289,46 +4648,49 @@ file-entry-cache@^5.0.1: 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= fill-range@^2.1.0: - version "2.2.3" - resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-2.2.3.tgz#50b77dfd7e469bc7492470963699fe7a8485a723" + version "2.2.4" + resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-2.2.4.tgz#eb1e773abb056dcd8df2bfdf6af59b8b3a936565" + integrity sha512-cnrcCbj01+j2gTG921VZPnHbjmdAf8oQV/iGeV2kZxGSyfYjjTyY79ErsK1WJWMpw6DaApEX72binqJE+/d+5Q== dependencies: is-number "^2.1.0" isobject "^2.0.0" - randomatic "^1.1.3" + randomatic "^3.0.0" 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" + integrity sha1-1USBHUKPmOsGpj3EAtJAPDKMOPc= dependencies: extend-shallow "^2.0.1" is-number "^3.0.0" repeat-string "^1.6.1" to-regex-range "^2.1.0" +fill-range@^7.0.1: + version "7.0.1" + resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-7.0.1.tgz#1919a6a7c75fe38b2c7c77e5198535da9acdda40" + integrity sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ== + dependencies: + to-regex-range "^5.0.1" + find-cache-dir@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/find-cache-dir/-/find-cache-dir-2.0.0.tgz#4c1faed59f45184530fb9d7fa123a4d04a98472d" + version "2.1.0" + resolved "https://registry.yarnpkg.com/find-cache-dir/-/find-cache-dir-2.1.0.tgz#8d0f94cd13fe43c6c7c261a0d86115ca918c05f7" + integrity sha512-Tq6PixE0w/VMFfCgbONnkiQIVol/JJL7nRMi20fqzA4NRs9AfeqMGeRdPi3wIhYkxjeBaWh2rxwapn5Tu3IqOQ== dependencies: commondir "^1.0.1" - make-dir "^1.0.0" + make-dir "^2.0.0" pkg-dir "^3.0.0" -find-parent-dir@^0.3.0: - version "0.3.0" - resolved "https://registry.yarnpkg.com/find-parent-dir/-/find-parent-dir-0.3.0.tgz#33c44b429ab2b2f0646299c5f9f718f376ff8d54" - -find-root@^1.0.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/find-root/-/find-root-1.1.0.tgz#abcfc8ba76f708c42a97b3d685b7e9450bfb9ce4" - integrity sha512-NKfW6bec6GfKc0SGx1e07QZY9PE99u0Bft/0rzSD5k3sO/vwkVUpDUKVm5Gpp5Ue3YfShPFTX2070tDs5kB9Ng== - find-up@^1.0.0: version "1.1.2" resolved "https://registry.yarnpkg.com/find-up/-/find-up-1.1.2.tgz#6b2e9822b1a2ce0a60ab64d610eccad53cb24d0f" + integrity sha1-ay6YIrGizgpgq2TWEOzK1TyyTQ8= dependencies: path-exists "^2.0.0" pinkie-promise "^2.0.0" @@ -4336,18 +4698,29 @@ find-up@^1.0.0: find-up@^2.0.0, find-up@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/find-up/-/find-up-2.1.0.tgz#45d1b7e506c717ddd482775a2b77920a3c0c57a7" + integrity sha1-RdG35QbHF93UgndaK3eSCjwMV6c= dependencies: locate-path "^2.0.0" find-up@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/find-up/-/find-up-3.0.0.tgz#49169f1d7993430646da61ecc5ae355c21c97b73" + integrity sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg== dependencies: locate-path "^3.0.0" +find-up@^4.0.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/find-up/-/find-up-4.1.0.tgz#97afe7d6cdc0bc5928584b7c8d7b16e8a9aa5d19" + integrity sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw== + dependencies: + locate-path "^5.0.0" + path-exists "^4.0.0" + findup-sync@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/findup-sync/-/findup-sync-2.0.0.tgz#9326b1488c22d1a6088650a86901b2d9a90a2cbc" + integrity sha1-kyaxSIwi0aYIhlCoaQGy2akKLLw= dependencies: detect-file "^1.0.0" is-glob "^3.1.0" @@ -4365,8 +4738,9 @@ findup-sync@^3.0.0: resolve-dir "^1.0.1" fined@^1.0.1: - version "1.1.0" - resolved "https://registry.yarnpkg.com/fined/-/fined-1.1.0.tgz#b37dc844b76a2f5e7081e884f7c0ae344f153476" + version "1.2.0" + resolved "https://registry.yarnpkg.com/fined/-/fined-1.2.0.tgz#d00beccf1aa2b475d16d423b0238b713a2c4a37b" + integrity sha512-ZYDqPLGxDkDhDZBjZBb+oD1+j0rA4E0pXY50eplAAOPg2N/gUBSSk5IM1/QhPfyVo19lJ+CvXpqfvk+b2p/8Ng== dependencies: expand-tilde "^2.0.2" is-plain-object "^2.0.3" @@ -4377,12 +4751,14 @@ fined@^1.0.1: first-chunk-stream@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/first-chunk-stream/-/first-chunk-stream-2.0.0.tgz#1bdecdb8e083c0664b91945581577a43a9f31d70" + integrity sha1-G97NuOCDwGZLkZRVgVd6Q6nzHXA= dependencies: readable-stream "^2.0.2" flagged-respawn@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/flagged-respawn/-/flagged-respawn-1.0.0.tgz#4e79ae9b2eb38bf86b3bb56bf3e0a56aa5fcabd7" + version "1.0.1" + resolved "https://registry.yarnpkg.com/flagged-respawn/-/flagged-respawn-1.0.1.tgz#e7de6f1279ddd9ca9aac8a5971d618606b3aab41" + integrity sha512-lNaHNVymajmk0OJMBn8fVUAU1BtDeKIqKoVhk4xAALB57aALg6b4W0MfJ/cUE0g9YBXy5XhSlPIpYIJ7HaY/3Q== flat-cache@^2.0.1: version "2.0.1" @@ -4394,54 +4770,56 @@ flat-cache@^2.0.1: write "1.0.3" flatted@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/flatted/-/flatted-2.0.0.tgz#55122b6536ea496b4b44893ee2608141d10d9916" - integrity sha512-R+H8IZclI8AAkSBRQJLVOsxwAoHd6WC40b4QTNWIjzAa6BXOBfQcM587MXDTVPeYaopFNWHUFLx7eNmHDSxMWg== + version "2.0.1" + resolved "https://registry.yarnpkg.com/flatted/-/flatted-2.0.1.tgz#69e57caa8f0eacbc281d2e2cb458d46fdb449e08" + integrity sha512-a1hQMktqW9Nmqr5aktAux3JMNqaucxGcjtjWnZLHX7yyPCmlSV3M54nGYbqT8K+0GhF3NBgmJCc3ma+WOgX8Jg== -flow-bin@^0.94.0: - version "0.94.0" - resolved "https://registry.yarnpkg.com/flow-bin/-/flow-bin-0.94.0.tgz#b5d58fe7559705b73a18229f97edfc3ab6ffffcb" - integrity sha512-DYF7r9CJ/AksfmmB4+q+TyLMoeQPRnqtF1Pk7KY3zgfkB/nVuA3nXyzqgsIPIvnMSiFEXQcFK4z+iPxSLckZhQ== +flow-bin@^0.108.0: + version "0.108.0" + resolved "https://registry.yarnpkg.com/flow-bin/-/flow-bin-0.108.0.tgz#6a42c85fd664d23dd937d925851e8e6ab5d71393" + integrity sha512-hPEyCP1J8rdhNDfCAA5w7bN6HUNBDcHVg/ABU5JVo0gUFMx+uRewpyEH8LlLBGjVQuIpbaPpaqpoaQhAVyaYww== flush-write-stream@^1.0.0, flush-write-stream@^1.0.2: - version "1.0.3" - resolved "https://registry.yarnpkg.com/flush-write-stream/-/flush-write-stream-1.0.3.tgz#c5d586ef38af6097650b49bc41b55fabb19f35bd" + version "1.1.1" + resolved "https://registry.yarnpkg.com/flush-write-stream/-/flush-write-stream-1.1.1.tgz#8dd7d873a1babc207d94ead0c2e0e44276ebf2e8" + integrity sha512-3Z4XhFZ3992uIq0XOqb9AreonueSYphE6oYbpt5+3u06JWklbsPkNv3ZKkP9Bz/r+1MWCaMoSQ28P85+1Yc77w== dependencies: - inherits "^2.0.1" - readable-stream "^2.0.4" - -fn-name@~2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/fn-name/-/fn-name-2.0.1.tgz#5214d7537a4d06a4a301c0cc262feb84188002e7" - integrity sha1-UhTXU3pNBqSjAcDMJi/rhBiAAuc= + inherits "^2.0.3" + readable-stream "^2.3.6" for-in@^1.0.1, for-in@^1.0.2: version "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" + integrity sha1-xjMy9BXO3EsE2/5wz4NklMU8tEs= dependencies: for-in "^1.0.1" -foreach@^2.0.5: +foreach@^2.0.5, foreach@~2.0.1: version "2.0.5" resolved "https://registry.yarnpkg.com/foreach/-/foreach-2.0.5.tgz#0bee005018aeb260d0a3af3ae658dd0136ec1b99" + integrity sha1-C+4AUBiusmDQo6865ljdATbsG5k= forever-agent@~0.6.1: version "0.6.1" resolved "https://registry.yarnpkg.com/forever-agent/-/forever-agent-0.6.1.tgz#fbc71f0c41adeb37f96c577ad1ed42d8fdacca91" + integrity sha1-+8cfDEGt6zf5bFd60e1C2P2sypE= form-data@~2.3.2: version "2.3.3" resolved "https://registry.yarnpkg.com/form-data/-/form-data-2.3.3.tgz#dcce52c05f644f298c6a7ab936bd724ceffbf3a6" + integrity sha512-1lLKB2Mu3aGP1Q/2eCOx0fNbRMe7XdwktwOruhfqqd0rIJWwN4Dh+E3hrPSlDCXnSR7UtZ1N38rVXm+6+MEhJQ== dependencies: asynckit "^0.4.0" combined-stream "^1.0.6" @@ -4450,33 +4828,38 @@ form-data@~2.3.2: fragment-cache@^0.2.1: version "0.2.1" resolved "https://registry.yarnpkg.com/fragment-cache/-/fragment-cache-0.2.1.tgz#4290fad27f13e89be7f33799c6bc5a0abfff0d19" + integrity sha1-QpD60n8T6Jvn8zeZxrxaCr//DRk= dependencies: map-cache "^0.2.2" from2@^2.1.0: version "2.3.0" resolved "https://registry.yarnpkg.com/from2/-/from2-2.3.0.tgz#8bfb5502bde4a4d36cfdeea007fcca21d7e382af" + integrity sha1-i/tVAr3kpNNs/e6gB/zKIdfjgq8= dependencies: inherits "^2.0.1" readable-stream "^2.0.0" -fs-extra@^7.0.0: - version "7.0.1" - resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-7.0.1.tgz#4f189c44aa123b895f722804f55ea23eadc348e9" +fs-extra@^8.1.0: + version "8.1.0" + resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-8.1.0.tgz#49d43c45a88cd9677668cb7be1b46efdb8d2e1c0" + integrity sha512-yhlQgA6mnOJUKOsRUFsgJdQCvkKhcz8tlZG5HBQfReYZy46OwLcY+Zia0mtdHsOo9y/hP+CxMN0TU9QxoOtG4g== dependencies: - graceful-fs "^4.1.2" + graceful-fs "^4.2.0" jsonfile "^4.0.0" universalify "^0.1.0" fs-minipass@^1.2.5: - version "1.2.5" - resolved "https://registry.yarnpkg.com/fs-minipass/-/fs-minipass-1.2.5.tgz#06c277218454ec288df77ada54a03b8702aacb9d" + version "1.2.7" + resolved "https://registry.yarnpkg.com/fs-minipass/-/fs-minipass-1.2.7.tgz#ccff8570841e7fe4265693da88936c55aed7f7c7" + integrity sha512-GWSSJGFy4e9GUeCcbIkED+bgAoFyj7XF1mV8rma3QW4NIqX9Kyx79N/PF61H5udOV3aY1IaMLs6pGbH71nlCTA== dependencies: - minipass "^2.2.1" + minipass "^2.6.0" fs-mkdirp-stream@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/fs-mkdirp-stream/-/fs-mkdirp-stream-1.0.0.tgz#0b7815fc3201c6a69e14db98ce098c16935259eb" + integrity sha1-C3gV/DIBxqaeFNuYzgmMFpNSWes= dependencies: graceful-fs "^4.1.11" through2 "^2.0.3" @@ -4484,10 +4867,12 @@ fs-mkdirp-stream@^1.0.0: fs-readdir-recursive@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/fs-readdir-recursive/-/fs-readdir-recursive-1.1.0.tgz#e32fc030a2ccee44a6b5371308da54be0b397d27" + integrity sha512-GNanXlVr2pf02+sPN40XN8HG+ePaNcvM0q5mZBd668Obwb0yD5GiUbZOFgwn8kGMY6I3mdyDJzieUy3PTYyTRA== fs-write-stream-atomic@^1.0.8: version "1.0.10" resolved "https://registry.yarnpkg.com/fs-write-stream-atomic/-/fs-write-stream-atomic-1.0.10.tgz#b47df53493ef911df75731e70a9ded0189db40c9" + integrity sha1-tH31NJPvkR33VzHnCp3tAYnbQMk= dependencies: graceful-fs "^4.1.2" iferr "^0.1.5" @@ -4497,6 +4882,7 @@ fs-write-stream-atomic@^1.0.8: fs.realpath@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f" + integrity sha1-FQStJSMVjKpA20onh8sBQRmU6k8= fsevents@^1.2.7: version "1.2.9" @@ -4509,22 +4895,24 @@ fsevents@^1.2.7: function-bind@^1.0.2, function-bind@^1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.1.tgz#a56899d3ea3c9bab874bb9773b7c5ede92f4895d" + integrity sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A== functional-red-black-tree@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz#1b0ab3bd553b2a0d6399d29c0e3ea0b252078327" + integrity sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc= -g-status@^2.0.2: - version "2.0.2" - resolved "https://registry.yarnpkg.com/g-status/-/g-status-2.0.2.tgz#270fd32119e8fc9496f066fe5fe88e0a6bc78b97" +fwd-stream@^1.0.4: + version "1.0.4" + resolved "https://registry.yarnpkg.com/fwd-stream/-/fwd-stream-1.0.4.tgz#ed281cabed46feecf921ee32dc4c50b372ac7cfa" + integrity sha1-7Sgcq+1G/uz5Ie4y3ExQs3KsfPo= dependencies: - arrify "^1.0.1" - matcher "^1.0.0" - simple-git "^1.85.0" + readable-stream "~1.0.26-4" gauge@~2.7.3: version "2.7.4" resolved "https://registry.yarnpkg.com/gauge/-/gauge-2.7.4.tgz#2c03405c7538c39d7eb37b317022e325fb018bf7" + integrity sha1-LANAXHU4w51+s3sxcCLjJfsBi/c= dependencies: aproba "^1.0.3" console-control-strings "^1.0.0" @@ -4538,18 +4926,32 @@ gauge@~2.7.3: genfun@^5.0.0: version "5.0.0" resolved "https://registry.yarnpkg.com/genfun/-/genfun-5.0.0.tgz#9dd9710a06900a5c4a5bf57aca5da4e52fe76537" + integrity sha512-KGDOARWVga7+rnB3z9Sd2Letx515owfk0hSxHGuqjANb1M+x2bGZGqHLiozPsYMdM2OubeMni/Hpwmjq6qIUhA== + +get-assigned-identifiers@^1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/get-assigned-identifiers/-/get-assigned-identifiers-1.2.0.tgz#6dbf411de648cbaf8d9169ebb0d2d576191e2ff1" + integrity sha512-mBBwmeGTrxEMO4pMaaf/uUEFHnYtwr8FTe8Y/mer4rcV/bye0qGm6pw1bGZFGStxC5O76c5ZAVBGnqHmOaJpdQ== get-caller-file@^1.0.1: - version "1.0.2" - resolved "https://registry.yarnpkg.com/get-caller-file/-/get-caller-file-1.0.2.tgz#f702e63127e7e231c160a80c1554acb70d5047e5" + version "1.0.3" + resolved "https://registry.yarnpkg.com/get-caller-file/-/get-caller-file-1.0.3.tgz#f978fa4c90d1dfe7ff2d6beda2a515e713bdcf4a" + integrity sha512-3t6rVToeoZfYSGd8YoLFR2DJkiQrIiUrGcjvFX2mDw3bn6k2OtwHN0TNCLbBO+w8qTvimhDkv+LSscbJY1vE6w== -get-own-enumerable-property-symbols@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/get-own-enumerable-property-symbols/-/get-own-enumerable-property-symbols-2.0.1.tgz#5c4ad87f2834c4b9b4e84549dc1e0650fb38c24b" +get-caller-file@^2.0.1: + version "2.0.5" + resolved "https://registry.yarnpkg.com/get-caller-file/-/get-caller-file-2.0.5.tgz#4f94412a82db32f36e3b0b9741f8a97feb031f7e" + integrity sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg== + +get-own-enumerable-property-symbols@^3.0.0: + version "3.0.1" + resolved "https://registry.yarnpkg.com/get-own-enumerable-property-symbols/-/get-own-enumerable-property-symbols-3.0.1.tgz#6f7764f88ea11e0b514bd9bd860a132259992ca4" + integrity sha512-09/VS4iek66Dh2bctjRkowueRJbY1JDGR1L/zRxO1Qk8Uxs6PnqaNSqalpizPT+CDjre3hnEsuzvhgomz9qYrA== get-pkg-repo@^1.0.0: version "1.4.0" resolved "https://registry.yarnpkg.com/get-pkg-repo/-/get-pkg-repo-1.4.0.tgz#c73b489c06d80cc5536c2c853f9e05232056972d" + integrity sha1-xztInAbYDMVTbCyFP54FIyBWly0= dependencies: hosted-git-info "^2.1.4" meow "^3.3.0" @@ -4557,42 +4959,51 @@ get-pkg-repo@^1.0.0: parse-github-repo-url "^1.3.0" through2 "^2.0.0" -get-port@^3.2.0: - version "3.2.0" - resolved "https://registry.yarnpkg.com/get-port/-/get-port-3.2.0.tgz#dd7ce7de187c06c8bf353796ac71e099f0980ebc" +get-port@^4.2.0: + version "4.2.0" + resolved "https://registry.yarnpkg.com/get-port/-/get-port-4.2.0.tgz#e37368b1e863b7629c43c5a323625f95cf24b119" + integrity sha512-/b3jarXkH8KJoOMQc3uVGHASwGLPq3gSFJ7tgJm2diza+bydJPTGOibin2steecKeOylE8oY2JERlVWkAJO6yw== get-stdin@^4.0.1: version "4.0.1" resolved "https://registry.yarnpkg.com/get-stdin/-/get-stdin-4.0.1.tgz#b968c6b0a04384324902e8bf1a5df32579a450fe" + integrity sha1-uWjGsKBDhDJJAui/Gl3zJXmkUP4= get-stdin@^7.0.0: version "7.0.0" resolved "https://registry.yarnpkg.com/get-stdin/-/get-stdin-7.0.0.tgz#8d5de98f15171a125c5e516643c7a6d0ea8a96f6" integrity sha512-zRKcywvrXlXsA0v0i9Io4KDRaAw7+a1ZpjRwl9Wox8PFlVCCHra7E9c4kqXCoCM9nR5tBkaTTZRBoCm60bFqTQ== -get-stream@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-3.0.0.tgz#8e943d1358dc37555054ecbe2edb05aa174ede14" - get-stream@^4.0.0, get-stream@^4.1.0: version "4.1.0" resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-4.1.0.tgz#c1b255575f3dc21d59bfc79cd3d2b46b1c3a54b5" + integrity sha512-GMat4EJ5161kIy2HevLlr4luNjBgvmj413KaQA7jt4V8B4RDsfpHk7WQ9GVqfYyyx8OS/L66Kox+rJRNklLK7w== + dependencies: + pump "^3.0.0" + +get-stream@^5.0.0: + version "5.1.0" + resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-5.1.0.tgz#01203cdc92597f9b909067c3e656cc1f4d3c4dc9" + integrity sha512-EXr1FOzrzTfGeL0gQdeFEvOMm2mzMOglyiOXSTpPC+iAjAKftbr3jpCMWynogwYnM+eSj9sHGc6wjIcDvYiygw== dependencies: pump "^3.0.0" get-value@^2.0.3, get-value@^2.0.6: version "2.0.6" resolved "https://registry.yarnpkg.com/get-value/-/get-value-2.0.6.tgz#dc15ca1c672387ca76bd37ac0a395ba2042a2c28" + integrity sha1-3BXKHGcjh8p2vTesCjlbogQqLCg= getpass@^0.1.1: version "0.1.7" resolved "https://registry.yarnpkg.com/getpass/-/getpass-0.1.7.tgz#5eff8e3e684d569ae4cb2b1282604e8ba62149fa" + integrity sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo= dependencies: assert-plus "^1.0.0" git-raw-commits@2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/git-raw-commits/-/git-raw-commits-2.0.0.tgz#d92addf74440c14bcc5c83ecce3fb7f8a79118b5" + integrity sha512-w4jFEJFgKXMQJ0H0ikBk2S+4KP2VEjhCvLCNqbNRQC8BgGWgLKNCO7a9K9LI+TVT7Gfoloje502sEnctibffgg== dependencies: dargs "^4.0.1" lodash.template "^4.0.2" @@ -4603,16 +5014,18 @@ git-raw-commits@2.0.0: git-remote-origin-url@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/git-remote-origin-url/-/git-remote-origin-url-2.0.0.tgz#5282659dae2107145a11126112ad3216ec5fa65f" + integrity sha1-UoJlna4hBxRaERJhEq0yFuxfpl8= dependencies: gitconfiglocal "^1.0.0" pify "^2.3.0" -git-semver-tags@^2.0.2: - version "2.0.2" - resolved "https://registry.yarnpkg.com/git-semver-tags/-/git-semver-tags-2.0.2.tgz#f506ec07caade191ac0c8d5a21bdb8131b4934e3" +git-semver-tags@^2.0.3: + version "2.0.3" + resolved "https://registry.yarnpkg.com/git-semver-tags/-/git-semver-tags-2.0.3.tgz#48988a718acf593800f99622a952a77c405bfa34" + integrity sha512-tj4FD4ww2RX2ae//jSrXZzrocla9db5h0V7ikPl1P/WwoZar9epdUhwR7XHXSgc+ZkNq72BEEerqQuicoEQfzA== dependencies: meow "^4.0.0" - semver "^5.5.0" + semver "^6.0.0" git-up@^4.0.0: version "4.0.1" @@ -4632,12 +5045,14 @@ git-url-parse@^11.1.2: gitconfiglocal@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/gitconfiglocal/-/gitconfiglocal-1.0.0.tgz#41d045f3851a5ea88f03f24ca1c6178114464b9b" + integrity sha1-QdBF84UaXqiPA/JMocYXgRRGS5s= dependencies: ini "^1.3.2" 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" @@ -4645,19 +5060,29 @@ glob-base@^0.3.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.0.1, glob-parent@^3.1.0: version "3.1.0" resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-3.1.0.tgz#9e6af6299d8d3bd2bd40430832bd113df906c5ae" + integrity sha1-nmr2KZ2NO9K9QEMIMr0RPfkGxa4= dependencies: is-glob "^3.1.0" path-dirname "^1.0.0" +glob-parent@^5.0.0, glob-parent@^5.1.0: + version "5.1.0" + resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-5.1.0.tgz#5f4c1d1e748d30cd73ad2944b3577a81b081e8c2" + integrity sha512-qjtRgnIVmOfnKUE3NJAQEdk+lKrxfw8t5ke7SXtfMTHcjsBfOfWXCQfdb30zfDoZQ2IRSIiidmjtbHZPZ++Ihw== + dependencies: + is-glob "^4.0.1" + glob-stream@^6.1.0: version "6.1.0" resolved "https://registry.yarnpkg.com/glob-stream/-/glob-stream-6.1.0.tgz#7045c99413b3eb94888d83ab46d0b404cc7bdde4" + integrity sha1-cEXJlBOz65SIjYOrRtC0BMx73eQ= dependencies: extend "^3.0.0" glob "^7.1.1" @@ -4673,6 +5098,7 @@ glob-stream@^6.1.0: glob-to-regexp@^0.3.0: version "0.3.0" resolved "https://registry.yarnpkg.com/glob-to-regexp/-/glob-to-regexp-0.3.0.tgz#8c5a1494d2066c570cc3bfe4496175acc4d502ab" + integrity sha1-jFoUlNIGbFcMw7/kSWF1rMTVAqs= glob-watcher@^5.0.3: version "5.0.3" @@ -4686,10 +5112,10 @@ glob-watcher@^5.0.3: just-debounce "^1.0.0" object.defaults "^1.1.0" -glob@^7.0.0, glob@^7.0.3, glob@^7.1.0, glob@^7.1.1, glob@^7.1.2, glob@^7.1.3: - version "7.1.3" - resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.3.tgz#3960832d3f1574108342dafd3a67b332c0969df1" - integrity sha512-vcfuiIxogLV4DlGBHIUOwI0IbrJ8HWPc4MU7HzviGeNho/UJDfi6B5p3sHeWIQ0KGIU0Jpxi5ZHxemQfLkkAwQ== +glob@^7.0.0, glob@^7.0.3, glob@^7.1.0, glob@^7.1.1, glob@^7.1.2, glob@^7.1.3, glob@^7.1.4: + version "7.1.6" + resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.6.tgz#141f33b81a7c2492e125594307480c46679278a6" + integrity sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA== dependencies: fs.realpath "^1.0.0" inflight "^1.0.4" @@ -4701,6 +5127,7 @@ glob@^7.0.0, glob@^7.0.3, glob@^7.1.0, glob@^7.1.1, glob@^7.1.2, glob@^7.1.3: global-modules@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/global-modules/-/global-modules-1.0.0.tgz#6d770f0eb523ac78164d72b5e71a8877265cc3ea" + integrity sha512-sKzpEkf11GpOFuw0Zzjzmt4B4UZwjOcG757PPvrfhxcLFbq0wpsgpOqxpxtxFiCG4DtG93M6XRVbF2oGdev7bg== dependencies: global-prefix "^1.0.1" is-windows "^1.0.1" @@ -4709,6 +5136,7 @@ global-modules@^1.0.0: global-prefix@^1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/global-prefix/-/global-prefix-1.0.2.tgz#dbf743c6c14992593c655568cb66ed32c0122ebe" + integrity sha1-2/dDxsFJklk8ZVVoy2btMsASLr4= dependencies: expand-tilde "^2.0.2" homedir-polyfill "^1.0.1" @@ -4716,51 +5144,67 @@ global-prefix@^1.0.1: is-windows "^1.0.1" which "^1.2.14" -globals@^11.1.0, globals@^11.7.0: - version "11.11.0" - resolved "https://registry.yarnpkg.com/globals/-/globals-11.11.0.tgz#dcf93757fa2de5486fbeed7118538adf789e9c2e" - integrity sha512-WHq43gS+6ufNOEqlrDBxVEbb8ntfXrfAUU2ZOpCxrBdGKW3gyv8mCxAfIBD0DroPKGrJ2eSsXsLtY9MPntsyTw== +globals@^11.1.0: + version "11.12.0" + resolved "https://registry.yarnpkg.com/globals/-/globals-11.12.0.tgz#ab8795338868a0babd8525758018c2a7eb95c42e" + integrity sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA== -globby@^6.1.0: - version "6.1.0" - resolved "https://registry.yarnpkg.com/globby/-/globby-6.1.0.tgz#f5a6d70e8395e21c858fb0489d64df02424d506c" +globals@^12.1.0: + version "12.3.0" + resolved "https://registry.yarnpkg.com/globals/-/globals-12.3.0.tgz#1e564ee5c4dded2ab098b0f88f24702a3c56be13" + integrity sha512-wAfjdLgFsPZsklLJvOBUBmzYE8/CwhEqSBEMRXA3qxIiNtyqvjYurAtIfDh6chlEPUfmTY3MnZh5Hfh4q0UlIw== dependencies: - array-union "^1.0.1" - glob "^7.0.3" - object-assign "^4.0.1" - pify "^2.0.0" - pinkie-promise "^2.0.0" + type-fest "^0.8.1" -globby@^8.0.1: - version "8.0.1" - resolved "https://registry.yarnpkg.com/globby/-/globby-8.0.1.tgz#b5ad48b8aa80b35b814fc1281ecc851f1d2b5b50" +globby@^10.0.1: + version "10.0.1" + resolved "https://registry.yarnpkg.com/globby/-/globby-10.0.1.tgz#4782c34cb75dd683351335c5829cc3420e606b22" + integrity sha512-sSs4inE1FB2YQiymcmTv6NWENryABjUNPeWhOvmn4SjtKybglsyPZxFB3U1/+L1bYi0rNZDqCLlHyLYDl1Pq5A== dependencies: - array-union "^1.0.1" - dir-glob "^2.0.0" - fast-glob "^2.0.2" - glob "^7.1.2" - ignore "^3.3.5" - pify "^3.0.0" - slash "^1.0.0" + "@types/glob" "^7.1.1" + array-union "^2.1.0" + dir-glob "^3.0.1" + fast-glob "^3.0.3" + glob "^7.1.3" + ignore "^5.1.1" + merge2 "^1.2.3" + slash "^3.0.0" + +globby@^9.2.0: + version "9.2.0" + resolved "https://registry.yarnpkg.com/globby/-/globby-9.2.0.tgz#fd029a706c703d29bdd170f4b6db3a3f7a7cb63d" + integrity sha512-ollPHROa5mcxDEkwg6bPt3QbEf4pDQSNtd6JPL1YvOvAo/7/0VAm9TccUeoTmarjPw4pfUthSCqcyfNB1I3ZSg== + dependencies: + "@types/glob" "^7.1.1" + array-union "^1.0.2" + dir-glob "^2.2.2" + fast-glob "^2.2.6" + glob "^7.1.3" + ignore "^4.0.3" + pify "^4.0.1" + slash "^2.0.0" glogg@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/glogg/-/glogg-1.0.1.tgz#dcf758e44789cc3f3d32c1f3562a3676e6a34810" + version "1.0.2" + resolved "https://registry.yarnpkg.com/glogg/-/glogg-1.0.2.tgz#2d7dd702beda22eb3bffadf880696da6d846313f" + integrity sha512-5mwUoSuBk44Y4EshyiqcH95ZntbDdTQqA3QYSrxmzj28Ai0vXBGMH1ApSANH14j2sIRtqCEyg6PfsuP7ElOEDA== dependencies: sparkles "^1.0.0" -graceful-fs@^4.0.0, graceful-fs@^4.1.11, graceful-fs@^4.1.15, graceful-fs@^4.1.2, graceful-fs@^4.1.6, graceful-fs@^4.1.9: - version "4.1.15" - resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.1.15.tgz#ffb703e1066e8a0eeaa4c8b80ba9253eeefbfb00" - integrity sha512-6uHUhOPEBgQ24HM+r6b/QwWfZq+yiFcipKFrOFiBEnWdy5sdzYoi+pJeQaPI5qOLRFqWmAXUPQNsielzdLoecA== +graceful-fs@^4.0.0, graceful-fs@^4.1.11, graceful-fs@^4.1.15, graceful-fs@^4.1.2, graceful-fs@^4.1.6, graceful-fs@^4.1.9, graceful-fs@^4.2.0, graceful-fs@^4.2.2: + version "4.2.3" + resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.3.tgz#4a12ff1b60376ef09862c2093edd908328be8423" + integrity sha512-a30VEBm4PEdx1dRB7MFK7BejejvCvBronbLjht+sHuGYj8PHs7M/5Z+rt5lw551vZ7yfTCj4Vuyy3mSJytDWRQ== growly@^1.3.0: version "1.3.0" resolved "https://registry.yarnpkg.com/growly/-/growly-1.3.0.tgz#f10748cbe76af964b7c96c93c6bcc28af120c081" + integrity sha1-8QdIy+dq+WS3yWyTxrzCivEgwIE= gulp-babel@^8.0.0: version "8.0.0" resolved "https://registry.yarnpkg.com/gulp-babel/-/gulp-babel-8.0.0.tgz#e0da96f4f2ec4a88dd3a3030f476e38ab2126d87" + integrity sha512-oomaIqDXxFkg7lbpBou/gnUkX51/Y/M2ZfSjL2hdqXTAlSWZcgZtd2o0cOH0r/eE8LWD0+Q/PsLsr2DKOoqToQ== dependencies: plugin-error "^1.0.1" replace-ext "^1.0.0" @@ -4794,6 +5238,7 @@ gulp-cli@^2.2.0: gulp-filter@^5.1.0: version "5.1.0" resolved "https://registry.yarnpkg.com/gulp-filter/-/gulp-filter-5.1.0.tgz#a05e11affb07cf7dcf41a7de1cb7b63ac3783e73" + integrity sha1-oF4Rr/sHz33PQafeHLe2OsN4PnM= dependencies: multimatch "^2.0.0" plugin-error "^0.1.2" @@ -4802,6 +5247,7 @@ gulp-filter@^5.1.0: gulp-newer@^1.0.0: version "1.4.0" resolved "https://registry.yarnpkg.com/gulp-newer/-/gulp-newer-1.4.0.tgz#25243ed6eac8f5462b95894e0d41937b112e65f3" + integrity sha512-h79fGO55S/P9eAADbLAP9aTtVYpLSR1ONj08VPaSdVVNVYhTS8p1CO1TW7kEMu+hC+sytmCqcUr5LesvZEtDoQ== dependencies: glob "^7.0.3" kew "^0.7.0" @@ -4810,6 +5256,7 @@ gulp-newer@^1.0.0: gulp-plumber@^1.2.1: version "1.2.1" resolved "https://registry.yarnpkg.com/gulp-plumber/-/gulp-plumber-1.2.1.tgz#d38700755a300b9d372318e4ffb5ff7ced0b2c84" + integrity sha512-mctAi9msEAG7XzW5ytDVZ9PxWMzzi1pS2rBH7lA095DhMa6KEXjm+St0GOCc567pJKJ/oCvosVAZEpAey0q2eQ== dependencies: chalk "^1.1.3" fancy-log "^1.3.2" @@ -4819,26 +5266,12 @@ gulp-plumber@^1.2.1: gulp-rename@^1.4.0: version "1.4.0" resolved "https://registry.yarnpkg.com/gulp-rename/-/gulp-rename-1.4.0.tgz#de1c718e7c4095ae861f7296ef4f3248648240bd" + integrity sha512-swzbIGb/arEoFK89tPY58vg3Ok1bw+d35PfUNwWqdo7KM4jkmuGA78JiDNqR+JeZFaeeHnRg9N7aihX3YPmsyg== -gulp-uglify@^3.0.2: - version "3.0.2" - resolved "https://registry.yarnpkg.com/gulp-uglify/-/gulp-uglify-3.0.2.tgz#5f5b2e8337f879ca9dec971feb1b82a5a87850b0" - integrity sha512-gk1dhB74AkV2kzqPMQBLA3jPoIAPd/nlNzP2XMDSG8XZrqnlCiDGAqC+rZOumzFvB5zOphlFh6yr3lgcAb/OOg== - dependencies: - array-each "^1.0.1" - extend-shallow "^3.0.2" - gulplog "^1.0.0" - has-gulplog "^0.1.0" - isobject "^3.0.1" - make-error-cause "^1.1.1" - safe-buffer "^5.1.2" - through2 "^2.0.0" - uglify-js "^3.0.5" - vinyl-sourcemaps-apply "^0.2.0" - -gulp-watch@^5.0.1: - version "5.0.1" - resolved "https://registry.yarnpkg.com/gulp-watch/-/gulp-watch-5.0.1.tgz#83d378752f5bfb46da023e73c17ed1da7066215d" +gulp-watch@^5.0.1: + version "5.0.1" + resolved "https://registry.yarnpkg.com/gulp-watch/-/gulp-watch-5.0.1.tgz#83d378752f5bfb46da023e73c17ed1da7066215d" + integrity sha512-HnTSBdzAOFIT4wmXYPDUn783TaYAq9bpaN05vuZNP5eni3z3aRx0NAKbjhhMYtcq76x4R1wf4oORDGdlrEjuog== dependencies: ansi-colors "1.1.0" anymatch "^1.3.0" @@ -4866,15 +5299,16 @@ gulp@^4.0.2: gulplog@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/gulplog/-/gulplog-1.0.0.tgz#e28c4d45d05ecbbed818363ce8f9c5926229ffe5" + integrity sha1-4oxNRdBey77YGDY86PnFkmIp/+U= dependencies: glogg "^1.0.0" -handlebars@^4.1.0: - version "4.1.0" - resolved "https://registry.yarnpkg.com/handlebars/-/handlebars-4.1.0.tgz#0d6a6f34ff1f63cecec8423aa4169827bf787c3a" - integrity sha512-l2jRuU1NAWK6AW5qqcTATWQJvNPEwkM7NEKSiv/gqOsoSQbVoWyqVEY5GS+XPQ88zLNmqASRpzfdm8d79hJS+w== +handlebars@^4.1.2, handlebars@^4.4.0: + version "4.5.3" + resolved "https://registry.yarnpkg.com/handlebars/-/handlebars-4.5.3.tgz#5cf75bd8714f7605713511a56be7c349becb0482" + integrity sha512-3yPecJoJHK/4c6aZhSvxOyG4vJKDshV36VHp0iVCDVh7o9w2vwi3NSnL2MMPj3YdduqaBcu7cGbggJQM0br9xA== dependencies: - async "^2.5.0" + neo-async "^2.6.0" optimist "^0.6.1" source-map "^0.6.1" optionalDependencies: @@ -4883,10 +5317,12 @@ handlebars@^4.1.0: har-schema@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/har-schema/-/har-schema-2.0.0.tgz#a94c2224ebcac04782a0d9035521f24735b7ec92" + integrity sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI= har-validator@~5.1.0: version "5.1.3" resolved "https://registry.yarnpkg.com/har-validator/-/har-validator-5.1.3.tgz#1ef89ebd3e4996557675eed9893110dc350fa080" + integrity sha512-sNvOCzEQNr/qrvJgc3UG/kD4QtlHycrzwS+6mfTrrSq97BvaYcPZZI1ZSqGSPR73Cxn4LKTD4PttRwfU7jWq5g== dependencies: ajv "^6.5.5" har-schema "^2.0.0" @@ -4894,34 +5330,29 @@ har-validator@~5.1.0: has-ansi@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/has-ansi/-/has-ansi-2.0.0.tgz#34f5049ce1ecdf2b0649af3ef24e45ed35416d91" + integrity sha1-NPUEnOHs3ysGSa8+8k5F7TVBbZE= dependencies: ansi-regex "^2.0.0" -has-flag@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-2.0.0.tgz#e8207af1cc7b30d446cc70b734b5e8be18f88d51" - has-flag@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-3.0.0.tgz#b5d454dc2199ae225699f3467e5a07f3b955bafd" + integrity sha1-tdRU3CGZriJWmfNGfloH87lVuv0= -has-gulplog@^0.1.0: - version "0.1.0" - resolved "https://registry.yarnpkg.com/has-gulplog/-/has-gulplog-0.1.0.tgz#6414c82913697da51590397dafb12f22967811ce" - dependencies: - sparkles "^1.0.0" - -has-symbols@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/has-symbols/-/has-symbols-1.0.0.tgz#ba1a8f1af2a0fc39650f5c850367704122063b44" +has-symbols@^1.0.0, has-symbols@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/has-symbols/-/has-symbols-1.0.1.tgz#9f5214758a44196c406d9bd76cebf81ec2dd31e8" + integrity sha512-PLcsoqu++dmEIZB+6totNFKq/7Do+Z0u4oT0zKOJNl3lYK6vGwwu2hjHs+68OEZbTjiUE9bgOABXbP/GvrS0Kg== has-unicode@^2.0.0, has-unicode@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/has-unicode/-/has-unicode-2.0.1.tgz#e0e6fe6a28cf51138855e086d1691e771de2a8b9" + integrity sha1-4Ob+aijPUROIVeCG0Wkedx3iqLk= has-value@^0.3.1: version "0.3.1" resolved "https://registry.yarnpkg.com/has-value/-/has-value-0.3.1.tgz#7b1f58bada62ca827ec0a2078025654845995e1f" + integrity sha1-ex9YutpiyoJ+wKIHgCVlSEWZXh8= dependencies: get-value "^2.0.3" has-values "^0.1.4" @@ -4930,6 +5361,7 @@ has-value@^0.3.1: has-value@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/has-value/-/has-value-1.0.0.tgz#18b281da585b1c5c51def24c930ed29a0be6b177" + integrity sha1-GLKB2lhbHFxR3vJMkw7SmgvmsXc= dependencies: get-value "^2.0.6" has-values "^1.0.0" @@ -4938,10 +5370,12 @@ has-value@^1.0.0: has-values@^0.1.4: version "0.1.4" resolved "https://registry.yarnpkg.com/has-values/-/has-values-0.1.4.tgz#6d61de95d91dfca9b9a02089ad384bff8f62b771" + integrity sha1-bWHeldkd/Km5oCCJrThL/49it3E= has-values@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/has-values/-/has-values-1.0.0.tgz#95b0b63fec2146619a6fe57fe75628d5a39efe4f" + integrity sha1-lbC2P+whRmGab+V/51Yo1aOe/k8= dependencies: is-number "^3.0.0" kind-of "^4.0.0" @@ -4953,99 +5387,64 @@ has@^1.0.0, has@^1.0.1, has@^1.0.3: dependencies: function-bind "^1.1.1" -hash-base@^2.0.0: - version "2.0.2" - resolved "https://registry.yarnpkg.com/hash-base/-/hash-base-2.0.2.tgz#66ea1d856db4e8a5470cadf6fce23ae5244ef2e1" - dependencies: - inherits "^2.0.1" - hash-base@^3.0.0: version "3.0.4" resolved "https://registry.yarnpkg.com/hash-base/-/hash-base-3.0.4.tgz#5fc8686847ecd73499403319a6b0a3f3f6ae4918" + integrity sha1-X8hoaEfs1zSZQDMZprCj8/auSRg= dependencies: inherits "^2.0.1" safe-buffer "^5.0.1" hash.js@^1.0.0, hash.js@^1.0.3: - version "1.1.3" - resolved "https://registry.yarnpkg.com/hash.js/-/hash.js-1.1.3.tgz#340dedbe6290187151c1ea1d777a3448935df846" + version "1.1.7" + resolved "https://registry.yarnpkg.com/hash.js/-/hash.js-1.1.7.tgz#0babca538e8d4ee4a0f8988d68866537a003cf42" + integrity sha512-taOaskGt4z4SOANNseOviYDvjEJinIkRgmp7LbKP2YTTmVxWBl87s/uzK9r+44BclBSp2X7K1hqeNfz9JbBeXA== dependencies: inherits "^2.0.3" - minimalistic-assert "^1.0.0" - -he@1.1.x: - version "1.1.1" - resolved "https://registry.yarnpkg.com/he/-/he-1.1.1.tgz#93410fd21b009735151f8868c2f271f3427e23fd" + minimalistic-assert "^1.0.1" hmac-drbg@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/hmac-drbg/-/hmac-drbg-1.0.1.tgz#d2745701025a6c775a6c545793ed502fc0c649a1" + integrity sha1-0nRXAQJabHdabFRXk+1QL8DGSaE= dependencies: hash.js "^1.0.3" minimalistic-assert "^1.0.0" minimalistic-crypto-utils "^1.0.1" homedir-polyfill@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/homedir-polyfill/-/homedir-polyfill-1.0.1.tgz#4c2bbc8a758998feebf5ed68580f76d46768b4bc" + version "1.0.3" + resolved "https://registry.yarnpkg.com/homedir-polyfill/-/homedir-polyfill-1.0.3.tgz#743298cef4e5af3e194161fbadcc2151d3a058e8" + integrity sha512-eSmmWE5bZTK2Nou4g0AI3zZ9rswp7GRKoKXS1BLUkvPviOqs4YTN1djQIqrXy9k5gEtdLPy86JjRwsNM9tnDcA== dependencies: parse-passwd "^1.0.0" -hosted-git-info@^2.1.4, hosted-git-info@^2.6.0: - version "2.7.1" - resolved "https://registry.yarnpkg.com/hosted-git-info/-/hosted-git-info-2.7.1.tgz#97f236977bd6e125408930ff6de3eec6281ec047" +hosted-git-info@^2.1.4, hosted-git-info@^2.7.1: + version "2.8.5" + resolved "https://registry.yarnpkg.com/hosted-git-info/-/hosted-git-info-2.8.5.tgz#759cfcf2c4d156ade59b0b2dfabddc42a6b9c70c" + integrity sha512-kssjab8CvdXfcXMXVcvsXum4Hwdq9XGtRD3TteMEvEbq0LXyiNQr6AprqKqfeaDXze7SxWvRxdpwE6ku7ikLkg== html-encoding-sniffer@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/html-encoding-sniffer/-/html-encoding-sniffer-1.0.2.tgz#e70d84b94da53aa375e11fe3a351be6642ca46f8" + integrity sha512-71lZziiDnsuabfdYiUeWdCVyKuqwWi23L8YeIgV9jSSZHCtb6wB1BKWooH7L3tn4/FuZJMVWyNaIDr4RGmaSYw== dependencies: whatwg-encoding "^1.0.1" -html-loader@^0.4.5: - version "0.4.5" - resolved "https://registry.yarnpkg.com/html-loader/-/html-loader-0.4.5.tgz#5fbcd87cd63a5c49a7fce2fe56f425e05729c68c" - dependencies: - es6-templates "^0.2.2" - fastparse "^1.1.1" - html-minifier "^3.0.1" - loader-utils "^1.0.2" - object-assign "^4.1.0" - -html-minifier@^3.0.1: - version "3.5.10" - resolved "https://registry.yarnpkg.com/html-minifier/-/html-minifier-3.5.10.tgz#8522c772c388db81aa5c26f62033302d906ea1c7" - dependencies: - camel-case "3.0.x" - clean-css "4.1.x" - commander "2.14.x" - he "1.1.x" - ncname "1.0.x" - param-case "2.1.x" - relateurl "0.2.x" - uglify-js "3.3.x" - htmlescape@^1.1.0: version "1.1.1" resolved "https://registry.yarnpkg.com/htmlescape/-/htmlescape-1.1.1.tgz#3a03edc2214bca3b66424a3e7959349509cb0351" - -htmlparser2@^3.9.1: - version "3.9.2" - resolved "https://registry.yarnpkg.com/htmlparser2/-/htmlparser2-3.9.2.tgz#1bdf87acca0f3f9e53fa4fcceb0f4b4cbb00b338" - dependencies: - domelementtype "^1.3.0" - domhandler "^2.3.0" - domutils "^1.5.1" - entities "^1.1.1" - inherits "^2.0.1" - readable-stream "^2.0.2" + integrity sha1-OgPtwiFLyjtmQko+eVk0lQnLA1E= http-cache-semantics@^3.8.1: version "3.8.1" resolved "https://registry.yarnpkg.com/http-cache-semantics/-/http-cache-semantics-3.8.1.tgz#39b0e16add9b605bf0a9ef3d9daaf4843b4cacd2" + integrity sha512-5ai2iksyV8ZXmnZhHH4rWPoxxistEexSi5936zIQ1bnNTW5VnA85B6P/VpXiRM017IgRvb2kKo1a//y+0wSp3w== http-proxy-agent@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/http-proxy-agent/-/http-proxy-agent-2.1.0.tgz#e4821beef5b2142a2026bd73926fe537631c5405" + integrity sha512-qwHbBLV7WviBl0rQsOzH6o5lwyOIvwp/BdFnvVxXORldu5TmjFfjzBcWUWS5kWAZhmv+JtiDhSuQCp4sBfbIgg== dependencies: agent-base "4" debug "3.1.0" @@ -5053,6 +5452,7 @@ http-proxy-agent@^2.1.0: http-signature@~1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/http-signature/-/http-signature-1.2.0.tgz#9aecd925114772f3d95b65a60abb8f7c18fbace1" + integrity sha1-muzZJRFHcvPZW2WmCruPfBj7rOE= dependencies: assert-plus "^1.0.0" jsprim "^1.2.2" @@ -5061,92 +5461,99 @@ http-signature@~1.2.0: https-browserify@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/https-browserify/-/https-browserify-1.0.0.tgz#ec06c10e0a34c0f2faf199f7fd7fc78fffd03c73" + integrity sha1-7AbBDgo0wPL68Zn3/X/Hj//QPHM= -https-proxy-agent@^2.2.1: - version "2.2.1" - resolved "https://registry.yarnpkg.com/https-proxy-agent/-/https-proxy-agent-2.2.1.tgz#51552970fa04d723e04c56d04178c3f92592bbc0" +https-proxy-agent@^2.2.3: + version "2.2.4" + resolved "https://registry.yarnpkg.com/https-proxy-agent/-/https-proxy-agent-2.2.4.tgz#4ee7a737abd92678a293d9b34a1af4d0d08c787b" + integrity sha512-OmvfoQ53WLjtA9HeYP9RNrWMJzzAz1JGaSFr1nijg0PVR1JaD/xbJq1mdEIIlxGpXp9eSe/O2LgU9DJmTPd0Eg== dependencies: - agent-base "^4.1.0" + agent-base "^4.3.0" debug "^3.1.0" humanize-ms@^1.2.1: version "1.2.1" resolved "https://registry.yarnpkg.com/humanize-ms/-/humanize-ms-1.2.1.tgz#c46e3159a293f6b896da29316d8b6fe8bb79bbed" + integrity sha1-xG4xWaKT9riW2ikxbYtv6Lt5u+0= dependencies: ms "^2.0.0" -husky@^2.3.0: - version "2.3.0" - resolved "https://registry.yarnpkg.com/husky/-/husky-2.3.0.tgz#8b78ed24d763042df7fd899991985d65a976dd13" - integrity sha512-A/ZQSEILoq+mQM3yC3RIBSaw1bYXdkKnyyKVSUiJl+iBjVZc5LQEXdGY1ZjrDxC4IzfRPiJ0IqzEQGCN5TQa/A== +husky@^3.0.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/husky/-/husky-3.1.0.tgz#5faad520ab860582ed94f0c1a77f0f04c90b57c0" + integrity sha512-FJkPoHHB+6s4a+jwPqBudBDvYZsoQW5/HBuMSehC8qDiCe50kpcxeqFoDSlow+9I6wg47YxBoT3WxaURlrDIIQ== dependencies: - cosmiconfig "^5.2.0" + chalk "^2.4.2" + ci-info "^2.0.0" + cosmiconfig "^5.2.1" execa "^1.0.0" - find-up "^3.0.0" get-stdin "^7.0.0" - is-ci "^2.0.0" - pkg-dir "^4.1.0" - please-upgrade-node "^3.1.1" - read-pkg "^5.1.1" + opencollective-postinstall "^2.0.2" + pkg-dir "^4.2.0" + please-upgrade-node "^3.2.0" + read-pkg "^5.2.0" run-node "^1.0.0" slash "^3.0.0" -iconv-lite@0.4.19: - version "0.4.19" - resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.19.tgz#f7468f60135f5e5dad3399c0a81be9a1603a082b" - -iconv-lite@^0.4.24, iconv-lite@^0.4.4, iconv-lite@~0.4.13: +iconv-lite@0.4.24, iconv-lite@^0.4.24, iconv-lite@^0.4.4, iconv-lite@~0.4.13: version "0.4.24" resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.24.tgz#2022b4b25fbddc21d2f524974a474aafe733908b" + integrity sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA== dependencies: safer-buffer ">= 2.1.2 < 3" +idb-wrapper@^1.5.0: + version "1.7.2" + resolved "https://registry.yarnpkg.com/idb-wrapper/-/idb-wrapper-1.7.2.tgz#8251afd5e77fe95568b1c16152eb44b396767ea2" + integrity sha512-zfNREywMuf0NzDo9mVsL0yegjsirJxHpKHvWcyRozIqQy89g0a3U+oBPOCN4cc0oCiOuYgZHimzaW/R46G1Mpg== + ieee754@^1.1.4: - version "1.1.8" - resolved "https://registry.yarnpkg.com/ieee754/-/ieee754-1.1.8.tgz#be33d40ac10ef1926701f6f08a2d86fbfd1ad3e4" + version "1.1.13" + resolved "https://registry.yarnpkg.com/ieee754/-/ieee754-1.1.13.tgz#ec168558e95aa181fd87d37f55c32bbcb6708b84" + integrity sha512-4vf7I2LYV/HaWerSo3XmlMkp5eZ83i+/CDluXi/IGTs/O1sejBNhTtnxzmRZfvOUqj7lZjqHkeTvpgSFDlWZTg== iferr@^0.1.5: version "0.1.5" resolved "https://registry.yarnpkg.com/iferr/-/iferr-0.1.5.tgz#c60eed69e6d8fdb6b3104a1fcbca1c192dc5b501" + integrity sha1-xg7taebY/bazEEofy8ocGS3FtQE= ignore-walk@^3.0.1: - version "3.0.1" - resolved "https://registry.yarnpkg.com/ignore-walk/-/ignore-walk-3.0.1.tgz#a83e62e7d272ac0e3b551aaa82831a19b69f82f8" + version "3.0.3" + resolved "https://registry.yarnpkg.com/ignore-walk/-/ignore-walk-3.0.3.tgz#017e2447184bfeade7c238e4aefdd1e8f95b1e37" + integrity sha512-m7o6xuOaT1aqheYHKf8W6J5pYH85ZI9w077erOzLje3JsB1gkafkAhHHY19dqjulgIZHFm32Cp5uNZgcQqdJKw== dependencies: minimatch "^3.0.4" -ignore@^3.3.5: - version "3.3.10" - resolved "https://registry.yarnpkg.com/ignore/-/ignore-3.3.10.tgz#0a97fb876986e8081c631160f8f9f389157f0043" - -ignore@^4.0.6: +ignore@^4.0.3, ignore@^4.0.6: version "4.0.6" resolved "https://registry.yarnpkg.com/ignore/-/ignore-4.0.6.tgz#750e3db5862087b4737ebac8207ffd1ef27b25fc" + integrity sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg== + +ignore@^5.1.1: + version "5.1.4" + resolved "https://registry.yarnpkg.com/ignore/-/ignore-5.1.4.tgz#84b7b3dbe64552b6ef0eca99f6743dbec6d97adf" + integrity sha512-MzbUSahkTW1u7JpKKjY7LCARd1fU5W2rLdxlM4kdkayuCwZImjkpluF9CM1aLewYJguPDqewLam18Y6AU69A8A== import-fresh@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/import-fresh/-/import-fresh-2.0.0.tgz#d81355c15612d386c61f9ddd3922d4304822a546" + integrity sha1-2BNVwVYS04bGH53dOSLUMEgipUY= dependencies: caller-path "^2.0.0" resolve-from "^3.0.0" import-fresh@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/import-fresh/-/import-fresh-3.0.0.tgz#a3d897f420cab0e671236897f75bc14b4885c390" + version "3.2.1" + resolved "https://registry.yarnpkg.com/import-fresh/-/import-fresh-3.2.1.tgz#633ff618506e793af5ac91bf48b72677e15cbe66" + integrity sha512-6e1q1cnWP2RXD9/keSkxHScg508CdXqXWgWBaETNhyuBFz+kUZlKboh+ISK+bU++DmbHimVBrOz/zzPe0sZ3sQ== dependencies: parent-module "^1.0.0" resolve-from "^4.0.0" -import-local@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/import-local/-/import-local-1.0.0.tgz#5e4ffdc03f4fe6c009c6729beb29631c2f8227bc" - dependencies: - pkg-dir "^2.0.0" - resolve-cwd "^2.0.0" - import-local@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/import-local/-/import-local-2.0.0.tgz#55070be38a5993cf18ef6db7e961f5bee5c5a09d" + integrity sha512-b6s04m3O+s3CGSbqDIyP4R6aAwAeYlVq9+WUWep6iHa8ETRf9yei1U48C5MmfJmV9AiLYYBKPMq/W+/WRpQmCQ== dependencies: pkg-dir "^3.0.0" resolve-cwd "^2.0.0" @@ -5154,43 +5561,67 @@ import-local@^2.0.0: imurmurhash@^0.1.4: version "0.1.4" resolved "https://registry.yarnpkg.com/imurmurhash/-/imurmurhash-0.1.4.tgz#9218b9b2b928a238b13dc4fb6b6d576f231453ea" + integrity sha1-khi5srkoojixPcT7a21XbyMUU+o= indent-string@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/indent-string/-/indent-string-2.1.0.tgz#8e2d48348742121b4a8218b7a137e9a52049dc80" + integrity sha1-ji1INIdCEhtKghi3oTfppSBJ3IA= dependencies: repeating "^2.0.0" indent-string@^3.0.0: version "3.2.0" resolved "https://registry.yarnpkg.com/indent-string/-/indent-string-3.2.0.tgz#4a5fd6d27cc332f37e5419a504dbb837105c9289" + integrity sha1-Sl/W0nzDMvN+VBmlBNu4NxBckok= + +indent-string@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/indent-string/-/indent-string-4.0.0.tgz#624f8f4497d619b2d9768531d58f4122854d7251" + integrity sha512-EdDDZu4A2OyIK7Lr/2zG+w5jmbuk1DVBnEwREQvBzspBJkCEbRa8GxU1lghYcaGJCnRWibjDXlq779X1/y5xwg== -indexof@0.0.1: +indexof@~0.0.1: version "0.0.1" resolved "https://registry.yarnpkg.com/indexof/-/indexof-0.0.1.tgz#82dc336d232b9062179d05ab3293a66059fd435d" + integrity sha1-gtwzbSMrkGIXnQWrMpOmYFn9Q10= + +infer-owner@^1.0.3, infer-owner@^1.0.4: + version "1.0.4" + resolved "https://registry.yarnpkg.com/infer-owner/-/infer-owner-1.0.4.tgz#c4cefcaa8e51051c2a40ba2ce8a3d27295af9467" + integrity sha512-IClj+Xz94+d7irH5qRyfJonOdfTzuDaifE6ZPWfx0N0+/ATZCbuTPq2prFl526urkQd90WyUKIh1DfBQ2hMz9A== inflight@^1.0.4: version "1.0.6" resolved "https://registry.yarnpkg.com/inflight/-/inflight-1.0.6.tgz#49bd6331d7d02d0c09bc910a1075ba8165b56df9" + integrity sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk= dependencies: once "^1.3.0" wrappy "1" inherits@2, inherits@^2.0.1, inherits@^2.0.3, inherits@~2.0.1, inherits@~2.0.3: - version "2.0.3" - resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.3.tgz#633c2c83e3da42a502f52466022480f4208261de" + version "2.0.4" + resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c" + integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ== inherits@2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.1.tgz#b17d08d326b4423e568eff719f91b0b1cbdf69f1" + integrity sha1-sX0I0ya0Qj5Wjv9xn5GwscvfafE= + +inherits@2.0.3: + version "2.0.3" + resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.3.tgz#633c2c83e3da42a502f52466022480f4208261de" + integrity sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4= ini@^1.3.2, ini@^1.3.4, ini@~1.3.0: version "1.3.5" resolved "https://registry.yarnpkg.com/ini/-/ini-1.3.5.tgz#eee25f56db1c9ec6085e0c22778083f596abf927" + integrity sha512-RZY5huIKCMRWDUqZlEi72f/lmXKMvuszcMBduliQ3nnWbx9X/ZBQO7DijMEYS9EhHBb2qacRUMtC7svLwe0lcw== init-package-json@^1.10.3: version "1.10.3" resolved "https://registry.yarnpkg.com/init-package-json/-/init-package-json-1.10.3.tgz#45ffe2f610a8ca134f2bd1db5637b235070f6cbe" + integrity sha512-zKSiXKhQveNteyhcj1CoOP8tqp1QuxPIPBl8Bid99DGLFqA1p87M6lNgfjJHSBoWJJlidGOv5rWjyYKEB3g2Jw== dependencies: glob "^7.1.1" npm-package-arg "^4.0.0 || ^5.0.0 || ^6.0.0" @@ -5204,19 +5635,21 @@ init-package-json@^1.10.3: inline-source-map@~0.5.0: version "0.5.0" resolved "https://registry.yarnpkg.com/inline-source-map/-/inline-source-map-0.5.0.tgz#4a4c5dd8e4fb5e9b3cda60c822dfadcaee66e0af" + integrity sha1-Skxd2OT7Xps82mDIIt+tyu5m4K8= dependencies: source-map "~0.4.0" inline-source-map@~0.6.0: version "0.6.2" resolved "https://registry.yarnpkg.com/inline-source-map/-/inline-source-map-0.6.2.tgz#f9393471c18a79d1724f863fa38b586370ade2a5" + integrity sha1-+Tk0ccGKedFyT4Y/o4tYY3Ct4qU= dependencies: source-map "~0.5.3" -inquirer@^6.2.0, inquirer@^6.2.2: - version "6.2.2" - resolved "https://registry.yarnpkg.com/inquirer/-/inquirer-6.2.2.tgz#46941176f65c9eb20804627149b743a218f25406" - integrity sha512-Z2rREiXA6cHRR9KBOarR3WuLlFzlIfAEIiB45ll5SSadMg7WqOh1MKEjjndfuH5ewXdixWCxqnVfGOQzPeiztA== +inquirer@^6.2.0: + version "6.5.2" + resolved "https://registry.yarnpkg.com/inquirer/-/inquirer-6.5.2.tgz#ad50942375d036d327ff528c08bd5fab089928ca" + integrity sha512-cntlB5ghuB0iuO65Ovoi8ogLHiWGs/5yNrtUcKjFhSSiVeAIVpD7koaSU9RM8mpXw5YDi9RdYXGQMaOURB7ycQ== dependencies: ansi-escapes "^3.2.0" chalk "^2.4.2" @@ -5224,52 +5657,75 @@ inquirer@^6.2.0, inquirer@^6.2.2: cli-width "^2.0.0" external-editor "^3.0.3" figures "^2.0.0" - lodash "^4.17.11" + lodash "^4.17.12" mute-stream "0.0.7" run-async "^2.2.0" rxjs "^6.4.0" string-width "^2.1.0" - strip-ansi "^5.0.0" + strip-ansi "^5.1.0" + through "^2.3.6" + +inquirer@^7.0.0: + version "7.0.0" + resolved "https://registry.yarnpkg.com/inquirer/-/inquirer-7.0.0.tgz#9e2b032dde77da1db5db804758b8fea3a970519a" + integrity sha512-rSdC7zelHdRQFkWnhsMu2+2SO41mpv2oF2zy4tMhmiLWkcKbOAs87fWAJhVXttKVwhdZvymvnuM95EyEXg2/tQ== + dependencies: + ansi-escapes "^4.2.1" + chalk "^2.4.2" + cli-cursor "^3.1.0" + cli-width "^2.0.0" + external-editor "^3.0.3" + figures "^3.0.0" + lodash "^4.17.15" + mute-stream "0.0.8" + run-async "^2.2.0" + rxjs "^6.4.0" + string-width "^4.1.0" + strip-ansi "^5.1.0" through "^2.3.6" insert-module-globals@^7.0.0: - version "7.0.2" - resolved "https://registry.yarnpkg.com/insert-module-globals/-/insert-module-globals-7.0.2.tgz#012c56baa7d3307a8b417d4ec5270cf9741c18f4" + version "7.2.0" + resolved "https://registry.yarnpkg.com/insert-module-globals/-/insert-module-globals-7.2.0.tgz#ec87e5b42728479e327bd5c5c71611ddfb4752ba" + integrity sha512-VE6NlW+WGn2/AeOMd496AHFYmE7eLKkUY6Ty31k4og5vmA3Fjuwe9v6ifH6Xx/Hz27QvdoMoviw1/pqWRB09Sw== dependencies: JSONStream "^1.0.3" - combine-source-map "~0.7.1" - concat-stream "~1.5.1" + acorn-node "^1.5.2" + combine-source-map "^0.8.0" + concat-stream "^1.6.1" is-buffer "^1.1.0" - lexical-scope "^1.2.0" + path-is-absolute "^1.0.1" process "~0.11.0" through2 "^2.0.0" + undeclared-identifiers "^1.1.2" xtend "^4.0.0" -interpret@^1.0.0, interpret@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/interpret/-/interpret-1.1.0.tgz#7ed1b1410c6a0e0f78cf95d3b8440c63f78b8614" +interpret@^1.1.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/interpret/-/interpret-1.2.0.tgz#d5061a6224be58e8083985f5014d844359576296" + integrity sha512-mT34yGKMNceBQUoVn7iCDKDntA7SC6gycMAWzGx1z/CMCTV7b2AAtXlo3nRyHZ1FelRkQbQjprHSYGwzLtkVbw== invariant@^2.2.2, invariant@^2.2.4: version "2.2.4" resolved "https://registry.yarnpkg.com/invariant/-/invariant-2.2.4.tgz#610f3c92c9359ce1db616e538008d23ff35158e6" + integrity sha512-phJfQVBuaJM5raOpJjSfkiD6BpbCE4Ns//LaXl6wGYtUBY83nWS6Rf9tXm2e8VaK60JEjYldbPif/A2B1C2gNA== dependencies: loose-envify "^1.0.0" invert-kv@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/invert-kv/-/invert-kv-1.0.0.tgz#104a8e4aaca6d3d8cd157a8ef8bfab2d7a3ffdb6" + integrity sha1-EEqOSqym09jNFXqO+L+rLXo//bY= -invert-kv@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/invert-kv/-/invert-kv-2.0.0.tgz#7393f5afa59ec9ff5f67a27620d11c226e3eec02" - -ip@^1.1.5: +ip@1.1.5: version "1.1.5" resolved "https://registry.yarnpkg.com/ip/-/ip-1.1.5.tgz#bdded70114290828c0a039e72ef25f5aaec4354a" + integrity sha1-vd7XARQpCCjAoDnnLvJfWq7ENUo= is-absolute@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/is-absolute/-/is-absolute-1.0.0.tgz#395e1ae84b11f26ad1795e73c17378e48a301576" + integrity sha512-dOWoqflvcydARa360Gvv18DZ/gRuHKi2NU/wU5X1ZFzdYfH29nkiNZsF3mp4OJ3H4yo9Mx8A/uAGNzpzPN3yBA== dependencies: is-relative "^1.0.0" is-windows "^1.0.1" @@ -5277,65 +5733,69 @@ is-absolute@^1.0.0: is-accessor-descriptor@^0.1.6: version "0.1.6" resolved "https://registry.yarnpkg.com/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz#a9e12cb3ae8d876727eeef3843f8a0897b5c98d6" + integrity sha1-qeEss66Nh2cn7u84Q/igiXtcmNY= dependencies: kind-of "^3.0.2" is-accessor-descriptor@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz#169c2f6d3df1f992618072365c9b0ea1f6878656" + integrity sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ== dependencies: kind-of "^6.0.0" is-arrayish@^0.2.1: version "0.2.1" resolved "https://registry.yarnpkg.com/is-arrayish/-/is-arrayish-0.2.1.tgz#77c99840527aa8ecb1a8ba697b80645a7a926a9d" + integrity sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0= is-binary-path@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/is-binary-path/-/is-binary-path-1.0.1.tgz#75f16642b480f187a711c814161fd3a4a7655898" + integrity sha1-dfFmQrSA8YenEcgUFh/TpKdlWJg= dependencies: binary-extensions "^1.0.0" is-buffer@^1.1.0, is-buffer@^1.1.5: version "1.1.6" resolved "https://registry.yarnpkg.com/is-buffer/-/is-buffer-1.1.6.tgz#efaa2ea9daa0d7ab2ea13a97b2b8ad51fefbe8be" + integrity sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w== is-callable@^1.1.4: version "1.1.4" resolved "https://registry.yarnpkg.com/is-callable/-/is-callable-1.1.4.tgz#1e1adf219e1eeb684d691f9d6a05ff0d30a24d75" integrity sha512-r5p9sxJjYnArLjObpjA4xu5EKI3CuKHkJXMhT7kwbpUyIFD1n5PMAsoPvWnvtZiNz7LjkYDRZhd7FlI0eMijEA== -is-ci@^1.0.10: - version "1.1.0" - resolved "https://registry.yarnpkg.com/is-ci/-/is-ci-1.1.0.tgz#247e4162e7860cebbdaf30b774d6b0ac7dcfe7a5" - dependencies: - ci-info "^1.0.0" - is-ci@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/is-ci/-/is-ci-2.0.0.tgz#6bc6334181810e04b5c22b3d589fdca55026404c" + integrity sha512-YfJT7rkpQB0updsdHLGWrvhBJfcfzNNawYDNIyQXJz0IViGf75O8EBPKSdvw2rF+LGCsX4FZ8tcr3b19LcZq4w== dependencies: ci-info "^2.0.0" is-data-descriptor@^0.1.4: version "0.1.4" resolved "https://registry.yarnpkg.com/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz#0b5ee648388e2c860282e793f1856fec3f301b56" + integrity sha1-C17mSDiOLIYCgueT8YVv7D8wG1Y= dependencies: kind-of "^3.0.2" is-data-descriptor@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz#d84876321d0e7add03990406abbbbd36ba9268c7" + integrity sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ== dependencies: kind-of "^6.0.0" is-date-object@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/is-date-object/-/is-date-object-1.0.1.tgz#9aa20eb6aeebbff77fbd33e74ca01b33581d3a16" + integrity sha1-mqIOtq7rv/d/vTPnTKAbM1gdOhY= is-descriptor@^0.1.0: version "0.1.6" resolved "https://registry.yarnpkg.com/is-descriptor/-/is-descriptor-0.1.6.tgz#366d8240dde487ca51823b1ab9f07a10a78251ca" + integrity sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg== dependencies: is-accessor-descriptor "^0.1.6" is-data-descriptor "^0.1.4" @@ -5344,6 +5804,7 @@ is-descriptor@^0.1.0: is-descriptor@^1.0.0, is-descriptor@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/is-descriptor/-/is-descriptor-1.0.2.tgz#3b159746a66604b04f8c81524ba365c5f14d86ec" + integrity sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg== dependencies: is-accessor-descriptor "^1.0.0" is-data-descriptor "^1.0.0" @@ -5352,136 +5813,162 @@ is-descriptor@^1.0.0, is-descriptor@^1.0.2: is-directory@^0.3.1: version "0.3.1" resolved "https://registry.yarnpkg.com/is-directory/-/is-directory-0.3.1.tgz#61339b6f2475fc772fd9c9d83f5c8575dc154ae1" + integrity sha1-YTObbyR1/Hcv2cnYP1yFddwVSuE= 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" + integrity sha1-YrEQ4omkcUGOPsNqYX1HLjAd/Ik= is-extendable@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/is-extendable/-/is-extendable-1.0.1.tgz#a7470f9e426733d81bd81e1155264e3a3507cab4" + integrity sha512-arnXMxT1hhoKo9k1LZdmlNyJdDDfy2v0fXjFlmok4+i8ul/6WlbVge9bhM74OpNPQPMGUToDtz+KXa1PneJxOA== 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" + integrity sha1-qIwCU1eR8C7TfHahueqXc8gz+MI= is-finite@^1.0.0: version "1.0.2" resolved "https://registry.yarnpkg.com/is-finite/-/is-finite-1.0.2.tgz#cc6677695602be550ef11e8b4aa6305342b6d0aa" + integrity sha1-zGZ3aVYCvlUO8R6LSqYwU0K20Ko= dependencies: number-is-nan "^1.0.0" is-fullwidth-code-point@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz#ef9e31386f031a7f0d643af82fde50c457ef00cb" + integrity sha1-754xOG8DGn8NZDr4L95QxFfvAMs= dependencies: number-is-nan "^1.0.0" is-fullwidth-code-point@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz#a3b30a5c4f199183167aaab93beefae3ddfb654f" + integrity sha1-o7MKXE8ZkYMWeqq5O+764937ZU8= + +is-fullwidth-code-point@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz#f116f8064fe90b3f7844a38997c0b75051269f1d" + integrity sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg== is-generator-fn@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/is-generator-fn/-/is-generator-fn-2.0.0.tgz#038c31b774709641bda678b1f06a4e3227c10b3e" + version "2.1.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" + integrity sha1-e6WuJCF4BKxwcHuWkiVnSGzD6Eo= dependencies: is-extglob "^2.1.0" -is-glob@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/is-glob/-/is-glob-4.0.0.tgz#9521c76845cc2610a85203ddf080a958c2ffabc0" +is-glob@^4.0.0, is-glob@^4.0.1: + version "4.0.1" + resolved "https://registry.yarnpkg.com/is-glob/-/is-glob-4.0.1.tgz#7567dbe9f2f5e2467bc77ab83c4a29482407a5dc" + integrity sha512-5G0tKtBTFImOqDnLB2hG6Bp2qcKEFduo4tZu9MT/H6NQv/ghhy30o55ufafxJ/LdH79LLs2Kfrn85TLKyA7BUg== dependencies: is-extglob "^2.1.1" 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-negated-glob@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/is-negated-glob/-/is-negated-glob-1.0.0.tgz#6910bca5da8c95e784b5751b976cf5a10fee36d2" + integrity sha1-aRC8pdqMleeEtXUbl2z1oQ/uNtI= 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" + integrity sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU= dependencies: kind-of "^3.0.2" is-number@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/is-number/-/is-number-4.0.0.tgz#0026e37f5454d73e356dfe6564699867c6a7f0ff" + integrity sha512-rSklcAIlf1OmFdyAqbnWTLVelsQ58uvZ66S/ZyawjWqIviTWCjg2PzVGw8WUA+nNuPTqb4wgA+NszrJ+08LlgQ== + +is-number@^7.0.0: + version "7.0.0" + resolved "https://registry.yarnpkg.com/is-number/-/is-number-7.0.0.tgz#7535345b896734d5f80c4d06c50955527a14f12b" + integrity sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng== is-obj@^1.0.0, is-obj@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/is-obj/-/is-obj-1.0.1.tgz#3e4729ac1f5fde025cd7d83a896dab9f4f67db0f" + integrity sha1-PkcprB9f3gJc19g6iW2rn09n2w8= + +is-object@~0.1.2: + version "0.1.2" + resolved "https://registry.yarnpkg.com/is-object/-/is-object-0.1.2.tgz#00efbc08816c33cfc4ac8251d132e10dc65098d7" + integrity sha1-AO+8CIFsM8/ErIJR0TLhDcZQmNc= is-observable@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/is-observable/-/is-observable-1.1.0.tgz#b3e986c8f44de950867cab5403f5a3465005975e" + integrity sha512-NqCa4Sa2d+u7BWc6CukaObG3Fh+CU9bvixbpcXYhy2VvYS7vVGIdAgnIS5Ks3A/cqk4rebLJ9s8zBstT2aKnIA== dependencies: symbol-observable "^1.1.0" -is-odd@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/is-odd/-/is-odd-2.0.0.tgz#7646624671fd7ea558ccd9a2795182f2958f1b24" - dependencies: - is-number "^4.0.0" - -is-path-cwd@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/is-path-cwd/-/is-path-cwd-1.0.0.tgz#d225ec23132e89edd38fda767472e62e65f1106d" - -is-path-in-cwd@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/is-path-in-cwd/-/is-path-in-cwd-1.0.0.tgz#6477582b8214d602346094567003be8a9eac04dc" - dependencies: - is-path-inside "^1.0.0" +is-path-cwd@^2.2.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/is-path-cwd/-/is-path-cwd-2.2.0.tgz#67d43b82664a7b5191fd9119127eb300048a9fdb" + integrity sha512-w942bTcih8fdJPJmQHFzkS76NEP8Kzzvmw92cXsazb8intwLqPibPPdXf4ANdKV3rYMuuQYGIWtvz9JilB3NFQ== -is-path-inside@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/is-path-inside/-/is-path-inside-1.0.1.tgz#8ef5b7de50437a3fdca6b4e865ef7aa55cb48036" - dependencies: - path-is-inside "^1.0.1" +is-path-inside@^3.0.1: + version "3.0.2" + resolved "https://registry.yarnpkg.com/is-path-inside/-/is-path-inside-3.0.2.tgz#f5220fc82a3e233757291dddc9c5877f2a1f3017" + integrity sha512-/2UGPSgmtqwo1ktx8NDHjuPwZWmHhO+gj0f93EkhLB5RgW9RZevWYYlIkS6zePc6U2WpOdQYIwHe9YC4DWEBVg== is-plain-obj@^1.0.0, is-plain-obj@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/is-plain-obj/-/is-plain-obj-1.1.0.tgz#71a50c8429dfca773c92a390a4a03b39fcd51d3e" + integrity sha1-caUMhCnfync8kqOQpKA7OfzVHT4= is-plain-object@^2.0.1, is-plain-object@^2.0.3, is-plain-object@^2.0.4: version "2.0.4" resolved "https://registry.yarnpkg.com/is-plain-object/-/is-plain-object-2.0.4.tgz#2c163b3fafb1b606d9d17928f05c2a1c38e07677" + integrity sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og== dependencies: isobject "^3.0.1" @@ -5495,28 +5982,41 @@ is-plain-object@^3.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" + integrity sha1-eaKp7OfwlugPNtKy87wWwf9L8/o= + +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" + integrity sha1-VRdIm1RwkbCTDglWVM7SXul+lJE= dependencies: has "^1.0.1" is-regexp@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/is-regexp/-/is-regexp-1.0.0.tgz#fd2d883545c46bac5a633e7b9a09e87fa2cb5069" + integrity sha1-/S2INUXEa6xaYz57mgnof6LLUGk= is-relative@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/is-relative/-/is-relative-1.0.0.tgz#a1bb6935ce8c5dba1e8b9754b9b2dcc020e2260d" + integrity sha512-Kw/ReK0iqwKeu0MITLFuj0jbPAmEiOsIwyIXvvbfa6QfmN9pkD1M+8pdk7Rl/dTKbH34/XBFMbgD4iMJhLQbGA== dependencies: is-unc-path "^1.0.0" @@ -5530,63 +6030,95 @@ is-ssh@^1.3.0: is-stream@^1.0.1, is-stream@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-1.1.0.tgz#12d4a3dd4e68e0b79ceb8dbc84173ae80d91ca44" + integrity sha1-EtSj3U5o4Lec6428hBc66A2RykQ= + +is-stream@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-2.0.0.tgz#bde9c32680d6fae04129d6ac9d921ce7815f78e3" + integrity sha512-XCoy+WlUr7d1+Z8GgSuXmpuUFC9fOhRXglJMx+dwLKTkL44Cjd4W1Z5P+BQZpr+cR93aGP4S/s7Ftw6Nd/kiEw== is-symbol@^1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/is-symbol/-/is-symbol-1.0.2.tgz#a055f6ae57192caee329e7a860118b497a950f38" - integrity sha512-HS8bZ9ox60yCJLH9snBpIwv9pYUAkcuLhSA1oero1UB5y9aiQpRA8y2ex945AOtCZL1lJDeIk3G5LthswI46Lw== + version "1.0.3" + resolved "https://registry.yarnpkg.com/is-symbol/-/is-symbol-1.0.3.tgz#38e1014b9e6329be0de9d24a414fd7441ec61937" + integrity sha512-OwijhaRSgqvhm/0ZdAcXNZt9lYdKFpcRDT5ULUuYXPoT794UNOdU+gpT6Rzo7b4V2HUl/op6GqY894AZwv9faQ== dependencies: - has-symbols "^1.0.0" + has-symbols "^1.0.1" -is-text-path@^1.0.0: +is-text-path@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/is-text-path/-/is-text-path-1.0.1.tgz#4e1aa0fb51bfbcb3e92688001397202c1775b66e" + integrity sha1-Thqg+1G/vLPpJogAE5cgLBd1tm4= dependencies: text-extensions "^1.0.0" is-typedarray@~1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/is-typedarray/-/is-typedarray-1.0.0.tgz#e479c80858df0c1b11ddda6940f96011fcda4a9a" + integrity sha1-5HnICFjfDBsR3dppQPlgEfzaSpo= is-unc-path@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/is-unc-path/-/is-unc-path-1.0.0.tgz#d731e8898ed090a12c352ad2eaed5095ad322c9d" + integrity sha512-mrGpVd0fs7WWLfVsStvgF6iEJnbjDFZh9/emhRDcGWTduTfNHd9CHeUwH3gYIjdbwo4On6hunkztwOaAw0yllQ== dependencies: unc-path-regex "^0.1.2" is-utf8@^0.2.0, is-utf8@^0.2.1: version "0.2.1" resolved "https://registry.yarnpkg.com/is-utf8/-/is-utf8-0.2.1.tgz#4b0da1442104d1b336340e80797e865cf39f7d72" + integrity sha1-Sw2hRCEE0bM2NA6AeX6GXPOffXI= is-valid-glob@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/is-valid-glob/-/is-valid-glob-1.0.0.tgz#29bf3eff701be2d4d315dbacc39bc39fe8f601aa" + integrity sha1-Kb8+/3Ab4tTTFdusw5vDn+j2Aao= -is-windows@^1.0.1, is-windows@^1.0.2: +is-windows@^1.0.0, is-windows@^1.0.1, is-windows@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/is-windows/-/is-windows-1.0.2.tgz#d1850eb9791ecd18e6182ce12a30f396634bb19d" + integrity sha512-eXK1UInq2bPmjyX6e3VHIzMLobc4J94i4AWn+Hpq3OU5KkrRC96OAcR3PRJ/pGu6m8TRnBHP9dkXQVsT/COVIA== + +is-wsl@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/is-wsl/-/is-wsl-1.1.0.tgz#1f16e4aa22b04d1336b66188a66af3c600c3a66d" + integrity sha1-HxbkqiKwTRM2tmGIpmrzxgDDpm0= + +is@~0.2.6: + version "0.2.7" + resolved "https://registry.yarnpkg.com/is/-/is-0.2.7.tgz#3b34a2c48f359972f35042849193ae7264b63562" + integrity sha1-OzSixI81mXLzUEKEkZOucmS2NWI= -isarray@0.0.1, isarray@~0.0.1: +isarray@0.0.1: version "0.0.1" resolved "https://registry.yarnpkg.com/isarray/-/isarray-0.0.1.tgz#8a18acfca9a8f4177e09abfc6038939b05d1eedf" + integrity sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8= isarray@1.0.0, isarray@^1.0.0, isarray@~1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/isarray/-/isarray-1.0.0.tgz#bb935d48582cba168c06834957a54a3e07124f11" + integrity sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE= + +isbuffer@~0.0.0: + version "0.0.0" + resolved "https://registry.yarnpkg.com/isbuffer/-/isbuffer-0.0.0.tgz#38c146d9df528b8bf9b0701c3d43cf12df3fc39b" + integrity sha1-OMFG2d9Si4v5sHAcPUPPEt8/w5s= isexe@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/isexe/-/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10" + integrity sha1-6PvzdNxVb/iUehDcsFctYz8s+hA= isobject@^2.0.0: version "2.1.0" resolved "https://registry.yarnpkg.com/isobject/-/isobject-2.1.0.tgz#f065561096a3f1da2ef46272f815c840d87e0c89" + integrity sha1-8GVWEJaj8dou9GJy+BXIQNh+DIk= dependencies: isarray "1.0.0" isobject@^3.0.0, isobject@^3.0.1: version "3.0.1" resolved "https://registry.yarnpkg.com/isobject/-/isobject-3.0.1.tgz#4e431e92b11a9731636aa1f9c8d1ccbcfdab78df" + integrity sha1-TkMekrEalzFjaqH5yNHMvP2reN8= isobject@^4.0.0: version "4.0.0" @@ -5596,351 +6128,358 @@ isobject@^4.0.0: isstream@~0.1.2: version "0.1.2" resolved "https://registry.yarnpkg.com/isstream/-/isstream-0.1.2.tgz#47e63f7af55afa6f92e1500e690eb8b8529c099a" + integrity sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo= -istanbul-lib-coverage@^2.0.2, istanbul-lib-coverage@^2.0.3: - version "2.0.3" - resolved "https://registry.yarnpkg.com/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.3.tgz#0b891e5ad42312c2b9488554f603795f9a2211ba" +istanbul-lib-coverage@^2.0.2, istanbul-lib-coverage@^2.0.5: + version "2.0.5" + resolved "https://registry.yarnpkg.com/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.5.tgz#675f0ab69503fad4b1d849f736baaca803344f49" + integrity sha512-8aXznuEPCJvGnMSRft4udDRDtb1V3pkQkMMI5LI+6HuQz5oQ4J2UFn1H82raA3qJtyOLkkwVqICBQkjnGtn5mA== -istanbul-lib-instrument@^3.0.0, istanbul-lib-instrument@^3.0.1: - version "3.1.0" - resolved "https://registry.yarnpkg.com/istanbul-lib-instrument/-/istanbul-lib-instrument-3.1.0.tgz#a2b5484a7d445f1f311e93190813fa56dfb62971" - dependencies: - "@babel/generator" "^7.0.0" - "@babel/parser" "^7.0.0" - "@babel/template" "^7.0.0" - "@babel/traverse" "^7.0.0" - "@babel/types" "^7.0.0" - istanbul-lib-coverage "^2.0.3" - semver "^5.5.0" +istanbul-lib-instrument@^3.0.1, istanbul-lib-instrument@^3.3.0: + version "3.3.0" + resolved "https://registry.yarnpkg.com/istanbul-lib-instrument/-/istanbul-lib-instrument-3.3.0.tgz#a5f63d91f0bbc0c3e479ef4c5de027335ec6d630" + integrity sha512-5nnIN4vo5xQZHdXno/YDXJ0G+I3dAm4XgzfSVTPLQpj/zAV2dV6Juy0yaf10/zrJOJeHoN3fraFe+XRq2bFVZA== + dependencies: + "@babel/generator" "^7.4.0" + "@babel/parser" "^7.4.3" + "@babel/template" "^7.4.0" + "@babel/traverse" "^7.4.3" + "@babel/types" "^7.4.0" + istanbul-lib-coverage "^2.0.5" + semver "^6.0.0" istanbul-lib-report@^2.0.4: - version "2.0.4" - resolved "https://registry.yarnpkg.com/istanbul-lib-report/-/istanbul-lib-report-2.0.4.tgz#bfd324ee0c04f59119cb4f07dab157d09f24d7e4" + version "2.0.8" + resolved "https://registry.yarnpkg.com/istanbul-lib-report/-/istanbul-lib-report-2.0.8.tgz#5a8113cd746d43c4889eba36ab10e7d50c9b4f33" + integrity sha512-fHBeG573EIihhAblwgxrSenp0Dby6tJMFR/HvlerBsrCTD5bkUuoNtn3gVh29ZCS824cGGBPn7Sg7cNk+2xUsQ== dependencies: - istanbul-lib-coverage "^2.0.3" - make-dir "^1.3.0" - supports-color "^6.0.0" + istanbul-lib-coverage "^2.0.5" + make-dir "^2.1.0" + supports-color "^6.1.0" istanbul-lib-source-maps@^3.0.1: - version "3.0.2" - resolved "https://registry.yarnpkg.com/istanbul-lib-source-maps/-/istanbul-lib-source-maps-3.0.2.tgz#f1e817229a9146e8424a28e5d69ba220fda34156" + version "3.0.6" + resolved "https://registry.yarnpkg.com/istanbul-lib-source-maps/-/istanbul-lib-source-maps-3.0.6.tgz#284997c48211752ec486253da97e3879defba8c8" + integrity sha512-R47KzMtDJH6X4/YW9XTx+jrLnZnscW4VpNN+1PViSYTejLVPWv7oov+Duf8YQSPyVRUvueQqz1TcsC6mooZTXw== dependencies: debug "^4.1.1" - istanbul-lib-coverage "^2.0.3" - make-dir "^1.3.0" - rimraf "^2.6.2" + istanbul-lib-coverage "^2.0.5" + make-dir "^2.1.0" + rimraf "^2.6.3" source-map "^0.6.1" -istanbul-reports@^2.1.1: - version "2.1.1" - resolved "https://registry.yarnpkg.com/istanbul-reports/-/istanbul-reports-2.1.1.tgz#72ef16b4ecb9a4a7bd0e2001e00f95d1eec8afa9" - integrity sha512-FzNahnidyEPBCI0HcufJoSEoKykesRlFcSzQqjH9x0+LC8tnnE/p/90PBLu8iZTxr8yYZNyTtiAujUqyN+CIxw== +istanbul-reports@^2.2.6: + version "2.2.6" + resolved "https://registry.yarnpkg.com/istanbul-reports/-/istanbul-reports-2.2.6.tgz#7b4f2660d82b29303a8fe6091f8ca4bf058da1af" + integrity sha512-SKi4rnMyLBKe0Jy2uUdx28h8oG7ph2PPuQPvIAh31d+Ci+lSiEu4C+h3oBPuJ9+mPKhOyW0M8gY4U5NM1WLeXA== dependencies: - handlebars "^4.1.0" + handlebars "^4.1.2" -jest-changed-files@^24.8.0: - version "24.8.0" - resolved "https://registry.yarnpkg.com/jest-changed-files/-/jest-changed-files-24.8.0.tgz#7e7eb21cf687587a85e50f3d249d1327e15b157b" - integrity sha512-qgANC1Yrivsq+UrLXsvJefBKVoCsKB0Hv+mBb6NMjjZ90wwxCDmU3hsCXBya30cH+LnPYjwgcU65i6yJ5Nfuug== +jest-changed-files@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest-changed-files/-/jest-changed-files-24.9.0.tgz#08d8c15eb79a7fa3fc98269bc14b451ee82f8039" + integrity sha512-6aTWpe2mHF0DhL28WjdkO8LyGjs3zItPET4bMSeXU6T3ub4FPMw+mcOcbdGXQOAfmLcxofD23/5Bl9Z4AkFwqg== dependencies: - "@jest/types" "^24.8.0" + "@jest/types" "^24.9.0" execa "^1.0.0" throat "^4.0.0" -jest-cli@^24.8.0: - version "24.8.0" - resolved "https://registry.yarnpkg.com/jest-cli/-/jest-cli-24.8.0.tgz#b075ac914492ed114fa338ade7362a301693e989" - integrity sha512-+p6J00jSMPQ116ZLlHJJvdf8wbjNbZdeSX9ptfHX06/MSNaXmKihQzx5vQcw0q2G6JsdVkUIdWbOWtSnaYs3yA== +jest-cli@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest-cli/-/jest-cli-24.9.0.tgz#ad2de62d07472d419c6abc301fc432b98b10d2af" + integrity sha512-+VLRKyitT3BWoMeSUIHRxV/2g8y9gw91Jh5z2UmXZzkZKpbC08CSehVxgHUwTpy+HwGcns/tqafQDJW7imYvGg== dependencies: - "@jest/core" "^24.8.0" - "@jest/test-result" "^24.8.0" - "@jest/types" "^24.8.0" + "@jest/core" "^24.9.0" + "@jest/test-result" "^24.9.0" + "@jest/types" "^24.9.0" chalk "^2.0.1" exit "^0.1.2" import-local "^2.0.0" is-ci "^2.0.0" - jest-config "^24.8.0" - jest-util "^24.8.0" - jest-validate "^24.8.0" + jest-config "^24.9.0" + jest-util "^24.9.0" + jest-validate "^24.9.0" prompts "^2.0.1" realpath-native "^1.1.0" - yargs "^12.0.2" + yargs "^13.3.0" -jest-config@^24.8.0: - version "24.8.0" - resolved "https://registry.yarnpkg.com/jest-config/-/jest-config-24.8.0.tgz#77db3d265a6f726294687cbbccc36f8a76ee0f4f" - integrity sha512-Czl3Nn2uEzVGsOeaewGWoDPD8GStxCpAe0zOYs2x2l0fZAgPbCr3uwUkgNKV3LwE13VXythM946cd5rdGkkBZw== +jest-config@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest-config/-/jest-config-24.9.0.tgz#fb1bbc60c73a46af03590719efa4825e6e4dd1b5" + integrity sha512-RATtQJtVYQrp7fvWg6f5y3pEFj9I+H8sWw4aKxnDZ96mob5i5SD6ZEGWgMLXQ4LE8UurrjbdlLWdUeo+28QpfQ== dependencies: "@babel/core" "^7.1.0" - "@jest/test-sequencer" "^24.8.0" - "@jest/types" "^24.8.0" - babel-jest "^24.8.0" + "@jest/test-sequencer" "^24.9.0" + "@jest/types" "^24.9.0" + babel-jest "^24.9.0" chalk "^2.0.1" glob "^7.1.1" - jest-environment-jsdom "^24.8.0" - jest-environment-node "^24.8.0" - jest-get-type "^24.8.0" - jest-jasmine2 "^24.8.0" + jest-environment-jsdom "^24.9.0" + jest-environment-node "^24.9.0" + jest-get-type "^24.9.0" + jest-jasmine2 "^24.9.0" jest-regex-util "^24.3.0" - jest-resolve "^24.8.0" - jest-util "^24.8.0" - jest-validate "^24.8.0" + jest-resolve "^24.9.0" + jest-util "^24.9.0" + jest-validate "^24.9.0" micromatch "^3.1.10" - pretty-format "^24.8.0" + pretty-format "^24.9.0" realpath-native "^1.1.0" -jest-diff@^24.8.0: - version "24.8.0" - resolved "https://registry.yarnpkg.com/jest-diff/-/jest-diff-24.8.0.tgz#146435e7d1e3ffdf293d53ff97e193f1d1546172" - integrity sha512-wxetCEl49zUpJ/bvUmIFjd/o52J+yWcoc5ZyPq4/W1LUKGEhRYDIbP1KcF6t+PvqNrGAFk4/JhtxDq/Nnzs66g== +jest-diff@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest-diff/-/jest-diff-24.9.0.tgz#931b7d0d5778a1baf7452cb816e325e3724055da" + integrity sha512-qMfrTs8AdJE2iqrTp0hzh7kTd2PQWrsFyj9tORoKmu32xjPjeE4NyjVRDz8ybYwqS2ik8N4hsIpiVTyFeo2lBQ== dependencies: chalk "^2.0.1" - diff-sequences "^24.3.0" - jest-get-type "^24.8.0" - pretty-format "^24.8.0" + diff-sequences "^24.9.0" + jest-get-type "^24.9.0" + pretty-format "^24.9.0" jest-docblock@^24.3.0: - version "24.3.0" - resolved "https://registry.yarnpkg.com/jest-docblock/-/jest-docblock-24.3.0.tgz#b9c32dac70f72e4464520d2ba4aec02ab14db5dd" - integrity sha512-nlANmF9Yq1dufhFlKG9rasfQlrY7wINJbo3q01tu56Jv5eBU5jirylhF2O5ZBnLxzOVBGRDz/9NAwNyBtG4Nyg== + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest-docblock/-/jest-docblock-24.9.0.tgz#7970201802ba560e1c4092cc25cbedf5af5a8ce2" + integrity sha512-F1DjdpDMJMA1cN6He0FNYNZlo3yYmOtRUnktrT9Q37njYzC5WEaDdmbynIgy0L/IvXvvgsG8OsqhLPXTpfmZAA== dependencies: detect-newline "^2.1.0" -jest-each@^24.8.0: - version "24.8.0" - resolved "https://registry.yarnpkg.com/jest-each/-/jest-each-24.8.0.tgz#a05fd2bf94ddc0b1da66c6d13ec2457f35e52775" - integrity sha512-NrwK9gaL5+XgrgoCsd9svsoWdVkK4gnvyhcpzd6m487tXHqIdYeykgq3MKI1u4I+5Zf0tofr70at9dWJDeb+BA== +jest-each@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest-each/-/jest-each-24.9.0.tgz#eb2da602e2a610898dbc5f1f6df3ba86b55f8b05" + integrity sha512-ONi0R4BvW45cw8s2Lrx8YgbeXL1oCQ/wIDwmsM3CqM/nlblNCPmnC3IPQlMbRFZu3wKdQ2U8BqM6lh3LJ5Bsog== dependencies: - "@jest/types" "^24.8.0" + "@jest/types" "^24.9.0" chalk "^2.0.1" - jest-get-type "^24.8.0" - jest-util "^24.8.0" - pretty-format "^24.8.0" - -jest-environment-jsdom@^24.8.0: - version "24.8.0" - resolved "https://registry.yarnpkg.com/jest-environment-jsdom/-/jest-environment-jsdom-24.8.0.tgz#300f6949a146cabe1c9357ad9e9ecf9f43f38857" - integrity sha512-qbvgLmR7PpwjoFjM/sbuqHJt/NCkviuq9vus9NBn/76hhSidO+Z6Bn9tU8friecegbJL8gzZQEMZBQlFWDCwAQ== - dependencies: - "@jest/environment" "^24.8.0" - "@jest/fake-timers" "^24.8.0" - "@jest/types" "^24.8.0" - jest-mock "^24.8.0" - jest-util "^24.8.0" + jest-get-type "^24.9.0" + jest-util "^24.9.0" + pretty-format "^24.9.0" + +jest-environment-jsdom@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest-environment-jsdom/-/jest-environment-jsdom-24.9.0.tgz#4b0806c7fc94f95edb369a69cc2778eec2b7375b" + integrity sha512-Zv9FV9NBRzLuALXjvRijO2351DRQeLYXtpD4xNvfoVFw21IOKNhZAEUKcbiEtjTkm2GsJ3boMVgkaR7rN8qetA== + dependencies: + "@jest/environment" "^24.9.0" + "@jest/fake-timers" "^24.9.0" + "@jest/types" "^24.9.0" + jest-mock "^24.9.0" + jest-util "^24.9.0" jsdom "^11.5.1" -jest-environment-node@^24.8.0: - version "24.8.0" - resolved "https://registry.yarnpkg.com/jest-environment-node/-/jest-environment-node-24.8.0.tgz#d3f726ba8bc53087a60e7a84ca08883a4c892231" - integrity sha512-vIGUEScd1cdDgR6sqn2M08sJTRLQp6Dk/eIkCeO4PFHxZMOgy+uYLPMC4ix3PEfM5Au/x3uQ/5Tl0DpXXZsJ/Q== +jest-environment-node@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest-environment-node/-/jest-environment-node-24.9.0.tgz#333d2d2796f9687f2aeebf0742b519f33c1cbfd3" + integrity sha512-6d4V2f4nxzIzwendo27Tr0aFm+IXWa0XEUnaH6nU0FMaozxovt+sfRvh4J47wL1OvF83I3SSTu0XK+i4Bqe7uA== dependencies: - "@jest/environment" "^24.8.0" - "@jest/fake-timers" "^24.8.0" - "@jest/types" "^24.8.0" - jest-mock "^24.8.0" - jest-util "^24.8.0" + "@jest/environment" "^24.9.0" + "@jest/fake-timers" "^24.9.0" + "@jest/types" "^24.9.0" + jest-mock "^24.9.0" + jest-util "^24.9.0" -jest-get-type@^24.8.0: - version "24.8.0" - resolved "https://registry.yarnpkg.com/jest-get-type/-/jest-get-type-24.8.0.tgz#a7440de30b651f5a70ea3ed7ff073a32dfe646fc" - integrity sha512-RR4fo8jEmMD9zSz2nLbs2j0zvPpk/KCEz3a62jJWbd2ayNo0cb+KFRxPHVhE4ZmgGJEQp0fosmNz84IfqM8cMQ== +jest-get-type@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest-get-type/-/jest-get-type-24.9.0.tgz#1684a0c8a50f2e4901b6644ae861f579eed2ef0e" + integrity sha512-lUseMzAley4LhIcpSP9Jf+fTrQ4a1yHQwLNeeVa2cEmbCGeoZAtYPOIv8JaxLD/sUpKxetKGP+gsHl8f8TSj8Q== -jest-haste-map@^24.8.0: - version "24.8.0" - resolved "https://registry.yarnpkg.com/jest-haste-map/-/jest-haste-map-24.8.0.tgz#51794182d877b3ddfd6e6d23920e3fe72f305800" - integrity sha512-ZBPRGHdPt1rHajWelXdqygIDpJx8u3xOoLyUBWRW28r3tagrgoepPrzAozW7kW9HrQfhvmiv1tncsxqHJO1onQ== +jest-haste-map@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest-haste-map/-/jest-haste-map-24.9.0.tgz#b38a5d64274934e21fa417ae9a9fbeb77ceaac7d" + integrity sha512-kfVFmsuWui2Sj1Rp1AJ4D9HqJwE4uwTlS/vO+eRUaMmd54BFpli2XhMQnPC2k4cHFVbB2Q2C+jtI1AGLgEnCjQ== dependencies: - "@jest/types" "^24.8.0" + "@jest/types" "^24.9.0" anymatch "^2.0.0" fb-watchman "^2.0.0" graceful-fs "^4.1.15" invariant "^2.2.4" - jest-serializer "^24.4.0" - jest-util "^24.8.0" - jest-worker "^24.6.0" + jest-serializer "^24.9.0" + jest-util "^24.9.0" + jest-worker "^24.9.0" micromatch "^3.1.10" sane "^4.0.3" walker "^1.0.7" optionalDependencies: fsevents "^1.2.7" -jest-jasmine2@^24.8.0: - version "24.8.0" - resolved "https://registry.yarnpkg.com/jest-jasmine2/-/jest-jasmine2-24.8.0.tgz#a9c7e14c83dd77d8b15e820549ce8987cc8cd898" - integrity sha512-cEky88npEE5LKd5jPpTdDCLvKkdyklnaRycBXL6GNmpxe41F0WN44+i7lpQKa/hcbXaQ+rc9RMaM4dsebrYong== +jest-jasmine2@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest-jasmine2/-/jest-jasmine2-24.9.0.tgz#1f7b1bd3242c1774e62acabb3646d96afc3be6a0" + integrity sha512-Cq7vkAgaYKp+PsX+2/JbTarrk0DmNhsEtqBXNwUHkdlbrTBLtMJINADf2mf5FkowNsq8evbPc07/qFO0AdKTzw== dependencies: "@babel/traverse" "^7.1.0" - "@jest/environment" "^24.8.0" - "@jest/test-result" "^24.8.0" - "@jest/types" "^24.8.0" + "@jest/environment" "^24.9.0" + "@jest/test-result" "^24.9.0" + "@jest/types" "^24.9.0" chalk "^2.0.1" co "^4.6.0" - expect "^24.8.0" + expect "^24.9.0" is-generator-fn "^2.0.0" - jest-each "^24.8.0" - jest-matcher-utils "^24.8.0" - jest-message-util "^24.8.0" - jest-runtime "^24.8.0" - jest-snapshot "^24.8.0" - jest-util "^24.8.0" - pretty-format "^24.8.0" + jest-each "^24.9.0" + jest-matcher-utils "^24.9.0" + jest-message-util "^24.9.0" + jest-runtime "^24.9.0" + jest-snapshot "^24.9.0" + jest-util "^24.9.0" + pretty-format "^24.9.0" throat "^4.0.0" -jest-leak-detector@^24.8.0: - version "24.8.0" - resolved "https://registry.yarnpkg.com/jest-leak-detector/-/jest-leak-detector-24.8.0.tgz#c0086384e1f650c2d8348095df769f29b48e6980" - integrity sha512-cG0yRSK8A831LN8lIHxI3AblB40uhv0z+SsQdW3GoMMVcK+sJwrIIyax5tu3eHHNJ8Fu6IMDpnLda2jhn2pD/g== +jest-leak-detector@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest-leak-detector/-/jest-leak-detector-24.9.0.tgz#b665dea7c77100c5c4f7dfcb153b65cf07dcf96a" + integrity sha512-tYkFIDsiKTGwb2FG1w8hX9V0aUb2ot8zY/2nFg087dUageonw1zrLMP4W6zsRO59dPkTSKie+D4rhMuP9nRmrA== dependencies: - pretty-format "^24.8.0" + jest-get-type "^24.9.0" + pretty-format "^24.9.0" -jest-matcher-utils@^24.8.0: - version "24.8.0" - resolved "https://registry.yarnpkg.com/jest-matcher-utils/-/jest-matcher-utils-24.8.0.tgz#2bce42204c9af12bde46f83dc839efe8be832495" - integrity sha512-lex1yASY51FvUuHgm0GOVj7DCYEouWSlIYmCW7APSqB9v8mXmKSn5+sWVF0MhuASG0bnYY106/49JU1FZNl5hw== +jest-matcher-utils@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest-matcher-utils/-/jest-matcher-utils-24.9.0.tgz#f5b3661d5e628dffe6dd65251dfdae0e87c3a073" + integrity sha512-OZz2IXsu6eaiMAwe67c1T+5tUAtQyQx27/EMEkbFAGiw52tB9em+uGbzpcgYVpA8wl0hlxKPZxrly4CXU/GjHA== dependencies: chalk "^2.0.1" - jest-diff "^24.8.0" - jest-get-type "^24.8.0" - pretty-format "^24.8.0" + jest-diff "^24.9.0" + jest-get-type "^24.9.0" + pretty-format "^24.9.0" -jest-message-util@^24.8.0: - version "24.8.0" - resolved "https://registry.yarnpkg.com/jest-message-util/-/jest-message-util-24.8.0.tgz#0d6891e72a4beacc0292b638685df42e28d6218b" - integrity sha512-p2k71rf/b6ns8btdB0uVdljWo9h0ovpnEe05ZKWceQGfXYr4KkzgKo3PBi8wdnd9OtNh46VpNIJynUn/3MKm1g== +jest-message-util@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest-message-util/-/jest-message-util-24.9.0.tgz#527f54a1e380f5e202a8d1149b0ec872f43119e3" + integrity sha512-oCj8FiZ3U0hTP4aSui87P4L4jC37BtQwUMqk+zk/b11FR19BJDeZsZAvIHutWnmtw7r85UmR3CEWZ0HWU2mAlw== dependencies: "@babel/code-frame" "^7.0.0" - "@jest/test-result" "^24.8.0" - "@jest/types" "^24.8.0" + "@jest/test-result" "^24.9.0" + "@jest/types" "^24.9.0" "@types/stack-utils" "^1.0.1" chalk "^2.0.1" micromatch "^3.1.10" slash "^2.0.0" stack-utils "^1.0.1" -jest-mock@^24.8.0: - version "24.8.0" - resolved "https://registry.yarnpkg.com/jest-mock/-/jest-mock-24.8.0.tgz#2f9d14d37699e863f1febf4e4d5a33b7fdbbde56" - integrity sha512-6kWugwjGjJw+ZkK4mDa0Df3sDlUTsV47MSrT0nGQ0RBWJbpODDQ8MHDVtGtUYBne3IwZUhtB7elxHspU79WH3A== +jest-mock@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest-mock/-/jest-mock-24.9.0.tgz#c22835541ee379b908673ad51087a2185c13f1c6" + integrity sha512-3BEYN5WbSq9wd+SyLDES7AHnjH9A/ROBwmz7l2y+ol+NtSFO8DYiEBzoO1CeFc9a8DYy10EO4dDFVv/wN3zl1w== dependencies: - "@jest/types" "^24.8.0" + "@jest/types" "^24.9.0" jest-pnp-resolver@^1.2.1: version "1.2.1" resolved "https://registry.yarnpkg.com/jest-pnp-resolver/-/jest-pnp-resolver-1.2.1.tgz#ecdae604c077a7fbc70defb6d517c3c1c898923a" integrity sha512-pgFw2tm54fzgYvc/OHrnysABEObZCUNFnhjoRjaVOCN8NYc032/gVjPaHD4Aq6ApkSieWtfKAFQtmDKAmhupnQ== -jest-regex-util@^24.3.0: - version "24.3.0" - resolved "https://registry.yarnpkg.com/jest-regex-util/-/jest-regex-util-24.3.0.tgz#d5a65f60be1ae3e310d5214a0307581995227b36" - integrity sha512-tXQR1NEOyGlfylyEjg1ImtScwMq8Oh3iJbGTjN7p0J23EuVX1MA8rwU69K4sLbCmwzgCUbVkm0FkSF9TdzOhtg== +jest-regex-util@^24.3.0, jest-regex-util@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest-regex-util/-/jest-regex-util-24.9.0.tgz#c13fb3380bde22bf6575432c493ea8fe37965636" + integrity sha512-05Cmb6CuxaA+Ys6fjr3PhvV3bGQmO+2p2La4hFbU+W5uOc479f7FdLXUWXw4pYMAhhSZIuKHwSXSu6CsSBAXQA== -jest-resolve-dependencies@^24.8.0: - version "24.8.0" - resolved "https://registry.yarnpkg.com/jest-resolve-dependencies/-/jest-resolve-dependencies-24.8.0.tgz#19eec3241f2045d3f990dba331d0d7526acff8e0" - integrity sha512-hyK1qfIf/krV+fSNyhyJeq3elVMhK9Eijlwy+j5jqmZ9QsxwKBiP6qukQxaHtK8k6zql/KYWwCTQ+fDGTIJauw== +jest-resolve-dependencies@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest-resolve-dependencies/-/jest-resolve-dependencies-24.9.0.tgz#ad055198959c4cfba8a4f066c673a3f0786507ab" + integrity sha512-Fm7b6AlWnYhT0BXy4hXpactHIqER7erNgIsIozDXWl5dVm+k8XdGVe1oTg1JyaFnOxarMEbax3wyRJqGP2Pq+g== dependencies: - "@jest/types" "^24.8.0" + "@jest/types" "^24.9.0" jest-regex-util "^24.3.0" - jest-snapshot "^24.8.0" + jest-snapshot "^24.9.0" -jest-resolve@^24.8.0: - version "24.8.0" - resolved "https://registry.yarnpkg.com/jest-resolve/-/jest-resolve-24.8.0.tgz#84b8e5408c1f6a11539793e2b5feb1b6e722439f" - integrity sha512-+hjSzi1PoRvnuOICoYd5V/KpIQmkAsfjFO71458hQ2Whi/yf1GDeBOFj8Gxw4LrApHsVJvn5fmjcPdmoUHaVKw== +jest-resolve@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest-resolve/-/jest-resolve-24.9.0.tgz#dff04c7687af34c4dd7e524892d9cf77e5d17321" + integrity sha512-TaLeLVL1l08YFZAt3zaPtjiVvyy4oSA6CRe+0AFPPVX3Q/VI0giIWWoAvoS5L96vj9Dqxj4fB5p2qrHCmTU/MQ== dependencies: - "@jest/types" "^24.8.0" + "@jest/types" "^24.9.0" browser-resolve "^1.11.3" chalk "^2.0.1" jest-pnp-resolver "^1.2.1" realpath-native "^1.1.0" -jest-runner@^24.8.0: - version "24.8.0" - resolved "https://registry.yarnpkg.com/jest-runner/-/jest-runner-24.8.0.tgz#4f9ae07b767db27b740d7deffad0cf67ccb4c5bb" - integrity sha512-utFqC5BaA3JmznbissSs95X1ZF+d+4WuOWwpM9+Ak356YtMhHE/GXUondZdcyAAOTBEsRGAgH/0TwLzfI9h7ow== +jest-runner@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest-runner/-/jest-runner-24.9.0.tgz#574fafdbd54455c2b34b4bdf4365a23857fcdf42" + integrity sha512-KksJQyI3/0mhcfspnxxEOBueGrd5E4vV7ADQLT9ESaCzz02WnbdbKWIf5Mkaucoaj7obQckYPVX6JJhgUcoWWg== dependencies: "@jest/console" "^24.7.1" - "@jest/environment" "^24.8.0" - "@jest/test-result" "^24.8.0" - "@jest/types" "^24.8.0" + "@jest/environment" "^24.9.0" + "@jest/test-result" "^24.9.0" + "@jest/types" "^24.9.0" chalk "^2.4.2" exit "^0.1.2" graceful-fs "^4.1.15" - jest-config "^24.8.0" + jest-config "^24.9.0" jest-docblock "^24.3.0" - jest-haste-map "^24.8.0" - jest-jasmine2 "^24.8.0" - jest-leak-detector "^24.8.0" - jest-message-util "^24.8.0" - jest-resolve "^24.8.0" - jest-runtime "^24.8.0" - jest-util "^24.8.0" + jest-haste-map "^24.9.0" + jest-jasmine2 "^24.9.0" + jest-leak-detector "^24.9.0" + jest-message-util "^24.9.0" + jest-resolve "^24.9.0" + jest-runtime "^24.9.0" + jest-util "^24.9.0" jest-worker "^24.6.0" source-map-support "^0.5.6" throat "^4.0.0" -jest-runtime@^24.8.0: - version "24.8.0" - resolved "https://registry.yarnpkg.com/jest-runtime/-/jest-runtime-24.8.0.tgz#05f94d5b05c21f6dc54e427cd2e4980923350620" - integrity sha512-Mq0aIXhvO/3bX44ccT+czU1/57IgOMyy80oM0XR/nyD5zgBcesF84BPabZi39pJVA6UXw+fY2Q1N+4BiVUBWOA== +jest-runtime@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest-runtime/-/jest-runtime-24.9.0.tgz#9f14583af6a4f7314a6a9d9f0226e1a781c8e4ac" + integrity sha512-8oNqgnmF3v2J6PVRM2Jfuj8oX3syKmaynlDMMKQ4iyzbQzIG6th5ub/lM2bCMTmoTKM3ykcUYI2Pw9xwNtjMnw== dependencies: "@jest/console" "^24.7.1" - "@jest/environment" "^24.8.0" + "@jest/environment" "^24.9.0" "@jest/source-map" "^24.3.0" - "@jest/transform" "^24.8.0" - "@jest/types" "^24.8.0" - "@types/yargs" "^12.0.2" + "@jest/transform" "^24.9.0" + "@jest/types" "^24.9.0" + "@types/yargs" "^13.0.0" chalk "^2.0.1" exit "^0.1.2" glob "^7.1.3" graceful-fs "^4.1.15" - jest-config "^24.8.0" - jest-haste-map "^24.8.0" - jest-message-util "^24.8.0" - jest-mock "^24.8.0" + jest-config "^24.9.0" + jest-haste-map "^24.9.0" + jest-message-util "^24.9.0" + jest-mock "^24.9.0" jest-regex-util "^24.3.0" - jest-resolve "^24.8.0" - jest-snapshot "^24.8.0" - jest-util "^24.8.0" - jest-validate "^24.8.0" + jest-resolve "^24.9.0" + jest-snapshot "^24.9.0" + jest-util "^24.9.0" + jest-validate "^24.9.0" realpath-native "^1.1.0" slash "^2.0.0" strip-bom "^3.0.0" - yargs "^12.0.2" + yargs "^13.3.0" -jest-serializer@^24.4.0: - version "24.4.0" - resolved "https://registry.yarnpkg.com/jest-serializer/-/jest-serializer-24.4.0.tgz#f70c5918c8ea9235ccb1276d232e459080588db3" - integrity sha512-k//0DtglVstc1fv+GY/VHDIjrtNjdYvYjMlbLUed4kxrE92sIUewOi5Hj3vrpB8CXfkJntRPDRjCrCvUhBdL8Q== +jest-serializer@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest-serializer/-/jest-serializer-24.9.0.tgz#e6d7d7ef96d31e8b9079a714754c5d5c58288e73" + integrity sha512-DxYipDr8OvfrKH3Kel6NdED3OXxjvxXZ1uIY2I9OFbGg+vUkkg7AGvi65qbhbWNPvDckXmzMPbK3u3HaDO49bQ== -jest-snapshot@^24.8.0: - version "24.8.0" - resolved "https://registry.yarnpkg.com/jest-snapshot/-/jest-snapshot-24.8.0.tgz#3bec6a59da2ff7bc7d097a853fb67f9d415cb7c6" - integrity sha512-5ehtWoc8oU9/cAPe6fez6QofVJLBKyqkY2+TlKTOf0VllBB/mqUNdARdcjlZrs9F1Cv+/HKoCS/BknT0+tmfPg== +jest-snapshot@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest-snapshot/-/jest-snapshot-24.9.0.tgz#ec8e9ca4f2ec0c5c87ae8f925cf97497b0e951ba" + integrity sha512-uI/rszGSs73xCM0l+up7O7a40o90cnrk429LOiK3aeTvfC0HHmldbd81/B7Ix81KSFe1lwkbl7GnBGG4UfuDew== dependencies: "@babel/types" "^7.0.0" - "@jest/types" "^24.8.0" + "@jest/types" "^24.9.0" chalk "^2.0.1" - expect "^24.8.0" - jest-diff "^24.8.0" - jest-matcher-utils "^24.8.0" - jest-message-util "^24.8.0" - jest-resolve "^24.8.0" + expect "^24.9.0" + jest-diff "^24.9.0" + jest-get-type "^24.9.0" + jest-matcher-utils "^24.9.0" + jest-message-util "^24.9.0" + jest-resolve "^24.9.0" mkdirp "^0.5.1" natural-compare "^1.4.0" - pretty-format "^24.8.0" - semver "^5.5.0" - -jest-util@^24.8.0: - version "24.8.0" - resolved "https://registry.yarnpkg.com/jest-util/-/jest-util-24.8.0.tgz#41f0e945da11df44cc76d64ffb915d0716f46cd1" - integrity sha512-DYZeE+XyAnbNt0BG1OQqKy/4GVLPtzwGx5tsnDrFcax36rVE3lTA5fbvgmbVPUZf9w77AJ8otqR4VBbfFJkUZA== - dependencies: - "@jest/console" "^24.7.1" - "@jest/fake-timers" "^24.8.0" - "@jest/source-map" "^24.3.0" - "@jest/test-result" "^24.8.0" - "@jest/types" "^24.8.0" + pretty-format "^24.9.0" + semver "^6.2.0" + +jest-util@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest-util/-/jest-util-24.9.0.tgz#7396814e48536d2e85a37de3e4c431d7cb140162" + integrity sha512-x+cZU8VRmOJxbA1K5oDBdxQmdq0OIdADarLxk0Mq+3XS4jgvhG/oKGWcIDCtPG0HgjxOYvF+ilPJQsAyXfbNOg== + dependencies: + "@jest/console" "^24.9.0" + "@jest/fake-timers" "^24.9.0" + "@jest/source-map" "^24.9.0" + "@jest/test-result" "^24.9.0" + "@jest/types" "^24.9.0" callsites "^3.0.0" chalk "^2.0.1" graceful-fs "^4.1.15" @@ -5949,60 +6488,58 @@ jest-util@^24.8.0: slash "^2.0.0" source-map "^0.6.0" -jest-validate@^24.8.0: - version "24.8.0" - resolved "https://registry.yarnpkg.com/jest-validate/-/jest-validate-24.8.0.tgz#624c41533e6dfe356ffadc6e2423a35c2d3b4849" - integrity sha512-+/N7VOEMW1Vzsrk3UWBDYTExTPwf68tavEPKDnJzrC6UlHtUDU/fuEdXqFoHzv9XnQ+zW6X3qMZhJ3YexfeLDA== +jest-validate@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest-validate/-/jest-validate-24.9.0.tgz#0775c55360d173cd854e40180756d4ff52def8ab" + integrity sha512-HPIt6C5ACwiqSiwi+OfSSHbK8sG7akG8eATl+IPKaeIjtPOeBUd/g3J7DghugzxrGjI93qS/+RPKe1H6PqvhRQ== dependencies: - "@jest/types" "^24.8.0" - camelcase "^5.0.0" + "@jest/types" "^24.9.0" + camelcase "^5.3.1" chalk "^2.0.1" - jest-get-type "^24.8.0" - leven "^2.1.0" - pretty-format "^24.8.0" - -jest-watcher@^24.8.0: - version "24.8.0" - resolved "https://registry.yarnpkg.com/jest-watcher/-/jest-watcher-24.8.0.tgz#58d49915ceddd2de85e238f6213cef1c93715de4" - integrity sha512-SBjwHt5NedQoVu54M5GEx7cl7IGEFFznvd/HNT8ier7cCAx/Qgu9ZMlaTQkvK22G1YOpcWBLQPFSImmxdn3DAw== - dependencies: - "@jest/test-result" "^24.8.0" - "@jest/types" "^24.8.0" - "@types/yargs" "^12.0.9" + jest-get-type "^24.9.0" + leven "^3.1.0" + pretty-format "^24.9.0" + +jest-watcher@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest-watcher/-/jest-watcher-24.9.0.tgz#4b56e5d1ceff005f5b88e528dc9afc8dd4ed2b3b" + integrity sha512-+/fLOfKPXXYJDYlks62/4R4GoT+GU1tYZed99JSCOsmzkkF7727RqKrjNAxtfO4YpGv11wybgRvCjR73lK2GZw== + dependencies: + "@jest/test-result" "^24.9.0" + "@jest/types" "^24.9.0" + "@types/yargs" "^13.0.0" ansi-escapes "^3.0.0" chalk "^2.0.1" - jest-util "^24.8.0" + jest-util "^24.9.0" string-length "^2.0.0" -jest-worker@^24.6.0: - version "24.6.0" - resolved "https://registry.yarnpkg.com/jest-worker/-/jest-worker-24.6.0.tgz#7f81ceae34b7cde0c9827a6980c35b7cdc0161b3" - integrity sha512-jDwgW5W9qGNvpI1tNnvajh0a5IE/PuGLFmHk6aR/BZFz8tSgGw17GsDPXAJ6p91IvYDjOw8GpFbvvZGAK+DPQQ== +jest-worker@^24.6.0, jest-worker@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest-worker/-/jest-worker-24.9.0.tgz#5dbfdb5b2d322e98567898238a9697bcce67b3e5" + integrity sha512-51PE4haMSXcHohnSMdM42anbvZANYTqMrr52tVKPqqsPJMzoP6FYYDVqahX/HrAoKEKz3uUPzSvKs9A3qR4iVw== dependencies: - merge-stream "^1.0.1" + merge-stream "^2.0.0" supports-color "^6.1.0" -jest@^24.8.0: - version "24.8.0" - resolved "https://registry.yarnpkg.com/jest/-/jest-24.8.0.tgz#d5dff1984d0d1002196e9b7f12f75af1b2809081" - integrity sha512-o0HM90RKFRNWmAWvlyV8i5jGZ97pFwkeVoGvPW1EtLTgJc2+jcuqcbbqcSZLE/3f2S5pt0y2ZBETuhpWNl1Reg== +jest@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest/-/jest-24.9.0.tgz#987d290c05a08b52c56188c1002e368edb007171" + integrity sha512-YvkBL1Zm7d2B1+h5fHEOdyjCG+sGMz4f8D86/0HiqJ6MB4MnDc8FgP5vdWsGnemOQro7lnYo8UakZ3+5A0jxGw== dependencies: import-local "^2.0.0" - jest-cli "^24.8.0" + jest-cli "^24.9.0" js-levenshtein@^1.1.3: - version "1.1.3" - resolved "https://registry.yarnpkg.com/js-levenshtein/-/js-levenshtein-1.1.3.tgz#3ef627df48ec8cf24bacf05c0f184ff30ef413c5" - -js-tokens@^3.0.0: - version "3.0.2" - resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-3.0.2.tgz#9866df395102130e38f7f996bceb65443209c25b" + version "1.1.6" + resolved "https://registry.yarnpkg.com/js-levenshtein/-/js-levenshtein-1.1.6.tgz#c6cee58eb3550372df8deb85fad5ce66ce01d59d" + integrity sha512-X2BB11YZtrRqY4EnQcLX5Rh373zbK4alC1FW7D7MBhL2gtcC17cTnr6DmfHZeS0s2rTHjUTMMHfG7gO8SSdw+g== -js-tokens@^4.0.0: +"js-tokens@^3.0.0 || ^4.0.0", js-tokens@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499" + integrity sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ== -js-yaml@^3.13.0, js-yaml@^3.13.1, js-yaml@^3.2.1: +js-yaml@^3.13.1, js-yaml@^3.2.1: version "3.13.1" resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.13.1.tgz#aff151b30bfdfa8e49e05da22e7415e9dfa37847" integrity sha512-YfbcO7jXDdyj0DGxYVSlSeQNHbD7XPWvrVWeVUujrQEoZzWJIRrCPoyk6kL6IAjAG2IolMK4T0hNUe0HOUs5Jw== @@ -6013,109 +6550,110 @@ js-yaml@^3.13.0, js-yaml@^3.13.1, js-yaml@^3.2.1: jsbn@~0.1.0: version "0.1.1" resolved "https://registry.yarnpkg.com/jsbn/-/jsbn-0.1.1.tgz#a5e654c2e5a2deb5f201d96cefbca80c0ef2f513" + integrity sha1-peZUwuWi3rXyAdls77yoDA7y9RM= jsdom@^11.5.1: - version "11.6.2" - resolved "https://registry.yarnpkg.com/jsdom/-/jsdom-11.6.2.tgz#25d1ef332d48adf77fc5221fe2619967923f16bb" + version "11.12.0" + resolved "https://registry.yarnpkg.com/jsdom/-/jsdom-11.12.0.tgz#1a80d40ddd378a1de59656e9e6dc5a3ba8657bc8" + integrity sha512-y8Px43oyiBM13Zc1z780FrfNLJCXTL40EWlty/LXUtcjykRBNgLlCjWXpfSPBl2iv+N7koQN+dvqszHZgT/Fjw== dependencies: - abab "^1.0.4" - acorn "^5.3.0" + abab "^2.0.0" + acorn "^5.5.3" acorn-globals "^4.1.0" array-equal "^1.0.0" - browser-process-hrtime "^0.1.2" - content-type-parser "^1.0.2" cssom ">= 0.3.2 < 0.4.0" - cssstyle ">= 0.2.37 < 0.3.0" - domexception "^1.0.0" - escodegen "^1.9.0" + cssstyle "^1.0.0" + data-urls "^1.0.0" + domexception "^1.0.1" + escodegen "^1.9.1" html-encoding-sniffer "^1.0.2" - left-pad "^1.2.0" - nwmatcher "^1.4.3" + left-pad "^1.3.0" + nwsapi "^2.0.7" parse5 "4.0.0" pn "^1.1.0" - request "^2.83.0" + request "^2.87.0" request-promise-native "^1.0.5" sax "^1.2.4" symbol-tree "^3.2.2" - tough-cookie "^2.3.3" + tough-cookie "^2.3.4" w3c-hr-time "^1.0.1" webidl-conversions "^4.0.2" whatwg-encoding "^1.0.3" - whatwg-url "^6.4.0" - ws "^4.0.0" + whatwg-mimetype "^2.1.0" + whatwg-url "^6.4.1" + ws "^5.2.0" xml-name-validator "^3.0.0" jsesc@^2.5.1: - version "2.5.1" - resolved "https://registry.yarnpkg.com/jsesc/-/jsesc-2.5.1.tgz#e421a2a8e20d6b0819df28908f782526b96dd1fe" + version "2.5.2" + resolved "https://registry.yarnpkg.com/jsesc/-/jsesc-2.5.2.tgz#80564d2e483dacf6e8ef209650a67df3f0c283a4" + integrity sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA== jsesc@~0.5.0: version "0.5.0" resolved "https://registry.yarnpkg.com/jsesc/-/jsesc-0.5.0.tgz#e7dee66e35d6fc16f710fe91d5cf69f70f08911d" - -json-loader@^0.5.4: - version "0.5.7" - resolved "https://registry.yarnpkg.com/json-loader/-/json-loader-0.5.7.tgz#dca14a70235ff82f0ac9a3abeb60d337a365185d" + integrity sha1-597mbjXW/Bb3EP6R1c9p9w8IkR0= json-parse-better-errors@^1.0.0, json-parse-better-errors@^1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz#bb867cfb3450e69107c131d1c514bab3dc8bcaa9" + integrity sha512-mrqyZKfX5EhL7hvqcV6WG1yYjnjeuYDzDhhcAAUrq8Po85NBQBJP+ZDUT75qZQ98IkUoBqdkExkukOU7Ts2wrw== json-schema-traverse@^0.4.1: version "0.4.1" resolved "https://registry.yarnpkg.com/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz#69f6a87d9513ab8bb8fe63bdb0979c448e684660" + integrity sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg== json-schema@0.2.3: version "0.2.3" resolved "https://registry.yarnpkg.com/json-schema/-/json-schema-0.2.3.tgz#b480c892e59a2f05954ce727bd3f2a4e882f9e13" + integrity sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM= json-stable-stringify-without-jsonify@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz#9db7b59496ad3f3cfef30a75142d2d930ad72651" - -json-stable-stringify@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/json-stable-stringify/-/json-stable-stringify-1.0.1.tgz#9a759d39c5f2ff503fd5300646ed445f88c4f9af" - dependencies: - jsonify "~0.0.0" + integrity sha1-nbe1lJatPzz+8wp1FC0tkwrXJlE= json-stable-stringify@~0.0.0: version "0.0.1" resolved "https://registry.yarnpkg.com/json-stable-stringify/-/json-stable-stringify-0.0.1.tgz#611c23e814db375527df851193db59dd2af27f45" + integrity sha1-YRwj6BTbN1Un34URk9tZ3Sryf0U= dependencies: jsonify "~0.0.0" json-stringify-safe@^5.0.1, json-stringify-safe@~5.0.1: version "5.0.1" resolved "https://registry.yarnpkg.com/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz#1296a2d58fd45f19a0f6ce01d65701e2c735b6eb" - -json5@^0.5.0, json5@^0.5.1: - version "0.5.1" - resolved "https://registry.yarnpkg.com/json5/-/json5-0.5.1.tgz#1eade7acc012034ad84e2396767ead9fa5495821" + integrity sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus= json5@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/json5/-/json5-2.1.0.tgz#e7a0c62c48285c628d20a10b85c89bb807c32850" + version "2.1.1" + resolved "https://registry.yarnpkg.com/json5/-/json5-2.1.1.tgz#81b6cb04e9ba496f1c7005d07b4368a2638f90b6" + integrity sha512-l+3HXD0GEI3huGq1njuqtzYK8OYJyXMkOLtQ53pjWh89tvWS2h6l+1zMkYWqlb57+SiQodKZyvMEFb2X+KrFhQ== dependencies: minimist "^1.2.0" jsonfile@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/jsonfile/-/jsonfile-4.0.0.tgz#8771aae0799b64076b76640fca058f9c10e33ecb" + integrity sha1-h3Gq4HmbZAdrdmQPygWPnBDjPss= optionalDependencies: graceful-fs "^4.1.6" jsonify@~0.0.0: version "0.0.0" resolved "https://registry.yarnpkg.com/jsonify/-/jsonify-0.0.0.tgz#2c74b6ee41d93ca51b7b5aaee8f503631d252a73" + integrity sha1-LHS27kHZPKUbe1qu6PUDYx0lKnM= jsonparse@^1.2.0: version "1.3.1" resolved "https://registry.yarnpkg.com/jsonparse/-/jsonparse-1.3.1.tgz#3f4dae4a91fac315f71062f8521cc239f1366280" + integrity sha1-P02uSpH6wxX3EGL4UhzCOfE2YoA= jsprim@^1.2.2: version "1.4.1" resolved "https://registry.yarnpkg.com/jsprim/-/jsprim-1.4.1.tgz#313e66bc1e5cc06e438bc1b7499c2e5c56acb6a2" + integrity sha1-MT5mvB5cwG5Di8G3SZwuXFastqI= dependencies: assert-plus "1.0.0" extsprintf "1.3.0" @@ -6125,101 +6663,100 @@ jsprim@^1.2.2: just-debounce@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/just-debounce/-/just-debounce-1.0.0.tgz#87fccfaeffc0b68cd19d55f6722943f929ea35ea" + integrity sha1-h/zPrv/AtozRnVX2cilD+SnqNeo= kew@^0.7.0: version "0.7.0" resolved "https://registry.yarnpkg.com/kew/-/kew-0.7.0.tgz#79d93d2d33363d6fdd2970b335d9141ad591d79b" + integrity sha1-edk9LTM2PW/dKXCzNdkUGtWR15s= kind-of@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-1.1.0.tgz#140a3d2d41a36d2efcfa9377b62c24f8495a5c44" + integrity sha1-FAo9LUGjbS78+pN3tiwk+ElaXEQ= -kind-of@^3.0.2, kind-of@^3.0.3, kind-of@^3.1.0, kind-of@^3.2.0: +kind-of@^3.0.2, kind-of@^3.0.3, kind-of@^3.2.0: version "3.2.2" resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-3.2.2.tgz#31ea21a734bab9bbb0f32466d893aea51e4a3c64" + integrity sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ= dependencies: is-buffer "^1.1.5" kind-of@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-4.0.0.tgz#20813df3d712928b207378691a45066fae72dd57" + integrity sha1-IIE989cSkosgc3hpGkUGb65y3Vc= dependencies: is-buffer "^1.1.5" kind-of@^5.0.0, kind-of@^5.0.2: version "5.1.0" resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-5.1.0.tgz#729c91e2d857b7a419a1f9aa65685c4c33f5845d" + integrity sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw== kind-of@^6.0.0, kind-of@^6.0.2: version "6.0.2" resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-6.0.2.tgz#01146b36a6218e64e58f3a8d66de5d7fc6f6d051" + integrity sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA== klaw@^2.1.0: version "2.1.1" resolved "https://registry.yarnpkg.com/klaw/-/klaw-2.1.1.tgz#42b76894701169cc910fd0d19ce677b5fb378af1" + integrity sha1-QrdolHARacyRD9DRnOZ3tfs3ivE= dependencies: graceful-fs "^4.1.9" -kleur@^3.0.0: - version "3.0.1" - resolved "https://registry.yarnpkg.com/kleur/-/kleur-3.0.1.tgz#4f5b313f5fa315432a400f19a24db78d451ede62" +kleur@^3.0.3: + version "3.0.3" + resolved "https://registry.yarnpkg.com/kleur/-/kleur-3.0.3.tgz#a79c9ecc86ee1ce3fa6206d1216c501f147fc07e" + integrity sha512-eTIzlVOSUR+JxdDFepEYcBMtZ9Qqdef+rnzWdRZuMbOywu5tO2w2N7rqjoANZ5k9vywhL6Br1VRjUIgTQx4E8w== labeled-stream-splicer@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/labeled-stream-splicer/-/labeled-stream-splicer-2.0.0.tgz#a52e1d138024c00b86b1c0c91f677918b8ae0a59" + version "2.0.2" + resolved "https://registry.yarnpkg.com/labeled-stream-splicer/-/labeled-stream-splicer-2.0.2.tgz#42a41a16abcd46fd046306cf4f2c3576fffb1c21" + integrity sha512-Ca4LSXFFZUjPScRaqOcFxneA0VpKZr4MMYCljyQr4LIewTLb3Y0IUTIsnBBsVubIeEfxeSZpSjSsRM8APEQaAw== dependencies: inherits "^2.0.1" - isarray "~0.0.1" stream-splicer "^2.0.0" last-run@^1.1.0: version "1.1.1" resolved "https://registry.yarnpkg.com/last-run/-/last-run-1.1.1.tgz#45b96942c17b1c79c772198259ba943bebf8ca5b" + integrity sha1-RblpQsF7HHnHchmCWbqUO+v4yls= dependencies: default-resolution "^2.0.0" es6-weak-map "^2.0.1" -lazy-cache@^1.0.3: - version "1.0.4" - resolved "https://registry.yarnpkg.com/lazy-cache/-/lazy-cache-1.0.4.tgz#a1d78fc3a50474cb80845d3b3b6e1da49a446e8e" - -lazy-cache@^2.0.2: - version "2.0.2" - resolved "https://registry.yarnpkg.com/lazy-cache/-/lazy-cache-2.0.2.tgz#b9190a4f913354694840859f8a8f7084d8822264" - dependencies: - set-getter "^0.1.0" - lazystream@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/lazystream/-/lazystream-1.0.0.tgz#f6995fe0f820392f61396be89462407bb77168e4" + integrity sha1-9plf4PggOS9hOWvolGJAe7dxaOQ= dependencies: readable-stream "^2.0.5" lcid@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/lcid/-/lcid-1.0.0.tgz#308accafa0bc483a3867b4b6f2b9506251d1b835" + integrity sha1-MIrMr6C8SDo4Z7S28rlQYlHRuDU= dependencies: invert-kv "^1.0.0" -lcid@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/lcid/-/lcid-2.0.0.tgz#6ef5d2df60e52f82eb228a4c373e8d1f397253cf" - dependencies: - invert-kv "^2.0.0" - lead@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/lead/-/lead-1.0.0.tgz#6f14f99a37be3a9dd784f5495690e5903466ee42" + integrity sha1-bxT5mje+Op3XhPVJVpDlkDRm7kI= dependencies: flush-write-stream "^1.0.2" -left-pad@^1.2.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/left-pad/-/left-pad-1.2.0.tgz#d30a73c6b8201d8f7d8e7956ba9616087a68e0ee" +left-pad@^1.3.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/left-pad/-/left-pad-1.3.0.tgz#5b8a3a7765dfe001261dde915589e782f8c94d1e" + integrity sha512-XI5MPzVNApjAyhQzphX8BkmKsKUxD4LdyK24iZeQGinBN9yTQT3bFlCBy/aVx2HrNcqQGsdot8ghrjyrvMCoEA== lerna-changelog@^0.5.0: version "0.5.0" resolved "https://registry.yarnpkg.com/lerna-changelog/-/lerna-changelog-0.5.0.tgz#1617a8193a1309451ffa1e686b425faf0424b3f8" + integrity sha512-+HFe8T3Q35Fwn2+fTRBvi0EdbKXrsGOozkuWBhq33DTJLBAqAFZ7m1LtKqF8LLuP0asZ0W9L+tGCAhoAt1+J1w== dependencies: chalk "^1.1.3" mkdirp "^0.5.1" @@ -6229,46 +6766,127 @@ lerna-changelog@^0.5.0: string.prototype.padend "^3.0.0" yargs "^6.6.0" -lerna@^3.14.2: - version "3.15.0" - resolved "https://registry.yarnpkg.com/lerna/-/lerna-3.15.0.tgz#b044dba8138d7a1a8dd48ac1d80e7541bdde0d1f" - integrity sha512-kRIQ3bgzkmew5/WZQ0C9WjH0IUf3ZmTNnBwTHfXgLkVY7td0lbwMQFD7zehflUn0zG4ou54o/gn+IfjF0ti/5A== - dependencies: - "@lerna/add" "3.15.0" - "@lerna/bootstrap" "3.15.0" - "@lerna/changed" "3.15.0" - "@lerna/clean" "3.15.0" - "@lerna/cli" "3.13.0" - "@lerna/create" "3.15.0" - "@lerna/diff" "3.15.0" - "@lerna/exec" "3.15.0" - "@lerna/import" "3.15.0" - "@lerna/init" "3.15.0" - "@lerna/link" "3.15.0" - "@lerna/list" "3.15.0" - "@lerna/publish" "3.15.0" - "@lerna/run" "3.15.0" - "@lerna/version" "3.15.0" - import-local "^1.0.0" +lerna@^3.19.0: + version "3.19.0" + resolved "https://registry.yarnpkg.com/lerna/-/lerna-3.19.0.tgz#6d53b613eca7da426ab1e97c01ce6fb39754da6c" + integrity sha512-YtMmwEqzWHQCh7Ynk7BvjrZri3EkSeVqTAcwZIqWlv9V/dCfvFPyRqp+2NIjPB5nj1FWXLRH6F05VT/qvzuuOA== + dependencies: + "@lerna/add" "3.19.0" + "@lerna/bootstrap" "3.18.5" + "@lerna/changed" "3.18.5" + "@lerna/clean" "3.18.5" + "@lerna/cli" "3.18.5" + "@lerna/create" "3.18.5" + "@lerna/diff" "3.18.5" + "@lerna/exec" "3.18.5" + "@lerna/import" "3.18.5" + "@lerna/init" "3.18.5" + "@lerna/link" "3.18.5" + "@lerna/list" "3.18.5" + "@lerna/publish" "3.18.5" + "@lerna/run" "3.18.5" + "@lerna/version" "3.18.5" + import-local "^2.0.0" npmlog "^4.1.2" -leven@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/leven/-/leven-2.1.0.tgz#c2e7a9f772094dee9d34202ae8acce4687875580" +level-blobs@^0.1.7: + version "0.1.7" + resolved "https://registry.yarnpkg.com/level-blobs/-/level-blobs-0.1.7.tgz#9ab9b97bb99f1edbf9f78a3433e21ed56386bdaf" + integrity sha1-mrm5e7mfHtv594o0M+Ie1WOGva8= + dependencies: + level-peek "1.0.6" + once "^1.3.0" + readable-stream "^1.0.26-4" + +level-filesystem@^1.0.1: + version "1.2.0" + resolved "https://registry.yarnpkg.com/level-filesystem/-/level-filesystem-1.2.0.tgz#a00aca9919c4a4dfafdca6a8108d225aadff63b3" + integrity sha1-oArKmRnEpN+v3KaoEI0iWq3/Y7M= + dependencies: + concat-stream "^1.4.4" + errno "^0.1.1" + fwd-stream "^1.0.4" + level-blobs "^0.1.7" + level-peek "^1.0.6" + level-sublevel "^5.2.0" + octal "^1.0.0" + once "^1.3.0" + xtend "^2.2.0" + +level-fix-range@2.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/level-fix-range/-/level-fix-range-2.0.0.tgz#c417d62159442151a19d9a2367868f1724c2d548" + integrity sha1-xBfWIVlEIVGhnZojZ4aPFyTC1Ug= + dependencies: + clone "~0.1.9" + +level-fix-range@~1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/level-fix-range/-/level-fix-range-1.0.2.tgz#bf15b915ae36d8470c821e883ddf79cd16420828" + integrity sha1-vxW5Fa422EcMgh6IPd95zRZCCCg= + +"level-hooks@>=4.4.0 <5": + version "4.5.0" + resolved "https://registry.yarnpkg.com/level-hooks/-/level-hooks-4.5.0.tgz#1b9ae61922930f3305d1a61fc4d83c8102c0dd93" + integrity sha1-G5rmGSKTDzMF0aYfxNg8gQLA3ZM= + dependencies: + string-range "~1.2" + +level-js@^2.1.3: + version "2.2.4" + resolved "https://registry.yarnpkg.com/level-js/-/level-js-2.2.4.tgz#bc055f4180635d4489b561c9486fa370e8c11697" + integrity sha1-vAVfQYBjXUSJtWHJSG+jcOjBFpc= + dependencies: + abstract-leveldown "~0.12.0" + idb-wrapper "^1.5.0" + isbuffer "~0.0.0" + ltgt "^2.1.2" + typedarray-to-buffer "~1.0.0" + xtend "~2.1.2" + +level-peek@1.0.6, level-peek@^1.0.6: + version "1.0.6" + resolved "https://registry.yarnpkg.com/level-peek/-/level-peek-1.0.6.tgz#bec51c72a82ee464d336434c7c876c3fcbcce77f" + integrity sha1-vsUccqgu5GTTNkNMfIdsP8vM538= + dependencies: + level-fix-range "~1.0.2" + +level-sublevel@^5.2.0: + version "5.2.3" + resolved "https://registry.yarnpkg.com/level-sublevel/-/level-sublevel-5.2.3.tgz#744c12c72d2e72be78dde3b9b5cd84d62191413a" + integrity sha1-dEwSxy0ucr543eO5tc2E1iGRQTo= + dependencies: + level-fix-range "2.0" + level-hooks ">=4.4.0 <5" + string-range "~1.2.1" + xtend "~2.0.4" + +levelup@^0.18.2: + version "0.18.6" + resolved "https://registry.yarnpkg.com/levelup/-/levelup-0.18.6.tgz#e6a01cb089616c8ecc0291c2a9bd3f0c44e3e5eb" + integrity sha1-5qAcsIlhbI7MApHCqb0/DETj5es= + dependencies: + bl "~0.8.1" + deferred-leveldown "~0.2.0" + errno "~0.1.1" + prr "~0.0.0" + readable-stream "~1.0.26" + semver "~2.3.1" + xtend "~3.0.0" + +leven@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/leven/-/leven-3.1.0.tgz#77891de834064cccba82ae7842bb6b14a13ed7f2" + integrity sha512-qsda+H8jTaUaN/x5vzW2rzc+8Rw4TAQ/4KjB46IwK5VH+IlVeeeje/EoZRpiXvIqjFgK84QffqPztGI3VBLG1A== levn@^0.3.0, levn@~0.3.0: version "0.3.0" resolved "https://registry.yarnpkg.com/levn/-/levn-0.3.0.tgz#3b09924edf9f083c0490fdd4c0bc4421e04764ee" + integrity sha1-OwmSTt+fCDwEkP3UwLxEIeBHZO4= dependencies: prelude-ls "~1.1.2" type-check "~0.3.2" -lexical-scope@^1.2.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/lexical-scope/-/lexical-scope-1.2.0.tgz#fcea5edc704a4b3a8796cdca419c3a0afaf22df4" - dependencies: - astw "^2.0.0" - liftoff@^3.1.0: version "3.1.0" resolved "https://registry.yarnpkg.com/liftoff/-/liftoff-3.1.0.tgz#c9ba6081f908670607ee79062d700df062c52ed3" @@ -6283,44 +6901,40 @@ liftoff@^3.1.0: rechoir "^0.6.2" resolve "^1.1.7" -lint-staged@^8.1.7: - version "8.1.7" - resolved "https://registry.yarnpkg.com/lint-staged/-/lint-staged-8.1.7.tgz#a8988bc83bdffa97d04adb09dbc0b1f3a58fa6fc" - integrity sha512-egT0goFhIFoOGk6rasPngTFh2qDqxZddM0PwI58oi66RxCDcn5uDwxmiasWIF0qGnchHSYVJ8HPRD5LrFo7TKA== +lines-and-columns@^1.1.6: + version "1.1.6" + resolved "https://registry.yarnpkg.com/lines-and-columns/-/lines-and-columns-1.1.6.tgz#1c00c743b433cd0a4e80758f7b64a57440d9ff00" + integrity sha1-HADHQ7QzzQpOgHWPe2SldEDZ/wA= + +lint-staged@^9.2.0: + version "9.5.0" + resolved "https://registry.yarnpkg.com/lint-staged/-/lint-staged-9.5.0.tgz#290ec605252af646d9b74d73a0fa118362b05a33" + integrity sha512-nawMob9cb/G1J98nb8v3VC/E8rcX1rryUYXVZ69aT9kde6YWX+uvNOEHY5yf2gcWcTJGiD0kqXmCnS3oD75GIA== dependencies: - chalk "^2.3.1" - commander "^2.14.1" - cosmiconfig "^5.2.0" - debug "^3.1.0" + chalk "^2.4.2" + commander "^2.20.0" + cosmiconfig "^5.2.1" + debug "^4.1.1" dedent "^0.7.0" - del "^3.0.0" - execa "^1.0.0" - find-parent-dir "^0.3.0" - g-status "^2.0.2" - is-glob "^4.0.0" - is-windows "^1.0.2" - listr "^0.14.2" - listr-update-renderer "^0.5.0" - lodash "^4.17.11" - log-symbols "^2.2.0" - micromatch "^3.1.8" - npm-which "^3.0.1" - p-map "^1.1.1" - path-is-inside "^1.0.2" - pify "^3.0.0" - please-upgrade-node "^3.0.2" - staged-git-files "1.1.2" - string-argv "^0.0.2" - stringify-object "^3.2.2" - yup "^0.27.0" + del "^5.0.0" + execa "^2.0.3" + listr "^0.14.3" + log-symbols "^3.0.0" + micromatch "^4.0.2" + normalize-path "^3.0.0" + please-upgrade-node "^3.1.1" + string-argv "^0.3.0" + stringify-object "^3.3.0" listr-silent-renderer@^1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/listr-silent-renderer/-/listr-silent-renderer-1.1.1.tgz#924b5a3757153770bf1a8e3fbf74b8bbf3f9242e" + integrity sha1-kktaN1cVN3C/Go4/v3S4u/P5JC4= listr-update-renderer@^0.5.0: version "0.5.0" resolved "https://registry.yarnpkg.com/listr-update-renderer/-/listr-update-renderer-0.5.0.tgz#4ea8368548a7b8aecb7e06d8c95cb45ae2ede6a2" + integrity sha512-tKRsZpKz8GSGqoI/+caPmfrypiaq+OQCbd+CovEC24uk1h952lVj5sC7SqyFUm+OaJ5HN/a1YLt5cit2FMNsFA== dependencies: chalk "^1.1.3" cli-truncate "^0.2.1" @@ -6334,15 +6948,17 @@ listr-update-renderer@^0.5.0: listr-verbose-renderer@^0.5.0: version "0.5.0" resolved "https://registry.yarnpkg.com/listr-verbose-renderer/-/listr-verbose-renderer-0.5.0.tgz#f1132167535ea4c1261102b9f28dac7cba1e03db" + integrity sha512-04PDPqSlsqIOaaaGZ+41vq5FejI9auqTInicFRndCBgE3bXG8D6W1I+mWhk+1nqbHmyhla/6BUrd5OSiHwKRXw== dependencies: chalk "^2.4.1" cli-cursor "^2.1.0" date-fns "^1.27.2" figures "^2.0.0" -listr@^0.14.2: +listr@^0.14.3: version "0.14.3" resolved "https://registry.yarnpkg.com/listr/-/listr-0.14.3.tgz#2fea909604e434be464c50bddba0d496928fa586" + integrity sha512-RmAl7su35BFd/xoMamRjpIE4j3v+L28o8CT5YhAXQJm1fD+1l9ngXY8JAQRJ+tFK2i5njvi0iRUKV09vPwA0iA== dependencies: "@samverschueren/stream-to-observable" "^0.3.0" is-observable "^1.1.0" @@ -6357,6 +6973,7 @@ listr@^0.14.2: load-json-file@^1.0.0: version "1.1.0" resolved "https://registry.yarnpkg.com/load-json-file/-/load-json-file-1.1.0.tgz#956905708d58b4bab4c2261b04f59f31c99374c0" + integrity sha1-lWkFcI1YtLq0wiYbBPWfMcmTdMA= dependencies: graceful-fs "^4.1.2" parse-json "^2.2.0" @@ -6367,6 +6984,7 @@ load-json-file@^1.0.0: load-json-file@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/load-json-file/-/load-json-file-2.0.0.tgz#7947e42149af80d696cbf797bcaabcfe1fe29ca8" + integrity sha1-eUfkIUmvgNaWy/eXvKq8/h/inKg= dependencies: graceful-fs "^4.1.2" parse-json "^2.2.0" @@ -6376,27 +6994,28 @@ load-json-file@^2.0.0: load-json-file@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/load-json-file/-/load-json-file-4.0.0.tgz#2f5f45ab91e33216234fd53adab668eb4ec0993b" + integrity sha1-L19Fq5HjMhYjT9U62rZo607AmTs= dependencies: graceful-fs "^4.1.2" parse-json "^4.0.0" pify "^3.0.0" strip-bom "^3.0.0" -loader-runner@^2.3.0: - version "2.3.0" - resolved "https://registry.yarnpkg.com/loader-runner/-/loader-runner-2.3.0.tgz#f482aea82d543e07921700d5a46ef26fdac6b8a2" - -loader-utils@^1.0.2, loader-utils@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/loader-utils/-/loader-utils-1.1.0.tgz#c98aef488bcceda2ffb5e2de646d6a754429f5cd" +load-json-file@^5.3.0: + version "5.3.0" + resolved "https://registry.yarnpkg.com/load-json-file/-/load-json-file-5.3.0.tgz#4d3c1e01fa1c03ea78a60ac7af932c9ce53403f3" + integrity sha512-cJGP40Jc/VXUsp8/OrnyKyTZ1y6v/dphm3bioS+RrKXjK2BB6wHUd6JptZEFDGgGahMT+InnZO5i1Ei9mpC8Bw== dependencies: - big.js "^3.1.3" - emojis-list "^2.0.0" - json5 "^0.5.0" + graceful-fs "^4.1.15" + parse-json "^4.0.0" + pify "^4.0.1" + strip-bom "^3.0.0" + type-fest "^0.3.0" locate-path@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-2.0.0.tgz#2b568b265eec944c6d9c0de9c3dbbbca0354cd8e" + integrity sha1-K1aLJl7slExtnA3pw9u7ygNUzY4= dependencies: p-locate "^2.0.0" path-exists "^3.0.0" @@ -6404,22 +7023,27 @@ locate-path@^2.0.0: locate-path@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-3.0.0.tgz#dbec3b3ab759758071b58fe59fc41871af21400e" + integrity sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A== dependencies: p-locate "^3.0.0" path-exists "^3.0.0" +locate-path@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-5.0.0.tgz#1afba396afd676a6d42504d0a67a3a7eb9f62aa0" + integrity sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g== + dependencies: + p-locate "^4.1.0" + lodash._reinterpolate@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/lodash._reinterpolate/-/lodash._reinterpolate-3.0.0.tgz#0ccf2d89166af03b3663c796538b75ac6e114d9d" integrity sha1-DM8tiRZq8Ds2Y8eWU4t1rG4RTZ0= -lodash.clone@^4.3.2: - version "4.5.0" - resolved "https://registry.yarnpkg.com/lodash.clone/-/lodash.clone-4.5.0.tgz#195870450f5a13192478df4bc3d23d2dea1907b6" - lodash.clonedeep@^4.5.0: version "4.5.0" resolved "https://registry.yarnpkg.com/lodash.clonedeep/-/lodash.clonedeep-4.5.0.tgz#e23f3f9c4f8fbdde872529c1071857a086e5ccef" + integrity sha1-4j8/nE+Pvd6HJSnBBxhXoIblzO8= lodash.get@^4.4.2: version "4.4.2" @@ -6434,21 +7058,19 @@ lodash.ismatch@^4.4.0: lodash.memoize@~3.0.3: version "3.0.4" resolved "https://registry.yarnpkg.com/lodash.memoize/-/lodash.memoize-3.0.4.tgz#2dcbd2c287cbc0a55cc42328bd0c736150d53e3f" + integrity sha1-LcvSwofLwKVcxCMovQxzYVDVPj8= lodash.set@^4.3.2: version "4.3.2" resolved "https://registry.yarnpkg.com/lodash.set/-/lodash.set-4.3.2.tgz#d8757b1da807dde24816b0d6a84bea1a76230b23" integrity sha1-2HV7HagH3eJIFrDWqEvqGnYjCyM= -lodash.some@^4.2.2: - version "4.6.0" - resolved "https://registry.yarnpkg.com/lodash.some/-/lodash.some-4.6.0.tgz#1bb9f314ef6b8baded13b549169b2a945eb68e4d" - lodash.sortby@^4.7.0: version "4.7.0" resolved "https://registry.yarnpkg.com/lodash.sortby/-/lodash.sortby-4.7.0.tgz#edd14c824e2cc9c1e0b0a1b42bb5210516a42438" + integrity sha1-7dFMgk4sycHgsKG0K7UhBRakJDg= -lodash.template@^4.0.2: +lodash.template@^4.0.2, lodash.template@^4.5.0: version "4.5.0" resolved "https://registry.yarnpkg.com/lodash.template/-/lodash.template-4.5.0.tgz#f976195cf3f347d0d5f52483569fe8031ccce8ab" integrity sha512-84vYFxIkmidUiFxidA/KjjH9pAycqW+h980j7Fuz5qxRtO9pgB7MDFTdys1N7A5mcucRiDyEq4fusljItR1T/A== @@ -6468,60 +7090,49 @@ lodash.uniq@^4.5.0: resolved "https://registry.yarnpkg.com/lodash.uniq/-/lodash.uniq-4.5.0.tgz#d0225373aeb652adc1bc82e4945339a842754773" integrity sha1-0CJTc662Uq3BvILklFM5qEJ1R3M= -lodash@^4.13.1, lodash@^4.15.0, lodash@^4.17.10, lodash@^4.17.11, lodash@^4.17.13, lodash@^4.17.4, lodash@^4.17.5, lodash@^4.2.1: - version "4.17.13" - resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.13.tgz#0bdc3a6adc873d2f4e0c4bac285df91b64fc7b93" - integrity sha512-vm3/XWXfWtRua0FkUyEHBZy8kCPjErNBT9fJx8Zvs+U6zjqPbTUOpkaoum3O5uiA8sm+yNMHXfYkTUHFoMxFNA== +lodash@^4.17.12, lodash@^4.17.13, lodash@^4.17.14, lodash@^4.17.15, lodash@^4.2.1: + version "4.17.15" + resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.15.tgz#b447f6670a0455bbfeedd11392eff330ea097548" + integrity sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A== log-symbols@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/log-symbols/-/log-symbols-1.0.2.tgz#376ff7b58ea3086a0f09facc74617eca501e1a18" + integrity sha1-N2/3tY6jCGoPCfrMdGF+ylAeGhg= dependencies: chalk "^1.0.0" -log-symbols@^2.2.0: - version "2.2.0" - resolved "https://registry.yarnpkg.com/log-symbols/-/log-symbols-2.2.0.tgz#5740e1c5d6f0dfda4ad9323b5332107ef6b4c40a" +log-symbols@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/log-symbols/-/log-symbols-3.0.0.tgz#f3a08516a5dea893336a7dee14d18a1cfdab77c4" + integrity sha512-dSkNGuI7iG3mfvDzUuYZyvk5dD9ocYCYzNU6CYDE6+Xqd+gwme6Z00NS3dUh8mq/73HaEtT7m6W+yUPtU6BZnQ== dependencies: - chalk "^2.0.1" + chalk "^2.4.2" log-update@^2.3.0: version "2.3.0" resolved "https://registry.yarnpkg.com/log-update/-/log-update-2.3.0.tgz#88328fd7d1ce7938b29283746f0b1bc126b24708" + integrity sha1-iDKP19HOeTiykoN0bwsbwSayRwg= dependencies: ansi-escapes "^3.0.0" cli-cursor "^2.0.0" wrap-ansi "^3.0.1" -longest@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/longest/-/longest-1.0.1.tgz#30a0b2da38f73770e8294a0d22e6625ed77d0097" - loose-envify@^1.0.0: - version "1.3.1" - resolved "https://registry.yarnpkg.com/loose-envify/-/loose-envify-1.3.1.tgz#d1a8ad33fa9ce0e713d65fdd0ac8b748d478c848" + version "1.4.0" + resolved "https://registry.yarnpkg.com/loose-envify/-/loose-envify-1.4.0.tgz#71ee51fa7be4caec1a63839f7e682d8132d30caf" + integrity sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q== dependencies: - js-tokens "^3.0.0" + js-tokens "^3.0.0 || ^4.0.0" loud-rejection@^1.0.0: version "1.6.0" resolved "https://registry.yarnpkg.com/loud-rejection/-/loud-rejection-1.6.0.tgz#5b46f80147edee578870f086d04821cf998e551f" + integrity sha1-W0b4AUft7leIcPCG0Eghz5mOVR8= dependencies: currently-unhandled "^0.4.1" signal-exit "^3.0.0" -lower-case@^1.1.1: - version "1.1.4" - resolved "https://registry.yarnpkg.com/lower-case/-/lower-case-1.1.4.tgz#9a2cabd1b9e8e0ae993a4bf7d5875c39c42e8eac" - -lru-cache@^4.0.1, lru-cache@^4.1.2, lru-cache@^4.1.3: - version "4.1.5" - resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-4.1.5.tgz#8bbe50ea85bed59bc9e33dcab8235ee9bcf443cd" - integrity sha512-sWZlbEP2OsHNkXrMl5GYk/jKk70MBng6UU4YI/qGDYbgf6YbP4EvmqISbXCoJiRKs+1bSpFHVgQxvJ17F2li5g== - dependencies: - pseudomap "^1.0.2" - yallist "^2.1.2" - lru-cache@^5.1.1: version "5.1.1" resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-5.1.1.tgz#1da27e6710271947695daf6848e847f01d84b920" @@ -6529,45 +7140,56 @@ lru-cache@^5.1.1: dependencies: yallist "^3.0.2" -macos-release@^2.2.0: - version "2.2.0" - resolved "https://registry.yarnpkg.com/macos-release/-/macos-release-2.2.0.tgz#ab58d55dd4714f0a05ad4b0e90f4370fef5cdea8" - integrity sha512-iV2IDxZaX8dIcM7fG6cI46uNmHUxHE4yN+Z8tKHAW1TBPMZDIKHf/3L+YnOuj/FK9il14UaVdHmiQ1tsi90ltA== +ltgt@^2.1.2: + version "2.2.1" + resolved "https://registry.yarnpkg.com/ltgt/-/ltgt-2.2.1.tgz#f35ca91c493f7b73da0e07495304f17b31f87ee5" + integrity sha1-81ypHEk/e3PaDgdJUwTxezH4fuU= + +macos-release@^2.2.0: + version "2.3.0" + resolved "https://registry.yarnpkg.com/macos-release/-/macos-release-2.3.0.tgz#eb1930b036c0800adebccd5f17bc4c12de8bb71f" + integrity sha512-OHhSbtcviqMPt7yfw5ef5aghS2jzFVKEFyCJndQt2YpSQ9qRVSEv2axSJI1paVThEu+FFGs584h/1YhxjVqajA== + +magic-string@^0.22.5: + version "0.22.5" + resolved "https://registry.yarnpkg.com/magic-string/-/magic-string-0.22.5.tgz#8e9cf5afddf44385c1da5bc2a6a0dbd10b03657e" + integrity sha512-oreip9rJZkzvA8Qzk9HFs8fZGF/u7H/gtrE8EN6RjKJ9kh2HlC+yQ2QezifqTZfGyiuAV0dRv5a+y/8gBb1m9w== + dependencies: + vlq "^0.2.2" magic-string@^0.25.2: - version "0.25.2" - resolved "https://registry.yarnpkg.com/magic-string/-/magic-string-0.25.2.tgz#139c3a729515ec55e96e69e82a11fe890a293ad9" - integrity sha512-iLs9mPjh9IuTtRsqqhNGYcZXGei0Nh/A4xirrsqW7c+QhKVFL2vm7U09ru6cHRD22azaP/wMDgI+HCqbETMTtg== + version "0.25.4" + resolved "https://registry.yarnpkg.com/magic-string/-/magic-string-0.25.4.tgz#325b8a0a79fc423db109b77fd5a19183b7ba5143" + integrity sha512-oycWO9nEVAP2RVPbIoDoA4Y7LFIJ3xRYov93gAyJhZkET1tNuB0u7uWkZS2LpBWTJUWnmau/To8ECWRC+jKNfw== dependencies: sourcemap-codec "^1.4.4" -make-dir@^1.0.0, make-dir@^1.3.0: +make-dir@^1.0.0: version "1.3.0" resolved "https://registry.yarnpkg.com/make-dir/-/make-dir-1.3.0.tgz#79c1033b80515bd6d24ec9933e860ca75ee27f0c" integrity sha512-2w31R7SJtieJJnQtGc7RVL2StM2vGYVfqUOvUDxH6bC6aJTxPxTF0GnIgCyu7tjockiUWAYQRbxa7vKn34s5sQ== dependencies: pify "^3.0.0" -make-error-cause@^1.1.1: - version "1.2.2" - resolved "https://registry.yarnpkg.com/make-error-cause/-/make-error-cause-1.2.2.tgz#df0388fcd0b37816dff0a5fb8108939777dcbc9d" +make-dir@^2.0.0, make-dir@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/make-dir/-/make-dir-2.1.0.tgz#5f0310e18b8be898cc07009295a30ae41e91e6f5" + integrity sha512-LS9X+dc8KLxXCb8dni79fLIIUA5VyZoyjSMCwTluaXA0o27cCK0bhXkpgw+sTXVpPy/lSO57ilRixqk0vDmtRA== dependencies: - make-error "^1.2.0" - -make-error@^1.2.0: - version "1.3.4" - resolved "https://registry.yarnpkg.com/make-error/-/make-error-1.3.4.tgz#19978ed575f9e9545d2ff8c13e33b5d18a67d535" + pify "^4.0.1" + semver "^5.6.0" -make-fetch-happen@^4.0.1: - version "4.0.1" - resolved "https://registry.yarnpkg.com/make-fetch-happen/-/make-fetch-happen-4.0.1.tgz#141497cb878f243ba93136c83d8aba12c216c083" +make-fetch-happen@^5.0.0: + version "5.0.2" + resolved "https://registry.yarnpkg.com/make-fetch-happen/-/make-fetch-happen-5.0.2.tgz#aa8387104f2687edca01c8687ee45013d02d19bd" + integrity sha512-07JHC0r1ykIoruKO8ifMXu+xEU8qOXDFETylktdug6vJDACnP+HKevOu3PXyNPzFyTSlz8vrBYlBO1JZRe8Cag== dependencies: agentkeepalive "^3.4.1" - cacache "^11.0.1" + cacache "^12.0.0" http-cache-semantics "^3.8.1" http-proxy-agent "^2.1.0" - https-proxy-agent "^2.2.1" - lru-cache "^4.1.2" + https-proxy-agent "^2.2.3" + lru-cache "^5.1.1" mississippi "^3.0.0" node-fetch-npm "^2.0.2" promise-retry "^1.1.1" @@ -6575,80 +7197,69 @@ make-fetch-happen@^4.0.1: ssri "^6.0.0" make-iterator@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/make-iterator/-/make-iterator-1.0.0.tgz#57bef5dc85d23923ba23767324d8e8f8f3d9694b" + version "1.0.1" + resolved "https://registry.yarnpkg.com/make-iterator/-/make-iterator-1.0.1.tgz#29b33f312aa8f547c4a5e490f56afcec99133ad6" + integrity sha512-pxiuXh0iVEq7VM7KMIhs5gxsfxCux2URptUQaXo4iZZJxBAzTPOLE2BumO5dbfVYq/hBJFBR/a1mFDmOx5AGmw== dependencies: - kind-of "^3.1.0" + kind-of "^6.0.2" makeerror@1.0.x: version "1.0.11" resolved "https://registry.yarnpkg.com/makeerror/-/makeerror-1.0.11.tgz#e01a5c9109f2af79660e4e8b9587790184f5a96c" + integrity sha1-4BpckQnyr3lmDk6LlYd5AYT1qWw= dependencies: tmpl "1.0.x" -map-age-cleaner@^0.1.1: - version "0.1.3" - resolved "https://registry.yarnpkg.com/map-age-cleaner/-/map-age-cleaner-0.1.3.tgz#7d583a7306434c055fe474b0f45078e6e1b4b92a" - dependencies: - p-defer "^1.0.0" - map-cache@^0.2.0, map-cache@^0.2.2: version "0.2.2" resolved "https://registry.yarnpkg.com/map-cache/-/map-cache-0.2.2.tgz#c32abd0bd6525d9b051645bb4f26ac5dc98a0dbf" + integrity sha1-wyq9C9ZSXZsFFkW7TyasXcmKDb8= map-obj@^1.0.0, map-obj@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/map-obj/-/map-obj-1.0.1.tgz#d933ceb9205d82bdcf4886f6742bdc2b4dea146d" + integrity sha1-2TPOuSBdgr3PSIb2dCvcK03qFG0= map-obj@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/map-obj/-/map-obj-2.0.0.tgz#a65cd29087a92598b8791257a523e021222ac1f9" + integrity sha1-plzSkIepJZi4eRJXpSPgISIqwfk= map-visit@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/map-visit/-/map-visit-1.0.0.tgz#ecdca8f13144e660f1b5bd41f12f3479d98dfb8f" + integrity sha1-7Nyo8TFE5mDxtb1B8S80edmN+48= dependencies: object-visit "^1.0.0" matchdep@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/matchdep/-/matchdep-2.0.0.tgz#c6f34834a0d8dbc3b37c27ee8bbcb27c7775582e" + integrity sha1-xvNINKDY28OzfCfui7yyfHd1WC4= dependencies: findup-sync "^2.0.0" micromatch "^3.0.4" resolve "^1.4.0" stack-trace "0.0.10" -matcher@^1.0.0: - version "1.1.1" - resolved "https://registry.yarnpkg.com/matcher/-/matcher-1.1.1.tgz#51d8301e138f840982b338b116bb0c09af62c1c2" - dependencies: - escape-string-regexp "^1.0.4" +math-random@^1.0.1: + version "1.0.4" + resolved "https://registry.yarnpkg.com/math-random/-/math-random-1.0.4.tgz#5dd6943c938548267016d4e34f057583080c514c" + integrity sha512-rUxjysqif/BZQH2yhd5Aaq7vXMSx9NdEsQcyA07uEzIvxgI7zIr33gGsh+RU0/XjmQpCW7RsVof1vlkvQVCK5A== md5.js@^1.3.4: - version "1.3.4" - resolved "https://registry.yarnpkg.com/md5.js/-/md5.js-1.3.4.tgz#e9bdbde94a20a5ac18b04340fc5764d5b09d901d" + version "1.3.5" + resolved "https://registry.yarnpkg.com/md5.js/-/md5.js-1.3.5.tgz#b5d07b8e3216e3e27cd728d72f70d1e6a342005f" + integrity sha512-xitP+WxNPcTTOgnTJcrhM0xvdPepipPSf3I8EIpGKeFLjt3PlJLIDG3u8EX53ZIubkb+5U2+3rELYpEhHhzdkg== dependencies: hash-base "^3.0.0" inherits "^2.0.1" + safe-buffer "^5.1.2" -mem@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/mem/-/mem-1.1.0.tgz#5edd52b485ca1d900fe64895505399a0dfa45f76" - dependencies: - mimic-fn "^1.0.0" - -mem@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/mem/-/mem-4.0.0.tgz#6437690d9471678f6cc83659c00cbafcd6b0cdaf" - dependencies: - map-age-cleaner "^0.1.1" - mimic-fn "^1.0.0" - p-is-promise "^1.1.0" - -memory-fs@^0.4.0, memory-fs@^0.4.1, memory-fs@~0.4.1: +memory-fs@^0.4.0: version "0.4.1" resolved "https://registry.yarnpkg.com/memory-fs/-/memory-fs-0.4.1.tgz#3a9a20b8462523e447cfbc7e8bb80ed667bfc552" + integrity sha1-OpoguEYlI+RHz7x+i7gO1me/xVI= dependencies: errno "^0.1.3" readable-stream "^2.0.1" @@ -6656,6 +7267,7 @@ memory-fs@^0.4.0, memory-fs@^0.4.1, memory-fs@~0.4.1: meow@^3.3.0: version "3.7.0" resolved "https://registry.yarnpkg.com/meow/-/meow-3.7.0.tgz#72cb668b425228290abbfa856892587308a801fb" + integrity sha1-cstmi0JSKCkKu/qFaJJYcwioAfs= dependencies: camelcase-keys "^2.0.0" decamelize "^1.1.2" @@ -6669,8 +7281,9 @@ meow@^3.3.0: trim-newlines "^1.0.0" meow@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/meow/-/meow-4.0.0.tgz#fd5855dd008db5b92c552082db1c307cba20b29d" + version "4.0.1" + resolved "https://registry.yarnpkg.com/meow/-/meow-4.0.1.tgz#d48598f6f4b1472f35bf6317a95945ace347f975" + integrity sha512-xcSBHD5Z86zaOc+781KrupuHAzeGXSLtiAOmBsiLDiPSaYSB6hdew2ng9EBAnZ62jagG9MHAOdxpDi/lWBFJ/A== dependencies: camelcase-keys "^4.0.0" decamelize-keys "^1.0.0" @@ -6682,19 +7295,40 @@ meow@^4.0.0: redent "^2.0.0" trim-newlines "^2.0.0" -merge-stream@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/merge-stream/-/merge-stream-1.0.1.tgz#4041202d508a342ba00174008df0c251b8c135e1" +meow@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/meow/-/meow-5.0.0.tgz#dfc73d63a9afc714a5e371760eb5c88b91078aa4" + integrity sha512-CbTqYU17ABaLefO8vCU153ZZlprKYWDljcndKKDCFcYQITzWCXZAVk4QMFZPgvzrnUQ3uItnIE/LoUOwrT15Ig== dependencies: - readable-stream "^2.0.1" + camelcase-keys "^4.0.0" + decamelize-keys "^1.0.0" + loud-rejection "^1.0.0" + minimist-options "^3.0.1" + normalize-package-data "^2.3.4" + read-pkg-up "^3.0.0" + redent "^2.0.0" + trim-newlines "^2.0.0" + yargs-parser "^10.0.0" -merge2@^1.2.3: - version "1.2.3" - resolved "https://registry.yarnpkg.com/merge2/-/merge2-1.2.3.tgz#7ee99dbd69bb6481689253f018488a1b902b0ed5" +merge-stream@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/merge-stream/-/merge-stream-2.0.0.tgz#52823629a14dd00c9770fb6ad47dc6310f2c1f60" + integrity sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w== + +merge2@^1.2.3, merge2@^1.3.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/merge2/-/merge2-1.3.0.tgz#5b366ee83b2f1582c48f87e47cf1a9352103ca81" + integrity sha512-2j4DAdlBOkiSZIsaXk4mTE3sRS02yBHAtfy127xRV3bQUFqXkjHCHLW6Scv7DwNRbIWNHH8zpnz9zMaKXIdvYw== + +mergeiterator@^1.2.5: + version "1.2.5" + resolved "https://registry.yarnpkg.com/mergeiterator/-/mergeiterator-1.2.5.tgz#40f0a27888f2eb85d80fa4c29632cf400a0b8c7b" + integrity sha512-KVZWGnRkEgmVewnpVIEUm/KuQ2kHx4T0zYQlPbGypBk4kM5sJ1+7bPDR2N4yg3EoS1CiGKk2GRb5PkAsMEoh3w== micromatch@^2.1.5: 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" @@ -6710,7 +7344,7 @@ micromatch@^2.1.5: parse-glob "^3.0.4" regex-cache "^0.4.2" -micromatch@^3.0.4, micromatch@^3.1.10, micromatch@^3.1.4, micromatch@^3.1.8: +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" integrity sha512-MWikgl9n9M3w+bpsY3He8L+w9eF9338xRl8IAO5viDizwSzziFEyUzo2xrrloB64ADbTf8uA8vRqqttDTOmccg== @@ -6729,74 +7363,103 @@ micromatch@^3.0.4, micromatch@^3.1.10, micromatch@^3.1.4, micromatch@^3.1.8: snapdragon "^0.8.1" to-regex "^3.0.2" +micromatch@^4.0.2: + version "4.0.2" + resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-4.0.2.tgz#4fcb0999bf9fbc2fcbdd212f6d629b9a56c39259" + integrity sha512-y7FpHSbMUMoyPbYUSzO6PaZ6FyRnQOpHuKwbo1G+Knck95XVU4QAiKdGEnj5wwoS7PlOgthX/09u5iFJ+aYf5Q== + dependencies: + braces "^3.0.1" + picomatch "^2.0.5" + miller-rabin@^4.0.0: version "4.0.1" resolved "https://registry.yarnpkg.com/miller-rabin/-/miller-rabin-4.0.1.tgz#f080351c865b0dc562a8462966daa53543c78a4d" + integrity sha512-115fLhvZVqWwHPbClyntxEVfVDfl9DLLTuJvq3g2O/Oxi8AiNouAHvDSzHS0viUJc+V5vm3eq91Xwqn9dp4jRA== dependencies: bn.js "^4.0.0" brorand "^1.0.1" -mime-db@~1.38.0: - version "1.38.0" - resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.38.0.tgz#1a2aab16da9eb167b49c6e4df2d9c68d63d8e2ad" - integrity sha512-bqVioMFFzc2awcdJZIzR3HjZFX20QhilVS7hytkKrv7xFAn8bM1gzc/FOX2awLISvWe0PV8ptFKcon+wZ5qYkg== +mime-db@1.42.0: + version "1.42.0" + resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.42.0.tgz#3e252907b4c7adb906597b4b65636272cf9e7bac" + integrity sha512-UbfJCR4UAVRNgMpfImz05smAXK7+c+ZntjaA26ANtkXLlOe947Aag5zdIcKQULAiF9Cq4WxBi9jUs5zkA84bYQ== mime-types@^2.1.12, mime-types@~2.1.19: - version "2.1.22" - resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.22.tgz#fe6b355a190926ab7698c9a0556a11199b2199bd" - integrity sha512-aGl6TZGnhm/li6F7yx82bJiBZwgiEa4Hf6CNr8YO+r5UHr53tSTYZb102zyU50DOWWKeOv0uQLRL0/9EiKWCog== + version "2.1.25" + resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.25.tgz#39772d46621f93e2a80a856c53b86a62156a6437" + integrity sha512-5KhStqB5xpTAeGqKBAMgwaYMnQik7teQN4IAzC7npDv6kzeU6prfkR67bc87J1kWMPGkoaZSq1npmexMgkmEVg== dependencies: - mime-db "~1.38.0" + mime-db "1.42.0" mimic-fn@^1.0.0: version "1.2.0" resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-1.2.0.tgz#820c86a39334640e99516928bd03fca88057d022" + integrity sha512-jf84uxzwiuiIVKiOLpfYk7N46TSy8ubTonmneY9vrpHNAnp0QBt2BxWV9dO3/j+BoVAb+a5G6YDPW3M5HOdMWQ== -minimalistic-assert@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/minimalistic-assert/-/minimalistic-assert-1.0.0.tgz#702be2dda6b37f4836bcb3f5db56641b64a1d3d3" +mimic-fn@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-2.1.0.tgz#7ed2c2ccccaf84d3ffcb7a69b57711fc2083401b" + integrity sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg== + +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" + integrity sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A== minimalistic-crypto-utils@^1.0.0, minimalistic-crypto-utils@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz#f6c00c1c0b082246e5c4d99dfb8c7c083b2b582a" + integrity sha1-9sAMHAsIIkblxNmd+4x8CDsrWCo= minimatch@^3.0.0, 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== dependencies: brace-expansion "^1.1.7" minimist-options@^3.0.1: version "3.0.2" resolved "https://registry.yarnpkg.com/minimist-options/-/minimist-options-3.0.2.tgz#fba4c8191339e13ecf4d61beb03f070103f3d954" + integrity sha512-FyBrT/d0d4+uiZRbqznPXqw3IpZZG3gl3wKWiX784FycUKVwBt0uLBFkQrtE4tZOrgo78nZp2jnKz3L65T5LdQ== dependencies: arrify "^1.0.1" is-plain-obj "^1.1.0" -minimist@0.0.8, minimist@~0.0.1: +minimist@0.0.8: version "0.0.8" resolved "https://registry.yarnpkg.com/minimist/-/minimist-0.0.8.tgz#857fcabfc3397d2625b8228262e86aa7a011b05d" + integrity sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0= minimist@^1.1.0, minimist@^1.1.1, minimist@^1.1.3, minimist@^1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.0.tgz#a35008b20f41383eec1fb914f4cd5df79a264284" + integrity sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ= -minipass@^2.2.1, minipass@^2.3.4, minipass@^2.3.5: - version "2.3.5" - resolved "https://registry.yarnpkg.com/minipass/-/minipass-2.3.5.tgz#cacebe492022497f656b0f0f51e2682a9ed2d848" +minimist@~0.0.1: + version "0.0.10" + resolved "https://registry.yarnpkg.com/minimist/-/minimist-0.0.10.tgz#de3f98543dbf96082be48ad1a0c7cda836301dcf" + integrity sha1-3j+YVD2/lggr5IrRoMfNqDYwHc8= + +minipass@^2.3.5, minipass@^2.6.0, minipass@^2.8.6, minipass@^2.9.0: + version "2.9.0" + resolved "https://registry.yarnpkg.com/minipass/-/minipass-2.9.0.tgz#e713762e7d3e32fed803115cf93e04bca9fcc9a6" + integrity sha512-wxfUjg9WebH+CUDX/CdbRlh5SmfZiy/hpkxaRI16Y9W56Pa75sWgd/rvFilSgrauD9NyFymP/+JFV3KwzIsJeg== dependencies: safe-buffer "^5.1.2" yallist "^3.0.0" -minizlib@^1.1.1: - version "1.2.1" - resolved "https://registry.yarnpkg.com/minizlib/-/minizlib-1.2.1.tgz#dd27ea6136243c7c880684e8672bb3a45fd9b614" +minizlib@^1.2.1: + version "1.3.3" + resolved "https://registry.yarnpkg.com/minizlib/-/minizlib-1.3.3.tgz#2290de96818a34c29551c8a8d301216bd65a861d" + integrity sha512-6ZYMOEnmVsdCeTJVE0W9ZD+pVnE8h9Hma/iOwwRDsdQoePpoX56/8B6z3P9VNwppJuBKNRuFDRNRqRWexT9G9Q== dependencies: - minipass "^2.2.1" + minipass "^2.9.0" mississippi@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/mississippi/-/mississippi-3.0.0.tgz#ea0a3291f97e0b5e8776b363d5f0a12d94c67022" + integrity sha512-x471SsVjUtBRtcvd4BzKE9kFC+/2TeWgKCgw0bZcw1b9l2X3QX5vCWgF+KaZaYm87Ss//rHnWryupDrgLvmSkA== dependencies: concat-stream "^1.5.0" duplexify "^3.4.2" @@ -6810,29 +7473,40 @@ mississippi@^3.0.0: through2 "^2.0.0" mixin-deep@^1.2.0: - version "1.3.1" - resolved "https://registry.yarnpkg.com/mixin-deep/-/mixin-deep-1.3.1.tgz#a49e7268dce1a0d9698e45326c5626df3543d0fe" + version "1.3.2" + resolved "https://registry.yarnpkg.com/mixin-deep/-/mixin-deep-1.3.2.tgz#1120b43dc359a785dce65b55b82e257ccf479566" + integrity sha512-WRoDn//mXBiJ1H40rqa3vH0toePwSsGb45iInWlTySa+Uu4k3tYUSxa2v1KqAiLtvlrSzaExqS1gtk96A9zvEA== dependencies: for-in "^1.0.2" is-extendable "^1.0.1" -mkdirp@^0.5.0, mkdirp@^0.5.1, mkdirp@~0.5.0: +mkdirp-promise@^5.0.1: + version "5.0.1" + resolved "https://registry.yarnpkg.com/mkdirp-promise/-/mkdirp-promise-5.0.1.tgz#e9b8f68e552c68a9c1713b84883f7a1dd039b8a1" + integrity sha1-6bj2jlUsaKnBcTuEiD96HdA5uKE= + dependencies: + mkdirp "*" + +mkdirp@*, mkdirp@^0.5.0, mkdirp@^0.5.1: version "0.5.1" resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.1.tgz#30057438eac6cf7f8c4767f38648d6697d75c903" + integrity sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM= dependencies: minimist "0.0.8" modify-values@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/modify-values/-/modify-values-1.0.0.tgz#e2b6cdeb9ce19f99317a53722f3dbf5df5eaaab2" + version "1.0.1" + resolved "https://registry.yarnpkg.com/modify-values/-/modify-values-1.0.1.tgz#b3939fa605546474e3e3e3c63d64bd43b4ee6022" + integrity sha512-xV2bxeN6F7oYjZWTe/YPAy6MN2M+sL4u/Rlm2AHCIVGfo2p1yGmBHQ6vHehl4bRTZBdHu3TSkWdYgkwpYzAGSw== module-deps@^6.0.0: - version "6.1.0" - resolved "https://registry.yarnpkg.com/module-deps/-/module-deps-6.1.0.tgz#d1e1efc481c6886269f7112c52c3236188e16479" + version "6.2.1" + resolved "https://registry.yarnpkg.com/module-deps/-/module-deps-6.2.1.tgz#cfe558784060e926824f474b4e647287837cda50" + integrity sha512-UnEn6Ah36Tu4jFiBbJVUtt0h+iXqxpLqDvPS8nllbw5RZFmNJ1+Mz5BjYnM9ieH80zyxHkARGLnMIHlPK5bu6A== dependencies: JSONStream "^1.0.3" browser-resolve "^1.7.0" - cached-path-relative "^1.0.0" + cached-path-relative "^1.0.2" concat-stream "~1.6.0" defined "^1.0.0" detective "^5.0.2" @@ -6849,6 +7523,7 @@ module-deps@^6.0.0: move-concurrently@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/move-concurrently/-/move-concurrently-1.0.1.tgz#be2c005fda32e0b29af1f05d7c4b33214c701f92" + integrity sha1-viwAX9oy4LKa8fBdfEszIUxwH5I= dependencies: aproba "^1.1.1" copy-concurrently "^1.0.0" @@ -6860,43 +7535,72 @@ move-concurrently@^1.0.1: ms@2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/ms/-/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8" + integrity sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g= ms@^2.0.0, ms@^2.1.1: - version "2.1.1" - resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.1.tgz#30a5864eb3ebb0a66f2ebe6d727af06a09d86e0a" + version "2.1.2" + resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009" + integrity sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w== -multimatch@^2.0.0, multimatch@^2.1.0: +multimatch@^2.0.0: version "2.1.0" resolved "https://registry.yarnpkg.com/multimatch/-/multimatch-2.1.0.tgz#9c7906a22fb4c02919e2f5f75161b4cdbd4b2a2b" + integrity sha1-nHkGoi+0wCkZ4vX3UWG0zb1LKis= dependencies: array-differ "^1.0.0" array-union "^1.0.1" arrify "^1.0.0" minimatch "^3.0.0" +multimatch@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/multimatch/-/multimatch-3.0.0.tgz#0e2534cc6bc238d9ab67e1b9cd5fcd85a6dbf70b" + integrity sha512-22foS/gqQfANZ3o+W7ST2x25ueHDVNWl/b9OlGcLpy/iKxjCpvcNCM51YCenUi7Mt/jAjjqv8JwZRs8YP5sRjA== + dependencies: + array-differ "^2.0.3" + array-union "^1.0.2" + arrify "^1.0.1" + minimatch "^3.0.4" + mute-stdout@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/mute-stdout/-/mute-stdout-1.0.0.tgz#5b32ea07eb43c9ded6130434cf926f46b2a7fd4d" + version "1.0.1" + resolved "https://registry.yarnpkg.com/mute-stdout/-/mute-stdout-1.0.1.tgz#acb0300eb4de23a7ddeec014e3e96044b3472331" + integrity sha512-kDcwXR4PS7caBpuRYYBUz9iVixUk3anO3f5OYFiIPwK/20vCzKCHyKoulbiDY1S53zD2bxUpxN/IJ+TnXjfvxg== -mute-stream@0.0.7, mute-stream@~0.0.4: +mute-stream@0.0.7: version "0.0.7" resolved "https://registry.yarnpkg.com/mute-stream/-/mute-stream-0.0.7.tgz#3075ce93bc21b8fab43e1bc4da7e8115ed1e7bab" + integrity sha1-MHXOk7whuPq0PhvE2n6BFe0ee6s= + +mute-stream@0.0.8, mute-stream@~0.0.4: + version "0.0.8" + resolved "https://registry.yarnpkg.com/mute-stream/-/mute-stream-0.0.8.tgz#1630c42b2251ff81e2a283de96a5497ea92e5e0d" + integrity sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA== + +mz@^2.5.0: + version "2.7.0" + resolved "https://registry.yarnpkg.com/mz/-/mz-2.7.0.tgz#95008057a56cafadc2bc63dde7f9ff6955948e32" + integrity sha512-z81GNO7nnYMEhrGh9LeymoE4+Yr0Wn5McHIZMK5cfQCl+NDX08sCZgUc9/6MHni9IWuFLm1Z3HTCXu2z9fN62Q== + dependencies: + any-promise "^1.0.0" + object-assign "^4.0.1" + thenify-all "^1.0.0" nan@^2.12.1: - version "2.13.2" - resolved "https://registry.yarnpkg.com/nan/-/nan-2.13.2.tgz#f51dc7ae66ba7d5d55e1e6d4d8092e802c9aefe7" - integrity sha512-TghvYc72wlMGMVMluVo9WRJc0mB8KxxF/gZ4YYFy7V2ZQX9l7rgbPg7vjS9mt6U5HXODVFVI2bOduCzwOMv/lw== + version "2.14.0" + resolved "https://registry.yarnpkg.com/nan/-/nan-2.14.0.tgz#7818f722027b2459a86f0295d434d1fc2336c52c" + integrity sha512-INOFj37C7k3AfaNTtX8RhsTw7qRy7eLET14cROi9+5HAVbbHuIWUHEauBv5qT4Av2tWasiTY1Jw6puUNqRJXQg== nanomatch@^1.2.9: - version "1.2.9" - resolved "https://registry.yarnpkg.com/nanomatch/-/nanomatch-1.2.9.tgz#879f7150cb2dab7a471259066c104eee6e0fa7c2" + version "1.2.13" + resolved "https://registry.yarnpkg.com/nanomatch/-/nanomatch-1.2.13.tgz#b87a8aa4fc0de8fe6be88895b38983ff265bd119" + integrity sha512-fpoe2T0RbHwBTBUOftAfBPaDEi06ufaUai0mE6Yn1kacc3SnTErfb/h+X94VXzI64rKFHYImXSvdwGGCmwOqCA== dependencies: arr-diff "^4.0.0" array-unique "^0.3.2" define-property "^2.0.2" extend-shallow "^3.0.2" fragment-cache "^0.2.1" - is-odd "^2.0.0" is-windows "^1.0.2" kind-of "^6.0.2" object.pick "^1.3.0" @@ -6907,38 +7611,36 @@ nanomatch@^1.2.9: natural-compare@^1.4.0: version "1.4.0" resolved "https://registry.yarnpkg.com/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7" - -ncname@1.0.x: - version "1.0.0" - resolved "https://registry.yarnpkg.com/ncname/-/ncname-1.0.0.tgz#5b57ad18b1ca092864ef62b0b1ed8194f383b71c" - dependencies: - xml-char-classes "^1.0.0" + integrity sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc= needle@^2.2.1: - version "2.2.4" - resolved "https://registry.yarnpkg.com/needle/-/needle-2.2.4.tgz#51931bff82533b1928b7d1d69e01f1b00ffd2a4e" + version "2.4.0" + resolved "https://registry.yarnpkg.com/needle/-/needle-2.4.0.tgz#6833e74975c444642590e15a750288c5f939b57c" + integrity sha512-4Hnwzr3mi5L97hMYeNl8wRW/Onhy4nUKR/lVemJ8gJedxxUyBLm9kkrDColJvoSfwi0jCNhD+xCdOtiGDQiRZg== dependencies: - debug "^2.1.2" + debug "^3.2.6" iconv-lite "^0.4.4" sax "^1.2.4" -neo-async@^2.5.0: - version "2.5.0" - resolved "https://registry.yarnpkg.com/neo-async/-/neo-async-2.5.0.tgz#76b1c823130cca26acfbaccc8fbaf0a2fa33b18f" +neo-async@^2.6.0: + version "2.6.1" + resolved "https://registry.yarnpkg.com/neo-async/-/neo-async-2.6.1.tgz#ac27ada66167fa8849a6addd837f6b189ad2081c" + integrity sha512-iyam8fBuCUpWeKPGpaNMetEocMt364qkCsfL9JuhjXX6dRnguRVOfk2GZaDpPjcOKiiXCPINZC1GczQ7iTq3Zw== -nice-try@^1.0.4: - version "1.0.4" - resolved "https://registry.yarnpkg.com/nice-try/-/nice-try-1.0.4.tgz#d93962f6c52f2c1558c0fbda6d512819f1efe1c4" +next-tick@~1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/next-tick/-/next-tick-1.0.0.tgz#ca86d1fe8828169b0120208e3dc8424b9db8342c" + integrity sha1-yobR/ogoFpsBICCOPchCS524NCw= -no-case@^2.2.0: - version "2.3.2" - resolved "https://registry.yarnpkg.com/no-case/-/no-case-2.3.2.tgz#60b813396be39b3f1288a4c1ed5d1e7d28b464ac" - dependencies: - lower-case "^1.1.1" +nice-try@^1.0.4: + version "1.0.5" + resolved "https://registry.yarnpkg.com/nice-try/-/nice-try-1.0.5.tgz#a3378a7696ce7d223e88fc9b764bd7ef1089e366" + integrity sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ== node-fetch-npm@^2.0.2: version "2.0.2" resolved "https://registry.yarnpkg.com/node-fetch-npm/-/node-fetch-npm-2.0.2.tgz#7258c9046182dca345b4208eda918daf33697ff7" + integrity sha512-nJIxm1QmAj4v3nfCvEeCrYSoVwXyxLnaPBK5W1W5DGEJwjlKuC2VEUycGw5oxk+4zZahRrB84PUJJgEmhFTDFw== dependencies: encoding "^0.1.11" json-parse-better-errors "^1.0.0" @@ -6947,6 +7649,7 @@ node-fetch-npm@^2.0.2: node-fetch@^1.7.0: version "1.7.3" resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-1.7.3.tgz#980f6f72d85211a5347c6b2bc18c5b84c3eb47ef" + integrity sha512-NhZ4CsKx7cYm2vSrBAr2PvFOe6sWDf0UYLRqA6svUYg7+/TSfVAu49jYC4BvQ4Sms9SZgdqGBgroqfDhJdTyKQ== dependencies: encoding "^0.1.11" is-stream "^1.0.1" @@ -6956,65 +7659,41 @@ node-fetch@^2.3.0, node-fetch@^2.5.0: resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.0.tgz#e633456386d4aa55863f676a7ab0daa8fdecb0fd" integrity sha512-8dG4H5ujfvFiqDmVu9fQ5bOHUC15JMjMY/Zumv26oOvvVJjM67KF8koCWIabKQ1GJIa9r2mMZscBq/TbdOcmNA== -node-gyp@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/node-gyp/-/node-gyp-4.0.0.tgz#972654af4e5dd0cd2a19081b4b46fe0442ba6f45" - integrity sha512-2XiryJ8sICNo6ej8d0idXDEMKfVfFK7kekGCtJAuelGsYHQxhj13KTf95swTCN2dZ/4lTfZ84Fu31jqJEEgjWA== +node-gyp@^5.0.2: + version "5.0.5" + resolved "https://registry.yarnpkg.com/node-gyp/-/node-gyp-5.0.5.tgz#f6cf1da246eb8c42b097d7cd4d6c3ce23a4163af" + integrity sha512-WABl9s4/mqQdZneZHVWVG4TVr6QQJZUC6PAx47ITSk9lreZ1n+7Z9mMAIbA3vnO4J9W20P7LhCxtzfWsAD/KDw== dependencies: + env-paths "^1.0.0" glob "^7.0.3" graceful-fs "^4.1.2" mkdirp "^0.5.0" nopt "2 || 3" npmlog "0 || 1 || 2 || 3 || 4" - osenv "0" request "^2.87.0" rimraf "2" semver "~5.3.0" - tar "^4.4.8" + tar "^4.4.12" which "1" node-int64@^0.4.0: version "0.4.0" resolved "https://registry.yarnpkg.com/node-int64/-/node-int64-0.4.0.tgz#87a9065cdb355d3182d8f94ce11188b825c68a3b" - -node-libs-browser@^2.0.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/node-libs-browser/-/node-libs-browser-2.1.0.tgz#5f94263d404f6e44767d726901fff05478d600df" - dependencies: - assert "^1.1.1" - browserify-zlib "^0.2.0" - buffer "^4.3.0" - console-browserify "^1.1.0" - constants-browserify "^1.0.0" - crypto-browserify "^3.11.0" - domain-browser "^1.1.1" - events "^1.0.0" - https-browserify "^1.0.0" - os-browserify "^0.3.0" - path-browserify "0.0.0" - process "^0.11.10" - punycode "^1.2.4" - querystring-es3 "^0.2.0" - readable-stream "^2.3.3" - stream-browserify "^2.0.1" - stream-http "^2.7.2" - string_decoder "^1.0.0" - timers-browserify "^2.0.4" - tty-browserify "0.0.0" - url "^0.11.0" - util "^0.10.3" - vm-browserify "0.0.4" + integrity sha1-h6kGXNs1XTGC2PlM4RGIuCXGijs= node-modules-regexp@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/node-modules-regexp/-/node-modules-regexp-1.0.0.tgz#8d9dbe28964a4ac5712e9131642107c71e90ec40" + integrity sha1-jZ2+KJZKSsVxLpExZCEHxx6Q7EA= -node-notifier@^5.2.1: - version "5.2.1" - resolved "https://registry.yarnpkg.com/node-notifier/-/node-notifier-5.2.1.tgz#fa313dd08f5517db0e2502e5758d664ac69f9dea" +node-notifier@^5.4.2: + version "5.4.3" + resolved "https://registry.yarnpkg.com/node-notifier/-/node-notifier-5.4.3.tgz#cb72daf94c93904098e28b9c590fd866e464bd50" + integrity sha512-M4UBGcs4jeOK9CjTsYwkvH6/MzuUmGCyTW+kCY7uO+1ZVr0+FHGdPdIf5CCLqAaxnRrWidyoQlNkMIIVwbKB8Q== dependencies: growly "^1.3.0" - semver "^5.4.1" + is-wsl "^1.1.0" + semver "^5.5.0" shellwords "^0.1.1" which "^1.3.0" @@ -7034,22 +7713,24 @@ node-pre-gyp@^0.12.0: semver "^5.3.0" tar "^4" -node-releases@^1.1.19: - version "1.1.19" - resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-1.1.19.tgz#c492d1e381fea0350b338b646c27867e88e91b3d" - integrity sha512-SH/B4WwovHbulIALsQllAVwqZZD1kPmKCqrhGfR29dXjLAVZMHvBjD3S6nL9D/J9QkmZ1R92/0wCMDKXUUvyyA== +node-releases@^1.1.42: + version "1.1.42" + resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-1.1.42.tgz#a999f6a62f8746981f6da90627a8d2fc090bbad7" + integrity sha512-OQ/ESmUqGawI2PRX+XIRao44qWYBBfN54ImQYdWVTQqUckuejOg76ysSqDBK8NG3zwySRVnX36JwDQ6x+9GxzA== dependencies: - semver "^5.3.0" + semver "^6.3.0" "nopt@2 || 3": version "3.0.6" resolved "https://registry.yarnpkg.com/nopt/-/nopt-3.0.6.tgz#c6465dbf08abcd4db359317f79ac68a646b28ff9" + integrity sha1-xkZdvwirzU2zWTF/eaxopkayj/k= dependencies: abbrev "1" nopt@^4.0.1: version "4.0.1" resolved "https://registry.yarnpkg.com/nopt/-/nopt-4.0.1.tgz#d0d4685afd5415193c8c7505602d0d17cd64474d" + integrity sha1-0NRoWv1UFRk8jHUFYC0NF81kR00= dependencies: abbrev "1" osenv "^0.1.4" @@ -7067,6 +7748,7 @@ normalize-package-data@^2.0.0, normalize-package-data@^2.3.0, normalize-package- normalize-path@^2.0.0, normalize-path@^2.0.1, 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= dependencies: remove-trailing-separator "^1.0.1" @@ -7081,23 +7763,25 @@ normalize-url@^3.3.0: integrity sha512-U+JJi7duF1o+u2pynbp2zXDW2/PADgC30f0GsHZtRh+HOcXHnw137TrNlyxxRvWW5fjKd3bcLHPxofWuCjaeZg== now-and-later@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/now-and-later/-/now-and-later-2.0.0.tgz#bc61cbb456d79cb32207ce47ca05136ff2e7d6ee" + version "2.0.1" + resolved "https://registry.yarnpkg.com/now-and-later/-/now-and-later-2.0.1.tgz#8e579c8685764a7cc02cb680380e94f43ccb1f7c" + integrity sha512-KGvQ0cB70AQfg107Xvs/Fbu+dGmZoTRJp2TaPwcwQm3/7PteUyN2BCgk8KBMPGBUXZdVwyWS8fDCGFygBm19UQ== dependencies: once "^1.3.2" npm-bundled@^1.0.1: - version "1.0.3" - resolved "https://registry.yarnpkg.com/npm-bundled/-/npm-bundled-1.0.3.tgz#7e71703d973af3370a9591bafe3a63aca0be2308" + version "1.1.0" + resolved "https://registry.yarnpkg.com/npm-bundled/-/npm-bundled-1.1.0.tgz#2e8fdb7e69eff2df963937b696243316537c284b" + integrity sha512-ez6dcKBFNo4FvlMqscBEFUum6M2FTLW5grqm3DyBKB5XOyKVCeeWvAuoZtbmW/5Cv8EM2bQUOA6ufxa/TKVN0g== -npm-lifecycle@^2.1.1: - version "2.1.1" - resolved "https://registry.yarnpkg.com/npm-lifecycle/-/npm-lifecycle-2.1.1.tgz#0027c09646f0fd346c5c93377bdaba59c6748fdf" - integrity sha512-+Vg6I60Z75V/09pdcH5iUo/99Q/vop35PaI99elvxk56azSVVsdsSsS/sXqKDNwbRRNN1qSxkcO45ZOu0yOWew== +npm-lifecycle@^3.1.2: + version "3.1.4" + resolved "https://registry.yarnpkg.com/npm-lifecycle/-/npm-lifecycle-3.1.4.tgz#de6975c7d8df65f5150db110b57cce498b0b604c" + integrity sha512-tgs1PaucZwkxECGKhC/stbEgFyc3TGh2TJcg2CDr6jbvQRdteHNhmMeljRzpe4wgFAXQADoy1cSqqi7mtiAa5A== dependencies: byline "^5.0.0" graceful-fs "^4.1.15" - node-gyp "^4.0.0" + node-gyp "^5.0.2" resolve-from "^4.0.0" slide "^1.1.6" uid-number "0.0.6" @@ -7105,31 +7789,27 @@ npm-lifecycle@^2.1.1: which "^1.3.1" "npm-package-arg@^4.0.0 || ^5.0.0 || ^6.0.0", npm-package-arg@^6.0.0, npm-package-arg@^6.1.0: - version "6.1.0" - resolved "https://registry.yarnpkg.com/npm-package-arg/-/npm-package-arg-6.1.0.tgz#15ae1e2758a5027efb4c250554b85a737db7fcc1" + version "6.1.1" + resolved "https://registry.yarnpkg.com/npm-package-arg/-/npm-package-arg-6.1.1.tgz#02168cb0a49a2b75bf988a28698de7b529df5cb7" + integrity sha512-qBpssaL3IOZWi5vEKUKW0cO7kzLeT+EQO9W8RsLOZf76KF9E/K9+wH0C7t06HXPpaH8WH5xF1MExLuCwbTqRUg== dependencies: - hosted-git-info "^2.6.0" + hosted-git-info "^2.7.1" osenv "^0.1.5" - semver "^5.5.0" + semver "^5.6.0" validate-npm-package-name "^3.0.0" -npm-packlist@^1.1.12, npm-packlist@^1.1.6, npm-packlist@^1.4.1: - version "1.4.1" - resolved "https://registry.yarnpkg.com/npm-packlist/-/npm-packlist-1.4.1.tgz#19064cdf988da80ea3cee45533879d90192bbfbc" - integrity sha512-+TcdO7HJJ8peiiYhvPxsEDhF3PJFGUGRcFsGve3vxvxdcpO2Z4Z7rkosRM0kWj6LfbK/P0gu3dzk5RU1ffvFcw== +npm-packlist@^1.1.6, npm-packlist@^1.4.4: + version "1.4.6" + resolved "https://registry.yarnpkg.com/npm-packlist/-/npm-packlist-1.4.6.tgz#53ba3ed11f8523079f1457376dd379ee4ea42ff4" + integrity sha512-u65uQdb+qwtGvEJh/DgQgW1Xg7sqeNbmxYyrvlNznaVTjV3E5P6F/EFjM+BVHXl7JJlsdG8A64M0XI8FI/IOlg== dependencies: ignore-walk "^3.0.1" npm-bundled "^1.0.1" -npm-path@^2.0.2: - version "2.0.4" - resolved "https://registry.yarnpkg.com/npm-path/-/npm-path-2.0.4.tgz#c641347a5ff9d6a09e4d9bce5580c4f505278e64" - dependencies: - which "^1.2.10" - -npm-pick-manifest@^2.2.3: - version "2.2.3" - resolved "https://registry.yarnpkg.com/npm-pick-manifest/-/npm-pick-manifest-2.2.3.tgz#32111d2a9562638bb2c8f2bf27f7f3092c8fae40" +npm-pick-manifest@^3.0.0: + version "3.0.2" + resolved "https://registry.yarnpkg.com/npm-pick-manifest/-/npm-pick-manifest-3.0.2.tgz#f4d9e5fd4be2153e5f4e5f9b7be8dc419a99abb7" + integrity sha512-wNprTNg+X5nf+tDi+hbjdHhM4bX+mKqv6XmPh7B5eG+QY9VARfQPfCEH013H5GqfNj6ee8Ij2fg8yk0mzps1Vw== dependencies: figgy-pudding "^3.5.1" npm-package-arg "^6.0.0" @@ -7138,70 +7818,91 @@ npm-pick-manifest@^2.2.3: npm-run-path@^2.0.0: version "2.0.2" resolved "https://registry.yarnpkg.com/npm-run-path/-/npm-run-path-2.0.2.tgz#35a9232dfa35d7067b4cb2ddf2357b1871536c5f" + integrity sha1-NakjLfo11wZ7TLLd8jV7GHFTbF8= dependencies: path-key "^2.0.0" -npm-which@^3.0.1: - version "3.0.1" - resolved "https://registry.yarnpkg.com/npm-which/-/npm-which-3.0.1.tgz#9225f26ec3a285c209cae67c3b11a6b4ab7140aa" +npm-run-path@^3.0.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/npm-run-path/-/npm-run-path-3.1.0.tgz#7f91be317f6a466efed3c9f2980ad8a4ee8b0fa5" + integrity sha512-Dbl4A/VfiVGLgQv29URL9xshU8XDY1GeLy+fsaZ1AA8JDSfjvr5P5+pzRbWqRSBxk6/DW7MIh8lTM/PaGnP2kg== dependencies: - commander "^2.9.0" - npm-path "^2.0.2" - which "^1.2.10" + path-key "^3.0.0" "npmlog@0 || 1 || 2 || 3 || 4", npmlog@^4.0.2, npmlog@^4.1.2: version "4.1.2" resolved "https://registry.yarnpkg.com/npmlog/-/npmlog-4.1.2.tgz#08a7f2a8bf734604779a9efa4ad5cc717abb954b" + integrity sha512-2uUqazuKlTaSI/dC8AzicUck7+IrEaOnN/e0jd3Xtt1KcGpwx30v50mL7oPyr/h9bL3E4aZccVwpwP+5W9Vjkg== dependencies: are-we-there-yet "~1.1.2" console-control-strings "~1.1.0" gauge "~2.7.3" set-blocking "~2.0.0" -nth-check@~1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/nth-check/-/nth-check-1.0.1.tgz#9929acdf628fc2c41098deab82ac580cf149aae4" - dependencies: - boolbase "~1.0.0" - number-is-nan@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/number-is-nan/-/number-is-nan-1.0.1.tgz#097b602b53422a522c1afb8790318336941a011d" + integrity sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0= -nwmatcher@^1.4.3: - version "1.4.3" - resolved "https://registry.yarnpkg.com/nwmatcher/-/nwmatcher-1.4.3.tgz#64348e3b3d80f035b40ac11563d278f8b72db89c" +nwsapi@^2.0.7: + 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.9.0: version "0.9.0" resolved "https://registry.yarnpkg.com/oauth-sign/-/oauth-sign-0.9.0.tgz#47a7b016baa68b5fa0ecf3dee08a85c679ac6455" + integrity sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ== -object-assign@^4.0.1, object-assign@^4.1.0: +object-assign@^4.0.1, object-assign@^4.1.0, object-assign@^4.1.1: version "4.1.1" resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863" + integrity sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM= object-copy@^0.1.0: version "0.1.0" resolved "https://registry.yarnpkg.com/object-copy/-/object-copy-0.1.0.tgz#7e7d858b781bd7c991a41ba975ed3812754e998c" + integrity sha1-fn2Fi3gb18mRpBupde04EnVOmYw= dependencies: copy-descriptor "^0.1.0" define-property "^0.2.5" kind-of "^3.0.3" -object-keys@^1.0.11, object-keys@^1.0.12, object-keys@^1.0.6, object-keys@^1.0.8: +object-inspect@^1.7.0: + version "1.7.0" + resolved "https://registry.yarnpkg.com/object-inspect/-/object-inspect-1.7.0.tgz#f4f6bd181ad77f006b5ece60bd0b6f398ff74a67" + integrity sha512-a7pEHdh1xKIAgTySUGgLMx/xwDZskN1Ud6egYYN3EdRW4ZMPNEDUTF+hwy2LUC+Bl+SyLXANnwz/jyh/qutKUw== + +object-keys@^1.0.11, object-keys@^1.0.12, object-keys@^1.0.6, object-keys@^1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/object-keys/-/object-keys-1.1.1.tgz#1c47f272df277f3b1daf061677d9c82e2322c60e" integrity sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA== +object-keys@~0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/object-keys/-/object-keys-0.2.0.tgz#cddec02998b091be42bf1035ae32e49f1cb6ea67" + integrity sha1-zd7AKZiwkb5CvxA1rjLknxy26mc= + dependencies: + foreach "~2.0.1" + indexof "~0.0.1" + is "~0.2.6" + +object-keys@~0.4.0: + version "0.4.0" + resolved "https://registry.yarnpkg.com/object-keys/-/object-keys-0.4.0.tgz#28a6aae7428dd2c3a92f3d95f21335dd204e0336" + integrity sha1-KKaq50KN0sOpLz2V8hM13SBOAzY= + object-visit@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/object-visit/-/object-visit-1.0.1.tgz#f79c4493af0c5377b59fe39d395e41042dd045bb" + integrity sha1-95xEk68MU3e1n+OdOV5BBC3QRbs= dependencies: isobject "^3.0.0" -object.assign@^4.0.4: +object.assign@^4.0.4, object.assign@^4.1.0: version "4.1.0" resolved "https://registry.yarnpkg.com/object.assign/-/object.assign-4.1.0.tgz#968bf1100d7956bb3ca086f006f846b3bc4008da" + integrity sha512-exHJeq6kBKj58mqGyTQ9DFvrZC/eR6OwxzoM9YRoGBqrXYonaFyGiFMuc9VZrXf7DarreEwMpurG3dd+CNyW5w== dependencies: define-properties "^1.1.2" function-bind "^1.1.1" @@ -7211,6 +7912,7 @@ object.assign@^4.0.4: object.defaults@^1.0.0, object.defaults@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/object.defaults/-/object.defaults-1.1.0.tgz#3a7f868334b407dea06da16d88d5cd29e435fecf" + integrity sha1-On+GgzS0B96gbaFtiNXNKeQ1/s8= dependencies: array-each "^1.0.1" array-slice "^1.0.0" @@ -7220,6 +7922,7 @@ object.defaults@^1.0.0, object.defaults@^1.1.0: object.getownpropertydescriptors@^2.0.3: version "2.0.3" resolved "https://registry.yarnpkg.com/object.getownpropertydescriptors/-/object.getownpropertydescriptors-2.0.3.tgz#8758c846f5b407adab0f236e0986f14b051caa16" + integrity sha1-h1jIRvW0B62rDyNuCYbxSwUcqhY= dependencies: define-properties "^1.1.2" es-abstract "^1.5.1" @@ -7227,6 +7930,7 @@ object.getownpropertydescriptors@^2.0.3: object.map@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/object.map/-/object.map-1.0.1.tgz#cf83e59dc8fcc0ad5f4250e1f78b3b81bd801d37" + integrity sha1-z4Plncj8wK1fQlDh94s7gb2AHTc= dependencies: for-own "^1.0.0" make-iterator "^1.0.0" @@ -7234,6 +7938,7 @@ object.map@^1.0.0: 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" @@ -7241,16 +7946,33 @@ object.omit@^2.0.0: object.pick@^1.2.0, object.pick@^1.3.0: version "1.3.0" resolved "https://registry.yarnpkg.com/object.pick/-/object.pick-1.3.0.tgz#87a10ac4c1694bd2e1cbf53591a66141fb5dd747" + integrity sha1-h6EKxMFpS9Lhy/U1kaZhQftd10c= dependencies: isobject "^3.0.1" object.reduce@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/object.reduce/-/object.reduce-1.0.1.tgz#6fe348f2ac7fa0f95ca621226599096825bb03ad" + integrity sha1-b+NI8qx/oPlcpiEiZZkJaCW7A60= dependencies: for-own "^1.0.0" make-iterator "^1.0.0" +object.values@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/object.values/-/object.values-1.1.0.tgz#bf6810ef5da3e5325790eaaa2be213ea84624da9" + integrity sha512-8mf0nKLAoFX6VlNVdhGj31SVYpaNFtUnuoOXWyFEstsWRgU837AK+JYM0iAxwkSzGRbwn8cbFmgbyxj1j4VbXg== + dependencies: + define-properties "^1.1.3" + es-abstract "^1.12.0" + function-bind "^1.1.1" + has "^1.0.3" + +octal@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/octal/-/octal-1.0.0.tgz#63e7162a68efbeb9e213588d58e989d1e5c4530b" + integrity sha1-Y+cWKmjvvrniE1iNWOmJ0eXEUws= + octokit-pagination-methods@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/octokit-pagination-methods/-/octokit-pagination-methods-1.1.0.tgz#cf472edc9d551055f9ef73f6e42b4dbb4c80bea4" @@ -7259,70 +7981,74 @@ octokit-pagination-methods@^1.1.0: once@^1.3.0, once@^1.3.1, once@^1.3.2, once@^1.4.0: version "1.4.0" resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1" + integrity sha1-WDsap3WWHUsROsF9nFC6753Xa9E= dependencies: wrappy "1" onetime@^2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/onetime/-/onetime-2.0.1.tgz#067428230fd67443b2794b22bba528b6867962d4" + integrity sha1-BnQoIw/WdEOyeUsiu6UotoZ5YtQ= dependencies: mimic-fn "^1.0.0" +onetime@^5.1.0: + version "5.1.0" + resolved "https://registry.yarnpkg.com/onetime/-/onetime-5.1.0.tgz#fff0f3c91617fe62bb50189636e99ac8a6df7be5" + integrity sha512-5NcSkPHhwTVFIQN+TUqXoS5+dlElHXdpAWu9I0HP20YOtIi+aZ0Ct82jdlILDxjLEAWwvm+qj1m6aEtsDVmm6Q== + dependencies: + mimic-fn "^2.1.0" + +opencollective-postinstall@^2.0.2: + version "2.0.2" + resolved "https://registry.yarnpkg.com/opencollective-postinstall/-/opencollective-postinstall-2.0.2.tgz#5657f1bede69b6e33a45939b061eb53d3c6c3a89" + integrity sha512-pVOEP16TrAO2/fjej1IdOyupJY8KDUM1CvsaScRbw6oddvpQoOfGk4ywha0HKKVAD6RkW4x6Q+tNBwhf3Bgpuw== + optimist@^0.6.1: version "0.6.1" resolved "https://registry.yarnpkg.com/optimist/-/optimist-0.6.1.tgz#da3ea74686fa21a19a111c326e90eb15a0196686" + integrity sha1-2j6nRob6IaGaERwybpDrFaAZZoY= dependencies: minimist "~0.0.1" wordwrap "~0.0.2" -optionator@^0.8.1, optionator@^0.8.2: - version "0.8.2" - resolved "https://registry.yarnpkg.com/optionator/-/optionator-0.8.2.tgz#364c5e409d3f4d6301d6c0b4c05bba50180aeb64" +optionator@^0.8.1, optionator@^0.8.3: + version "0.8.3" + resolved "https://registry.yarnpkg.com/optionator/-/optionator-0.8.3.tgz#84fa1d036fe9d3c7e21d99884b601167ec8fb495" + integrity sha512-+IW9pACdk3XWmmTXG8m3upGUJst5XRGzxMRjXzAuJ1XnIFNvfhjjIuYkDvysnPQ7qzqVzLt78BCruntqRhWQbA== dependencies: deep-is "~0.1.3" - fast-levenshtein "~2.0.4" + fast-levenshtein "~2.0.6" levn "~0.3.0" prelude-ls "~1.1.2" type-check "~0.3.2" - wordwrap "~1.0.0" + word-wrap "~1.2.3" ordered-read-streams@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/ordered-read-streams/-/ordered-read-streams-1.0.1.tgz#77c0cb37c41525d64166d990ffad7ec6a0e1363e" + integrity sha1-d8DLN8QVJdZBZtmQ/61+xqDhNj4= dependencies: readable-stream "^2.0.1" -os-browserify@^0.3.0, os-browserify@~0.3.0: +os-browserify@~0.3.0: version "0.3.0" resolved "https://registry.yarnpkg.com/os-browserify/-/os-browserify-0.3.0.tgz#854373c7f5c2315914fc9bfc6bd8238fdda1ec27" + integrity sha1-hUNzx/XCMVkU/Jv8a9gjj92h7Cc= os-homedir@^1.0.0: version "1.0.2" resolved "https://registry.yarnpkg.com/os-homedir/-/os-homedir-1.0.2.tgz#ffbc4988336e0e833de0c168c7ef152121aa7fb3" + integrity sha1-/7xJiDNuDoM94MFox+8VISGqf7M= os-locale@^1.4.0: version "1.4.0" resolved "https://registry.yarnpkg.com/os-locale/-/os-locale-1.4.0.tgz#20f9f17ae29ed345e8bde583b13d2009803c14d9" + integrity sha1-IPnxeuKe00XoveWDsT0gCYA8FNk= dependencies: lcid "^1.0.0" -os-locale@^2.0.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/os-locale/-/os-locale-2.1.0.tgz#42bc2900a6b5b8bd17376c8e882b65afccf24bf2" - dependencies: - execa "^0.7.0" - lcid "^1.0.0" - mem "^1.1.0" - -os-locale@^3.0.0: - version "3.0.1" - resolved "https://registry.yarnpkg.com/os-locale/-/os-locale-3.0.1.tgz#3b014fbf01d87f60a1e5348d80fe870dc82c4620" - dependencies: - execa "^0.10.0" - lcid "^2.0.0" - mem "^4.0.0" - -os-name@^3.0.0: +os-name@^3.1.0: version "3.1.0" resolved "https://registry.yarnpkg.com/os-name/-/os-name-3.1.0.tgz#dec19d966296e1cd62d701a5a66ee1ddeae70801" integrity sha512-h8L+8aNjNcMpo/mAIBPn5PXCM16iyPGjHNWo6U1YO8sJTMHtEtyczI6QJnLoplswm6goopQkqc7OAnjhWcugVg== @@ -7333,10 +8059,12 @@ os-name@^3.0.0: os-tmpdir@^1.0.0, os-tmpdir@~1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/os-tmpdir/-/os-tmpdir-1.0.2.tgz#bbe67406c79aa85c5cfec766fe5734555dfa1274" + integrity sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ= -osenv@0, osenv@^0.1.4, osenv@^0.1.5: +osenv@^0.1.4, osenv@^0.1.5: version "0.1.5" resolved "https://registry.yarnpkg.com/osenv/-/osenv-0.1.5.tgz#85cdfafaeb28e8677f416e287592b5f3f49ea410" + integrity sha512-0CWcCECdMVc2Rw3U5w9ZjqX6ga6ubk1xDVKxtBQPK7wis/0F2r9T6k4ydGYhecl7YUBxBVxhL5oisPsNxAPe2g== dependencies: os-homedir "^1.0.0" os-tmpdir "^1.0.0" @@ -7344,70 +8072,92 @@ osenv@0, osenv@^0.1.4, osenv@^0.1.5: output-file-sync@^2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/output-file-sync/-/output-file-sync-2.0.1.tgz#f53118282f5f553c2799541792b723a4c71430c0" + integrity sha512-mDho4qm7WgIXIGf4eYU1RHN2UU5tPfVYVSRwDJw0uTmj35DQUt/eNp19N7v6T3SrR0ESTEf2up2CGO73qI35zQ== dependencies: graceful-fs "^4.1.11" is-plain-obj "^1.1.0" mkdirp "^0.5.1" -p-defer@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/p-defer/-/p-defer-1.0.0.tgz#9f6eb182f6c9aa8cd743004a7d4f96b196b0fb0c" - p-each-series@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/p-each-series/-/p-each-series-1.0.0.tgz#930f3d12dd1f50e7434457a22cd6f04ac6ad7f71" + integrity sha1-kw89Et0fUOdDRFeiLNbwSsatf3E= dependencies: p-reduce "^1.0.0" p-finally@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/p-finally/-/p-finally-1.0.0.tgz#3fbcfb15b899a44123b34b6dcc18b724336a2cae" + integrity sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4= -p-is-promise@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/p-is-promise/-/p-is-promise-1.1.0.tgz#9c9456989e9f6588017b0434d56097675c3da05e" +p-finally@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/p-finally/-/p-finally-2.0.1.tgz#bd6fcaa9c559a096b680806f4d657b3f0f240561" + integrity sha512-vpm09aKwq6H9phqRQzecoDpD8TmVyGw70qmWlyq5onxY7tqyTTFVvxMykxQSQKILBSFlbXpypIw2T1Ml7+DDtw== p-limit@^1.1.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-1.2.0.tgz#0e92b6bedcb59f022c13d0f1949dc82d15909f1c" + version "1.3.0" + resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-1.3.0.tgz#b86bd5f0c25690911c7590fcbfc2010d54b3ccb8" + integrity sha512-vvcXsLAJ9Dr5rQOPk7toZQZJApBl2K4J6dANSsEuh6QI41JYcsS/qhTGa9ErIUUgK3WNQoJYvylxvjqmiqEA9Q== dependencies: p-try "^1.0.0" -p-limit@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-2.0.0.tgz#e624ed54ee8c460a778b3c9f3670496ff8a57aec" +p-limit@^2.0.0, p-limit@^2.2.0: + version "2.2.1" + resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-2.2.1.tgz#aa07a788cc3151c939b5131f63570f0dd2009537" + integrity sha512-85Tk+90UCVWvbDavCLKPOLC9vvY8OwEX/RtKF+/1OADJMVlFfEHOiMTPVyxg7mk/dKa+ipdHm0OUkTvCpMTuwg== dependencies: p-try "^2.0.0" p-locate@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/p-locate/-/p-locate-2.0.0.tgz#20a0103b222a70c8fd39cc2e580680f3dde5ec43" + integrity sha1-IKAQOyIqcMj9OcwuWAaA893l7EM= dependencies: p-limit "^1.1.0" p-locate@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/p-locate/-/p-locate-3.0.0.tgz#322d69a05c0264b25997d9f40cd8a891ab0064a4" + integrity sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ== dependencies: p-limit "^2.0.0" +p-locate@^4.1.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/p-locate/-/p-locate-4.1.0.tgz#a3428bb7088b3a60292f66919278b7c297ad4f07" + integrity sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A== + dependencies: + p-limit "^2.2.0" + p-map-series@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/p-map-series/-/p-map-series-1.0.0.tgz#bf98fe575705658a9e1351befb85ae4c1f07bdca" + integrity sha1-v5j+V1cFZYqeE1G++4WuTB8Hvco= dependencies: p-reduce "^1.0.0" -p-map@^1.1.1, p-map@^1.2.0: +p-map@^1.1.1: version "1.2.0" resolved "https://registry.yarnpkg.com/p-map/-/p-map-1.2.0.tgz#e4e94f311eabbc8633a1e79908165fca26241b6b" + integrity sha512-r6zKACMNhjPJMTl8KcFH4li//gkrXWfbD6feV8l6doRHlzljFWGJ2AP6iKaCJXyZmAUMOPtvbW7EXkbWO/pLEA== -p-map@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/p-map/-/p-map-2.0.0.tgz#be18c5a5adeb8e156460651421aceca56c213a50" +p-map@^2.0.0, p-map@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/p-map/-/p-map-2.1.0.tgz#310928feef9c9ecc65b68b17693018a665cea175" + integrity sha512-y3b8Kpd8OAN444hxfBbFfj1FY/RjtTd8tzYwhUqNYXx0fXx2iX4maP4Qr6qhIKbQXI02wTLAda4fYUbDagTUFw== + +p-map@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/p-map/-/p-map-3.0.0.tgz#d704d9af8a2ba684e2600d9a215983d4141a979d" + integrity sha512-d3qXVTF/s+W+CdJ5A29wywV2n8CQQYahlgz2bFiA+4eVNJbHJodPZ+/gXwPGh0bOqA+j8S+6+ckmvLGPk1QpxQ== + dependencies: + aggregate-error "^3.0.0" p-pipe@^1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/p-pipe/-/p-pipe-1.2.0.tgz#4b1a11399a11520a67790ee5a0c1d5881d6befe9" + integrity sha1-SxoROZoRUgpneQ7loMHViB1r7+k= p-queue@^4.0.0: version "4.0.0" @@ -7419,64 +8169,69 @@ p-queue@^4.0.0: p-reduce@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/p-reduce/-/p-reduce-1.0.0.tgz#18c2b0dd936a4690a529f8231f58a0fdb6a47dfa" + integrity sha1-GMKw3ZNqRpClKfgjH1ig/bakffo= p-try@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/p-try/-/p-try-1.0.0.tgz#cbc79cdbaf8fd4228e13f621f2b1a237c1b207b3" + integrity sha1-y8ec26+P1CKOE/Yh8rGiN8GyB7M= p-try@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/p-try/-/p-try-2.0.0.tgz#85080bb87c64688fa47996fe8f7dfbe8211760b1" + version "2.2.0" + resolved "https://registry.yarnpkg.com/p-try/-/p-try-2.2.0.tgz#cb2868540e313d61de58fafbe35ce9004d5540e6" + integrity sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ== p-waterfall@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/p-waterfall/-/p-waterfall-1.0.0.tgz#7ed94b3ceb3332782353af6aae11aa9fc235bb00" + integrity sha1-ftlLPOszMngjU69qrhGqn8I1uwA= dependencies: p-reduce "^1.0.0" pako@~1.0.5: - version "1.0.6" - resolved "https://registry.yarnpkg.com/pako/-/pako-1.0.6.tgz#0101211baa70c4bca4a0f63f2206e97b7dfaf258" + version "1.0.10" + resolved "https://registry.yarnpkg.com/pako/-/pako-1.0.10.tgz#4328badb5086a426aa90f541977d4955da5c9732" + integrity sha512-0DTvPVU3ed8+HNXOu5Bs+o//Mbdj9VNQMUOe9oKCwh8l0GNwpTDMKCWbRjgtD291AWnkAgkqA/LOnQS8AmS1tw== parallel-transform@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/parallel-transform/-/parallel-transform-1.1.0.tgz#d410f065b05da23081fcd10f28854c29bda33b06" + version "1.2.0" + resolved "https://registry.yarnpkg.com/parallel-transform/-/parallel-transform-1.2.0.tgz#9049ca37d6cb2182c3b1d2c720be94d14a5814fc" + integrity sha512-P2vSmIu38uIlvdcU7fDkyrxj33gTUy/ABO5ZUbGowxNCopBq/OoD42bP4UmMrJoPyk4Uqf0mu3mtWBhHCZD8yg== dependencies: - cyclist "~0.2.2" + cyclist "^1.0.1" inherits "^2.0.3" readable-stream "^2.1.5" -param-case@2.1.x: - version "2.1.1" - resolved "https://registry.yarnpkg.com/param-case/-/param-case-2.1.1.tgz#df94fd8cf6531ecf75e6bef9a0858fbc72be2247" - dependencies: - no-case "^2.2.0" - parent-module@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/parent-module/-/parent-module-1.0.0.tgz#df250bdc5391f4a085fb589dad761f5ad6b865b5" + version "1.0.1" + resolved "https://registry.yarnpkg.com/parent-module/-/parent-module-1.0.1.tgz#691d2709e78c79fae3a156622452d00762caaaa2" + integrity sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g== dependencies: callsites "^3.0.0" parents@^1.0.0, parents@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/parents/-/parents-1.0.1.tgz#fedd4d2bf193a77745fe71e371d73c3307d9c751" + integrity sha1-/t1NK/GTp3dF/nHjcdc8MwfZx1E= dependencies: path-platform "~0.11.15" parse-asn1@^5.0.0: - version "5.1.0" - resolved "https://registry.yarnpkg.com/parse-asn1/-/parse-asn1-5.1.0.tgz#37c4f9b7ed3ab65c74817b5f2480937fbf97c712" + version "5.1.5" + resolved "https://registry.yarnpkg.com/parse-asn1/-/parse-asn1-5.1.5.tgz#003271343da58dc94cace494faef3d2147ecea0e" + integrity sha512-jkMYn1dcJqF6d5CpU689bq7w/b5ALS9ROVSpQDPrZsqqesUJii9qutvoT5ltGedNXMO2e16YUWIghG9KxaViTQ== dependencies: asn1.js "^4.0.0" browserify-aes "^1.0.0" create-hash "^1.1.0" evp_bytestokey "^1.0.0" pbkdf2 "^3.0.3" + safe-buffer "^5.1.1" parse-filepath@^1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/parse-filepath/-/parse-filepath-1.0.2.tgz#a632127f53aaf3d15876f5872f3ffac763d6c891" + integrity sha1-pjISf1Oq89FYdvWHLz/6x2PWyJE= dependencies: is-absolute "^1.0.0" map-cache "^0.2.0" @@ -7485,10 +8240,12 @@ parse-filepath@^1.0.1: parse-github-repo-url@^1.3.0: version "1.4.1" resolved "https://registry.yarnpkg.com/parse-github-repo-url/-/parse-github-repo-url-1.4.1.tgz#9e7d8bb252a6cb6ba42595060b7bf6df3dbc1f50" + integrity sha1-nn2LslKmy2ukJZUGC3v23z28H1A= 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" @@ -7498,23 +8255,37 @@ parse-glob@^3.0.4: parse-json@^2.2.0: version "2.2.0" resolved "https://registry.yarnpkg.com/parse-json/-/parse-json-2.2.0.tgz#f480f40434ef80741f8469099f8dea18f55a4dc9" + integrity sha1-9ID0BDTvgHQfhGkJn43qGPVaTck= dependencies: error-ex "^1.2.0" parse-json@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/parse-json/-/parse-json-4.0.0.tgz#be35f5425be1f7f6c747184f98a788cb99477ee0" + integrity sha1-vjX1Qlvh9/bHRxhPmKeIy5lHfuA= dependencies: error-ex "^1.3.1" json-parse-better-errors "^1.0.1" +parse-json@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/parse-json/-/parse-json-5.0.0.tgz#73e5114c986d143efa3712d4ea24db9a4266f60f" + integrity sha512-OOY5b7PAEFV0E2Fir1KOkxchnZNCdowAJgQ5NuxjpBKTRP3pQhwkrkxqQjeoKJ+fO7bCpmIZaogI4eZGDMEGOw== + dependencies: + "@babel/code-frame" "^7.0.0" + error-ex "^1.3.1" + json-parse-better-errors "^1.0.1" + lines-and-columns "^1.1.6" + parse-node-version@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/parse-node-version/-/parse-node-version-1.0.1.tgz#e2b5dbede00e7fa9bc363607f53327e8b073189b" + integrity sha512-3YHlOa/JgH6Mnpr05jP9eDG254US9ek25LyIxZlDItp2iJtwyaXQb57lBYLdT3MowkUFYEV2XXNAYIPlESvJlA== parse-passwd@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/parse-passwd/-/parse-passwd-1.0.0.tgz#6d5b934a456993b23d37f40a382d6f1666a8e5c6" + integrity sha1-bVuTSkVpk7I9N/QKOC1vFmao5cY= parse-path@^4.0.0: version "4.0.1" @@ -7537,68 +8308,81 @@ parse-url@^5.0.0: parse5@4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/parse5/-/parse5-4.0.0.tgz#6d78656e3da8d78b4ec0b906f7c08ef1dfe3f608" - -parse5@^3.0.1: - version "3.0.3" - resolved "https://registry.yarnpkg.com/parse5/-/parse5-3.0.3.tgz#042f792ffdd36851551cf4e9e066b3874ab45b5c" - dependencies: - "@types/node" "*" + integrity sha512-VrZ7eOd3T1Fk4XWNXMgiGBK/z0MG48BWG2uQNU4I72fkQuKUTZpl+u9k+CxEG0twMVzSmXEEz12z5Fnw1jIQFA== pascalcase@^0.1.1: version "0.1.1" resolved "https://registry.yarnpkg.com/pascalcase/-/pascalcase-0.1.1.tgz#b363e55e8006ca6fe21784d2db22bd15d7917f14" + integrity sha1-s2PlXoAGym/iF4TS2yK9FdeRfxQ= -path-browserify@0.0.0, path-browserify@~0.0.0: - version "0.0.0" - resolved "https://registry.yarnpkg.com/path-browserify/-/path-browserify-0.0.0.tgz#a0b870729aae214005b7d5032ec2cbbb0fb4451a" +path-browserify@~0.0.0: + version "0.0.1" + resolved "https://registry.yarnpkg.com/path-browserify/-/path-browserify-0.0.1.tgz#e6c4ddd7ed3aa27c68a20cc4e50e1a4ee83bbc4a" + integrity sha512-BapA40NHICOS+USX9SN4tyhq+A2RrN/Ws5F0Z5aMHDp98Fl86lX8Oti8B7uN93L4Ifv4fHOEA+pQw87gmMO/lQ== path-dirname@^1.0.0: version "1.0.2" resolved "https://registry.yarnpkg.com/path-dirname/-/path-dirname-1.0.2.tgz#cc33d24d525e099a5388c0336c6e32b9160609e0" + integrity sha1-zDPSTVJeCZpTiMAzbG4yuRYGCeA= path-exists@^2.0.0: version "2.1.0" resolved "https://registry.yarnpkg.com/path-exists/-/path-exists-2.1.0.tgz#0feb6c64f0fc518d9a754dd5efb62c7022761f4b" + integrity sha1-D+tsZPD8UY2adU3V77YscCJ2H0s= dependencies: pinkie-promise "^2.0.0" path-exists@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/path-exists/-/path-exists-3.0.0.tgz#ce0ebeaa5f78cb18925ea7d810d7b59b010fd515" + integrity sha1-zg6+ql94yxiSXqfYENe1mwEP1RU= + +path-exists@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/path-exists/-/path-exists-4.0.0.tgz#513bdbe2d3b95d7762e8c1137efa195c6c61b5b3" + integrity sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w== path-is-absolute@^1.0.0, path-is-absolute@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f" - -path-is-inside@^1.0.1, path-is-inside@^1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/path-is-inside/-/path-is-inside-1.0.2.tgz#365417dede44430d1c11af61027facf074bdfc53" + integrity sha1-F0uSaHNVNP+8es5r9TpanhtcX18= path-key@^2.0.0, path-key@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/path-key/-/path-key-2.0.1.tgz#411cadb574c5a140d3a4b1910d40d80cc9f40b40" + integrity sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A= + +path-key@^3.0.0, path-key@^3.1.0: + version "3.1.1" + resolved "https://registry.yarnpkg.com/path-key/-/path-key-3.1.1.tgz#581f6ade658cbba65a0d3380de7753295054f375" + integrity sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q== path-parse@^1.0.6: version "1.0.6" resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.6.tgz#d62dbb5679405d72c4737ec58600e9ddcf06d24c" + integrity sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw== path-platform@~0.11.15: version "0.11.15" resolved "https://registry.yarnpkg.com/path-platform/-/path-platform-0.11.15.tgz#e864217f74c36850f0852b78dc7bf7d4a5721bf2" + integrity sha1-6GQhf3TDaFDwhSt43Hv31KVyG/I= path-root-regex@^0.1.0: version "0.1.2" resolved "https://registry.yarnpkg.com/path-root-regex/-/path-root-regex-0.1.2.tgz#bfccdc8df5b12dc52c8b43ec38d18d72c04ba96d" + integrity sha1-v8zcjfWxLcUsi0PsONGNcsBLqW0= path-root@^0.1.1: version "0.1.1" resolved "https://registry.yarnpkg.com/path-root/-/path-root-0.1.1.tgz#9a4a6814cac1c0cd73360a95f32083c8ea4745b7" + integrity sha1-mkpoFMrBwM1zNgqV8yCDyOpHRbc= dependencies: path-root-regex "^0.1.0" path-type@^1.0.0: version "1.1.0" resolved "https://registry.yarnpkg.com/path-type/-/path-type-1.1.0.tgz#59c44f7ee491da704da415da5a4070ba4f8fe441" + integrity sha1-WcRPfuSR2nBNpBXaWkBwuk+P5EE= dependencies: graceful-fs "^4.1.2" pify "^2.0.0" @@ -7607,18 +8391,26 @@ path-type@^1.0.0: path-type@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/path-type/-/path-type-2.0.0.tgz#f012ccb8415b7096fc2daa1054c3d72389594c73" + integrity sha1-8BLMuEFbcJb8LaoQVMPXI4lZTHM= dependencies: pify "^2.0.0" path-type@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/path-type/-/path-type-3.0.0.tgz#cef31dc8e0a1a3bb0d105c0cd97cf3bf47f4e36f" + integrity sha512-T2ZUsdZFHgA3u4e5PfPbjd7HDDpxPnQb5jN0SrDsjNSuVXHJqtwTnWqG0B1jZrgmJ/7lj1EmVIByWt1gxGkWvg== dependencies: pify "^3.0.0" +path-type@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/path-type/-/path-type-4.0.0.tgz#84ed01c0a7ba380afe09d90a8c180dcd9d03043b" + integrity sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw== + pbkdf2@^3.0.3: - version "3.0.14" - resolved "https://registry.yarnpkg.com/pbkdf2/-/pbkdf2-3.0.14.tgz#a35e13c64799b06ce15320f459c230e68e73bade" + version "3.0.17" + resolved "https://registry.yarnpkg.com/pbkdf2/-/pbkdf2-3.0.17.tgz#976c206530617b14ebb32114239f7b09336e93a6" + integrity sha512-U/il5MsrZp7mGg3mSQfn742na2T+1/vHDCG5/iTI3X9MKUuYUZVLQhyRsg06mCgDBTd57TxzgZt7P+fYfjRLtA== dependencies: create-hash "^1.1.2" create-hmac "^1.1.4" @@ -7629,14 +8421,22 @@ pbkdf2@^3.0.3: performance-now@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/performance-now/-/performance-now-2.1.0.tgz#6309f4e0e5fa913ec1c69307ae364b4b377c9e7b" + integrity sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns= + +picomatch@^2.0.5: + version "2.1.1" + resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.1.1.tgz#ecdfbea7704adb5fe6fb47f9866c4c0e15e905c5" + integrity sha512-OYMyqkKzK7blWO/+XZYP6w8hH0LDvkBvdvKukti+7kqYFCiEAk+gI3DWnryapc0Dau05ugGTy0foQ6mqn4AHYA== pify@^2.0.0, pify@^2.3.0: version "2.3.0" resolved "https://registry.yarnpkg.com/pify/-/pify-2.3.0.tgz#ed141a6ac043a849ea588498e7dca8b15330e90c" + integrity sha1-7RQaasBDqEnqWISY59yosVMw6Qw= pify@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/pify/-/pify-3.0.0.tgz#e5a4acd2c101fdf3d9a4d07f0dbc4db49dd28176" + integrity sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY= pify@^4.0.1: version "4.0.1" @@ -7646,12 +8446,14 @@ pify@^4.0.1: pinkie-promise@^2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/pinkie-promise/-/pinkie-promise-2.0.1.tgz#2135d6dfa7a358c069ac9b178776288228450ffa" + integrity sha1-ITXW36ejWMBprJsXh3YogihFD/o= dependencies: pinkie "^2.0.0" pinkie@^2.0.0: version "2.0.4" resolved "https://registry.yarnpkg.com/pinkie/-/pinkie-2.0.4.tgz#72556b80cfa0d48a974e80e77248e80ed4f7f870" + integrity sha1-clVrgM+g1IqXToDnckjoDtT3+HA= pirates@^4.0.0, pirates@^4.0.1: version "4.0.1" @@ -7663,31 +8465,35 @@ pirates@^4.0.0, pirates@^4.0.1: pkg-dir@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/pkg-dir/-/pkg-dir-2.0.0.tgz#f6d5d1109e19d63edf428e0bd57e12777615334b" + integrity sha1-9tXREJ4Z1j7fQo4L1X4Sd3YVM0s= dependencies: find-up "^2.1.0" pkg-dir@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/pkg-dir/-/pkg-dir-3.0.0.tgz#2749020f239ed990881b1f71210d51eb6523bea3" + integrity sha512-/E57AYkoeQ25qkxMj5PBOVgF8Kiu/h7cYS30Z5+R7WaiCCBfLq58ZI/dSeaEKb9WVJV5n/03QwrN3IeWIFllvw== dependencies: find-up "^3.0.0" -pkg-dir@^4.1.0: - version "4.1.0" - resolved "https://registry.yarnpkg.com/pkg-dir/-/pkg-dir-4.1.0.tgz#aaeb91c0d3b9c4f74a44ad849f4de34781ae01de" - integrity sha512-55k9QN4saZ8q518lE6EFgYiu95u3BWkSajCifhdQjvLvmr8IpnRbhI+UGpWJQfa0KzDguHeeWT1ccO1PmkOi3A== +pkg-dir@^4.2.0: + version "4.2.0" + resolved "https://registry.yarnpkg.com/pkg-dir/-/pkg-dir-4.2.0.tgz#f099133df7ede422e81d1d8448270eeb3e4261f3" + integrity sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ== dependencies: - find-up "^3.0.0" + find-up "^4.0.0" -please-upgrade-node@^3.0.2, please-upgrade-node@^3.1.1: - version "3.1.1" - resolved "https://registry.yarnpkg.com/please-upgrade-node/-/please-upgrade-node-3.1.1.tgz#ed320051dfcc5024fae696712c8288993595e8ac" +please-upgrade-node@^3.1.1, please-upgrade-node@^3.2.0: + version "3.2.0" + resolved "https://registry.yarnpkg.com/please-upgrade-node/-/please-upgrade-node-3.2.0.tgz#aeddd3f994c933e4ad98b99d9a556efa0e2fe942" + integrity sha512-gQR3WpIgNIKwBMVLkpMUeR3e1/E1y42bqDQZfql+kDeXd8COYfM8PQA4X6y7a8u9Ua9FHmsrrmirW2vHs45hWg== dependencies: semver-compare "^1.0.0" plugin-error@1.0.1, plugin-error@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/plugin-error/-/plugin-error-1.0.1.tgz#77016bd8919d0ac377fdcdd0322328953ca5781c" + integrity sha512-L1zP0dk7vGweZME2i+EeakvUNqSrdiI3F91TwEoYiGrAfUXmVv6fJIq4g82PAXxNsWOp0J7ZqQy/3Szz0ajTxA== dependencies: ansi-colors "^1.0.1" arr-diff "^4.0.0" @@ -7697,6 +8503,7 @@ plugin-error@1.0.1, plugin-error@^1.0.1: plugin-error@^0.1.2: version "0.1.2" resolved "https://registry.yarnpkg.com/plugin-error/-/plugin-error-0.1.2.tgz#3b9bb3335ccf00f425e07437e19276967da47ace" + integrity sha1-O5uzM1zPAPQl4HQ34ZJ2ln2kes4= dependencies: ansi-cyan "^0.1.1" ansi-red "^0.1.1" @@ -7707,36 +8514,41 @@ plugin-error@^0.1.2: pn@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/pn/-/pn-1.1.0.tgz#e2f4cef0e219f463c179ab37463e4e1ecdccbafb" + integrity sha512-2qHaIQr2VLRFoxe2nASzsV6ef4yOOH+Fi9FBOVH6cqeSgUnoyySPZkxzLuzd+RYOQTRpROA0ztTMqxROKSb/nA== posix-character-classes@^0.1.0: version "0.1.1" resolved "https://registry.yarnpkg.com/posix-character-classes/-/posix-character-classes-0.1.1.tgz#01eac0fe3b5af71a2a6c02feabb8c1fef7e00eab" + integrity sha1-AerA/jta9xoqbAL+q7jB/vfgDqs= prelude-ls@~1.1.2: version "1.1.2" resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.1.2.tgz#21932a549f5e52ffd9a827f570e04be62a97da54" + integrity sha1-IZMqVJ9eUv/ZqCf1cOBL5iqX2lQ= preserve@^0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/preserve/-/preserve-0.2.0.tgz#815ed1f6ebc65926f865b310c0713bcb3315ce4b" + integrity sha1-gV7R9uvGWSb4ZbMQwHE7yzMVzks= prettier-linter-helpers@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/prettier-linter-helpers/-/prettier-linter-helpers-1.0.0.tgz#d23d41fe1375646de2d0104d3454a3008802cf7b" + integrity sha512-GbK2cP9nraSSUF9N2XwUwqfzlAFlMNYYl+ShE/V+H8a9uNl/oUqB1w2EL54Jh0OlyRSd8RfWYJ3coVS4TROP2w== dependencies: fast-diff "^1.1.2" -prettier@^1.17.1: - version "1.17.1" - resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.17.1.tgz#ed64b4e93e370cb8a25b9ef7fef3e4fd1c0995db" - integrity sha512-TzGRNvuUSmPgwivDqkZ9tM/qTGW9hqDKWOE9YHiyQdixlKbv7kvEqsmDPrcHJTKwthU774TQwZXVtaQ/mMsvjg== +prettier@^1.19.1: + version "1.19.1" + resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.19.1.tgz#f7d7f5ff8a9cd872a7be4ca142095956a60797cb" + integrity sha512-s7PoyDv/II1ObgQunCbB9PdLmUcBZcnWOcxDh7O0N/UwDEsHyqkW+Qh28jW+mVuCdx7gLB0BotYI1Y6uI9iyew== -pretty-format@^24.8.0: - version "24.8.0" - resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-24.8.0.tgz#8dae7044f58db7cb8be245383b565a963e3c27f2" - integrity sha512-P952T7dkrDEplsR+TuY7q3VXDae5Sr7zmQb12JU/NDQa/3CH7/QW0yvqLcGN6jL+zQFKaoJcPc+yJxMTGmosqw== +pretty-format@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-24.9.0.tgz#12fac31b37019a4eea3c11aa9a959eb7628aa7c9" + integrity sha512-00ZMZUiHaJrNfk33guavqgvfJS30sLYf0f8+Srklv0AMPodGGHcoHgksZ3OThYnIvOd+8yMCn0YiEOogjlgsnA== dependencies: - "@jest/types" "^24.8.0" + "@jest/types" "^24.9.0" ansi-regex "^4.0.0" ansi-styles "^3.2.0" react-is "^16.8.4" @@ -7744,63 +8556,70 @@ pretty-format@^24.8.0: pretty-hrtime@^1.0.0: version "1.0.3" resolved "https://registry.yarnpkg.com/pretty-hrtime/-/pretty-hrtime-1.0.3.tgz#b7e3ea42435a4c9b2759d99e0f201eb195802ee1" + integrity sha1-t+PqQkNaTJsnWdmeDyAesZWALuE= -private@^0.1.6, private@~0.1.5: +private@^0.1.6: version "0.1.8" resolved "https://registry.yarnpkg.com/private/-/private-0.1.8.tgz#2381edb3689f7a53d653190060fcf822d2f368ff" + integrity sha512-VvivMrbvd2nKkiG38qjULzlc+4Vx4wm/whI9pQD35YrARNnhxeiRktSOhSukRLFNlzg6Br/cJPet5J/u19r/mg== -process-nextick-args@^1.0.6, process-nextick-args@^1.0.7, process-nextick-args@~1.0.6: - version "1.0.7" - resolved "https://registry.yarnpkg.com/process-nextick-args/-/process-nextick-args-1.0.7.tgz#150e20b756590ad3f91093f25a4f2ad8bff30ba3" +process-es6@^0.11.2, process-es6@^0.11.6: + version "0.11.6" + resolved "https://registry.yarnpkg.com/process-es6/-/process-es6-0.11.6.tgz#c6bb389f9a951f82bd4eb169600105bd2ff9c778" + integrity sha1-xrs4n5qVH4K9TrFpYAEFvS/5x3g= -process-nextick-args@~2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/process-nextick-args/-/process-nextick-args-2.0.0.tgz#a37d732f4271b4ab1ad070d35508e8290788ffaa" +process-nextick-args@^2.0.0, process-nextick-args@~2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/process-nextick-args/-/process-nextick-args-2.0.1.tgz#7820d9b16120cc55ca9ae7792680ae7dba6d7fe2" + integrity sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag== -process@^0.11.10, process@~0.11.0: +process@~0.11.0: version "0.11.10" resolved "https://registry.yarnpkg.com/process/-/process-0.11.10.tgz#7332300e840161bda3e69a1d1d91a7d4bc16f182" + integrity sha1-czIwDoQBYb2j5podHZGn1LwW8YI= progress@^1.1.8: version "1.1.8" resolved "https://registry.yarnpkg.com/progress/-/progress-1.1.8.tgz#e260c78f6161cdd9b0e56cc3e0a85de17c7a57be" + integrity sha1-4mDHj2Fhzdmw5WzD4Khd4Xx6V74= progress@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/progress/-/progress-2.0.0.tgz#8a1be366bf8fc23db2bd23f10c6fe920b4389d1f" + version "2.0.3" + resolved "https://registry.yarnpkg.com/progress/-/progress-2.0.3.tgz#7e8cf8d8f5b8f239c1bc68beb4eb78567d572ef8" + integrity sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA== promise-inflight@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/promise-inflight/-/promise-inflight-1.0.1.tgz#98472870bf228132fcbdd868129bad12c3c029e3" + integrity sha1-mEcocL8igTL8vdhoEputEsPAKeM= promise-retry@^1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/promise-retry/-/promise-retry-1.1.1.tgz#6739e968e3051da20ce6497fb2b50f6911df3d6d" + integrity sha1-ZznpaOMFHaIM5kl/srUPaRHfPW0= dependencies: err-code "^1.0.0" retry "^0.10.0" prompts@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/prompts/-/prompts-2.0.1.tgz#201b3718b4276fb407f037db48c0029d6465245c" + version "2.3.0" + resolved "https://registry.yarnpkg.com/prompts/-/prompts-2.3.0.tgz#a444e968fa4cc7e86689a74050685ac8006c4cc4" + integrity sha512-NfbbPPg/74fT7wk2XYQ7hAIp9zJyZp5Fu19iRbORqqy1BhtrkZ0fPafBU+7bmn8ie69DpT0R6QpJIN2oisYjJg== dependencies: - kleur "^3.0.0" - sisteransi "^1.0.0" + kleur "^3.0.3" + sisteransi "^1.0.3" promzard@^0.3.0: version "0.3.0" resolved "https://registry.yarnpkg.com/promzard/-/promzard-0.3.0.tgz#26a5d6ee8c7dee4cb12208305acfb93ba382a9ee" + integrity sha1-JqXW7ox97kyxIggwWs+5O6OCqe4= dependencies: read "1" -property-expr@^1.5.0: - version "1.5.1" - resolved "https://registry.yarnpkg.com/property-expr/-/property-expr-1.5.1.tgz#22e8706894a0c8e28d58735804f6ba3a3673314f" - integrity sha512-CGuc0VUTGthpJXL36ydB6jnbyOf/rAHFvmVrJlH+Rg0DqqLFQGAP6hIaxD/G0OAmBJPhXDHuEJigrp0e0wFV6g== - proto-list@~1.2.1: version "1.2.4" resolved "https://registry.yarnpkg.com/proto-list/-/proto-list-1.2.4.tgz#212d5bfe1318306a420f6402b8e26ff39647a849" + integrity sha1-IS1b/hMYMGpCD2QCuOJv85ZHqEk= protocols@^1.1.0, protocols@^1.4.0: version "1.4.7" @@ -7810,34 +8629,41 @@ protocols@^1.1.0, protocols@^1.4.0: protoduck@^5.0.1: version "5.0.1" resolved "https://registry.yarnpkg.com/protoduck/-/protoduck-5.0.1.tgz#03c3659ca18007b69a50fd82a7ebcc516261151f" + integrity sha512-WxoCeDCoCBY55BMvj4cAEjdVUFGRWed9ZxPlqTKYyw1nDDTQ4pqmnIMAGfJlg7Dx35uB/M+PHJPTmGOvaCaPTg== dependencies: genfun "^5.0.0" +prr@~0.0.0: + version "0.0.0" + resolved "https://registry.yarnpkg.com/prr/-/prr-0.0.0.tgz#1a84b85908325501411853d0081ee3fa86e2926a" + integrity sha1-GoS4WQgyVQFBGFPQCB7j+obikmo= + prr@~1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/prr/-/prr-1.0.1.tgz#d3fc114ba06995a45ec6893f484ceb1d78f5f476" + integrity sha1-0/wRS6BplaRexok/SEzrHXj19HY= -pseudomap@^1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/pseudomap/-/pseudomap-1.0.2.tgz#f052a28da70e618917ef0a8ac34c1ae5a68286b3" - -psl@^1.1.24: - version "1.1.31" - resolved "https://registry.yarnpkg.com/psl/-/psl-1.1.31.tgz#e9aa86d0101b5b105cbe93ac6b784cd547276184" +psl@^1.1.24, psl@^1.1.28: + version "1.6.0" + resolved "https://registry.yarnpkg.com/psl/-/psl-1.6.0.tgz#60557582ee23b6c43719d9890fb4170ecd91e110" + integrity sha512-SYKKmVel98NCOYXpkwUqZqh0ahZeeKfmisiLIcEZdsb+WbLv02g/dI5BUmZnIyOe7RzZtLax81nnb2HbvC2tzA== public-encrypt@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/public-encrypt/-/public-encrypt-4.0.0.tgz#39f699f3a46560dd5ebacbca693caf7c65c18cc6" + version "4.0.3" + resolved "https://registry.yarnpkg.com/public-encrypt/-/public-encrypt-4.0.3.tgz#4fcc9d77a07e48ba7527e7cbe0de33d0701331e0" + integrity sha512-zVpa8oKZSz5bTMTFClc1fQOnyyEzpl5ozpi1B5YcvBrdohMjH2rfsBtyXcuNuwjsDIXmBYlF2N5FlJYhR29t8Q== dependencies: bn.js "^4.1.0" browserify-rsa "^4.0.0" create-hash "^1.1.0" parse-asn1 "^5.0.0" randombytes "^2.0.1" + safe-buffer "^5.1.2" pump@^2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/pump/-/pump-2.0.1.tgz#12399add6e4cf7526d973cbc8b5ce2e2908b3909" + integrity sha512-ruPMNRkN3MHP1cWJc9OWr+T/xDP0jhXYCLfJcBuX54hhfIBnaQmAUMfDcG4DM5UMWByBbJY69QSphm3jtDKIkA== dependencies: end-of-stream "^1.1.0" once "^1.3.1" @@ -7845,6 +8671,7 @@ pump@^2.0.0: pump@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/pump/-/pump-3.0.0.tgz#b4a2116815bde2f4e1ea602354e8c75565107a64" + integrity sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww== dependencies: end-of-stream "^1.1.0" once "^1.3.1" @@ -7852,6 +8679,7 @@ pump@^3.0.0: pumpify@^1.3.3, pumpify@^1.3.5: version "1.5.1" resolved "https://registry.yarnpkg.com/pumpify/-/pumpify-1.5.1.tgz#36513be246ab27570b1a374a5ce278bfd74370ce" + integrity sha512-oClZI37HvuUJJxSKKrC17bZ9Cu0ZYhEAGPsPUy9KlMUmv9dKX2o77RUmq7f3XjIxbwyGwYzbzQ1L2Ks8sIradQ== dependencies: duplexify "^3.6.0" inherits "^2.0.3" @@ -7860,51 +8688,63 @@ pumpify@^1.3.3, pumpify@^1.3.5: punycode@1.3.2: version "1.3.2" resolved "https://registry.yarnpkg.com/punycode/-/punycode-1.3.2.tgz#9653a036fb7c1ee42342f2325cceefea3926c48d" + integrity sha1-llOgNvt8HuQjQvIyXM7v6jkmxI0= -punycode@^1.2.4, punycode@^1.3.2, punycode@^1.4.1: +punycode@^1.3.2, punycode@^1.4.1: version "1.4.1" resolved "https://registry.yarnpkg.com/punycode/-/punycode-1.4.1.tgz#c0d5a63b2718800ad8e1eb0fa5269c84dd41845e" + integrity sha1-wNWmOycYgArY4esPpSachN1BhF4= -punycode@^2.1.0: +punycode@^2.1.0, punycode@^2.1.1: version "2.1.1" resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.1.1.tgz#b58b010ac40c22c5657616c8d2c2c02c7bf479ec" + integrity sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A== q@^1.5.1: version "1.5.1" resolved "https://registry.yarnpkg.com/q/-/q-1.5.1.tgz#7e32f75b41381291d04611f1bf14109ac00651d7" + integrity sha1-fjL3W0E4EpHQRhHxvxQQmsAGUdc= qs@~6.5.2: version "6.5.2" resolved "https://registry.yarnpkg.com/qs/-/qs-6.5.2.tgz#cb3ae806e8740444584ef154ce8ee98d403f3e36" + integrity sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA== -querystring-es3@^0.2.0, querystring-es3@~0.2.0: +querystring-es3@~0.2.0: version "0.2.1" resolved "https://registry.yarnpkg.com/querystring-es3/-/querystring-es3-0.2.1.tgz#9ec61f79049875707d69414596fd907a4d711e73" + integrity sha1-nsYfeQSYdXB9aUFFlv2Qek1xHnM= querystring@0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/querystring/-/querystring-0.2.0.tgz#b209849203bb25df820da756e747005878521620" + integrity sha1-sgmEkgO7Jd+CDadW50cAWHhSFiA= quick-lru@^1.0.0: version "1.1.0" resolved "https://registry.yarnpkg.com/quick-lru/-/quick-lru-1.1.0.tgz#4360b17c61136ad38078397ff11416e186dcfbb8" + integrity sha1-Q2CxfGETatOAeDl/8RQW4Ybc+7g= -randomatic@^1.1.3: - version "1.1.7" - resolved "https://registry.yarnpkg.com/randomatic/-/randomatic-1.1.7.tgz#c7abe9cc8b87c0baa876b19fde83fd464797e38c" +randomatic@^3.0.0: + version "3.1.1" + resolved "https://registry.yarnpkg.com/randomatic/-/randomatic-3.1.1.tgz#b776efc59375984e36c537b2f51a1f0aff0da1ed" + integrity sha512-TuDE5KxZ0J461RVjrJZCJc+J+zCkTb1MbH9AQUq68sMhOMcy9jLcb3BrZKgp9q9Ncltdg4QVqWrH02W2EFFVYw== dependencies: - is-number "^3.0.0" - kind-of "^4.0.0" + is-number "^4.0.0" + kind-of "^6.0.0" + math-random "^1.0.1" randombytes@^2.0.0, randombytes@^2.0.1, randombytes@^2.0.5: - version "2.0.6" - resolved "https://registry.yarnpkg.com/randombytes/-/randombytes-2.0.6.tgz#d302c522948588848a8d300c932b44c24231da80" + version "2.1.0" + resolved "https://registry.yarnpkg.com/randombytes/-/randombytes-2.1.0.tgz#df6f84372f0270dc65cdf6291349ab7a473d4f2a" + integrity sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ== dependencies: safe-buffer "^5.1.0" randomfill@^1.0.3: version "1.0.4" resolved "https://registry.yarnpkg.com/randomfill/-/randomfill-1.0.4.tgz#c92196fc86ab42be983f1bf31778224931d61458" + integrity sha512-87lcbR8+MhcWcUiQ+9e+Rwx8MyR2P7qnt15ynUlbm3TU/fjbgz4GsvfSUDTemtCCtVCqb4ZcEFlyPNTh9bBTLw== dependencies: randombytes "^2.0.5" safe-buffer "^5.1.0" @@ -7912,6 +8752,7 @@ randomfill@^1.0.3: rc@^1.2.7: version "1.2.8" resolved "https://registry.yarnpkg.com/rc/-/rc-1.2.8.tgz#cd924bf5200a075b83c188cd6b9e211b7fc0d3ed" + integrity sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw== dependencies: deep-extend "^0.6.0" ini "~1.3.0" @@ -7919,25 +8760,28 @@ rc@^1.2.7: strip-json-comments "~2.0.1" react-is@^16.8.4: - version "16.8.4" - resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.8.4.tgz#90f336a68c3a29a096a3d648ab80e87ec61482a2" - integrity sha512-PVadd+WaUDOAciICm/J1waJaSvgq+4rHE/K70j0PFqKhkTBsPv/82UGQJNXAngz1fOQLLxI6z1sEDmJDQhCTAA== + version "16.12.0" + resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.12.0.tgz#2cc0fe0fba742d97fd527c42a13bec4eeb06241c" + integrity sha512-rPCkf/mWBtKc97aLL9/txD8DZdemK0vkA3JMLShjlJB3Pj3s+lpf1KaBzMfQrAmhMQB0n1cU/SUGgKKBCe837Q== read-cmd-shim@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/read-cmd-shim/-/read-cmd-shim-1.0.1.tgz#2d5d157786a37c055d22077c32c53f8329e91c7b" + version "1.0.5" + resolved "https://registry.yarnpkg.com/read-cmd-shim/-/read-cmd-shim-1.0.5.tgz#87e43eba50098ba5a32d0ceb583ab8e43b961c16" + integrity sha512-v5yCqQ/7okKoZZkBQUAfTsQ3sVJtXdNfbPnI5cceppoxEVLYA3k+VtV2omkeo8MS94JCy4fSiUwlRBAwCVRPUA== dependencies: graceful-fs "^4.1.2" read-only-stream@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/read-only-stream/-/read-only-stream-2.0.0.tgz#2724fd6a8113d73764ac288d4386270c1dbf17f0" + integrity sha1-JyT9aoET1zdkrCiNQ4YnDB2/F/A= dependencies: readable-stream "^2.0.2" "read-package-json@1 || 2", read-package-json@^2.0.0, read-package-json@^2.0.13: - version "2.0.13" - resolved "https://registry.yarnpkg.com/read-package-json/-/read-package-json-2.0.13.tgz#2e82ebd9f613baa6d2ebe3aa72cefe3f68e41f4a" + version "2.1.0" + resolved "https://registry.yarnpkg.com/read-package-json/-/read-package-json-2.1.0.tgz#e3d42e6c35ea5ae820d9a03ab0c7291217fc51d5" + integrity sha512-KLhu8M1ZZNkMcrq1+0UJbR8Dii8KZUqB0Sha4mOx/bknfKI/fyrQVrG/YIt2UOtG667sD8+ee4EXMM91W9dC+A== dependencies: glob "^7.1.1" json-parse-better-errors "^1.0.1" @@ -7947,18 +8791,18 @@ read-only-stream@^2.0.0: graceful-fs "^4.1.2" read-package-tree@^5.1.6: - version "5.2.1" - resolved "https://registry.yarnpkg.com/read-package-tree/-/read-package-tree-5.2.1.tgz#6218b187d6fac82289ce4387bbbaf8eef536ad63" + version "5.3.1" + resolved "https://registry.yarnpkg.com/read-package-tree/-/read-package-tree-5.3.1.tgz#a32cb64c7f31eb8a6f31ef06f9cedf74068fe636" + integrity sha512-mLUDsD5JVtlZxjSlPPx1RETkNjjvQYuweKwNVt1Sn8kP5Jh44pvYuUHCp6xSVDZWbNxVxG5lyZJ921aJH61sTw== dependencies: - debuglog "^1.0.1" - dezalgo "^1.0.0" - once "^1.3.0" read-package-json "^2.0.0" readdir-scoped-modules "^1.0.0" + util-promisify "^2.1.0" read-pkg-up@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/read-pkg-up/-/read-pkg-up-1.0.1.tgz#9d63c13276c065918d57f002a57f40a1b643fb02" + integrity sha1-nWPBMnbAZZGNV/ACpX9AobZD+wI= dependencies: find-up "^1.0.0" read-pkg "^1.0.0" @@ -7966,6 +8810,7 @@ read-pkg-up@^1.0.1: read-pkg-up@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/read-pkg-up/-/read-pkg-up-2.0.0.tgz#6b72a8048984e0c41e79510fd5e9fa99b3b549be" + integrity sha1-a3KoBImE4MQeeVEP1en6mbO1Sb4= dependencies: find-up "^2.0.0" read-pkg "^2.0.0" @@ -7973,6 +8818,7 @@ read-pkg-up@^2.0.0: read-pkg-up@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/read-pkg-up/-/read-pkg-up-3.0.0.tgz#3ed496685dba0f8fe118d0691dc51f4a1ff96f07" + integrity sha1-PtSWaF26D4/hGNBpHcUfSh/5bwc= dependencies: find-up "^2.0.0" read-pkg "^3.0.0" @@ -7980,6 +8826,7 @@ read-pkg-up@^3.0.0: read-pkg-up@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/read-pkg-up/-/read-pkg-up-4.0.0.tgz#1b221c6088ba7799601c808f91161c66e58f8978" + integrity sha512-6etQSH7nJGsK0RbG/2TeDzZFa8shjQ1um+SwQQ5cwKy0dhSXdOncEhb1CPpvQG4h7FyOV6EB6YlV0yJvZQNAkA== dependencies: find-up "^3.0.0" read-pkg "^3.0.0" @@ -7987,6 +8834,7 @@ read-pkg-up@^4.0.0: read-pkg@^1.0.0: version "1.1.0" resolved "https://registry.yarnpkg.com/read-pkg/-/read-pkg-1.1.0.tgz#f5ffaa5ecd29cb31c0474bca7d756b6bb29e3f28" + integrity sha1-9f+qXs0pyzHAR0vKfXVra7KePyg= dependencies: load-json-file "^1.0.0" normalize-package-data "^2.3.2" @@ -7995,6 +8843,7 @@ read-pkg@^1.0.0: read-pkg@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/read-pkg/-/read-pkg-2.0.0.tgz#8ef1c0623c6a6db0dc6713c4bfac46332b2368f8" + integrity sha1-jvHAYjxqbbDcZxPEv6xGMysjaPg= dependencies: load-json-file "^2.0.0" normalize-package-data "^2.3.2" @@ -8003,30 +8852,33 @@ read-pkg@^2.0.0: read-pkg@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/read-pkg/-/read-pkg-3.0.0.tgz#9cbc686978fee65d16c00e2b19c237fcf6e38389" + integrity sha1-nLxoaXj+5l0WwA4rGcI3/Pbjg4k= dependencies: load-json-file "^4.0.0" normalize-package-data "^2.3.2" path-type "^3.0.0" -read-pkg@^5.1.1: - version "5.1.1" - resolved "https://registry.yarnpkg.com/read-pkg/-/read-pkg-5.1.1.tgz#5cf234dde7a405c90c88a519ab73c467e9cb83f5" - integrity sha512-dFcTLQi6BZ+aFUaICg7er+/usEoqFdQxiEBsEMNGoipenihtxxtdrQuBXvyANCEI8VuUIVYFgeHGx9sLLvim4w== +read-pkg@^5.2.0: + version "5.2.0" + resolved "https://registry.yarnpkg.com/read-pkg/-/read-pkg-5.2.0.tgz#7bf295438ca5a33e56cd30e053b34ee7250c93cc" + integrity sha512-Ug69mNOpfvKDAc2Q8DRpMjjzdtrnv9HcSMX+4VsZxD1aZ6ZzrIE7rlzXBtWTyhULSMKg076AW6WR5iZpD0JiOg== dependencies: "@types/normalize-package-data" "^2.4.0" normalize-package-data "^2.5.0" - parse-json "^4.0.0" - type-fest "^0.4.1" + parse-json "^5.0.0" + type-fest "^0.6.0" read@1, read@~1.0.1: version "1.0.7" resolved "https://registry.yarnpkg.com/read/-/read-1.0.7.tgz#b3da19bd052431a97671d44a42634adf710b40c4" + integrity sha1-s9oZvQUkMal2cdRKQmNK33ELQMQ= dependencies: mute-stream "~0.0.4" -"readable-stream@1 || 2", "readable-stream@2 || 3", readable-stream@^2.0.0, readable-stream@^2.0.1, readable-stream@^2.0.2, readable-stream@^2.0.4, readable-stream@^2.0.5, readable-stream@^2.0.6, readable-stream@^2.1.5, readable-stream@^2.2.2, readable-stream@^2.3.3, readable-stream@~2.3.6: +"readable-stream@1 || 2", readable-stream@^2.0.0, readable-stream@^2.0.1, readable-stream@^2.0.2, readable-stream@^2.0.5, readable-stream@^2.0.6, readable-stream@^2.1.5, readable-stream@^2.2.2, readable-stream@^2.3.3, readable-stream@^2.3.5, readable-stream@^2.3.6, readable-stream@~2.3.6: version "2.3.6" resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.3.6.tgz#b11c27d88b8ff1fbe070643cf94b0c79ae1b0aaf" + integrity sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw== dependencies: core-util-is "~1.0.0" inherits "~2.0.3" @@ -8036,29 +8888,39 @@ read@1, read@~1.0.1: string_decoder "~1.1.1" util-deprecate "~1.0.1" -"readable-stream@>=1.1.13-1 <1.2.0-0": - version "1.1.14" - resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-1.1.14.tgz#7cf4c54ef648e3813084c636dd2079e166c081d9" +"readable-stream@2 || 3", readable-stream@^3.0.2, readable-stream@^3.0.6: + version "3.4.0" + resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-3.4.0.tgz#a51c26754658e0a3c21dbf59163bd45ba6f447fc" + integrity sha512-jItXPLmrSR8jmTRmRWJXCnGJsfy85mB3Wd/uINMXA65yrnFo0cPClFIUWzo2najVNSl+mx7/4W8ttlLWJe99pQ== + dependencies: + inherits "^2.0.3" + string_decoder "^1.1.1" + util-deprecate "^1.0.1" + +"readable-stream@>=1.1.13-1 <1.2.0-0", readable-stream@^1.0.26-4: + version "1.1.14" + resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-1.1.14.tgz#7cf4c54ef648e3813084c636dd2079e166c081d9" + integrity sha1-fPTFTvZI44EwhMY23SB54WbAgdk= dependencies: core-util-is "~1.0.0" inherits "~2.0.1" isarray "0.0.1" string_decoder "~0.10.x" -readable-stream@~2.0.0: - version "2.0.6" - resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.0.6.tgz#8f90341e68a53ccc928788dacfcd11b36eb9b78e" +readable-stream@~1.0.26, readable-stream@~1.0.26-4: + version "1.0.34" + resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-1.0.34.tgz#125820e34bc842d2f2aaafafe4c2916ee32c157c" + integrity sha1-Elgg40vIQtLyqq+v5MKRbuMsFXw= dependencies: core-util-is "~1.0.0" inherits "~2.0.1" - isarray "~1.0.0" - process-nextick-args "~1.0.6" + isarray "0.0.1" string_decoder "~0.10.x" - util-deprecate "~1.0.1" readdir-scoped-modules@^1.0.0: - version "1.0.2" - resolved "https://registry.yarnpkg.com/readdir-scoped-modules/-/readdir-scoped-modules-1.0.2.tgz#9fafa37d286be5d92cbaebdee030dc9b5f406747" + version "1.1.0" + resolved "https://registry.yarnpkg.com/readdir-scoped-modules/-/readdir-scoped-modules-1.1.0.tgz#8d45407b4f870a0dcaebc0e28670d18e74514309" + integrity sha512-asaikDeqAQg7JifRsZn1NJZXo9E+VwlyCfbkZhwyISinqk5zNS6266HS5kah6P0SaQKGF6SkNnZVHUzHFYxYDw== dependencies: debuglog "^1.0.1" dezalgo "^1.0.0" @@ -8081,24 +8943,17 @@ realpath-native@^1.1.0: dependencies: util.promisify "^1.0.0" -recast@~0.11.12: - version "0.11.23" - resolved "https://registry.yarnpkg.com/recast/-/recast-0.11.23.tgz#451fd3004ab1e4df9b4e4b66376b2a21912462d3" - dependencies: - ast-types "0.9.6" - esprima "~3.1.0" - private "~0.1.5" - source-map "~0.5.0" - rechoir@^0.6.2: version "0.6.2" resolved "https://registry.yarnpkg.com/rechoir/-/rechoir-0.6.2.tgz#85204b54dba82d5742e28c96756ef43af50e3384" + integrity sha1-hSBLVNuoLVdC4oyWdW70OvUOM4Q= dependencies: resolve "^1.1.6" redent@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/redent/-/redent-1.0.0.tgz#cf916ab1fd5f1f16dfb20822dd6ec7f730c2afde" + integrity sha1-z5Fqsf1fHxbfsggi3W7H9zDCr94= dependencies: indent-string "^2.1.0" strip-indent "^1.0.1" @@ -8106,84 +8961,83 @@ redent@^1.0.0: redent@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/redent/-/redent-2.0.0.tgz#c1b2007b42d57eb1389079b3c8333639d5e1ccaa" + integrity sha1-wbIAe0LVfrE4kHmzyDM2OdXhzKo= dependencies: indent-string "^3.0.0" strip-indent "^2.0.0" -regenerate-unicode-properties@^8.0.2: - version "8.0.2" - resolved "https://registry.yarnpkg.com/regenerate-unicode-properties/-/regenerate-unicode-properties-8.0.2.tgz#7b38faa296252376d363558cfbda90c9ce709662" - integrity sha512-SbA/iNrBUf6Pv2zU8Ekv1Qbhv92yxL4hiDa2siuxs4KKn4oOoMDHXjAf7+Nz9qinUQ46B1LcWEi/PhJfPWpZWQ== +regenerate-unicode-properties@^8.1.0: + version "8.1.0" + resolved "https://registry.yarnpkg.com/regenerate-unicode-properties/-/regenerate-unicode-properties-8.1.0.tgz#ef51e0f0ea4ad424b77bf7cb41f3e015c70a3f0e" + integrity sha512-LGZzkgtLY79GeXLm8Dp0BVLdQlWICzBnJz/ipWUgo59qBaZ+BHtq51P2q1uVZlppMuUAT37SDk39qUbjTWB7bA== dependencies: regenerate "^1.4.0" regenerate@^1.4.0: version "1.4.0" resolved "https://registry.yarnpkg.com/regenerate/-/regenerate-1.4.0.tgz#4a856ec4b56e4077c557589cae85e7a4c8869a11" + integrity sha512-1G6jJVDWrt0rK99kBjvEtziZNCICAuvIPkSiUFIQxVP06RCVpq3dmDo2oi6ABpYaDYaTRr67BEhL8r1wgEZZKg== regenerator-runtime@^0.13.2: - version "0.13.2" - resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.13.2.tgz#32e59c9a6fb9b1a4aff09b4930ca2d4477343447" - integrity sha512-S/TQAZJO+D3m9xeN1WTI8dLKBBiRgXBlTJvbWjCThHWZj9EvHK70Ff50/tYj2J/fvBY6JtFVwRuazHN2E7M9BA== + version "0.13.3" + resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.13.3.tgz#7cf6a77d8f5c6f60eb73c5fc1955b2ceb01e6bf5" + integrity sha512-naKIZz2GQ8JWh///G7L3X6LaQUAMp2lvb1rvwwsURe/VXwD6VMfr+/1NuNw3ag8v2kY1aQ/go5SNn79O9JU7yw== regenerator-transform@^0.14.0: - version "0.14.0" - resolved "https://registry.yarnpkg.com/regenerator-transform/-/regenerator-transform-0.14.0.tgz#2ca9aaf7a2c239dd32e4761218425b8c7a86ecaf" - integrity sha512-rtOelq4Cawlbmq9xuMR5gdFmv7ku/sFoB7sRiywx7aq53bc52b4j6zvH7Te1Vt/X2YveDKnCGUbioieU7FEL3w== + version "0.14.1" + resolved "https://registry.yarnpkg.com/regenerator-transform/-/regenerator-transform-0.14.1.tgz#3b2fce4e1ab7732c08f665dfdb314749c7ddd2fb" + integrity sha512-flVuee02C3FKRISbxhXl9mGzdbWUVHubl1SMaknjxkFB1/iqpJhArQUvRxOOPEc/9tAiX0BaQ28FJH10E4isSQ== 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" + integrity sha512-J6SDjUgDxQj5NusnOtdFxDwN/+HWykR8GELwctJ7mdqhcyy1xEc4SRFHUXvxTp661YaVKAjfRLZ9cCqS6tn32A== dependencies: extend-shallow "^3.0.2" safe-regex "^1.1.0" -regexp-tree@^0.1.6: - version "0.1.10" - resolved "https://registry.yarnpkg.com/regexp-tree/-/regexp-tree-0.1.10.tgz#d837816a039c7af8a8d64d7a7c3cf6a1d93450bc" - integrity sha512-K1qVSbcedffwuIslMwpe6vGlj+ZXRnGkvjAtFHfDZZZuEdA/h0dxljAPu9vhUo6Rrx2U2AwJ+nSQ6hK+lrP5MQ== - regexpp@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/regexpp/-/regexpp-2.0.1.tgz#8d19d31cf632482b589049f8281f93dbcba4d07f" + integrity sha512-lv0M6+TkDVniA3aD1Eg0DVpfU/booSu7Eev3TDO/mZKHBfVjgCGTV4t4buppESEYDtkArYFOxTJWv6S5C+iaNw== -regexpu-core@^4.5.4: - version "4.5.4" - resolved "https://registry.yarnpkg.com/regexpu-core/-/regexpu-core-4.5.4.tgz#080d9d02289aa87fe1667a4f5136bc98a6aebaae" - integrity sha512-BtizvGtFQKGPUcTy56o3nk1bGRp4SZOTYrDtGNlqCQufptV5IkkLN6Emw+yunAJjzf+C9FQFtvq7IoA3+oMYHQ== +regexpu-core@^4.6.0: + version "4.6.0" + resolved "https://registry.yarnpkg.com/regexpu-core/-/regexpu-core-4.6.0.tgz#2037c18b327cfce8a6fea2a4ec441f2432afb8b6" + integrity sha512-YlVaefl8P5BnFYOITTNzDvan1ulLOiXJzCNZxduTIosN17b87h3bvG9yHMoHaRuo88H4mQ06Aodj5VtYGGGiTg== dependencies: regenerate "^1.4.0" - regenerate-unicode-properties "^8.0.2" + regenerate-unicode-properties "^8.1.0" regjsgen "^0.5.0" regjsparser "^0.6.0" unicode-match-property-ecmascript "^1.0.4" unicode-match-property-value-ecmascript "^1.1.0" regjsgen@^0.5.0: - version "0.5.0" - resolved "https://registry.yarnpkg.com/regjsgen/-/regjsgen-0.5.0.tgz#a7634dc08f89209c2049adda3525711fb97265dd" + version "0.5.1" + resolved "https://registry.yarnpkg.com/regjsgen/-/regjsgen-0.5.1.tgz#48f0bf1a5ea205196929c0d9798b42d1ed98443c" + integrity sha512-5qxzGZjDs9w4tzT3TPhCJqWdCc3RLYwy9J2NB0nm5Lz+S273lvWcpjaTGHsT1dc6Hhfq41uSEOw8wBmxrKOuyg== regjsparser@^0.6.0: version "0.6.0" resolved "https://registry.yarnpkg.com/regjsparser/-/regjsparser-0.6.0.tgz#f1e6ae8b7da2bae96c99399b868cd6c933a2ba9c" + integrity sha512-RQ7YyokLiQBomUJuUG8iGVvkgOLxwyZM8k6d3q5SAXpg4r5TZJZigKFvC6PpD+qQ98bCDC5YelPeA3EucDoNeQ== dependencies: jsesc "~0.5.0" -relateurl@0.2.x: - version "0.2.7" - resolved "https://registry.yarnpkg.com/relateurl/-/relateurl-0.2.7.tgz#54dbf377e51440aca90a4cd274600d3ff2d888a9" - remove-bom-buffer@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/remove-bom-buffer/-/remove-bom-buffer-3.0.0.tgz#c2bf1e377520d324f623892e33c10cac2c252b53" + integrity sha512-8v2rWhaakv18qcvNeli2mZ/TMTL2nEyAKRvzo1WtnZBl15SHyEhrCu2/xKlJyUFKHiHgfXIyuY6g2dObJJycXQ== dependencies: is-buffer "^1.1.5" is-utf8 "^0.2.1" @@ -8191,6 +9045,7 @@ remove-bom-buffer@^3.0.0: remove-bom-stream@^1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/remove-bom-stream/-/remove-bom-stream-1.2.0.tgz#05f1a593f16e42e1fb90ebf59de8e569525f9523" + integrity sha1-BfGlk/FuQuH7kOv1nejlaVJflSM= dependencies: remove-bom-buffer "^3.0.0" safe-buffer "^5.1.0" @@ -8199,54 +9054,64 @@ remove-bom-stream@^1.2.0: remove-trailing-separator@^1.0.1, remove-trailing-separator@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/remove-trailing-separator/-/remove-trailing-separator-1.1.0.tgz#c24bce2a283adad5bc3f58e0d48249b92379d8ef" + integrity sha1-wkvOKig62tW8P1jg1IJJuSN52O8= repeat-element@^1.1.2: - version "1.1.2" - resolved "https://registry.yarnpkg.com/repeat-element/-/repeat-element-1.1.2.tgz#ef089a178d1483baae4d93eb98b4f9e4e11d990a" + version "1.1.3" + resolved "https://registry.yarnpkg.com/repeat-element/-/repeat-element-1.1.3.tgz#782e0d825c0c5a3bb39731f84efee6b742e6b1ce" + integrity sha512-ahGq0ZnV5m5XtZLMb+vP76kcAM5nkLqk0lpqAuojSKGgQtn4eRi4ZZGm2olo2zKFH+sMsWaqOCW1dqAnOru72g== repeat-string@^1.5.2, 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= repeating@^2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/repeating/-/repeating-2.0.1.tgz#5214c53a926d3552707527fbab415dbc08d06dda" + integrity sha1-UhTFOpJtNVJwdSf7q0FdvAjQbdo= dependencies: is-finite "^1.0.0" replace-ext@0.0.1: version "0.0.1" resolved "https://registry.yarnpkg.com/replace-ext/-/replace-ext-0.0.1.tgz#29bbd92078a739f0bcce2b4ee41e837953522924" + integrity sha1-KbvZIHinOfC8zitO5B6DeVNSKSQ= replace-ext@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/replace-ext/-/replace-ext-1.0.0.tgz#de63128373fcbf7c3ccfa4de5a480c45a67958eb" + integrity sha1-3mMSg3P8v3w8z6TeWkgMRaZ5WOs= replace-homedir@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/replace-homedir/-/replace-homedir-1.0.0.tgz#e87f6d513b928dde808260c12be7fec6ff6e798c" + integrity sha1-6H9tUTuSjd6AgmDBK+f+xv9ueYw= dependencies: homedir-polyfill "^1.0.1" is-absolute "^1.0.0" remove-trailing-separator "^1.1.0" -request-promise-core@1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/request-promise-core/-/request-promise-core-1.1.1.tgz#3eee00b2c5aa83239cfb04c5700da36f81cd08b6" +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.13.1" + lodash "^4.17.15" request-promise-native@^1.0.5: - version "1.0.5" - resolved "https://registry.yarnpkg.com/request-promise-native/-/request-promise-native-1.0.5.tgz#5281770f68e0c9719e5163fd3fab482215f4fda5" + 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.1" - stealthy-require "^1.1.0" - tough-cookie ">=2.3.3" + request-promise-core "1.1.3" + stealthy-require "^1.1.1" + tough-cookie "^2.3.3" -request@^2.83.0, request@^2.87.0: +request@^2.87.0: version "2.88.0" resolved "https://registry.yarnpkg.com/request/-/request-2.88.0.tgz#9c2fca4f7d35b592efe57c7f0a55e81052124fef" + integrity sha512-NAqBSrijGLZdM0WZNsInLJpkJokL72XYjUpnB0iwsRgxh7dB6COrHnTBNwN0E+lHDAJzu7kLAkDeY08z2/A0hg== dependencies: aws-sign2 "~0.7.0" aws4 "^1.8.0" @@ -8272,20 +9137,29 @@ request@^2.83.0, request@^2.87.0: require-directory@^2.1.1: version "2.1.1" resolved "https://registry.yarnpkg.com/require-directory/-/require-directory-2.1.1.tgz#8c64ad5fd30dab1c976e2344ffe7f792a6a6df42" + integrity sha1-jGStX9MNqxyXbiNE/+f3kqam30I= require-main-filename@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/require-main-filename/-/require-main-filename-1.0.1.tgz#97f717b69d48784f5f526a6c5aa8ffdda055a4d1" + integrity sha1-l/cXtp1IeE9fUmpsWqj/3aBVpNE= + +require-main-filename@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/require-main-filename/-/require-main-filename-2.0.0.tgz#d0b329ecc7cc0f61649f62215be69af54aa8989b" + integrity sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg== resolve-cwd@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/resolve-cwd/-/resolve-cwd-2.0.0.tgz#00a9f7387556e27038eae232caa372a6a59b665a" + integrity sha1-AKn3OHVW4nA46uIyyqNypqWbZlo= dependencies: resolve-from "^3.0.0" resolve-dir@^1.0.0, resolve-dir@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/resolve-dir/-/resolve-dir-1.0.1.tgz#79a40644c362be82f26effe739c9bb5382046f43" + integrity sha1-eaQGRMNivoLybv/nOcm7U4IEb0M= dependencies: expand-tilde "^2.0.0" global-modules "^1.0.0" @@ -8293,85 +9167,148 @@ resolve-dir@^1.0.0, resolve-dir@^1.0.1: resolve-from@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-3.0.0.tgz#b22c7af7d9d6881bc8b6e653335eebcb0a188748" + integrity sha1-six699nWiBvItuZTM17rywoYh0g= resolve-from@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-4.0.0.tgz#4abcd852ad32dd7baabfe9b40e00a36db5f392e6" + integrity sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g== resolve-options@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/resolve-options/-/resolve-options-1.1.0.tgz#32bb9e39c06d67338dc9378c0d6d6074566ad131" + integrity sha1-MrueOcBtZzONyTeMDW1gdFZq0TE= dependencies: value-or-function "^3.0.0" resolve-url@^0.2.1: version "0.2.1" resolved "https://registry.yarnpkg.com/resolve-url/-/resolve-url-0.2.1.tgz#2c637fe77c893afd2a663fe21aa9080068e2052a" + integrity sha1-LGN/53yJOv0qZj/iGqkIAGjiBSo= resolve@1.1.7: version "1.1.7" resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.1.7.tgz#203114d82ad2c5ed9e8e0411b3932875e889e97b" integrity sha1-IDEU2CrSxe2ejgQRs5ModeiJ6Xs= -resolve@^1.1.4, resolve@^1.1.6, resolve@^1.1.7, resolve@^1.10.0, resolve@^1.10.1, resolve@^1.3.2, resolve@^1.4.0, resolve@^1.5.0, resolve@^1.8.1: - version "1.10.1" - resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.10.1.tgz#664842ac960795bbe758221cdccda61fb64b5f18" - integrity sha512-KuIe4mf++td/eFb6wkaPbMDnP6kObCaEtIDuHOUED6MNUo4K670KZUHuuvYPZDxNF0WVLw49n06M2m2dXphEzA== +resolve@^1.1.4, resolve@^1.1.6, resolve@^1.1.7, resolve@^1.10.0, resolve@^1.11.0, resolve@^1.11.1, resolve@^1.12.0, resolve@^1.3.2, resolve@^1.4.0, resolve@^1.5.0, resolve@^1.8.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" restore-cursor@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/restore-cursor/-/restore-cursor-2.0.0.tgz#9f7ee287f82fd326d4fd162923d62129eee0dfaf" + integrity sha1-n37ih/gv0ybU/RYpI9YhKe7g368= dependencies: onetime "^2.0.0" signal-exit "^3.0.2" +restore-cursor@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/restore-cursor/-/restore-cursor-3.1.0.tgz#39f67c54b3a7a58cea5236d95cf0034239631f7e" + integrity sha512-l+sSefzHpj5qimhFSE5a8nufZYAM3sBSVMAPtYkmC+4EH2anSGaEMXSD0izRQbu9nfyQ9y5JrVmp7E8oZrUjvA== + dependencies: + onetime "^5.1.0" + signal-exit "^3.0.2" + ret@~0.1.10: version "0.1.15" resolved "https://registry.yarnpkg.com/ret/-/ret-0.1.15.tgz#b8a4825d5bdb1fc3f6f53c2bc33f81388681c7bc" + integrity sha512-TTlYpa+OL+vMMNG24xSlQGEJ3B/RzEfUlLct7b5G/ytav+wPrplCpVMFuwzXbkecJrb6IYo1iFb0S9v37754mg== retry@^0.10.0: version "0.10.1" resolved "https://registry.yarnpkg.com/retry/-/retry-0.10.1.tgz#e76388d217992c252750241d3d3956fed98d8ff4" + integrity sha1-52OI0heZLCUnUCQdPTlW/tmNj/Q= -right-align@^0.1.1: - version "0.1.3" - resolved "https://registry.yarnpkg.com/right-align/-/right-align-0.1.3.tgz#61339b722fe6a3515689210d24e14c96148613ef" +reusify@^1.0.0: + version "1.0.4" + resolved "https://registry.yarnpkg.com/reusify/-/reusify-1.0.4.tgz#90da382b1e126efc02146e90845a88db12925d76" + integrity sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw== + +rimraf@2, rimraf@^2.5.4, rimraf@^2.6.1, rimraf@^2.6.2, rimraf@^2.6.3: + version "2.7.1" + resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.7.1.tgz#35797f13a7fdadc566142c29d4f07ccad483e3ec" + integrity sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w== dependencies: - align-text "^0.1.1" + glob "^7.1.3" -rimraf@2, rimraf@2.6.3, rimraf@^2.2.8, rimraf@^2.5.4, rimraf@^2.6.1, rimraf@^2.6.2, rimraf@^2.6.3: +rimraf@2.6.3: version "2.6.3" resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.6.3.tgz#b2d104fe0d8fb27cf9e0a1cda8262dd3833c6cab" + integrity sha512-mwqeW5XsA2qAejG46gYdENaxXjx9onRNCfn7L0duuP4hCuTIi/QO7PDK07KJfp1d+izWPrzEJDcSqBa0OZQriA== + dependencies: + glob "^7.1.3" + +rimraf@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-3.0.0.tgz#614176d4b3010b75e5c390eb0ee96f6dc0cebb9b" + integrity sha512-NDGVxTsjqfunkds7CqsOiEnxln4Bo7Nddl3XhS4pXg5OzwkLqJ971ZVAAnB+DDLnF76N+VnDEiBHaVV8I06SUg== dependencies: glob "^7.1.3" ripemd160@^2.0.0, ripemd160@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/ripemd160/-/ripemd160-2.0.1.tgz#0f4584295c53a3628af7e6d79aca21ce57d1c6e7" + version "2.0.2" + resolved "https://registry.yarnpkg.com/ripemd160/-/ripemd160-2.0.2.tgz#a1c1a6f624751577ba5d07914cbc92850585890c" + integrity sha512-ii4iagi25WusVoiC4B4lq7pbXfAp3D9v5CwfkY33vffw2+pkDjY1D8GaN7spsxvCSx8dkPqOZCEZyfxcmJG2IA== dependencies: - hash-base "^2.0.0" + hash-base "^3.0.0" inherits "^2.0.1" rollup-plugin-babel@^4.0.0: - version "4.3.2" - resolved "https://registry.yarnpkg.com/rollup-plugin-babel/-/rollup-plugin-babel-4.3.2.tgz#8c0e1bd7aa9826e90769cf76895007098ffd1413" - integrity sha512-KfnizE258L/4enADKX61ozfwGHoqYauvoofghFJBhFnpH9Sb9dNPpWg8QHOaAfVASUYV8w0mCx430i9z0LJoJg== + 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== dependencies: "@babel/helper-module-imports" "^7.0.0" - rollup-pluginutils "^2.3.0" + rollup-pluginutils "^2.8.1" + +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: + 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-builtins@^2.1.2: + version "2.1.2" + resolved "https://registry.yarnpkg.com/rollup-plugin-node-builtins/-/rollup-plugin-node-builtins-2.1.2.tgz#24a1fed4a43257b6b64371d8abc6ce1ab14597e9" + integrity sha1-JKH+1KQyV7a2Q3HYq8bOGrFFl+k= + dependencies: + browserify-fs "^1.0.0" + buffer-es6 "^4.9.2" + crypto-browserify "^3.11.0" + process-es6 "^0.11.2" + +rollup-plugin-node-globals@^1.4.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/rollup-plugin-node-globals/-/rollup-plugin-node-globals-1.4.0.tgz#5e1f24a9bb97c0ef51249f625e16c7e61b7c020b" + integrity sha512-xRkB+W/m1KLIzPUmG0ofvR+CPNcvuCuNdjVBVS7ALKSxr3EDhnzNceGkGi1m8MToSli13AzKFYH4ie9w3I5L3g== + dependencies: + acorn "^5.7.3" + buffer-es6 "^4.9.3" + estree-walker "^0.5.2" + magic-string "^0.22.5" + process-es6 "^0.11.6" + rollup-pluginutils "^2.3.1" rollup-plugin-node-resolve@^5.0.0: - version "5.0.0" - resolved "https://registry.yarnpkg.com/rollup-plugin-node-resolve/-/rollup-plugin-node-resolve-5.0.0.tgz#754abf4841ed4bab2241551cba0a11d04c57f290" - integrity sha512-JUFr7DkFps3div9DYwpSg0O+s8zuSSRASUZUVNx6h6zhw2m8vcpToeS68JDPsFbmisMVSMYK0IxftngCRv7M9Q== + 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: "@types/resolve" "0.0.8" builtin-modules "^3.1.0" is-module "^1.0.0" - resolve "^1.10.1" - rollup-pluginutils "^2.7.0" + resolve "^1.11.1" + rollup-pluginutils "^2.8.1" rollup-plugin-replace@^2.2.0: version "2.2.0" @@ -8381,72 +9318,99 @@ rollup-plugin-replace@^2.2.0: magic-string "^0.25.2" rollup-pluginutils "^2.6.0" -rollup-pluginutils@^2.3.0, rollup-pluginutils@^2.6.0, rollup-pluginutils@^2.7.0: - version "2.7.1" - resolved "https://registry.yarnpkg.com/rollup-pluginutils/-/rollup-pluginutils-2.7.1.tgz#a7915ce8b12c177364784bf38a1590cc6c2c8250" - integrity sha512-3nRf3buQGR9qz/IsSzhZAJyoK663kzseps8itkYHr+Z7ESuaffEPfgRinxbCRA0pf0gzLqkNKkSb8aNVTq75NA== +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.6.0" - micromatch "^3.1.10" + "@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@^1.12.0: - version "1.12.0" - resolved "https://registry.yarnpkg.com/rollup/-/rollup-1.12.0.tgz#3e07e7d178bf61fe12325660a037ae0041219d8c" - integrity sha512-DFqgTupu9dkoS80AZ4xMgeLCeC96pGRCu1MLlOwRAjJ3qGItw+j4YWcL3/uWbgQO2mnmrAZphxAdjSXYsG5pWA== +rollup-pluginutils@^2.3.1, rollup-pluginutils@^2.5.0, rollup-pluginutils@^2.6.0, rollup-pluginutils@^2.8.1: + version "2.8.2" + resolved "https://registry.yarnpkg.com/rollup-pluginutils/-/rollup-pluginutils-2.8.2.tgz#72f2af0748b592364dbd3389e600e5a9444a351e" + integrity sha512-EEp9NhnUkwY8aif6bxgovPHMoMoNr2FulJziTndpt5H9RdwC47GSGuII9XxpSdzVGM0GWrNPHV6ie1LTNJPaLQ== dependencies: - "@types/estree" "0.0.39" - "@types/node" "^12.0.2" - acorn "^6.1.1" + estree-walker "^0.6.1" -rsvp@^3.3.3: - version "3.6.2" - resolved "https://registry.yarnpkg.com/rsvp/-/rsvp-3.6.2.tgz#2e96491599a96cde1b515d5674a8f7a91452926a" +rollup@^1.27.5: + version "1.27.9" + resolved "https://registry.yarnpkg.com/rollup/-/rollup-1.27.9.tgz#742f1234c1fa935f35149a433807da675b10f9a6" + integrity sha512-8AfW4cJTPZfG6EXWwT/ujL4owUsDI1Xl8J1t+hvK4wDX81F5I4IbwP9gvGbHzxnV19fnU4rRABZQwZSX9J402Q== + dependencies: + "@types/estree" "*" + "@types/node" "*" + acorn "^7.1.0" + +rsvp@^4.8.4: + version "4.8.5" + resolved "https://registry.yarnpkg.com/rsvp/-/rsvp-4.8.5.tgz#c8f155311d167f68f21e168df71ec5b083113734" + integrity sha512-nfMOlASu9OnRJo1mbEk2cz0D56a1MBNrJ7orjRZQG10XDyuvwksKbuXNp6qa+kbn839HwjwhBzhFmdsaEAfauA== run-async@^2.2.0: version "2.3.0" resolved "https://registry.yarnpkg.com/run-async/-/run-async-2.3.0.tgz#0371ab4ae0bdd720d4166d7dfda64ff7a445a6c0" + integrity sha1-A3GrSuC91yDUFm19/aZP96RFpsA= dependencies: is-promise "^2.1.0" run-node@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/run-node/-/run-node-1.0.0.tgz#46b50b946a2aa2d4947ae1d886e9856fd9cabe5e" + integrity sha512-kc120TBlQ3mih1LSzdAJXo4xn/GWS2ec0l3S+syHDXP9uRr0JAT8Qd3mdMuyjqCzeZktgP3try92cEgf9Nks8A== + +run-parallel@^1.1.9: + version "1.1.9" + resolved "https://registry.yarnpkg.com/run-parallel/-/run-parallel-1.1.9.tgz#c9dd3a7cf9f4b2c4b6244e173a6ed866e61dd679" + integrity sha512-DEqnSRTDw/Tc3FXf49zedI638Z9onwUotBMiUFKmrO2sdFKIbXamXGQ3Axd4qgphxKB4kw/qP1w5kTxnfU1B9Q== run-queue@^1.0.0, run-queue@^1.0.3: version "1.0.3" resolved "https://registry.yarnpkg.com/run-queue/-/run-queue-1.0.3.tgz#e848396f057d223f24386924618e25694161ec47" + integrity sha1-6Eg5bwV9Ij8kOGkkYY4laUFh7Ec= dependencies: aproba "^1.1.1" rxjs@^6.3.3, rxjs@^6.4.0: - version "6.4.0" - resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-6.4.0.tgz#f3bb0fe7bda7fb69deac0c16f17b50b0b8790504" - integrity sha512-Z9Yfa11F6B9Sg/BK9MnqnQ+aQYicPLtilXBp2yUtDt2JRCE0h26d33EnfO3ZxoNxG0T92OUucP3Ct7cpfkdFfw== + version "6.5.3" + resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-6.5.3.tgz#510e26317f4db91a7eb1de77d9dd9ba0a4899a3a" + integrity sha512-wuYsAYYFdWTAnAaPoKGNhfpWwKZbJW+HgAJ+mImp+Epl7BG8oNWBCTyRM8gba9k4lk8BgWdoYm21Mo/RYhhbgA== dependencies: tslib "^1.9.0" -safe-buffer@^5.0.1, safe-buffer@^5.1.0, safe-buffer@^5.1.1, safe-buffer@^5.1.2, safe-buffer@~5.1.0, safe-buffer@~5.1.1: +safe-buffer@^5.0.1, safe-buffer@^5.1.0, safe-buffer@^5.1.1, safe-buffer@^5.1.2, safe-buffer@^5.2.0, safe-buffer@~5.2.0: + version "5.2.0" + resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.2.0.tgz#b74daec49b1148f88c64b68d49b1e815c1f2f519" + integrity sha512-fZEwUGbVl7kouZs1jCdMLdt95hdIv0ZeHg6L7qPeciMZhZ+/gdesW4wgTARkrFWEpspjEATAzUGPG8N2jJiwbg== + +safe-buffer@~5.1.0, safe-buffer@~5.1.1: version "5.1.2" resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.2.tgz#991ec69d296e0313747d59bdfd2b745c35f8828d" + integrity sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g== safe-regex@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/safe-regex/-/safe-regex-1.1.0.tgz#40a3669f3b077d1e943d44629e157dd48023bf2e" + integrity sha1-QKNmnzsHfR6UPURinhV91IAjvy4= dependencies: ret "~0.1.10" -"safer-buffer@>= 2.1.2 < 3": +"safer-buffer@>= 2.1.2 < 3", safer-buffer@^2.0.2, safer-buffer@^2.1.0, safer-buffer@~2.1.0: version "2.1.2" resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a" + integrity sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg== sane@^4.0.3: - version "4.0.3" - resolved "https://registry.yarnpkg.com/sane/-/sane-4.0.3.tgz#e878c3f19e25cc57fbb734602f48f8a97818b181" - integrity sha512-hSLkC+cPHiBQs7LSyXkotC3UUtyn8C4FMn50TNaacRyvBlI+3ebcxMpqckmTdtXVtel87YS7GXN3UIOj7NiGVQ== + version "4.1.0" + resolved "https://registry.yarnpkg.com/sane/-/sane-4.1.0.tgz#ed881fd922733a6c461bc189dc2b6c006f3ffded" + integrity sha512-hhbzAgTIX8O7SHfp2c8/kREfEn4qO/9q8C9beyY6+tvZ87EpoZ3i1RIEvp27YBswnNbY9mWd6paKVmKbAgLfZA== dependencies: "@cnakazawa/watch" "^1.0.3" anymatch "^2.0.0" - capture-exit "^1.2.0" + capture-exit "^2.0.0" exec-sh "^0.3.2" execa "^1.0.0" fb-watchman "^2.0.0" @@ -8457,72 +9421,86 @@ sane@^4.0.3: sax@^1.2.4: version "1.2.4" resolved "https://registry.yarnpkg.com/sax/-/sax-1.2.4.tgz#2816234e2378bddc4e5354fab5caa895df7100d9" + integrity sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw== semver-compare@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/semver-compare/-/semver-compare-1.0.0.tgz#0dee216a1c941ab37e9efb1788f6afc5ff5537fc" + integrity sha1-De4hahyUGrN+nvsXiPavxf9VN/w= semver-greatest-satisfied-range@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/semver-greatest-satisfied-range/-/semver-greatest-satisfied-range-1.1.0.tgz#13e8c2658ab9691cb0cd71093240280d36f77a5b" + integrity sha1-E+jCZYq5aRywzXEJMkAoDTb3els= dependencies: sver-compat "^1.5.0" -"semver@2 || 3 || 4 || 5", "semver@2.x || 3.x || 4 || 5", semver@^5.3.0, semver@^5.4.1, semver@^5.5.0, semver@^5.5.1, semver@^5.6.0: - version "5.6.0" - resolved "https://registry.yarnpkg.com/semver/-/semver-5.6.0.tgz#7e74256fbaa49c75aa7c7a205cc22799cac80004" +"semver@2 || 3 || 4 || 5", "semver@2.x || 3.x || 4 || 5", semver@^5.3.0, semver@^5.4.1, semver@^5.5.0, semver@^5.5.1, semver@^5.6.0, semver@^5.7.0: + version "5.7.1" + resolved "https://registry.yarnpkg.com/semver/-/semver-5.7.1.tgz#a954f931aeba508d307bbf069eff0c01c96116f7" + integrity sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ== -semver@^6.0.0: - version "6.0.0" - resolved "https://registry.yarnpkg.com/semver/-/semver-6.0.0.tgz#05e359ee571e5ad7ed641a6eec1e547ba52dea65" - integrity sha512-0UewU+9rFapKFnlbirLi3byoOuhrSsli/z/ihNnvM24vgF+8sNBiI1LZPBSH9wJKUwaUbw+s3hToDLCXkrghrQ== +semver@^6.0.0, semver@^6.1.2, semver@^6.2.0, semver@^6.3.0: + version "6.3.0" + resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.0.tgz#ee0a64c8af5e8ceea67687b133761e1becbd1d3d" + integrity sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw== + +semver@~2.3.1: + version "2.3.2" + resolved "https://registry.yarnpkg.com/semver/-/semver-2.3.2.tgz#b9848f25d6cf36333073ec9ef8856d42f1233e52" + integrity sha1-uYSPJdbPNjMwc+ye+IVtQvEjPlI= semver@~5.3.0: version "5.3.0" resolved "https://registry.yarnpkg.com/semver/-/semver-5.3.0.tgz#9b2ce5d3de02d17c6012ad326aa6b4d0cf54f94f" + integrity sha1-myzl094C0XxgEq0yaqa00M9U+U8= + +serialize-javascript@^1.7.0: + version "1.9.1" + resolved "https://registry.yarnpkg.com/serialize-javascript/-/serialize-javascript-1.9.1.tgz#cfc200aef77b600c47da9bb8149c943e798c2fdb" + integrity sha512-0Vb/54WJ6k5v8sSWN09S0ora+Hnr+cX40r9F170nT+mSkaxltoE/7R3OrIdBSUv1OoiobH1QoWQbCnAO+e8J1A== set-blocking@^2.0.0, set-blocking@~2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/set-blocking/-/set-blocking-2.0.0.tgz#045f9782d011ae9a6803ddd382b24392b3d890f7" + integrity sha1-BF+XgtARrppoA93TgrJDkrPYkPc= -set-getter@^0.1.0: - version "0.1.0" - resolved "https://registry.yarnpkg.com/set-getter/-/set-getter-0.1.0.tgz#d769c182c9d5a51f409145f2fba82e5e86e80376" - dependencies: - to-object-path "^0.3.0" - -set-value@^0.4.3: - version "0.4.3" - resolved "https://registry.yarnpkg.com/set-value/-/set-value-0.4.3.tgz#7db08f9d3d22dc7f78e53af3c3bf4666ecdfccf1" - dependencies: - extend-shallow "^2.0.1" - is-extendable "^0.1.1" - is-plain-object "^2.0.1" - to-object-path "^0.3.0" - -set-value@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/set-value/-/set-value-2.0.0.tgz#71ae4a88f0feefbbf52d1ea604f3fb315ebb6274" +set-value@^2.0.0, set-value@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/set-value/-/set-value-2.0.1.tgz#a18d40530e6f07de4228c7defe4227af8cad005b" + integrity sha512-JxHc1weCN68wRY0fhCoXpyK55m/XPHafOmK4UWD7m2CI14GMcFypt4w/0+NV5f/ZMby2F6S2wwA7fgynh9gWSw== dependencies: extend-shallow "^2.0.1" is-extendable "^0.1.1" is-plain-object "^2.0.3" split-string "^3.0.1" -setimmediate@^1.0.4: - version "1.0.5" - resolved "https://registry.yarnpkg.com/setimmediate/-/setimmediate-1.0.5.tgz#290cbb232e306942d7d7ea9b83732ab7856f8285" - sha.js@^2.4.0, sha.js@^2.4.8, sha.js@~2.4.4: - version "2.4.10" - resolved "https://registry.yarnpkg.com/sha.js/-/sha.js-2.4.10.tgz#b1fde5cd7d11a5626638a07c604ab909cfa31f9b" + version "2.4.11" + resolved "https://registry.yarnpkg.com/sha.js/-/sha.js-2.4.11.tgz#37a5cf0b81ecbc6943de109ba2960d1b26584ae7" + integrity sha512-QMEp5B7cftE7APOjk5Y6xgrbWu+WkLVQwk8JNjZ8nKRciZaByEW6MubieAiToS7+dwvrjGhH8jRXz3MVd0AYqQ== dependencies: inherits "^2.0.1" safe-buffer "^5.0.1" +shallow-clone@^3.0.0: + version "3.0.1" + resolved "https://registry.yarnpkg.com/shallow-clone/-/shallow-clone-3.0.1.tgz#8f2981ad92531f55035b01fb230769a40e02efa3" + integrity sha512-/6KqX+GVUdqPuPPd2LxDDxzX6CAbjJehAAOKlNpqqUpAqPM6HeL8f+o3a+JsyGjn2lv0WY8UsTgUJjU9Ok55NA== + dependencies: + kind-of "^6.0.2" + +shasum-object@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/shasum-object/-/shasum-object-1.0.0.tgz#0b7b74ff5b66ecf9035475522fa05090ac47e29e" + integrity sha512-Iqo5rp/3xVi6M4YheapzZhhGPVs0yZwHj7wvwQ1B9z8H6zk+FEnI7y3Teq7qwnekfEhu8WmG2z0z4iWZaxLWVg== + dependencies: + fast-safe-stringify "^2.0.7" + shasum@^1.0.0: version "1.0.2" resolved "https://registry.yarnpkg.com/shasum/-/shasum-1.0.2.tgz#e7012310d8f417f4deb5712150e5678b87ae565f" + integrity sha1-5wEjENj0F/TetXEhUOVni4euVl8= dependencies: json-stable-stringify "~0.0.0" sha.js "~2.4.4" @@ -8530,47 +9508,61 @@ shasum@^1.0.0: shebang-command@^1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/shebang-command/-/shebang-command-1.2.0.tgz#44aac65b695b03398968c39f363fee5deafdf1ea" + integrity sha1-RKrGW2lbAzmJaMOfNj/uXer98eo= dependencies: shebang-regex "^1.0.0" +shebang-command@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/shebang-command/-/shebang-command-2.0.0.tgz#ccd0af4f8835fbdc265b82461aaf0c36663f34ea" + integrity sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA== + dependencies: + shebang-regex "^3.0.0" + shebang-regex@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-1.0.0.tgz#da42f49740c0b42db2ca9728571cb190c98efea3" + integrity sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM= + +shebang-regex@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-3.0.0.tgz#ae16f1644d873ecad843b0307b143362d4c42172" + integrity sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A== shell-quote@^1.6.1: - version "1.6.1" - resolved "https://registry.yarnpkg.com/shell-quote/-/shell-quote-1.6.1.tgz#f4781949cce402697127430ea3b3c5476f481767" - dependencies: - array-filter "~0.0.0" - array-map "~0.0.0" - array-reduce "~0.0.0" - jsonify "~0.0.0" + version "1.7.2" + resolved "https://registry.yarnpkg.com/shell-quote/-/shell-quote-1.7.2.tgz#67a7d02c76c9da24f99d20808fcaded0e0e04be2" + integrity sha512-mRz/m/JVscCrkMyPqHc/bczi3OQHkLTqXHEFu0zDhK/qfv3UcOA4SVmRCLmos4bhjr9ekVQubj/R7waKapmiQg== shellwords@^0.1.1: version "0.1.1" resolved "https://registry.yarnpkg.com/shellwords/-/shellwords-0.1.1.tgz#d6b9181c1a48d397324c84871efbcfc73fc0654b" + integrity sha512-vFwSUfQvqybiICwZY5+DAWIPLKsWO31Q91JSKl3UYv+K5c2QRPzn0qzec6QPu1Qc9eHYItiP3NdJqNVqetYAww== signal-exit@^3.0.0, signal-exit@^3.0.2: version "3.0.2" resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.2.tgz#b5fdc08f1287ea1178628e415e25132b73646c6d" + integrity sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0= -simple-git@^1.85.0: - version "1.107.0" - resolved "https://registry.yarnpkg.com/simple-git/-/simple-git-1.107.0.tgz#12cffaf261c14d6f450f7fdb86c21ccee968b383" - dependencies: - debug "^4.0.1" - -sisteransi@^1.0.0: +simple-concat@^1.0.0: version "1.0.0" - resolved "https://registry.yarnpkg.com/sisteransi/-/sisteransi-1.0.0.tgz#77d9622ff909080f1c19e5f4a1df0c1b0a27b88c" + resolved "https://registry.yarnpkg.com/simple-concat/-/simple-concat-1.0.0.tgz#7344cbb8b6e26fb27d66b2fc86f9f6d5997521c6" + integrity sha1-c0TLuLbib7J9ZrL8hvn21Zl1IcY= + +sisteransi@^1.0.3: + version "1.0.4" + resolved "https://registry.yarnpkg.com/sisteransi/-/sisteransi-1.0.4.tgz#386713f1ef688c7c0304dc4c0632898941cad2e3" + integrity sha512-/ekMoM4NJ59ivGSfKapeG+FWtrmWvA1p6FBZwXrqojw90vJu8lBmrTxCMuBCydKtkaUe2zt4PlxeTKpjwMbyig== slash@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/slash/-/slash-1.0.0.tgz#c41f2f6c39fc16d1cd17ad4b5d896114ae470d55" + integrity sha1-xB8vbDn8FtHNF61LXYlhFK5HDVU= slash@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/slash/-/slash-2.0.0.tgz#de552851a1759df3a8f206535442f5ec4ddeab44" + integrity sha512-ZYKh3Wh2z1PpEXWr0MpSBZ0V6mZHAQfYevttO11c51CaWjGTaadiKZ+wVt1PbMlDV5qhMFslpZCemhwOK7C89A== slash@^3.0.0: version "3.0.0" @@ -8580,6 +9572,7 @@ slash@^3.0.0: slice-ansi@0.0.4: version "0.0.4" resolved "https://registry.yarnpkg.com/slice-ansi/-/slice-ansi-0.0.4.tgz#edbf8903f66f7ce2f8eafd6ceed65e264c831b35" + integrity sha1-7b+JA/ZvfOL46v1s7tZeJkyDGzU= slice-ansi@^2.1.0: version "2.1.0" @@ -8593,14 +9586,17 @@ slice-ansi@^2.1.0: slide@^1.1.6: version "1.1.6" resolved "https://registry.yarnpkg.com/slide/-/slide-1.1.6.tgz#56eb027d65b4d2dce6cb2e2d32c4d4afc9e1d707" + integrity sha1-VusCfWW00tzmyy4tMsTUr8nh1wc= -smart-buffer@^4.0.1: - version "4.0.1" - resolved "https://registry.yarnpkg.com/smart-buffer/-/smart-buffer-4.0.1.tgz#07ea1ca8d4db24eb4cac86537d7d18995221ace3" +smart-buffer@^4.1.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/smart-buffer/-/smart-buffer-4.1.0.tgz#91605c25d91652f4661ea69ccf45f1b331ca21ba" + integrity sha512-iVICrxOzCynf/SNaBQCw34eM9jROU/s5rzIhpOvzhzuYHfJR/DhZfDkXiZSgKXfgv26HT3Yni3AV/DGw0cGnnw== snapdragon-node@^2.0.1: version "2.1.1" resolved "https://registry.yarnpkg.com/snapdragon-node/-/snapdragon-node-2.1.1.tgz#6c175f86ff14bdb0724563e8f3c1b021a286853b" + integrity sha512-O27l4xaMYt/RSQ5TR3vpWCAB5Kb/czIcqUFOM/C4fYcLnbZUc1PkjTAMjof2pBWaSTwOUd6qUHcFGVGj7aIwnw== dependencies: define-property "^1.0.0" isobject "^3.0.0" @@ -8609,12 +9605,14 @@ snapdragon-node@^2.0.1: snapdragon-util@^3.0.1: version "3.0.1" resolved "https://registry.yarnpkg.com/snapdragon-util/-/snapdragon-util-3.0.1.tgz#f956479486f2acd79700693f6f7b805e45ab56e2" + integrity sha512-mbKkMdQKsjX4BAL4bRYTj21edOf8cN7XHdYUJEe+Zn99hVEYcMvKPct1IqNe7+AZPirn8BCDOQBHQZknqmKlZQ== dependencies: kind-of "^3.2.0" snapdragon@^0.8.1: - version "0.8.1" - resolved "https://registry.yarnpkg.com/snapdragon/-/snapdragon-0.8.1.tgz#e12b5487faded3e3dea0ac91e9400bf75b401370" + version "0.8.2" + resolved "https://registry.yarnpkg.com/snapdragon/-/snapdragon-0.8.2.tgz#64922e7c565b0e14204ba1aa7d6964278d25182d" + integrity sha512-FtyOnWN/wCHTVXOMwvSv26d+ko5vWlIDD6zoUJ7LW8vh+ZBC8QdljveRP+crNrtBwioEUWy/4dMtbBjA4ioNlg== dependencies: base "^0.11.1" debug "^2.2.0" @@ -8623,45 +9621,46 @@ snapdragon@^0.8.1: map-cache "^0.2.2" source-map "^0.5.6" source-map-resolve "^0.5.0" - use "^2.0.0" + use "^3.1.0" socks-proxy-agent@^4.0.0: - version "4.0.1" - resolved "https://registry.yarnpkg.com/socks-proxy-agent/-/socks-proxy-agent-4.0.1.tgz#5936bf8b707a993079c6f37db2091821bffa6473" + version "4.0.2" + resolved "https://registry.yarnpkg.com/socks-proxy-agent/-/socks-proxy-agent-4.0.2.tgz#3c8991f3145b2799e70e11bd5fbc8b1963116386" + integrity sha512-NT6syHhI9LmuEMSK6Kd2V7gNv5KFZoLE7V5udWmn0de+3Mkj3UMA/AJPLyeNUVmElCurSHtUdM3ETpR3z770Wg== dependencies: - agent-base "~4.2.0" - socks "~2.2.0" + agent-base "~4.2.1" + socks "~2.3.2" -socks@~2.2.0: - version "2.2.2" - resolved "https://registry.yarnpkg.com/socks/-/socks-2.2.2.tgz#f061219fc2d4d332afb4af93e865c84d3fa26e2b" +socks@~2.3.2: + version "2.3.3" + resolved "https://registry.yarnpkg.com/socks/-/socks-2.3.3.tgz#01129f0a5d534d2b897712ed8aceab7ee65d78e3" + integrity sha512-o5t52PCNtVdiOvzMry7wU4aOqYWL0PeCXRWBEiJow4/i/wr+wpsJQ9awEu1EonLIqsfGd5qSgDdxEOvCdmBEpA== dependencies: - ip "^1.1.5" - smart-buffer "^4.0.1" + ip "1.1.5" + smart-buffer "^4.1.0" sort-keys@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/sort-keys/-/sort-keys-2.0.0.tgz#658535584861ec97d730d6cf41822e1f56684128" + integrity sha1-ZYU1WEhh7JfXMNbPQYIuH1ZoQSg= dependencies: is-plain-obj "^1.0.0" -source-list-map@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/source-list-map/-/source-list-map-2.0.0.tgz#aaa47403f7b245a92fbc97ea08f250d6087ed085" - source-map-resolve@^0.5.0: - version "0.5.1" - resolved "https://registry.yarnpkg.com/source-map-resolve/-/source-map-resolve-0.5.1.tgz#7ad0f593f2281598e854df80f19aae4b92d7a11a" + version "0.5.2" + resolved "https://registry.yarnpkg.com/source-map-resolve/-/source-map-resolve-0.5.2.tgz#72e2cc34095543e43b2c62b2c4c10d4a9054f259" + integrity sha512-MjqsvNwyz1s0k81Goz/9vRBe9SZdB09Bdw+/zYyO+3CuPk6fouTaxscHkgtE8jKvf01kVfl8riHzERQ/kefaSA== dependencies: - atob "^2.0.0" + atob "^2.1.1" decode-uri-component "^0.2.0" resolve-url "^0.2.1" source-map-url "^0.4.0" urix "^0.1.0" -source-map-support@^0.5.6, source-map-support@^0.5.9: - version "0.5.9" - resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.9.tgz#41bc953b2534267ea2d605bccfa7bfa3111ced5f" +source-map-support@^0.5.16, source-map-support@^0.5.6, source-map-support@~0.5.12: + version "0.5.16" + resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.16.tgz#0ae069e7fe3ba7538c64c98515e35339eac5a042" + integrity sha512-efyLRJDr68D9hBBNIPWFjhpFzURh+KJykQwvMyW5UiZzYwoF6l4YMMDIJJEyFWxWCqfyxLzz6tSfUFR+kXXsVQ== dependencies: buffer-from "^1.0.0" source-map "^0.6.0" @@ -8669,120 +9668,136 @@ source-map-support@^0.5.6, source-map-support@^0.5.9: source-map-url@^0.4.0: version "0.4.0" resolved "https://registry.yarnpkg.com/source-map-url/-/source-map-url-0.4.0.tgz#3e935d7ddd73631b97659956d55128e87b5084a3" + integrity sha1-PpNdfd1zYxuXZZlW1VEo6HtQhKM= -source-map@0.5.x, source-map@^0.5.0, source-map@^0.5.1, source-map@^0.5.3, source-map@^0.5.6, source-map@~0.5.0, source-map@~0.5.1, source-map@~0.5.3: +source-map@^0.5.0, source-map@^0.5.1, source-map@^0.5.6, source-map@~0.5.3: version "0.5.7" resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.5.7.tgz#8a039d2d1021d22d1ea14c80d8ea468ba2ef3fcc" + integrity sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w= source-map@^0.6.0, source-map@^0.6.1, source-map@~0.6.1: version "0.6.1" resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263" + integrity sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g== source-map@~0.4.0, source-map@~0.4.2: version "0.4.4" resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.4.4.tgz#eba4f5da9c0dc999de68032d8b4f76173652036b" + integrity sha1-66T12pwNyZneaAMti092FzZSA2s= dependencies: amdefine ">=0.0.4" sourcemap-codec@^1.4.4: - version "1.4.4" - resolved "https://registry.yarnpkg.com/sourcemap-codec/-/sourcemap-codec-1.4.4.tgz#c63ea927c029dd6bd9a2b7fa03b3fec02ad56e9f" - integrity sha512-CYAPYdBu34781kLHkaW3m6b/uUSyMOC2R61gcYMWooeuaGtjof86ZA/8T+qVPPt7np1085CR9hmMGrySwEc8Xg== + version "1.4.6" + resolved "https://registry.yarnpkg.com/sourcemap-codec/-/sourcemap-codec-1.4.6.tgz#e30a74f0402bad09807640d39e971090a08ce1e9" + integrity sha512-1ZooVLYFxC448piVLBbtOxFcXwnymH9oUF8nRd3CuYDVvkRBxRl6pB4Mtas5a4drtL+E8LDgFkQNcgIw6tc8Hg== sparkles@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/sparkles/-/sparkles-1.0.0.tgz#1acbbfb592436d10bbe8f785b7cc6f82815012c3" + version "1.0.1" + resolved "https://registry.yarnpkg.com/sparkles/-/sparkles-1.0.1.tgz#008db65edce6c50eec0c5e228e1945061dd0437c" + integrity sha512-dSO0DDYUahUt/0/pD/Is3VIm5TGJjludZ0HVymmhYF6eNA53PVLhnUk0znSYbH8IYBuJdCE+1luR22jNLMaQdw== spdx-correct@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/spdx-correct/-/spdx-correct-3.0.0.tgz#05a5b4d7153a195bc92c3c425b69f3b2a9524c82" + version "3.1.0" + resolved "https://registry.yarnpkg.com/spdx-correct/-/spdx-correct-3.1.0.tgz#fb83e504445268f154b074e218c87c003cd31df4" + integrity sha512-lr2EZCctC2BNR7j7WzJ2FpDznxky1sjfxvvYEyzxNyb6lZXHODmEoJeFu4JupYlkfha1KZpJyoqiJ7pgA1qq8Q== dependencies: spdx-expression-parse "^3.0.0" spdx-license-ids "^3.0.0" spdx-exceptions@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/spdx-exceptions/-/spdx-exceptions-2.1.0.tgz#2c7ae61056c714a5b9b9b2b2af7d311ef5c78fe9" + version "2.2.0" + resolved "https://registry.yarnpkg.com/spdx-exceptions/-/spdx-exceptions-2.2.0.tgz#2ea450aee74f2a89bfb94519c07fcd6f41322977" + integrity sha512-2XQACfElKi9SlVb1CYadKDXvoajPgBVPn/gOQLrTvHdElaVhr7ZEbqJaRnJLVNeaI4cMEAgVCeBMKF6MWRDCRA== spdx-expression-parse@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/spdx-expression-parse/-/spdx-expression-parse-3.0.0.tgz#99e119b7a5da00e05491c9fa338b7904823b41d0" + integrity sha512-Yg6D3XpRD4kkOmTpdgbUiEJFKghJH03fiC1OPll5h/0sO6neh2jqRDVHOQ4o/LMea0tgCkbMgea5ip/e+MkWyg== dependencies: spdx-exceptions "^2.1.0" spdx-license-ids "^3.0.0" spdx-license-ids@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/spdx-license-ids/-/spdx-license-ids-3.0.0.tgz#7a7cd28470cc6d3a1cfe6d66886f6bc430d3ac87" + version "3.0.5" + resolved "https://registry.yarnpkg.com/spdx-license-ids/-/spdx-license-ids-3.0.5.tgz#3694b5804567a458d3c8045842a6358632f62654" + integrity sha512-J+FWzZoynJEXGphVIS+XEh3kFSjZX/1i9gFBaWQcB+/tmpe2qUsSBABpcxqxnAxFdiUFEgAX1bjYGQvIZmoz9Q== split-string@^3.0.1, split-string@^3.0.2: version "3.1.0" resolved "https://registry.yarnpkg.com/split-string/-/split-string-3.1.0.tgz#7cb09dda3a86585705c64b39a6466038682e8fe2" + integrity sha512-NzNVhJDYpwceVVii8/Hu6DKfD2G+NrQHlS/V/qgv763EYudVwEcMQNxd2lh+0VrUByXN/oJkl5grOhYWvQUYiw== dependencies: extend-shallow "^3.0.0" split2@^2.0.0: version "2.2.0" resolved "https://registry.yarnpkg.com/split2/-/split2-2.2.0.tgz#186b2575bcf83e85b7d18465756238ee4ee42493" + integrity sha512-RAb22TG39LhI31MbreBgIuKiIKhVsawfTgEGqKHTK87aG+ul/PB8Sqoi3I7kVdRWiCfrKxK3uo4/YUkpNvhPbw== dependencies: through2 "^2.0.2" split@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/split/-/split-1.0.1.tgz#605bd9be303aa59fb35f9229fbea0ddec9ea07d9" + integrity sha512-mTyOoPbrivtXnwnIxZRFYRrPNtEFKlpB2fvjSnCQUiAA6qAZzqwna5envK4uk6OIeP17CsdF3rSBGYVBsU0Tkg== dependencies: through "2" sprintf-js@~1.0.2: version "1.0.3" resolved "https://registry.yarnpkg.com/sprintf-js/-/sprintf-js-1.0.3.tgz#04e6926f662895354f3dd015203633b857297e2c" + integrity sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw= sshpk@^1.7.0: - version "1.13.1" - resolved "https://registry.yarnpkg.com/sshpk/-/sshpk-1.13.1.tgz#512df6da6287144316dc4c18fe1cf1d940739be3" + version "1.16.1" + resolved "https://registry.yarnpkg.com/sshpk/-/sshpk-1.16.1.tgz#fb661c0bef29b39db40769ee39fa70093d6f6877" + integrity sha512-HXXqVUq7+pcKeLqqZj6mHFUMvXtOJt1uoUx09pFW6011inTMxqI8BA8PM95myrIyyKwdnzjdFjLiE6KBPVtJIg== dependencies: asn1 "~0.2.3" assert-plus "^1.0.0" - dashdash "^1.12.0" - getpass "^0.1.1" - optionalDependencies: bcrypt-pbkdf "^1.0.0" + dashdash "^1.12.0" ecc-jsbn "~0.1.1" + getpass "^0.1.1" jsbn "~0.1.0" + safer-buffer "^2.0.2" tweetnacl "~0.14.0" ssri@^6.0.0, ssri@^6.0.1: version "6.0.1" resolved "https://registry.yarnpkg.com/ssri/-/ssri-6.0.1.tgz#2a3c41b28dd45b62b63676ecb74001265ae9edd8" + integrity sha512-3Wge10hNcT1Kur4PDFwEieXSCMCJs/7WvSACcrMYrNp+b8kDL1/0wJch5Ni2WrtwEa2IO8OsVfeKIciKCDx/QA== dependencies: figgy-pudding "^3.5.1" stack-trace@0.0.10: version "0.0.10" resolved "https://registry.yarnpkg.com/stack-trace/-/stack-trace-0.0.10.tgz#547c70b347e8d32b4e108ea1a2a159e5fdde19c0" + integrity sha1-VHxws0fo0ytOEI6hoqFZ5f3eGcA= stack-utils@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/stack-utils/-/stack-utils-1.0.1.tgz#d4f33ab54e8e38778b0ca5cfd3b3afb12db68620" - -staged-git-files@1.1.2: - version "1.1.2" - resolved "https://registry.yarnpkg.com/staged-git-files/-/staged-git-files-1.1.2.tgz#4326d33886dc9ecfa29a6193bf511ba90a46454b" + version "1.0.2" + resolved "https://registry.yarnpkg.com/stack-utils/-/stack-utils-1.0.2.tgz#33eba3897788558bebfc2db059dc158ec36cebb8" + integrity sha512-MTX+MeG5U994cazkjd/9KNAapsHnibjMLnfXodlkXw76JEea0UiNzrqidzo1emMwk7w5Qhc9jd4Bn9TBb1MFwA== static-extend@^0.1.1: version "0.1.2" resolved "https://registry.yarnpkg.com/static-extend/-/static-extend-0.1.2.tgz#60809c39cbff55337226fd5e0b520f341f1fb5c6" + integrity sha1-YICcOcv/VTNyJv1eC1IPNB8ftcY= dependencies: define-property "^0.2.5" object-copy "^0.1.0" -stealthy-require@^1.1.0: +stealthy-require@^1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/stealthy-require/-/stealthy-require-1.1.1.tgz#35b09875b4ff49f26a777e509b3090a3226bf24b" + integrity sha1-NbCYdbT/SfJqd35QmzCQoyJr8ks= -stream-browserify@^2.0.0, stream-browserify@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/stream-browserify/-/stream-browserify-2.0.1.tgz#66266ee5f9bdb9940a4e4514cafb43bb71e5c9db" +stream-browserify@^2.0.0: + version "2.0.2" + resolved "https://registry.yarnpkg.com/stream-browserify/-/stream-browserify-2.0.2.tgz#87521d38a44aa7ee91ce1cd2a47df0cb49dd660b" + integrity sha512-nX6hmklHs/gr2FuxYDltq8fJA1GDlxKQCz8O/IM4atRqBH8OORmBNgfvW5gG10GT/qQ9u0CzIvr2X5Pkt6ntqg== dependencies: inherits "~2.0.1" readable-stream "^2.0.2" @@ -8790,6 +9805,7 @@ stream-browserify@^2.0.0, stream-browserify@^2.0.1: stream-combiner2@^1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/stream-combiner2/-/stream-combiner2-1.1.1.tgz#fb4d8a1420ea362764e21ad4780397bebcb41cbe" + integrity sha1-+02KFCDqNidk4hrUeAOXvry0HL4= dependencies: duplexer2 "~0.1.0" readable-stream "^2.0.2" @@ -8797,6 +9813,7 @@ stream-combiner2@^1.1.1: stream-each@^1.1.0: version "1.2.3" resolved "https://registry.yarnpkg.com/stream-each/-/stream-each-1.2.3.tgz#ebe27a0c389b04fbcc233642952e10731afa9bae" + integrity sha512-vlMC2f8I2u/bZGqkdfLQW/13Zihpej/7PmSiMQsbYddxuTsJp8vRe2x2FvVExZg7FaOds43ROAuFJwPR4MTZLw== dependencies: end-of-stream "^1.1.0" stream-shift "^1.0.0" @@ -8804,24 +9821,27 @@ stream-each@^1.1.0: stream-exhaust@^1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/stream-exhaust/-/stream-exhaust-1.0.2.tgz#acdac8da59ef2bc1e17a2c0ccf6c320d120e555d" + integrity sha512-b/qaq/GlBK5xaq1yrK9/zFcyRSTNxmcZwFLGSTG0mXgZl/4Z6GgiyYOXOvY7N3eEvFRAG1bkDRz5EPGSvPYQlw== -stream-http@^2.0.0, stream-http@^2.7.2: - version "2.8.0" - resolved "https://registry.yarnpkg.com/stream-http/-/stream-http-2.8.0.tgz#fd86546dac9b1c91aff8fc5d287b98fafb41bc10" +stream-http@^3.0.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/stream-http/-/stream-http-3.1.0.tgz#22fb33fe9b4056b4eccf58bd8f400c4b993ffe57" + integrity sha512-cuB6RgO7BqC4FBYzmnvhob5Do3wIdIsXAgGycHJnW+981gHqoYcYz9lqjJrk8WXRddbwPuqPYRl+bag6mYv4lw== dependencies: builtin-status-codes "^3.0.0" inherits "^2.0.1" - readable-stream "^2.3.3" - to-arraybuffer "^1.0.0" + readable-stream "^3.0.6" xtend "^4.0.0" stream-shift@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/stream-shift/-/stream-shift-1.0.0.tgz#d5c752825e5367e786f78e18e445ea223a155952" + integrity sha1-1cdSgl5TZ+eG944Y5EXqIjoVWVI= stream-splicer@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/stream-splicer/-/stream-splicer-2.0.0.tgz#1b63be438a133e4b671cc1935197600175910d83" + version "2.0.1" + resolved "https://registry.yarnpkg.com/stream-splicer/-/stream-splicer-2.0.1.tgz#0b13b7ee2b5ac7e0609a7463d83899589a363fcd" + integrity sha512-Xizh4/NPuYSyAXyT7g8IvdJ9HJpxIGL9PjyhtywCZvvP0OPIdqyrr4dMikeuvY8xahpdKEBlBTySe583totajg== dependencies: inherits "^2.0.1" readable-stream "^2.0.2" @@ -8829,91 +9849,148 @@ stream-splicer@^2.0.0: streamfilter@^1.0.5: version "1.0.7" resolved "https://registry.yarnpkg.com/streamfilter/-/streamfilter-1.0.7.tgz#ae3e64522aa5a35c061fd17f67620c7653c643c9" + integrity sha512-Gk6KZM+yNA1JpW0KzlZIhjo3EaBJDkYfXtYSbOwNIQ7Zd6006E6+sCFlW1NDvFG/vnXhKmw6TJJgiEQg/8lXfQ== dependencies: readable-stream "^2.0.2" -string-argv@^0.0.2: - version "0.0.2" - resolved "https://registry.yarnpkg.com/string-argv/-/string-argv-0.0.2.tgz#dac30408690c21f3c3630a3ff3a05877bdcbd736" +string-argv@^0.3.0: + version "0.3.1" + resolved "https://registry.yarnpkg.com/string-argv/-/string-argv-0.3.1.tgz#95e2fbec0427ae19184935f816d74aaa4c5c19da" + integrity sha512-a1uQGz7IyVy9YwhqjZIZu1c8JO8dNIe20xBmSS6qu9kv++k3JGzCVmprbNN5Kn+BgzD5E7YYwg1CcjuJMRNsvg== string-length@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/string-length/-/string-length-2.0.0.tgz#d40dbb686a3ace960c1cffca562bf2c45f8363ed" + integrity sha1-1A27aGo6zpYMHP/KVivyxF+DY+0= dependencies: astral-regex "^1.0.0" strip-ansi "^4.0.0" +string-range@~1.2, string-range@~1.2.1: + version "1.2.2" + resolved "https://registry.yarnpkg.com/string-range/-/string-range-1.2.2.tgz#a893ed347e72299bc83befbbf2a692a8d239d5dd" + integrity sha1-qJPtNH5yKZvIO++78qaSqNI51d0= + string-width@^1.0.1, string-width@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/string-width/-/string-width-1.0.2.tgz#118bdf5b8cdc51a2a7e70d211e07e2b0b9b107d3" + integrity sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M= dependencies: code-point-at "^1.0.0" is-fullwidth-code-point "^1.0.0" strip-ansi "^3.0.0" -string-width@^2.0.0, string-width@^2.1.0, string-width@^2.1.1: +"string-width@^1.0.2 || 2", string-width@^2.1.0, string-width@^2.1.1: version "2.1.1" resolved "https://registry.yarnpkg.com/string-width/-/string-width-2.1.1.tgz#ab93f27a8dc13d28cac815c462143a6d9012ae9e" + integrity sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw== dependencies: is-fullwidth-code-point "^2.0.0" strip-ansi "^4.0.0" -string-width@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/string-width/-/string-width-3.0.0.tgz#5a1690a57cc78211fffd9bf24bbe24d090604eb1" - integrity sha512-rr8CUxBbvOZDUvc5lNIJ+OC1nPVpz+Siw9VBtUjB9b6jZehZLFt0JMCZzShFHIsI8cbhm0EsNIfWJMFV3cu3Ew== +string-width@^3.0.0, string-width@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/string-width/-/string-width-3.1.0.tgz#22767be21b62af1081574306f69ac51b62203961" + integrity sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w== dependencies: emoji-regex "^7.0.1" is-fullwidth-code-point "^2.0.0" - strip-ansi "^5.0.0" + strip-ansi "^5.1.0" + +string-width@^4.1.0: + version "4.2.0" + resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.0.tgz#952182c46cc7b2c313d1596e623992bd163b72b5" + integrity sha512-zUz5JD+tgqtuDjMhwIg5uFVV3dtqZ9yQJlZVfq4I01/K5Paj5UHj7VyrQOJvzawSVlKpObApbfD0Ed6yJc+1eg== + dependencies: + emoji-regex "^8.0.0" + is-fullwidth-code-point "^3.0.0" + strip-ansi "^6.0.0" string.prototype.padend@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/string.prototype.padend/-/string.prototype.padend-3.0.0.tgz#f3aaef7c1719f170c5eab1c32bf780d96e21f2f0" + integrity sha1-86rvfBcZ8XDF6rHDK/eA2W4h8vA= dependencies: define-properties "^1.1.2" es-abstract "^1.4.3" function-bind "^1.0.2" -string_decoder@^1.0.0, string_decoder@^1.1.1, string_decoder@~1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.1.1.tgz#9cf1611ba62685d7030ae9e4ba34149c3af03fc8" +string.prototype.trimleft@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/string.prototype.trimleft/-/string.prototype.trimleft-2.1.0.tgz#6cc47f0d7eb8d62b0f3701611715a3954591d634" + integrity sha512-FJ6b7EgdKxxbDxc79cOlok6Afd++TTs5szo+zJTUyow3ycrRfJVE2pq3vcN53XexvKZu/DJMDfeI/qMiZTrjTw== dependencies: - safe-buffer "~5.1.0" + define-properties "^1.1.3" + function-bind "^1.1.1" + +string.prototype.trimright@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/string.prototype.trimright/-/string.prototype.trimright-2.1.0.tgz#669d164be9df9b6f7559fa8e89945b168a5a6c58" + integrity sha512-fXZTSV55dNBwv16uw+hh5jkghxSnc5oHq+5K/gXgizHwAvMetdAJlHqqoFC1FSDVPYWLkAKl2cxpUT41sV7nSg== + dependencies: + define-properties "^1.1.3" + function-bind "^1.1.1" + +string_decoder@^1.1.1: + version "1.3.0" + resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.3.0.tgz#42f114594a46cf1a8e30b0a84f56c78c3edac21e" + integrity sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA== + dependencies: + safe-buffer "~5.2.0" string_decoder@~0.10.x: version "0.10.31" resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-0.10.31.tgz#62e203bc41766c6c28c9fc84301dab1c5310fa94" + integrity sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ= -stringify-object@^3.2.2: - version "3.2.2" - resolved "https://registry.yarnpkg.com/stringify-object/-/stringify-object-3.2.2.tgz#9853052e5a88fb605a44cd27445aa257ad7ffbcd" +string_decoder@~1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.1.1.tgz#9cf1611ba62685d7030ae9e4ba34149c3af03fc8" + integrity sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg== dependencies: - get-own-enumerable-property-symbols "^2.0.1" + safe-buffer "~5.1.0" + +stringify-object@^3.3.0: + version "3.3.0" + resolved "https://registry.yarnpkg.com/stringify-object/-/stringify-object-3.3.0.tgz#703065aefca19300d3ce88af4f5b3956d7556629" + integrity sha512-rHqiFh1elqCQ9WPLIC8I0Q/g/wj5J1eMkyoiD6eoQApWHP0FtlK7rqnhmabL5VUY9JQCcqwwvlOaSuutekgyrw== + dependencies: + get-own-enumerable-property-symbols "^3.0.0" is-obj "^1.0.1" is-regexp "^1.0.0" strip-ansi@^3.0.0, strip-ansi@^3.0.1: version "3.0.1" resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-3.0.1.tgz#6a385fb8853d952d5ff05d0e8aaf94278dc63dcf" + integrity sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8= dependencies: ansi-regex "^2.0.0" strip-ansi@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-4.0.0.tgz#a8479022eb1ac368a871389b635262c505ee368f" + integrity sha1-qEeQIusaw2iocTibY1JixQXuNo8= dependencies: ansi-regex "^3.0.0" -strip-ansi@^5.0.0: - version "5.0.0" - resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-5.0.0.tgz#f78f68b5d0866c20b2c9b8c61b5298508dc8756f" +strip-ansi@^5.0.0, strip-ansi@^5.1.0, strip-ansi@^5.2.0: + version "5.2.0" + resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-5.2.0.tgz#8c9a536feb6afc962bdfa5b104a5091c1ad9c0ae" + integrity sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA== dependencies: - ansi-regex "^4.0.0" + ansi-regex "^4.1.0" + +strip-ansi@^6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.0.tgz#0b1571dd7669ccd4f3e06e14ef1eed26225ae532" + integrity sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w== + dependencies: + ansi-regex "^5.0.0" strip-bom-stream@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/strip-bom-stream/-/strip-bom-stream-2.0.0.tgz#f87db5ef2613f6968aa545abfe1ec728b6a829ca" + integrity sha1-+H217yYT9paKpUWr/h7HKLaoKco= dependencies: first-chunk-stream "^2.0.0" strip-bom "^2.0.0" @@ -8921,34 +9998,51 @@ strip-bom-stream@^2.0.0: strip-bom@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/strip-bom/-/strip-bom-2.0.0.tgz#6219a85616520491f35788bdbf1447a99c7e6b0e" + integrity sha1-YhmoVhZSBJHzV4i9vxRHqZx+aw4= dependencies: is-utf8 "^0.2.0" strip-bom@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/strip-bom/-/strip-bom-3.0.0.tgz#2334c18e9c759f7bdd56fdef7e9ae3d588e68ed3" + integrity sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM= strip-eof@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/strip-eof/-/strip-eof-1.0.0.tgz#bb43ff5598a6eb05d89b59fcd129c983313606bf" + integrity sha1-u0P/VZim6wXYm1n80SnJgzE2Br8= + +strip-final-newline@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/strip-final-newline/-/strip-final-newline-2.0.0.tgz#89b852fb2fcbe936f6f4b3187afb0a12c1ab58ad" + integrity sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA== strip-indent@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/strip-indent/-/strip-indent-1.0.1.tgz#0c7962a6adefa7bbd4ac366460a638552ae1a0a2" + integrity sha1-DHlipq3vp7vUrDZkYKY4VSrhoKI= dependencies: get-stdin "^4.0.1" strip-indent@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/strip-indent/-/strip-indent-2.0.0.tgz#5ef8db295d01e6ed6cbf7aab96998d7822527b68" + integrity sha1-XvjbKV0B5u1sv3qrlpmNeCJSe2g= + +strip-json-comments@^3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-3.0.1.tgz#85713975a91fb87bf1b305cca77395e40d2a64a7" + integrity sha512-VTyMAUfdm047mwKl+u79WIdrZxtFtn+nBxHeb844XBQ9uMNTuTHdx2hc5RiAJYqwTj3wc/xe5HLSdJSkJ+WfZw== -strip-json-comments@^2.0.1, strip-json-comments@~2.0.1: +strip-json-comments@~2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-2.0.1.tgz#3c531942e908c2697c0ec344858c286c7ca0a60a" + integrity sha1-PFMZQukIwml8DsNEhYwobHygpgo= strong-log-transformer@^2.0.0: version "2.1.0" resolved "https://registry.yarnpkg.com/strong-log-transformer/-/strong-log-transformer-2.1.0.tgz#0f5ed78d325e0421ac6f90f7f10e691d6ae3ae10" + integrity sha512-B3Hgul+z0L9a236FAUC9iZsL+nVHgoCJnqCbN588DjYxvGXaXaaFbfmQ/JhvKjZwsOukuR72XbHv71Qkug0HxA== dependencies: duplexer "^0.1.1" minimist "^1.2.0" @@ -8957,34 +10051,33 @@ strong-log-transformer@^2.0.0: subarg@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/subarg/-/subarg-1.0.0.tgz#f62cf17581e996b48fc965699f54c06ae268b8d2" + integrity sha1-9izxdYHplrSPyWVpn1TAauJouNI= dependencies: minimist "^1.1.0" supports-color@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-2.0.0.tgz#535d045ce6b6363fa40117084629995e9df324c7" + integrity sha1-U10EXOa2Nj+kARcIRimZXp3zJMc= -supports-color@^4.2.1: - version "4.5.0" - resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-4.5.0.tgz#be7a0de484dec5c5cddf8b3d59125044912f635b" - dependencies: - has-flag "^2.0.0" - -supports-color@^5.2.0, supports-color@^5.3.0: - version "5.3.0" - resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-5.3.0.tgz#5b24ac15db80fa927cf5227a4a33fd3c4c7676c0" +supports-color@^5.3.0: + version "5.5.0" + resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-5.5.0.tgz#e2e69a44ac8772f78a1ec0b35b689df6530efc8f" + integrity sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow== dependencies: has-flag "^3.0.0" -supports-color@^6.0.0, supports-color@^6.1.0: +supports-color@^6.1.0: version "6.1.0" resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-6.1.0.tgz#0764abc69c63d5ac842dd4867e8d025e880df8f3" + integrity sha512-qe1jfm1Mg7Nq/NSh6XE24gPXROEVsWHxC1LIx//XNlD9iw7YZQGjZNjYN7xGaEG6iKdA8EtNFW6R0gjnVXp+wQ== dependencies: has-flag "^3.0.0" sver-compat@^1.5.0: version "1.5.0" resolved "https://registry.yarnpkg.com/sver-compat/-/sver-compat-1.5.0.tgz#3cf87dfeb4d07b4a3f14827bc186b3fd0c645cd8" + integrity sha1-PPh9/rTQe0o/FIJ7wYaz/QxkXNg= dependencies: es6-iterator "^2.0.1" es6-symbol "^3.1.1" @@ -8992,55 +10085,57 @@ sver-compat@^1.5.0: symbol-observable@^1.1.0: version "1.2.0" resolved "https://registry.yarnpkg.com/symbol-observable/-/symbol-observable-1.2.0.tgz#c22688aed4eab3cdc2dfeacbb561660560a00804" + integrity sha512-e900nM8RRtGhlV36KGEU9k65K3mPb1WV70OdjfxlG2EAuM1noi/E/BaW/uMhL7bPEssK8QV57vN3esixjUvcXQ== symbol-tree@^3.2.2: - version "3.2.2" - resolved "https://registry.yarnpkg.com/symbol-tree/-/symbol-tree-3.2.2.tgz#ae27db38f660a7ae2e1c3b7d1bc290819b8519e6" - -synchronous-promise@^2.0.6: - version "2.0.8" - resolved "https://registry.yarnpkg.com/synchronous-promise/-/synchronous-promise-2.0.8.tgz#01fd026fffdbf2d3d39ec06ee1a7c971578136f7" - integrity sha512-xYavZtFC1vKgJu0AOSYdrLeikNCsNwmUeZaV1XF9cMqEhBVVxLq6rEbYzOGrF1MV2MNPkhsJqqiXuQ4a76CEUg== + version "3.2.4" + resolved "https://registry.yarnpkg.com/symbol-tree/-/symbol-tree-3.2.4.tgz#430637d248ba77e078883951fb9aa0eed7c63fa2" + integrity sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw== syntax-error@^1.1.1: version "1.4.0" resolved "https://registry.yarnpkg.com/syntax-error/-/syntax-error-1.4.0.tgz#2d9d4ff5c064acb711594a3e3b95054ad51d907c" + integrity sha512-YPPlu67mdnHGTup2A8ff7BC2Pjq0e0Yp/IyTFN03zWO0RcK07uLcbi7C2KpGR2FvWbaB0+bfE27a+sBKebSo7w== dependencies: acorn-node "^1.2.0" table@^5.2.3: - version "5.2.3" - resolved "https://registry.yarnpkg.com/table/-/table-5.2.3.tgz#cde0cc6eb06751c009efab27e8c820ca5b67b7f2" - integrity sha512-N2RsDAMvDLvYwFcwbPyF3VmVSSkuF+G1e+8inhBLtHpvwXGw4QRPEZhihQNeEN0i1up6/f6ObCJXNdlRG3YVyQ== + version "5.4.6" + resolved "https://registry.yarnpkg.com/table/-/table-5.4.6.tgz#1292d19500ce3f86053b05f0e8e7e4a3bb21079e" + integrity sha512-wmEc8m4fjnob4gt5riFRtTu/6+4rSe12TpAELNSqHMfF3IqnA+CH37USM6/YR3qRZv7e56kAEAtd6nKZaxe0Ug== dependencies: - ajv "^6.9.1" - lodash "^4.17.11" + ajv "^6.10.2" + lodash "^4.17.14" slice-ansi "^2.1.0" string-width "^3.0.0" tapable@^0.2.7: - version "0.2.8" - resolved "https://registry.yarnpkg.com/tapable/-/tapable-0.2.8.tgz#99372a5c999bf2df160afc0d74bed4f47948cd22" + version "0.2.9" + resolved "https://registry.yarnpkg.com/tapable/-/tapable-0.2.9.tgz#af2d8bbc9b04f74ee17af2b4d9048f807acd18a8" + integrity sha512-2wsvQ+4GwBvLPLWsNfLCDYGsW6xb7aeC6utq2Qh0PFwgEy7K7dsma9Jsmb2zSQj7GvYAyUGSntLtsv++GmgL1A== -tar@^4, tar@^4.4.8: - version "4.4.8" - resolved "https://registry.yarnpkg.com/tar/-/tar-4.4.8.tgz#b19eec3fde2a96e64666df9fdb40c5ca1bc3747d" +tar@^4, tar@^4.4.10, tar@^4.4.12, tar@^4.4.8: + version "4.4.13" + resolved "https://registry.yarnpkg.com/tar/-/tar-4.4.13.tgz#43b364bc52888d555298637b10d60790254ab525" + integrity sha512-w2VwSrBoHa5BsSyH+KxEqeQBAllHhccyMFVHtGtdMpF4W7IRWfZjFiQceJPChOeTsSDVUpER2T8FA93pr0L+QA== dependencies: chownr "^1.1.1" fs-minipass "^1.2.5" - minipass "^2.3.4" - minizlib "^1.1.1" + minipass "^2.8.6" + minizlib "^1.2.1" mkdirp "^0.5.0" safe-buffer "^5.1.2" - yallist "^3.0.2" + yallist "^3.0.3" temp-dir@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/temp-dir/-/temp-dir-1.0.0.tgz#0a7c0ea26d3a39afa7e0ebea9c1fc0bc4daa011d" + integrity sha1-CnwOom06Oa+n4OvqnB/AvE2qAR0= temp-write@^3.4.0: version "3.4.0" resolved "https://registry.yarnpkg.com/temp-write/-/temp-write-3.4.0.tgz#8cff630fb7e9da05f047c74ce4ce4d685457d492" + integrity sha1-jP9jD7fp2gXwR8dM5M5NaFRX1JI= dependencies: graceful-fs "^4.1.2" is-stream "^1.1.0" @@ -9049,44 +10144,66 @@ temp-write@^3.4.0: temp-dir "^1.0.0" uuid "^3.0.1" -test-exclude@^5.0.0: - version "5.0.0" - resolved "https://registry.yarnpkg.com/test-exclude/-/test-exclude-5.0.0.tgz#cdce7cece785e0e829cd5c2b27baf18bc583cfb7" +terser@^4.1.0: + version "4.4.2" + resolved "https://registry.yarnpkg.com/terser/-/terser-4.4.2.tgz#448fffad0245f4c8a277ce89788b458bfd7706e8" + integrity sha512-Uufrsvhj9O1ikwgITGsZ5EZS6qPokUOkCegS7fYOdGTv+OA90vndUbU6PEjr5ePqHfNUbGyMO7xyIZv2MhsALQ== dependencies: - arrify "^1.0.1" + commander "^2.20.0" + source-map "~0.6.1" + source-map-support "~0.5.12" + +test-exclude@^5.2.3: + version "5.2.3" + resolved "https://registry.yarnpkg.com/test-exclude/-/test-exclude-5.2.3.tgz#c3d3e1e311eb7ee405e092dac10aefd09091eac0" + integrity sha512-M+oxtseCFO3EDtAaGH7iiej3CBkzXqFMbzqYAACdzKui4eZA+pq3tZEwChvOdNfa7xxy8BfbmgJSIr43cC/+2g== + dependencies: + glob "^7.1.3" minimatch "^3.0.4" read-pkg-up "^4.0.0" - require-main-filename "^1.0.1" + require-main-filename "^2.0.0" -test262-parser@^2.0.7: - version "2.0.7" - resolved "https://registry.yarnpkg.com/test262-parser/-/test262-parser-2.0.7.tgz#733b46bf7759e747eae34b5b14d6a3c8d2082add" +test262-stream@^1.3.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/test262-stream/-/test262-stream-1.3.0.tgz#98c4ab9f8e74c7f9478afcf52e071a89d319df61" + integrity sha512-TSv+Z4hftmRuUJVJk7kaguWLlVLRfwyWm1DOt4kvTXAanATxv6A1HhjRTrSBI00XXEWQ+cUdsDii8tn+fkjXyw== dependencies: js-yaml "^3.2.1" - through "^2.3.4" - -test262-stream@^1.2.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/test262-stream/-/test262-stream-1.2.0.tgz#37f03bf56672ec0f0120596372ea98313309d32e" - dependencies: klaw "^2.1.0" - test262-parser "^2.0.7" text-extensions@^1.0.0: - version "1.7.0" - resolved "https://registry.yarnpkg.com/text-extensions/-/text-extensions-1.7.0.tgz#faaaba2625ed746d568a23e4d0aacd9bf08a8b39" + version "1.9.0" + resolved "https://registry.yarnpkg.com/text-extensions/-/text-extensions-1.9.0.tgz#1853e45fee39c945ce6f6c36b2d659b5aabc2a26" + integrity sha512-wiBrwC1EhBelW12Zy26JeOUkQ5mRu+5o8rpsJk5+2t+Y5vE7e842qtZDQ2g1NpX/29HdyFeJ4nSIhI47ENSxlQ== text-table@^0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/text-table/-/text-table-0.2.0.tgz#7f5ee823ae805207c00af2df4a84ec3fcfa570b4" + integrity sha1-f17oI66AUgfACvLfSoTsP8+lcLQ= + +thenify-all@^1.0.0: + version "1.6.0" + resolved "https://registry.yarnpkg.com/thenify-all/-/thenify-all-1.6.0.tgz#1a1918d402d8fc3f98fbf234db0bcc8cc10e9726" + integrity sha1-GhkY1ALY/D+Y+/I02wvMjMEOlyY= + dependencies: + thenify ">= 3.1.0 < 4" + +"thenify@>= 3.1.0 < 4": + version "3.3.0" + resolved "https://registry.yarnpkg.com/thenify/-/thenify-3.3.0.tgz#e69e38a1babe969b0108207978b9f62b88604839" + integrity sha1-5p44obq+lpsBCCB5eLn2K4hgSDk= + dependencies: + any-promise "^1.0.0" throat@^4.0.0: version "4.1.0" resolved "https://registry.yarnpkg.com/throat/-/throat-4.1.0.tgz#89037cbc92c56ab18926e6ba4cbb200e15672a6a" + integrity sha1-iQN8vJLFarGJJua6TLsgDhVnKmo= -through2-filter@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/through2-filter/-/through2-filter-2.0.0.tgz#60bc55a0dacb76085db1f9dae99ab43f83d622ec" +through2-filter@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/through2-filter/-/through2-filter-3.0.0.tgz#700e786df2367c2c88cd8aa5be4cf9c1e7831254" + integrity sha512-jaRjI2WxN3W1V8/FMZ9HKIBXixtiqs3SQSX4/YGIiP3gL6djW48VoZq9tDqeCWs3MT8YY5wb/zli8VW8snY1CA== dependencies: through2 "~2.0.0" xtend "~4.0.0" @@ -9094,13 +10211,15 @@ through2-filter@^2.0.0: through2@^1.0.0: version "1.1.1" resolved "https://registry.yarnpkg.com/through2/-/through2-1.1.1.tgz#0847cbc4449f3405574dbdccd9bb841b83ac3545" + integrity sha1-CEfLxESfNAVXTb3M2buEG4OsNUU= dependencies: readable-stream ">=1.1.13-1 <1.2.0-0" xtend ">=4.0.0 <4.1.0-0" -through2@^2.0.0, through2@^2.0.1, through2@^2.0.2, through2@^2.0.3, through2@~2.0.0: +through2@^2.0.0, through2@^2.0.2, through2@^2.0.3, through2@~2.0.0: version "2.0.5" resolved "https://registry.yarnpkg.com/through2/-/through2-2.0.5.tgz#01c1e39eb31d07cb7d03a96a70823260b23132cd" + integrity sha512-/mrRod8xqpA+IHSLyGCQ2s8SPHiCDEeQJSep1jqLYeEUClOFG2Qsh+4FU6G9VeqpZnGW/Su8LQGc4YKni5rYSQ== dependencies: readable-stream "~2.3.6" xtend "~4.0.1" @@ -9112,67 +10231,74 @@ through2@^3.0.0: dependencies: readable-stream "2 || 3" -through@2, "through@>=2.2.7 <3", through@^2.3.4, through@^2.3.6, through@^2.3.8, through@~2.3.6: +through@2, "through@>=2.2.7 <3", through@^2.3.4, through@^2.3.6: version "2.3.8" resolved "https://registry.yarnpkg.com/through/-/through-2.3.8.tgz#0dd4c9ffaabc357960b1b724115d7e0e86a2e1f5" + integrity sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU= time-stamp@^1.0.0: version "1.1.0" resolved "https://registry.yarnpkg.com/time-stamp/-/time-stamp-1.1.0.tgz#764a5a11af50561921b133f3b44e618687e0f5c3" + integrity sha1-dkpaEa9QVhkhsTPztE5hhofg9cM= timers-browserify@^1.0.1: version "1.4.2" resolved "https://registry.yarnpkg.com/timers-browserify/-/timers-browserify-1.4.2.tgz#c9c58b575be8407375cb5e2462dacee74359f41d" + integrity sha1-ycWLV1voQHN1y14kYtrO50NZ9B0= dependencies: process "~0.11.0" -timers-browserify@^2.0.4: - version "2.0.6" - resolved "https://registry.yarnpkg.com/timers-browserify/-/timers-browserify-2.0.6.tgz#241e76927d9ca05f4d959819022f5b3664b64bae" - dependencies: - setimmediate "^1.0.4" - tmp@^0.0.33: version "0.0.33" resolved "https://registry.yarnpkg.com/tmp/-/tmp-0.0.33.tgz#6d34335889768d21b2bcda0aa277ced3b1bfadf9" + integrity sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw== dependencies: os-tmpdir "~1.0.2" tmpl@1.0.x: version "1.0.4" resolved "https://registry.yarnpkg.com/tmpl/-/tmpl-1.0.4.tgz#23640dd7b42d00433911140820e5cf440e521dd1" + integrity sha1-I2QN17QtAEM5ERQIIOXPRA5SHdE= to-absolute-glob@^2.0.0: version "2.0.2" resolved "https://registry.yarnpkg.com/to-absolute-glob/-/to-absolute-glob-2.0.2.tgz#1865f43d9e74b0822db9f145b78cff7d0f7c849b" + integrity sha1-GGX0PZ50sIItufFFt4z/fQ98hJs= dependencies: is-absolute "^1.0.0" is-negated-glob "^1.0.0" -to-arraybuffer@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/to-arraybuffer/-/to-arraybuffer-1.0.1.tgz#7d229b1fcc637e466ca081180836a7aabff83f43" - to-fast-properties@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/to-fast-properties/-/to-fast-properties-2.0.0.tgz#dc5e698cbd079265bc73e0377681a4e4e83f616e" + integrity sha1-3F5pjL0HkmW8c+A3doGk5Og/YW4= to-object-path@^0.3.0: version "0.3.0" resolved "https://registry.yarnpkg.com/to-object-path/-/to-object-path-0.3.0.tgz#297588b7b0e7e0ac08e04e672f85c1f4999e17af" + integrity sha1-KXWIt7Dn4KwI4E5nL4XB9JmeF68= dependencies: kind-of "^3.0.2" to-regex-range@^2.1.0: version "2.1.1" resolved "https://registry.yarnpkg.com/to-regex-range/-/to-regex-range-2.1.1.tgz#7c80c17b9dfebe599e27367e0d4dd5590141db38" + integrity sha1-fIDBe53+vlmeJzZ+DU3VWQFB2zg= dependencies: is-number "^3.0.0" repeat-string "^1.6.1" +to-regex-range@^5.0.1: + version "5.0.1" + resolved "https://registry.yarnpkg.com/to-regex-range/-/to-regex-range-5.0.1.tgz#1648c44aae7c8d988a326018ed72f5b4dd0392e4" + integrity sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ== + dependencies: + is-number "^7.0.0" + to-regex@^3.0.1, to-regex@^3.0.2: version "3.0.2" resolved "https://registry.yarnpkg.com/to-regex/-/to-regex-3.0.2.tgz#13cfdd9b336552f30b51f33a8ae1b42a7a7599ce" + integrity sha512-FWtleNAtZ/Ki2qtqej2CXTOayOH9bHDQF+Q48VpWyDXjbYxA4Yz8iDB31zXOBUlOHHKidDbqGVrTUvQMPmBGBw== dependencies: define-property "^2.0.2" extend-shallow "^3.0.2" @@ -9182,127 +10308,160 @@ to-regex@^3.0.1, to-regex@^3.0.2: to-through@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/to-through/-/to-through-2.0.0.tgz#fc92adaba072647bc0b67d6b03664aa195093af6" + integrity sha1-/JKtq6ByZHvAtn1rA2ZKoZUJOvY= dependencies: through2 "^2.0.3" -toposort@^2.0.2: - version "2.0.2" - resolved "https://registry.yarnpkg.com/toposort/-/toposort-2.0.2.tgz#ae21768175d1559d48bef35420b2f4962f09c330" - integrity sha1-riF2gXXRVZ1IvvNUILL0li8JwzA= +tough-cookie@^2.3.3, tough-cookie@^2.3.4: + version "2.5.0" + resolved "https://registry.yarnpkg.com/tough-cookie/-/tough-cookie-2.5.0.tgz#cd9fb2a0aa1d5a12b473bd9fb96fa3dcff65ade2" + integrity sha512-nlLsUzgm1kfLXSXfRZMc1KLAugd4hqJHDTvc2hDIwS3mZAfMEuMbc03SujMF+GEcpaX/qboeycw6iO8JwVv2+g== + dependencies: + psl "^1.1.28" + punycode "^2.1.1" -tough-cookie@>=2.3.3, tough-cookie@^2.3.3, tough-cookie@~2.4.3: +tough-cookie@~2.4.3: version "2.4.3" resolved "https://registry.yarnpkg.com/tough-cookie/-/tough-cookie-2.4.3.tgz#53f36da3f47783b0925afa06ff9f3b165280f781" + integrity sha512-Q5srk/4vDM54WJsJio3XNn6K2sCG+CQ8G5Wz6bZhRZoAe/+TxjWB/GlFAnYEbkYVlON9FMk/fE3h2RLpPXo4lQ== dependencies: psl "^1.1.24" punycode "^1.4.1" -tr46@^1.0.0, tr46@^1.0.1: +tr46@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/tr46/-/tr46-1.0.1.tgz#a8b13fd6bfd2489519674ccde55ba3693b706d09" + integrity sha1-qLE/1r/SSJUZZ0zN5VujaTtwbQk= dependencies: punycode "^2.1.0" trim-newlines@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/trim-newlines/-/trim-newlines-1.0.0.tgz#5887966bb582a4503a41eb524f7d35011815a613" + integrity sha1-WIeWa7WCpFA6QetST301ARgVphM= trim-newlines@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/trim-newlines/-/trim-newlines-2.0.0.tgz#b403d0b91be50c331dfc4b82eeceb22c3de16d20" + integrity sha1-tAPQuRvlDDMd/EuC7s6yLD3hbSA= trim-off-newlines@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/trim-off-newlines/-/trim-off-newlines-1.0.1.tgz#9f9ba9d9efa8764c387698bcbfeb2c848f11adb3" - -trim-right@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/trim-right/-/trim-right-1.0.1.tgz#cb2e1203067e0c8de1f614094b9fe45704ea6003" + integrity sha1-n5up2e+odkw4dpi8v+sshI8RrbM= tslib@^1.9.0: - version "1.9.3" - resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.9.3.tgz#d7e4dd79245d85428c4d7e4822a79917954ca286" - -tty-browserify@0.0.0: - version "0.0.0" - resolved "https://registry.yarnpkg.com/tty-browserify/-/tty-browserify-0.0.0.tgz#a157ba402da24e9bf957f9aa69d524eed42901a6" + version "1.10.0" + resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.10.0.tgz#c3c19f95973fb0a62973fb09d90d961ee43e5c8a" + integrity sha512-qOebF53frne81cf0S9B41ByenJ3/IuH8yJKngAX35CmiZySA0khhkovshKK+jGCaMnVomla7gVlIcc3EvKPbTQ== tty-browserify@0.0.1: version "0.0.1" resolved "https://registry.yarnpkg.com/tty-browserify/-/tty-browserify-0.0.1.tgz#3f05251ee17904dfd0677546670db9651682b811" + integrity sha512-C3TaO7K81YvjCgQH9Q1S3R3P3BtN3RIM8n+OvX4il1K1zgE8ZhI0op7kClgkxtutIE8hQrcrHBXvIheqKUUCxw== tunnel-agent@^0.6.0: version "0.6.0" resolved "https://registry.yarnpkg.com/tunnel-agent/-/tunnel-agent-0.6.0.tgz#27a5dea06b36b04a0a9966774b290868f0fc40fd" + integrity sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0= dependencies: safe-buffer "^5.0.1" tweetnacl@^0.14.3, tweetnacl@~0.14.0: version "0.14.5" resolved "https://registry.yarnpkg.com/tweetnacl/-/tweetnacl-0.14.5.tgz#5ae68177f192d4456269d108afa93ff8743f4f64" + integrity sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q= type-check@~0.3.2: version "0.3.2" resolved "https://registry.yarnpkg.com/type-check/-/type-check-0.3.2.tgz#5884cab512cf1d355e3fb784f30804b2b520db72" + integrity sha1-WITKtRLPHTVeP7eE8wgEsrUg23I= dependencies: prelude-ls "~1.1.2" -type-fest@^0.4.1: - version "0.4.1" - resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.4.1.tgz#8bdf77743385d8a4f13ba95f610f5ccd68c728f8" - integrity sha512-IwzA/LSfD2vC1/YDYMv/zHP4rDF1usCwllsDpbolT3D4fUepIO7f9K70jjmUewU/LmGUKJcwcVtDCpnKk4BPMw== +type-fest@^0.3.0: + version "0.3.1" + resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.3.1.tgz#63d00d204e059474fe5e1b7c011112bbd1dc29e1" + integrity sha512-cUGJnCdr4STbePCgqNFbpVNCepa+kAVohJs1sLhxzdH+gnEoOd8VhbYa7pD3zZYGiURWM2xzEII3fQcRizDkYQ== -typedarray@^0.0.6, typedarray@~0.0.5: - version "0.0.6" - resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777" +type-fest@^0.6.0: + version "0.6.0" + resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.6.0.tgz#8d2a2370d3df886eb5c90ada1c5bf6188acf838b" + integrity sha512-q+MB8nYR1KDLrgr4G5yemftpMC7/QLqVndBmEEdqzmNj5dcFOO4Oo8qlwZE3ULT3+Zim1F8Kq4cBnikNhlCMlg== -uglify-js@3.3.x, uglify-js@^3.0.5, uglify-js@^3.1.4: - version "3.3.13" - resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-3.3.13.tgz#8a1a89eeb16e2d6a66b0db2b04cb871af3c669cf" - dependencies: - commander "~2.14.1" - source-map "~0.6.1" +type-fest@^0.8.1: + version "0.8.1" + resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.8.1.tgz#09e249ebde851d3b1e48d27c105444667f17b83d" + integrity sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA== -uglify-js@^2.8.29: - version "2.8.29" - resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-2.8.29.tgz#29c5733148057bb4e1f75df35b7a9cb72e6a59dd" - dependencies: - source-map "~0.5.1" - yargs "~3.10.0" - optionalDependencies: - uglify-to-browserify "~1.0.0" +type@^1.0.1: + version "1.2.0" + resolved "https://registry.yarnpkg.com/type/-/type-1.2.0.tgz#848dd7698dafa3e54a6c479e759c4bc3f18847a0" + integrity sha512-+5nt5AAniqsCnu2cEQQdpzCAh33kVx8n0VoFidKpB1dVVLAN/F+bgVOqOJqOnEnrhp222clB5p3vUlD+1QAnfg== -uglify-to-browserify@~1.0.0: - version "1.0.2" - resolved "https://registry.yarnpkg.com/uglify-to-browserify/-/uglify-to-browserify-1.0.2.tgz#6e0924d6bda6b5afe349e39a6d632850a0f882b7" +type@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/type/-/type-2.0.0.tgz#5f16ff6ef2eb44f260494dae271033b29c09a9c3" + integrity sha512-KBt58xCHry4Cejnc2ISQAF7QY+ORngsWfxezO68+12hKV6lQY8P/psIkcbjeHWn7MqcgciWJyCCevFMJdIXpow== + +typedarray-to-buffer@~1.0.0: + version "1.0.4" + resolved "https://registry.yarnpkg.com/typedarray-to-buffer/-/typedarray-to-buffer-1.0.4.tgz#9bb8ba0e841fb3f4cf1fe7c245e9f3fa8a5fe99c" + integrity sha1-m7i6DoQfs/TPH+fCRenz+opf6Zw= + +typedarray@^0.0.6: + version "0.0.6" + resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777" + integrity sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c= + +typescript@^3.6.3: + version "3.7.3" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.7.3.tgz#b36840668a16458a7025b9eabfad11b66ab85c69" + integrity sha512-Mcr/Qk7hXqFBXMN7p7Lusj1ktCBydylfQM/FZCk5glCNQJrCUKPkMHdo9R0MTFWsC/4kPFvDS0fDPvukfCkFsw== -uglifyjs-webpack-plugin@^0.4.6: - version "0.4.6" - resolved "https://registry.yarnpkg.com/uglifyjs-webpack-plugin/-/uglifyjs-webpack-plugin-0.4.6.tgz#b951f4abb6bd617e66f63eb891498e391763e309" +uglify-js@^3.1.4: + version "3.7.2" + resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-3.7.2.tgz#cb1a601e67536e9ed094a92dd1e333459643d3f9" + integrity sha512-uhRwZcANNWVLrxLfNFEdltoPNhECUR3lc+UdJoG9CBpMcSnKyWA94tc3eAujB1GcMY5Uwq8ZMp4qWpxWYDQmaA== dependencies: - source-map "^0.5.6" - uglify-js "^2.8.29" - webpack-sources "^1.0.1" + commander "~2.20.3" + source-map "~0.6.1" uid-number@0.0.6: version "0.0.6" resolved "https://registry.yarnpkg.com/uid-number/-/uid-number-0.0.6.tgz#0ea10e8035e8eb5b8e4449f06da1c730663baa81" + integrity sha1-DqEOgDXo61uOREnwbaHHMGY7qoE= umask@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/umask/-/umask-1.1.0.tgz#f29cebf01df517912bb58ff9c4e50fde8e33320d" + integrity sha1-8pzr8B31F5ErtY/5xOUP3o4zMg0= umd@^3.0.0: - version "3.0.1" - resolved "https://registry.yarnpkg.com/umd/-/umd-3.0.1.tgz#8ae556e11011f63c2596708a8837259f01b3d60e" + version "3.0.3" + resolved "https://registry.yarnpkg.com/umd/-/umd-3.0.3.tgz#aa9fe653c42b9097678489c01000acb69f0b26cf" + integrity sha512-4IcGSufhFshvLNcMCV80UnQVlZ5pMOC8mvNPForqwA4+lzYQuetTESLDQkeLmihq8bRcnpbQa48Wb8Lh16/xow== unc-path-regex@^0.1.2: version "0.1.2" resolved "https://registry.yarnpkg.com/unc-path-regex/-/unc-path-regex-0.1.2.tgz#e73dd3d7b0d7c5ed86fbac6b0ae7d8c6a69d50fa" + integrity sha1-5z3T17DXxe2G+6xrCufYxqadUPo= + +undeclared-identifiers@^1.1.2: + version "1.1.3" + resolved "https://registry.yarnpkg.com/undeclared-identifiers/-/undeclared-identifiers-1.1.3.tgz#9254c1d37bdac0ac2b52de4b6722792d2a91e30f" + integrity sha512-pJOW4nxjlmfwKApE4zvxLScM/njmwj/DiUBv7EabwE4O8kRUy+HIwxQtZLBPll/jx1LJyBcqNfB3/cpv9EZwOw== + dependencies: + acorn-node "^1.3.0" + dash-ast "^1.0.0" + get-assigned-identifiers "^1.2.0" + simple-concat "^1.0.0" + xtend "^4.0.1" undertaker-registry@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/undertaker-registry/-/undertaker-registry-1.0.1.tgz#5e4bda308e4a8a2ae584f9b9a4359a499825cc50" + integrity sha1-XkvaMI5KiirlhPm5pDWaSZglzFA= undertaker@^1.2.1: version "1.2.1" @@ -9322,10 +10481,12 @@ undertaker@^1.2.1: unicode-canonical-property-names-ecmascript@^1.0.4: version "1.0.4" resolved "https://registry.yarnpkg.com/unicode-canonical-property-names-ecmascript/-/unicode-canonical-property-names-ecmascript-1.0.4.tgz#2619800c4c825800efdd8343af7dd9933cbe2818" + integrity sha512-jDrNnXWHd4oHiTZnx/ZG7gtUTVp+gCcTTKr8L0HjlwphROEW3+Him+IpvC+xcJEFegapiMZyZe02CyuOnRmbnQ== unicode-match-property-ecmascript@^1.0.4: version "1.0.4" resolved "https://registry.yarnpkg.com/unicode-match-property-ecmascript/-/unicode-match-property-ecmascript-1.0.4.tgz#8ed2a32569961bce9227d09cd3ffbb8fed5f020c" + integrity sha512-L4Qoh15vTfntsn4P1zqnHulG0LdXgjSO035fEpdtp6YxXhMT51Q6vgM5lYdG/5X3MjS+k/Y9Xw4SFCY9IkR0rg== dependencies: unicode-canonical-property-names-ecmascript "^1.0.4" unicode-property-aliases-ecmascript "^1.0.4" @@ -9336,119 +10497,140 @@ unicode-match-property-value-ecmascript@^1.1.0: integrity sha512-hDTHvaBk3RmFzvSl0UVrUmC3PuW9wKVnpoUDYH0JDkSIovzw+J5viQmeYHxVSBptubnr7PbH2e0fnpDRQnQl5g== unicode-property-aliases-ecmascript@^1.0.4: - version "1.0.4" - resolved "https://registry.yarnpkg.com/unicode-property-aliases-ecmascript/-/unicode-property-aliases-ecmascript-1.0.4.tgz#5a533f31b4317ea76f17d807fa0d116546111dd0" + version "1.0.5" + resolved "https://registry.yarnpkg.com/unicode-property-aliases-ecmascript/-/unicode-property-aliases-ecmascript-1.0.5.tgz#a9cc6cc7ce63a0a3023fc99e341b94431d405a57" + integrity sha512-L5RAqCfXqAwR3RriF8pM0lU0w4Ryf/GgzONwi6KnL1taJQa7x1TCxdJnILX59WIGOwR57IVxn7Nej0fz1Ny6fw== union-value@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/union-value/-/union-value-1.0.0.tgz#5c71c34cb5bad5dcebe3ea0cd08207ba5aa1aea4" + version "1.0.1" + resolved "https://registry.yarnpkg.com/union-value/-/union-value-1.0.1.tgz#0b6fe7b835aecda61c6ea4d4f02c14221e109847" + integrity sha512-tJfXmxMeWYnczCVs7XAEvIV7ieppALdyepWMkHkwciRpZraG/xwT+s2JN8+pr1+8jCRf80FFzvr+MpQeeoF4Xg== dependencies: arr-union "^3.1.0" get-value "^2.0.6" is-extendable "^0.1.1" - set-value "^0.4.3" + set-value "^2.0.1" unique-filename@^1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/unique-filename/-/unique-filename-1.1.1.tgz#1d69769369ada0583103a1e6ae87681b56573230" + integrity sha512-Vmp0jIp2ln35UTXuryvjzkjGdRyf9b2lTXuSYUiPmzRcl3FDtYqAwOnTJkAngD9SWhnoJzDbTKwaOrZ+STtxNQ== dependencies: unique-slug "^2.0.0" unique-slug@^2.0.0: - version "2.0.1" - resolved "https://registry.yarnpkg.com/unique-slug/-/unique-slug-2.0.1.tgz#5e9edc6d1ce8fb264db18a507ef9bd8544451ca6" + version "2.0.2" + resolved "https://registry.yarnpkg.com/unique-slug/-/unique-slug-2.0.2.tgz#baabce91083fc64e945b0f3ad613e264f7cd4e6c" + integrity sha512-zoWr9ObaxALD3DOPfjPSqxt4fnZiWblxHIgeWqW8x7UqDzEtHEQLzji2cuJYQFCU6KmoJikOYAZlrTHHebjx2w== dependencies: imurmurhash "^0.1.4" unique-stream@^2.0.2: - version "2.2.1" - resolved "https://registry.yarnpkg.com/unique-stream/-/unique-stream-2.2.1.tgz#5aa003cfbe94c5ff866c4e7d668bb1c4dbadb369" + version "2.3.1" + resolved "https://registry.yarnpkg.com/unique-stream/-/unique-stream-2.3.1.tgz#c65d110e9a4adf9a6c5948b28053d9a8d04cbeac" + integrity sha512-2nY4TnBE70yoxHkDli7DMazpWiP7xMdCYqU2nBRO0UB+ZpEkGsSija7MvmvnZFUeC+mrgiUfcHSr3LmRFIg4+A== dependencies: - json-stable-stringify "^1.0.0" - through2-filter "^2.0.0" + json-stable-stringify-without-jsonify "^1.0.1" + through2-filter "^3.0.0" -universal-user-agent@^2.0.0, universal-user-agent@^2.0.1, universal-user-agent@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/universal-user-agent/-/universal-user-agent-2.1.0.tgz#5abfbcc036a1ba490cb941f8fd68c46d3669e8e4" - integrity sha512-8itiX7G05Tu3mGDTdNY2fB4KJ8MgZLS54RdG6PkkfwMAavrXu1mV/lls/GABx9O3Rw4PnTtasxrvbMQoBYY92Q== +universal-user-agent@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/universal-user-agent/-/universal-user-agent-4.0.0.tgz#27da2ec87e32769619f68a14996465ea1cb9df16" + integrity sha512-eM8knLpev67iBDizr/YtqkJsF3GK8gzDc6st/WKzrTuPtcsOKW/0IdL4cnMBsU69pOx0otavLWBDGTwg+dB0aA== dependencies: - os-name "^3.0.0" + os-name "^3.1.0" universalify@^0.1.0: - version "0.1.1" - resolved "https://registry.yarnpkg.com/universalify/-/universalify-0.1.1.tgz#fa71badd4437af4c148841e3b3b165f9e9e590b7" + version "0.1.2" + resolved "https://registry.yarnpkg.com/universalify/-/universalify-0.1.2.tgz#b646f69be3942dabcecc9d6639c80dc105efaa66" + integrity sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg== unset-value@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/unset-value/-/unset-value-1.0.0.tgz#8376873f7d2335179ffb1e6fc3a8ed0dfc8ab559" + integrity sha1-g3aHP30jNRef+x5vw6jtDfyKtVk= dependencies: has-value "^0.3.1" isobject "^3.0.0" upath@^1.1.1: - version "1.1.2" - resolved "https://registry.yarnpkg.com/upath/-/upath-1.1.2.tgz#3db658600edaeeccbe6db5e684d67ee8c2acd068" - integrity sha512-kXpym8nmDmlCBr7nKdIx8P2jNBa+pBpIUFRnKJ4dr8htyYGJFokkr2ZvERRtUN+9SY+JqXouNgUPtv6JQva/2Q== - -upper-case@^1.1.1: - version "1.1.3" - resolved "https://registry.yarnpkg.com/upper-case/-/upper-case-1.1.3.tgz#f6b4501c2ec4cdd26ba78be7222961de77621598" + version "1.2.0" + resolved "https://registry.yarnpkg.com/upath/-/upath-1.2.0.tgz#8f66dbcd55a883acdae4408af8b035a5044c1894" + integrity sha512-aZwGpamFO61g3OlfT7OQCHqhGnW43ieH9WZeP7QxN/G/jS4jfqUkZxoryvJgVPEcrl5NL/ggHsSmLMHuH64Lhg== uri-js@^4.2.2: version "4.2.2" resolved "https://registry.yarnpkg.com/uri-js/-/uri-js-4.2.2.tgz#94c540e1ff772956e2299507c010aea6c8838eb0" + integrity sha512-KY9Frmirql91X2Qgjry0Wd4Y+YTdrdZheS8TFwvkbLWf/G5KNJDCh6pKL5OZctEW4+0Baa5idK2ZQuELRwPznQ== dependencies: punycode "^2.1.0" urix@^0.1.0: version "0.1.0" resolved "https://registry.yarnpkg.com/urix/-/urix-0.1.0.tgz#da937f7a62e21fec1fd18d49b35c2935067a6c72" + integrity sha1-2pN/emLiH+wf0Y1Js1wpNQZ6bHI= -url-template@^2.0.8: - version "2.0.8" - resolved "https://registry.yarnpkg.com/url-template/-/url-template-2.0.8.tgz#fc565a3cccbff7730c775f5641f9555791439f21" - integrity sha1-/FZaPMy/93MMd19WQflVV5FDnyE= - -url@^0.11.0, url@~0.11.0: +url@~0.11.0: version "0.11.0" resolved "https://registry.yarnpkg.com/url/-/url-0.11.0.tgz#3838e97cfc60521eb73c525a8e55bfdd9e2e28f1" + integrity sha1-ODjpfPxgUh63PFJajlW/3Z4uKPE= dependencies: punycode "1.3.2" querystring "0.2.0" -use@^2.0.0: - version "2.0.2" - resolved "https://registry.yarnpkg.com/use/-/use-2.0.2.tgz#ae28a0d72f93bf22422a18a2e379993112dec8e8" - dependencies: - define-property "^0.2.5" - isobject "^3.0.0" - lazy-cache "^2.0.2" +use@^3.1.0: + version "3.1.1" + resolved "https://registry.yarnpkg.com/use/-/use-3.1.1.tgz#d50c8cac79a19fbc20f2911f56eb973f4e10070f" + integrity sha512-cwESVXlO3url9YWlFW/TA9cshCEhtu7IKJ/p5soJ/gGpj7vbvFrAY/eIioQ6Dw23KjZhYgiIo8HOs1nQ2vr/oQ== -util-deprecate@~1.0.1: +util-deprecate@^1.0.1, util-deprecate@~1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf" + integrity sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8= + +util-promisify@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/util-promisify/-/util-promisify-2.1.0.tgz#3c2236476c4d32c5ff3c47002add7c13b9a82a53" + integrity sha1-PCI2R2xNMsX/PEcAKt18E7moKlM= + dependencies: + object.getownpropertydescriptors "^2.0.3" util.promisify@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/util.promisify/-/util.promisify-1.0.0.tgz#440f7165a459c9a16dc145eb8e72f35687097030" + integrity sha512-i+6qA2MPhvoKLuxnJNpXAGhg7HphQOSUq2LKMZD0m15EiskXUkMvKdF4Uui0WYeCUGea+o2cw/ZuwehtfsrNkA== dependencies: define-properties "^1.1.2" object.getownpropertydescriptors "^2.0.3" -util@0.10.3, util@^0.10.3, util@~0.10.1: +util@0.10.3: version "0.10.3" resolved "https://registry.yarnpkg.com/util/-/util-0.10.3.tgz#7afb1afe50805246489e3db7fe0ed379336ac0f9" + integrity sha1-evsa/lCAUkZInj23/g7TeTNqwPk= dependencies: inherits "2.0.1" +util@~0.10.1: + version "0.10.4" + resolved "https://registry.yarnpkg.com/util/-/util-0.10.4.tgz#3aa0125bfe668a4672de58857d3ace27ecb76901" + integrity sha512-0Pm9hTQ3se5ll1XihRic3FDIku70C+iHUdT/W926rSgHV5QgXsYbKZN8MSC3tJtSkhuROzvsQjAaFENRXr+19A== + dependencies: + inherits "2.0.3" + uuid@^3.0.1, uuid@^3.3.2: - version "3.3.2" - resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.3.2.tgz#1b4af4955eb3077c501c23872fc6513811587131" - integrity sha512-yXJmeNaw3DnnKAOKJE51sL/ZaYfWJRl1pK9dr19YFCu0ObS231AB1/LbqTKRAQ5kw8A90rA6fr4riOUpTZvQZA== + version "3.3.3" + resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.3.3.tgz#4568f0216e78760ee1dbf3a4d2cf53e224112866" + integrity sha512-pW0No1RGHgzlpHJO1nsVrHKpOEIxkGg1xB+v0ZmdNH5OAeAwzAVrCnI2/6Mtx+Uys6iaylxa+D3g4j63IKKjSQ== + +v8-compile-cache@^2.0.3: + version "2.1.0" + resolved "https://registry.yarnpkg.com/v8-compile-cache/-/v8-compile-cache-2.1.0.tgz#e14de37b31a6d194f5690d67efc4e7f6fc6ab30e" + integrity sha512-usZBT3PW+LOjM25wbqIlZwPeJV+3OSz3M1k1Ws8snlW39dZyYL9lOGC5FgPVHfk0jKmjiDV8Z0mIbVQPiwFs7g== v8flags@^3.0.1: - version "3.0.2" - resolved "https://registry.yarnpkg.com/v8flags/-/v8flags-3.0.2.tgz#ad6a78a20a6b23d03a8debc11211e3cc23149477" + version "3.1.3" + resolved "https://registry.yarnpkg.com/v8flags/-/v8flags-3.1.3.tgz#fc9dc23521ca20c5433f81cc4eb9b3033bb105d8" + integrity sha512-amh9CCg3ZxkzQ48Mhcb8iX7xpAfYJgePHxWMQCBWECpOSqJUXgY26ncA61UTV0BkPqfhcy6mzwCIoP4ygxpW8w== dependencies: homedir-polyfill "^1.0.1" @@ -9463,16 +10645,19 @@ validate-npm-package-license@^3.0.1, validate-npm-package-license@^3.0.3: validate-npm-package-name@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/validate-npm-package-name/-/validate-npm-package-name-3.0.0.tgz#5fa912d81eb7d0c74afc140de7317f0ca7df437e" + integrity sha1-X6kS2B630MdK/BQN5zF/DKffQ34= dependencies: builtins "^1.0.3" value-or-function@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/value-or-function/-/value-or-function-3.0.0.tgz#1c243a50b595c1be54a754bfece8563b9ff8d813" + integrity sha1-HCQ6ULWVwb5Up1S/7OhWO5/42BM= verror@1.10.0: version "1.10.0" resolved "https://registry.yarnpkg.com/verror/-/verror-1.10.0.tgz#3a105ca17053af55d6e270c1f8288682e18da400" + integrity sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA= dependencies: assert-plus "^1.0.0" core-util-is "1.0.2" @@ -9481,6 +10666,7 @@ verror@1.10.0: vinyl-file@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/vinyl-file/-/vinyl-file-2.0.0.tgz#a7ebf5ffbefda1b7d18d140fcb07b223efb6751a" + integrity sha1-p+v1/779obfRjRQPyweyI++2dRo= dependencies: graceful-fs "^4.1.2" pify "^2.3.0" @@ -9490,8 +10676,9 @@ vinyl-file@^2.0.0: vinyl "^1.1.0" vinyl-fs@^3.0.0: - version "3.0.2" - resolved "https://registry.yarnpkg.com/vinyl-fs/-/vinyl-fs-3.0.2.tgz#1b86258844383f57581fcaac081fe09ef6d6d752" + version "3.0.3" + resolved "https://registry.yarnpkg.com/vinyl-fs/-/vinyl-fs-3.0.3.tgz#c85849405f67428feabbbd5c5dbdd64f47d31bc7" + integrity sha512-vIu34EkyNyJxmP0jscNzWBSygh7VWhqun6RmqVfXePrOwi9lhvRs//dOaGOTRUQr4tx7/zd26Tk5WeSVZitgng== dependencies: fs-mkdirp-stream "^1.0.0" glob-stream "^6.1.0" @@ -9514,6 +10701,7 @@ vinyl-fs@^3.0.0: vinyl-sourcemap@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/vinyl-sourcemap/-/vinyl-sourcemap-1.1.0.tgz#92a800593a38703a8cdb11d8b300ad4be63b3e16" + integrity sha1-kqgAWTo4cDqM2xHYswCtS+Y7PhY= dependencies: append-buffer "^1.0.2" convert-source-map "^1.5.0" @@ -9526,20 +10714,23 @@ vinyl-sourcemap@^1.1.0: vinyl-sourcemaps-apply@^0.2.0: version "0.2.1" resolved "https://registry.yarnpkg.com/vinyl-sourcemaps-apply/-/vinyl-sourcemaps-apply-0.2.1.tgz#ab6549d61d172c2b1b87be5c508d239c8ef87705" + integrity sha1-q2VJ1h0XLCsbh75cUI0jnI74dwU= dependencies: source-map "^0.5.1" vinyl@^1.1.0: version "1.2.0" resolved "https://registry.yarnpkg.com/vinyl/-/vinyl-1.2.0.tgz#5c88036cf565e5df05558bfc911f8656df218884" + integrity sha1-XIgDbPVl5d8FVYv8kR+GVt8hiIQ= dependencies: clone "^1.0.0" clone-stats "^0.0.1" replace-ext "0.0.1" vinyl@^2.0.0, vinyl@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/vinyl/-/vinyl-2.1.0.tgz#021f9c2cf951d6b939943c89eb5ee5add4fd924c" + version "2.2.0" + resolved "https://registry.yarnpkg.com/vinyl/-/vinyl-2.2.0.tgz#d85b07da96e458d25b2ffe19fece9f2caa13ed86" + integrity sha512-MBH+yP0kC/GQ5GwBqrTPTzEfiiLjta7hTtvQtbxBgTeSXsmKQRQecjibMbxIXzVT3Y9KJK+drOz1/k+vsu8Nkg== dependencies: clone "^2.1.1" clone-buffer "^1.0.0" @@ -9548,140 +10739,67 @@ vinyl@^2.0.0, vinyl@^2.1.0: remove-trailing-separator "^1.0.1" replace-ext "^1.0.0" -vm-browserify@0.0.4: - version "0.0.4" - resolved "https://registry.yarnpkg.com/vm-browserify/-/vm-browserify-0.0.4.tgz#5d7ea45bbef9e4a6ff65f95438e0a87c357d5a73" - dependencies: - indexof "0.0.1" +vlq@^0.2.2: + version "0.2.3" + resolved "https://registry.yarnpkg.com/vlq/-/vlq-0.2.3.tgz#8f3e4328cf63b1540c0d67e1b2778386f8975b26" + integrity sha512-DRibZL6DsNhIgYQ+wNdWDL2SL3bKPlVrRiBqV5yuMm++op8W4kGFtaQfCs4KEJn0wBZcHVHJ3eoywX8983k1ow== vm-browserify@^1.0.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/vm-browserify/-/vm-browserify-1.1.0.tgz#bd76d6a23323e2ca8ffa12028dc04559c75f9019" + version "1.1.2" + resolved "https://registry.yarnpkg.com/vm-browserify/-/vm-browserify-1.1.2.tgz#78641c488b8e6ca91a75f511e7a3b32a86e5dda0" + integrity sha512-2ham8XPWTONajOR0ohOKOHXkm3+gaBmGut3SRuu75xLd/RRaY6vqgh8NBYYk7+RW3u5AtzPQZG8F10LHkl0lAQ== w3c-hr-time@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/w3c-hr-time/-/w3c-hr-time-1.0.1.tgz#82ac2bff63d950ea9e3189a58a65625fedf19045" + integrity sha1-gqwr/2PZUOqeMYmlimViX+3xkEU= dependencies: browser-process-hrtime "^0.1.2" walker@^1.0.7, walker@~1.0.5: version "1.0.7" resolved "https://registry.yarnpkg.com/walker/-/walker-1.0.7.tgz#2f7f9b8fd10d677262b18a884e28d19618e028fb" + integrity sha1-L3+bj9ENZ3JisYqITijRlhjgKPs= dependencies: makeerror "1.0.x" -warnings-to-errors-webpack-plugin@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/warnings-to-errors-webpack-plugin/-/warnings-to-errors-webpack-plugin-2.0.0.tgz#1ce862fa845c77a3c21bb68c839efaa7ebbdb9fb" - integrity sha512-0Girb3F5xc5U1TpYMiLDcie5oB+Ko2EuujOYyS3aXpKS4Yp264WkIuJ+0vF8wnmkDkmZAOBxahBedEL0mLjHQA== - -watchpack@^1.4.0: - version "1.5.0" - resolved "https://registry.yarnpkg.com/watchpack/-/watchpack-1.5.0.tgz#231e783af830a22f8966f65c4c4bacc814072eed" - dependencies: - chokidar "^2.0.2" - graceful-fs "^4.1.2" - neo-async "^2.5.0" - wcwidth@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/wcwidth/-/wcwidth-1.0.1.tgz#f0b0dcf915bc5ff1528afadb2c0e17b532da2fe8" + integrity sha1-8LDc+RW8X/FSivrbLA4XtTLaL+g= dependencies: defaults "^1.0.3" -webidl-conversions@^4.0.1, webidl-conversions@^4.0.2: +webidl-conversions@^4.0.2: version "4.0.2" resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-4.0.2.tgz#a855980b1f0b6b359ba1d5d9fb39ae941faa63ad" - -webpack-dependency-suite@^2.4.4: - version "2.4.5" - resolved "https://registry.yarnpkg.com/webpack-dependency-suite/-/webpack-dependency-suite-2.4.5.tgz#e2d3c9a178140edb7be41de57413a31cb2f11ec0" - dependencies: - "@types/acorn" "^4.0.2" - "@types/cheerio" "^0.22.1" - "@types/debug" "^0.0.29" - "@types/enhanced-resolve" "^3.0.3" - "@types/escape-string-regexp" "^0.0.30" - "@types/estree" "0.0.35" - "@types/lodash" "^4.14.67" - "@types/node" "^8.0.0" - "@types/semver" "^5.3.32" - "@types/webpack" "^3.0.0" - acorn "^5.0.3" - cheerio "^1.0.0-rc.1" - debug "^3.0.0" - escape-string-regexp "^1.0.5" - html-loader "^0.4.5" - loader-utils "^1.1.0" - lodash "^4.17.4" - semver "^5.3.0" - source-map "^0.5.6" - -webpack-sources@^1.0.1: - version "1.1.0" - resolved "https://registry.yarnpkg.com/webpack-sources/-/webpack-sources-1.1.0.tgz#a101ebae59d6507354d71d8013950a3a8b7a5a54" - dependencies: - source-list-map "^2.0.0" - source-map "~0.6.1" - -webpack-stream@^4.0.0: - version "4.0.2" - resolved "https://registry.yarnpkg.com/webpack-stream/-/webpack-stream-4.0.2.tgz#7b90aec71d45c8a4519ff8b5a4d59e039cfd02c0" - dependencies: - fancy-log "^1.3.2" - lodash.clone "^4.3.2" - lodash.some "^4.2.2" - memory-fs "^0.4.1" - plugin-error "^1.0.1" - supports-color "^5.2.0" - through "^2.3.8" - vinyl "^2.1.0" - webpack "^3.4.1" - -webpack@^3.4.1: - version "3.11.0" - resolved "https://registry.yarnpkg.com/webpack/-/webpack-3.11.0.tgz#77da451b1d7b4b117adaf41a1a93b5742f24d894" - dependencies: - acorn "^5.0.0" - acorn-dynamic-import "^2.0.0" - ajv "^6.1.0" - ajv-keywords "^3.1.0" - async "^2.1.2" - enhanced-resolve "^3.4.0" - escope "^3.6.0" - interpret "^1.0.0" - json-loader "^0.5.4" - json5 "^0.5.1" - loader-runner "^2.3.0" - loader-utils "^1.1.0" - memory-fs "~0.4.1" - mkdirp "~0.5.0" - node-libs-browser "^2.0.0" - source-map "^0.5.3" - supports-color "^4.2.1" - tapable "^0.2.7" - uglifyjs-webpack-plugin "^0.4.6" - watchpack "^1.4.0" - webpack-sources "^1.0.1" - yargs "^8.0.2" + integrity sha512-YQ+BmxuTgd6UXZW3+ICGfyqRyHXVlD5GtQr5+qjiNW7bF0cqrzX500HVXPBOvgXb5YnzDd+h0zqyv61KUD7+Sg== whatwg-encoding@^1.0.1, whatwg-encoding@^1.0.3: - version "1.0.3" - resolved "https://registry.yarnpkg.com/whatwg-encoding/-/whatwg-encoding-1.0.3.tgz#57c235bc8657e914d24e1a397d3c82daee0a6ba3" + version "1.0.5" + resolved "https://registry.yarnpkg.com/whatwg-encoding/-/whatwg-encoding-1.0.5.tgz#5abacf777c32166a51d085d6b4f3e7d27113ddb0" + integrity sha512-b5lim54JOPN9HtzvK9HFXvBma/rnfFeqsic0hSpjtDbVxR3dJKLc+KB4V6GgiGOvl7CY/KNh8rxSo9DKQrnUEw== dependencies: - iconv-lite "0.4.19" + iconv-lite "0.4.24" -whatwg-url@^6.4.0: - version "6.4.0" - resolved "https://registry.yarnpkg.com/whatwg-url/-/whatwg-url-6.4.0.tgz#08fdf2b9e872783a7a1f6216260a1d66cc722e08" +whatwg-mimetype@^2.1.0, whatwg-mimetype@^2.2.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== + +whatwg-url@^6.4.1: + version "6.5.0" + resolved "https://registry.yarnpkg.com/whatwg-url/-/whatwg-url-6.5.0.tgz#f2df02bff176fd65070df74ad5ccbb5a199965a8" + integrity sha512-rhRZRqx/TLJQWUpQ6bmrt2UV4f0HCQ463yQuONJqC6fO2VoEb1pTYddbe59SkYq87aoM5A3bdhMZiUiVws+fzQ== dependencies: lodash.sortby "^4.7.0" - tr46 "^1.0.0" - webidl-conversions "^4.0.1" + tr46 "^1.0.1" + webidl-conversions "^4.0.2" whatwg-url@^7.0.0: - version "7.0.0" - resolved "https://registry.yarnpkg.com/whatwg-url/-/whatwg-url-7.0.0.tgz#fde926fa54a599f3adf82dff25a9f7be02dc6edd" + version "7.1.0" + resolved "https://registry.yarnpkg.com/whatwg-url/-/whatwg-url-7.1.0.tgz#c2c492f1eca612988efd3d2266be1b9fc6170d06" + integrity sha512-WUu7Rg1DroM7oQvGWfOiAK21n74Gg+T4elXEQYkOhtyLeWiJFoOGLXPKI/9gzIie9CtwVLm8wtw6YJdKyxSjeg== dependencies: lodash.sortby "^4.7.0" tr46 "^1.0.1" @@ -9690,27 +10808,33 @@ whatwg-url@^7.0.0: which-module@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/which-module/-/which-module-1.0.0.tgz#bba63ca861948994ff307736089e3b96026c2a4f" + integrity sha1-u6Y8qGGUiZT/MHc2CJ47lgJsKk8= which-module@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/which-module/-/which-module-2.0.0.tgz#d9ef07dce77b9902b8a3a8fa4b31c3e3f7e6e87a" + integrity sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho= -which@1, which@^1.2.10, which@^1.2.14, which@^1.2.9, which@^1.3.0, which@^1.3.1: +which@1, which@^1.2.14, which@^1.2.9, which@^1.3.0, which@^1.3.1: version "1.3.1" resolved "https://registry.yarnpkg.com/which/-/which-1.3.1.tgz#a45043d54f5805316da8d62f9f50918d3da70b0a" integrity sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ== dependencies: isexe "^2.0.0" -wide-align@^1.1.0: - version "1.1.2" - resolved "https://registry.yarnpkg.com/wide-align/-/wide-align-1.1.2.tgz#571e0f1b0604636ebc0dfc21b0339bbe31341710" +which@^2.0.1: + version "2.0.2" + resolved "https://registry.yarnpkg.com/which/-/which-2.0.2.tgz#7c6a8dd0a636a0327e10b59c9286eee93f3f51b1" + integrity sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA== dependencies: - string-width "^1.0.2" + isexe "^2.0.0" -window-size@0.1.0: - version "0.1.0" - resolved "https://registry.yarnpkg.com/window-size/-/window-size-0.1.0.tgz#5438cd2ea93b202efa3a19fe8887aee7c94f9c9d" +wide-align@^1.1.0: + version "1.1.3" + resolved "https://registry.yarnpkg.com/wide-align/-/wide-align-1.1.3.tgz#ae074e6bdc0c14a431e804e624549c633b000457" + integrity sha512-QGkOQc8XL6Bt5PwnsExKBPuMKBxnGxWWW3fU55Xt4feHozMUhdUMaBCk290qpm/wG5u/RSKzwdAC4i51YigihA== + dependencies: + string-width "^1.0.2 || 2" windows-release@^3.1.0: version "3.2.0" @@ -9719,17 +10843,20 @@ windows-release@^3.1.0: dependencies: execa "^1.0.0" -wordwrap@0.0.2, wordwrap@~0.0.2: - version "0.0.2" - resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-0.0.2.tgz#b79669bb42ecb409f83d583cad52ca17eaa1643f" +word-wrap@~1.2.3: + version "1.2.3" + resolved "https://registry.yarnpkg.com/word-wrap/-/word-wrap-1.2.3.tgz#610636f6b1f703891bd34771ccb17fb93b47079c" + integrity sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ== -wordwrap@~1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-1.0.0.tgz#27584810891456a4171c8d0226441ade90cbcaeb" +wordwrap@~0.0.2: + version "0.0.3" + resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-0.0.3.tgz#a3d5da6cd5c0bc0008d37234bbaf1bed63059107" + integrity sha1-o9XabNXAvAAI03I0u68b7WMFkQc= wrap-ansi@^2.0.0: version "2.1.0" resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-2.1.0.tgz#d8fc3d284dd05794fe84973caecdd1cf824fdd85" + integrity sha1-2Pw9KE3QV5T+hJc8rs3Rz4JP3YU= dependencies: string-width "^1.0.1" strip-ansi "^3.0.1" @@ -9737,15 +10864,26 @@ wrap-ansi@^2.0.0: wrap-ansi@^3.0.1: version "3.0.1" resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-3.0.1.tgz#288a04d87eda5c286e060dfe8f135ce8d007f8ba" + integrity sha1-KIoE2H7aXChuBg3+jxNc6NAH+Lo= dependencies: string-width "^2.1.1" strip-ansi "^4.0.0" +wrap-ansi@^5.1.0: + version "5.1.0" + resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-5.1.0.tgz#1fd1f67235d5b6d0fee781056001bfb694c03b09" + integrity sha512-QC1/iN/2/RPVJ5jYK8BGttj5z83LmSKmvbvrXPNCLZSEb32KKVDJDl/MOt2N01qU2H/FkzEa9PKto1BqDjtd7Q== + dependencies: + ansi-styles "^3.2.0" + string-width "^3.0.0" + strip-ansi "^5.0.0" + wrappy@1: version "1.0.2" resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" + integrity sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8= -write-file-atomic@2.4.1, write-file-atomic@^2.0.0, write-file-atomic@^2.3.0: +write-file-atomic@2.4.1: version "2.4.1" resolved "https://registry.yarnpkg.com/write-file-atomic/-/write-file-atomic-2.4.1.tgz#d0b05463c188ae804396fd5ab2a370062af87529" integrity sha512-TGHFeZEZMnv+gBFRfjAcxL5bPHrsGKtnb4qsFAws7/vlh+QfwAaySIw4AXP9ZskTTh5GWu3FLuJhsWVdiJPGvg== @@ -9754,9 +10892,19 @@ write-file-atomic@2.4.1, write-file-atomic@^2.0.0, write-file-atomic@^2.3.0: imurmurhash "^0.1.4" signal-exit "^3.0.2" -write-json-file@^2.2.0, write-json-file@^2.3.0: +write-file-atomic@^2.0.0, write-file-atomic@^2.3.0, write-file-atomic@^2.4.2: + version "2.4.3" + resolved "https://registry.yarnpkg.com/write-file-atomic/-/write-file-atomic-2.4.3.tgz#1fd2e9ae1df3e75b8d8c367443c692d4ca81f481" + integrity sha512-GaETH5wwsX+GcnzhPgKcKjJ6M2Cq3/iZp1WyY/X1CSqrW+jVNM9Y7D8EC2sM4ZG/V8wZlSniJnCKWPmBYAucRQ== + dependencies: + graceful-fs "^4.1.11" + imurmurhash "^0.1.4" + signal-exit "^3.0.2" + +write-json-file@^2.2.0: version "2.3.0" resolved "https://registry.yarnpkg.com/write-json-file/-/write-json-file-2.3.0.tgz#2b64c8a33004d54b8698c76d585a77ceb61da32f" + integrity sha1-K2TIozAE1UuGmMdtWFp3zrYdoy8= dependencies: detect-indent "^5.0.0" graceful-fs "^4.1.2" @@ -9765,9 +10913,22 @@ write-json-file@^2.2.0, write-json-file@^2.3.0: sort-keys "^2.0.0" write-file-atomic "^2.0.0" +write-json-file@^3.2.0: + version "3.2.0" + resolved "https://registry.yarnpkg.com/write-json-file/-/write-json-file-3.2.0.tgz#65bbdc9ecd8a1458e15952770ccbadfcff5fe62a" + integrity sha512-3xZqT7Byc2uORAatYiP3DHUUAVEkNOswEWNs9H5KXiicRTvzYzYqKjYc4G7p+8pltvAw641lVByKVtMpf+4sYQ== + dependencies: + detect-indent "^5.0.0" + graceful-fs "^4.1.15" + make-dir "^2.1.0" + pify "^4.0.1" + sort-keys "^2.0.0" + write-file-atomic "^2.4.2" + write-pkg@^3.1.0: version "3.2.0" resolved "https://registry.yarnpkg.com/write-pkg/-/write-pkg-3.2.0.tgz#0e178fe97820d389a8928bc79535dbe68c2cff21" + integrity sha512-tX2ifZ0YqEFOF1wjRW2Pk93NLsj02+n1UP5RvO6rCs0K6R2g1padvf006cY74PQJKMGS2r42NK7FD0dG6Y6paw== dependencies: sort-keys "^2.0.0" write-json-file "^2.2.0" @@ -9779,44 +10940,82 @@ write@1.0.3: dependencies: mkdirp "^0.5.1" -ws@^4.0.0: - version "4.1.0" - resolved "https://registry.yarnpkg.com/ws/-/ws-4.1.0.tgz#a979b5d7d4da68bf54efe0408967c324869a7289" +ws@^5.2.0: + version "5.2.2" + resolved "https://registry.yarnpkg.com/ws/-/ws-5.2.2.tgz#dffef14866b8e8dc9133582514d1befaf96e980f" + integrity sha512-jaHFD6PFv6UgoIVda6qZllptQsMlDEJkTQcybzzXDYM1XO9Y8em691FGMPmM46WGyLU4z9KMgQN+qrux/nhlHA== dependencies: async-limiter "~1.0.0" - safe-buffer "~5.1.0" - -xml-char-classes@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/xml-char-classes/-/xml-char-classes-1.0.0.tgz#64657848a20ffc5df583a42ad8a277b4512bbc4d" xml-name-validator@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/xml-name-validator/-/xml-name-validator-3.0.0.tgz#6ae73e06de4d8c6e47f9fb181f78d648ad457c6a" + integrity sha512-A5CUptxDsvxKJEU3yO6DuWBSJz/qizqzJKOMIfUJHETbBw/sFaDxgd6fxm1ewUaM0jZ444Fc5vC5ROYurg/4Pw== -"xtend@>=4.0.0 <4.1.0-0", xtend@^4.0.0, xtend@^4.0.1, xtend@~4.0.0, xtend@~4.0.1: - version "4.0.1" - resolved "https://registry.yarnpkg.com/xtend/-/xtend-4.0.1.tgz#a5c6d532be656e23db820efb943a1f04998d63af" +"xtend@>=4.0.0 <4.1.0-0", xtend@^4.0.0, xtend@^4.0.1, xtend@^4.0.2, xtend@~4.0.0, xtend@~4.0.1: + version "4.0.2" + resolved "https://registry.yarnpkg.com/xtend/-/xtend-4.0.2.tgz#bb72779f5fa465186b1f438f674fa347fdb5db54" + integrity sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ== + +xtend@^2.2.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/xtend/-/xtend-2.2.0.tgz#eef6b1f198c1c8deafad8b1765a04dad4a01c5a9" + integrity sha1-7vax8ZjByN6vrYsXZaBNrUoBxak= + +xtend@~2.0.4: + version "2.0.6" + resolved "https://registry.yarnpkg.com/xtend/-/xtend-2.0.6.tgz#5ea657a6dba447069c2e59c58a1138cb0c5e6cee" + integrity sha1-XqZXptukRwacLlnFihE4ywxebO4= + dependencies: + is-object "~0.1.2" + object-keys "~0.2.0" + +xtend@~2.1.2: + version "2.1.2" + resolved "https://registry.yarnpkg.com/xtend/-/xtend-2.1.2.tgz#6efecc2a4dad8e6962c4901b337ce7ba87b5d28b" + integrity sha1-bv7MKk2tjmlixJAbM3znuoe10os= + dependencies: + object-keys "~0.4.0" + +xtend@~3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/xtend/-/xtend-3.0.0.tgz#5cce7407baf642cba7becda568111c493f59665a" + integrity sha1-XM50B7r2Qsunvs2laBEcST9ZZlo= y18n@^3.2.1: version "3.2.1" resolved "https://registry.yarnpkg.com/y18n/-/y18n-3.2.1.tgz#6d15fba884c08679c0d77e88e7759e811e07fa41" + integrity sha1-bRX7qITAhnnA136I53WegR4H+kE= -"y18n@^3.2.1 || ^4.0.0", y18n@^4.0.0: +y18n@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/y18n/-/y18n-4.0.0.tgz#95ef94f85ecc81d007c264e190a120f0a3c8566b" + integrity sha512-r9S/ZyXu/Xu9q1tYlpsLIsa3EeLXXk0VwlxqTcFRfg9EhMW+17kbt9G0NrgCmhGb5vT2hyhJZLfDGx+7+5Uj/w== -yallist@^2.1.2: - version "2.1.2" - resolved "https://registry.yarnpkg.com/yallist/-/yallist-2.1.2.tgz#1c11f9218f076089a47dd512f93c6699a6a81d52" +yallist@^3.0.0, yallist@^3.0.2, yallist@^3.0.3: + version "3.1.1" + resolved "https://registry.yarnpkg.com/yallist/-/yallist-3.1.1.tgz#dbb7daf9bfd8bac9ab45ebf602b8cbad0d5d08fd" + integrity sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g== -yallist@^3.0.0, yallist@^3.0.2: - version "3.0.2" - resolved "https://registry.yarnpkg.com/yallist/-/yallist-3.0.2.tgz#8452b4bb7e83c7c188d8041c1a837c773d6d8bb9" +yargs-parser@^10.0.0: + version "10.1.0" + resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-10.1.0.tgz#7202265b89f7e9e9f2e5765e0fe735a905edbaa8" + integrity sha512-VCIyR1wJoEBZUqk5PA+oOBF6ypbwh5aNB3I50guxAL/quggdfs4TtNHQrSazFA3fYZ+tEqfs0zIGlv0c/rgjbQ== + dependencies: + camelcase "^4.1.0" + +yargs-parser@^13.1.1: + version "13.1.1" + resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-13.1.1.tgz#d26058532aa06d365fe091f6a1fc06b2f7e5eca0" + integrity sha512-oVAVsHz6uFrg3XQheFII8ESO2ssAf9luWuAd6Wexsu4F3OtIW0o8IribPXYrD4WC24LWtPrJlGy87y5udK+dxQ== + dependencies: + camelcase "^5.0.0" + decamelize "^1.2.0" -yargs-parser@^11.1.1: - version "11.1.1" - resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-11.1.1.tgz#879a0865973bca9f6bab5cbdf3b1c67ec7d3bcf4" +yargs-parser@^15.0.0: + version "15.0.0" + resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-15.0.0.tgz#cdd7a97490ec836195f59f3f4dbe5ea9e8f75f08" + integrity sha512-xLTUnCMc4JhxrPEPUYD5IBR1mWCK/aT6+RJ/K29JY2y1vD+FhtgKK0AXRWvI262q3QSffAQuTouFIKUuHX89wQ== dependencies: camelcase "^5.0.0" decamelize "^1.2.0" @@ -9824,41 +11023,54 @@ yargs-parser@^11.1.1: yargs-parser@^4.2.0: version "4.2.1" resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-4.2.1.tgz#29cceac0dc4f03c6c87b4a9f217dd18c9f74871c" + integrity sha1-KczqwNxPA8bIe0qfIX3RjJ90hxw= dependencies: camelcase "^3.0.0" yargs-parser@^5.0.0: version "5.0.0" resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-5.0.0.tgz#275ecf0d7ffe05c77e64e7c86e4cd94bf0e1228a" + integrity sha1-J17PDX/+Bcd+ZOfIbkzZS/DhIoo= dependencies: camelcase "^3.0.0" -yargs-parser@^7.0.0: - version "7.0.0" - resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-7.0.0.tgz#8d0ac42f16ea55debd332caf4c4038b3e3f5dfd9" +yargs@^13.3.0: + version "13.3.0" + resolved "https://registry.yarnpkg.com/yargs/-/yargs-13.3.0.tgz#4c657a55e07e5f2cf947f8a366567c04a0dedc83" + integrity sha512-2eehun/8ALW8TLoIl7MVaRUrg+yCnenu8B4kBlRxj3GJGDKU1Og7sMXPNm1BYyM1DOJmTZ4YeN/Nwxv+8XJsUA== dependencies: - camelcase "^4.1.0" + cliui "^5.0.0" + find-up "^3.0.0" + get-caller-file "^2.0.1" + require-directory "^2.1.1" + require-main-filename "^2.0.0" + set-blocking "^2.0.0" + string-width "^3.0.0" + which-module "^2.0.0" + y18n "^4.0.0" + yargs-parser "^13.1.1" -yargs@^12.0.1, yargs@^12.0.2: - version "12.0.5" - resolved "https://registry.yarnpkg.com/yargs/-/yargs-12.0.5.tgz#05f5997b609647b64f66b81e3b4b10a368e7ad13" +yargs@^14.2.2: + version "14.2.2" + resolved "https://registry.yarnpkg.com/yargs/-/yargs-14.2.2.tgz#2769564379009ff8597cdd38fba09da9b493c4b5" + integrity sha512-/4ld+4VV5RnrynMhPZJ/ZpOCGSCeghMykZ3BhdFBDa9Wy/RH6uEGNWDJog+aUlq+9OM1CFTgtYRW5Is1Po9NOA== dependencies: - cliui "^4.0.0" + cliui "^5.0.0" decamelize "^1.2.0" find-up "^3.0.0" - get-caller-file "^1.0.1" - os-locale "^3.0.0" + get-caller-file "^2.0.1" require-directory "^2.1.1" - require-main-filename "^1.0.1" + require-main-filename "^2.0.0" set-blocking "^2.0.0" - string-width "^2.0.0" + string-width "^3.0.0" which-module "^2.0.0" - y18n "^3.2.1 || ^4.0.0" - yargs-parser "^11.1.1" + y18n "^4.0.0" + yargs-parser "^15.0.0" yargs@^6.5.0, yargs@^6.6.0: version "6.6.0" resolved "https://registry.yarnpkg.com/yargs/-/yargs-6.6.0.tgz#782ec21ef403345f830a808ca3d513af56065208" + integrity sha1-eC7CHvQDNF+DCoCMo9UTr1YGUgg= dependencies: camelcase "^3.0.0" cliui "^3.2.0" @@ -9877,6 +11089,7 @@ yargs@^6.5.0, yargs@^6.6.0: yargs@^7.1.0: version "7.1.0" resolved "https://registry.yarnpkg.com/yargs/-/yargs-7.1.0.tgz#6ba318eb16961727f5d284f8ea003e8d6154d0c8" + integrity sha1-a6MY6xaWFyf10oT46gA+jWFU0Mg= dependencies: camelcase "^3.0.0" cliui "^3.2.0" @@ -9891,42 +11104,3 @@ yargs@^7.1.0: which-module "^1.0.0" y18n "^3.2.1" yargs-parser "^5.0.0" - -yargs@^8.0.2: - version "8.0.2" - resolved "https://registry.yarnpkg.com/yargs/-/yargs-8.0.2.tgz#6299a9055b1cefc969ff7e79c1d918dceb22c360" - dependencies: - camelcase "^4.1.0" - cliui "^3.2.0" - decamelize "^1.1.1" - get-caller-file "^1.0.1" - os-locale "^2.0.0" - read-pkg-up "^2.0.0" - require-directory "^2.1.1" - require-main-filename "^1.0.1" - set-blocking "^2.0.0" - string-width "^2.0.0" - which-module "^2.0.0" - y18n "^3.2.1" - yargs-parser "^7.0.0" - -yargs@~3.10.0: - version "3.10.0" - resolved "https://registry.yarnpkg.com/yargs/-/yargs-3.10.0.tgz#f7ee7bd857dd7c1d2d38c0e74efbd681d1431fd1" - dependencies: - camelcase "^1.0.2" - cliui "^2.1.0" - decamelize "^1.0.0" - window-size "0.1.0" - -yup@^0.27.0: - version "0.27.0" - resolved "https://registry.yarnpkg.com/yup/-/yup-0.27.0.tgz#f8cb198c8e7dd2124beddc2457571329096b06e7" - integrity sha512-v1yFnE4+u9za42gG/b/081E7uNW9mUj3qtkmelLbW5YPROZzSH/KUUyJu9Wt8vxFJcT9otL/eZopS0YK1L5yPQ== - dependencies: - "@babel/runtime" "^7.0.0" - fn-name "~2.0.1" - lodash "^4.17.11" - property-expr "^1.5.0" - synchronous-promise "^2.0.6" - toposort "^2.0.2"