Compare commits
71 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a422ea64ee | ||
|
|
34d30e28d6 | ||
|
|
3ad4c70d3a | ||
|
|
34937f13d5 | ||
|
|
c7add11fdc | ||
|
|
d329156ebc | ||
|
|
25b35261ca | ||
|
|
563874c06c | ||
|
|
b0acfb24dd | ||
|
|
599d2ff324 | ||
|
|
0856618ed5 | ||
|
|
bc0966a46f | ||
|
|
3498195ae2 | ||
|
|
fbf3cb0ac4 | ||
|
|
e6264a0992 | ||
|
|
0b37ab0362 | ||
|
|
57ae306457 | ||
|
|
fa5a40c8d5 | ||
|
|
a219b6de7a | ||
|
|
fa5057f9fb | ||
|
|
02f2d17e83 | ||
|
|
b351f29033 | ||
|
|
298c9a6c33 | ||
|
|
80d99b4d4e | ||
|
|
94fcabc4e3 | ||
|
|
5f1970433d | ||
|
|
b459f6a0a4 | ||
|
|
66062c2a8c | ||
|
|
8d4f95de45 | ||
|
|
d0f093e716 | ||
|
|
490798a26d | ||
|
|
eaa1474541 | ||
|
|
0e9502685a | ||
|
|
26be14b24d | ||
|
|
6f3460c767 | ||
|
|
cc080417b9 | ||
|
|
a00f371610 | ||
|
|
af66d521bd | ||
|
|
b9cb4af953 | ||
|
|
69d00dc5b0 | ||
|
|
f339d2d034 | ||
|
|
3069747a81 | ||
|
|
962015f7e7 | ||
|
|
b7333ea97a | ||
|
|
46c70ad734 | ||
|
|
3a7b6e1c22 | ||
|
|
9c1ad0a9f7 | ||
|
|
87dc201411 | ||
|
|
0ef4972295 | ||
|
|
cb881e6b3f | ||
|
|
45a484f0a2 | ||
|
|
99f4f6c3b0 | ||
|
|
e4b4831100 | ||
|
|
256fa5aa04 | ||
|
|
0ee2c42b55 | ||
|
|
1b352ca8a1 | ||
|
|
53af9e8b7a | ||
|
|
af04f40ee0 | ||
|
|
98b14843ba | ||
|
|
4395c22f3a | ||
|
|
610d6bdc62 | ||
|
|
8027dca501 | ||
|
|
81831032c3 | ||
|
|
daf25af47c | ||
|
|
6a5cee8f27 | ||
|
|
2096d0cfcb | ||
|
|
a79fbe62e4 | ||
|
|
381b066bd0 | ||
|
|
15b63bc89e | ||
|
|
fc8e14264c | ||
|
|
7e4f48139c |
@@ -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_\-]+\)$' -> '<PROJECT_ROOT>/packages/babel-\1/src/index'
|
||||
|
||||
10
.github/CHANGELOG-6to5.md
vendored
10
.github/CHANGELOG-6to5.md
vendored
@@ -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.
|
||||
|
||||
|
||||
6
.github/CHANGELOG-v4.md
vendored
6
.github/CHANGELOG-v4.md
vendored
@@ -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.
|
||||
|
||||
8
.github/CHANGELOG-v5.md
vendored
8
.github/CHANGELOG-v5.md
vendored
@@ -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.
|
||||
|
||||

