Compare commits

..

No commits in common. "initializers-fix" and "v7.6.0" have entirely different histories.

3198 changed files with 6690 additions and 179997 deletions

View File

@ -30,20 +30,11 @@ aliases:
- &artifact_env_min
path: ~/babel/packages/babel-preset-env-standalone/babel-preset-env.min.js
- &test262_workdir
working_directory: ~/babel/babel-test262-runner
- &artifact_test262_tap
path: ~/test262.tap
- &artifact_test262_xunit
path: ~/test-results
jobs:
test:
build:
working_directory: ~/babel
docker:
- image: circleci/node:13
- image: circleci/node:12
steps:
- checkout
- restore-cache: *restore-yarn-cache
@ -63,59 +54,3 @@ jobs:
- store_artifacts: *artifact_env_min
- save_cache: *save-node-modules-cache
- save_cache: *save-yarn-cache
test262:
working_directory: ~/babel
docker:
- image: circleci/node:12
steps:
- checkout
- restore-cache: *restore-yarn-cache
- restore-cache: *restore-node-modules-cache
- run:
name: Build Babel
command: BABEL_ENV=test make bootstrap
- run:
name: Link Babel
command: |
cd packages
for package in */; do
cd $package
yarn link
cd ..
done
- run:
name: Setup Test Runner
command: |
git clone --recurse-submodules https://github.com/babel/babel-test262-runner
cd babel-test262-runner
yarn
yarn add tap-mocha-reporter --dev
curl -L https://github.com/stedolan/jq/releases/download/jq-1.5/jq-linux64 > jq
chmod +x ./jq
for package in ../packages/*/package.json; do
yarn link $(./jq -j ".name" $package)
done
node lib/download-node
- run:
name: Run Test262
command: node lib/run-tests I_AM_SURE | tee ~/test262.tap
<<: *test262_workdir
- store_artifacts: *artifact_test262_tap
- run:
name: Output test262 results
command: |
cat ~/test262.tap | $(npm bin)/tap-mocha-reporter spec || true
<<: *test262_workdir
workflows:
version: 2
test:
jobs:
- test
master:
jobs:
- test262:
filters:
branches:
only:
- master

View File

@ -24,6 +24,4 @@ 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'

View File

@ -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 Compliance**
* **Spec Compliancy**
* 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 Compliance**
* **Spec Compliancy**
* 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 Compliance**
* **Spec Compliancy**
* 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 Compliance**
* **Spec Compliancy**
* 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 Compliance**
* **Spec Compliancy**
* Class inheritance now has a `function` or `null` type check.
* Add `interopRequireWildcard` around wildcard imports and exports to handle non-object exports.

View File

@ -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 Compliance**
* **Spec Compliancy**
* 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 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.
* **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.
* **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.

View File

@ -12,7 +12,7 @@
## 5.8.24
* **Spec Compliance**
* **Spec Compliancy**
* Updated `optimisation.react.inlineElements` transformer to React 0.14 output. Thanks [@spicyj](https://github.com/spicyj)!
* **Polish**
* Add support for evaluating more static nodes. Thanks [@hzoo](https://github.com/hzoo)!
@ -451,7 +451,7 @@ Issues with publish process.
![gifs lol](https://31.media.tumblr.com/568205a0e37ae15eca510fa639589a59/tumblr_n8kw8kpcSb1sg6cg8o1_500.gif)
* **Spec Compliance**
* **Spec Compliancy**
* 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 Compliance**
* **Spec Compliancy**
* 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 Compliance**
* **Spec Compliancy**
* Fix object decorators not using the `initializer` pattern.
* Remove property initializer descriptor reflection.

View File

@ -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 Compliance
#### :eyeglasses: Spec Compliancy
* `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 Compliance
#### :eyeglasses: Spec Compliancy
* `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-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).
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).
```js
// async generator syntax
@ -1569,7 +1569,7 @@ First PR!
Babel 6.16: Happy 2nd Birthday 🎂!
#### :eyeglasses: Spec Compliance
#### :eyeglasses: Spec Compliancy
* `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 Compliance
#### Spec Compliancy
* `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 Compliance
#### Spec Compliancy
* `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 Compliance
#### Spec Compliancy
* `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 Compliance**
* **Spec Compliancy**
* `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 Compliance**
* **Spec Compliancy**
* 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 Compliance**
* **Spec Compliancy**
* 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 Compliance**
* **Spec Compliancy**
* Update exponentiation operator precedence.
* Fix parser bug where arrow functions have a higher precedence than they should.
* **Bug Fix**

View File

@ -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 and write "Fixes" before the number to link the issues -->
| Fixed Issues? | `Fixes #1, Fixes #2` <!-- remove the (`) quotes to link the issues -->
| Patch: Bug Fix? |
| Major: Breaking Change? |
| Minor: New Feature? |

2
.github/lock.yml vendored
View File

@ -4,7 +4,7 @@
daysUntilLock: 91
# Comment to post before locking. Set to `false` to disable
lockComment: false
# The label to be applied when an issue is locked
only: issues
lockLabel: 'outdated'
# Issues or pull requests with these labels will not be locked

76
.github/main.workflow vendored Normal file
View File

@ -0,0 +1,76 @@
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"]
}

View File

@ -1,81 +0,0 @@
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.

View File

@ -1,53 +0,0 @@
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

2
.gitignore vendored
View File

@ -35,7 +35,7 @@ package-lock.json
!/packages/babel-runtime-corejs2/helpers/temporalRef.js
/packages/babel-runtime-corejs2/helpers/esm/*.js
!/packages/babel-runtime-corejs2/helpers/esm/toArray.js
/packages/babel-runtime-corejs2/helpers/esm/iterableToArray.js
!/packages/babel-runtime-corejs2/helpers/esm/iterableToArray.js
!/packages/babel-runtime-corejs2/helpers/esm/temporalRef.js
/packages/babel-runtime-corejs2/core-js/**/*.js
!/packages/babel-runtime-corejs2/core-js/map.js

View File

@ -3,43 +3,41 @@ git:
language: node_js
cache:
yarn: true
os: linux
node_js:
# We test the latest version on circleci
- '11'
- '10'
- '8'
- '6'
env:
global:
- PATH=$HOME/.yarn/bin:$PATH
- JOB=test
install: skip
before_script:
before_install:
- curl -o- -L https://yarnpkg.com/install.sh | bash
- if [ "$TRAVIS_OS_NAME" = "windows" ]; then choco install make; fi
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
before_script:
- if [ "$JOB" = "babel-parser-flow-tests" ]; then make bootstrap-flow; fi
- if [ "$JOB" = "babel-parser-test262-tests" ]; then make bootstrap-test262; fi
script:
- 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
- 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
matrix:
fast_finish: true
include:
- node_js: "node"
env: JOB=lint
# We test the latest version on circleci
- node_js: "12"
# Move `windows` build to be the third since it is slow
- os: windows
node_js: "node"
env:
- JOB=test
# https://travis-ci.community/t/build-doesnt-finish-after-completing-tests/288/9
- YARN_GPG=no
# 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"

View File

@ -2,7 +2,7 @@
> **Tags:**
> - :boom: [Breaking Change]
> - :eyeglasses: [Spec Compliance]
> - :eyeglasses: [Spec Compliancy]
> - :rocket: [New Feature]
> - :bug: [Bug Fix]
> - :memo: [Documentation]
@ -17,314 +17,6 @@ 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.7.3 (2019-11-08)
#### :bug: Bug Fix
* `babel-parser`
* [#10682](https://github.com/babel/babel/pull/10682) Don't recover from "adjacent jsx elements" parser error ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo))
## v7.7.2 (2019-11-07)
#### :bug: Bug Fix
* `babel-parser`
* [#10669](https://github.com/babel/babel/pull/10669) Parse arrows with params annotations in conditional expressions ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo))
* `babel-plugin-transform-typescript`
* [#10658](https://github.com/babel/babel/pull/10658) fix: remove accessibility of constructor ([@JLHwung](https://github.com/JLHwung))
* `babel-traverse`
* [#10656](https://github.com/babel/babel/pull/10656) fix: add inList setter for compatibility with babel-minify ([@JLHwung](https://github.com/JLHwung))
## v7.7.1 (2019-11-05)
#### :bug: Bug Fix
* `babel-types`
* [#10650](https://github.com/babel/babel/pull/10650) Revert "throw a TypeError if identifier validation fails (#10621)" ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo))
* `babel-preset-env`
* [#10649](https://github.com/babel/babel/pull/10649) Fix(babel-preset-env): check api.caller is a function to avoid to thr… ([@love2me](https://github.com/love2me))
## v7.7.0 (2019-11-05)
#### :eyeglasses: Spec Compliance
* `babel-types`
* [#10621](https://github.com/babel/babel/pull/10621) throw a TypeError if identifier validation fails. ([@dentrado](https://github.com/dentrado))
* `babel-parser`
* [#10559](https://github.com/babel/babel/pull/10559) fix: Exclude catch clause from let identifier error. ([@gonzarodriguezt](https://github.com/gonzarodriguezt))
* [#10567](https://github.com/babel/babel/pull/10567) [parser] Exception to 8 and 9 in tagged template. ([@pnowak](https://github.com/pnowak))
* [#10532](https://github.com/babel/babel/pull/10532) Allow duplicate __proto__ keys in patterns, simple case (#6705). ([@alejo90](https://github.com/alejo90))
#### :rocket: New Feature
* `babel-generator`, `babel-helper-create-class-features-plugin`, `babel-parser`, `babel-plugin-transform-typescript`, `babel-preset-typescript`, `babel-types`
* [#10545](https://github.com/babel/babel/pull/10545) Add support for TS declare modifier on fields. ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo))
* `babel-core`, `babel-parser`, `babel-preset-typescript`
* [#10363](https://github.com/babel/babel/pull/10363) @babel/parser error recovery. ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo))
* `babel-core`
* [#10599](https://github.com/babel/babel/pull/10599) Add support for .cjs config files. ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo))
* [#10501](https://github.com/babel/babel/pull/10501) Add support for babel.config.json. ([@devongovett](https://github.com/devongovett))
* [#10361](https://github.com/babel/babel/pull/10361) feat: if code frame error is on a single line, highlight the whole path. ([@SimenB](https://github.com/SimenB))
* `babel-plugin-syntax-top-level-await`, `babel-preset-env`
* [#10573](https://github.com/babel/babel/pull/10573) Create @babel/plugin-syntax-top-level-await. ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo))
* `babel-helper-builder-react-jsx`, `babel-plugin-transform-react-jsx`, `babel-preset-react`
* [#10572](https://github.com/babel/babel/pull/10572) [transform-react-jsx] Add useSpread option to transform JSX. ([@ivandevp](https://github.com/ivandevp))
* `babel-generator`, `babel-parser`, `babel-plugin-proposal-decorators`, `babel-plugin-syntax-flow`, `babel-types`
* [#10344](https://github.com/babel/babel/pull/10344) Flow enums parsing. ([@gkz](https://github.com/gkz))
* `babel-plugin-transform-function-name`, `babel-plugin-transform-modules-umd`, `babel-preset-env`
* [#10477](https://github.com/babel/babel/pull/10477) Changes UMD callsite to be more likely to pass in the intended object.. ([@MicahZoltu](https://github.com/MicahZoltu))
* `babel-parser`
* [#10449](https://github.com/babel/babel/pull/10449) Create parser plugin "topLevelAwait". ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo))
* [#10521](https://github.com/babel/babel/pull/10521) [parser] Enable "exportNamespaceFrom" by default. ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo))
* [#10483](https://github.com/babel/babel/pull/10483) [parser] Add support for private fields in TypeScript. ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo))
* `babel-generator`, `babel-parser`, `babel-types`
* [#10543](https://github.com/babel/babel/pull/10543) add assertions signature for TypeScript. ([@tanhauhau](https://github.com/tanhauhau))
* `babel-cli`, `babel-register`
* [#8622](https://github.com/babel/babel/pull/8622) Make dir for babel --out-file. ([@TrySound](https://github.com/TrySound))
* `babel-cli`
* [#10399](https://github.com/babel/babel/pull/10399) Closes [#8326](https://github.com/babel/babel/issues/8326), add back --quiet option.. ([@chris-peng-1244](https://github.com/chris-peng-1244))
#### :bug: Bug Fix
* `babel-helpers`, `babel-plugin-proposal-async-generator-functions`, `babel-plugin-proposal-function-sent`, `babel-preset-env`
* [#10422](https://github.com/babel/babel/pull/10422) Correctly delegate .return() in async generator. ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo))
* `babel-helper-module-transforms`, `babel-plugin-transform-modules-commonjs`
* [#10628](https://github.com/babel/babel/pull/10628) Don't throw when destructuring into a var named as an import. ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo))
* `babel-plugin-transform-modules-systemjs`
* [#10638](https://github.com/babel/babel/pull/10638) fix: remove ExportNamedDeclaration when the specifier is empty. ([@JLHwung](https://github.com/JLHwung))
* `babel-parser`
* [#10631](https://github.com/babel/babel/pull/10631) [TS] Parse calls with type args in optional chains. ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo))
* [#10607](https://github.com/babel/babel/pull/10607) fixed missing errors on assignment pattern in object expression. ([@vivek12345](https://github.com/vivek12345))
* [#10594](https://github.com/babel/babel/pull/10594) [parser] Parse only modifiers of actual methods. ([@gonzarodriguezt](https://github.com/gonzarodriguezt))
* `babel-plugin-transform-typescript`
* [#10555](https://github.com/babel/babel/pull/10555) [TS] Correctly transform computed strings and templates in enums. ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo))
* `babel-core`
* [#10623](https://github.com/babel/babel/pull/10623) Fix: inputSourceMap should work when it is an external file. ([@JLHwung](https://github.com/JLHwung))
* [#10539](https://github.com/babel/babel/pull/10539) fix: remove filename annotation in buildCodeFrameError. ([@JLHwung](https://github.com/JLHwung))
* `babel-plugin-proposal-decorators`
* [#10578](https://github.com/babel/babel/pull/10578) [decorators] fix: support string literal properties. ([@mwhitworth](https://github.com/mwhitworth))
* `babel-helpers`, `babel-plugin-proposal-dynamic-import`, `babel-plugin-transform-modules-commonjs`, `babel-preset-env`
* [#10574](https://github.com/babel/babel/pull/10574) fix: _interopRequireWildcard should only cache objects. ([@samMeow](https://github.com/samMeow))
* `babel-traverse`
* [#9777](https://github.com/babel/babel/pull/9777) [traverse] Allow skipping nodes inserted with .replaceWith(). ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo))
* `babel-preset-env`
* [#10146](https://github.com/babel/babel/pull/10146) Inject core-js@3 imports in Program:exit instead of on post(). ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo))
* `babel-generator`
* [#10519](https://github.com/babel/babel/pull/10519) Fix generator missing parens around an arrow returning function type. ([@existentialism](https://github.com/existentialism))
* `babel-plugin-transform-async-to-generator`, `babel-preset-env`, `babel-traverse`
* [#9939](https://github.com/babel/babel/pull/9939) Don't use args rest/spread to hoist super method calls. ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo))
#### :nail_care: Polish
* `babel-plugin-transform-classes`, `babel-plugin-transform-regenerator`, `babel-preset-env`
* [#9481](https://github.com/babel/babel/pull/9481) [preset-env] Don't use async-to-generator when already using regenerator. ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo))
* `babel-helpers`, `babel-plugin-transform-modules-commonjs`, `babel-preset-env`
* [#10585](https://github.com/babel/babel/pull/10585) fix(babelhelpers/interopRequireWildcard): Avoid double nullish check. ([@ExE-Boss](https://github.com/ExE-Boss))
* `babel-register`
* [#10557](https://github.com/babel/babel/pull/10557) fix: disable caching when babel could not read/write cache. ([@JLHwung](https://github.com/JLHwung))
#### :house: Internal
* `babel-cli`, `babel-node`
* [#10619](https://github.com/babel/babel/pull/10619) chore: remove output-file-sync dependency. ([@JLHwung](https://github.com/JLHwung))
* `babel-register`
* [#10614](https://github.com/babel/babel/pull/10614) chore: bump source-map-support to 0.5.14. ([@JLHwung](https://github.com/JLHwung))
* `babel-helper-create-regexp-features-plugin`, `babel-plugin-proposal-unicode-property-regex`, `babel-plugin-transform-dotall-regex`, `babel-plugin-transform-named-capturing-groups-regex`, `babel-plugin-transform-unicode-regex`, `babel-preset-env`
* [#10447](https://github.com/babel/babel/pull/10447) Merge multiple regex transform plugin. ([@JLHwung](https://github.com/JLHwung))
* `babel-preset-env`
* [#10612](https://github.com/babel/babel/pull/10612) chore: update web.immediate support fixtures. ([@JLHwung](https://github.com/JLHwung))
* `babel-helper-module-imports`
* [#10608](https://github.com/babel/babel/pull/10608) Use .find instead of .filter to get targetPath in ImportInjector. ([@Andarist](https://github.com/Andarist))
* Other
* [#10600](https://github.com/babel/babel/pull/10600) Test node@13 on circle. ([@existentialism](https://github.com/existentialism))
* [#10593](https://github.com/babel/babel/pull/10593) chore: replace outdated travis-ci.org badges [ci skip]. ([@JLHwung](https://github.com/JLHwung))
* [#10591](https://github.com/babel/babel/pull/10591) chore: test against Node.js 13. ([@JLHwung](https://github.com/JLHwung))
* [#10556](https://github.com/babel/babel/pull/10556) Add master branch workflow for test262 tests. ([@jbhoosreddy](https://github.com/jbhoosreddy))
* [#10553](https://github.com/babel/babel/pull/10553) chore: introduce envinfo into environment section. ([@JLHwung](https://github.com/JLHwung))
* `babel-runtime`
* [#10418](https://github.com/babel/babel/pull/10418) docs: add homepage link. ([@DanArthurGallagher](https://github.com/DanArthurGallagher))
* `babel-helper-annotate-as-pure`, `babel-helper-bindify-decorators`, `babel-helper-builder-binary-assignment-operator-visitor`, `babel-helper-builder-react-jsx`, `babel-helper-call-delegate`, `babel-helper-define-map`, `babel-helper-explode-assignable-expression`, `babel-helper-explode-class`, `babel-helper-function-name`, `babel-helper-get-function-arity`, `babel-helper-hoist-variables`, `babel-helper-member-expression-to-functions`, `babel-helper-module-imports`, `babel-helper-module-transforms`, `babel-helper-optimise-call-expression`, `babel-helper-remap-async-to-generator`, `babel-helper-replace-supers`, `babel-helper-simple-access`, `babel-helper-split-export-declaration`, `babel-helper-wrap-function`, `babel-helpers`, `babel-template`
* [#10568](https://github.com/babel/babel/pull/10568) Bump babel-types to ^7.6.3. ([@JLHwung](https://github.com/JLHwung))
#### :running_woman: Performance
* `babel-traverse`
* [#10480](https://github.com/babel/babel/pull/10480) Traverse performance. ([@JLHwung](https://github.com/JLHwung))
## v7.6.4 (2019-10-10)
#### :eyeglasses: Spec Compliance
* `babel-parser`
* [#10491](https://github.com/babel/babel/pull/10491) Trailing comma after rest - The final fix ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo))
#### :bug: Bug Fix
* `babel-cli`, `babel-core`, `babel-generator`, `babel-helper-transform-fixture-test-runner`
* [#10536](https://github.com/babel/babel/pull/10536) Revert "chore: Upgrade source-map to 0.6.1 (#10446)" ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo))
## v7.6.3 (2019-10-08)
#### :eyeglasses: Spec Compliance
* `babel-parser`
* [#10469](https://github.com/babel/babel/pull/10469) Disallow await inside async arrow params ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo))
* [#10493](https://github.com/babel/babel/pull/10493) [parser] Disallow numeric separators in legacy octal like integers ([@gonzarodriguezt](https://github.com/gonzarodriguezt))
#### :rocket: New Feature
* `babel-types`
* [#10504](https://github.com/babel/babel/pull/10504) Add declarations for more of @babel/types exports ([@Jessidhia](https://github.com/Jessidhia))
#### :bug: Bug Fix
* `babel-plugin-transform-block-scoping`
* [#10343](https://github.com/babel/babel/pull/10343) Do not remove let bindings even they are wrapped in closure ([@JLHwung](https://github.com/JLHwung))
* `babel-parser`
* [#10119](https://github.com/babel/babel/pull/10119) add scope to TSModuleDeclaration ([@tanhauhau](https://github.com/tanhauhau))
* [#10332](https://github.com/babel/babel/pull/10332) Do not allow member expressions to start async arrows ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo))
* [#10490](https://github.com/babel/babel/pull/10490) [parser] Don't crash on comment after trailing comma after elision ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo))
* `babel-plugin-transform-react-constant-elements`, `babel-traverse`
* [#10529](https://github.com/babel/babel/pull/10529) Do not hoist jsx referencing a mutable binding ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo))
* `babel-generator`, `babel-parser`, `babel-plugin-transform-block-scoping`, `babel-plugin-transform-flow-comments`, `babel-plugin-transform-flow-strip-types`, `babel-plugin-transform-typescript`
* [#10220](https://github.com/babel/babel/pull/10220) Flow: interface identifier should be declared in the scope ([@JLHwung](https://github.com/JLHwung))
#### :nail_care: Polish
* `babel-core`
* [#10419](https://github.com/babel/babel/pull/10419) assertNoDuplicates throw with more context ([@hjdivad](https://github.com/hjdivad))
* [#10511](https://github.com/babel/babel/pull/10511) Add filename to transform error ([@JLHwung](https://github.com/JLHwung))
#### :house: Internal
* Other
* [#10506](https://github.com/babel/babel/pull/10506) Use `make -j` for parallel build ([@JLHwung](https://github.com/JLHwung))
* [#10443](https://github.com/babel/babel/pull/10443) perf: only apply lazy cjs module transform on cli and core ([@JLHwung](https://github.com/JLHwung))
* [#10494](https://github.com/babel/babel/pull/10494) Enable optional chaining and nullish coalescing plugins ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo))
* `babel-cli`, `babel-core`, `babel-generator`, `babel-helper-fixtures`, `babel-helper-transform-fixture-test-runner`, `babel-node`, `babel-plugin-transform-react-jsx-source`, `babel-plugin-transform-runtime`, `babel-preset-env`, `babel-preset-react`
* [#10249](https://github.com/babel/babel/pull/10249) Add windows to travis ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo))
#### :running_woman: Performance
* `babel-parser`
* [#10371](https://github.com/babel/babel/pull/10371) perf: replace lookahead by lookaheadCharCode ([@JLHwung](https://github.com/JLHwung))
* Other
* [#10443](https://github.com/babel/babel/pull/10443) perf: only apply lazy cjs module transform on cli and core ([@JLHwung](https://github.com/JLHwung))
## v7.6.2 (2019-09-23)
#### :eyeglasses: Spec Compliance
* `babel-parser`
* [#10472](https://github.com/babel/babel/pull/10472) added check to disallow super.private variable access and test case added. ([@vivek12345](https://github.com/vivek12345))
* [#10468](https://github.com/babel/babel/pull/10468) [parser] Disallow numeric separator in unicode scape sequences. ([@ivandevp](https://github.com/ivandevp))
* [#10467](https://github.com/babel/babel/pull/10467) [parser] Invalid NonOctal Decimal. ([@gonzarodriguezt](https://github.com/gonzarodriguezt))
* [#10461](https://github.com/babel/babel/pull/10461) [parser] Disallow static fields named `constructor`. ([@guywaldman](https://github.com/guywaldman))
* [#10455](https://github.com/babel/babel/pull/10455) [parser] Report escapes in kws only if they won't be used as identifiers. ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo))
#### :bug: Bug Fix
* `babel-parser`
* [#10445](https://github.com/babel/babel/pull/10445) Leave trailing comments after handling a possible trailing comma. ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo))
* `babel-cli`
* [#10400](https://github.com/babel/babel/pull/10400) fix: allow the process to exit naturally. ([@JLHwung](https://github.com/JLHwung))
* `babel-core`
* [#10402](https://github.com/babel/babel/pull/10402) fix: pass optionLoc when validating plugin object. ([@JLHwung](https://github.com/JLHwung))
* `babel-plugin-transform-block-scoping`, `babel-plugin-transform-spread`, `babel-traverse`
* [#10417](https://github.com/babel/babel/pull/10417) Do not guess relative execution status for exported fns. ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo))
* `babel-plugin-proposal-object-rest-spread`, `babel-preset-env`
* [#10275](https://github.com/babel/babel/pull/10275) fix object rest in array pattern. ([@tanhauhau](https://github.com/tanhauhau))
#### :house: Internal
* `babel-plugin-transform-named-capturing-groups-regex`
* [#10430](https://github.com/babel/babel/pull/10430) refactor: replace regexp-tree by regexpu. ([@JLHwung](https://github.com/JLHwung))
* Other
* [#10441](https://github.com/babel/babel/pull/10441) Update GitHub actions to v2. ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo))
* [#10427](https://github.com/babel/babel/pull/10427) chore: add lint-ts rule. ([@JLHwung](https://github.com/JLHwung))
* `babel-helper-fixtures`
* [#10428](https://github.com/babel/babel/pull/10428) chore: remove tryResolve dependency. ([@JLHwung](https://github.com/JLHwung))
* `babel-node`
* [#10429](https://github.com/babel/babel/pull/10429) Remove babel polyfill dependency of babel-node. ([@bdwain](https://github.com/bdwain))
* `babel-generator`, `babel-helper-fixtures`
* [#10420](https://github.com/babel/babel/pull/10420) chore: remove trim-right dependency. ([@JLHwung](https://github.com/JLHwung))
* `babel-core`, `babel-plugin-transform-runtime`, `babel-register`
* [#10405](https://github.com/babel/babel/pull/10405) Remove circular dependency. ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo))
#### :running_woman: Performance
* `babel-parser`
* [#10421](https://github.com/babel/babel/pull/10421) Miscellaneous perf tweak. ([@JLHwung](https://github.com/JLHwung))
## v7.6.1 (2019-09-06)
#### :bug: Bug Fix
* `babel-types`
* [#10404](https://github.com/babel/babel/pull/10404) fix(types): correct typescript function headers ([@forstermatth](https://github.com/forstermatth))
* `babel-node`
* [#9758](https://github.com/babel/babel/pull/9758) Remove process.exit(1) from babel-node ([@dword-design](https://github.com/dword-design))
## v7.6.0 (2019-09-06)
#### :eyeglasses: Spec Compliance
* `babel-generator`, `babel-parser`
* [#10269](https://github.com/babel/babel/pull/10269) Fix parenthesis for nullish coalescing ([@vivek12345](https://github.com/vivek12345))
* `babel-helpers`, `babel-plugin-transform-block-scoping`, `babel-traverse`
* [#9498](https://github.com/babel/babel/pull/9498) Fix tdz checks in transform-block-scoping plugin ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo))
#### :rocket: New Feature
* `babel-core`
* [#10181](https://github.com/babel/babel/pull/10181) feat(errors): validate preset when filename is absent ([@JLHwung](https://github.com/JLHwung))
* `babel-helper-create-class-features-plugin`, `babel-helpers`, `babel-plugin-proposal-private-methods`
* [#10217](https://github.com/babel/babel/pull/10217) Class Private Static Accessors ([@tim-mc](https://github.com/tim-mc))
* `babel-generator`, `babel-parser`, `babel-types`
* [#10148](https://github.com/babel/babel/pull/10148) V8intrinsic syntax plugin ([@JLHwung](https://github.com/JLHwung))
* `babel-preset-typescript`
* [#10382](https://github.com/babel/babel/pull/10382) Allow setting 'allowNamespaces' in typescript preset ([@dsgkirkby](https://github.com/dsgkirkby))
* `babel-parser`
* [#10352](https://github.com/babel/babel/pull/10352) Do not register ambient classes to the TS scope ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo))
* `babel-types`
* [#10248](https://github.com/babel/babel/pull/10248) Add static to class property builder ([@yuri-karadzhov](https://github.com/yuri-karadzhov))
#### :bug: Bug Fix
* `babel-helpers`, `babel-plugin-transform-destructuring`, `babel-plugin-transform-modules-commonjs`, `babel-preset-env`
* [#10396](https://github.com/babel/babel/pull/10396) fix: early return when instance is not iterable ([@JLHwung](https://github.com/JLHwung))
* `babel-plugin-transform-runtime`
* [#10398](https://github.com/babel/babel/pull/10398) Add supports for polyfill computed methods ([@rhyzx](https://github.com/rhyzx))
* `babel-preset-env`
* [#10397](https://github.com/babel/babel/pull/10397) Don't polyfill when evaluation is not confident ([@rhyzx](https://github.com/rhyzx))
* [#10218](https://github.com/babel/babel/pull/10218) [preset-env] Include / exclude module plugins properly ([@AdamRamberg](https://github.com/AdamRamberg))
* [#10284](https://github.com/babel/babel/pull/10284) Replace es.string.reverse with es.array.reverse ([@epicfaace](https://github.com/epicfaace))
* `babel-plugin-transform-named-capturing-groups-regex`
* [#10395](https://github.com/babel/babel/pull/10395) fix: transform name capturing regex once ([@JLHwung](https://github.com/JLHwung))
* `babel-types`
* [#10098](https://github.com/babel/babel/pull/10098) fix typescript for babel-types ([@tanhauhau](https://github.com/tanhauhau))
* [#10319](https://github.com/babel/babel/pull/10319) Add a builder definition including name for tsTypeParameter ([@deificx](https://github.com/deificx))
* `babel-parser`
* [#10380](https://github.com/babel/babel/pull/10380) Refactor trailing comment adjustment ([@banga](https://github.com/banga))
* [#10369](https://github.com/babel/babel/pull/10369) Retain trailing comments in array expressions ([@banga](https://github.com/banga))
* [#10292](https://github.com/babel/babel/pull/10292) fix: assign trailing comment to ObjectProperty only when inside an ObjectExpression ([@JLHwung](https://github.com/JLHwung))
* `babel-parser`, `babel-types`
* [#10366](https://github.com/babel/babel/pull/10366) Don't allow JSXNamespacedName to chain ([@jridgewell](https://github.com/jridgewell))
* `babel-generator`, `babel-plugin-transform-typescript`, `babel-types`
* [#10341](https://github.com/babel/babel/pull/10341) Add TSBigIntKeyword to @babel/types ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo))
* `babel-core`, `babel-types`
* [#9960](https://github.com/babel/babel/pull/9960) Do not delete "fake" source map comments from strings ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo))
* `babel-plugin-transform-flow-comments`
* [#10329](https://github.com/babel/babel/pull/10329) Fix flow comments plugin issues ([@zaygraveyard](https://github.com/zaygraveyard))
* `babel-helpers`, `babel-plugin-transform-react-constant-elements`
* [#10307](https://github.com/babel/babel/pull/10307) [fix] jsx helper calls order ([@Sinewyk](https://github.com/Sinewyk))
* `babel-plugin-proposal-decorators`
* [#10302](https://github.com/babel/babel/pull/10302) fix: register inserted class declaration ([@thiagoarrais](https://github.com/thiagoarrais))
* `babel-plugin-proposal-do-expressions`, `babel-traverse`
* [#10070](https://github.com/babel/babel/pull/10070) Do expressions transform for switch statements ([@tanhauhau](https://github.com/tanhauhau))
* [#10277](https://github.com/babel/babel/pull/10277) remove finally from completion record in try statement ([@tanhauhau](https://github.com/tanhauhau))
* `babel-helpers`, `babel-plugin-transform-named-capturing-groups-regex`
* [#10136](https://github.com/babel/babel/pull/10136) fix capturing group for matchAll ([@tanhauhau](https://github.com/tanhauhau))
#### :nail_care: Polish
* `babel-plugin-transform-runtime`, `babel-preset-env`
* [#10372](https://github.com/babel/babel/pull/10372) Don't allow instance properties transformation on namespace ([@rhyzx](https://github.com/rhyzx))
#### :memo: Documentation
* [#10313](https://github.com/babel/babel/pull/10313) Adds note about two approval policy to PR template ([@thiagoarrais](https://github.com/thiagoarrais))
#### :house: Internal
* `babel-register`
* [#9847](https://github.com/babel/babel/pull/9847) Remove core-js dependency from @babel/register ([@coreyfarrell](https://github.com/coreyfarrell))
* `babel-helper-fixtures`, `babel-helper-transform-fixture-test-runner`, `babel-preset-env`
* [#10401](https://github.com/babel/babel/pull/10401) Use "validateLogs" for preset-env's debug fixtures ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo))
* `babel-parser`
* [#10380](https://github.com/babel/babel/pull/10380) Refactor trailing comment adjustment ([@banga](https://github.com/banga))
* `babel-helper-fixtures`, `babel-helper-transform-fixture-test-runner`, `babel-plugin-proposal-dynamic-import`, `babel-preset-env`
* [#10326](https://github.com/babel/babel/pull/10326) Allow testing logs with `@babel/helper-transform-fixture-test-runner` ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo))
* `babel-runtime-corejs2`, `babel-runtime`, `babel-types`
* [#10331](https://github.com/babel/babel/pull/10331) Commit generated code ([@JLHwung](https://github.com/JLHwung))
* `babel-cli`, `babel-core`, `babel-generator`, `babel-helper-create-class-features-plugin`, `babel-helper-fixtures`, `babel-node`, `babel-parser`, `babel-plugin-proposal-do-expressions`, `babel-plugin-proposal-pipeline-operator`, `babel-plugin-transform-modules-commonjs`, `babel-plugin-transform-runtime`, `babel-preset-env`, `babel-standalone`, `babel-template`, `babel-traverse`, `babel-types`
* [#10228](https://github.com/babel/babel/pull/10228) Update dev dependencies and fix linting errors ([@danez](https://github.com/danez))
* `babel-cli`
* [#10244](https://github.com/babel/babel/pull/10244) added flow to babel cli ([@Letladi](https://github.com/Letladi))
#### :running_woman: Performance
* `babel-helpers`, `babel-plugin-transform-modules-commonjs`, `babel-preset-env`
* [#10161](https://github.com/babel/babel/pull/10161) Improves the logic to import objects in helpers ([@ifsnow](https://github.com/ifsnow))
* `babel-traverse`
* [#10243](https://github.com/babel/babel/pull/10243) perf: always return `void 0` as undefined node ([@JLHwung](https://github.com/JLHwung))
## v7.5.5 (2019-07-17)
@ -697,7 +389,7 @@ See [Babylon's CHANGELOG](packages/babylon/CHANGELOG.md) for the Babylon pre-7.0
## v7.3.3 (2019-02-15)
#### :eyeglasses: Spec Compliance
#### :eyeglasses: Spec Compliancy
* `babel-generator`
* [#9501](https://github.com/babel/babel/pull/9501) Correctly output escapes in directives ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo))
@ -719,11 +411,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 compliance fixes and better support for smart pipelines and private methods.
Various spec compliancy fixes and better support for smart pipelines and private methods.
Thanks @gverni, @naffiq, @spondbob and @dstaley for their first PRs!
#### :eyeglasses: Spec Compliance
#### :eyeglasses: Spec Compliancy
* `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))
@ -771,7 +463,7 @@ This release fixes some regressions introduced in v7.3.0
Thanks to @jamesgeorge007 and @armano2 for their first PR!
#### :eyeglasses: Spec Compliance
#### :eyeglasses: Spec Compliancy
* `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))
@ -992,7 +684,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 Compliance
#### :eyeglasses: Spec Compliancy
* `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))
@ -1455,7 +1147,7 @@ Fixed a peerDep issue
Mostly bug fixes and some decorator updates
#### :eyeglasses: Spec Compliance
#### :eyeglasses: Spec Compliancy
* `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`
@ -1555,7 +1247,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 Compliance
#### :eyeglasses: Spec Compliancy
* `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))
@ -1745,7 +1437,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 Compliance
#### :eyeglasses: Spec Compliancy
* `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`
@ -1833,7 +1525,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 Compliance
#### :eyeglasses: Spec Compliancy
* `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))
@ -1932,7 +1624,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 Compliance
#### :eyeglasses: Spec Compliancy
* `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))
@ -2080,7 +1772,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 Compliance
#### :eyeglasses: Spec Compliancy
* `babel-plugin-proposal-optional-chaining`
* [#6345](https://github.com/babel/babel/pull/6345) Remove old optional chain features. ([@jridgewell](https://github.com/jridgewell))
@ -2293,7 +1985,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 Compliance
#### :eyeglasses: Spec Compliancy
* `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`
@ -2346,7 +2038,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 Compliance
#### :eyeglasses: Spec Compliancy
* `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))
@ -2360,7 +2052,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 Compliance
#### :eyeglasses: Spec Compliancy
* `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`
@ -2545,7 +2237,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 Compliance
#### :eyeglasses: Spec Compliancy
* `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`
@ -2825,7 +2517,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 Compliance
#### :eyeglasses: Spec Compliancy
* `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`
@ -2961,7 +2653,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 Compliance
#### :eyeglasses: Spec Compliancy
* `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`
@ -3010,9 +2702,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 Compliance
#### :eyeglasses: Spec Compliancy
* `babel-plugin-check-es2015-constants`
* [#5930](https://github.com/babel/babel/pull/5930) Spec compliance of check-es2015-constants plugin. ([@maurobringolf](https://github.com/maurobringolf))
* [#5930](https://github.com/babel/babel/pull/5930) Spec compliancy 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.
@ -3317,7 +3009,7 @@ var A = function A() {
## v7.0.0-alpha.12 (2017-05-31)
#### :eyeglasses: Spec Compliance
#### :eyeglasses: Spec Compliancy
* `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))
@ -3358,7 +3050,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 Compliance
#### :eyeglasses: Spec Compliancy
* `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))
@ -3432,7 +3124,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 Compliance
#### :eyeglasses: Spec Compliancy
* `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))

View File

@ -11,20 +11,25 @@ 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 defaultSourcesGlob = "./@(codemods|packages)/*/src/**/*.js";
const sources = ["codemods", "packages"];
function swapSrcWithLib(srcPath) {
const parts = srcPath.split(path.sep);
parts[2] = "lib";
parts[1] = "lib";
return parts.join(path.sep);
}
function getGlobFromSource(source) {
return `./${source}/*/src/**/*.js`;
}
function getIndexFromPackage(name) {
return `${name}/src/index.js`;
}
@ -51,28 +56,32 @@ function rename(fn) {
});
}
function buildBabel(exclude, sourcesGlob = defaultSourcesGlob) {
const base = __dirname;
function buildBabel(exclude) {
return merge(
sources.map(source => {
const base = path.join(__dirname, source);
let stream = gulp.src(sourcesGlob, { base: __dirname });
let stream = gulp.src(getGlobFromSource(source), { base: base });
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) {
@ -109,9 +118,6 @@ 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"));
@ -122,7 +128,7 @@ gulp.task(
"watch",
gulp.series("build-no-bundle", function watch() {
gulpWatch(
defaultSourcesGlob,
sources.map(getGlobFromSource),
{ debounceDelay: 200 },
gulp.task("build-no-bundle")
);

193
Makefile
View File

@ -1,5 +1,6 @@
MAKEFLAGS = -j1
FLOW_COMMIT = 09669846b7a7ca5a6c23c12d56bb3bebdafd67e9
TEST262_COMMIT = 8688c4ab79059c3097098605e69f1ee5eda6c409
TEST262_COMMIT = de567d3aa5de4eaa11e00131d26b9fe77997dfb0
# Fix color output until TravisCI fixes https://github.com/travis-ci/travis-ci/issues/7967
export FORCE_COLOR = true
@ -8,110 +9,59 @@ SOURCES = packages codemods
.PHONY: build build-dist watch lint fix clean test-clean test-only test test-ci publish bootstrap
build: build-bundle
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
ifneq ("$(BABEL_COVERAGE)", "true")
$(MAKE) build-standalone
make build-standalone
make build-preset-env-standalone
endif
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-standalone:
./node_modules/.bin/gulp build-babel-standalone
build-preset-env-standalone:
yarn gulp build-babel-preset-env-standalone
./node_modules/.bin/gulp build-babel-preset-env-standalone
prepublish-build-standalone:
BABEL_ENV=production IS_PUBLISH=true yarn gulp build-babel-standalone
BABEL_ENV=production IS_PUBLISH=true ./node_modules/.bin/gulp build-babel-standalone
prepublish-build-preset-env-standalone:
BABEL_ENV=production IS_PUBLISH=true yarn gulp build-babel-preset-env-standalone
BABEL_ENV=production IS_PUBLISH=true ./node_modules/.bin/gulp build-babel-preset-env-standalone
build-dist: build-polyfill-dist build-plugin-transform-runtime-dist
build-polyfill-dist:
build-dist: build
cd packages/babel-polyfill; \
scripts/build-dist.sh
build-plugin-transform-runtime-dist:
cd packages/babel-plugin-transform-runtime; \
node scripts/build-dist.js
build-no-bundle: clean clean-lib
BABEL_ENV=development yarn gulp build-no-bundle
watch: clean clean-lib
# Ensure that build artifacts for types are created during local
# development too.
$(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
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
flow:
yarn flow check --strip-root
./node_modules/.bin/flow check --strip-root
bootstrap-flowcheck: bootstrap-only
yarn gulp build-babel-types
$(MAKE) build-typings
lint:
./node_modules/.bin/eslint scripts $(SOURCES) '*.js' --format=codeframe
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: fix-json
./node_modules/.bin/eslint scripts $(SOURCES) '*.js' --format=codeframe --fix
fix-json:
yarn prettier "{packages,codemod}/*/test/fixtures/**/options.json" --write --loglevel warn
./node_modules/.bin/prettier "{packages,codemod}/*/test/fixtures/**/options.json" --write --loglevel warn
clean: test-clean
rm -f .npmrc
@ -124,80 +74,72 @@ 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: jest-ci
test-ci: bootstrap test-only
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: build-bundle-ci bootstrap-flow
$(MAKE) test-flow
test-flow-ci: bootstrap 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-09-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-01-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: build-bundle-ci bootstrap-test262
$(MAKE) test-test262
test-test262-ci: bootstrap 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: clean-lib clean-runtime-helpers
NODE_ENV=production BABEL_ENV=production $(MAKE) build
$(MAKE) clone-license
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:
$(MAKE) bootstrap-only
$(MAKE) prepublish-build
$(MAKE) test
make bootstrap-only
make prepublish-build
make test
new-version:
git pull --rebase
yarn lerna version --force-publish="@babel/runtime,@babel/runtime-corejs2,@babel/runtime-corejs3,@babel/standalone,@babel/preset-env-standalone"
publish-cerxes: prepublish
yarn lerna publish --registry="https://npm.cerxes.net" --force-publish --allow-branch initializers-fix --canary --preid csx --dist-tag csx
./node_modules/.bin/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
yarn lerna publish from-git
$(MAKE) clean
./node_modules/.bin/lerna publish from-git --require-scripts
make clean
publish-ci: prepublish
ifneq ("$(NPM_TOKEN)", "")
@ -206,30 +148,23 @@ else
echo "Missing NPM_TOKEN env var"
exit 1
endif
yarn lerna publish from-git --yes
./node_modules/.bin/lerna publish from-git --require-scripts --yes
rm -f .npmrc
$(MAKE) clean
make clean
bootstrap-only: lerna-bootstrap
yarn-install: clean-all
bootstrap-only: clean-all
yarn --ignore-engines
lerna-bootstrap: yarn-install
yarn lerna bootstrap
./node_modules/.bin/lerna bootstrap -- --ignore-engines
bootstrap: bootstrap-only
$(MAKE) build
make build
cd packages/babel-plugin-transform-runtime; \
node scripts/build-dist.js
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
@ -238,7 +173,7 @@ clean-all:
$(foreach source, $(SOURCES), \
$(call clean-source-all, $(source)))
$(MAKE) clean
make clean
define clean-source-lib
rm -rf $(1)/*/lib

View File

@ -4,23 +4,16 @@
</a>
</p>
<p align="center">
<span style="color:darkred">
<b><i>WARNING</i> This is a fork of babel to test a fix for initializer-variables with class-properties (proposals-stuff)</b>
</span>
</p>
<p align="center">
The compiler for writing next generation JavaScript.
</p>
<p align="center">
<a href="https://www.npmjs.com/package/@babel/core"><img alt="v7 npm Downloads" src="https://img.shields.io/npm/dm/@babel/core.svg?maxAge=43200&label=v7%20downloads"></a>
<a href="https://www.npmjs.com/package/babel-core"><img alt="v6 npm Downloads" src="https://img.shields.io/npm/dm/babel-core.svg?maxAge=43200&label=v6%20downloads"></a>
</p>
<p align="center">
<a href="https://travis-ci.com/babel/babel"><img alt="Travis Status" src="https://img.shields.io/travis/com/babel/babel/master.svg?label=travis&maxAge=43200"></a>
<a href="https://travis-ci.org/babel/babel"><img alt="Travis Status" src="https://img.shields.io/travis/babel/babel/master.svg?label=travis&maxAge=43200"></a>
<a href="https://circleci.com/gh/babel/babel"><img alt="CircleCI Status" src="https://img.shields.io/circleci/project/github/babel/babel/master.svg?label=circle&maxAge=43200"></a>
<a href="https://codecov.io/github/babel/babel"><img alt="Coverage Status" src="https://img.shields.io/codecov/c/github/babel/babel/master.svg?maxAge=43200"></a>
<a href="https://slack.babeljs.io/"><img alt="Slack Status" src="https://slack.babeljs.io/badge.svg"></a>

View File

@ -77,10 +77,9 @@ module.exports = function(api) {
"@babel/proposal-object-rest-spread",
{ useBuiltIns: true, loose: true },
],
"@babel/plugin-proposal-optional-chaining",
"@babel/plugin-proposal-nullish-coalescing-operator",
convertESM ? "@babel/transform-modules-commonjs" : null,
// Explicitly use the lazy version of CommonJS modules.
convertESM ? ["@babel/transform-modules-commonjs", { lazy: true }] : null,
].filter(Boolean),
overrides: [
{
@ -91,17 +90,18 @@ module.exports = function(api) {
],
},
{
test: ["./packages/babel-cli", "./packages/babel-core"],
test: "./packages/babel-register",
plugins: [
// Explicitly use the lazy version of CommonJS modules.
convertESM
? ["@babel/transform-modules-commonjs", { lazy: true }]
: null,
// 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,
].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

View File

@ -16,7 +16,7 @@
"@babel/plugin-syntax-object-rest-spread": "^7.0.0"
},
"peerDependencies": {
"@babel/core": "^7.0.0-0 || csx"
"@babel/core": "^7.0.0-0"
},
"devDependencies": {
"@babel/core": "^7.0.0",

View File

@ -16,7 +16,7 @@
"@babel/plugin-syntax-optional-catch-binding": "^7.0.0"
},
"peerDependencies": {
"@babel/core": "^7.0.0-0 || csx"
"@babel/core": "^7.0.0-0"
},
"devDependencies": {
"@babel/core": "^7.0.0",

View File

@ -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 more easily.
* Tests across modules are run together which finds bugs that touch multiple modules easier.
**Cons:**

View File

@ -1,5 +1,5 @@
{
"version": "7.7.3",
"version": "7.6.0",
"changelog": {
"repo": "babel/babel",
"cacheDir": ".changelog",
@ -33,8 +33,5 @@
"npmClient": "yarn",
"npmClientArgs": [
"--no-lockfile"
],
"publishConfig": {
"registry": "https://npm.cerxes.net"
}
]
}

View File

@ -9,22 +9,20 @@
"test": "make test"
},
"devDependencies": {
"@babel/cli": "^7.6.0",
"@babel/core": "^7.6.0",
"@babel/cli": "^7.4.4",
"@babel/core": "^7.4.5",
"@babel/eslint-plugin-development": "^1.0.1",
"@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-class-properties": "^7.4.4",
"@babel/plugin-proposal-export-namespace-from": "^7.2.0",
"@babel/plugin-proposal-numeric-separator": "^7.2.0",
"@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/plugin-transform-modules-commonjs": "^7.4.4",
"@babel/plugin-transform-runtime": "^7.4.4",
"@babel/preset-env": "^7.4.5",
"@babel/preset-flow": "^7.0.0",
"@babel/register": "^7.6.0",
"@babel/runtime": "^7.6.0",
"@babel/register": "^7.4.4",
"@babel/runtime": "^7.4.5",
"babel-eslint": "^11.0.0-beta.0",
"babel-jest": "^24.9.0",
"babel-jest": "^24.8.0",
"babel-loader": "^8.0.6",
"babel-plugin-transform-charcodes": "^0.2.0",
"browserify": "^16.2.3",
@ -40,7 +38,7 @@
"eslint-plugin-import": "^2.17.2",
"eslint-plugin-prettier": "^3.1.0",
"fancy-log": "^1.3.3",
"flow-bin": "^0.108.0",
"flow-bin": "^0.102.0",
"graceful-fs": "^4.1.15",
"gulp": "^4.0.2",
"gulp-babel": "^8.0.0",
@ -51,11 +49,12 @@
"gulp-uglify": "^3.0.2",
"gulp-watch": "^5.0.1",
"husky": "^3.0.0",
"jest": "^24.9.0",
"jest": "^24.8.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",
@ -64,9 +63,8 @@
"rollup-plugin-babel": "^4.0.0",
"rollup-plugin-node-resolve": "^5.0.0",
"rollup-plugin-replace": "^2.2.0",
"test262-stream": "^1.3.0",
"test262-stream": "^1.2.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",
@ -76,7 +74,7 @@
"@lerna/**/@lerna/collect-updates": "https://github.com/babel/lerna.git#babel-collect-updates"
},
"engines": {
"node": ">= 6.9.0 < 14.0.0",
"node": ">= 6.9.0 < 13.0.0",
"npm": ">= 3.x <= 6.x",
"yarn": ">=0.27.5 || >=1.0.0-20170811"
},
@ -116,7 +114,6 @@
],
"transformIgnorePatterns": [
"/node_modules/",
"/packages/babel-standalone/babel.js",
"<rootDir>/packages/babel-standalone/babel(\\.min)?\\.js",
"<rootDir>/packages/babel-preset-env-standalone/babel-preset-env(\\.min)?\\.js",
"/test/(fixtures|tmp|__data__)/",

View File

@ -1,6 +1,6 @@
{
"name": "@babel/cli",
"version": "7.7.0",
"version": "7.6.0",
"description": "Babel command line.",
"author": "Sebastian McKenzie <sebmck@gmail.com>",
"homepage": "https://babeljs.io/",
@ -24,7 +24,8 @@
"fs-readdir-recursive": "^1.1.0",
"glob": "^7.0.0",
"lodash": "^4.17.13",
"make-dir": "^2.1.0",
"mkdirp": "^0.5.1",
"output-file-sync": "^2.0.0",
"slash": "^2.0.0",
"source-map": "^0.5.0"
},
@ -32,11 +33,11 @@
"chokidar": "^2.1.8"
},
"peerDependencies": {
"@babel/core": "^7.0.0-0 || csx"
"@babel/core": "^7.0.0-0"
},
"devDependencies": {
"@babel/core": "^7.7.0",
"@babel/helper-fixtures": "^7.6.3"
"@babel/core": "^7.6.0",
"@babel/helper-fixtures": "^7.6.0"
},
"bin": {
"babel": "./bin/babel.js",

View File

@ -1,7 +1,8 @@
// @flow
import defaults from "lodash/defaults";
import { sync as makeDirSync } from "make-dir";
import outputFileSync from "output-file-sync";
import { sync as mkdirpSync } from "mkdirp";
import slash from "slash";
import path from "path";
import fs from "fs";
@ -9,11 +10,6 @@ import fs from "fs";
import * as util from "./util";
import { type CmdOptions } from "./options";
function outputFileSync(filePath: string, data: string | Buffer): void {
makeDirSync(path.dirname(filePath));
fs.writeFileSync(filePath, data);
}
export default async function({
cliOptions,
babelOptions,
@ -126,20 +122,18 @@ export default async function({
util.deleteDir(cliOptions.outDir);
}
makeDirSync(cliOptions.outDir);
mkdirpSync(cliOptions.outDir);
let compiledFiles = 0;
for (const filename of cliOptions.filenames) {
compiledFiles += await handle(filename);
}
if (!cliOptions.quiet) {
console.log(
`Successfully compiled ${compiledFiles} ${
compiledFiles !== 1 ? "files" : "file"
} with Babel.`,
);
}
console.log(
`Successfully compiled ${compiledFiles} ${
compiledFiles !== 1 ? "files" : "file"
} with Babel.`,
);
}
if (cliOptions.watch) {

View File

@ -4,7 +4,6 @@ import convertSourceMap from "convert-source-map";
import defaults from "lodash/defaults";
import sourceMap from "source-map";
import slash from "slash";
import { sync as makeDirSync } from "make-dir";
import path from "path";
import fs from "fs";
@ -90,8 +89,6 @@ export default async function({
const result = buildResult(fileResults);
if (cliOptions.outFile) {
makeDirSync(path.dirname(cliOptions.outFile));
// we've requested for a sourcemap to be written to disk
if (babelOptions.sourceMaps && babelOptions.sourceMaps !== "inline") {
const mapLoc = cliOptions.outFile + ".map";

View File

@ -6,12 +6,8 @@ import fileCommand from "./file";
const opts = parseArgv(process.argv);
if (opts) {
const fn = opts.cliOptions.outDir ? dirCommand : fileCommand;
fn(opts).catch(err => {
console.error(err);
process.exitCode = 1;
});
} else {
process.exitCode = 2;
}
const fn = opts.cliOptions.outDir ? dirCommand : fileCommand;
fn(opts).catch(err => {
console.error(err);
process.exit(1);
});

View File

@ -12,19 +12,19 @@ import pkg from "../../package.json";
// Standard Babel input configs.
commander.option(
"-f, --filename [filename]",
"The filename to use when reading from stdin. This will be used in source-maps, errors etc.",
"filename to use when reading from stdin - this will be used in source-maps, errors etc",
);
commander.option(
"--presets [list]",
"A comma-separated list of preset names.",
"comma-separated list of preset names",
collect,
);
commander.option(
"--plugins [list]",
"A comma-separated list of plugin names.",
"comma-separated list of plugin names",
collect,
);
commander.option("--config-file [path]", "Path to a .babelrc file to use.");
commander.option("--config-file [path]", "Path to a .babelrc file to use");
commander.option(
"--env-name [name]",
"The name of the 'env' to use when loading configs and plugins. " +
@ -40,101 +40,97 @@ commander.option(
commander.option("--source-type [script|module]", "");
commander.option(
"--no-babelrc",
"Whether or not to look up .babelrc and .babelignore files.",
"Whether or not to look up .babelrc and .babelignore files",
);
commander.option(
"--ignore [list]",
"List of glob paths to **not** compile.",
"list of glob paths to **not** compile",
collect,
);
commander.option(
"--only [list]",
"List of glob paths to **only** compile.",
"list of glob paths to **only** compile",
collect,
);
// Misc babel config.
commander.option(
"--no-highlight-code",
"Enable or disable ANSI syntax highlighting of code frames. (on by default)",
"enable/disable ANSI syntax highlighting of code frames (on by default)",
);
// General output formatting.
commander.option(
"--no-comments",
"Write comments to generated output. (true by default)",
"write comments to generated output (true by default)",
);
commander.option(
"--retain-lines",
"Retain line numbers. This will result in really ugly code.",
"retain line numbers - will result in really ugly code",
);
commander.option(
"--compact [true|false|auto]",
"Do not include superfluous whitespace characters and line terminators.",
"do not include superfluous whitespace characters and line terminators",
booleanify,
);
commander.option(
"--minified [true|false]",
"Save as many bytes when printing.",
);
commander.option("--minified", "save as much bytes when printing [true|false]");
commander.option(
"--auxiliary-comment-before [string]",
"Print a comment before any injected non-user code.",
"print a comment before any injected non-user code",
);
commander.option(
"--auxiliary-comment-after [string]",
"Print a comment after any injected non-user code.",
"print a comment after any injected non-user code",
);
// General source map formatting.
commander.option("-s, --source-maps [true|false|inline|both]", "", booleanify);
commander.option(
"--source-map-target [string]",
"Set `file` on returned source map.",
"set `file` on returned source map",
);
commander.option(
"--source-file-name [string]",
"Set `sources[0]` on returned source map.",
"set `sources[0]` on returned source map",
);
commander.option(
"--source-root [filename]",
"The root from which all sources are relative.",
"the root from which all sources are relative",
);
// Config params for certain module output formats.
commander.option(
"--module-root [filename]",
// eslint-disable-next-line max-len
"Optional prefix for the AMD module formatter that will be prepended to the filename on module definitions.",
"optional prefix for the AMD module formatter that will be prepend to the filename on module definitions",
);
commander.option("-M, --module-ids", "Insert an explicit id for modules.");
commander.option("-M, --module-ids", "insert an explicit id for modules");
commander.option(
"--module-id [string]",
"Specify a custom name for module ids.",
"specify a custom name for module ids",
);
// "babel" command specific arguments that are not passed to @babel/core.
commander.option(
"-x, --extensions [extensions]",
"List of extensions to compile when a directory has been the input. [.es6,.js,.es,.jsx,.mjs]",
"List of extensions to compile when a directory has been input [.es6,.js,.es,.jsx,.mjs]",
collect,
);
commander.option(
"--keep-file-extension",
"Preserve the file extensions of the input files.",
"Preserve the file extensions of the input files",
);
commander.option("-w, --watch", "Recompile files on changes.");
commander.option("-w, --watch", "Recompile files on changes");
commander.option(
"--skip-initial-build",
"Do not compile files before watching.",
"Do not compile files before watching",
);
commander.option(
"-o, --out-file [out]",
"Compile all input files into a single file.",
"Compile all input files into a single file",
);
commander.option(
"-d, --out-dir [out]",
"Compile an input directory of modules into an output directory.",
"Compile an input directory of modules into an output directory",
);
commander.option(
"--relative",
@ -142,23 +138,16 @@ commander.option(
);
commander.option(
"-D, --copy-files",
"When compiling a directory copy over non-compilable files.",
"When compiling a directory copy over non-compilable files",
);
commander.option(
"--include-dotfiles",
"Include dotfiles when compiling and copying non-compilable files.",
);
commander.option(
"--verbose",
"Log everything. This option conflicts with --quiet",
);
commander.option(
"--quiet",
"Don't log anything. This option conflicts with --verbose",
"Include dotfiles when compiling and copying non-compilable files",
);
commander.option("--verbose", "Log everything");
commander.option(
"--delete-dir-on-start",
"Delete the out directory before compilation.",
"Delete the out directory before compilation",
);
commander.version(pkg.version + " (@babel/core " + version + ")");
@ -169,7 +158,7 @@ export type CmdOptions = {
cliOptions: Object,
};
export default function parseArgv(args: Array<string>): CmdOptions | null {
export default function parseArgv(args: Array<string>): CmdOptions {
//
commander.parse(args);
@ -218,10 +207,6 @@ export default function parseArgv(args: Array<string>): CmdOptions | null {
errors.push("--delete-dir-on-start requires --out-dir");
}
if (commander.verbose && commander.quiet) {
errors.push("--verbose and --quiet cannot be used together");
}
if (
!commander.outDir &&
filenames.length === 0 &&
@ -238,7 +223,7 @@ export default function parseArgv(args: Array<string>): CmdOptions | null {
errors.forEach(function(e) {
console.error(" " + e);
});
return null;
process.exit(2);
}
const opts = commander.opts();
@ -297,7 +282,6 @@ export default function parseArgv(args: Array<string>): CmdOptions | null {
copyFiles: opts.copyFiles,
includeDotfiles: opts.includeDotfiles,
verbose: opts.verbose,
quiet: opts.quiet,
deleteDirOnStart: opts.deleteDirOnStart,
sourceMapTarget: opts.sourceMapTarget,
},

View File

@ -112,7 +112,7 @@ export function deleteDir(path: string): void {
process.on("uncaughtException", function(err) {
console.error(err);
process.exitCode = 1;
process.exit(1);
});
export function requireChokidar(): Object {

View File

@ -1 +0,0 @@
arr.map(x => x * MULTIPLIER);

View File

@ -1,3 +0,0 @@
{
"args": ["script.js", "--out-file", "folder/nested/script.js"]
}

View File

@ -1,5 +0,0 @@
"use strict";
arr.map(function (x) {
return x * MULTIPLIER;
});

View File

@ -1,5 +0,0 @@
{
"args": ["--filename", "test.js"],
"stderrContains": true,
"os": ["win32"]
}

View File

@ -1 +0,0 @@
SyntaxError: <CWD>\test.js: Unexpected token, expected ";" (2:10)

View File

@ -1,3 +0,0 @@
arr.map(function () {
return $]!;
});

View File

@ -1,5 +1,4 @@
{
"args": ["--filename", "test.js"],
"stderrContains": true,
"os": ["linux", "darwin"]
"stderrContains": true
}

View File

@ -1,7 +1,7 @@
const readdir = require("fs-readdir-recursive");
const helper = require("@babel/helper-fixtures");
const rimraf = require("rimraf");
const { sync: makeDirSync } = require("make-dir");
const outputFileSync = require("output-file-sync");
const child = require("child_process");
const merge = require("lodash/merge");
const path = require("path");
@ -14,11 +14,6 @@ const fileFilter = function(x) {
return x !== ".DS_Store";
};
const outputFileSync = function(filePath, data) {
makeDirSync(path.dirname(filePath));
fs.writeFileSync(filePath, data);
};
const presetLocs = [path.join(__dirname, "../../babel-preset-react")];
const pluginLocs = [
@ -120,6 +115,13 @@ const buildTest = function(binName, testName, opts) {
const binLoc = path.join(__dirname, "../lib", binName);
return function(callback) {
const dir = process.cwd();
process.chdir(__dirname);
if (fs.existsSync(tmpLoc)) rimraf.sync(tmpLoc);
fs.mkdirSync(tmpLoc);
process.chdir(tmpLoc);
saveInFiles(opts.inFiles);
let args = [binLoc];
@ -157,6 +159,7 @@ const buildTest = function(binName, testName, opts) {
args.map(arg => `"${arg}"`).join(" ") + ": " + err.message;
}
process.chdir(dir);
callback(err);
});
@ -172,26 +175,6 @@ fs.readdirSync(fixtureLoc).forEach(function(binName) {
const suiteLoc = path.join(fixtureLoc, binName);
describe("bin/" + binName, function() {
let cwd;
beforeEach(() => {
cwd = process.cwd();
if (fs.existsSync(tmpLoc)) {
for (const child of fs.readdirSync(tmpLoc)) {
rimraf.sync(path.join(tmpLoc, child));
}
} else {
fs.mkdirSync(tmpLoc);
}
process.chdir(tmpLoc);
});
afterEach(() => {
process.chdir(cwd);
});
fs.readdirSync(suiteLoc).forEach(function(testName) {
if (testName.startsWith(".")) return;
@ -202,29 +185,7 @@ fs.readdirSync(fixtureLoc).forEach(function(binName) {
};
const optionsLoc = path.join(testLoc, "options.json");
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);
}
if (fs.existsSync(optionsLoc)) merge(opts, require(optionsLoc));
["stdout", "stdin", "stderr"].forEach(function(key) {
const loc = path.join(testLoc, key + ".txt");
@ -244,7 +205,7 @@ fs.readdirSync(fixtureLoc).forEach(function(binName) {
opts.inFiles[".babelrc"] = helper.readFile(babelrcLoc);
}
it(testName, buildTest(binName, testName, opts), 20000);
it(testName, buildTest(binName, testName, opts));
});
});
});

View File

@ -1,6 +1,6 @@
{
"name": "@babel/core",
"version": "7.7.2",
"version": "7.6.0",
"description": "Babel compiler core.",
"main": "lib/index.js",
"author": "Sebastian McKenzie <sebmck@gmail.com>",
@ -34,13 +34,13 @@
},
"dependencies": {
"@babel/code-frame": "^7.5.5",
"@babel/generator": "^7.7.2",
"@babel/helpers": "^7.7.0",
"@babel/parser": "^7.7.2",
"@babel/template": "^7.7.0",
"@babel/traverse": "^7.7.2",
"@babel/types": "^7.7.2",
"convert-source-map": "^1.7.0",
"@babel/generator": "^7.6.0",
"@babel/helpers": "^7.6.0",
"@babel/parser": "^7.6.0",
"@babel/template": "^7.6.0",
"@babel/traverse": "^7.6.0",
"@babel/types": "^7.6.0",
"convert-source-map": "^1.1.0",
"debug": "^4.1.0",
"json5": "^2.1.0",
"lodash": "^4.17.13",
@ -49,6 +49,7 @@
"source-map": "^0.5.0"
},
"devDependencies": {
"@babel/helper-transform-fixture-test-runner": "^7.6.4"
"@babel/helper-transform-fixture-test-runner": "^7.6.0",
"@babel/register": "^7.6.0"
}
}

View File

@ -345,7 +345,6 @@ 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.`,
@ -356,9 +355,6 @@ function assertNoDuplicates(items: Array<UnloadedDescriptor>): void {
` ['some-plugin', {}],`,
` ['some-plugin', {}, 'some unique name'],`,
` ]`,
``,
`Duplicates detected are:`,
`${JSON.stringify(conflicts, null, 2)}`,
].join("\n"),
);
}

View File

@ -18,22 +18,18 @@ import type { CallerMetadata } from "../validation/options";
const debug = buildDebug("babel:config:loading:files:configuration");
const ROOT_CONFIG_FILENAMES = [
"babel.config.js",
"babel.config.cjs",
"babel.config.json",
];
const RELATIVE_CONFIG_FILENAMES = [".babelrc", ".babelrc.js", ".babelrc.cjs"];
const BABEL_CONFIG_JS_FILENAME = "babel.config.js";
const BABELRC_FILENAME = ".babelrc";
const BABELRC_JS_FILENAME = ".babelrc.js";
const BABELIGNORE_FILENAME = ".babelignore";
export function findConfigUpwards(rootDir: string): string | null {
let dirname = rootDir;
while (true) {
const configFileFound = ROOT_CONFIG_FILENAMES.some(filename =>
fs.existsSync(path.join(dirname, filename)),
);
if (configFileFound) return dirname;
if (fs.existsSync(path.join(dirname, BABEL_CONFIG_JS_FILENAME))) {
return dirname;
}
const nextDir = path.dirname(dirname);
if (dirname === nextDir) break;
@ -55,15 +51,45 @@ export function findRelativeConfig(
for (const loc of packageData.directories) {
if (!config) {
config = loadOneConfig(
RELATIVE_CONFIG_FILENAMES,
loc,
envName,
caller,
config = [BABELRC_FILENAME, BABELRC_JS_FILENAME].reduce(
(previousConfig: ConfigFile | null, name) => {
const filepath = path.join(loc, name);
const config = readConfig(filepath, envName, caller);
if (config && previousConfig) {
throw new Error(
`Multiple configuration files found. Please remove one:\n` +
` - ${path.basename(previousConfig.filepath)}\n` +
` - ${name}\n` +
`from ${loc}`,
);
}
return config || previousConfig;
},
null,
);
const pkgConfig =
packageData.pkg && packageData.pkg.dirname === loc
? packageToBabelConfig(packageData.pkg)
: null,
);
: null;
if (pkgConfig) {
if (config) {
throw new Error(
`Multiple configuration files found. Please remove one:\n` +
` - ${path.basename(pkgConfig.filepath)}#babel\n` +
` - ${path.basename(config.filepath)}\n` +
`from ${loc}`,
);
}
config = pkgConfig;
}
if (config) {
debug("Found configuration %o from %o.", config.filepath, dirname);
}
}
if (!ignore) {
@ -84,36 +110,13 @@ export function findRootConfig(
envName: string,
caller: CallerMetadata | void,
): ConfigFile | null {
return loadOneConfig(ROOT_CONFIG_FILENAMES, dirname, envName, caller);
}
const filepath = path.resolve(dirname, BABEL_CONFIG_JS_FILENAME);
function loadOneConfig(
names: string[],
dirname: string,
envName: string,
caller: CallerMetadata | void,
previousConfig?: ConfigFile | null = null,
): ConfigFile | null {
const config = names.reduce((previousConfig: ConfigFile | null, name) => {
const filepath = path.resolve(dirname, name);
const config = readConfig(filepath, envName, caller);
if (config && previousConfig) {
throw new Error(
`Multiple configuration files found. Please remove one:\n` +
` - ${path.basename(previousConfig.filepath)}\n` +
` - ${name}\n` +
`from ${dirname}`,
);
}
return config || previousConfig;
}, previousConfig);
if (config) {
debug("Found configuration %o from %o.", config.filepath, dirname);
const conf = readConfig(filepath, envName, caller);
if (conf) {
debug("Found root config %o in %o.", BABEL_CONFIG_JS_FILENAME, dirname);
}
return config;
return conf;
}
export function loadConfig(
@ -138,8 +141,7 @@ export function loadConfig(
* throw if there are parsing errors while loading a config.
*/
function readConfig(filepath, envName, caller): ConfigFile | null {
const ext = path.extname(filepath);
return ext === ".js" || ext === ".cjs"
return path.extname(filepath) === ".js"
? readConfigJS(filepath, { envName, caller })
: readConfigJSON5(filepath);
}

View File

@ -70,7 +70,7 @@ function assertVersion(range: string | number): void {
throw new Error("Expected string or integer value.");
}
if (semver.satisfies(semver.coerce(coreVersion).raw, range)) return;
if (semver.satisfies(coreVersion, range)) return;
const limit = Error.stackTraceLimit;

View File

@ -272,8 +272,7 @@ export type OptionsSource =
| "configfile"
| "babelrcfile"
| "extendsfile"
| "preset"
| "plugin";
| "preset";
type RootPath = $ReadOnly<{
type: "root",

View File

@ -84,19 +84,10 @@ 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(optLoc, obj[key]);
if (validator) validator(key, obj[key]);
else throw new Error(`.${key} is not a valid Plugin property`);
});

View File

@ -19,17 +19,6 @@ const errorVisitor = {
},
};
export type NodeLocation = {
loc?: {
end?: { line: number, column: number },
start: { line: number, column: number },
},
_loc?: {
end?: { line: number, column: number },
start: { line: number, column: number },
},
};
export default class File {
_map: Map<any, any> = new Map();
opts: Object;
@ -261,12 +250,17 @@ export default class File {
}
buildCodeFrameError(
node: ?NodeLocation,
node: ?{
loc?: { start: { line: number, column: number } },
_loc?: { start: { line: number, column: number } },
},
msg: string,
Error: typeof Error = SyntaxError,
): Error {
let loc = node && (node.loc || node._loc);
msg = `${this.opts.filename}: ${msg}`;
if (!loc && node) {
const state = {
loc: null,
@ -293,13 +287,6 @@ export default class File {
line: loc.start.line,
column: loc.start.column + 1,
},
end:
loc.end && loc.start.line === loc.end.line
? {
line: loc.end.line,
column: loc.end.column + 1,
}
: undefined,
},
{ highlightCode },
);

View File

@ -41,7 +41,7 @@ export default function generateCode(
if (typeof result.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.`,

View File

@ -55,29 +55,11 @@ export function runSync(
ast,
);
const opts = file.opts;
try {
transformFile(file, config.passes);
} catch (e) {
e.message = `${opts.filename ?? "unknown"}: ${e.message}`;
if (!e.code) {
e.code = "BABEL_TRANSFORM_ERROR";
}
throw e;
}
transformFile(file, config.passes);
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;
}
const opts = file.opts;
const { outputCode, outputMap } =
opts.code !== false ? generateCode(config.passes, file) : {};
return {
metadata: file.metadata,

View File

@ -65,8 +65,7 @@ export default function normalizeFile(
if (typeof options.filename === "string" && lastComment) {
try {
inputMap = convertSourceMap.fromMapFileComment(
// fromMapFileComment requires the whole comment block
`//${lastComment}`,
lastComment,
path.dirname(options.filename),
);
} catch (err) {
@ -108,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 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.`,
@ -122,7 +121,6 @@ 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;
@ -157,7 +155,7 @@ function parser(
// eslint-disable-next-line max-len
const INLINE_SOURCEMAP_REGEX = /^[@#]\s+sourceMappingURL=data:(?:application|text)\/json;(?:charset[:=]\S+?;)?base64,(?:.*)$/;
const EXTERNAL_SOURCEMAP_REGEX = /^[@#][ \t]+sourceMappingURL=(?:[^\s'"`]+?)[ \t]*$/;
const EXTERNAL_SOURCEMAP_REGEX = /^[@#][ \t]+sourceMappingURL=([^\s'"`]+?)[ \t]*$/;
function extractCommentsFromList(regex, comments, lastComment) {
if (comments) {

View File

@ -1,7 +1,6 @@
// @flow
import type File from "./file/file";
import type NodeLocation from "./file/file";
export default class PluginPass {
_map: Map<mixed, mixed> = new Map();
@ -48,7 +47,14 @@ export default class PluginPass {
return this.file.getModuleName();
}
buildCodeFrameError(node: ?NodeLocation, msg: string, Error?: typeof Error) {
buildCodeFrameError(
node: ?{
loc?: { start: { line: number, column: number } },
_loc?: { start: { line: number, column: number } },
},
msg: string,
Error?: typeof Error,
) {
return this.file.buildCodeFrameError(node, msg, Error);
}
}

View File

@ -1,44 +1,7 @@
import fs from "fs";
import os from "os";
import path from "path";
import escapeRegExp from "lodash/escapeRegExp";
import { loadOptions as loadOptionsOrig } from "../lib";
// TODO: In Babel 8, we can directly uses fs.promises which is supported by
// node 8+
const pfs =
fs.promises ??
new Proxy(fs, {
get(target, name) {
if (name === "copyFile") {
// fs.copyFile is only supported since node 8.5
// https://stackoverflow.com/a/30405105/2359289
return function copyFile(source, target) {
const rd = fs.createReadStream(source);
const wr = fs.createWriteStream(target);
return new Promise(function(resolve, reject) {
rd.on("error", reject);
wr.on("error", reject);
wr.on("finish", resolve);
rd.pipe(wr);
}).catch(function(error) {
rd.destroy();
wr.end();
throw error;
});
};
}
return (...args) =>
new Promise((resolve, reject) =>
target[name](...args, (error, result) => {
if (error) reject(error);
else resolve(result);
}),
);
},
});
function fixture(...args) {
return path.join(__dirname, "fixtures", "config", ...args);
}
@ -50,24 +13,6 @@ function loadOptions(opts) {
});
}
function pairs(items) {
const pairs = [];
for (let i = 0; i < items.length - 1; i++) {
for (let j = i + 1; j < items.length; j++) {
pairs.push([items[i], items[j]]);
}
}
return pairs;
}
async function getTemp(name) {
const cwd = await pfs.mkdtemp(os.tmpdir() + path.sep + name);
const tmp = name => path.join(cwd, name);
const config = name =>
pfs.copyFile(fixture("config-files-templates", name), tmp(name));
return { cwd, tmp, config };
}
describe("buildConfigChain", function() {
describe("test", () => {
describe("single", () => {
@ -88,7 +33,7 @@ describe("buildConfigChain", function() {
cwd: fixture("nonexistant-fake"),
filename: fixture("nonexistant-fake", "src.js"),
babelrc: false,
test: new RegExp(escapeRegExp(fixture("nonexistant-fake"))),
test: new RegExp(fixture("nonexistant-fake")),
comments: true,
});
@ -124,7 +69,7 @@ describe("buildConfigChain", function() {
cwd: fixture("nonexistant-fake"),
filename: fixture("nonexistant-fake", "src.js"),
babelrc: false,
test: new RegExp(escapeRegExp(fixture("nonexistant-unknown"))),
test: new RegExp(fixture("nonexistant-unknown")),
comments: true,
});
@ -162,7 +107,7 @@ describe("buildConfigChain", function() {
cwd: fixture("nonexistant-fake"),
filename: fixture("nonexistant-fake", "src.js"),
babelrc: false,
test: [new RegExp(escapeRegExp(fixture("nonexistant-fake")))],
test: [new RegExp(fixture("nonexistant-fake"))],
comments: true,
});
@ -198,7 +143,7 @@ describe("buildConfigChain", function() {
cwd: fixture("nonexistant-fake"),
filename: fixture("nonexistant-fake", "src.js"),
babelrc: false,
test: [new RegExp(escapeRegExp(fixture("nonexistant-unknown")))],
test: [new RegExp(fixture("nonexistant-unknown"))],
comments: true,
});
@ -238,7 +183,7 @@ describe("buildConfigChain", function() {
cwd: fixture("nonexistant-fake"),
filename: fixture("nonexistant-fake", "src.js"),
babelrc: false,
include: new RegExp(escapeRegExp(fixture("nonexistant-fake"))),
include: new RegExp(fixture("nonexistant-fake")),
comments: true,
});
@ -274,7 +219,7 @@ describe("buildConfigChain", function() {
cwd: fixture("nonexistant-fake"),
filename: fixture("nonexistant-fake", "src.js"),
babelrc: false,
include: new RegExp(escapeRegExp(fixture("nonexistant-unknown"))),
include: new RegExp(fixture("nonexistant-unknown")),
comments: true,
});
@ -312,7 +257,7 @@ describe("buildConfigChain", function() {
cwd: fixture("nonexistant-fake"),
filename: fixture("nonexistant-fake", "src.js"),
babelrc: false,
include: [new RegExp(escapeRegExp(fixture("nonexistant-fake")))],
include: [new RegExp(fixture("nonexistant-fake"))],
comments: true,
});
@ -348,7 +293,7 @@ describe("buildConfigChain", function() {
cwd: fixture("nonexistant-fake"),
filename: fixture("nonexistant-fake", "src.js"),
babelrc: false,
include: [new RegExp(escapeRegExp(fixture("nonexistant-unknown")))],
include: [new RegExp(fixture("nonexistant-unknown"))],
comments: true,
});
@ -388,7 +333,7 @@ describe("buildConfigChain", function() {
cwd: fixture("nonexistant-fake"),
filename: fixture("nonexistant-fake", "src.js"),
babelrc: false,
exclude: new RegExp(escapeRegExp(fixture("nonexistant-fake"))),
exclude: new RegExp(fixture("nonexistant-fake")),
comments: true,
});
@ -424,7 +369,7 @@ describe("buildConfigChain", function() {
cwd: fixture("nonexistant-fake"),
filename: fixture("nonexistant-fake", "src.js"),
babelrc: false,
exclude: new RegExp(escapeRegExp(fixture("nonexistant-unknown"))),
exclude: new RegExp(fixture("nonexistant-unknown")),
comments: true,
});
@ -462,7 +407,7 @@ describe("buildConfigChain", function() {
cwd: fixture("nonexistant-fake"),
filename: fixture("nonexistant-fake", "src.js"),
babelrc: false,
exclude: [new RegExp(escapeRegExp(fixture("nonexistant-fake")))],
exclude: [new RegExp(fixture("nonexistant-fake"))],
comments: true,
});
@ -498,7 +443,7 @@ describe("buildConfigChain", function() {
cwd: fixture("nonexistant-fake"),
filename: fixture("nonexistant-fake", "src.js"),
babelrc: false,
exclude: [new RegExp(escapeRegExp(fixture("nonexistant-unknown")))],
exclude: [new RegExp(fixture("nonexistant-unknown"))],
comments: true,
});
@ -998,120 +943,111 @@ describe("buildConfigChain", function() {
}
});
describe("root", () => {
test.each(["babel.config.json", "babel.config.js", "babel.config.cjs"])(
"should load %s",
async name => {
const { cwd, tmp, config } = await getTemp(
`babel-test-load-config-${name}`,
);
const filename = tmp("src.js");
it("should load .babelrc", () => {
const filename = fixture("config-files", "babelrc", "src.js");
await config(name);
expect(
loadOptions({
filename,
cwd,
}),
).toEqual({
...getDefaults(),
filename,
cwd,
root: cwd,
comments: true,
});
},
);
test.each(
pairs(["babel.config.json", "babel.config.js", "babel.config.cjs"]),
)("should throw if both %s and %s are used", async (name1, name2) => {
const { cwd, tmp, config } = await getTemp(
`babel-test-dup-config-${name1}-${name2}`,
);
await Promise.all([config(name1), config(name2)]);
expect(() => loadOptions({ filename: tmp("src.js"), cwd })).toThrow(
/Multiple configuration files found/,
);
expect(
loadOptions({
filename,
cwd: path.dirname(filename),
}),
).toEqual({
...getDefaults(),
filename: filename,
cwd: path.dirname(filename),
root: path.dirname(filename),
comments: true,
});
});
describe("relative", () => {
test.each(["package.json", ".babelrc", ".babelrc.js", ".babelrc.cjs"])(
"should load %s",
async name => {
const { cwd, tmp, config } = await getTemp(
`babel-test-load-config-${name}`,
);
const filename = tmp("src.js");
it("should load .babelrc.js", () => {
const filename = fixture("config-files", "babelrc-js", "src.js");
await config(name);
expect(
loadOptions({
filename,
cwd,
}),
).toEqual({
...getDefaults(),
filename,
cwd,
root: cwd,
comments: true,
});
},
);
it("should load .babelignore", () => {
const filename = fixture("config-files", "babelignore", "src.js");
expect(
loadOptions({ filename, cwd: path.dirname(filename) }),
).toBeNull();
expect(loadOptions({ filename, cwd: path.dirname(filename) })).toEqual({
...getDefaults(),
filename: filename,
cwd: path.dirname(filename),
root: path.dirname(filename),
comments: true,
});
});
test.each(
pairs(["package.json", ".babelrc", ".babelrc.js", ".babelrc.cjs"]),
)("should throw if both %s and %s are used", async (name1, name2) => {
const { cwd, tmp, config } = await getTemp(
`babel-test-dup-config-${name1}-${name2}`,
);
it("should load package.json#babel", () => {
const filename = fixture("config-files", "pkg", "src.js");
await Promise.all([config(name1), config(name2)]);
expect(() => loadOptions({ filename: tmp("src.js"), cwd })).toThrow(
/Multiple configuration files found/,
);
expect(loadOptions({ filename, cwd: path.dirname(filename) })).toEqual({
...getDefaults(),
filename: filename,
cwd: path.dirname(filename),
root: path.dirname(filename),
comments: true,
});
});
it("should ignore package.json without a 'babel' property", () => {
const filename = fixture("config-files", "pkg-ignored", "src.js");
it("should load .babelignore", () => {
const filename = fixture("config-files", "babelignore", "src.js");
expect(loadOptions({ filename, cwd: path.dirname(filename) })).toEqual({
...getDefaults(),
filename: filename,
cwd: path.dirname(filename),
root: path.dirname(filename),
comments: true,
});
expect(loadOptions({ filename, cwd: path.dirname(filename) })).toBeNull();
});
it("should throw if there are both .babelrc and .babelrc.js", () => {
const filename = fixture("config-files", "both-babelrc", "src.js");
expect(() =>
loadOptions({ filename, cwd: path.dirname(filename) }),
).toThrow(/Multiple configuration files found/);
});
it("should throw if there are both .babelrc and package.json", () => {
const filename = fixture("config-files", "pkg-babelrc", "src.js");
expect(() =>
loadOptions({ filename, cwd: path.dirname(filename) }),
).toThrow(/Multiple configuration files found/);
});
it("should throw if there are both .babelrc.js and package.json", () => {
const filename = fixture("config-files", "pkg-babelrc-js", "src.js");
expect(() =>
loadOptions({ filename, cwd: path.dirname(filename) }),
).toThrow(/Multiple configuration files found/);
});
it("should ignore package.json without a 'babel' property", () => {
const filename = fixture("config-files", "pkg-ignored", "src.js");
expect(loadOptions({ filename, cwd: path.dirname(filename) })).toEqual({
...getDefaults(),
filename: filename,
cwd: path.dirname(filename),
root: path.dirname(filename),
comments: true,
});
});
test.each`
config | dir | error
${".babelrc"} | ${"babelrc-error"} | ${/Error while parsing config - /}
${".babelrc.js"} | ${"babelrc-js-error"} | ${/Babelrc threw an error/}
${".babelrc.cjs"} | ${"babelrc-cjs-error"} | ${/Babelrc threw an error/}
${"package.json"} | ${"pkg-error"} | ${/Error while parsing JSON - /}
`("should show helpful errors for $config", ({ dir, error }) => {
const filename = fixture("config-files", dir, "src.js");
it("should show helpful errors for .babelrc", () => {
const filename = fixture("config-files", "babelrc-error", "src.js");
expect(() =>
loadOptions({ filename, cwd: path.dirname(filename) }),
).toThrow(error);
});
expect(() =>
loadOptions({ filename, cwd: path.dirname(filename) }),
).toThrow(/Error while parsing config - /);
});
it("should show helpful errors for .babelrc.js", () => {
const filename = fixture("config-files", "babelrc-js-error", "src.js");
expect(() =>
loadOptions({ filename, cwd: path.dirname(filename) }),
).toThrow(/Babelrc threw an error/);
});
it("should show helpful errors for package.json", () => {
const filename = fixture("config-files", "pkg-error", "src.js");
expect(() =>
loadOptions({ filename, cwd: path.dirname(filename) }),
).toThrow(/Error while parsing JSON - /);
});
it("should throw when `test` presents but `filename` is not passed", () => {

View File

@ -322,21 +322,6 @@ 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", () => {

View File

@ -1,3 +0,0 @@
{
"comments": true
}

View File

@ -1,3 +0,0 @@
module.exports = {
comments: true
};

View File

@ -1,3 +0,0 @@
module.exports = {
comments: true
};

View File

@ -1,3 +0,0 @@
module.exports = {
comments: true
};

View File

@ -1,3 +0,0 @@
module.exports = {
comments: true
};

View File

@ -1,3 +0,0 @@
{
"comments": true
}

View File

@ -1,3 +0,0 @@
module.exports = function() {
throw new Error("Babelrc threw an error");
};

View File

@ -0,0 +1,3 @@
module.exports = {
comments: true,
};

View File

@ -0,0 +1,3 @@
{
comments: true,
}

View File

@ -0,0 +1 @@
{}

View File

@ -0,0 +1 @@
module.exports = {};

View File

@ -0,0 +1 @@
module.exports = {};

View File

@ -0,0 +1,3 @@
{
"babel": {}
}

View File

@ -0,0 +1 @@
{}

View File

@ -0,0 +1,3 @@
{
"babel": {}
}

View File

@ -2,7 +2,6 @@
"type": "File",
"start": 0,
"end": 91,
"errors": [],
"loc": {
"start": {
"line": 1,

View File

@ -1,18 +1,16 @@
expect(() => {
var code = "function f() {}";
transform(code, {
plugins: [
function() {
return {
visitor: {
FunctionDeclaration: function(path) {
throw path.buildCodeFrameError("someMsg");
},
var code = "function f() {}";
transform(code, {
plugins: [
function() {
return {
visitor: {
FunctionDeclaration: function(path) {
throw path.buildCodeFrameError("someMsg");
},
};
},
],
// hard to assert on ANSI escape codes
highlightCode: false,
});
}).toThrow(/^unknown: someMsg\s+> 1 \| function f\(\) {}/);
},
};
},
],
// hard to assert on ANSI escape codes
highlightCode: false,
});

View File

@ -0,0 +1,3 @@
{
"throws": "undefined: someMsg\n> 1 | function f() {}"
}

View File

@ -1,15 +0,0 @@
var code = "function f() {}";
transform(code, {
plugins: [
function() {
return {
visitor: {
FunctionDeclaration: function(path) {
throw new Error("someMsg");
},
},
};
},
],
filename: "/fake/path/example.js"
});

View File

@ -1,4 +0,0 @@
{
"throws": "/fake/path/example.js: someMsg",
"os": ["linux", "darwin"]
}

View File

@ -1,5 +0,0 @@
var foo = function () {
return 4;
};
//# sourceMappingURL=input.js.map

View File

@ -1 +0,0 @@
{"version":3,"sources":["original.js"],"names":[],"mappings":"AAAA,UAAU,Y;SAAM,C;CAAC","sourcesContent":["var foo = () => 4;"]}

View File

@ -1,3 +0,0 @@
{
"inputSourceMap": true
}

View File

@ -1,3 +0,0 @@
var foo = function () {
return 4;
};

View File

@ -1,7 +0,0 @@
{
"mappings": "AAAA,IAAA,GAAA,GAAU,Y;SAAM,C;AAAC,CAAjB",
"names": [],
"sources": ["original.js"],
"sourcesContent": ["var foo = () => 4;"],
"version": 3
}

View File

@ -27,19 +27,14 @@ describe("option-manager", () => {
return { plugin, calls };
}
it("should throw if a plugin is repeated, with information about the repeated plugin", () => {
const { calls, plugin } = makePlugin("my-plugin");
it("should throw if a plugin is repeated", () => {
const { calls, plugin } = makePlugin();
expect(() => {
loadOptions({
plugins: [
[plugin, undefined, "my-plugin"],
[plugin, undefined, "my-plugin"],
],
plugins: [plugin, plugin],
});
}).toThrow(
/Duplicate plugin\/preset detected.*Duplicates detected are.*my-plugin.*my-plugin/ms,
);
}).toThrow(/Duplicate plugin\/preset detected/);
expect(calls).toEqual([]);
});

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
{
"name": "@babel/generator",
"version": "7.7.2",
"version": "7.6.0",
"description": "Turns an AST into code.",
"author": "Sebastian McKenzie <sebmck@gmail.com>",
"homepage": "https://babeljs.io/",
@ -14,13 +14,14 @@
"lib"
],
"dependencies": {
"@babel/types": "^7.7.2",
"@babel/types": "^7.6.0",
"jsesc": "^2.5.1",
"lodash": "^4.17.13",
"source-map": "^0.5.0"
"source-map": "^0.5.0",
"trim-right": "^1.0.1"
},
"devDependencies": {
"@babel/helper-fixtures": "^7.6.3",
"@babel/parser": "^7.7.2"
"@babel/helper-fixtures": "^7.6.0",
"@babel/parser": "^7.6.0"
}
}

View File

@ -1,4 +1,5 @@
import type SourceMap from "./source-map";
import trimRight from "trim-right";
const SPACES_RE = /^[ \t]+$/;
@ -42,7 +43,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: this._buf.join("").trimRight(),
code: trimRight(this._buf.join("")),
map: null,
rawMappings: map && map.getRawMappings(),
};

View File

@ -71,8 +71,26 @@ export function ClassBody(node: Object) {
export function ClassProperty(node: Object) {
this.printJoin(node.decorators, node);
this.tsPrintClassMemberModifiers(node, /* isField */ true);
if (node.accessibility) {
// TS
this.word(node.accessibility);
this.space();
}
if (node.static) {
this.word("static");
this.space();
}
if (node.abstract) {
// TS
this.word("abstract");
this.space();
}
if (node.readonly) {
// TS
this.word("readonly");
this.space();
}
if (node.computed) {
this.token("[");
this.print(node.key, node);
@ -130,6 +148,23 @@ export function ClassPrivateMethod(node: Object) {
export function _classMethodHead(node) {
this.printJoin(node.decorators, node);
this.tsPrintClassMemberModifiers(node, /* isField */ false);
if (node.accessibility) {
// TS
this.word(node.accessibility);
this.space();
}
if (node.abstract) {
// TS
this.word("abstract");
this.space();
}
if (node.static) {
this.word("static");
this.space();
}
this._methodHead(node);
}

View File

@ -134,92 +134,6 @@ export function DeclareExportAllDeclaration(/*node: Object*/) {
ExportAllDeclaration.apply(this, arguments);
}
export function EnumDeclaration(node: Object) {
const { id, body } = node;
this.word("enum");
this.space();
this.print(id, node);
this.print(body, node);
}
function enumExplicitType(
context: Object,
name: string,
hasExplicitType: boolean,
) {
if (hasExplicitType) {
context.space();
context.word("of");
context.space();
context.word(name);
}
context.space();
}
function enumBody(context: Object, node: Object) {
const { members } = node;
context.token("{");
context.indent();
context.newline();
for (const member of members) {
context.print(member, node);
context.newline();
}
context.dedent();
context.token("}");
}
export function EnumBooleanBody(node: Object) {
const { explicitType } = node;
enumExplicitType(this, "boolean", explicitType);
enumBody(this, node);
}
export function EnumNumberBody(node: Object) {
const { explicitType } = node;
enumExplicitType(this, "number", explicitType);
enumBody(this, node);
}
export function EnumStringBody(node: Object) {
const { explicitType } = node;
enumExplicitType(this, "string", explicitType);
enumBody(this, node);
}
export function EnumSymbolBody(node: Object) {
enumExplicitType(this, "symbol", true);
enumBody(this, node);
}
export function EnumDefaultedMember(node: Object) {
const { id } = node;
this.print(id, node);
this.token(",");
}
function enumInitializedMember(context: Object, node: Object) {
const { id, init } = node;
context.print(id, node);
context.space();
context.token("=");
context.space();
context.print(init, node);
context.token(",");
}
export function EnumBooleanMember(node: Object) {
enumInitializedMember(this, node);
}
export function EnumNumberMember(node: Object) {
enumInitializedMember(this, node);
}
export function EnumStringMember(node: Object) {
enumInitializedMember(this, node);
}
function FlowExportDeclaration(node: Object) {
if (node.declaration) {
const declar = node.declaration;

View File

@ -197,17 +197,11 @@ export function TSTypeReference(node) {
}
export function TSTypePredicate(node) {
if (node.asserts) {
this.word("asserts");
this.space();
}
this.print(node.parameterName);
if (node.typeAnnotation) {
this.space();
this.word("is");
this.space();
this.print(node.typeAnnotation.typeAnnotation);
}
this.space();
this.word("is");
this.space();
this.print(node.typeAnnotation.typeAnnotation);
}
export function TSTypeQuery(node) {
@ -556,26 +550,3 @@ export function tsPrintSignatureDeclarationBase(node) {
this.token(")");
this.print(node.typeAnnotation, node);
}
export function tsPrintClassMemberModifiers(node, isField) {
if (isField && node.declare) {
this.word("declare");
this.space();
}
if (node.accessibility) {
this.word(node.accessibility);
this.space();
}
if (node.static) {
this.word("static");
this.space();
}
if (node.abstract) {
this.word("abstract");
this.space();
}
if (isField && node.readonly) {
this.word("readonly");
this.space();
}
}

View File

@ -35,22 +35,14 @@ export function NullableTypeAnnotation(node: Object, parent: Object): boolean {
return t.isArrayTypeAnnotation(parent);
}
export function FunctionTypeAnnotation(
node: Object,
parent: Object,
printStack: Array<Object>,
): boolean {
export function FunctionTypeAnnotation(node: Object, parent: Object): boolean {
return (
// (() => A) | (() => B)
t.isUnionTypeAnnotation(parent) ||
// (() => A) & (() => B)
t.isIntersectionTypeAnnotation(parent) ||
// (() => A)[]
t.isArrayTypeAnnotation(parent) ||
// <T>(A: T): (T => T[]) => B => [A, B]
(t.isTypeAnnotation(parent) &&
// Check grandparent
t.isArrowFunctionExpression(printStack[printStack.length - 3]))
t.isArrayTypeAnnotation(parent)
);
}

View File

@ -24,20 +24,14 @@ export default class SourceMap {
const code = this._code;
if (typeof code === "string") {
map.setSourceContent(
this._opts.sourceFileName.replace(/\\/g, "/"),
code,
);
map.setSourceContent(this._opts.sourceFileName, code);
} else if (typeof code === "object") {
Object.keys(code).forEach(sourceFileName => {
map.setSourceContent(
sourceFileName.replace(/\\/g, "/"),
code[sourceFileName],
);
map.setSourceContent(sourceFileName, code[sourceFileName]);
});
}
this._rawMappings.forEach(mapping => map.addMapping(mapping), map);
this._rawMappings.forEach(map.addMapping, map);
}
return this._cachedMap.toJSON();
@ -89,10 +83,7 @@ export default class SourceMap {
line: generatedLine,
column: generatedColumn,
},
source:
line == null
? undefined
: (filename || this._opts.sourceFileName).replace(/\\/g, "/"),
source: line == null ? undefined : filename || this._opts.sourceFileName,
original:
line == null
? undefined

View File

@ -5,4 +5,3 @@ const bar4 = x => {};
const bar5 = (x): string => {};
const bar6 = (x: number) => {};
const bar7 = <T>(x) => {};
const bar8 = <T>(x: T): (T => T[]) => y => [x, y];

View File

@ -10,6 +10,4 @@ const bar5 = (x): string => {};
const bar6 = (x: number) => {};
const bar7 = <T>(x) => {};
const bar8 = <T>(x: T): ((T) => T[]) => y => [x, y];
const bar7 = <T>(x) => {};

View File

@ -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 A1 = string
declare type A = string
declare type T<U> = { [k:string]: U }
declare type B1 = {
declare type B = {
fn?: (foo: string) => void,
}
declare interface I1 { foo: string }
declare interface I2<T> { foo: T }
declare interface I { foo: string }
declare interface I<T> { foo: T }
declare module.exports: { foo: string }
declare opaque type Foo<T>: Bar<T>;
declare opaque type ID;

View File

@ -22,17 +22,17 @@ declare class B {
(): number
}
declare class A mixins B<T>, C {}
declare type A1 = string;
declare type A = string;
declare type T<U> = {
[k: string]: U
};
declare type B1 = {
declare type B = {
fn?: (foo: string) => void
};
declare interface I1 {
declare interface I {
foo: string
}
declare interface I2<T> {
declare interface I<T> {
foo: T
}
declare module.exports: {

View File

@ -5,10 +5,10 @@ type T2 = { +p: T };
type T3 = { -p: T };
type T4 = { +[k:K]: V };
type T5 = { -[k:K]: V };
interface I1 { +p: T }
interface I2 { -p: T }
interface I3 { +[k:K]: V }
interface I4 { -[k:K]: V }
interface I { +p: T }
interface I { -p: T }
interface I { +[k:K]: V }
interface I { -[k:K]: V }
declare class I { +p: T }
declare class I { -p: T }
declare class I { +[k:K]: V }

View File

@ -15,16 +15,16 @@ type T4 = {
type T5 = {
-[k: K]: V
};
interface I1 {
interface I {
+p: T
}
interface I2 {
interface I {
-p: T
}
interface I3 {
interface I {
+[k: K]: V
}
interface I4 {
interface I {
-[k: K]: V
}
declare class I {

View File

@ -1,36 +0,0 @@
enum E {
A = true,
B = false,
}
enum E of boolean {
A = true,
B = false,
}
enum E {
A = 1,
B = 2,
}
enum E of number {
A = 1,
B = 2,
}
enum E {
A,
B,
}
enum E of string {
A,
B,
}
enum E {
A = "a",
B = "b",
}
enum E of string {
A = "a",
B = "b",
}
enum E of symbol {
A,
B,
}

View File

@ -1,3 +0,0 @@
{
"plugins": [["flow", { "enums": true }]]
}

View File

@ -1,36 +0,0 @@
enum E {
A = true,
B = false,
}
enum E of boolean {
A = true,
B = false,
}
enum E {
A = 1,
B = 2,
}
enum E of number {
A = 1,
B = 2,
}
enum E {
A,
B,
}
enum E of string {
A,
B,
}
enum E {
A = "a",
B = "b",
}
enum E of string {
A = "a",
B = "b",
}
enum E of symbol {
A,
B,
}

View File

@ -1,7 +1,7 @@
declare class C { static [[foo]]: T }
declare class C { [[foo]]: T }
interface I1 { [[foo]]: X }
interface I2 { [[foo]](): X }
interface I { [[foo]]: X }
interface I { [[foo]](): X }
type T1 = { [[foo]]: X }
type T2 = { [[foo]](): X }
type T3 = { [[foo]]?: X }

View File

@ -4,10 +4,10 @@ declare class C {
declare class C {
[[foo]]: T
}
interface I1 {
interface I {
[[foo]]: X
}
interface I2 {
interface I {
[[foo]]() => X
}
type T1 = {

View File

@ -1,7 +1,7 @@
interface A1 {
interface A {
@@iterator(): Iterator<File>;
}
interface A2 {
interface A {
@@asyncIterator(): Iterator<File>;
}

View File

@ -1,6 +1,6 @@
interface A1 {
interface A {
@@iterator(): Iterator<File>
}
interface A2 {
interface A {
@@asyncIterator(): Iterator<File>
}

Some files were not shown because too many files have changed in this diff Show More