|
||||
|
||||
* **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.
|
||||
|
||||
|
||||
22
.github/CHANGELOG-v6.md
vendored
22
.github/CHANGELOG-v6.md
vendored
@@ -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**
|
||||
|
||||
2
.github/PULL_REQUEST_TEMPLATE.md
vendored
2
.github/PULL_REQUEST_TEMPLATE.md
vendored
@@ -11,7 +11,7 @@ If you are making a change that should have a docs update: submit another PR to
|
||||
|
||||
| Q | A <!--(Can use an emoji 👍) -->
|
||||
| ------------------------ | ---
|
||||
| Fixed Issues? | `Fixes #1, Fixes #2` <!-- remove the (`) quotes to link the issues -->
|
||||
| Fixed Issues? | `Fixes #1, Fixes #2` <!-- remove the (`) quotes and write "Fixes" before the number to link the issues -->
|
||||
| Patch: Bug Fix? |
|
||||
| Major: Breaking Change? |
|
||||
| Minor: New Feature? |
|
||||
|
||||
2
.github/lock.yml
vendored
2
.github/lock.yml
vendored
@@ -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
|
||||
|
||||
76
.github/main.workflow
vendored
76
.github/main.workflow
vendored
@@ -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"]
|
||||
}
|
||||
81
.github/workflows/issue-triage.yml
vendored
Normal file
81
.github/workflows/issue-triage.yml
vendored
Normal file
@@ -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.
|
||||
|
||||
53
.github/workflows/release.yml
vendored
Normal file
53
.github/workflows/release.yml
vendored
Normal file
@@ -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
|
||||
42
.travis.yml
42
.travis.yml
@@ -3,41 +3,43 @@ 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-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: "11"
|
||||
# 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
|
||||
# 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"
|
||||
|
||||
222
CHANGELOG.md
222
CHANGELOG.md
@@ -2,7 +2,7 @@
|
||||
|
||||
> **Tags:**
|
||||
> - :boom: [Breaking Change]
|
||||
> - :eyeglasses: [Spec Compliancy]
|
||||
> - :eyeglasses: [Spec Compliance]
|
||||
> - :rocket: [New Feature]
|
||||
> - :bug: [Bug Fix]
|
||||
> - :memo: [Documentation]
|
||||
@@ -17,6 +17,182 @@ See [Babylon's CHANGELOG](packages/babylon/CHANGELOG.md) for the Babylon pre-7.0
|
||||
|
||||
<!-- DO NOT CHANGE THESE COMMENTS - See .github/actions/trigger-github-release/update-changelog.js -->
|
||||
<!-- insert-new-changelog-here -->
|
||||
## 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 +565,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 +587,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 +639,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 +860,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 +1323,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 +1423,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 +1613,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 +1701,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 +1800,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 +1948,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 +2161,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 +2214,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 +2228,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 +2413,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 +2693,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 +2829,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 +2878,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 +3185,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 +3226,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 +3300,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))
|
||||
|
||||
|
||||
56
Gulpfile.js
56
Gulpfile.js
@@ -11,25 +11,20 @@ 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 rollupBabel = require("rollup-plugin-babel");
|
||||
const rollupNodeResolve = require("rollup-plugin-node-resolve");
|
||||
const rollupReplace = require("rollup-plugin-replace");
|
||||
const { registerStandalonePackageTask } = require("./scripts/gulp-tasks");
|
||||
|
||||
const sources = ["codemods", "packages"];
|
||||
const defaultSourcesGlob = "./@(codemods|packages)/*/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,32 +51,28 @@ 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));
|
||||
}
|
||||
|
||||
function buildRollup(packages) {
|
||||
@@ -118,6 +109,9 @@ const bundles = ["packages/babel-parser"];
|
||||
|
||||
gulp.task("build-rollup", () => buildRollup(bundles));
|
||||
gulp.task("build-babel", () => buildBabel(/* exclude */ bundles));
|
||||
gulp.task("build-babel-types", () =>
|
||||
buildBabel(/* exclude */ bundles, "packages/babel-types/src/**/*.js")
|
||||
);
|
||||
gulp.task("build", gulp.parallel("build-rollup", "build-babel"));
|
||||
|
||||
gulp.task("default", gulp.series("build"));
|
||||
@@ -128,7 +122,7 @@ gulp.task(
|
||||
"watch",
|
||||
gulp.series("build-no-bundle", function watch() {
|
||||
gulpWatch(
|
||||
sources.map(getGlobFromSource),
|
||||
defaultSourcesGlob,
|
||||
{ debounceDelay: 200 },
|
||||
gulp.task("build-no-bundle")
|
||||
);
|
||||
|
||||
190
Makefile
190
Makefile
@@ -1,6 +1,5 @@
|
||||
MAKEFLAGS = -j1
|
||||
FLOW_COMMIT = 09669846b7a7ca5a6c23c12d56bb3bebdafd67e9
|
||||
TEST262_COMMIT = de567d3aa5de4eaa11e00131d26b9fe77997dfb0
|
||||
TEST262_COMMIT = 8688c4ab79059c3097098605e69f1ee5eda6c409
|
||||
|
||||
# Fix color output until TravisCI fixes https://github.com/travis-ci/travis-ci/issues/7967
|
||||
export FORCE_COLOR = true
|
||||
@@ -9,59 +8,110 @@ SOURCES = packages codemods
|
||||
|
||||
.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
|
||||
|
||||
build-plugin-transform-runtime-dist:
|
||||
cd packages/babel-plugin-transform-runtime; \
|
||||
node scripts/build-dist.js
|
||||
|
||||
watch: clean clean-lib
|
||||
|
||||
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
|
||||
|
||||
lint:
|
||||
./node_modules/.bin/eslint scripts $(SOURCES) '*.js' --format=codeframe
|
||||
bootstrap-flowcheck: bootstrap-only
|
||||
yarn gulp build-babel-types
|
||||
$(MAKE) build-typings
|
||||
|
||||
fix: fix-json
|
||||
./node_modules/.bin/eslint scripts $(SOURCES) '*.js' --format=codeframe --fix
|
||||
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: lint-js lint-ts
|
||||
|
||||
lint-js:
|
||||
yarn eslint scripts $(SOURCES) '*.js' --format=codeframe
|
||||
|
||||
lint-ts:
|
||||
scripts/tests/typescript/lint.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 "{packages,codemod}/*/test/fixtures/**/options.json" --write --loglevel warn
|
||||
|
||||
clean: test-clean
|
||||
rm -f .npmrc
|
||||
@@ -74,72 +124,77 @@ 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
|
||||
|
||||
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
|
||||
|
||||
bootstrap-test262:
|
||||
rm -rf ./build/test262
|
||||
mkdir -p ./build
|
||||
git clone --branch=master --single-branch --shallow-since=2019-01-01 https://github.com/tc39/test262.git ./build/test262
|
||||
rm -rf build/test262
|
||||
mkdir -p build
|
||||
git clone --branch=master --single-branch --shallow-since=2019-09-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
|
||||
|
||||
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
|
||||
|
||||
# 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
|
||||
$(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="@babel/runtime,@babel/runtime-corejs2,@babel/runtime-corejs3,@babel/standalone,@babel/preset-env-standalone"
|
||||
|
||||
# NOTE: Run make new-version first
|
||||
publish: prepublish
|
||||
./node_modules/.bin/lerna publish from-git --require-scripts
|
||||
make clean
|
||||
yarn lerna publish from-git --require-scripts
|
||||
$(MAKE) clean
|
||||
|
||||
publish-ci: prepublish
|
||||
ifneq ("$(NPM_TOKEN)", "")
|
||||
@@ -148,23 +203,30 @@ 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 --require-scripts --yes
|
||||
rm -f .npmrc
|
||||
make clean
|
||||
$(MAKE) clean
|
||||
|
||||
bootstrap-only: clean-all
|
||||
bootstrap-only: lerna-bootstrap
|
||||
|
||||
yarn-install: clean-all
|
||||
yarn --ignore-engines
|
||||
./node_modules/.bin/lerna bootstrap -- --ignore-engines
|
||||
|
||||
lerna-bootstrap: yarn-install
|
||||
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:
|
||||
$(foreach source, $(SOURCES), \
|
||||
$(call clean-source-lib, $(source)))
|
||||
|
||||
clean-runtime-helpers:
|
||||
rm -rf packages/babel-runtime/helpers
|
||||
rm -rf packages/babel-runtime-corejs2/helpers
|
||||
rm -rf packages/babel-runtime-corejs2/core-js
|
||||
|
||||
clean-all:
|
||||
rm -rf node_modules
|
||||
rm -rf package-lock.json
|
||||
@@ -173,7 +235,7 @@ clean-all:
|
||||
$(foreach source, $(SOURCES), \
|
||||
$(call clean-source-all, $(source)))
|
||||
|
||||
make clean
|
||||
$(MAKE) clean
|
||||
|
||||
define clean-source-lib
|
||||
rm -rf $(1)/*/lib
|
||||
|
||||
@@ -77,9 +77,10 @@ module.exports = function(api) {
|
||||
"@babel/proposal-object-rest-spread",
|
||||
{ useBuiltIns: true, loose: true },
|
||||
],
|
||||
"@babel/plugin-proposal-optional-chaining",
|
||||
"@babel/plugin-proposal-nullish-coalescing-operator",
|
||||
|
||||
// Explicitly use the lazy version of CommonJS modules.
|
||||
convertESM ? ["@babel/transform-modules-commonjs", { lazy: true }] : null,
|
||||
convertESM ? "@babel/transform-modules-commonjs" : null,
|
||||
].filter(Boolean),
|
||||
overrides: [
|
||||
{
|
||||
@@ -90,18 +91,17 @@ 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
|
||||
|
||||
@@ -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:**
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"version": "7.6.0",
|
||||
"version": "7.6.4",
|
||||
"changelog": {
|
||||
"repo": "babel/babel",
|
||||
"cacheDir": ".changelog",
|
||||
|
||||
30
package.json
30
package.json
@@ -9,20 +9,22 @@
|
||||
"test": "make test"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/cli": "^7.4.4",
|
||||
"@babel/core": "^7.4.5",
|
||||
"@babel/cli": "^7.6.0",
|
||||
"@babel/core": "^7.6.0",
|
||||
"@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.5.5",
|
||||
"@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-optional-chaining": "^7.6.0",
|
||||
"@babel/plugin-transform-modules-commonjs": "^7.6.0",
|
||||
"@babel/plugin-transform-runtime": "^7.6.0",
|
||||
"@babel/preset-env": "^7.6.0",
|
||||
"@babel/preset-flow": "^7.0.0",
|
||||
"@babel/register": "^7.4.4",
|
||||
"@babel/runtime": "^7.4.5",
|
||||
"@babel/register": "^7.6.0",
|
||||
"@babel/runtime": "^7.6.0",
|
||||
"babel-eslint": "^11.0.0-beta.0",
|
||||
"babel-jest": "^24.8.0",
|
||||
"babel-jest": "^24.9.0",
|
||||
"babel-loader": "^8.0.6",
|
||||
"babel-plugin-transform-charcodes": "^0.2.0",
|
||||
"browserify": "^16.2.3",
|
||||
@@ -38,7 +40,7 @@
|
||||
"eslint-plugin-import": "^2.17.2",
|
||||
"eslint-plugin-prettier": "^3.1.0",
|
||||
"fancy-log": "^1.3.3",
|
||||
"flow-bin": "^0.102.0",
|
||||
"flow-bin": "^0.108.0",
|
||||
"graceful-fs": "^4.1.15",
|
||||
"gulp": "^4.0.2",
|
||||
"gulp-babel": "^8.0.0",
|
||||
@@ -49,12 +51,11 @@
|
||||
"gulp-uglify": "^3.0.2",
|
||||
"gulp-watch": "^5.0.1",
|
||||
"husky": "^3.0.0",
|
||||
"jest": "^24.8.0",
|
||||
"jest": "^24.9.0",
|
||||
"lerna": "^3.16.0",
|
||||
"lerna-changelog": "^0.5.0",
|
||||
"lint-staged": "^9.2.0",
|
||||
"lodash": "^4.17.13",
|
||||
"merge-stream": "^1.0.1",
|
||||
"output-file-sync": "^2.0.0",
|
||||
"prettier": "^1.17.1",
|
||||
"pump": "^3.0.0",
|
||||
@@ -63,8 +64,9 @@
|
||||
"rollup-plugin-babel": "^4.0.0",
|
||||
"rollup-plugin-node-resolve": "^5.0.0",
|
||||
"rollup-plugin-replace": "^2.2.0",
|
||||
"test262-stream": "^1.2.0",
|
||||
"test262-stream": "^1.3.0",
|
||||
"through2": "^2.0.0",
|
||||
"typescript": "^3.6.3",
|
||||
"warnings-to-errors-webpack-plugin": "^2.0.0",
|
||||
"webpack": "^3.4.1",
|
||||
"webpack-dependency-suite": "^2.4.4",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@babel/cli",
|
||||
"version": "7.6.0",
|
||||
"version": "7.6.4",
|
||||
"description": "Babel command line.",
|
||||
"author": "Sebastian McKenzie <sebmck@gmail.com>",
|
||||
"homepage": "https://babeljs.io/",
|
||||
@@ -36,8 +36,8 @@
|
||||
"@babel/core": "^7.0.0-0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.6.0",
|
||||
"@babel/helper-fixtures": "^7.6.0"
|
||||
"@babel/core": "^7.6.4",
|
||||
"@babel/helper-fixtures": "^7.6.3"
|
||||
},
|
||||
"bin": {
|
||||
"babel": "./bin/babel.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;
|
||||
}
|
||||
|
||||
@@ -158,7 +158,7 @@ export type CmdOptions = {
|
||||
cliOptions: Object,
|
||||
};
|
||||
|
||||
export default function parseArgv(args: Array<string>): CmdOptions {
|
||||
export default function parseArgv(args: Array<string>): CmdOptions | null {
|
||||
//
|
||||
commander.parse(args);
|
||||
|
||||
@@ -223,7 +223,7 @@ export default function parseArgv(args: Array<string>): CmdOptions {
|
||||
errors.forEach(function(e) {
|
||||
console.error(" " + e);
|
||||
});
|
||||
process.exit(2);
|
||||
return null;
|
||||
}
|
||||
|
||||
const opts = commander.opts();
|
||||
|
||||
@@ -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 {
|
||||
|
||||
5
packages/babel-cli/test/fixtures/babel/stdin --filename windows/options.json
vendored
Normal file
5
packages/babel-cli/test/fixtures/babel/stdin --filename windows/options.json
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"args": ["--filename", "test.js"],
|
||||
"stderrContains": true,
|
||||
"os": ["win32"]
|
||||
}
|
||||
1
packages/babel-cli/test/fixtures/babel/stdin --filename windows/stderr.txt
vendored
Normal file
1
packages/babel-cli/test/fixtures/babel/stdin --filename windows/stderr.txt
vendored
Normal file
@@ -0,0 +1 @@
|
||||
SyntaxError: <CWD>\test.js: Unexpected token, expected ";" (2:10)
|
||||
3
packages/babel-cli/test/fixtures/babel/stdin --filename windows/stdin.txt
vendored
Normal file
3
packages/babel-cli/test/fixtures/babel/stdin --filename windows/stdin.txt
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
arr.map(function () {
|
||||
return $]!;
|
||||
});
|
||||
@@ -1,4 +1,5 @@
|
||||
{
|
||||
"args": ["--filename", "test.js"],
|
||||
"stderrContains": true
|
||||
"stderrContains": true,
|
||||
"os": ["linux", "darwin"]
|
||||
}
|
||||
|
||||
@@ -185,7 +185,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");
|
||||
@@ -205,7 +227,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);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@babel/core",
|
||||
"version": "7.6.0",
|
||||
"version": "7.6.4",
|
||||
"description": "Babel compiler core.",
|
||||
"main": "lib/index.js",
|
||||
"author": "Sebastian McKenzie <sebmck@gmail.com>",
|
||||
@@ -34,12 +34,12 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@babel/code-frame": "^7.5.5",
|
||||
"@babel/generator": "^7.6.0",
|
||||
"@babel/helpers": "^7.6.0",
|
||||
"@babel/parser": "^7.6.0",
|
||||
"@babel/generator": "^7.6.4",
|
||||
"@babel/helpers": "^7.6.2",
|
||||
"@babel/parser": "^7.6.4",
|
||||
"@babel/template": "^7.6.0",
|
||||
"@babel/traverse": "^7.6.0",
|
||||
"@babel/types": "^7.6.0",
|
||||
"@babel/traverse": "^7.6.3",
|
||||
"@babel/types": "^7.6.3",
|
||||
"convert-source-map": "^1.1.0",
|
||||
"debug": "^4.1.0",
|
||||
"json5": "^2.1.0",
|
||||
@@ -49,7 +49,6 @@
|
||||
"source-map": "^0.5.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/helper-transform-fixture-test-runner": "^7.6.0",
|
||||
"@babel/register": "^7.6.0"
|
||||
"@babel/helper-transform-fixture-test-runner": "^7.6.4"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -345,6 +345,7 @@ function assertNoDuplicates(items: Array<UnloadedDescriptor>): 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<UnloadedDescriptor>): void {
|
||||
` ['some-plugin', {}],`,
|
||||
` ['some-plugin', {}, 'some unique name'],`,
|
||||
` ]`,
|
||||
``,
|
||||
`Duplicates detected are:`,
|
||||
`${JSON.stringify(conflicts, null, 2)}`,
|
||||
].join("\n"),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -272,7 +272,8 @@ export type OptionsSource =
|
||||
| "configfile"
|
||||
| "babelrcfile"
|
||||
| "extendsfile"
|
||||
| "preset";
|
||||
| "preset"
|
||||
| "plugin";
|
||||
|
||||
type RootPath = $ReadOnly<{
|
||||
type: "root",
|
||||
|
||||
@@ -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`);
|
||||
});
|
||||
|
||||
|
||||
@@ -259,7 +259,7 @@ export default class File {
|
||||
): Error {
|
||||
let loc = node && (node.loc || node._loc);
|
||||
|
||||
msg = `${this.opts.filename}: ${msg}`;
|
||||
msg = `${this.opts.filename ?? "unknown"}: ${msg}`;
|
||||
|
||||
if (!loc && node) {
|
||||
const state = {
|
||||
|
||||
@@ -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.`,
|
||||
|
||||
@@ -55,11 +55,29 @@ export function runSync(
|
||||
ast,
|
||||
);
|
||||
|
||||
transformFile(file, config.passes);
|
||||
|
||||
const opts = file.opts;
|
||||
const { outputCode, outputMap } =
|
||||
opts.code !== false ? generateCode(config.passes, file) : {};
|
||||
try {
|
||||
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,
|
||||
|
||||
@@ -107,7 +107,7 @@ function parser(
|
||||
} else if (results.length === 1) {
|
||||
if (typeof results[0].then === "function") {
|
||||
throw new Error(
|
||||
`You appear to be using an async codegen plugin, ` +
|
||||
`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.`,
|
||||
@@ -121,6 +121,7 @@ function parser(
|
||||
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;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import fs from "fs";
|
||||
import path from "path";
|
||||
import escapeRegExp from "lodash/escapeRegExp";
|
||||
import { loadOptions as loadOptionsOrig } from "../lib";
|
||||
|
||||
function fixture(...args) {
|
||||
@@ -33,7 +34,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 +70,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 +108,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 +144,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 +184,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 +220,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 +258,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 +294,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 +334,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 +370,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 +408,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 +444,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,
|
||||
});
|
||||
|
||||
|
||||
@@ -322,6 +322,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", () => {
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
{
|
||||
"throws": "undefined: someMsg\n> 1 | function f() {}"
|
||||
"throws": "unknown: someMsg\n> 1 | function f() {}"
|
||||
}
|
||||
|
||||
15
packages/babel-core/test/fixtures/plugins/transform-error/exec.js
vendored
Normal file
15
packages/babel-core/test/fixtures/plugins/transform-error/exec.js
vendored
Normal file
@@ -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"
|
||||
});
|
||||
4
packages/babel-core/test/fixtures/plugins/transform-error/options.json
vendored
Normal file
4
packages/babel-core/test/fixtures/plugins/transform-error/options.json
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"throws": "/fake/path/example.js: someMsg",
|
||||
"os": ["linux", "darwin"]
|
||||
}
|
||||
@@ -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([]);
|
||||
});
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@babel/generator",
|
||||
"version": "7.6.0",
|
||||
"version": "7.6.4",
|
||||
"description": "Turns an AST into code.",
|
||||
"author": "Sebastian McKenzie <sebmck@gmail.com>",
|
||||
"homepage": "https://babeljs.io/",
|
||||
@@ -14,14 +14,13 @@
|
||||
"lib"
|
||||
],
|
||||
"dependencies": {
|
||||
"@babel/types": "^7.6.0",
|
||||
"@babel/types": "^7.6.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.6.0",
|
||||
"@babel/parser": "^7.6.0"
|
||||
"@babel/helper-fixtures": "^7.6.3",
|
||||
"@babel/parser": "^7.6.4"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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(),
|
||||
};
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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<T>, C {}
|
||||
declare type A = string
|
||||
declare type A1 = string
|
||||
declare type T<U> = { [k:string]: U }
|
||||
declare type B = {
|
||||
declare type B1 = {
|
||||
fn?: (foo: string) => void,
|
||||
}
|
||||
declare interface I { foo: string }
|
||||
declare interface I<T> { foo: T }
|
||||
declare interface I1 { foo: string }
|
||||
declare interface I2<T> { foo: T }
|
||||
declare module.exports: { foo: string }
|
||||
declare opaque type Foo<T>: Bar<T>;
|
||||
declare opaque type ID;
|
||||
|
||||
@@ -22,17 +22,17 @@ declare class B {
|
||||
(): number
|
||||
}
|
||||
declare class A mixins B<T>, C {}
|
||||
declare type A = string;
|
||||
declare type A1 = string;
|
||||
declare type T<U> = {
|
||||
[k: string]: U
|
||||
};
|
||||
declare type B = {
|
||||
declare type B1 = {
|
||||
fn?: (foo: string) => void
|
||||
};
|
||||
declare interface I {
|
||||
declare interface I1 {
|
||||
foo: string
|
||||
}
|
||||
declare interface I<T> {
|
||||
declare interface I2<T> {
|
||||
foo: T
|
||||
}
|
||||
declare module.exports: {
|
||||
|
||||
@@ -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 }
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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 }
|
||||
|
||||
@@ -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 = {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
interface A {
|
||||
interface A1 {
|
||||
@@iterator(): Iterator<File>;
|
||||
}
|
||||
|
||||
interface A {
|
||||
interface A2 {
|
||||
@@asyncIterator(): Iterator<File>;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
interface A {
|
||||
interface A1 {
|
||||
@@iterator(): Iterator<File>
|
||||
}
|
||||
interface A {
|
||||
interface A2 {
|
||||
@@asyncIterator(): Iterator<File>
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@babel/helper-fixtures",
|
||||
"version": "7.6.0",
|
||||
"version": "7.6.3",
|
||||
"description": "Helper function to support fixtures",
|
||||
"author": "Sebastian McKenzie <sebmck@gmail.com>",
|
||||
"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"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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<Suite> {
|
||||
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<Suite> {
|
||||
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)) {
|
||||
@@ -140,7 +145,7 @@ export default function get(entryLoc): Array<Suite> {
|
||||
|
||||
const taskOpts = cloneDeep(suite.options);
|
||||
|
||||
const taskOptsLoc = resolve(taskDir + "/options");
|
||||
const taskOptsLoc = tryResolve(taskDir + "/options");
|
||||
if (taskOptsLoc) extend(taskOpts, require(taskOptsLoc));
|
||||
|
||||
const test = {
|
||||
@@ -187,6 +192,26 @@ export default function get(entryLoc): Array<Suite> {
|
||||
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) {
|
||||
@@ -275,7 +300,7 @@ export function multiple(entryLoc, ignore?: Array<string>) {
|
||||
|
||||
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 {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@babel/helper-transform-fixture-test-runner",
|
||||
"version": "7.6.0",
|
||||
"version": "7.6.4",
|
||||
"description": "Transform test runner for @babel/helper-fixtures module",
|
||||
"author": "Sebastian McKenzie <sebmck@gmail.com>",
|
||||
"homepage": "https://babeljs.io/",
|
||||
@@ -12,8 +12,8 @@
|
||||
"main": "lib/index.js",
|
||||
"dependencies": {
|
||||
"@babel/code-frame": "^7.5.5",
|
||||
"@babel/core": "^7.6.0",
|
||||
"@babel/helper-fixtures": "^7.6.0",
|
||||
"@babel/core": "^7.6.4",
|
||||
"@babel/helper-fixtures": "^7.6.3",
|
||||
"@babel/polyfill": "^7.6.0",
|
||||
"babel-check-duplicated-nodes": "^1.0.0",
|
||||
"jest": "^24.8.0",
|
||||
|
||||
@@ -295,12 +295,22 @@ function validateFile(actualCode, expectedLoc, expectedCode) {
|
||||
}
|
||||
|
||||
function normalizeOutput(code) {
|
||||
return code
|
||||
let result = code
|
||||
.trim()
|
||||
.replace(
|
||||
new RegExp(escapeRegExp(path.resolve(__dirname, "../../../")), "g"),
|
||||
"<CWD>",
|
||||
);
|
||||
if (process.platform === "win32") {
|
||||
result = result.replace(
|
||||
new RegExp(
|
||||
escapeRegExp(path.resolve(__dirname, "../../../").replace(/\\/g, "/")),
|
||||
"g",
|
||||
),
|
||||
"<CWD>",
|
||||
);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
const toEqualFile = () => ({
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@babel/helpers",
|
||||
"version": "7.6.0",
|
||||
"version": "7.6.2",
|
||||
"description": "Collection of helper functions used by Babel transforms.",
|
||||
"author": "Sebastian McKenzie <sebmck@gmail.com>",
|
||||
"homepage": "https://babeljs.io/",
|
||||
@@ -12,7 +12,7 @@
|
||||
"main": "lib/index.js",
|
||||
"dependencies": {
|
||||
"@babel/template": "^7.6.0",
|
||||
"@babel/traverse": "^7.6.0",
|
||||
"@babel/traverse": "^7.6.2",
|
||||
"@babel/types": "^7.6.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
||||
@@ -936,7 +936,7 @@ 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
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@babel/node",
|
||||
"version": "7.6.0",
|
||||
"version": "7.6.3",
|
||||
"description": "Babel command line",
|
||||
"author": "Sebastian McKenzie <sebmck@gmail.com>",
|
||||
"homepage": "https://babeljs.io/",
|
||||
@@ -19,19 +19,20 @@
|
||||
"compiler"
|
||||
],
|
||||
"dependencies": {
|
||||
"@babel/polyfill": "^7.6.0",
|
||||
"@babel/register": "^7.6.0",
|
||||
"@babel/register": "^7.6.2",
|
||||
"commander": "^2.8.1",
|
||||
"core-js": "^3.2.1",
|
||||
"lodash": "^4.17.13",
|
||||
"node-environment-flags": "^1.0.5",
|
||||
"regenerator-runtime": "^0.13.3",
|
||||
"v8flags": "^3.1.1"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@babel/core": "^7.0.0-0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.6.0",
|
||||
"@babel/helper-fixtures": "^7.6.0",
|
||||
"@babel/core": "^7.6.3",
|
||||
"@babel/helper-fixtures": "^7.6.3",
|
||||
"fs-readdir-recursive": "^1.0.0",
|
||||
"output-file-sync": "^2.0.0"
|
||||
},
|
||||
|
||||
@@ -5,7 +5,8 @@ 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 pkg from "../package.json";
|
||||
|
||||
@@ -93,9 +93,6 @@ getV8Flags(function(err, v8Flags) {
|
||||
}
|
||||
});
|
||||
});
|
||||
process.on("SIGINT", () => {
|
||||
proc.kill("SIGINT");
|
||||
process.exit(1);
|
||||
});
|
||||
process.on("SIGINT", () => proc.kill("SIGINT"));
|
||||
}
|
||||
});
|
||||
|
||||
@@ -198,7 +198,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);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "@babel/parser",
|
||||
"version": "7.6.0",
|
||||
"version": "7.6.4",
|
||||
"description": "A JavaScript parser",
|
||||
"author": "Sebastian McKenzie <sebmck@gmail.com>",
|
||||
"homepage": "https://babeljs.io/",
|
||||
"license": "MIT",
|
||||
"publishConfig": {
|
||||
"tag": "next"
|
||||
"access": "public"
|
||||
},
|
||||
"keywords": [
|
||||
"babel",
|
||||
@@ -29,7 +29,7 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/code-frame": "^7.5.5",
|
||||
"@babel/helper-fixtures": "^7.6.0",
|
||||
"@babel/helper-fixtures": "^7.6.3",
|
||||
"charcodes": "^0.2.0",
|
||||
"unicode-12.0.0": "^0.7.9"
|
||||
},
|
||||
|
||||
@@ -38,15 +38,31 @@ export default class CommentsParser extends BaseParser {
|
||||
this.state.leadingComments.push(comment);
|
||||
}
|
||||
|
||||
adjustCommentsAfterTrailingComma(node: Node, elements: Node[]) {
|
||||
if (elements.length === 0) {
|
||||
return;
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
const lastElement = last(elements);
|
||||
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 (
|
||||
@@ -58,10 +74,16 @@ export default class CommentsParser extends BaseParser {
|
||||
}
|
||||
|
||||
const newTrailingComments = [];
|
||||
while (this.state.leadingComments.length) {
|
||||
const leadingComment = this.state.leadingComments.shift();
|
||||
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 = [];
|
||||
@@ -69,6 +91,7 @@ export default class CommentsParser extends BaseParser {
|
||||
node.trailingComments.push(leadingComment);
|
||||
}
|
||||
}
|
||||
if (takeAllComments) this.state.leadingComments = [];
|
||||
|
||||
if (newTrailingComments.length > 0) {
|
||||
lastElement.trailingComments = newTrailingComments;
|
||||
@@ -129,16 +152,20 @@ export default class CommentsParser extends BaseParser {
|
||||
if (firstChild) {
|
||||
switch (node.type) {
|
||||
case "ObjectExpression":
|
||||
case "ObjectPattern":
|
||||
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":
|
||||
case "ArrayPattern":
|
||||
this.adjustCommentsAfterTrailingComma(node, node.elements);
|
||||
break;
|
||||
case "ArrayPattern":
|
||||
this.adjustCommentsAfterTrailingComma(node, node.elements, true);
|
||||
break;
|
||||
}
|
||||
} else if (
|
||||
this.state.commentPreviousNode &&
|
||||
@@ -147,9 +174,11 @@ export default class CommentsParser extends BaseParser {
|
||||
(this.state.commentPreviousNode.type === "ExportSpecifier" &&
|
||||
node.type !== "ExportSpecifier"))
|
||||
) {
|
||||
this.adjustCommentsAfterTrailingComma(node, [
|
||||
this.state.commentPreviousNode,
|
||||
]);
|
||||
this.adjustCommentsAfterTrailingComma(
|
||||
node,
|
||||
[this.state.commentPreviousNode],
|
||||
true,
|
||||
);
|
||||
}
|
||||
|
||||
if (lastChild) {
|
||||
|
||||
@@ -168,9 +168,6 @@ export default class ExpressionParser extends LValParser {
|
||||
}
|
||||
}
|
||||
|
||||
const oldCommaAfterSpreadAt = this.state.commaAfterSpreadAt;
|
||||
this.state.commaAfterSpreadAt = -1;
|
||||
|
||||
let failOnShorthandAssign;
|
||||
if (refShorthandDefaultPos) {
|
||||
failOnShorthandAssign = false;
|
||||
@@ -230,9 +227,6 @@ export default class ExpressionParser extends LValParser {
|
||||
);
|
||||
}
|
||||
|
||||
if (patternErrorMsg) this.checkCommaAfterRestFromSpread();
|
||||
this.state.commaAfterSpreadAt = oldCommaAfterSpreadAt;
|
||||
|
||||
this.next();
|
||||
node.right = this.parseMaybeAssign(noIn);
|
||||
return this.finishNode(node, "AssignmentExpression");
|
||||
@@ -240,8 +234,6 @@ export default class ExpressionParser extends LValParser {
|
||||
this.unexpected(refShorthandDefaultPos.start);
|
||||
}
|
||||
|
||||
this.state.commaAfterSpreadAt = oldCommaAfterSpreadAt;
|
||||
|
||||
return left;
|
||||
}
|
||||
|
||||
@@ -490,11 +482,7 @@ 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))
|
||||
) {
|
||||
if (this.isContextual("await") && this.isAwaitAllowed()) {
|
||||
return this.parseAwait();
|
||||
} else if (this.state.type.prefix) {
|
||||
const node = this.startNode();
|
||||
@@ -578,21 +566,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;
|
||||
}
|
||||
@@ -607,7 +590,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);
|
||||
@@ -623,7 +605,7 @@ export default class ExpressionParser extends LValParser {
|
||||
} else if (this.match(tt.questionDot)) {
|
||||
this.expectPlugin("optionalChaining");
|
||||
state.optionalChainMember = true;
|
||||
if (noCalls && this.lookahead().type === tt.parenL) {
|
||||
if (noCalls && this.lookaheadCharCode() === charCodes.leftParenthesis) {
|
||||
state.stop = true;
|
||||
return base;
|
||||
}
|
||||
@@ -655,6 +637,12 @@ export default class ExpressionParser extends LValParser {
|
||||
node.object = base;
|
||||
node.property = this.parseMaybePrivateName();
|
||||
node.computed = false;
|
||||
if (
|
||||
node.property.type === "PrivateName" &&
|
||||
node.object.type === "Super"
|
||||
) {
|
||||
this.raise(startPos, "Private fields can't be accessed on super");
|
||||
}
|
||||
if (state.optionalChainMember) {
|
||||
node.optional = false;
|
||||
return this.finishNode(node, "OptionalMemberExpression");
|
||||
@@ -676,22 +664,20 @@ export default class ExpressionParser extends LValParser {
|
||||
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,
|
||||
state.maybeAsyncArrow,
|
||||
base.type === "Import",
|
||||
base.type !== "Super",
|
||||
node,
|
||||
);
|
||||
if (!state.optionalChainMember) {
|
||||
this.finishCallExpression(node);
|
||||
@@ -699,11 +685,9 @@ export default class ExpressionParser extends LValParser {
|
||||
this.finishOptionalCallExpression(node);
|
||||
}
|
||||
|
||||
if (maybeAsyncArrow && this.shouldParseAsyncArrow()) {
|
||||
if (state.maybeAsyncArrow && this.shouldParseAsyncArrow()) {
|
||||
state.stop = true;
|
||||
|
||||
this.checkCommaAfterRestFromSpread();
|
||||
|
||||
node = this.parseAsyncArrowFromCallExpression(
|
||||
this.startNodeAt(startPos, startLoc),
|
||||
node,
|
||||
@@ -716,12 +700,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)) {
|
||||
@@ -803,6 +812,7 @@ export default class ExpressionParser extends LValParser {
|
||||
possibleAsyncArrow: boolean,
|
||||
dynamicImport?: boolean,
|
||||
allowPlaceholder?: boolean,
|
||||
nodeForExtra?: ?N.Node,
|
||||
): $ReadOnlyArray<?N.Expression> {
|
||||
const elts = [];
|
||||
let innerParenStart;
|
||||
@@ -815,13 +825,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;
|
||||
}
|
||||
}
|
||||
@@ -861,7 +879,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;
|
||||
}
|
||||
|
||||
@@ -1024,6 +1047,7 @@ export default class ExpressionParser extends LValParser {
|
||||
tt.bracketR,
|
||||
true,
|
||||
refShorthandDefaultPos,
|
||||
node,
|
||||
);
|
||||
if (!this.state.maybeInArrowParameters) {
|
||||
// This could be an array pattern:
|
||||
@@ -1231,8 +1255,8 @@ 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;
|
||||
@@ -1267,7 +1291,7 @@ export default class ExpressionParser extends LValParser {
|
||||
),
|
||||
);
|
||||
|
||||
this.checkCommaAfterRest();
|
||||
this.checkCommaAfterRest(charCodes.rightParenthesis);
|
||||
|
||||
break;
|
||||
} else {
|
||||
@@ -1310,8 +1334,8 @@ 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);
|
||||
@@ -1482,7 +1506,11 @@ 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);
|
||||
@@ -1550,7 +1578,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");
|
||||
}
|
||||
|
||||
@@ -1804,8 +1832,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;
|
||||
@@ -1834,6 +1862,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);
|
||||
@@ -1842,10 +1871,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();
|
||||
@@ -1859,11 +1888,13 @@ 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,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1975,7 +2006,7 @@ export default class ExpressionParser extends LValParser {
|
||||
node.params[i],
|
||||
BIND_VAR,
|
||||
allowDuplicates ? null : nameHash,
|
||||
"function paramter list",
|
||||
"function parameter list",
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1990,6 +2021,7 @@ export default class ExpressionParser extends LValParser {
|
||||
close: TokenType,
|
||||
allowEmpty?: boolean,
|
||||
refShorthandDefaultPos?: ?Pos,
|
||||
nodeForExtra?: ?N.Node,
|
||||
): $ReadOnlyArray<?N.Expression> {
|
||||
const elts = [];
|
||||
let first = true;
|
||||
@@ -1999,7 +2031,17 @@ 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));
|
||||
@@ -2066,6 +2108,11 @@ export default class ExpressionParser extends LValParser {
|
||||
|
||||
if (this.match(tt.name)) {
|
||||
name = this.state.value;
|
||||
|
||||
// An escaped identifier whose value is the same as a keyword
|
||||
if (!liberal && this.state.containsEsc && isKeyword(name)) {
|
||||
this.raise(this.state.pos, `Escape sequence in keyword ${name}`);
|
||||
}
|
||||
} else if (this.state.type.keyword) {
|
||||
name = this.state.type.keyword;
|
||||
|
||||
@@ -2112,11 +2159,18 @@ export default class ExpressionParser extends LValParser {
|
||||
);
|
||||
}
|
||||
|
||||
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",
|
||||
);
|
||||
} else if (
|
||||
this.state.awaitPos === -1 &&
|
||||
(this.state.maybeInArrowParameters || this.isAwaitAllowed())
|
||||
) {
|
||||
this.state.awaitPos = this.state.start;
|
||||
}
|
||||
}
|
||||
|
||||
if (this.state.inClassProperty && word === "arguments") {
|
||||
@@ -2146,10 +2200,16 @@ export default class ExpressionParser extends LValParser {
|
||||
}
|
||||
}
|
||||
|
||||
isAwaitAllowed(): boolean {
|
||||
if (this.scope.inFunction) return this.scope.inAsync;
|
||||
if (this.options.allowAwaitOutsideFunction) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
// Parses await expression inside async function.
|
||||
|
||||
parseAwait(): N.AwaitExpression {
|
||||
if (!this.state.awaitPos) {
|
||||
if (this.state.awaitPos === -1) {
|
||||
this.state.awaitPos = this.state.start;
|
||||
}
|
||||
const node = this.startNode();
|
||||
@@ -2178,7 +2238,7 @@ export default class ExpressionParser extends LValParser {
|
||||
// Parses yield expression inside generator.
|
||||
|
||||
parseYield(noIn?: ?boolean): N.YieldExpression {
|
||||
if (!this.state.yieldPos) {
|
||||
if (this.state.yieldPos === -1) {
|
||||
this.state.yieldPos = this.state.start;
|
||||
}
|
||||
const node = this.startNode();
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
// @flow
|
||||
|
||||
import * as charCodes from "charcodes";
|
||||
import { types as tt, type TokenType } from "../tokenizer/types";
|
||||
import type {
|
||||
TSParameterProperty,
|
||||
@@ -60,6 +61,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,7 +87,12 @@ 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":
|
||||
@@ -142,6 +156,7 @@ export default class LValParser extends NodeUtils {
|
||||
exprList: Expression[],
|
||||
isBinding: ?boolean,
|
||||
contextDescription: string,
|
||||
trailingCommaPos?: ?number,
|
||||
): $ReadOnlyArray<Pattern> {
|
||||
let end = exprList.length;
|
||||
if (end) {
|
||||
@@ -160,6 +175,11 @@ export default class LValParser extends NodeUtils {
|
||||
) {
|
||||
this.unexpected(arg.start);
|
||||
}
|
||||
|
||||
if (trailingCommaPos) {
|
||||
this.raiseTrailingCommaAfterRest(trailingCommaPos);
|
||||
}
|
||||
|
||||
--end;
|
||||
}
|
||||
}
|
||||
@@ -213,11 +233,6 @@ export default class LValParser extends NodeUtils {
|
||||
undefined,
|
||||
refNeedsArrowPos,
|
||||
);
|
||||
|
||||
if (this.state.commaAfterSpreadAt === -1 && this.match(tt.comma)) {
|
||||
this.state.commaAfterSpreadAt = this.state.start;
|
||||
}
|
||||
|
||||
return this.finishNode(node, "SpreadElement");
|
||||
}
|
||||
|
||||
@@ -234,7 +249,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 +266,7 @@ export default class LValParser extends NodeUtils {
|
||||
|
||||
parseBindingList(
|
||||
close: TokenType,
|
||||
closeCharCode: $Values<typeof charCodes>,
|
||||
allowEmpty?: boolean,
|
||||
allowModifiers?: boolean,
|
||||
): $ReadOnlyArray<Pattern | TSParameterProperty> {
|
||||
@@ -265,7 +285,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 {
|
||||
@@ -455,19 +475,21 @@ export default class LValParser extends NodeUtils {
|
||||
}
|
||||
}
|
||||
|
||||
checkCommaAfterRest(): void {
|
||||
checkCommaAfterRest(close: $Values<typeof charCodes>): void {
|
||||
if (this.match(tt.comma)) {
|
||||
this.raiseRestNotLast(this.state.start);
|
||||
}
|
||||
}
|
||||
|
||||
checkCommaAfterRestFromSpread(): void {
|
||||
if (this.state.commaAfterSpreadAt > -1) {
|
||||
this.raiseRestNotLast(this.state.commaAfterSpreadAt);
|
||||
if (this.lookaheadCharCode() === close) {
|
||||
this.raiseTrailingCommaAfterRest(this.state.start);
|
||||
} else {
|
||||
this.raiseRestNotLast(this.state.start);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
raiseRestNotLast(pos: number) {
|
||||
this.raise(pos, `Rest element must be last element`);
|
||||
}
|
||||
|
||||
raiseTrailingCommaAfterRest(pos: number) {
|
||||
this.raise(pos, `Unexpected trailing comma after rest element`);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
@@ -105,10 +105,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
|
||||
@@ -170,7 +167,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(
|
||||
@@ -223,8 +220,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;
|
||||
}
|
||||
|
||||
@@ -1050,12 +1050,14 @@ export default class StatementParser extends ExpressionParser {
|
||||
node.id = this.parseFunctionId(requireId);
|
||||
}
|
||||
|
||||
const oldMaybeInArrowParameters = this.state.maybeInArrowParameters;
|
||||
const oldInClassProperty = this.state.inClassProperty;
|
||||
const oldYieldPos = this.state.yieldPos;
|
||||
const oldAwaitPos = this.state.awaitPos;
|
||||
this.state.maybeInArrowParameters = false;
|
||||
this.state.inClassProperty = false;
|
||||
this.state.yieldPos = 0;
|
||||
this.state.awaitPos = 0;
|
||||
this.state.yieldPos = -1;
|
||||
this.state.awaitPos = -1;
|
||||
this.scope.enter(functionFlags(node.async, node.generator));
|
||||
|
||||
if (!isStatement) {
|
||||
@@ -1084,6 +1086,7 @@ export default class StatementParser extends ExpressionParser {
|
||||
this.checkFunctionStatementId(node);
|
||||
}
|
||||
|
||||
this.state.maybeInArrowParameters = oldMaybeInArrowParameters;
|
||||
this.state.inClassProperty = oldInClassProperty;
|
||||
this.state.yieldPos = oldYieldPos;
|
||||
this.state.awaitPos = oldAwaitPos;
|
||||
@@ -1102,6 +1105,7 @@ export default class StatementParser extends ExpressionParser {
|
||||
this.expect(tt.parenL);
|
||||
node.params = this.parseBindingList(
|
||||
tt.parenR,
|
||||
charCodes.rightParenthesis,
|
||||
/* allowEmpty */ false,
|
||||
allowModifiers,
|
||||
);
|
||||
@@ -1498,13 +1502,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));
|
||||
}
|
||||
|
||||
@@ -1738,11 +1747,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"`);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1757,21 +1766,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")
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1833,10 +1831,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")
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -4,6 +4,8 @@ import { types as tt, type TokenType } from "../tokenizer/types";
|
||||
import Tokenizer from "../tokenizer";
|
||||
import type { Node } from "../types";
|
||||
import { lineBreak, skipWhiteSpace } from "../util/whitespace";
|
||||
import { isIdentifierChar } from "../util/identifier";
|
||||
import * as charCodes from "charcodes";
|
||||
|
||||
const literal = /^('|")((?:\\?.)*?)\1/;
|
||||
|
||||
@@ -26,8 +28,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
|
||||
@@ -60,9 +69,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 +177,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",
|
||||
|
||||
@@ -14,6 +14,8 @@ import {
|
||||
type BindingTypes,
|
||||
BIND_NONE,
|
||||
BIND_LEXICAL,
|
||||
BIND_VAR,
|
||||
BIND_FUNCTION,
|
||||
SCOPE_ARROW,
|
||||
SCOPE_OTHER,
|
||||
} from "../util/scopeflags";
|
||||
@@ -270,6 +272,7 @@ export default (superClass: Class<Parser>): Class<Parser> =>
|
||||
node.id = this.flowParseTypeAnnotatableIdentifier(
|
||||
/*allowPrimitiveOverride*/ true,
|
||||
);
|
||||
this.scope.declareName(node.id.name, BIND_VAR, node.id.start);
|
||||
this.semicolon();
|
||||
return this.finishNode(node, "DeclareVariable");
|
||||
}
|
||||
@@ -462,6 +465,12 @@ export default (superClass: Class<Parser>): Class<Parser> =>
|
||||
): void {
|
||||
node.id = this.flowParseRestrictedIdentifier(/*liberal*/ !isClass);
|
||||
|
||||
this.scope.declareName(
|
||||
node.id.name,
|
||||
isClass ? BIND_FUNCTION : BIND_LEXICAL,
|
||||
node.id.start,
|
||||
);
|
||||
|
||||
if (this.isRelational("<")) {
|
||||
node.typeParameters = this.flowParseTypeParameterDeclaration();
|
||||
} else {
|
||||
@@ -1789,6 +1798,7 @@ export default (superClass: Class<Parser>): Class<Parser> =>
|
||||
((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);
|
||||
@@ -1811,6 +1821,7 @@ export default (superClass: Class<Parser>): Class<Parser> =>
|
||||
((node.params: any): N.Expression[]),
|
||||
true,
|
||||
"arrow function parameters",
|
||||
node.extra?.trailingComma,
|
||||
);
|
||||
}
|
||||
return [arrows, []];
|
||||
@@ -1822,6 +1833,7 @@ export default (superClass: Class<Parser>): Class<Parser> =>
|
||||
((node.params: any): N.Expression[]),
|
||||
true,
|
||||
"arrow function parameters",
|
||||
node.extra?.trailingComma,
|
||||
);
|
||||
return true;
|
||||
} catch (err) {
|
||||
@@ -1996,6 +2008,7 @@ export default (superClass: Class<Parser>): Class<Parser> =>
|
||||
exprList: N.Expression[],
|
||||
isBinding: ?boolean,
|
||||
contextDescription: string,
|
||||
trailingCommaPos?: ?number,
|
||||
): $ReadOnlyArray<N.Pattern> {
|
||||
for (let i = 0; i < exprList.length; i++) {
|
||||
const expr = exprList[i];
|
||||
@@ -2003,7 +2016,12 @@ export default (superClass: Class<Parser>): Class<Parser> =>
|
||||
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
|
||||
@@ -2634,7 +2652,6 @@ export default (superClass: Class<Parser>): Class<Parser> =>
|
||||
startLoc: Position,
|
||||
noCalls: ?boolean,
|
||||
subscriptState: N.ParseSubscriptState,
|
||||
maybeAsyncArrow: boolean,
|
||||
): N.Expression {
|
||||
if (this.match(tt.questionDot) && this.isLookaheadRelational("<")) {
|
||||
this.expectPlugin("optionalChaining");
|
||||
@@ -2687,7 +2704,6 @@ export default (superClass: Class<Parser>): Class<Parser> =>
|
||||
startLoc,
|
||||
noCalls,
|
||||
subscriptState,
|
||||
maybeAsyncArrow,
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@ import type Parser from "../../parser";
|
||||
import {
|
||||
type BindingTypes,
|
||||
BIND_NONE,
|
||||
SCOPE_TS_MODULE,
|
||||
SCOPE_OTHER,
|
||||
BIND_TS_ENUM,
|
||||
BIND_TS_CONST_ENUM,
|
||||
@@ -19,6 +20,7 @@ import {
|
||||
BIND_CLASS,
|
||||
} from "../../util/scopeflags";
|
||||
import TypeScriptScopeHandler from "./scope";
|
||||
import * as charCodes from "charcodes";
|
||||
|
||||
type TsModifier =
|
||||
| "readonly"
|
||||
@@ -361,21 +363,23 @@ export default (superClass: Class<Parser>): Class<Parser> =>
|
||||
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"
|
||||
) {
|
||||
throw this.unexpected(
|
||||
pattern.start,
|
||||
"Name in a signature must be an Identifier, ObjectPattern or ArrayPattern," +
|
||||
`instead got ${pattern.type}`,
|
||||
);
|
||||
}
|
||||
return pattern;
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
tsParseTypeMemberSemicolon(): void {
|
||||
@@ -584,7 +588,7 @@ export default (superClass: Class<Parser>): Class<Parser> =>
|
||||
const restNode: N.TsRestType = this.startNode();
|
||||
this.next(); // skips ellipsis
|
||||
restNode.typeAnnotation = this.tsParseType();
|
||||
this.checkCommaAfterRest();
|
||||
this.checkCommaAfterRest(charCodes.rightSquareBracket);
|
||||
return this.finishNode(restNode, "TSRestType");
|
||||
}
|
||||
|
||||
@@ -657,7 +661,10 @@ export default (superClass: Class<Parser>): Class<Parser> =>
|
||||
: 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);
|
||||
@@ -1163,7 +1170,9 @@ export default (superClass: Class<Parser>): Class<Parser> =>
|
||||
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 +1188,10 @@ export default (superClass: Class<Parser>): Class<Parser> =>
|
||||
} else {
|
||||
this.unexpected();
|
||||
}
|
||||
|
||||
if (this.match(tt.braceL)) {
|
||||
this.scope.enter(SCOPE_TS_MODULE);
|
||||
node.body = this.tsParseModuleBlock();
|
||||
this.scope.exit();
|
||||
} else {
|
||||
this.semicolon();
|
||||
}
|
||||
@@ -1203,7 +1213,8 @@ export default (superClass: Class<Parser>): Class<Parser> =>
|
||||
|
||||
tsIsExternalModuleReference(): boolean {
|
||||
return (
|
||||
this.isContextual("require") && this.lookahead().type === tt.parenL
|
||||
this.isContextual("require") &&
|
||||
this.lookaheadCharCode() === charCodes.leftParenthesis
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1332,10 +1343,12 @@ export default (superClass: Class<Parser>): Class<Parser> =>
|
||||
// `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;
|
||||
@@ -1568,7 +1581,6 @@ export default (superClass: Class<Parser>): Class<Parser> =>
|
||||
startLoc: Position,
|
||||
noCalls: ?boolean,
|
||||
state: N.ParseSubscriptState,
|
||||
maybeAsyncArrow: boolean,
|
||||
): N.Expression {
|
||||
if (!this.hasPrecedingLineBreak() && this.match(tt.bang)) {
|
||||
this.state.exprAllowed = false;
|
||||
@@ -1631,14 +1643,7 @@ export default (superClass: Class<Parser>): Class<Parser> =>
|
||||
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 {
|
||||
@@ -2360,11 +2365,7 @@ export default (superClass: Class<Parser>): Class<Parser> =>
|
||||
}
|
||||
}
|
||||
|
||||
toAssignableList(
|
||||
exprList: N.Expression[],
|
||||
isBinding: ?boolean,
|
||||
contextDescription: string,
|
||||
): $ReadOnlyArray<N.Pattern> {
|
||||
toAssignableList(exprList: N.Expression[]): $ReadOnlyArray<N.Pattern> {
|
||||
for (let i = 0; i < exprList.length; i++) {
|
||||
const expr = exprList[i];
|
||||
if (!expr) continue;
|
||||
@@ -2381,7 +2382,7 @@ export default (superClass: Class<Parser>): Class<Parser> =>
|
||||
break;
|
||||
}
|
||||
}
|
||||
return super.toAssignableList(exprList, isBinding, contextDescription);
|
||||
return super.toAssignableList(...arguments);
|
||||
}
|
||||
|
||||
typeCastToParameter(node: N.TsTypeCastExpression): N.Node {
|
||||
|
||||
@@ -13,6 +13,7 @@ import {
|
||||
lineBreakG,
|
||||
isNewLine,
|
||||
isWhitespace,
|
||||
skipWhiteSpace,
|
||||
} from "../util/whitespace";
|
||||
import State from "./state";
|
||||
|
||||
@@ -168,6 +169,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 +247,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) this.raise(start, "Unterminated comment");
|
||||
|
||||
this.state.pos = end + 2;
|
||||
lineBreakG.lastIndex = start;
|
||||
@@ -267,13 +280,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);
|
||||
}
|
||||
}
|
||||
@@ -404,8 +411,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 +448,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);
|
||||
}
|
||||
|
||||
@@ -878,7 +881,11 @@ export default class Tokenizer extends LocationParser {
|
||||
// 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 {
|
||||
readInt(
|
||||
radix: number,
|
||||
len?: number,
|
||||
allowNumSeparator: boolean = true,
|
||||
): number | null {
|
||||
const start = this.state.pos;
|
||||
const forbiddenSiblings =
|
||||
radix === 16
|
||||
@@ -900,9 +907,9 @@ 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");
|
||||
}
|
||||
@@ -915,6 +922,13 @@ export default class Tokenizer extends LocationParser {
|
||||
this.raise(this.state.pos, "Invalid or unexpected token");
|
||||
}
|
||||
|
||||
if (!allowNumSeparator) {
|
||||
this.raise(
|
||||
this.state.pos,
|
||||
"Numeric separators are not allowed inside unicode escape sequences or hex escape sequences",
|
||||
);
|
||||
}
|
||||
|
||||
// Ignore this _ character
|
||||
++this.state.pos;
|
||||
continue;
|
||||
@@ -980,6 +994,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 +1011,7 @@ export default class Tokenizer extends LocationParser {
|
||||
}
|
||||
if (/[89]/.test(this.input.slice(start, this.state.pos))) {
|
||||
octal = false;
|
||||
isNonOctalDecimalInt = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1020,10 +1036,26 @@ 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;
|
||||
}
|
||||
@@ -1250,7 +1282,7 @@ export default class Tokenizer extends LocationParser {
|
||||
|
||||
readHexChar(len: number, throwOnInvalid: boolean): number | null {
|
||||
const codePos = this.state.pos;
|
||||
const n = this.readInt(16, len);
|
||||
const n = this.readInt(16, len, false);
|
||||
if (n === null) {
|
||||
if (throwOnInvalid) {
|
||||
this.raise(codePos, "Bad character escape sequence");
|
||||
@@ -1324,11 +1356,7 @@ export default class Tokenizer extends LocationParser {
|
||||
|
||||
readWord(): void {
|
||||
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}`);
|
||||
}
|
||||
const type = (!this.state.containsEsc && keywordTypes.get(word)) || tt.name;
|
||||
|
||||
// Allow @@iterator and @@asyncIterator as a identifier only inside type
|
||||
if (
|
||||
|
||||
@@ -55,11 +55,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;
|
||||
@@ -97,8 +92,8 @@ export default class State {
|
||||
decoratorStack: Array<Array<N.Decorator>> = [[]];
|
||||
|
||||
// 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<Token | N.Comment> = [];
|
||||
|
||||
@@ -1447,5 +1447,6 @@ export type Placeholder<N: PlaceholderTypes> = NodeBase & {
|
||||
|
||||
export type ParseSubscriptState = {
|
||||
optionalChainMember: boolean,
|
||||
maybeAsyncArrow: boolean,
|
||||
stop: boolean,
|
||||
};
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -373,7 +373,10 @@
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
],
|
||||
"extra": {
|
||||
"trailingComma": 140
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
@@ -494,7 +497,10 @@
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
],
|
||||
"extra": {
|
||||
"trailingComma": 200
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
|
||||
@@ -74,6 +74,9 @@
|
||||
},
|
||||
"name": "fn"
|
||||
},
|
||||
"extra": {
|
||||
"trailingComma": 11
|
||||
},
|
||||
"arguments": [
|
||||
{
|
||||
"type": "Identifier",
|
||||
|
||||
@@ -74,6 +74,9 @@
|
||||
},
|
||||
"name": "fn"
|
||||
},
|
||||
"extra": {
|
||||
"trailingComma": 7
|
||||
},
|
||||
"arguments": [
|
||||
{
|
||||
"type": "Identifier",
|
||||
|
||||
@@ -181,6 +181,9 @@
|
||||
}
|
||||
}
|
||||
],
|
||||
"extra": {
|
||||
"trailingComma": 35
|
||||
},
|
||||
"trailingComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
|
||||
@@ -309,7 +309,10 @@
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
],
|
||||
"extra": {
|
||||
"trailingComma": 66
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
|
||||
@@ -250,7 +250,25 @@
|
||||
"label": null
|
||||
}
|
||||
],
|
||||
"test": null
|
||||
"test": null,
|
||||
"leadingComments": [
|
||||
{
|
||||
"type": "CommentLine",
|
||||
"value": " comment",
|
||||
"start": 47,
|
||||
"end": 57,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 4,
|
||||
"column": 4
|
||||
},
|
||||
"end": {
|
||||
"line": 4,
|
||||
"column": 14
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -163,7 +163,10 @@
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
],
|
||||
"extra": {
|
||||
"trailingComma": 13
|
||||
}
|
||||
}
|
||||
},
|
||||
"trailingComments": [
|
||||
@@ -215,7 +218,25 @@
|
||||
"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": []
|
||||
|
||||
5
packages/babel-parser/test/fixtures/comments/regression/10432/input.js
vendored
Normal file
5
packages/babel-parser/test/fixtures/comments/regression/10432/input.js
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
const socket = socketClient(address)
|
||||
/* istanbul ignore next */
|
||||
socket.on('connect', function () {
|
||||
debug('Connected to ' + address)
|
||||
})
|
||||
431
packages/babel-parser/test/fixtures/comments/regression/10432/output.json
vendored
Normal file
431
packages/babel-parser/test/fixtures/comments/regression/10432/output.json
vendored
Normal file
@@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
2
packages/babel-parser/test/fixtures/comments/regression/10448/input.js
vendored
Normal file
2
packages/babel-parser/test/fixtures/comments/regression/10448/input.js
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
function foo([foo, /* not used */, /* not used */]) {
|
||||
}
|
||||
191
packages/babel-parser/test/fixtures/comments/regression/10448/output.json
vendored
Normal file
191
packages/babel-parser/test/fixtures/comments/regression/10448/output.json
vendored
Normal file
@@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
3
packages/babel-parser/test/fixtures/core/escape-keyword/invalid/input.js
vendored
Normal file
3
packages/babel-parser/test/fixtures/core/escape-keyword/invalid/input.js
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
var a = {
|
||||
br\u{65}ak
|
||||
};
|
||||
3
packages/babel-parser/test/fixtures/core/escape-keyword/invalid/options.json
vendored
Normal file
3
packages/babel-parser/test/fixtures/core/escape-keyword/invalid/options.json
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"throws": "Unexpected keyword 'break' (2:2)"
|
||||
}
|
||||
3
packages/babel-parser/test/fixtures/core/escape-keyword/used-as-property/input.js
vendored
Normal file
3
packages/babel-parser/test/fixtures/core/escape-keyword/used-as-property/input.js
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
var a = {
|
||||
br\u{65}ak: 2
|
||||
};
|
||||
157
packages/babel-parser/test/fixtures/core/escape-keyword/used-as-property/output.json
vendored
Normal file
157
packages/babel-parser/test/fixtures/core/escape-keyword/used-as-property/output.json
vendored
Normal file
@@ -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": []
|
||||
}
|
||||
}
|
||||
@@ -110,7 +110,10 @@
|
||||
},
|
||||
"value": 42
|
||||
}
|
||||
]
|
||||
],
|
||||
"extra": {
|
||||
"trailingComma": 8
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -150,7 +150,10 @@
|
||||
},
|
||||
"value": 3
|
||||
}
|
||||
]
|
||||
],
|
||||
"extra": {
|
||||
"trailingComma": 13
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -151,7 +151,10 @@
|
||||
},
|
||||
"value": 3
|
||||
}
|
||||
]
|
||||
],
|
||||
"extra": {
|
||||
"trailingComma": 14
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
{
|
||||
"throws": "Rest element must be last element (1:5)"
|
||||
"throws": "Unexpected trailing comma after rest element (1:5)"
|
||||
}
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
for ([...a,] in []);
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"throws": "Unexpected trailing comma after rest element (1:10)"
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
[[...a,]] = [];
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"throws": "Unexpected trailing comma after rest element (1:6)"
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user