Compare commits
No commits in common. "initializers-fix" and "v7.0.0" have entirely different histories.
initialize
...
v7.0.0
@ -30,20 +30,11 @@ aliases:
|
|||||||
- &artifact_env_min
|
- &artifact_env_min
|
||||||
path: ~/babel/packages/babel-preset-env-standalone/babel-preset-env.min.js
|
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:
|
jobs:
|
||||||
test:
|
build:
|
||||||
working_directory: ~/babel
|
working_directory: ~/babel
|
||||||
docker:
|
docker:
|
||||||
- image: circleci/node:13
|
- image: circleci/node:10
|
||||||
steps:
|
steps:
|
||||||
- checkout
|
- checkout
|
||||||
- restore-cache: *restore-yarn-cache
|
- restore-cache: *restore-yarn-cache
|
||||||
@ -51,7 +42,7 @@ jobs:
|
|||||||
- run: yarn --version
|
- run: yarn --version
|
||||||
- run: make test-ci-coverage
|
- run: make test-ci-coverage
|
||||||
# Builds babel-standalone with the regular Babel config
|
# Builds babel-standalone with the regular Babel config
|
||||||
- run: IS_PUBLISH=true make build
|
- run: make build
|
||||||
# test-ci-coverage doesn't test babel-standalone, as trying to gather coverage
|
# test-ci-coverage doesn't test babel-standalone, as trying to gather coverage
|
||||||
# data for a JS file that's several megabytes large is bound to fail. Here,
|
# data for a JS file that's several megabytes large is bound to fail. Here,
|
||||||
# we just run the babel-standalone test separately.
|
# we just run the babel-standalone test separately.
|
||||||
@ -63,59 +54,3 @@ jobs:
|
|||||||
- store_artifacts: *artifact_env_min
|
- store_artifacts: *artifact_env_min
|
||||||
- save_cache: *save-node-modules-cache
|
- save_cache: *save-node-modules-cache
|
||||||
- save_cache: *save-yarn-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
|
|
||||||
|
|||||||
@ -6,12 +6,9 @@ charset = utf-8
|
|||||||
trim_trailing_whitespace = true
|
trim_trailing_whitespace = true
|
||||||
end_of_line = lf
|
end_of_line = lf
|
||||||
|
|
||||||
[*.{js,json,ts,tsx}]
|
[*.{js,json}]
|
||||||
indent_style = space
|
indent_style = space
|
||||||
indent_size = 2
|
indent_size = 2
|
||||||
|
|
||||||
[Makefile]
|
|
||||||
indent_style = tab
|
|
||||||
|
|
||||||
[*.{md,markdown}]
|
[*.{md,markdown}]
|
||||||
trim_trailing_whitespace = false
|
trim_trailing_whitespace = false
|
||||||
|
|||||||
@ -5,8 +5,8 @@ package.json
|
|||||||
lerna.json
|
lerna.json
|
||||||
packages/babel-runtime
|
packages/babel-runtime
|
||||||
!packages/babel-plugin-transform-runtime/scripts
|
!packages/babel-plugin-transform-runtime/scripts
|
||||||
|
!packages/babel-runtime-corejs2/core-js.js
|
||||||
packages/babel-runtime-corejs2
|
packages/babel-runtime-corejs2
|
||||||
packages/babel-runtime-corejs3
|
|
||||||
packages/*/node_modules
|
packages/*/node_modules
|
||||||
packages/*/lib
|
packages/*/lib
|
||||||
packages/*/dist
|
packages/*/dist
|
||||||
|
|||||||
@ -1,9 +1,11 @@
|
|||||||
{
|
{
|
||||||
"root": true,
|
"root": true,
|
||||||
"plugins": ["prettier", "@babel/development", "import"],
|
|
||||||
"extends": "babel",
|
"extends": "babel",
|
||||||
|
"plugins": ["prettier"],
|
||||||
"rules": {
|
"rules": {
|
||||||
"prettier/prettier": "error"
|
"curly": ["error", "multi-line"],
|
||||||
|
"prettier/prettier": "error",
|
||||||
|
"no-case-declarations": "error"
|
||||||
},
|
},
|
||||||
"env": {
|
"env": {
|
||||||
"node": true
|
"node": true
|
||||||
@ -12,10 +14,8 @@
|
|||||||
{
|
{
|
||||||
"files": ["packages/*/src/**/*.js", "codemods/*/src/**/*.js"],
|
"files": ["packages/*/src/**/*.js", "codemods/*/src/**/*.js"],
|
||||||
"rules": {
|
"rules": {
|
||||||
"@babel/development/no-undefined-identifier": "error",
|
"no-undefined-identifier": "error",
|
||||||
"@babel/development/no-deprecated-clone": "error",
|
"no-deprecated-clone": "error"
|
||||||
"import/no-extraneous-dependencies": "error",
|
|
||||||
"guard-for-in": "error"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -28,14 +28,6 @@
|
|||||||
"env": {
|
"env": {
|
||||||
"jest": true
|
"jest": true
|
||||||
}
|
}
|
||||||
},
|
|
||||||
{
|
|
||||||
"files": ["packages/babel-plugin-*/src/index.js"],
|
|
||||||
"excludedFiles": ["packages/babel-plugin-transform-regenerator/**/*.js"],
|
|
||||||
"rules": {
|
|
||||||
"@babel/development/plugin-name": "error",
|
|
||||||
"eqeqeq": ["error", "always", { "null": "ignore" }]
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
15
.flowconfig
15
.flowconfig
@ -1,10 +1,11 @@
|
|||||||
[ignore]
|
[ignore]
|
||||||
<PROJECT_ROOT>/build/.*
|
.*/build/.*
|
||||||
<PROJECT_ROOT>/packages/.*/lib
|
.*/packages/.*/lib
|
||||||
<PROJECT_ROOT>/packages/.*/test
|
.*/packages/.*/test
|
||||||
<PROJECT_ROOT>/codemods/.*/lib
|
.*/codemods/.*/lib
|
||||||
<PROJECT_ROOT>/codemods/.*/test
|
.*/codemods/.*/test
|
||||||
<PROJECT_ROOT>/node_modules/module-deps/
|
.*/node_modules/conventional-changelog-core/
|
||||||
|
.*/node_modules/module-deps/
|
||||||
|
|
||||||
[include]
|
[include]
|
||||||
packages/*/src
|
packages/*/src
|
||||||
@ -24,6 +25,4 @@ suppress_comment= \\(.\\|\n\\)*\\$FlowIgnore
|
|||||||
suppress_type=$FlowFixMe
|
suppress_type=$FlowFixMe
|
||||||
suppress_type=$FlowSubtype
|
suppress_type=$FlowSubtype
|
||||||
esproposal.export_star_as=enable
|
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'
|
module.name_mapper='^@babel\/\([a-zA-Z0-9_\-]+\)$' -> '<PROJECT_ROOT>/packages/babel-\1/src/index'
|
||||||
|
|||||||
22
.github/CHANGELOG-6to5.md
vendored
22
.github/CHANGELOG-6to5.md
vendored
@ -84,7 +84,7 @@
|
|||||||
* More performance improvements.
|
* More performance improvements.
|
||||||
* Parsing is now ~30% faster thanks to [marijnh/acorn@7264bc0178e7e6af7cfe02e9e0c6b26ee0e6007f](https://github.com/marijnh/acorn/commit/7264bc0178e7e6af7cfe02e9e0c6b26ee0e6007f).
|
* Parsing is now ~30% faster thanks to [marijnh/acorn@7264bc0178e7e6af7cfe02e9e0c6b26ee0e6007f](https://github.com/marijnh/acorn/commit/7264bc0178e7e6af7cfe02e9e0c6b26ee0e6007f).
|
||||||
* **New Feature**
|
* **New Feature**
|
||||||
* Optional `es6.blockScopingTDZ` is now completely functional and handles all edge cases.
|
* Optional `es6.blockScopingTDZ` is now completely functional and handles all edgecases.
|
||||||
* `super` in object literals.
|
* `super` in object literals.
|
||||||
* Tail call optimisation. Thanks [@RReverser](https://github.com/RReverser)!
|
* Tail call optimisation. Thanks [@RReverser](https://github.com/RReverser)!
|
||||||
|
|
||||||
@ -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.
|
* Restructure transformers so they're only ran if the AST contains nodes that they need to worry about. Improves transpilation speed significantly.
|
||||||
* **Bug Fix**
|
* **Bug Fix**
|
||||||
* Fix source maps not tracking end of node locations.
|
* 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.
|
* Use static super references as the home object is actually done at definition time.
|
||||||
* **Polish**
|
* **Polish**
|
||||||
* Force the `es6.destructuring` transformer to be whitelisted when the `es7.objectSpread` transformer is.
|
* Force the `es6.destructuring` transformer to be whitelisted when the `es7.objectSpread` transformer is.
|
||||||
@ -474,12 +474,12 @@
|
|||||||
* **Polish**
|
* **Polish**
|
||||||
* Rest parameters now allocate the array before populating.
|
* Rest parameters now allocate the array before populating.
|
||||||
* **Internal**
|
* **Internal**
|
||||||
* `for...in` loops have been changed to optimized `for` loops - better performance and no enumeration of prototype keys.
|
* `for...in` loops have been changed to optimized `for` loops - better performance and no enumeration of protoype keys.
|
||||||
* Parts of the code generator have now been optimized thanks to [gaearon](https://github.com/gaearon).
|
* Parts of the code generator have now been optimized thanks to [gaearon](https://github.com/gaearon).
|
||||||
|
|
||||||
## 2.12.3
|
## 2.12.3
|
||||||
|
|
||||||
* **Spec Compliance**
|
* **Spec Compliancy**
|
||||||
* Optional `typeof` transformer checks for `undefined` before passing it to the helper.
|
* Optional `typeof` transformer checks for `undefined` before passing it to the helper.
|
||||||
* Class methods are now named.
|
* Class methods are now named.
|
||||||
|
|
||||||
@ -551,7 +551,7 @@
|
|||||||
* Add `classesFastSuper` optional transformer that doesn't support parent getters and prototype changing.
|
* 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 `forOfFast` transformer that speeds up `for...of` on arrays but produces more code.
|
||||||
* Add `--react-compat` to `bin/6to5`.
|
* Add `--react-compat` to `bin/6to5`.
|
||||||
* **Spec Compliance**
|
* **Spec Compliancy**
|
||||||
* Disallow setters without a single parameter.
|
* Disallow setters without a single parameter.
|
||||||
* Add `configurable` and `writable` to defined properties.
|
* Add `configurable` and `writable` to defined properties.
|
||||||
* Use define instead of assignment for class methods.
|
* Use define instead of assignment for class methods.
|
||||||
@ -619,7 +619,7 @@
|
|||||||
|
|
||||||
## 2.7.0
|
## 2.7.0
|
||||||
|
|
||||||
* **Spec Compliance**
|
* **Spec Compliancy**
|
||||||
* Disallow reassignments of imports.
|
* Disallow reassignments of imports.
|
||||||
* **New Feature**
|
* **New Feature**
|
||||||
* `reactCompat` option to enable pre-v0.12 react components.
|
* `reactCompat` option to enable pre-v0.12 react components.
|
||||||
@ -643,7 +643,7 @@
|
|||||||
|
|
||||||
* **Bug Fix**
|
* **Bug Fix**
|
||||||
* Better handling of number literal property keys.
|
* Better handling of number literal property keys.
|
||||||
* Handle `NewExpression` paren insertion edge cases better.
|
* Handle `NewExpression` paren insertion edegcases better.
|
||||||
* **Internal**
|
* **Internal**
|
||||||
* Fix incorrect AST node `identifier("this")`.
|
* Fix incorrect AST node `identifier("this")`.
|
||||||
* Better `toIdentifier` method that handles reserved words.
|
* Better `toIdentifier` method that handles reserved words.
|
||||||
@ -662,7 +662,7 @@
|
|||||||
* **Polish**
|
* **Polish**
|
||||||
* Move `"use strict";` to inside module bodies instead of at the top of the file.
|
* Move `"use strict";` to inside module bodies instead of at the top of the file.
|
||||||
* Better handling of dynamic imports.
|
* Better handling of dynamic imports.
|
||||||
* **Spec Compliance**
|
* **Spec Compliancy**
|
||||||
* Class inheritance now has a `function` or `null` type check.
|
* Class inheritance now has a `function` or `null` type check.
|
||||||
* Add `interopRequireWildcard` around wildcard imports and exports to handle non-object exports.
|
* Add `interopRequireWildcard` around wildcard imports and exports to handle non-object exports.
|
||||||
|
|
||||||
@ -850,7 +850,7 @@
|
|||||||
|
|
||||||
## 1.14.10
|
## 1.14.10
|
||||||
|
|
||||||
* Fix let scoping unnecessary override.
|
* Fix let scoping unneccesary override.
|
||||||
|
|
||||||
## 1.14.6
|
## 1.14.6
|
||||||
|
|
||||||
@ -973,7 +973,7 @@
|
|||||||
|
|
||||||
## 1.12.21
|
## 1.12.21
|
||||||
|
|
||||||
* Fix unnecessary let scoping replacement.
|
* Fix unneccesary let scoping replacement.
|
||||||
* Add `commonInterop` module formatter. Thanks [@Naddiseo](https://github.com/Naddiseo).
|
* Add `commonInterop` module formatter. Thanks [@Naddiseo](https://github.com/Naddiseo).
|
||||||
* Fix `return` outside of function body bug. Thanks [@brentburg](https://github.com/brentburg).
|
* Fix `return` outside of function body bug. Thanks [@brentburg](https://github.com/brentburg).
|
||||||
* Add more flexible option types.
|
* Add more flexible option types.
|
||||||
@ -1020,7 +1020,7 @@
|
|||||||
|
|
||||||
## 1.12.12
|
## 1.12.12
|
||||||
|
|
||||||
* Make scope tracker more reliable to handle all edge cases.
|
* Make scope tracker more reliable to handle all edgecases.
|
||||||
|
|
||||||
## 1.12.11
|
## 1.12.11
|
||||||
|
|
||||||
|
|||||||
10
.github/CHANGELOG-v4.md
vendored
10
.github/CHANGELOG-v4.md
vendored
@ -110,7 +110,7 @@
|
|||||||
* Throw an error on different `babel` and `babel-runtime` versions.
|
* Throw an error on different `babel` and `babel-runtime` versions.
|
||||||
* Replicate module environment for `babel-node` eval.
|
* Replicate module environment for `babel-node` eval.
|
||||||
* Clean up classes output.
|
* Clean up classes output.
|
||||||
* **Spec Compliance**
|
* **Spec Compliancy**
|
||||||
* Make it illegal to use a rest parameter on a setter.
|
* Make it illegal to use a rest parameter on a setter.
|
||||||
|
|
||||||
## 4.6.6
|
## 4.6.6
|
||||||
@ -127,7 +127,7 @@
|
|||||||
## 4.6.4
|
## 4.6.4
|
||||||
|
|
||||||
* **Bug Fix**
|
* **Bug Fix**
|
||||||
* Fix `ForOfStatement` not properly inheriting labels.
|
* Fix `ForOfStatement` not proplery inheriting labels.
|
||||||
* When in closure mode in block scoping transformer, properly check for variable shadowing.
|
* When in closure mode in block scoping transformer, properly check for variable shadowing.
|
||||||
* **New Feature**
|
* **New Feature**
|
||||||
* New `utility.inlineEnvironmentVariables` and `utility.inlineExpression` transformers.
|
* New `utility.inlineEnvironmentVariables` and `utility.inlineExpression` transformers.
|
||||||
@ -150,10 +150,10 @@
|
|||||||
|
|
||||||
* **New Feature**
|
* **New Feature**
|
||||||
* Desugar sticky regexes to a new constructor expression so it can be handled by a polyfill.
|
* Desugar sticky regexes to a new constructor expression so it can be handled by a polyfill.
|
||||||
* **Spec Compliance**
|
* **Spec Compliancy**
|
||||||
* `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.
|
* `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**
|
* **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)!
|
* Rest parameters that are only refered 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.
|
* `$ babel` no longer exits on syntax errors.
|
||||||
* **Internal**
|
* **Internal**
|
||||||
* Upgrade `browserify`.
|
* Upgrade `browserify`.
|
||||||
|
|||||||
21
.github/CHANGELOG-v5.md
vendored
21
.github/CHANGELOG-v5.md
vendored
@ -12,7 +12,7 @@
|
|||||||
|
|
||||||
## 5.8.24
|
## 5.8.24
|
||||||
|
|
||||||
* **Spec Compliance**
|
* **Spec Compliancy**
|
||||||
* Updated `optimisation.react.inlineElements` transformer to React 0.14 output. Thanks [@spicyj](https://github.com/spicyj)!
|
* Updated `optimisation.react.inlineElements` transformer to React 0.14 output. Thanks [@spicyj](https://github.com/spicyj)!
|
||||||
* **Polish**
|
* **Polish**
|
||||||
* Add support for evaluating more static nodes. Thanks [@hzoo](https://github.com/hzoo)!
|
* Add support for evaluating more static nodes. Thanks [@hzoo](https://github.com/hzoo)!
|
||||||
@ -262,8 +262,8 @@ Issues with publish process.
|
|||||||
* Register labels as bindings to fix undeclared variable checks.
|
* Register labels as bindings to fix undeclared variable checks.
|
||||||
* **Polish**
|
* **Polish**
|
||||||
* Remove unnecessary string binary expressions when transforming template literals.
|
* Remove unnecessary string binary expressions when transforming template literals.
|
||||||
* Support module live bindings in arbitrary positions not in Program statement position.
|
* Support module live bindings in arbitary positions not in Program statement position.
|
||||||
* Throw error when attempting to replace a `Program` root node with another node not of type `Program`.
|
* Throw error when attemping to replace a `Program` root node with another node not of type `Program`.
|
||||||
* Optimise rest parameters in spread element position and allocate rest array at the earliest common ancestor of all references.
|
* Optimise rest parameters in spread element position and allocate rest array at the earliest common ancestor of all references.
|
||||||
* Generate original number representation when value was not changed.
|
* Generate original number representation when value was not changed.
|
||||||
* Check for invalid binding identifiers when generating inferred method names.
|
* Check for invalid binding identifiers when generating inferred method names.
|
||||||
@ -451,7 +451,7 @@ Issues with publish process.
|
|||||||
|
|
||||||

|

|
||||||
|
|
||||||
* **Spec Compliance**
|
* **Spec Compliancy**
|
||||||
* Allow trailing param commas for methods when using the `es7.trailingCommas` transformer.
|
* Allow trailing param commas for methods when using the `es7.trailingCommas` transformer.
|
||||||
* **Bug Fix**
|
* **Bug Fix**
|
||||||
* Fix `es6.blockScoping` transformer not properly ignoring `break` in `SwitchCase`.
|
* 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 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 incorrect extensions reference causing weird issues when using the Babel CLI.
|
||||||
* Fix destructuring param reference replacements not inheriting from their original param.
|
* Fix destructuring param reference replacements not inheriting from their original param.
|
||||||
* **Spec Compliance**
|
* **Spec Compliancy**
|
||||||
* Fix order that method decorators are ran in.
|
* Fix order that method decorators are ran in.
|
||||||
|
|
||||||
## 5.2.15
|
## 5.2.15
|
||||||
@ -543,12 +543,12 @@ Issues with publish process.
|
|||||||
* **Internal**
|
* **Internal**
|
||||||
* Removed native inheritance support from classes.
|
* Removed native inheritance support from classes.
|
||||||
* Added `replaceWithSourceString` path API.
|
* Added `replaceWithSourceString` path API.
|
||||||
* Split up `es3.propertyLiterals` and `es3.memberExpressionLiterals` transformers to `minification.propertyLiterals` and `es3.memberExpressionLiterals`.
|
* Split up `es3.propertyLiterals` and `es3.memberExpressionLiterals` transformers to `minfication.propertyLiterals` and `es3.memberExpressionLiterals`.
|
||||||
|
|
||||||
## 5.2.6
|
## 5.2.6
|
||||||
|
|
||||||
* **Internal**
|
* **Internal**
|
||||||
* Fix transformer aliases being accidentally set as deprecated ones.
|
* Fix transformer aliases being accidently set as deprecated ones.
|
||||||
* Expose `Pipeline` as `TransformerPipeline` instead.
|
* Expose `Pipeline` as `TransformerPipeline` instead.
|
||||||
|
|
||||||
## 5.2.5
|
## 5.2.5
|
||||||
@ -616,7 +616,7 @@ Issues with publish process.
|
|||||||
* Fix `externalHelpers` option being incorrectly listed as type `string`.
|
* Fix `externalHelpers` option being incorrectly listed as type `string`.
|
||||||
* **Internal**
|
* **Internal**
|
||||||
* Upgrade `core-js` to `0.9.0`.
|
* Upgrade `core-js` to `0.9.0`.
|
||||||
* **Spec Compliance**
|
* **Spec Compliancy**
|
||||||
* Fix object decorators not using the `initializer` pattern.
|
* Fix object decorators not using the `initializer` pattern.
|
||||||
* Remove property initializer descriptor reflection.
|
* Remove property initializer descriptor reflection.
|
||||||
|
|
||||||
@ -824,10 +824,10 @@ Issues with publish process.
|
|||||||
* Save register cache on tick instead of `SIGINT`.
|
* Save register cache on tick instead of `SIGINT`.
|
||||||
* Enable strict mode on babel-node eval flag.
|
* Enable strict mode on babel-node eval flag.
|
||||||
* **Bug Fixes**
|
* **Bug Fixes**
|
||||||
* Add support for live bindings. This change also increases the reliability of export specifier renaming.
|
* Add support for live bindings. This change also increases the reliablity of export specifier renaming.
|
||||||
* Add support for super update and non equals assignment expressions.
|
* Add support for super update and non equals assignment expressions.
|
||||||
* Rename shadow constructor binding in classes.
|
* Rename shadow constructor binding in classes.
|
||||||
* Seed next iteration bindings with previous fresh bindings when reassigning loop block scoped variables.
|
* Seed next iteration bindings with previous fresh bindings when reassinging loop block scoped variables.
|
||||||
* Fix new expression spread referencing the wrong constructor.
|
* Fix new expression spread referencing the wrong constructor.
|
||||||
* Call `resolveModuleSource` on dynamic imports.
|
* Call `resolveModuleSource` on dynamic imports.
|
||||||
* Added `param` to list of duplicate declaration kinds.
|
* Added `param` to list of duplicate declaration kinds.
|
||||||
@ -836,3 +836,4 @@ Issues with publish process.
|
|||||||
* ES7 Abstract References have been removed.
|
* ES7 Abstract References have been removed.
|
||||||
* Experimental option has been removed in favor of a stage option.
|
* Experimental option has been removed in favor of a stage option.
|
||||||
* Rename `returnUsedHelpers` to `metadataUsedHelpers`.
|
* Rename `returnUsedHelpers` to `metadataUsedHelpers`.
|
||||||
|
|
||||||
36
.github/CHANGELOG-v6.md
vendored
36
.github/CHANGELOG-v6.md
vendored
@ -19,10 +19,10 @@
|
|||||||
|
|
||||||
## 6.26.0 (2017-08-16)
|
## 6.26.0 (2017-08-16)
|
||||||
|
|
||||||
> Backports for some folks (also other's when we accidentally merged PRs from both 6.x/master)
|
> Backports for some folks (also other's when we accidently merged PRs from both 6.x/master)
|
||||||
> Lesson learned: just use `master` and backport on another branch.
|
> 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`
|
* `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))
|
* [#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)
|
## v6.17.0 (2016-10-01)
|
||||||
|
|
||||||
#### :eyeglasses: Spec Compliance
|
#### :eyeglasses: Spec Compliancy
|
||||||
* `babel-preset-stage-2`, `babel-preset-stage-3`
|
* `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))
|
* [#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
|
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
|
```js
|
||||||
// async generator syntax
|
// async generator syntax
|
||||||
@ -1569,7 +1569,7 @@ First PR!
|
|||||||
|
|
||||||
Babel 6.16: Happy 2nd Birthday 🎂!
|
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`, ...
|
* `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))
|
* [#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))
|
||||||
@ -1767,7 +1767,7 @@ typeof Symbol.prototype === 'object'
|
|||||||
* [#3456](https://github.com/babel/babel/pull/3456) Use the real sourcemap API and handle input sourcemaps - Fixes [#7259](https://github.com/babel/babel/issues/7259). ([@loganfsmyth](https://github.com/loganfsmyth))
|
* [#3456](https://github.com/babel/babel/pull/3456) Use the real sourcemap API and handle input sourcemaps - Fixes [#7259](https://github.com/babel/babel/issues/7259). ([@loganfsmyth](https://github.com/loganfsmyth))
|
||||||
* [#4507](https://github.com/babel/babel/pull/4507) Only set options in cli if different from default. ([@danez](https://github.com/danez))
|
* [#4507](https://github.com/babel/babel/pull/4507) Only set options in cli if different from default. ([@danez](https://github.com/danez))
|
||||||
|
|
||||||
Fix an issue with defaults not being overridden. This was causing options like `comments: false` not to work correctly.
|
Fix an issue with defaults not being overidden. This was causing options like `comments: false` not to work correctly.
|
||||||
|
|
||||||
* [#4508](https://github.com/babel/babel/pull/4508) Support custom ports for V8 --inspect. ([@andykant](https://github.com/andykant))
|
* [#4508](https://github.com/babel/babel/pull/4508) Support custom ports for V8 --inspect. ([@andykant](https://github.com/andykant))
|
||||||
* [#4562](https://github.com/babel/babel/pull/4562) Fixes [#2299](https://github.com/babel/babel/issues/2299): Prevent REPL from printing implicit 'use strict'. ([@hzoo](https://github.com/hzoo))
|
* [#4562](https://github.com/babel/babel/pull/4562) Fixes [#2299](https://github.com/babel/babel/issues/2299): Prevent REPL from printing implicit 'use strict'. ([@hzoo](https://github.com/hzoo))
|
||||||
@ -2036,7 +2036,7 @@ It's also a lot folk's first PR (or first code PR)!
|
|||||||
* `babel-generator`, `babel-types`
|
* `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))
|
* [#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`
|
* `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))
|
* [#3518](https://github.com/babel/babel/pull/3518) Throw error for multiple exports default. ([@kaicataldo](https://github.com/kaicataldo))
|
||||||
|
|
||||||
@ -2084,7 +2084,7 @@ Also added more tests and will update Babel to use the new preset options after
|
|||||||
|
|
||||||
## v6.13.1 (2016-08-04)
|
## v6.13.1 (2016-08-04)
|
||||||
|
|
||||||
We had a regression in our new babel-preset-es2015@6.13.0 that made it unexpectedly backward-incompatible. This release introduces a new alternative plugin-options approach that is uglier but supports backward-compatibility. Ideally new plugins would use the new `module.exports = function(babel, options){ }` approach and simple skip supporting `babel-core@<6.13.x`.
|
We had a regression in our new babel-preset-es2015@6.13.0 that made it unexpectedly backward-incompatible. This release introduces a new alternative plugin-options approach that is uglier but supports backward-compatiblity. Ideally new plugins would use the new `module.exports = function(babel, options){ }` approach and simple skip supporting `babel-core@<6.13.x`.
|
||||||
|
|
||||||
#### Bug Fix
|
#### Bug Fix
|
||||||
* `babel-core`, `babel-preset-es2015`
|
* `babel-core`, `babel-preset-es2015`
|
||||||
@ -2092,7 +2092,7 @@ We had a regression in our new babel-preset-es2015@6.13.0 that made it unexpecte
|
|||||||
|
|
||||||
## v6.13.0 (2016-08-04)
|
## v6.13.0 (2016-08-04)
|
||||||
|
|
||||||
> Since the last release we've created https://github.com/babel/notes to track discussions on our slack and high level features/changes that could be added - definitely check it out if you're interested in Babel's development!
|
> Since the last release we've created https://github.com/babel/notes to track discussions on our slack and high level features/changes that could be added - definetely check it out if you're interested in Babel's development!
|
||||||
|
|
||||||
Some small but very important additions in this release:
|
Some small but very important additions in this release:
|
||||||
|
|
||||||
@ -2332,7 +2332,7 @@ Length: The number of characters in the output code
|
|||||||
* `babel-plugin-transform-react-jsx-self`, `babel-preset-react`
|
* `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))
|
* [#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`
|
* `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))
|
* [#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.
|
- Reverting the class properties semicolon parser error.
|
||||||
- Fix regression with plugin ordering with `babel-register`.
|
- Fix regression with plugin ordering with `babel-register`.
|
||||||
|
|
||||||
#### Spec Compliance
|
#### Spec Compliancy
|
||||||
* `babel-plugin-transform-class-properties`, `babylon`
|
* `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))
|
* [#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-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
|
* `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)).
|
* `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**
|
* **Internal**
|
||||||
@ -3817,7 +3817,7 @@ Thanks to @samwgoldman for all the new flow support!
|
|||||||
* **New Feature**
|
* **New Feature**
|
||||||
* Add support for `function.sent`.
|
* Add support for `function.sent`.
|
||||||
* **Internal**
|
* **Internal**
|
||||||
* Bump `invariant` dependency version.
|
* Bump `invariant` depenency version.
|
||||||
* **Polish**
|
* **Polish**
|
||||||
* Infer filename from the base directory when resolving plugins and presets.
|
* Infer filename from the base directory when resolving plugins and presets.
|
||||||
* Allow JSX pragma to be specified in line comments.
|
* Allow JSX pragma to be specified in line comments.
|
||||||
@ -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.
|
* 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 `buildExternalHelpers` script ignoring non-underscored helpers.
|
||||||
* Fix exported classes with static class properties.
|
* Fix exported classes with static class properties.
|
||||||
* **Spec Compliance**
|
* **Spec Compliancy**
|
||||||
* Add support for computed mutators in `babel-plugin-transform-es2015-computed-properties`.
|
* Add support for computed mutators in `babel-plugin-transform-es2015-computed-properties`.
|
||||||
* **Polish**
|
* **Polish**
|
||||||
* Make interop for plugins with the `__esModule` work for all plugins no matter how they're imported/specified.
|
* Make interop for plugins with the `__esModule` work for all plugins no matter how they're imported/specified.
|
||||||
@ -3887,7 +3887,7 @@ Thanks to @samwgoldman for all the new flow support!
|
|||||||
## 6.1.2
|
## 6.1.2
|
||||||
|
|
||||||
* **Bug Fix**
|
* **Bug Fix**
|
||||||
* Fix bug where the parser wouldn't allow typed annotated default parameters in arrow functions.
|
* Fix bug where the parser wouldn't allow typed annotated default parametesr in arrow functions.
|
||||||
* Add existence check to `NodePath#has` to ensure safeness when making comparisons.
|
* Add existence check to `NodePath#has` to ensure safeness when making comparisons.
|
||||||
* Protect against replacing a class expression with a name inferred version that would
|
* Protect against replacing a class expression with a name inferred version that would
|
||||||
result in it never being transformed.
|
result in it never being transformed.
|
||||||
@ -3904,7 +3904,7 @@ Thanks to @samwgoldman for all the new flow support!
|
|||||||
* **Polish**
|
* **Polish**
|
||||||
* Add npm 3 check to `babel-doctor`.
|
* Add npm 3 check to `babel-doctor`.
|
||||||
* Autoclear the `babel/register` cache when it gets too big to be serialised.
|
* Autoclear the `babel/register` cache when it gets too big to be serialised.
|
||||||
* **Spec Compliance**
|
* **Spec Compliancy**
|
||||||
* Add support for flow existential type parameters.
|
* Add support for flow existential type parameters.
|
||||||
|
|
||||||
## 6.1.1
|
## 6.1.1
|
||||||
@ -3969,14 +3969,14 @@ Thanks to @samwgoldman for all the new flow support!
|
|||||||
|
|
||||||
## 6.0.14
|
## 6.0.14
|
||||||
|
|
||||||
* **Spec Compliance**
|
* **Spec Compliancy**
|
||||||
* Update exponentiation operator precedence.
|
* Update exponentiation operator precedence.
|
||||||
* Fix parser bug where arrow functions have a higher precedence than they should.
|
* Fix parser bug where arrow functions have a higher precedence than they should.
|
||||||
* **Bug Fix**
|
* **Bug Fix**
|
||||||
* Fix SystemJS module formatter exporting function parameters.
|
* Fix SystemJS module formatter exporting function parameters.
|
||||||
* Ensure that invalid identifier JSX attribute keys are quoted when transforming to calls.
|
* Ensure that invalid identifier JSX attribute keys are quoted when transforming to calls.
|
||||||
* Fix ES3 property literal plugin.
|
* Fix ES3 property literal plugin.
|
||||||
* Fix parameters after defaults in arrow functions referring to the wrong `arguments`.
|
* Fix parameters after defaults in arrow functions refering to the wrong `arguments`.
|
||||||
|
|
||||||
## 6.0.13
|
## 6.0.13
|
||||||
|
|
||||||
|
|||||||
9
.github/ISSUE_TEMPLATE/Bug_report.md
vendored
9
.github/ISSUE_TEMPLATE/Bug_report.md
vendored
@ -1,9 +1,6 @@
|
|||||||
---
|
---
|
||||||
name: "\U0001F41B Bug Report"
|
name: 🐛 Bug Report
|
||||||
about: "If something isn't working as expected \U0001F914."
|
about: If something isn't working as expected 🤔.
|
||||||
title: ''
|
|
||||||
labels: 'i: bug, i: needs triage'
|
|
||||||
assignees: ''
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@ -34,7 +31,7 @@ A clear and concise description of what you expected to happen (or code).
|
|||||||
- Babel version(s): [e.g. v6.0.0, v7.0.0-beta.34]
|
- Babel version(s): [e.g. v6.0.0, v7.0.0-beta.34]
|
||||||
- Node/npm version: [e.g. Node 8/npm 5]
|
- Node/npm version: [e.g. Node 8/npm 5]
|
||||||
- OS: [e.g. OSX 10.13.4, Windows 10]
|
- OS: [e.g. OSX 10.13.4, Windows 10]
|
||||||
- Monorepo: [e.g. yes/no/Lerna]
|
- Monorepo [e.g. yes/no/Lerna]
|
||||||
- How you are using Babel: [e.g. `cli`, `register`, `loader`]
|
- How you are using Babel: [e.g. `cli`, `register`, `loader`]
|
||||||
|
|
||||||
**Possible Solution**
|
**Possible Solution**
|
||||||
|
|||||||
7
.github/ISSUE_TEMPLATE/Feature_request.md
vendored
7
.github/ISSUE_TEMPLATE/Feature_request.md
vendored
@ -1,9 +1,6 @@
|
|||||||
---
|
---
|
||||||
name: "\U0001F680 Feature Request"
|
name: 🚀 Feature Request
|
||||||
about: "I have a suggestion (and may want to implement it \U0001F642)!"
|
about: I have a suggestion (and may want to implement it 🙂)!
|
||||||
title: ''
|
|
||||||
labels: 'i: enhancement, i: needs triage'
|
|
||||||
assignees: ''
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|||||||
10
.github/ISSUE_TEMPLATE/Regression-v7.md
vendored
10
.github/ISSUE_TEMPLATE/Regression-v7.md
vendored
@ -1,16 +1,12 @@
|
|||||||
---
|
---
|
||||||
name: "\U0001F4A5 v7 Regression"
|
name: 💥 v7 Regression
|
||||||
about: Report an unexpected behavior in v7 from v6 (Check the upgrade guide first
|
about: Report an unexpected behavior in v7 from v6 (Check the upgrade guide first ✌️)
|
||||||
✌️)
|
|
||||||
title: ''
|
|
||||||
labels: 'i: bug, 7.x: regression, i: needs triage'
|
|
||||||
assignees: ''
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
# v7 Regression
|
# v7 Regression
|
||||||
|
|
||||||
> First check out: https://babeljs.io/docs/en/v7-migration
|
> First check out: https://new.babeljs.io/docs/en/next/v7-migration.html
|
||||||
> Also a partial upgrade tool: https://github.com/babel/babel-upgrade
|
> Also a partial upgrade tool: https://github.com/babel/babel-upgrade
|
||||||
|
|
||||||
**Potential Commit/PR that introduced the regression**
|
**Potential Commit/PR that introduced the regression**
|
||||||
|
|||||||
7
.github/ISSUE_TEMPLATE/Support_question.md
vendored
7
.github/ISSUE_TEMPLATE/Support_question.md
vendored
@ -1,9 +1,6 @@
|
|||||||
---
|
---
|
||||||
name: "\U0001F917 Support Question"
|
name: 🤗 Support Question
|
||||||
about: "If you have a question \U0001F4AC, please check out our Slack or StackOverflow!"
|
about: If you have a question 💬, please check out our Slack or StackOverflow!
|
||||||
title: ''
|
|
||||||
labels: 'i: question, i: needs triage'
|
|
||||||
assignees: ''
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|||||||
8
.github/ISSUE_TEMPLATE/Support_us.md
vendored
8
.github/ISSUE_TEMPLATE/Support_us.md
vendored
@ -1,10 +1,6 @@
|
|||||||
---
|
---
|
||||||
name: "\U0001F91D Support us on Babel"
|
name: 🤝 Support us on Babel
|
||||||
about: "If you would like to support our efforts in maintaining this community-driven
|
about: If you would like to support our efforts in maintaining this community-driven project 🙌!
|
||||||
project \U0001F64C!"
|
|
||||||
title: ''
|
|
||||||
labels: ''
|
|
||||||
assignees: ''
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|||||||
4
.github/PULL_REQUEST_TEMPLATE.md
vendored
4
.github/PULL_REQUEST_TEMPLATE.md
vendored
@ -2,8 +2,6 @@
|
|||||||
Before making a PR, please read our contributing guidelines
|
Before making a PR, please read our contributing guidelines
|
||||||
https://github.com/babel/babel/blob/master/CONTRIBUTING.md
|
https://github.com/babel/babel/blob/master/CONTRIBUTING.md
|
||||||
|
|
||||||
Please note that the Babel Team requires two approvals before merging most PRs.
|
|
||||||
|
|
||||||
For issue references: Add a comma-separated list of a [closing word](https://help.github.com/articles/closing-issues-via-commit-messages/) followed by the ticket number fixed by the PR. (it should be underlined in the preview if done correctly)
|
For issue references: Add a comma-separated list of a [closing word](https://help.github.com/articles/closing-issues-via-commit-messages/) followed by the ticket number fixed by the PR. (it should be underlined in the preview if done correctly)
|
||||||
|
|
||||||
If you are making a change that should have a docs update: submit another PR to https://github.com/babel/website
|
If you are making a change that should have a docs update: submit another PR to https://github.com/babel/website
|
||||||
@ -11,7 +9,7 @@ If you are making a change that should have a docs update: submit another PR to
|
|||||||
|
|
||||||
| Q | A <!--(Can use an emoji 👍) -->
|
| 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? |
|
| Patch: Bug Fix? |
|
||||||
| Major: Breaking Change? |
|
| Major: Breaking Change? |
|
||||||
| Minor: New Feature? |
|
| Minor: New Feature? |
|
||||||
|
|||||||
2
.github/lock.yml
vendored
2
.github/lock.yml
vendored
@ -4,7 +4,7 @@
|
|||||||
daysUntilLock: 91
|
daysUntilLock: 91
|
||||||
# Comment to post before locking. Set to `false` to disable
|
# Comment to post before locking. Set to `false` to disable
|
||||||
lockComment: false
|
lockComment: false
|
||||||
# The label to be applied when an issue is locked
|
only: issues
|
||||||
lockLabel: 'outdated'
|
lockLabel: 'outdated'
|
||||||
|
|
||||||
# Issues or pull requests with these labels will not be locked
|
# Issues or pull requests with these labels will not be locked
|
||||||
|
|||||||
81
.github/workflows/issue-triage.yml
vendored
81
.github/workflows/issue-triage.yml
vendored
@ -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.
|
|
||||||
|
|
||||||
53
.github/workflows/release.yml
vendored
53
.github/workflows/release.yml
vendored
@ -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
|
|
||||||
11
.gitignore
vendored
11
.gitignore
vendored
@ -1,8 +1,5 @@
|
|||||||
.npmrc
|
|
||||||
|
|
||||||
.DS_Store
|
.DS_Store
|
||||||
/node_modules
|
/node_modules
|
||||||
/.github/actions/*/node_modules
|
|
||||||
/packages/*/node_modules
|
/packages/*/node_modules
|
||||||
/packages/*/LICENSE
|
/packages/*/LICENSE
|
||||||
!/packages/babel-parser/LICENSE
|
!/packages/babel-parser/LICENSE
|
||||||
@ -18,7 +15,6 @@ coverage
|
|||||||
dist
|
dist
|
||||||
/.package.json
|
/.package.json
|
||||||
package-lock.json
|
package-lock.json
|
||||||
!/.github/actions/*/package-lock.json
|
|
||||||
|
|
||||||
/packages/babel-runtime/helpers/*.js
|
/packages/babel-runtime/helpers/*.js
|
||||||
!/packages/babel-runtime/helpers/toArray.js
|
!/packages/babel-runtime/helpers/toArray.js
|
||||||
@ -35,16 +31,11 @@ package-lock.json
|
|||||||
!/packages/babel-runtime-corejs2/helpers/temporalRef.js
|
!/packages/babel-runtime-corejs2/helpers/temporalRef.js
|
||||||
/packages/babel-runtime-corejs2/helpers/esm/*.js
|
/packages/babel-runtime-corejs2/helpers/esm/*.js
|
||||||
!/packages/babel-runtime-corejs2/helpers/esm/toArray.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/helpers/esm/temporalRef.js
|
||||||
/packages/babel-runtime-corejs2/core-js/**/*.js
|
/packages/babel-runtime-corejs2/core-js/**/*.js
|
||||||
!/packages/babel-runtime-corejs2/core-js/map.js
|
!/packages/babel-runtime-corejs2/core-js/map.js
|
||||||
|
|
||||||
/packages/babel-runtime-corejs3/helpers/*.js
|
|
||||||
/packages/babel-runtime-corejs3/helpers/esm/*.js
|
|
||||||
/packages/babel-runtime-corejs3/core-js/**/*.js
|
|
||||||
/packages/babel-runtime-corejs3/core-js-stable/**/*.js
|
|
||||||
|
|
||||||
/packages/babel-register/test/.babel
|
/packages/babel-register/test/.babel
|
||||||
/packages/babel-cli/test/tmp
|
/packages/babel-cli/test/tmp
|
||||||
/packages/babel-node/test/tmp
|
/packages/babel-node/test/tmp
|
||||||
|
|||||||
@ -1,5 +1,2 @@
|
|||||||
package.json
|
package.json
|
||||||
packages/babel-preset-env/data
|
packages/babel-preset-env/data
|
||||||
packages/*/test/fixtures/**/input.*
|
|
||||||
packages/*/test/fixtures/**/exec.*
|
|
||||||
packages/*/test/fixtures/**/output.*
|
|
||||||
|
|||||||
@ -7,6 +7,7 @@
|
|||||||
"bracketSpacing": true,
|
"bracketSpacing": true,
|
||||||
"jsxBracketSameLine": false,
|
"jsxBracketSameLine": false,
|
||||||
"tabWidth": 2,
|
"tabWidth": 2,
|
||||||
|
"parser": "babylon",
|
||||||
"printWidth": 80,
|
"printWidth": 80,
|
||||||
"overrides": [{
|
"overrides": [{
|
||||||
"files": [
|
"files": [
|
||||||
@ -15,7 +16,6 @@
|
|||||||
"**/packages/*/src/**/*.js",
|
"**/packages/*/src/**/*.js",
|
||||||
"**/packages/*/test/**/*.js"
|
"**/packages/*/test/**/*.js"
|
||||||
],
|
],
|
||||||
"parser": "babylon",
|
|
||||||
"options": {
|
"options": {
|
||||||
"trailingComma": "all"
|
"trailingComma": "all"
|
||||||
}
|
}
|
||||||
|
|||||||
43
.travis.yml
43
.travis.yml
@ -1,45 +1,42 @@
|
|||||||
git:
|
git:
|
||||||
depth: 5
|
depth: 10
|
||||||
|
sudo: false
|
||||||
language: node_js
|
language: node_js
|
||||||
cache:
|
cache:
|
||||||
yarn: true
|
yarn: true
|
||||||
|
directories:
|
||||||
os: linux
|
- node_modules
|
||||||
|
node_js:
|
||||||
|
# We test the latest version on circleci
|
||||||
|
- '9'
|
||||||
|
- '8'
|
||||||
|
- '6'
|
||||||
|
|
||||||
env:
|
env:
|
||||||
global:
|
global:
|
||||||
- PATH=$HOME/.yarn/bin:$PATH
|
- PATH=$HOME/.yarn/bin:$PATH
|
||||||
- JOB=test
|
- JOB=test
|
||||||
|
|
||||||
install: skip
|
before_install:
|
||||||
before_script:
|
|
||||||
- curl -o- -L https://yarnpkg.com/install.sh | bash
|
- curl -o- -L https://yarnpkg.com/install.sh | bash
|
||||||
- if [ "$TRAVIS_OS_NAME" = "windows" ]; then choco install make; fi
|
|
||||||
|
install: yarn --ignore-engines
|
||||||
|
|
||||||
|
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:
|
script:
|
||||||
- if [ "$JOB" = "test" ]; then make -j test-ci; fi
|
- 'if [ "$JOB" = "test" ]; then make test-ci; fi'
|
||||||
- if [ "$JOB" = "lint" ]; then make -j code-quality-ci; fi
|
- 'if [ "$JOB" = "lint" ]; then make lint && make flow; fi'
|
||||||
- if [ "$JOB" = "babel-parser-flow-tests" ]; then make -j test-flow-ci; fi
|
- 'if [ "$JOB" = "babel-parser-flow-tests" ]; then make test-flow-ci; fi'
|
||||||
- if [ "$JOB" = "babel-parser-test262-tests" ]; then make -j test-test262-ci; fi
|
- 'if [ "$JOB" = "babel-parser-test262-tests" ]; then make test-test262-ci; fi'
|
||||||
|
|
||||||
matrix:
|
matrix:
|
||||||
fast_finish: true
|
fast_finish: true
|
||||||
include:
|
include:
|
||||||
- node_js: "node"
|
- node_js: "node"
|
||||||
env: JOB=lint
|
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"
|
- node_js: "node"
|
||||||
env: JOB=babel-parser-flow-tests
|
env: JOB=babel-parser-flow-tests
|
||||||
- node_js: "node"
|
- node_js: "node"
|
||||||
|
|||||||
1364
CHANGELOG.md
1364
CHANGELOG.md
File diff suppressed because it is too large
Load Diff
@ -55,7 +55,7 @@ further defined and clarified by project maintainers.
|
|||||||
## Enforcement
|
## Enforcement
|
||||||
|
|
||||||
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
||||||
reported by contacting Henry Zhu <hi@henryzoo.com>, Logan Smyth <loganfsmyth@gmail.com> or one of the other [Babel core team members](https://babeljs.io/team). All
|
reported by contacting hzoo, thejameskyle, sebastian, or loganfsmyth on [Slack](https://slack.babeljs.io/). All
|
||||||
complaints will be reviewed and investigated and will result in a response that
|
complaints will be reviewed and investigated and will result in a response that
|
||||||
is deemed necessary and appropriate to the circumstances. The project team is
|
is deemed necessary and appropriate to the circumstances. The project team is
|
||||||
obligated to maintain confidentiality with regard to the reporter of an incident.
|
obligated to maintain confidentiality with regard to the reporter of an incident.
|
||||||
|
|||||||
@ -24,7 +24,7 @@ contributing, please read the
|
|||||||
## Not sure where to start?
|
## Not sure where to start?
|
||||||
|
|
||||||
- If you aren't just making a documentation change, you'll probably want to learn a bit about a few topics.
|
- If you aren't just making a documentation change, you'll probably want to learn a bit about a few topics.
|
||||||
- [ASTs](https://en.wikipedia.org/wiki/Abstract_syntax_tree) (Abstract Syntax Tree): The Babel AST [spec](https://github.com/babel/babel/blob/master/packages/babel-parser/ast/spec.md) is a bit different from [ESTree](https://github.com/estree/estree). The differences are listed [here](https://babeljs.io/docs/en/next/babel-parser.html#output).
|
- [ASTs](https://en.wikipedia.org/wiki/Abstract_syntax_tree) (Abstract Syntax Tree): The Babel AST [spec](https://github.com/babel/babel/blob/master/packages/babel-parser/ast/spec.md) is a bit different from [ESTree](https://github.com/estree/estree). The differences are listed [here](https://github.com/babel/babel/tree/master/packages/babel-parser#output).
|
||||||
- Check out [`/doc`](https://github.com/babel/babel/tree/master/doc) for information about Babel's internals
|
- Check out [`/doc`](https://github.com/babel/babel/tree/master/doc) for information about Babel's internals
|
||||||
- Check out [the Babel Plugin Handbook](https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#babel-plugin-handbook) - core plugins are written the same way as any other plugin!
|
- Check out [the Babel Plugin Handbook](https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#babel-plugin-handbook) - core plugins are written the same way as any other plugin!
|
||||||
- Check out [AST Explorer](http://astexplorer.net/#/scUfOmVOG5) to learn more about ASTs or make your own plugin in the browser
|
- Check out [AST Explorer](http://astexplorer.net/#/scUfOmVOG5) to learn more about ASTs or make your own plugin in the browser
|
||||||
@ -32,7 +32,6 @@ contributing, please read the
|
|||||||
- Follow along with what we are working on by joining our [Slack](https://babeljs.slack.com) (you can sign-up [here](https://slack.babeljs.io/)
|
- Follow along with what we are working on by joining our [Slack](https://babeljs.slack.com) (you can sign-up [here](https://slack.babeljs.io/)
|
||||||
for an invite), following our announcements on [Twitter](https://twitter.com/babeljs), and reading (or participating!) in our [meeting notes](https://github.com/babel/notes).
|
for an invite), following our announcements on [Twitter](https://twitter.com/babeljs), and reading (or participating!) in our [meeting notes](https://github.com/babel/notes).
|
||||||
- Check out our [website](http://babeljs.io/) and the [repo](https://github.com/babel/website)
|
- Check out our [website](http://babeljs.io/) and the [repo](https://github.com/babel/website)
|
||||||
- You can contribute by triaging issues which may include reproducing bug reports or asking for vital information, such as version numbers or reproduction instructions. If you would like to start triaging issues, one easy way to get started is to [subscribe to babel on CodeTriage](https://www.codetriage.com/babel/babel). [](https://www.codetriage.com/babel/babel)
|
|
||||||
|
|
||||||
## Chat
|
## Chat
|
||||||
|
|
||||||
@ -311,7 +310,7 @@ Note that the code shown in Chrome DevTools is compiled code and therefore diffe
|
|||||||
- Create a new issue that describes the proposal (ex: [#538](https://github.com/babel/babylon/issues/538)). Include any relevant information like proposal repo/author, examples, parsing approaches, meeting notes, presentation slides, and more.
|
- Create a new issue that describes the proposal (ex: [#538](https://github.com/babel/babylon/issues/538)). Include any relevant information like proposal repo/author, examples, parsing approaches, meeting notes, presentation slides, and more.
|
||||||
- The pull request should include:
|
- The pull request should include:
|
||||||
- [ ] An update to the [plugins](https://github.com/babel/babel/tree/master/packages/babel-parser#plugins) part of the readme. Add a new entry to that list for the new plugin flag (and link to the proposal)
|
- [ ] An update to the [plugins](https://github.com/babel/babel/tree/master/packages/babel-parser#plugins) part of the readme. Add a new entry to that list for the new plugin flag (and link to the proposal)
|
||||||
- [ ] If any new nodes or modifications need to be added to the AST, update [ast/spec.md](https://github.com/babel/babel/blob/master/packages/babel-parser/ast/spec.md)
|
- [ ] If any new nodes or modifications need to be added to the AST, update [ast/spec.md](https://github.com/babel/babel/bloc/master/packages/babel-parser/ast/spec.md)
|
||||||
- [ ] Make sure you use the `this.hasPlugin("plugin-name-here")` check in the babel parser so that your new plugin code only runs when that flag is turned on (not default behavior)
|
- [ ] Make sure you use the `this.hasPlugin("plugin-name-here")` check in the babel parser so that your new plugin code only runs when that flag is turned on (not default behavior)
|
||||||
- [ ] Add failing/passing tests according to spec behavior
|
- [ ] Add failing/passing tests according to spec behavior
|
||||||
- Start working about the Babel transform itself!
|
- Start working about the Babel transform itself!
|
||||||
|
|||||||
136
Gulpfile.js
136
Gulpfile.js
@ -6,32 +6,43 @@ const chalk = require("chalk");
|
|||||||
const newer = require("gulp-newer");
|
const newer = require("gulp-newer");
|
||||||
const babel = require("gulp-babel");
|
const babel = require("gulp-babel");
|
||||||
const gulpWatch = require("gulp-watch");
|
const gulpWatch = require("gulp-watch");
|
||||||
const fancyLog = require("fancy-log");
|
const gutil = require("gulp-util");
|
||||||
const filter = require("gulp-filter");
|
const filter = require("gulp-filter");
|
||||||
const gulp = require("gulp");
|
const gulp = require("gulp");
|
||||||
const path = require("path");
|
const path = require("path");
|
||||||
const webpack = require("webpack");
|
const webpack = require("webpack");
|
||||||
const rollup = require("rollup");
|
const merge = require("merge-stream");
|
||||||
|
const rollup = require("rollup-stream");
|
||||||
|
const source = require("vinyl-source-stream");
|
||||||
|
const buffer = require("vinyl-buffer");
|
||||||
const rollupBabel = require("rollup-plugin-babel");
|
const rollupBabel = require("rollup-plugin-babel");
|
||||||
const rollupNodeResolve = require("rollup-plugin-node-resolve");
|
const rollupNodeResolve = require("rollup-plugin-node-resolve");
|
||||||
const rollupReplace = require("rollup-plugin-replace");
|
const registerStandalonePackageTask = require("./scripts/gulp-tasks")
|
||||||
const { registerStandalonePackageTask } = require("./scripts/gulp-tasks");
|
.registerStandalonePackageTask;
|
||||||
|
|
||||||
const defaultSourcesGlob = "./@(codemods|packages)/*/src/**/*.js";
|
const sources = ["codemods", "packages"];
|
||||||
|
|
||||||
function swapSrcWithLib(srcPath) {
|
function swapSrcWithLib(srcPath) {
|
||||||
const parts = srcPath.split(path.sep);
|
const parts = srcPath.split(path.sep);
|
||||||
parts[2] = "lib";
|
parts[1] = "lib";
|
||||||
return parts.join(path.sep);
|
return parts.join(path.sep);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getGlobFromSource(source) {
|
||||||
|
return `./${source}/*/src/**/*.js`;
|
||||||
|
}
|
||||||
|
|
||||||
function getIndexFromPackage(name) {
|
function getIndexFromPackage(name) {
|
||||||
return `${name}/src/index.js`;
|
return `${name}/src/index.js`;
|
||||||
}
|
}
|
||||||
|
|
||||||
function compilationLogger() {
|
function compilationLogger(rollup) {
|
||||||
return through.obj(function(file, enc, callback) {
|
return through.obj(function(file, enc, callback) {
|
||||||
fancyLog(`Compiling '${chalk.cyan(file.relative)}'...`);
|
gutil.log(
|
||||||
|
`Compiling '${chalk.cyan(file.relative)}'${
|
||||||
|
rollup ? " with rollup " : ""
|
||||||
|
}...`
|
||||||
|
);
|
||||||
callback(null, file);
|
callback(null, file);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -39,7 +50,7 @@ function compilationLogger() {
|
|||||||
function errorsLogger() {
|
function errorsLogger() {
|
||||||
return plumber({
|
return plumber({
|
||||||
errorHandler(err) {
|
errorHandler(err) {
|
||||||
fancyLog(err.stack);
|
gutil.log(err.stack);
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -51,68 +62,61 @@ function rename(fn) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function buildBabel(exclude, sourcesGlob = defaultSourcesGlob) {
|
function buildBabel(exclude) {
|
||||||
const base = __dirname;
|
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) {
|
if (exclude) {
|
||||||
const filters = exclude.map(p => `!**/${p}/**`);
|
const filters = exclude.map(p => `!**/${p}/**`);
|
||||||
filters.unshift("**");
|
filters.unshift("**");
|
||||||
stream = stream.pipe(filter(filters));
|
stream = stream.pipe(filter(filters));
|
||||||
}
|
}
|
||||||
|
|
||||||
return stream
|
return stream
|
||||||
.pipe(errorsLogger())
|
.pipe(errorsLogger())
|
||||||
.pipe(newer({ dest: base, map: swapSrcWithLib }))
|
.pipe(newer({ dest: base, map: swapSrcWithLib }))
|
||||||
.pipe(compilationLogger())
|
.pipe(compilationLogger())
|
||||||
.pipe(babel())
|
.pipe(babel())
|
||||||
.pipe(
|
.pipe(
|
||||||
// Passing 'file.relative' because newer() above uses a relative
|
// Passing 'file.relative' because newer() above uses a relative
|
||||||
// path and this keeps it consistent.
|
// path and this keeps it consistent.
|
||||||
rename(file => path.resolve(file.base, swapSrcWithLib(file.relative)))
|
rename(file => path.resolve(file.base, swapSrcWithLib(file.relative)))
|
||||||
)
|
)
|
||||||
.pipe(gulp.dest(base));
|
.pipe(gulp.dest(base));
|
||||||
}
|
|
||||||
|
|
||||||
function buildRollup(packages) {
|
|
||||||
return Promise.all(
|
|
||||||
packages.map(pkg => {
|
|
||||||
const input = getIndexFromPackage(pkg);
|
|
||||||
fancyLog(`Compiling '${chalk.cyan(input)}' with rollup ...`);
|
|
||||||
return rollup
|
|
||||||
.rollup({
|
|
||||||
input,
|
|
||||||
plugins: [
|
|
||||||
rollupReplace({
|
|
||||||
"process.env.NODE_ENV": JSON.stringify(process.env.NODE_ENV),
|
|
||||||
}),
|
|
||||||
rollupBabel({
|
|
||||||
envName: "babel-parser",
|
|
||||||
}),
|
|
||||||
rollupNodeResolve(),
|
|
||||||
],
|
|
||||||
})
|
|
||||||
.then(bundle => {
|
|
||||||
return bundle.write({
|
|
||||||
file: path.join(pkg, "lib/index.js"),
|
|
||||||
format: "cjs",
|
|
||||||
name: "babel-parser",
|
|
||||||
sourcemap: process.env.NODE_ENV !== "production",
|
|
||||||
});
|
|
||||||
});
|
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const bundles = ["packages/babel-parser"];
|
function buildRollup(packages) {
|
||||||
|
return merge(
|
||||||
|
packages.map(pkg => {
|
||||||
|
return rollup({
|
||||||
|
input: getIndexFromPackage(pkg),
|
||||||
|
format: "cjs",
|
||||||
|
plugins: [
|
||||||
|
rollupBabel({
|
||||||
|
envName: "babel-parser",
|
||||||
|
}),
|
||||||
|
rollupNodeResolve(),
|
||||||
|
],
|
||||||
|
})
|
||||||
|
.pipe(source("index.js"))
|
||||||
|
.pipe(buffer())
|
||||||
|
.pipe(errorsLogger())
|
||||||
|
.pipe(compilationLogger(/* rollup */ true))
|
||||||
|
.pipe(gulp.dest(path.join(pkg, "lib")));
|
||||||
|
})
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
gulp.task("build-rollup", () => buildRollup(bundles));
|
gulp.task("build", function() {
|
||||||
gulp.task("build-babel", () => buildBabel(/* exclude */ bundles));
|
const bundles = ["packages/babel-parser"];
|
||||||
gulp.task("build-babel-types", () =>
|
|
||||||
buildBabel(/* exclude */ bundles, "packages/babel-types/src/**/*.js")
|
return merge([buildBabel(/* exclude */ bundles), buildRollup(bundles)]);
|
||||||
);
|
});
|
||||||
gulp.task("build", gulp.parallel("build-rollup", "build-babel"));
|
|
||||||
|
|
||||||
gulp.task("default", gulp.series("build"));
|
gulp.task("default", gulp.series("build"));
|
||||||
|
|
||||||
@ -122,7 +126,7 @@ gulp.task(
|
|||||||
"watch",
|
"watch",
|
||||||
gulp.series("build-no-bundle", function watch() {
|
gulp.series("build-no-bundle", function watch() {
|
||||||
gulpWatch(
|
gulpWatch(
|
||||||
defaultSourcesGlob,
|
sources.map(getGlobFromSource),
|
||||||
{ debounceDelay: 200 },
|
{ debounceDelay: 200 },
|
||||||
gulp.task("build-no-bundle")
|
gulp.task("build-no-bundle")
|
||||||
);
|
);
|
||||||
@ -134,7 +138,7 @@ registerStandalonePackageTask(
|
|||||||
"babel",
|
"babel",
|
||||||
"Babel",
|
"Babel",
|
||||||
path.join(__dirname, "packages"),
|
path.join(__dirname, "packages"),
|
||||||
require("./packages/babel-standalone/package.json").version
|
require("./packages/babel-core/package.json").version
|
||||||
);
|
);
|
||||||
|
|
||||||
const presetEnvWebpackPlugins = [
|
const presetEnvWebpackPlugins = [
|
||||||
@ -163,6 +167,6 @@ registerStandalonePackageTask(
|
|||||||
"babel-preset-env",
|
"babel-preset-env",
|
||||||
"babelPresetEnv",
|
"babelPresetEnv",
|
||||||
path.join(__dirname, "packages"),
|
path.join(__dirname, "packages"),
|
||||||
require("./packages/babel-preset-env-standalone/package.json").version,
|
require("./packages/babel-preset-env/package.json").version,
|
||||||
presetEnvWebpackPlugins
|
presetEnvWebpackPlugins
|
||||||
);
|
);
|
||||||
|
|||||||
2
LICENSE
2
LICENSE
@ -1,6 +1,6 @@
|
|||||||
MIT License
|
MIT License
|
||||||
|
|
||||||
Copyright (c) 2014-present Sebastian McKenzie and other contributors
|
Copyright (c) 2014-2018 Sebastian McKenzie <sebmck@gmail.com>
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining
|
Permission is hereby granted, free of charge, to any person obtaining
|
||||||
a copy of this software and associated documentation files (the
|
a copy of this software and associated documentation files (the
|
||||||
|
|||||||
209
Makefile
209
Makefile
@ -1,5 +1,6 @@
|
|||||||
FLOW_COMMIT = 09669846b7a7ca5a6c23c12d56bb3bebdafd67e9
|
MAKEFLAGS = -j1
|
||||||
TEST262_COMMIT = 8688c4ab79059c3097098605e69f1ee5eda6c409
|
FLOW_COMMIT = bea8b83f50f597454941d2a7ecef6e93a881e576
|
||||||
|
TEST262_COMMIT = f90a52b39609a620c0854e0bd0b3a906c930fd17
|
||||||
|
|
||||||
# Fix color output until TravisCI fixes https://github.com/travis-ci/travis-ci/issues/7967
|
# Fix color output until TravisCI fixes https://github.com/travis-ci/travis-ci/issues/7967
|
||||||
export FORCE_COLOR = true
|
export FORCE_COLOR = true
|
||||||
@ -8,113 +9,50 @@ SOURCES = packages codemods
|
|||||||
|
|
||||||
.PHONY: build build-dist watch lint fix clean test-clean test-only test test-ci publish bootstrap
|
.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-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 scripts/generators/flow.js > ./packages/babel-types/lib/index.js.flow
|
||||||
|
node scripts/generators/typescript.js > ./packages/babel-types/lib/index.d.ts
|
||||||
ifneq ("$(BABEL_COVERAGE)", "true")
|
ifneq ("$(BABEL_COVERAGE)", "true")
|
||||||
$(MAKE) build-standalone
|
make build-standalone
|
||||||
|
make build-preset-env-standalone
|
||||||
endif
|
endif
|
||||||
|
|
||||||
build-bundle: clean clean-lib
|
build-standalone:
|
||||||
yarn gulp build
|
./node_modules/.bin/gulp build-babel-standalone
|
||||||
$(MAKE) generate-standalone generate-type-helpers
|
|
||||||
# call build again as the generated files might need to be compiled again.
|
|
||||||
yarn gulp build
|
|
||||||
$(MAKE) build-typings
|
|
||||||
$(MAKE) build-dist
|
|
||||||
|
|
||||||
build-bundle-ci: bootstrap-only
|
|
||||||
$(MAKE) build-bundle
|
|
||||||
|
|
||||||
generate-standalone:
|
|
||||||
node packages/babel-standalone/scripts/generate.js
|
|
||||||
|
|
||||||
generate-type-helpers:
|
|
||||||
node packages/babel-types/scripts/generateTypeHelpers.js
|
|
||||||
|
|
||||||
build-typings: build-flow-typings build-typescript-typings
|
|
||||||
|
|
||||||
build-flow-typings:
|
|
||||||
node packages/babel-types/scripts/generators/flow.js > packages/babel-types/lib/index.js.flow
|
|
||||||
|
|
||||||
build-typescript-typings:
|
|
||||||
node packages/babel-types/scripts/generators/typescript.js > packages/babel-types/lib/index.d.ts
|
|
||||||
|
|
||||||
build-standalone: build-babel-standalone build-preset-env-standalone
|
|
||||||
|
|
||||||
build-standalone-ci: build-bundle-ci
|
|
||||||
$(MAKE) build-standalone
|
|
||||||
|
|
||||||
build-babel-standalone:
|
|
||||||
yarn gulp build-babel-standalone
|
|
||||||
|
|
||||||
build-preset-env-standalone:
|
build-preset-env-standalone:
|
||||||
yarn gulp build-babel-preset-env-standalone
|
./node_modules/.bin/gulp build-babel-preset-env-standalone
|
||||||
|
|
||||||
prepublish-build-standalone:
|
build-dist: build
|
||||||
BABEL_ENV=production IS_PUBLISH=true yarn gulp build-babel-standalone
|
|
||||||
|
|
||||||
prepublish-build-preset-env-standalone:
|
|
||||||
BABEL_ENV=production IS_PUBLISH=true yarn gulp build-babel-preset-env-standalone
|
|
||||||
|
|
||||||
build-dist: build-polyfill-dist build-plugin-transform-runtime-dist
|
|
||||||
|
|
||||||
build-polyfill-dist:
|
|
||||||
cd packages/babel-polyfill; \
|
cd packages/babel-polyfill; \
|
||||||
scripts/build-dist.sh
|
scripts/build-dist.sh
|
||||||
|
|
||||||
build-plugin-transform-runtime-dist:
|
|
||||||
cd packages/babel-plugin-transform-runtime; \
|
cd packages/babel-plugin-transform-runtime; \
|
||||||
node scripts/build-dist.js
|
node scripts/build-dist.js
|
||||||
|
|
||||||
build-no-bundle: clean clean-lib
|
watch: clean clean-lib
|
||||||
BABEL_ENV=development yarn gulp build-no-bundle
|
|
||||||
# Ensure that build artifacts for types are created during local
|
# Ensure that build artifacts for types are created during local
|
||||||
# development too.
|
# development too.
|
||||||
$(MAKE) generate-type-helpers
|
BABEL_ENV=development ./node_modules/.bin/gulp build-no-bundle
|
||||||
$(MAKE) build-typings
|
node ./packages/babel-types/scripts/generateTypeHelpers.js
|
||||||
|
node scripts/generators/flow.js > ./packages/babel-types/lib/index.js.flow
|
||||||
watch: build-no-bundle
|
BABEL_ENV=development ./node_modules/.bin/gulp watch
|
||||||
BABEL_ENV=development yarn gulp watch
|
|
||||||
|
|
||||||
code-quality-ci: flowcheck-ci lint-ci
|
|
||||||
|
|
||||||
flowcheck-ci: bootstrap-flowcheck
|
|
||||||
$(MAKE) flow
|
|
||||||
|
|
||||||
code-quality: flow lint
|
|
||||||
|
|
||||||
flow:
|
flow:
|
||||||
yarn flow check --strip-root
|
./node_modules/.bin/flow check --strip-root
|
||||||
|
|
||||||
bootstrap-flowcheck: bootstrap-only
|
lint:
|
||||||
yarn gulp build-babel-types
|
./node_modules/.bin/eslint scripts $(SOURCES) '*.js' --format=codeframe --rulesdir="./scripts/eslint_rules"
|
||||||
$(MAKE) build-typings
|
|
||||||
|
|
||||||
lint-ci: lint-js-ci lint-ts-ci
|
fix:
|
||||||
|
./node_modules/.bin/eslint scripts $(SOURCES) '*.js' --format=codeframe --fix --rulesdir="./scripts/eslint_rules"
|
||||||
lint-js-ci: bootstrap-only
|
|
||||||
$(MAKE) lint-js
|
|
||||||
|
|
||||||
lint-ts-ci: bootstrap-flowcheck
|
|
||||||
$(MAKE) lint-ts
|
|
||||||
|
|
||||||
lint: lint-js lint-ts
|
|
||||||
|
|
||||||
lint-js:
|
|
||||||
yarn eslint scripts $(SOURCES) '*.js' --format=codeframe
|
|
||||||
|
|
||||||
lint-ts:
|
|
||||||
scripts/tests/typescript/lint.sh
|
|
||||||
|
|
||||||
fix: fix-json fix-js
|
|
||||||
|
|
||||||
fix-js:
|
|
||||||
yarn eslint scripts $(SOURCES) '*.js' --format=codeframe --fix
|
|
||||||
|
|
||||||
fix-json:
|
|
||||||
yarn prettier "{packages,codemod}/*/test/fixtures/**/options.json" --write --loglevel warn
|
|
||||||
|
|
||||||
clean: test-clean
|
clean: test-clean
|
||||||
rm -f .npmrc
|
|
||||||
rm -rf packages/babel-polyfill/browser*
|
rm -rf packages/babel-polyfill/browser*
|
||||||
rm -rf packages/babel-polyfill/dist
|
rm -rf packages/babel-polyfill/dist
|
||||||
rm -rf coverage
|
rm -rf coverage
|
||||||
@ -124,112 +62,81 @@ test-clean:
|
|||||||
$(foreach source, $(SOURCES), \
|
$(foreach source, $(SOURCES), \
|
||||||
$(call clean-source-test, $(source)))
|
$(call clean-source-test, $(source)))
|
||||||
|
|
||||||
# Does not work on Windows; use "yarn jest" instead
|
|
||||||
test-only:
|
test-only:
|
||||||
BABEL_ENV=test ./scripts/test.sh
|
BABEL_ENV=test ./scripts/test.sh
|
||||||
$(MAKE) test-clean
|
make test-clean
|
||||||
|
|
||||||
test: lint test-only
|
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: SHELL:=/bin/bash
|
||||||
test-ci-coverage:
|
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
|
BABEL_ENV=test TEST_TYPE=cov ./scripts/test-cov.sh
|
||||||
bash <(curl -s https://codecov.io/bash) -f coverage/coverage-final.json
|
bash <(curl -s https://codecov.io/bash) -f coverage/coverage-final.json
|
||||||
|
|
||||||
bootstrap-flow:
|
bootstrap-flow:
|
||||||
rm -rf build/flow
|
rm -rf ./build/flow
|
||||||
mkdir -p build
|
mkdir -p ./build
|
||||||
git clone --branch=master --single-branch --shallow-since=2018-11-01 https://github.com/facebook/flow.git build/flow
|
git clone --branch=master --single-branch --shallow-since=2017-01-01 https://github.com/facebook/flow.git ./build/flow
|
||||||
cd build/flow && git checkout $(FLOW_COMMIT)
|
cd build/flow && git checkout $(FLOW_COMMIT)
|
||||||
|
|
||||||
test-flow:
|
test-flow:
|
||||||
node scripts/tests/flow/run_babel_parser_flow_tests.js
|
node scripts/tests/flow/run_babel_parser_flow_tests.js
|
||||||
|
|
||||||
test-flow-ci: build-bundle-ci bootstrap-flow
|
test-flow-ci: bootstrap test-flow
|
||||||
$(MAKE) test-flow
|
|
||||||
|
|
||||||
test-flow-update-whitelist:
|
test-flow-update-whitelist:
|
||||||
node scripts/tests/flow/run_babel_parser_flow_tests.js --update-whitelist
|
node scripts/tests/flow/run_babel_parser_flow_tests.js --update-whitelist
|
||||||
|
|
||||||
bootstrap-test262:
|
bootstrap-test262:
|
||||||
rm -rf build/test262
|
rm -rf ./build/test262
|
||||||
mkdir -p build
|
mkdir -p ./build
|
||||||
git clone --branch=master --single-branch --shallow-since=2019-09-01 https://github.com/tc39/test262.git build/test262
|
git clone --branch=master --single-branch --shallow-since=2017-01-01 https://github.com/tc39/test262.git ./build/test262
|
||||||
cd build/test262 && git checkout $(TEST262_COMMIT)
|
cd build/test262 && git checkout $(TEST262_COMMIT)
|
||||||
|
|
||||||
test-test262:
|
test-test262:
|
||||||
node scripts/tests/test262/run_babel_parser_test262.js
|
node scripts/tests/test262/run_babel_parser_test262.js
|
||||||
|
|
||||||
test-test262-ci: build-bundle-ci bootstrap-test262
|
test-test262-ci: bootstrap test-test262
|
||||||
$(MAKE) test-test262
|
|
||||||
|
|
||||||
test-test262-update-whitelist:
|
test-test262-update-whitelist:
|
||||||
node scripts/tests/test262/run_babel_parser_test262.js --update-whitelist
|
node scripts/tests/test262/run_babel_parser_test262.js --update-whitelist
|
||||||
|
|
||||||
# Does not work on Windows
|
|
||||||
clone-license:
|
clone-license:
|
||||||
./scripts/clone-license.sh
|
./scripts/clone-license.sh
|
||||||
|
|
||||||
prepublish-build: clean-lib clean-runtime-helpers
|
prepublish-build:
|
||||||
NODE_ENV=production BABEL_ENV=production $(MAKE) build
|
make clean-lib
|
||||||
$(MAKE) clone-license
|
rm -rf packages/babel-runtime/helpers
|
||||||
|
rm -rf packages/babel-runtime-corejs2/helpers
|
||||||
|
rm -rf packages/babel-runtime-corejs2/core-js
|
||||||
|
BABEL_ENV=production make build-dist
|
||||||
|
make clone-license
|
||||||
|
|
||||||
prepublish:
|
prepublish:
|
||||||
$(MAKE) bootstrap-only
|
|
||||||
$(MAKE) prepublish-build
|
|
||||||
$(MAKE) test
|
|
||||||
|
|
||||||
new-version:
|
|
||||||
git pull --rebase
|
git pull --rebase
|
||||||
yarn lerna version --force-publish="@babel/runtime,@babel/runtime-corejs2,@babel/runtime-corejs3,@babel/standalone,@babel/preset-env-standalone"
|
make prepublish-build
|
||||||
|
make test
|
||||||
|
|
||||||
publish-cerxes: prepublish
|
|
||||||
yarn lerna publish --registry="https://npm.cerxes.net" --force-publish --allow-branch initializers-fix --canary --preid csx --dist-tag csx
|
|
||||||
|
|
||||||
# NOTE: Run make new-version first
|
|
||||||
publish: prepublish
|
publish: prepublish
|
||||||
yarn lerna publish from-git
|
# not using lerna independent mode atm, so only update packages that have changed since we use ^
|
||||||
$(MAKE) clean
|
# --only-explicit-updates
|
||||||
|
./node_modules/.bin/lerna publish --force-publish=* --temp-tag
|
||||||
|
make clean
|
||||||
|
|
||||||
publish-ci: prepublish
|
bootstrap: clean-all
|
||||||
ifneq ("$(NPM_TOKEN)", "")
|
|
||||||
echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > .npmrc
|
|
||||||
else
|
|
||||||
echo "Missing NPM_TOKEN env var"
|
|
||||||
exit 1
|
|
||||||
endif
|
|
||||||
yarn lerna publish from-git --yes
|
|
||||||
rm -f .npmrc
|
|
||||||
$(MAKE) clean
|
|
||||||
|
|
||||||
bootstrap-only: lerna-bootstrap
|
|
||||||
|
|
||||||
yarn-install: clean-all
|
|
||||||
yarn --ignore-engines
|
yarn --ignore-engines
|
||||||
|
./node_modules/.bin/lerna bootstrap -- --ignore-engines
|
||||||
lerna-bootstrap: yarn-install
|
make build
|
||||||
yarn lerna bootstrap
|
cd packages/babel-plugin-transform-runtime; \
|
||||||
|
node scripts/build-dist.js
|
||||||
bootstrap: bootstrap-only
|
|
||||||
$(MAKE) build
|
|
||||||
|
|
||||||
clean-lib:
|
clean-lib:
|
||||||
$(foreach source, $(SOURCES), \
|
$(foreach source, $(SOURCES), \
|
||||||
$(call clean-source-lib, $(source)))
|
$(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:
|
clean-all:
|
||||||
rm -rf node_modules
|
rm -rf node_modules
|
||||||
rm -rf package-lock.json
|
rm -rf package-lock.json
|
||||||
@ -238,7 +145,7 @@ clean-all:
|
|||||||
$(foreach source, $(SOURCES), \
|
$(foreach source, $(SOURCES), \
|
||||||
$(call clean-source-all, $(source)))
|
$(call clean-source-all, $(source)))
|
||||||
|
|
||||||
$(MAKE) clean
|
make clean
|
||||||
|
|
||||||
define clean-source-lib
|
define clean-source-lib
|
||||||
rm -rf $(1)/*/lib
|
rm -rf $(1)/*/lib
|
||||||
|
|||||||
72
README.md
72
README.md
@ -4,27 +4,16 @@
|
|||||||
</a>
|
</a>
|
||||||
</p>
|
</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">
|
<p align="center">
|
||||||
The compiler for writing next generation JavaScript.
|
The compiler for writing next generation JavaScript.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
|
||||||
<p align="center">
|
<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://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://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://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://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://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>
|
<a href="https://slack.babeljs.io/"><img alt="Slack Status" src="https://slack.babeljs.io/badge.svg"></a>
|
||||||
<a href="https://twitter.com/intent/follow?screen_name=babeljs"><img alt="Follow on Twitter" src="https://img.shields.io/twitter/follow/babeljs.svg?style=social&label=Follow"></a>
|
<a href="https://www.npmjs.com/package/babel-core"><img alt="npm Downloads" src="https://img.shields.io/npm/dm/babel-core.svg?maxAge=43200"></a>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<h2 align="center">Supporting Babel</h2>
|
<h2 align="center">Supporting Babel</h2>
|
||||||
@ -35,14 +24,14 @@
|
|||||||
<a href="https://medium.com/friendship-dot-js/i-peeked-into-my-node-modules-directory-and-you-wont-believe-what-happened-next-b89f63d21558"><img alt="Business Strategy Status" src="https://img.shields.io/badge/business%20model-flavortown-green.svg"></a>
|
<a href="https://medium.com/friendship-dot-js/i-peeked-into-my-node-modules-directory-and-you-wont-believe-what-happened-next-b89f63d21558"><img alt="Business Strategy Status" src="https://img.shields.io/badge/business%20model-flavortown-green.svg"></a>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
Babel (pronounced ["babble"](https://soundcloud.com/sebmck/how-to-pronounce-babel)) is a community-driven project used by many companies and projects, and is maintained by a group of [volunteers](https://babeljs.io/team). If you'd like to help support the future of the project, please consider:
|
Babel is a community-driven project used by many companies and projects, and is maintained by a group of [volunteers](https://babeljs.io/team). If you'd like to help support the future of the project, please consider:
|
||||||
|
|
||||||
- Giving developer time on the project. (Message us on [Twitter](https://twitter.com/babeljs) or [Slack](https://slack.babeljs.io/) for guidance!)
|
- Giving developer time on the project. (Message us on [Twitter](https://twitter.com/babeljs) or [Slack](https://slack.babeljs.io/) for guidance!)
|
||||||
- Giving funds by becoming a sponsor on [Open Collective](https://opencollective.com/babel) or [Patreon](https://www.patreon.com/henryzhu)!
|
- Giving funds by becoming a sponsor (see below)!
|
||||||
|
|
||||||
## Sponsors
|
## Open Collective Sponsors
|
||||||
|
|
||||||
Our top sponsors are shown below! [[Become a sponsor](https://opencollective.com/babel#sponsor)]
|
Become a sponsor and get your logo on our README on Github with a link to your site. [[Become a sponsor](https://opencollective.com/babel#sponsor)]
|
||||||
|
|
||||||
<a href="https://opencollective.com/babel/sponsor/0/website" target="_blank"><img src="https://opencollective.com/babel/sponsor/0/avatar.svg"></a>
|
<a href="https://opencollective.com/babel/sponsor/0/website" target="_blank"><img src="https://opencollective.com/babel/sponsor/0/avatar.svg"></a>
|
||||||
<a href="https://opencollective.com/babel/sponsor/1/website" target="_blank"><img src="https://opencollective.com/babel/sponsor/1/avatar.svg"></a>
|
<a href="https://opencollective.com/babel/sponsor/1/website" target="_blank"><img src="https://opencollective.com/babel/sponsor/1/avatar.svg"></a>
|
||||||
@ -59,6 +48,32 @@ Our top sponsors are shown below! [[Become a sponsor](https://opencollective.com
|
|||||||
<a href="https://opencollective.com/babel/sponsor/12/website" target="_blank"><img src="https://opencollective.com/babel/sponsor/12/avatar.svg"></a>
|
<a href="https://opencollective.com/babel/sponsor/12/website" target="_blank"><img src="https://opencollective.com/babel/sponsor/12/avatar.svg"></a>
|
||||||
<a href="https://opencollective.com/babel/sponsor/13/website" target="_blank"><img src="https://opencollective.com/babel/sponsor/13/avatar.svg"></a>
|
<a href="https://opencollective.com/babel/sponsor/13/website" target="_blank"><img src="https://opencollective.com/babel/sponsor/13/avatar.svg"></a>
|
||||||
<a href="https://opencollective.com/babel/sponsor/14/website" target="_blank"><img src="https://opencollective.com/babel/sponsor/14/avatar.svg"></a>
|
<a href="https://opencollective.com/babel/sponsor/14/website" target="_blank"><img src="https://opencollective.com/babel/sponsor/14/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/babel/sponsor/15/website" target="_blank"><img src="https://opencollective.com/babel/sponsor/15/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/babel/sponsor/16/website" target="_blank"><img src="https://opencollective.com/babel/sponsor/16/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/babel/sponsor/17/website" target="_blank"><img src="https://opencollective.com/babel/sponsor/17/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/babel/sponsor/18/website" target="_blank"><img src="https://opencollective.com/babel/sponsor/18/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/babel/sponsor/19/website" target="_blank"><img src="https://opencollective.com/babel/sponsor/19/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/babel/sponsor/20/website" target="_blank"><img src="https://opencollective.com/babel/sponsor/20/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/babel/sponsor/21/website" target="_blank"><img src="https://opencollective.com/babel/sponsor/21/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/babel/sponsor/22/website" target="_blank"><img src="https://opencollective.com/babel/sponsor/22/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/babel/sponsor/23/website" target="_blank"><img src="https://opencollective.com/babel/sponsor/23/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/babel/sponsor/24/website" target="_blank"><img src="https://opencollective.com/babel/sponsor/24/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/babel/sponsor/25/website" target="_blank"><img src="https://opencollective.com/babel/sponsor/25/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/babel/sponsor/26/website" target="_blank"><img src="https://opencollective.com/babel/sponsor/26/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/babel/sponsor/27/website" target="_blank"><img src="https://opencollective.com/babel/sponsor/27/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/babel/sponsor/28/website" target="_blank"><img src="https://opencollective.com/babel/sponsor/28/avatar.svg"></a>
|
||||||
|
<a href="https://opencollective.com/babel/sponsor/29/website" target="_blank"><img src="https://opencollective.com/babel/sponsor/29/avatar.svg"></a>
|
||||||
|
|
||||||
|
## Patreon Sponsors
|
||||||
|
|
||||||
|
Become a sponsor and get your logo on our README on Github with a link to your site. [[Become a sponsor](https://www.patreon.com/henryzhu)]
|
||||||
|
|
||||||
|
## Bronze
|
||||||
|
|
||||||
|
<a href="http://teamextension.io/" target="_blank"><img src="https://teamextension.io/dist/img/logo/te-logo-compact.png" height="64"></a>
|
||||||
|
<a href="https://webflow.com/" target="_blank"><img src="https://opencollective.com/proxy/images/?src=https%3A%2F%2Fopencollective-production.s3-us-west-1.amazonaws.com%2F4a5024b0-8cf2-11e7-b1a2-b30b1de1463c.png&height=64"></a>
|
||||||
|
<a href="https://issue.sh/?utm_medium=github&utm_campaign=babel" target="_blank"><img src="https://user-images.githubusercontent.com/5557143/43912065-c8cdff78-9c33-11e8-829a-0b4166ccc215.png"></a>
|
||||||
|
<p><a href="https://twitter.com/mikesherov">Mike Sherov</a></p>
|
||||||
|
|
||||||
## Intro
|
## Intro
|
||||||
|
|
||||||
@ -85,16 +100,16 @@ Try it out at our [REPL](https://babeljs.io/repl/build/master#?code_lz=NoRgNATGD
|
|||||||
|
|
||||||
### Who maintains Babel?
|
### Who maintains Babel?
|
||||||
|
|
||||||
Mostly a handful of volunteers, funded by you! Please check out our [team page](https://babeljs.io/team)!
|
Mostly a handful of volunteers! Please check out our [team page](https://babeljs.io/team)!
|
||||||
|
|
||||||
|
### Looking for support?
|
||||||
|
|
||||||
|
For questions and support please visit join our [Slack Community](https://slack.babeljs.io/) (you can sign-up [here](https://slack.babeljs.io/) for an invite), ask a question on [Stack Overflow](https://stackoverflow.com/questions/tagged/babeljs), or ping us on [Twitter](https://twitter.com/babeljs).
|
||||||
|
|
||||||
### Is there a Babel song?
|
### Is there a Babel song?
|
||||||
|
|
||||||
I'm so glad you asked: [Hallelujah —— In Praise of Babel](SONG.md) by [@angus-c](https://github.com/angus-c), [audio version](https://youtu.be/40abpedBKK8) by [@swyx](https://twitter.com/@swyx). Tweet us your recordings!
|
I'm so glad you asked: [Hallelujah —— In Praise of Babel](SONG.md) by [@angus-c](https://github.com/angus-c), [audio version](https://youtu.be/40abpedBKK8) by [@swyx](https://twitter.com/@swyx). Tweet us your recordings!
|
||||||
|
|
||||||
### Looking for support?
|
|
||||||
|
|
||||||
For questions and support please join our [Slack Community](https://slack.babeljs.io/) (you can sign-up [here](https://slack.babeljs.io/) for an invite), ask a question on [Stack Overflow](https://stackoverflow.com/questions/tagged/babeljs), or ping us on [Twitter](https://twitter.com/babeljs).
|
|
||||||
|
|
||||||
### Where are the docs?
|
### Where are the docs?
|
||||||
|
|
||||||
Check out our website: [babeljs.io](https://babeljs.io/), and report issues/features at [babel/website](https://github.com/babel/website/issues).
|
Check out our website: [babeljs.io](https://babeljs.io/), and report issues/features at [babel/website](https://github.com/babel/website/issues).
|
||||||
@ -105,19 +120,12 @@ Please read through our [CONTRIBUTING.md](CONTRIBUTING.md) and fill out the issu
|
|||||||
|
|
||||||
### Want to contribute to Babel?
|
### Want to contribute to Babel?
|
||||||
|
|
||||||
Check out:
|
Check out our [CONTRIBUTING.md](CONTRIBUTING.md) to get started with setting up the repo.
|
||||||
|
|
||||||
- Our [#development](https://babeljs.slack.com/messages/development) Slack channel and say hi ([signup](https://slack.babeljs.io))!
|
- If you have already joined Slack, join our [#development](https://babeljs.slack.com/messages/development) channel and say hi!
|
||||||
- Issues with the [good first issue](https://github.com/babel/babel/labels/good%20first%20issue) and [help wanted](https://github.com/babel/babel/labels/help%20wanted) label. We suggest also looking at the [closed ones](https://github.com/babel/babel/issues?utf8=%E2%9C%93&q=is%3Aclosed+label%3A%22good+first+issue%22) to get a sense of the kinds of issues you can tackle.
|
- Check out the issues with the [good first issue](https://github.com/babel/babel/labels/good%20first%20issue) and [help wanted](https://github.com/babel/babel/labels/help%20wanted) label. We suggest also looking at the closed ones to get a sense of the kinds of issues you can tackle.
|
||||||
|
|
||||||
Some resources:
|
|
||||||
|
|
||||||
- Our [CONTRIBUTING.md](CONTRIBUTING.md) to get started with setting up the repo.
|
|
||||||
- Our discussions/notes/roadmap: [babel/notes](https://github.com/babel/notes)
|
- Our discussions/notes/roadmap: [babel/notes](https://github.com/babel/notes)
|
||||||
- Our progress on TC39 proposals: [babel/proposals](https://github.com/babel/proposals)
|
- Our progress on TC39 proposals: [babel/proposals](https://github.com/babel/proposals)
|
||||||
- Our blog which contains release posts and explainations: [/blog](https://babeljs.io/blog)
|
|
||||||
- Our videos page with talks about open source and Babel: [/videos](https://babeljs.io/videos)
|
|
||||||
- Our [podcast](https://podcast.babeljs.io)
|
|
||||||
|
|
||||||
### How is the repo structured?
|
### How is the repo structured?
|
||||||
|
|
||||||
|
|||||||
19
SECURITY.md
19
SECURITY.md
@ -1,19 +0,0 @@
|
|||||||
# Security Policy
|
|
||||||
|
|
||||||
## Supported Versions
|
|
||||||
|
|
||||||
This is the list of versions of `babel` which are
|
|
||||||
currently being supported with security updates.
|
|
||||||
|
|
||||||
| Version | Supported |
|
|
||||||
| -------- | ------------------ |
|
|
||||||
| 7.x | :white_check_mark: |
|
|
||||||
| 6.26.x | :white_check_mark: |
|
|
||||||
| < 6.26.0 | :x: |
|
|
||||||
|
|
||||||
## Reporting a Vulnerability
|
|
||||||
|
|
||||||
To report a vulnerability please send an email with the details to security@babeljs.io.
|
|
||||||
This will help us to assess the risk and start the necessary steps.
|
|
||||||
|
|
||||||
Thanks for helping to keep babel secure.
|
|
||||||
23
SONG.md
23
SONG.md
@ -19,8 +19,7 @@ Generators, const and let
|
|||||||
I used them all without regret
|
I used them all without regret
|
||||||
And it’s a terse and a destructured Hallelujah
|
And it’s a terse and a destructured Hallelujah
|
||||||
|
|
||||||
Hallelujah, Hallelujah
|
Hallelujah etc.
|
||||||
Hallelujah, Hallelujah
|
|
||||||
|
|
||||||
Well my faith was strong but I needed proof
|
Well my faith was strong but I needed proof
|
||||||
The standard was my source of truth
|
The standard was my source of truth
|
||||||
@ -29,9 +28,7 @@ So even though you weren’t impressed
|
|||||||
I checked the build against the spec
|
I checked the build against the spec
|
||||||
And it’s a more-or-less compliant Hallelujah
|
And it’s a more-or-less compliant Hallelujah
|
||||||
|
|
||||||
|
Hallelujah etc.
|
||||||
Hallelujah, Hallelujah
|
|
||||||
Hallelujah, Hallelujah
|
|
||||||
|
|
||||||
Now you say the build step’s too complex
|
Now you say the build step’s too complex
|
||||||
And you claim no need for ES Next
|
And you claim no need for ES Next
|
||||||
@ -40,9 +37,7 @@ But your code grows older with each line
|
|||||||
It’s a joyless dirge on a withered vine
|
It’s a joyless dirge on a withered vine
|
||||||
It’s a threnody for a bygone Hallelujah
|
It’s a threnody for a bygone Hallelujah
|
||||||
|
|
||||||
|
Hallelujah etc.
|
||||||
Hallelujah, Hallelujah
|
|
||||||
Hallelujah, Hallelujah
|
|
||||||
|
|
||||||
Yes I learned about the danger signs
|
Yes I learned about the danger signs
|
||||||
How they’d polyfilled a thousand lines
|
How they’d polyfilled a thousand lines
|
||||||
@ -51,9 +46,7 @@ Still I disregarded common sense
|
|||||||
Now my source is small but the build’s immense
|
Now my source is small but the build’s immense
|
||||||
And it’s a slow and unresponsive Hallelujah
|
And it’s a slow and unresponsive Hallelujah
|
||||||
|
|
||||||
|
Hallelujah etc.
|
||||||
Hallelujah, Hallelujah
|
|
||||||
Hallelujah, Hallelujah
|
|
||||||
|
|
||||||
There was a time when they let me know
|
There was a time when they let me know
|
||||||
What’s really going on below
|
What’s really going on below
|
||||||
@ -62,9 +55,7 @@ And debugging’s not a progress march
|
|||||||
It’s a frenzied fumble in the dark
|
It’s a frenzied fumble in the dark
|
||||||
It’s a labyrinthine search for Hallelujah
|
It’s a labyrinthine search for Hallelujah
|
||||||
|
|
||||||
|
Hallelujah etc.
|
||||||
Hallelujah, Hallelujah
|
|
||||||
Hallelujah, Hallelujah
|
|
||||||
|
|
||||||
Well, maybe there’s a god up there
|
Well, maybe there’s a god up there
|
||||||
But all I ever got from prayers
|
But all I ever got from prayers
|
||||||
@ -73,8 +64,6 @@ And that anguished cry you hear at night
|
|||||||
Is the plugin I forgot to write
|
Is the plugin I forgot to write
|
||||||
It’s a cold and it’s a broken Hallelujah
|
It’s a cold and it’s a broken Hallelujah
|
||||||
|
|
||||||
|
Hallelujah etc.
|
||||||
Hallelujah, Hallelujah
|
|
||||||
Hallelujah, Hallelujah
|
|
||||||
|
|
||||||
[Angus Croll](https://github.com/angus-c)
|
[Angus Croll](https://github.com/angus-c)
|
||||||
|
|||||||
@ -5,26 +5,21 @@ module.exports = function(api) {
|
|||||||
|
|
||||||
const includeCoverage = process.env.BABEL_COVERAGE === "true";
|
const includeCoverage = process.env.BABEL_COVERAGE === "true";
|
||||||
|
|
||||||
const envOptsNoTargets = {
|
const envOpts = {
|
||||||
loose: true,
|
loose: true,
|
||||||
modules: false,
|
modules: false,
|
||||||
exclude: ["transform-typeof-symbol"],
|
exclude: ["transform-typeof-symbol"],
|
||||||
};
|
};
|
||||||
const envOpts = Object.assign({}, envOptsNoTargets);
|
|
||||||
|
|
||||||
let convertESM = true;
|
let convertESM = true;
|
||||||
let ignoreLib = true;
|
let ignoreLib = true;
|
||||||
let includeRuntime = false;
|
let includeRuntime = false;
|
||||||
const nodeVersion = "6.9";
|
|
||||||
|
|
||||||
switch (env) {
|
switch (env) {
|
||||||
// Configs used during bundling builds.
|
// Configs used during bundling builds.
|
||||||
case "babel-parser":
|
case "babel-parser":
|
||||||
convertESM = false;
|
convertESM = false;
|
||||||
ignoreLib = false;
|
ignoreLib = false;
|
||||||
envOpts.targets = {
|
|
||||||
node: nodeVersion,
|
|
||||||
};
|
|
||||||
break;
|
break;
|
||||||
case "standalone":
|
case "standalone":
|
||||||
convertESM = false;
|
convertESM = false;
|
||||||
@ -34,7 +29,7 @@ module.exports = function(api) {
|
|||||||
case "production":
|
case "production":
|
||||||
// Config during builds before publish.
|
// Config during builds before publish.
|
||||||
envOpts.targets = {
|
envOpts.targets = {
|
||||||
node: nodeVersion,
|
node: "6.9",
|
||||||
};
|
};
|
||||||
break;
|
break;
|
||||||
case "development":
|
case "development":
|
||||||
@ -77,10 +72,9 @@ module.exports = function(api) {
|
|||||||
"@babel/proposal-object-rest-spread",
|
"@babel/proposal-object-rest-spread",
|
||||||
{ useBuiltIns: true, loose: true },
|
{ 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),
|
].filter(Boolean),
|
||||||
overrides: [
|
overrides: [
|
||||||
{
|
{
|
||||||
@ -91,18 +85,14 @@ module.exports = function(api) {
|
|||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
test: ["./packages/babel-cli", "./packages/babel-core"],
|
test: "./packages/babel-register",
|
||||||
plugins: [
|
plugins: [
|
||||||
// Explicitly use the lazy version of CommonJS modules.
|
// Override the root options to disable lazy imports for babel-register
|
||||||
convertESM
|
// because otherwise the require hook will try to lazy-import things
|
||||||
? ["@babel/transform-modules-commonjs", { lazy: true }]
|
// leading to dependency cycles.
|
||||||
: null,
|
convertESM ? "@babel/transform-modules-commonjs" : null,
|
||||||
].filter(Boolean),
|
].filter(Boolean),
|
||||||
},
|
},
|
||||||
{
|
|
||||||
test: "./packages/babel-polyfill",
|
|
||||||
presets: [["@babel/env", envOptsNoTargets]],
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
// The vast majority of our src files are modules, but we use
|
// The vast majority of our src files are modules, but we use
|
||||||
// unambiguous to keep things simple until we get around to renaming
|
// unambiguous to keep things simple until we get around to renaming
|
||||||
@ -121,11 +111,9 @@ module.exports = function(api) {
|
|||||||
"packages/babel-runtime",
|
"packages/babel-runtime",
|
||||||
/[\\/]node_modules[\\/](?:@babel\/runtime|babel-runtime|core-js)[\\/]/,
|
/[\\/]node_modules[\\/](?:@babel\/runtime|babel-runtime|core-js)[\\/]/,
|
||||||
],
|
],
|
||||||
plugins: [
|
plugins: [includeRuntime ? "@babel/transform-runtime" : null].filter(
|
||||||
includeRuntime
|
Boolean
|
||||||
? ["@babel/transform-runtime", { version: "7.4.4" }]
|
),
|
||||||
: null,
|
|
||||||
].filter(Boolean),
|
|
||||||
},
|
},
|
||||||
].filter(Boolean),
|
].filter(Boolean),
|
||||||
};
|
};
|
||||||
|
|||||||
@ -8,5 +8,3 @@ coverage:
|
|||||||
target: "80%"
|
target: "80%"
|
||||||
patch:
|
patch:
|
||||||
enabled: false
|
enabled: false
|
||||||
ignore:
|
|
||||||
- packages/babel-types/src/*/generated/index.js
|
|
||||||
|
|||||||
@ -36,7 +36,7 @@ npm install --save-dev @babel/plugin-codemod-object-assign-to-object-spread
|
|||||||
|
|
||||||
**.babelrc**
|
**.babelrc**
|
||||||
|
|
||||||
```jsonc
|
```json
|
||||||
{
|
{
|
||||||
"plugins": ["@babel/plugin-codemod-object-assign-to-object-spread"]
|
"plugins": ["@babel/plugin-codemod-object-assign-to-object-spread"]
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,9 +4,6 @@
|
|||||||
"description": "Transforms Object.assign into object spread syntax",
|
"description": "Transforms Object.assign into object spread syntax",
|
||||||
"repository": "https://github.com/babel/babel/tree/master/codemods/babel-plugin-codemod-object-assign-to-object-spread",
|
"repository": "https://github.com/babel/babel/tree/master/codemods/babel-plugin-codemod-object-assign-to-object-spread",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"publishConfig": {
|
|
||||||
"access": "public"
|
|
||||||
},
|
|
||||||
"main": "lib/index.js",
|
"main": "lib/index.js",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"@babel/codemod",
|
"@babel/codemod",
|
||||||
@ -16,7 +13,7 @@
|
|||||||
"@babel/plugin-syntax-object-rest-spread": "^7.0.0"
|
"@babel/plugin-syntax-object-rest-spread": "^7.0.0"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"@babel/core": "^7.0.0-0 || csx"
|
"@babel/core": "^7.0.0-0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@babel/core": "^7.0.0",
|
"@babel/core": "^7.0.0",
|
||||||
|
|||||||
@ -34,7 +34,7 @@ npm install --save-dev @babel/plugin-codemod-optional-catch-binding
|
|||||||
|
|
||||||
**.babelrc**
|
**.babelrc**
|
||||||
|
|
||||||
```jsonc
|
```json
|
||||||
{
|
{
|
||||||
"plugins": ["@babel/plugin-codemod-optional-catch-binding"]
|
"plugins": ["@babel/plugin-codemod-optional-catch-binding"]
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,9 +4,6 @@
|
|||||||
"description": "Remove unused catch bindings",
|
"description": "Remove unused catch bindings",
|
||||||
"repository": "https://github.com/babel/babel/tree/master/codemods/babel-plugin-codemod-remove-unused-catch-binding",
|
"repository": "https://github.com/babel/babel/tree/master/codemods/babel-plugin-codemod-remove-unused-catch-binding",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"publishConfig": {
|
|
||||||
"access": "public"
|
|
||||||
},
|
|
||||||
"main": "lib/index.js",
|
"main": "lib/index.js",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"@babel/codemod",
|
"@babel/codemod",
|
||||||
@ -16,7 +13,7 @@
|
|||||||
"@babel/plugin-syntax-optional-catch-binding": "^7.0.0"
|
"@babel/plugin-syntax-optional-catch-binding": "^7.0.0"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"@babel/core": "^7.0.0-0 || csx"
|
"@babel/core": "^7.0.0-0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@babel/core": "^7.0.0",
|
"@babel/core": "^7.0.0",
|
||||||
|
|||||||
@ -0,0 +1,5 @@
|
|||||||
|
try {
|
||||||
|
throw 0;
|
||||||
|
} catch (e) {
|
||||||
|
let e = new TypeError('Duplicate variable declaration; will throw an error.');
|
||||||
|
}
|
||||||
@ -0,0 +1,4 @@
|
|||||||
|
{
|
||||||
|
"plugins": ["../../../../lib"],
|
||||||
|
"throws": "Duplicate declaration \"e\""
|
||||||
|
}
|
||||||
@ -15,7 +15,7 @@ This is quite taboo but let's look at the pros and cons:
|
|||||||
* Easy to coordinate changes across modules.
|
* Easy to coordinate changes across modules.
|
||||||
* Single place to report issues.
|
* Single place to report issues.
|
||||||
* Easier to setup a development environment.
|
* 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:**
|
**Cons:**
|
||||||
|
|
||||||
|
|||||||
26
lerna.json
26
lerna.json
@ -1,40 +1,34 @@
|
|||||||
{
|
{
|
||||||
"version": "7.7.3",
|
"lerna": "2.11.0",
|
||||||
|
"version": "7.0.0",
|
||||||
"changelog": {
|
"changelog": {
|
||||||
"repo": "babel/babel",
|
"repo": "babel/babel",
|
||||||
"cacheDir": ".changelog",
|
"cacheDir": ".changelog",
|
||||||
"labels": {
|
"labels": {
|
||||||
"PR: Spec Compliance :eyeglasses:": ":eyeglasses: Spec Compliance",
|
"PR: Spec Compliancy :eyeglasses:": ":eyeglasses: Spec Compliancy",
|
||||||
"PR: Breaking Change :boom:": ":boom: Breaking Change",
|
"PR: Breaking Change :boom:": ":boom: Breaking Change",
|
||||||
"PR: New Feature :rocket:": ":rocket: New Feature",
|
"PR: New Feature :rocket:": ":rocket: New Feature",
|
||||||
"PR: Bug Fix :bug:": ":bug: Bug Fix",
|
"PR: Bug Fix :bug:": ":bug: Bug Fix",
|
||||||
"PR: Polish :nail_care:": ":nail_care: Polish",
|
"PR: Polish :nail_care:": ":nail_care: Polish",
|
||||||
"PR: Docs :memo:": ":memo: Documentation",
|
"PR: Docs :memo:": ":memo: Documentation",
|
||||||
"PR: Internal :house:": ":house: Internal",
|
"PR: Internal :house:": ":house: Internal"
|
||||||
"PR: Performance :running_woman:": ":running_woman: Performance"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"command": {
|
"commands": {
|
||||||
"publish": {
|
"publish": {
|
||||||
"ignoreChanges": [
|
"ignore": [
|
||||||
"*.md",
|
"*.md",
|
||||||
"*.txt",
|
|
||||||
"test/**",
|
"test/**",
|
||||||
"codemods/**",
|
"codemods/**"
|
||||||
"# We ignore every JSON file, except for built-in-modules, built-ins and plugins defined in babel-preset-env/data.",
|
|
||||||
"@(!(built-in-modules|built-ins|plugins|package)).json"
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"packages": [
|
"packages": [
|
||||||
"codemods/*",
|
"packages/*",
|
||||||
"packages/*"
|
"codemods/*"
|
||||||
],
|
],
|
||||||
"npmClient": "yarn",
|
"npmClient": "yarn",
|
||||||
"npmClientArgs": [
|
"npmClientArgs": [
|
||||||
"--no-lockfile"
|
"--no-lockfile"
|
||||||
],
|
]
|
||||||
"publishConfig": {
|
|
||||||
"registry": "https://npm.cerxes.net"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,6 +2,12 @@
|
|||||||
* Basic declarations for the npm modules we use.
|
* Basic declarations for the npm modules we use.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
declare module "micromatch" {
|
||||||
|
declare module.exports: {
|
||||||
|
(Array<string>, Array<string>, ?{ nocase: boolean }): Array<string>,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
declare module "resolve" {
|
declare module "resolve" {
|
||||||
declare export default {
|
declare export default {
|
||||||
sync: (string, {| basedir: string |}) => string;
|
sync: (string, {| basedir: string |}) => string;
|
||||||
@ -27,31 +33,16 @@ declare module "lodash/merge" {
|
|||||||
}
|
}
|
||||||
|
|
||||||
declare module "semver" {
|
declare module "semver" {
|
||||||
declare class SemVer {
|
|
||||||
build: Array<string>;
|
|
||||||
loose: ?boolean;
|
|
||||||
major: number;
|
|
||||||
minor: number;
|
|
||||||
patch: number;
|
|
||||||
prerelease: Array<string | number>;
|
|
||||||
raw: string;
|
|
||||||
version: string;
|
|
||||||
|
|
||||||
constructor(version: string | SemVer): SemVer;
|
|
||||||
}
|
|
||||||
|
|
||||||
declare module.exports: {
|
declare module.exports: {
|
||||||
SemVer: SemVer;
|
valid(v: string): boolean;
|
||||||
|
|
||||||
coerce(version: string | SemVer): SemVer | null;
|
|
||||||
gt(v1: string, v2: string): boolean;
|
gt(v1: string, v2: string): boolean;
|
||||||
intersects(r1: string, r2: string): boolean;
|
|
||||||
lt(v1: string, v2: string): boolean;
|
lt(v1: string, v2: string): boolean;
|
||||||
major(v: string): number;
|
major(v: string): number;
|
||||||
minor(v: string): number;
|
minor(v: string): number;
|
||||||
patch(v: string): number;
|
patch(v: string): number;
|
||||||
satisfies(v1: string, r1: string): boolean;
|
satisfies(v1: string, r1: string): boolean;
|
||||||
valid(v: string): boolean;
|
|
||||||
|
intersects(r1: string, r2: string): boolean;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -165,7 +156,7 @@ declare module "source-map" {
|
|||||||
}
|
}
|
||||||
|
|
||||||
declare module "convert-source-map" {
|
declare module "convert-source-map" {
|
||||||
import type { SourceMap, SourceMapGenerator } from "source-map";
|
import type { SourceMap } from "source-map";
|
||||||
|
|
||||||
declare class Converter {
|
declare class Converter {
|
||||||
toJSON(): string;
|
toJSON(): string;
|
||||||
@ -177,11 +168,11 @@ declare module "convert-source-map" {
|
|||||||
declare module.exports: {
|
declare module.exports: {
|
||||||
SourceMap: SourceMap,
|
SourceMap: SourceMap,
|
||||||
Converter: Converter,
|
Converter: Converter,
|
||||||
fromObject(obj: SourceMap | SourceMapGenerator): Converter,
|
fromObject(obj: SourceMap): Converter,
|
||||||
fromJSON(str: string): Converter,
|
fromJSON(str: string): Converter,
|
||||||
fromBase64(str: string): Converter,
|
fromBase64(str: string): Converter,
|
||||||
fromComment(str: string): Converter,
|
fromComment(str: string): Converter,
|
||||||
fromMapFileComment(str: string, dir: string): Converter,
|
fromMapFileComment(str: string): Converter,
|
||||||
fromSource(str: string): Converter,
|
fromSource(str: string): Converter,
|
||||||
fromMapFileSource(str: string, dir: string): Converter,
|
fromMapFileSource(str: string, dir: string): Converter,
|
||||||
removeComments(str: string): string,
|
removeComments(str: string): string,
|
||||||
@ -195,13 +186,3 @@ declare module "js-levenshtein" {
|
|||||||
(string, string): number,
|
(string, string): number,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
declare module "core-js-compat/data" {
|
|
||||||
declare type Target = "node" | "chrome" | "opera" | "edge" | "firefox" | "safari" | "ie" | "ios" | "android" | "electron" | "samsung";
|
|
||||||
|
|
||||||
declare module.exports: {
|
|
||||||
[key: string]: {
|
|
||||||
[target: Target]: string;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
122
package.json
122
package.json
@ -6,90 +6,80 @@
|
|||||||
"build": "make build",
|
"build": "make build",
|
||||||
"fix": "make fix",
|
"fix": "make fix",
|
||||||
"lint": "make lint",
|
"lint": "make lint",
|
||||||
|
"precommit": "lint-staged",
|
||||||
"test": "make test"
|
"test": "make test"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@babel/cli": "^7.6.0",
|
"@babel/cli": "7.0.0-rc.2",
|
||||||
"@babel/core": "^7.6.0",
|
"@babel/core": "7.0.0-rc.2",
|
||||||
"@babel/eslint-plugin-development": "^1.0.1",
|
"@babel/plugin-transform-runtime": "7.0.0-rc.2",
|
||||||
"@babel/plugin-proposal-class-properties": "^7.5.5",
|
"@babel/plugin-proposal-class-properties": "7.0.0-rc.2",
|
||||||
"@babel/plugin-proposal-export-namespace-from": "^7.5.2",
|
"@babel/plugin-proposal-export-namespace-from": "7.0.0-rc.2",
|
||||||
"@babel/plugin-proposal-nullish-coalescing-operator": "^7.4.4",
|
"@babel/plugin-proposal-numeric-separator": "7.0.0-rc.2",
|
||||||
"@babel/plugin-proposal-numeric-separator": "^7.2.0",
|
"@babel/plugin-transform-modules-commonjs": "7.0.0-rc.2",
|
||||||
"@babel/plugin-proposal-optional-chaining": "^7.6.0",
|
"@babel/preset-env": "7.0.0-rc.2",
|
||||||
"@babel/plugin-transform-modules-commonjs": "^7.6.0",
|
"@babel/preset-flow": "7.0.0-rc.2",
|
||||||
"@babel/plugin-transform-runtime": "^7.6.0",
|
"@babel/register": "7.0.0-rc.2",
|
||||||
"@babel/preset-env": "^7.6.0",
|
"@babel/runtime": "7.0.0-rc.2",
|
||||||
"@babel/preset-flow": "^7.0.0",
|
"babel-core": "^7.0.0-0",
|
||||||
"@babel/register": "^7.6.0",
|
"babel-eslint": "^8.2.6",
|
||||||
"@babel/runtime": "^7.6.0",
|
"babel-jest": "^23.4.0",
|
||||||
"babel-eslint": "^11.0.0-beta.0",
|
"babel-loader": "8.0.0-beta.4",
|
||||||
"babel-jest": "^24.9.0",
|
"babel-plugin-transform-charcodes": "^0.1.0",
|
||||||
"babel-loader": "^8.0.6",
|
"browserify": "^16.2.2",
|
||||||
"babel-plugin-transform-charcodes": "^0.2.0",
|
|
||||||
"browserify": "^16.2.3",
|
|
||||||
"bundle-collapser": "^1.2.1",
|
"bundle-collapser": "^1.2.1",
|
||||||
"chalk": "^2.4.2",
|
"chalk": "^2.3.2",
|
||||||
"charcodes": "^0.2.0",
|
"charcodes": "^0.1.0",
|
||||||
"derequire": "^2.0.2",
|
"derequire": "^2.0.2",
|
||||||
"duplicate-package-checker-webpack-plugin": "^2.1.0",
|
|
||||||
"enhanced-resolve": "^3.0.0",
|
"enhanced-resolve": "^3.0.0",
|
||||||
"eslint": "^6.0.1",
|
"eslint": "^5.3.0",
|
||||||
"eslint-config-babel": "^9.0.0",
|
"eslint-config-babel": "^7.0.2",
|
||||||
"eslint-plugin-flowtype": "^3.8.2",
|
"eslint-plugin-flowtype": "^2.50.0",
|
||||||
"eslint-plugin-import": "^2.17.2",
|
"eslint-plugin-prettier": "^2.6.2",
|
||||||
"eslint-plugin-prettier": "^3.1.0",
|
"flow-bin": "^0.79.0",
|
||||||
"fancy-log": "^1.3.3",
|
"graceful-fs": "^4.1.11",
|
||||||
"flow-bin": "^0.108.0",
|
"gulp": "^4.0.0",
|
||||||
"graceful-fs": "^4.1.15",
|
"gulp-babel": "^8.0.0-beta.2",
|
||||||
"gulp": "^4.0.2",
|
|
||||||
"gulp-babel": "^8.0.0",
|
|
||||||
"gulp-filter": "^5.1.0",
|
"gulp-filter": "^5.1.0",
|
||||||
"gulp-newer": "^1.0.0",
|
"gulp-newer": "^1.0.0",
|
||||||
"gulp-plumber": "^1.2.1",
|
"gulp-plumber": "^1.0.1",
|
||||||
"gulp-rename": "^1.4.0",
|
"gulp-rename": "^1.2.2",
|
||||||
"gulp-uglify": "^3.0.2",
|
"gulp-uglify": "^3.0.0",
|
||||||
"gulp-watch": "^5.0.1",
|
"gulp-util": "^3.0.7",
|
||||||
"husky": "^3.0.0",
|
"gulp-watch": "^5.0.0",
|
||||||
"jest": "^24.9.0",
|
"husky": "^0.14.3",
|
||||||
"lerna": "^3.16.0",
|
"jest": "^23.4.1",
|
||||||
|
"lerna": "^2.11.0",
|
||||||
"lerna-changelog": "^0.5.0",
|
"lerna-changelog": "^0.5.0",
|
||||||
"lint-staged": "^9.2.0",
|
"lint-staged": "^6.0.1",
|
||||||
"lodash": "^4.17.13",
|
"lodash": "^4.17.10",
|
||||||
|
"merge-stream": "^1.0.1",
|
||||||
"output-file-sync": "^2.0.0",
|
"output-file-sync": "^2.0.0",
|
||||||
"prettier": "^1.17.1",
|
"prettier": "^1.13.7",
|
||||||
"pump": "^3.0.0",
|
"pump": "^1.0.2",
|
||||||
"rimraf": "^2.6.3",
|
"rimraf": "^2.4.3",
|
||||||
"rollup": "^1.12.0",
|
"rollup-plugin-babel": "^4.0.0-beta.0",
|
||||||
"rollup-plugin-babel": "^4.0.0",
|
"rollup-plugin-node-resolve": "^3.0.2",
|
||||||
"rollup-plugin-node-resolve": "^5.0.0",
|
"rollup-stream": "^1.24.1",
|
||||||
"rollup-plugin-replace": "^2.2.0",
|
"test262-stream": "^1.2.0",
|
||||||
"test262-stream": "^1.3.0",
|
|
||||||
"through2": "^2.0.0",
|
"through2": "^2.0.0",
|
||||||
"typescript": "^3.6.3",
|
"uglify-js": "^2.4.16",
|
||||||
"warnings-to-errors-webpack-plugin": "^2.0.0",
|
"vinyl-buffer": "^1.0.1",
|
||||||
|
"vinyl-source-stream": "^2.0.0",
|
||||||
"webpack": "^3.4.1",
|
"webpack": "^3.4.1",
|
||||||
"webpack-dependency-suite": "^2.4.4",
|
"webpack-dependency-suite": "^2.4.4",
|
||||||
"webpack-stream": "^4.0.0"
|
"webpack-stream": "^4.0.0"
|
||||||
},
|
},
|
||||||
"resolutions": {
|
|
||||||
"@lerna/**/@lerna/collect-updates": "https://github.com/babel/lerna.git#babel-collect-updates"
|
|
||||||
},
|
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">= 6.9.0 < 14.0.0",
|
"node": ">= 6.9.0 <= 11.0.0-0",
|
||||||
"npm": ">= 3.x <= 6.x",
|
"npm": ">= 3.x <= 6.x",
|
||||||
"yarn": ">=0.27.5 || >=1.0.0-20170811"
|
"yarn": ">=0.27.5 || >=1.0.0-20170811"
|
||||||
},
|
},
|
||||||
"lint-staged": {
|
"lint-staged": {
|
||||||
"*.js": [
|
"*.js": [
|
||||||
"eslint --format=codeframe"
|
"eslint --format=codeframe --rulesdir='./scripts/eslint_rules'"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"husky": {
|
|
||||||
"hooks": {
|
|
||||||
"pre-commit": "lint-staged"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"jest": {
|
"jest": {
|
||||||
"collectCoverageFrom": [
|
"collectCoverageFrom": [
|
||||||
"packages/*/src/**/*.mjs",
|
"packages/*/src/**/*.mjs",
|
||||||
@ -111,12 +101,9 @@
|
|||||||
"_browser\\.js"
|
"_browser\\.js"
|
||||||
],
|
],
|
||||||
"testEnvironment": "node",
|
"testEnvironment": "node",
|
||||||
"setupFilesAfterEnv": [
|
"setupTestFrameworkScriptFile": "<rootDir>/test/testSetupFile.js",
|
||||||
"<rootDir>/test/testSetupFile.js"
|
|
||||||
],
|
|
||||||
"transformIgnorePatterns": [
|
"transformIgnorePatterns": [
|
||||||
"/node_modules/",
|
"/node_modules/",
|
||||||
"/packages/babel-standalone/babel.js",
|
|
||||||
"<rootDir>/packages/babel-standalone/babel(\\.min)?\\.js",
|
"<rootDir>/packages/babel-standalone/babel(\\.min)?\\.js",
|
||||||
"<rootDir>/packages/babel-preset-env-standalone/babel-preset-env(\\.min)?\\.js",
|
"<rootDir>/packages/babel-preset-env-standalone/babel-preset-env(\\.min)?\\.js",
|
||||||
"/test/(fixtures|tmp|__data__)/",
|
"/test/(fixtures|tmp|__data__)/",
|
||||||
@ -133,9 +120,6 @@
|
|||||||
"/test/tmp/",
|
"/test/tmp/",
|
||||||
"/test/__data__/",
|
"/test/__data__/",
|
||||||
"<rootDir>/build/"
|
"<rootDir>/build/"
|
||||||
],
|
]
|
||||||
"moduleNameMapper": {
|
|
||||||
"^@babel/([a-zA-Z0-9_-]+)$": "<rootDir>/packages/babel-$1/"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -13,10 +13,10 @@ A monorepo, muhahahahahaha. See the [monorepo design doc](/doc/design/monorepo.m
|
|||||||
|
|
||||||
| Package | Version | Dependencies |
|
| Package | Version | Dependencies |
|
||||||
|--------|-------|------------|
|
|--------|-------|------------|
|
||||||
| [`@babel/core`](/packages/babel-core) | [](https://www.npmjs.com/package/@babel/core) | [](https://david-dm.org/babel/babel?path=packages/babel-core) |
|
| [`@babel/core`](/packages/babel-core) | [](https://www.npmjs.com/package/@babel/core) | [](https://david-dm.org/babel/babel?path=packages/babel-core) |
|
||||||
| [`@babel/parser`](/packages/babel-parser) | [](https://www.npmjs.com/package/@babel/parser) | [](https://david-dm.org/babel/babel?path=packages/babel-parser) |
|
| [`@babel/parser`](/packages/babel-parser) | [](https://www.npmjs.com/package/@babel/parser) | [](https://david-dm.org/babel/babel?path=packages/babel-parser) |
|
||||||
| [`@babel/traverse`](/packages/babel-traverse) | [](https://www.npmjs.com/package/@babel/traverse) | [](https://david-dm.org/babel/babel?path=packages/babel-traverse) |
|
| [`@babel/traverse`](/packages/babel-traverse) | [](https://www.npmjs.com/package/@babel/traverse) | [](https://david-dm.org/babel/babel?path=packages/babel-traverse) |
|
||||||
| [`@babel/generator`](/packages/babel-generator) | [](https://www.npmjs.com/package/@babel/generator) | [](https://david-dm.org/babel/babel?path=packages/babel-generator) |
|
| [`@babel/generator`](/packages/babel-generator) | [](https://www.npmjs.com/package/@babel/generator) | [](https://david-dm.org/babel/babel?path=packages/babel-generator) |
|
||||||
|
|
||||||
[`@babel/core`](/packages/babel-core) is the Babel compiler itself; it exposes the `babel.transform` method, where `transformedCode = transform(src).code`.
|
[`@babel/core`](/packages/babel-core) is the Babel compiler itself; it exposes the `babel.transform` method, where `transformedCode = transform(src).code`.
|
||||||
|
|
||||||
@ -36,14 +36,14 @@ Check out the [`babel-handbook`](https://github.com/thejameskyle/babel-handbook/
|
|||||||
|
|
||||||
| Package | Version | Dependencies |
|
| Package | Version | Dependencies |
|
||||||
|--------|-------|------------|
|
|--------|-------|------------|
|
||||||
| [`@babel/cli`](/packages/babel-cli) | [](https://www.npmjs.com/package/@babel/cli) | [](https://david-dm.org/babel/babel?path=packages/babel-cli) |
|
| [`@babel/cli`](/packages/babel-cli) | [](https://www.npmjs.com/package/@babel/cli) | [](https://david-dm.org/babel/babel?path=packages/babel-cli) |
|
||||||
| [`@babel/types`](/packages/babel-types) | [](https://www.npmjs.com/package/@babel/types) | [](https://david-dm.org/babel/babel?path=packages/babel-types) |
|
| [`@babel/types`](/packages/babel-types) | [](https://www.npmjs.com/package/@babel/types) | [](https://david-dm.org/babel/babel?path=packages/babel-types) |
|
||||||
| [`@babel/polyfill`](/packages/babel-polyfill) | [](https://www.npmjs.com/package/@babel/polyfill) | [](https://david-dm.org/babel/babel?path=packages/babel-polyfill) |
|
| [`@babel/polyfill`](/packages/babel-polyfill) | [](https://www.npmjs.com/package/@babel/polyfill) | [](https://david-dm.org/babel/babel?path=packages/babel-polyfill) |
|
||||||
| [`@babel/runtime`](/packages/babel-runtime) | [](https://www.npmjs.com/package/@babel/runtime) | [](https://david-dm.org/babel/babel?path=packages/babel-runtime) |
|
| [`@babel/runtime`](/packages/babel-runtime) | [](https://www.npmjs.com/package/@babel/runtime) | [](https://david-dm.org/babel/babel?path=packages/babel-runtime) |
|
||||||
| [`@babel/register`](/packages/babel-register) | [](https://www.npmjs.com/package/@babel/register) | [](https://david-dm.org/babel/babel?path=packages/babel-register) |
|
| [`@babel/register`](/packages/babel-register) | [](https://www.npmjs.com/package/@babel/register) | [](https://david-dm.org/babel/babel?path=packages/babel-register) |
|
||||||
| [`@babel/template`](/packages/babel-template) | [](https://www.npmjs.com/package/@babel/template) | [](https://david-dm.org/babel/babel?path=packages/babel-template) |
|
| [`@babel/template`](/packages/babel-template) | [](https://www.npmjs.com/package/@babel/template) | [](https://david-dm.org/babel/babel?path=packages/babel-template) |
|
||||||
| [`@babel/helpers`](/packages/babel-helpers) | [](https://www.npmjs.com/package/@babel/helpers) | [](https://david-dm.org/babel/babel?path=packages/babel-helpers) |
|
| [`@babel/helpers`](/packages/babel-helpers) | [](https://www.npmjs.com/package/@babel/helpers) | [](https://david-dm.org/babel/babel?path=packages/babel-helpers) |
|
||||||
| [`@babel/code-frame`](/packages/babel-code-frame) | [](https://www.npmjs.com/package/@babel/code-frame) | [](https://david-dm.org/babel/babel?path=packages/babel-code-frame) |
|
| [`@babel/code-frame`](/packages/babel-code-frame) | [](https://www.npmjs.com/package/@babel/code-frame) | [](https://david-dm.org/babel/babel?path=packages/babel-code-frame) |
|
||||||
|
|
||||||
- [`@babel/cli`](/packages/babel-cli) is the CLI tool that runs `@babel/core` and helps with outputting to a directory, a file, stdout and more (also includes `@babel/node` cli). Check out the [docs](https://babeljs.io/docs/usage/cli/).
|
- [`@babel/cli`](/packages/babel-cli) is the CLI tool that runs `@babel/core` and helps with outputting to a directory, a file, stdout and more (also includes `@babel/node` cli). Check out the [docs](https://babeljs.io/docs/usage/cli/).
|
||||||
- [`@babel/types`](/packages/babel-types) is used to validate, build and change AST nodes.
|
- [`@babel/types`](/packages/babel-types) is used to validate, build and change AST nodes.
|
||||||
@ -62,7 +62,7 @@ The transformer[s] used in Babel are the independent pieces of code that transfo
|
|||||||
|
|
||||||
| Package | Version | Dependencies | Description |
|
| Package | Version | Dependencies | Description |
|
||||||
|--------|-------|------------|---|
|
|--------|-------|------------|---|
|
||||||
| [`@babel/preset-env`](/packages/babel-preset-env) | [](https://www.npmjs.com/package/@babel/preset-env) | [](https://david-dm.org/babel/babel?path=packages/babel-preset-env) | automatically determines plugins and polyfills you need based on your supported environments |
|
| [`@babel/preset-env`](/packages/babel-preset-env) | [](https://www.npmjs.com/package/@babel/preset-env) | [](https://david-dm.org/babel/babel?path=packages/babel-preset-env) | automatically determines plugins and polyfills you need based on your supported environments |
|
||||||
|
|
||||||
> You can find community maintained presets on [npm](https://www.npmjs.com/search?q=babel-preset)
|
> You can find community maintained presets on [npm](https://www.npmjs.com/search?q=babel-preset)
|
||||||
|
|
||||||
|
|||||||
@ -1,13 +1,10 @@
|
|||||||
{
|
{
|
||||||
"name": "@babel/cli",
|
"name": "@babel/cli",
|
||||||
"version": "7.7.0",
|
"version": "7.0.0",
|
||||||
"description": "Babel command line.",
|
"description": "Babel command line.",
|
||||||
"author": "Sebastian McKenzie <sebmck@gmail.com>",
|
"author": "Sebastian McKenzie <sebmck@gmail.com>",
|
||||||
"homepage": "https://babeljs.io/",
|
"homepage": "https://babeljs.io/",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"publishConfig": {
|
|
||||||
"access": "public"
|
|
||||||
},
|
|
||||||
"repository": "https://github.com/babel/babel/tree/master/packages/babel-cli",
|
"repository": "https://github.com/babel/babel/tree/master/packages/babel-cli",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"6to5",
|
"6to5",
|
||||||
@ -23,20 +20,21 @@
|
|||||||
"convert-source-map": "^1.1.0",
|
"convert-source-map": "^1.1.0",
|
||||||
"fs-readdir-recursive": "^1.1.0",
|
"fs-readdir-recursive": "^1.1.0",
|
||||||
"glob": "^7.0.0",
|
"glob": "^7.0.0",
|
||||||
"lodash": "^4.17.13",
|
"lodash": "^4.17.10",
|
||||||
"make-dir": "^2.1.0",
|
"mkdirp": "^0.5.1",
|
||||||
|
"output-file-sync": "^2.0.0",
|
||||||
"slash": "^2.0.0",
|
"slash": "^2.0.0",
|
||||||
"source-map": "^0.5.0"
|
"source-map": "^0.5.0"
|
||||||
},
|
},
|
||||||
"optionalDependencies": {
|
"optionalDependencies": {
|
||||||
"chokidar": "^2.1.8"
|
"chokidar": "^2.0.3"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"@babel/core": "^7.0.0-0 || csx"
|
"@babel/core": "^7.0.0-0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@babel/core": "^7.7.0",
|
"@babel/core": "^7.0.0",
|
||||||
"@babel/helper-fixtures": "^7.6.3"
|
"@babel/helper-fixtures": "^7.0.0"
|
||||||
},
|
},
|
||||||
"bin": {
|
"bin": {
|
||||||
"babel": "./bin/babel.js",
|
"babel": "./bin/babel.js",
|
||||||
|
|||||||
@ -1,12 +1,7 @@
|
|||||||
// @flow
|
|
||||||
|
|
||||||
import commander from "commander";
|
import commander from "commander";
|
||||||
import { buildExternalHelpers } from "@babel/core";
|
import { buildExternalHelpers } from "@babel/core";
|
||||||
|
|
||||||
function collect(
|
function collect(value, previousValue): Array<string> {
|
||||||
value: string | any,
|
|
||||||
previousValue: Array<string>,
|
|
||||||
): Array<string> {
|
|
||||||
// If the user passed the option with no value, like "babel-external-helpers --whitelist", do nothing.
|
// If the user passed the option with no value, like "babel-external-helpers --whitelist", do nothing.
|
||||||
if (typeof value !== "string") return previousValue;
|
if (typeof value !== "string") return previousValue;
|
||||||
|
|
||||||
|
|||||||
@ -1,26 +1,16 @@
|
|||||||
// @flow
|
|
||||||
|
|
||||||
import defaults from "lodash/defaults";
|
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 slash from "slash";
|
||||||
import path from "path";
|
import path from "path";
|
||||||
import fs from "fs";
|
import fs from "fs";
|
||||||
|
|
||||||
import * as util from "./util";
|
import * as util from "./util";
|
||||||
import { type CmdOptions } from "./options";
|
|
||||||
|
|
||||||
function outputFileSync(filePath: string, data: string | Buffer): void {
|
export default async function({ cliOptions, babelOptions }) {
|
||||||
makeDirSync(path.dirname(filePath));
|
|
||||||
fs.writeFileSync(filePath, data);
|
|
||||||
}
|
|
||||||
|
|
||||||
export default async function({
|
|
||||||
cliOptions,
|
|
||||||
babelOptions,
|
|
||||||
}: CmdOptions): Promise<void> {
|
|
||||||
const filenames = cliOptions.filenames;
|
const filenames = cliOptions.filenames;
|
||||||
|
|
||||||
async function write(src: string, base: string): Promise<boolean> {
|
async function write(src, base) {
|
||||||
let relative = path.relative(base, src);
|
let relative = path.relative(base, src);
|
||||||
|
|
||||||
if (!util.isCompilableExtension(relative, cliOptions.extensions)) {
|
if (!util.isCompilableExtension(relative, cliOptions.extensions)) {
|
||||||
@ -75,14 +65,14 @@ export default async function({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function getDest(filename: string, base: string): string {
|
function getDest(filename, base) {
|
||||||
if (cliOptions.relative) {
|
if (cliOptions.relative) {
|
||||||
return path.join(base, cliOptions.outDir, filename);
|
return path.join(base, cliOptions.outDir, filename);
|
||||||
}
|
}
|
||||||
return path.join(cliOptions.outDir, filename);
|
return path.join(cliOptions.outDir, filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
async function handleFile(src: string, base: string): Promise<boolean> {
|
async function handleFile(src, base) {
|
||||||
const written = await write(src, base);
|
const written = await write(src, base);
|
||||||
|
|
||||||
if (!written && cliOptions.copyFiles) {
|
if (!written && cliOptions.copyFiles) {
|
||||||
@ -94,7 +84,7 @@ export default async function({
|
|||||||
return written;
|
return written;
|
||||||
}
|
}
|
||||||
|
|
||||||
async function handle(filenameOrDir: string): Promise<number> {
|
async function handle(filenameOrDir) {
|
||||||
if (!fs.existsSync(filenameOrDir)) return 0;
|
if (!fs.existsSync(filenameOrDir)) return 0;
|
||||||
|
|
||||||
const stat = fs.statSync(filenameOrDir);
|
const stat = fs.statSync(filenameOrDir);
|
||||||
@ -126,20 +116,18 @@ export default async function({
|
|||||||
util.deleteDir(cliOptions.outDir);
|
util.deleteDir(cliOptions.outDir);
|
||||||
}
|
}
|
||||||
|
|
||||||
makeDirSync(cliOptions.outDir);
|
mkdirpSync(cliOptions.outDir);
|
||||||
|
|
||||||
let compiledFiles = 0;
|
let compiledFiles = 0;
|
||||||
for (const filename of cliOptions.filenames) {
|
for (const filename of cliOptions.filenames) {
|
||||||
compiledFiles += await handle(filename);
|
compiledFiles += await handle(filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!cliOptions.quiet) {
|
console.log(
|
||||||
console.log(
|
`Successfully compiled ${compiledFiles} ${
|
||||||
`Successfully compiled ${compiledFiles} ${
|
compiledFiles !== 1 ? "files" : "file"
|
||||||
compiledFiles !== 1 ? "files" : "file"
|
} with Babel.`,
|
||||||
} with Babel.`,
|
);
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cliOptions.watch) {
|
if (cliOptions.watch) {
|
||||||
|
|||||||
@ -1,26 +1,14 @@
|
|||||||
// @flow
|
|
||||||
|
|
||||||
import convertSourceMap from "convert-source-map";
|
import convertSourceMap from "convert-source-map";
|
||||||
import defaults from "lodash/defaults";
|
import defaults from "lodash/defaults";
|
||||||
import sourceMap from "source-map";
|
import sourceMap from "source-map";
|
||||||
import slash from "slash";
|
import slash from "slash";
|
||||||
import { sync as makeDirSync } from "make-dir";
|
|
||||||
import path from "path";
|
import path from "path";
|
||||||
import fs from "fs";
|
import fs from "fs";
|
||||||
|
|
||||||
import * as util from "./util";
|
import * as util from "./util";
|
||||||
import { type CmdOptions } from "./options";
|
|
||||||
|
|
||||||
type CompilationOutput = {
|
export default async function({ cliOptions, babelOptions }) {
|
||||||
code: string,
|
function buildResult(fileResults) {
|
||||||
map: Object,
|
|
||||||
};
|
|
||||||
|
|
||||||
export default async function({
|
|
||||||
cliOptions,
|
|
||||||
babelOptions,
|
|
||||||
}: CmdOptions): Promise<void> {
|
|
||||||
function buildResult(fileResults: Array<Object>): CompilationOutput {
|
|
||||||
const map = new sourceMap.SourceMapGenerator({
|
const map = new sourceMap.SourceMapGenerator({
|
||||||
file:
|
file:
|
||||||
cliOptions.sourceMapTarget ||
|
cliOptions.sourceMapTarget ||
|
||||||
@ -86,12 +74,10 @@ export default async function({
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function output(fileResults: Array<string>): void {
|
function output(fileResults) {
|
||||||
const result = buildResult(fileResults);
|
const result = buildResult(fileResults);
|
||||||
|
|
||||||
if (cliOptions.outFile) {
|
if (cliOptions.outFile) {
|
||||||
makeDirSync(path.dirname(cliOptions.outFile));
|
|
||||||
|
|
||||||
// we've requested for a sourcemap to be written to disk
|
// we've requested for a sourcemap to be written to disk
|
||||||
if (babelOptions.sourceMaps && babelOptions.sourceMaps !== "inline") {
|
if (babelOptions.sourceMaps && babelOptions.sourceMaps !== "inline") {
|
||||||
const mapLoc = cliOptions.outFile + ".map";
|
const mapLoc = cliOptions.outFile + ".map";
|
||||||
@ -105,15 +91,14 @@ export default async function({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function readStdin(): Promise<string> {
|
function readStdin() {
|
||||||
return new Promise((resolve: Function, reject: Function): void => {
|
return new Promise((resolve, reject) => {
|
||||||
let code = "";
|
let code = "";
|
||||||
|
|
||||||
process.stdin.setEncoding("utf8");
|
process.stdin.setEncoding("utf8");
|
||||||
|
|
||||||
process.stdin.on("readable", function() {
|
process.stdin.on("readable", function() {
|
||||||
const chunk = process.stdin.read();
|
const chunk = process.stdin.read();
|
||||||
// $FlowIgnore
|
|
||||||
if (chunk !== null) code += chunk;
|
if (chunk !== null) code += chunk;
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -124,7 +109,7 @@ export default async function({
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async function stdin(): Promise<void> {
|
async function stdin() {
|
||||||
const code = await readStdin();
|
const code = await readStdin();
|
||||||
|
|
||||||
const res = await util.transform(
|
const res = await util.transform(
|
||||||
@ -141,7 +126,7 @@ export default async function({
|
|||||||
output([res]);
|
output([res]);
|
||||||
}
|
}
|
||||||
|
|
||||||
async function walk(filenames: Array<string>): Promise<void> {
|
async function walk(filenames) {
|
||||||
const _filenames = [];
|
const _filenames = [];
|
||||||
|
|
||||||
filenames.forEach(function(filename) {
|
filenames.forEach(function(filename) {
|
||||||
@ -152,11 +137,7 @@ export default async function({
|
|||||||
const dirname = filename;
|
const dirname = filename;
|
||||||
|
|
||||||
util
|
util
|
||||||
.readdirForCompilable(
|
.readdirForCompilable(filename, cliOptions.includeDotfiles)
|
||||||
filename,
|
|
||||||
cliOptions.includeDotfiles,
|
|
||||||
cliOptions.extensions,
|
|
||||||
)
|
|
||||||
.forEach(function(filename) {
|
.forEach(function(filename) {
|
||||||
_filenames.push(path.join(dirname, filename));
|
_filenames.push(path.join(dirname, filename));
|
||||||
});
|
});
|
||||||
@ -166,7 +147,7 @@ export default async function({
|
|||||||
});
|
});
|
||||||
|
|
||||||
const results = await Promise.all(
|
const results = await Promise.all(
|
||||||
_filenames.map(async function(filename: string): Promise<Object> {
|
_filenames.map(async function(filename) {
|
||||||
let sourceFilename = filename;
|
let sourceFilename = filename;
|
||||||
if (cliOptions.outFile) {
|
if (cliOptions.outFile) {
|
||||||
sourceFilename = path.relative(
|
sourceFilename = path.relative(
|
||||||
@ -183,7 +164,7 @@ export default async function({
|
|||||||
{
|
{
|
||||||
sourceFileName: sourceFilename,
|
sourceFileName: sourceFilename,
|
||||||
// Since we're compiling everything to be merged together,
|
// Since we're compiling everything to be merged together,
|
||||||
// "inline" applies to the final output file, but not to the individual
|
// "inline" applies to the final output file, but to the individual
|
||||||
// files being concatenated.
|
// files being concatenated.
|
||||||
sourceMaps:
|
sourceMaps:
|
||||||
babelOptions.sourceMaps === "inline"
|
babelOptions.sourceMaps === "inline"
|
||||||
@ -207,7 +188,7 @@ export default async function({
|
|||||||
output(results);
|
output(results);
|
||||||
}
|
}
|
||||||
|
|
||||||
async function files(filenames: Array<string>): Promise<void> {
|
async function files(filenames) {
|
||||||
if (!cliOptions.skipInitialBuild) {
|
if (!cliOptions.skipInitialBuild) {
|
||||||
await walk(filenames);
|
await walk(filenames);
|
||||||
}
|
}
|
||||||
@ -223,7 +204,7 @@ export default async function({
|
|||||||
pollInterval: 10,
|
pollInterval: 10,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
.on("all", function(type: string, filename: string) {
|
.on("all", function(type, filename) {
|
||||||
if (!util.isCompilableExtension(filename, cliOptions.extensions)) {
|
if (!util.isCompilableExtension(filename, cliOptions.extensions)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -6,12 +6,8 @@ import fileCommand from "./file";
|
|||||||
|
|
||||||
const opts = parseArgv(process.argv);
|
const opts = parseArgv(process.argv);
|
||||||
|
|
||||||
if (opts) {
|
const fn = opts.cliOptions.outDir ? dirCommand : fileCommand;
|
||||||
const fn = opts.cliOptions.outDir ? dirCommand : fileCommand;
|
fn(opts).catch(err => {
|
||||||
fn(opts).catch(err => {
|
console.error(err);
|
||||||
console.error(err);
|
process.exit(1);
|
||||||
process.exitCode = 1;
|
});
|
||||||
});
|
|
||||||
} else {
|
|
||||||
process.exitCode = 2;
|
|
||||||
}
|
|
||||||
|
|||||||
@ -1,5 +1,3 @@
|
|||||||
// @flow
|
|
||||||
|
|
||||||
import fs from "fs";
|
import fs from "fs";
|
||||||
|
|
||||||
import commander from "commander";
|
import commander from "commander";
|
||||||
@ -12,129 +10,120 @@ import pkg from "../../package.json";
|
|||||||
// Standard Babel input configs.
|
// Standard Babel input configs.
|
||||||
commander.option(
|
commander.option(
|
||||||
"-f, --filename [filename]",
|
"-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(
|
commander.option(
|
||||||
"--presets [list]",
|
"--presets [list]",
|
||||||
"A comma-separated list of preset names.",
|
"comma-separated list of preset names",
|
||||||
collect,
|
collect,
|
||||||
);
|
);
|
||||||
commander.option(
|
commander.option(
|
||||||
"--plugins [list]",
|
"--plugins [list]",
|
||||||
"A comma-separated list of plugin names.",
|
"comma-separated list of plugin names",
|
||||||
collect,
|
collect,
|
||||||
);
|
);
|
||||||
commander.option("--config-file [path]", "Path to a .babelrc file to use.");
|
commander.option("--config-file [path]", "Path a to .babelrc file to use");
|
||||||
commander.option(
|
commander.option(
|
||||||
"--env-name [name]",
|
"--env-name [name]",
|
||||||
"The name of the 'env' to use when loading configs and plugins. " +
|
"The name of the 'env' to use when loading configs and plugins. " +
|
||||||
"Defaults to the value of BABEL_ENV, or else NODE_ENV, or else 'development'.",
|
"Defaults to the value of BABEL_ENV, or else NODE_ENV, or else 'development'.",
|
||||||
);
|
);
|
||||||
commander.option(
|
|
||||||
"--root-mode [mode]",
|
|
||||||
"The project-root resolution mode. " +
|
|
||||||
"One of 'root' (the default), 'upward', or 'upward-optional'.",
|
|
||||||
);
|
|
||||||
|
|
||||||
// Basic file input configuration.
|
// Basic file input configuration.
|
||||||
commander.option("--source-type [script|module]", "");
|
commander.option("--source-type [script|module]", "");
|
||||||
commander.option(
|
commander.option(
|
||||||
"--no-babelrc",
|
"--no-babelrc",
|
||||||
"Whether or not to look up .babelrc and .babelignore files.",
|
"Whether or not to look up .babelrc and .babelignore files",
|
||||||
);
|
);
|
||||||
commander.option(
|
commander.option(
|
||||||
"--ignore [list]",
|
"--ignore [list]",
|
||||||
"List of glob paths to **not** compile.",
|
"list of glob paths to **not** compile",
|
||||||
collect,
|
collect,
|
||||||
);
|
);
|
||||||
commander.option(
|
commander.option(
|
||||||
"--only [list]",
|
"--only [list]",
|
||||||
"List of glob paths to **only** compile.",
|
"list of glob paths to **only** compile",
|
||||||
collect,
|
collect,
|
||||||
);
|
);
|
||||||
|
|
||||||
// Misc babel config.
|
// Misc babel config.
|
||||||
commander.option(
|
commander.option(
|
||||||
"--no-highlight-code",
|
"--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.
|
// General output formatting.
|
||||||
commander.option(
|
commander.option(
|
||||||
"--no-comments",
|
"--no-comments",
|
||||||
"Write comments to generated output. (true by default)",
|
"write comments to generated output (true by default)",
|
||||||
);
|
);
|
||||||
commander.option(
|
commander.option(
|
||||||
"--retain-lines",
|
"--retain-lines",
|
||||||
"Retain line numbers. This will result in really ugly code.",
|
"retain line numbers - will result in really ugly code",
|
||||||
);
|
);
|
||||||
commander.option(
|
commander.option(
|
||||||
"--compact [true|false|auto]",
|
"--compact [true|false|auto]",
|
||||||
"Do not include superfluous whitespace characters and line terminators.",
|
"do not include superfluous whitespace characters and line terminators",
|
||||||
booleanify,
|
booleanify,
|
||||||
);
|
);
|
||||||
commander.option(
|
commander.option("--minified", "save as much bytes when printing [true|false]");
|
||||||
"--minified [true|false]",
|
|
||||||
"Save as many bytes when printing.",
|
|
||||||
);
|
|
||||||
commander.option(
|
commander.option(
|
||||||
"--auxiliary-comment-before [string]",
|
"--auxiliary-comment-before [string]",
|
||||||
"Print a comment before any injected non-user code.",
|
"print a comment before any injected non-user code",
|
||||||
);
|
);
|
||||||
commander.option(
|
commander.option(
|
||||||
"--auxiliary-comment-after [string]",
|
"--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.
|
// General soucemap formatting.
|
||||||
commander.option("-s, --source-maps [true|false|inline|both]", "", booleanify);
|
commander.option("-s, --source-maps [true|false|inline|both]", "", booleanify);
|
||||||
commander.option(
|
commander.option(
|
||||||
"--source-map-target [string]",
|
"--source-map-target [string]",
|
||||||
"Set `file` on returned source map.",
|
"set `file` on returned source map",
|
||||||
);
|
);
|
||||||
commander.option(
|
commander.option(
|
||||||
"--source-file-name [string]",
|
"--source-file-name [string]",
|
||||||
"Set `sources[0]` on returned source map.",
|
"set `sources[0]` on returned source map",
|
||||||
);
|
);
|
||||||
commander.option(
|
commander.option(
|
||||||
"--source-root [filename]",
|
"--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.
|
// Config params for certain module output formats.
|
||||||
commander.option(
|
commander.option(
|
||||||
"--module-root [filename]",
|
"--module-root [filename]",
|
||||||
// eslint-disable-next-line max-len
|
"optional prefix for the AMD module formatter that will be prepend to the filename on module definitions",
|
||||||
"Optional prefix for the AMD module formatter that will be prepended to the filename on module definitions.",
|
|
||||||
);
|
);
|
||||||
commander.option("-M, --module-ids", "Insert an explicit id for modules.");
|
commander.option("-M, --module-ids", "insert an explicit id for modules");
|
||||||
commander.option(
|
commander.option(
|
||||||
"--module-id [string]",
|
"--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.
|
// "babel" command specific arguments that are not passed to @babel/core.
|
||||||
commander.option(
|
commander.option(
|
||||||
"-x, --extensions [extensions]",
|
"-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,
|
collect,
|
||||||
);
|
);
|
||||||
commander.option(
|
commander.option(
|
||||||
"--keep-file-extension",
|
"--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(
|
commander.option(
|
||||||
"--skip-initial-build",
|
"--skip-initial-build",
|
||||||
"Do not compile files before watching.",
|
"Do not compile files before watching",
|
||||||
);
|
);
|
||||||
commander.option(
|
commander.option(
|
||||||
"-o, --out-file [out]",
|
"-o, --out-file [out]",
|
||||||
"Compile all input files into a single file.",
|
"Compile all input files into a single file",
|
||||||
);
|
);
|
||||||
commander.option(
|
commander.option(
|
||||||
"-d, --out-dir [out]",
|
"-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(
|
commander.option(
|
||||||
"--relative",
|
"--relative",
|
||||||
@ -142,34 +131,22 @@ commander.option(
|
|||||||
);
|
);
|
||||||
commander.option(
|
commander.option(
|
||||||
"-D, --copy-files",
|
"-D, --copy-files",
|
||||||
"When compiling a directory copy over non-compilable files.",
|
"When compiling a directory copy over non-compilable files",
|
||||||
);
|
);
|
||||||
commander.option(
|
commander.option(
|
||||||
"--include-dotfiles",
|
"--include-dotfiles",
|
||||||
"Include dotfiles when compiling and copying non-compilable files.",
|
"Include dotfiles when compiling and copying non-compilable files",
|
||||||
);
|
|
||||||
commander.option(
|
|
||||||
"--verbose",
|
|
||||||
"Log everything. This option conflicts with --quiet",
|
|
||||||
);
|
|
||||||
commander.option(
|
|
||||||
"--quiet",
|
|
||||||
"Don't log anything. This option conflicts with --verbose",
|
|
||||||
);
|
);
|
||||||
|
commander.option("--verbose", "Log everything");
|
||||||
commander.option(
|
commander.option(
|
||||||
"--delete-dir-on-start",
|
"--delete-dir-on-start",
|
||||||
"Delete the out directory before compilation.",
|
"Delete the out directory before compilation",
|
||||||
);
|
);
|
||||||
|
|
||||||
commander.version(pkg.version + " (@babel/core " + version + ")");
|
commander.version(pkg.version + " (@babel/core " + version + ")");
|
||||||
commander.usage("[options] <files ...>");
|
commander.usage("[options] <files ...>");
|
||||||
|
|
||||||
export type CmdOptions = {
|
export default function parseArgv(args: Array<string>) {
|
||||||
babelOptions: Object,
|
|
||||||
cliOptions: Object,
|
|
||||||
};
|
|
||||||
|
|
||||||
export default function parseArgv(args: Array<string>): CmdOptions | null {
|
|
||||||
//
|
//
|
||||||
commander.parse(args);
|
commander.parse(args);
|
||||||
|
|
||||||
@ -185,20 +162,20 @@ export default function parseArgv(args: Array<string>): CmdOptions | null {
|
|||||||
|
|
||||||
filenames.forEach(function(filename) {
|
filenames.forEach(function(filename) {
|
||||||
if (!fs.existsSync(filename)) {
|
if (!fs.existsSync(filename)) {
|
||||||
errors.push(filename + " does not exist");
|
errors.push(filename + " doesn't exist");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if (commander.outDir && !filenames.length) {
|
if (commander.outDir && !filenames.length) {
|
||||||
errors.push("--out-dir requires filenames");
|
errors.push("filenames required for --out-dir");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (commander.outFile && commander.outDir) {
|
if (commander.outFile && commander.outDir) {
|
||||||
errors.push("--out-file and --out-dir cannot be used together");
|
errors.push("cannot have --out-file and --out-dir");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (commander.relative && !commander.outDir) {
|
if (commander.relative && !commander.outDir) {
|
||||||
errors.push("--relative requires --out-dir usage");
|
errors.push("output directory required for --relative");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (commander.watch) {
|
if (commander.watch) {
|
||||||
@ -218,10 +195,6 @@ export default function parseArgv(args: Array<string>): CmdOptions | null {
|
|||||||
errors.push("--delete-dir-on-start requires --out-dir");
|
errors.push("--delete-dir-on-start requires --out-dir");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (commander.verbose && commander.quiet) {
|
|
||||||
errors.push("--verbose and --quiet cannot be used together");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (
|
if (
|
||||||
!commander.outDir &&
|
!commander.outDir &&
|
||||||
filenames.length === 0 &&
|
filenames.length === 0 &&
|
||||||
@ -234,56 +207,41 @@ export default function parseArgv(args: Array<string>): CmdOptions | null {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (errors.length) {
|
if (errors.length) {
|
||||||
console.error("babel:");
|
console.error(errors.join(". "));
|
||||||
errors.forEach(function(e) {
|
process.exit(2);
|
||||||
console.error(" " + e);
|
|
||||||
});
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const opts = commander.opts();
|
const opts = commander.opts();
|
||||||
|
|
||||||
const babelOptions = {
|
|
||||||
presets: opts.presets,
|
|
||||||
plugins: opts.plugins,
|
|
||||||
rootMode: opts.rootMode,
|
|
||||||
configFile: opts.configFile,
|
|
||||||
envName: opts.envName,
|
|
||||||
sourceType: opts.sourceType,
|
|
||||||
ignore: opts.ignore,
|
|
||||||
only: opts.only,
|
|
||||||
retainLines: opts.retainLines,
|
|
||||||
compact: opts.compact,
|
|
||||||
minified: opts.minified,
|
|
||||||
auxiliaryCommentBefore: opts.auxiliaryCommentBefore,
|
|
||||||
auxiliaryCommentAfter: opts.auxiliaryCommentAfter,
|
|
||||||
sourceMaps: opts.sourceMaps,
|
|
||||||
sourceFileName: opts.sourceFileName,
|
|
||||||
sourceRoot: opts.sourceRoot,
|
|
||||||
moduleRoot: opts.moduleRoot,
|
|
||||||
moduleIds: opts.moduleIds,
|
|
||||||
moduleId: opts.moduleId,
|
|
||||||
|
|
||||||
// Commander will default the "--no-" arguments to true, but we want to
|
|
||||||
// leave them undefined so that @babel/core can handle the
|
|
||||||
// default-assignment logic on its own.
|
|
||||||
babelrc: opts.babelrc === true ? undefined : opts.babelrc,
|
|
||||||
highlightCode: opts.highlightCode === true ? undefined : opts.highlightCode,
|
|
||||||
comments: opts.comments === true ? undefined : opts.comments,
|
|
||||||
};
|
|
||||||
|
|
||||||
// If the @babel/cli version is newer than the @babel/core version, and we have added
|
|
||||||
// new options for @babel/core, we'll potentially get option validation errors from
|
|
||||||
// @babel/core. To avoid that, we delete undefined options, so @babel/core will only
|
|
||||||
// give the error if users actually pass an unsupported CLI option.
|
|
||||||
for (const key of Object.keys(babelOptions)) {
|
|
||||||
if (babelOptions[key] === undefined) {
|
|
||||||
delete babelOptions[key];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
babelOptions,
|
babelOptions: {
|
||||||
|
presets: opts.presets,
|
||||||
|
plugins: opts.plugins,
|
||||||
|
configFile: opts.configFile,
|
||||||
|
envName: opts.envName,
|
||||||
|
sourceType: opts.sourceType,
|
||||||
|
ignore: opts.ignore,
|
||||||
|
only: opts.only,
|
||||||
|
retainLines: opts.retainLines,
|
||||||
|
compact: opts.compact,
|
||||||
|
minified: opts.minified,
|
||||||
|
auxiliaryCommentBefore: opts.auxiliaryCommentBefore,
|
||||||
|
auxiliaryCommentAfter: opts.auxiliaryCommentAfter,
|
||||||
|
sourceMaps: opts.sourceMaps,
|
||||||
|
sourceFileName: opts.sourceFileName,
|
||||||
|
sourceRoot: opts.sourceRoot,
|
||||||
|
moduleRoot: opts.moduleRoot,
|
||||||
|
moduleIds: opts.moduleIds,
|
||||||
|
moduleId: opts.moduleId,
|
||||||
|
|
||||||
|
// Commander will default the "--no-" arguments to true, but we want to
|
||||||
|
// leave them undefined so that @babel/core can handle the
|
||||||
|
// default-assignment logic on its own.
|
||||||
|
babelrc: opts.babelrc === true ? undefined : opts.babelrc,
|
||||||
|
highlightCode:
|
||||||
|
opts.highlightCode === true ? undefined : opts.highlightCode,
|
||||||
|
comments: opts.comments === true ? undefined : opts.comments,
|
||||||
|
},
|
||||||
cliOptions: {
|
cliOptions: {
|
||||||
filename: opts.filename,
|
filename: opts.filename,
|
||||||
filenames,
|
filenames,
|
||||||
@ -297,7 +255,6 @@ export default function parseArgv(args: Array<string>): CmdOptions | null {
|
|||||||
copyFiles: opts.copyFiles,
|
copyFiles: opts.copyFiles,
|
||||||
includeDotfiles: opts.includeDotfiles,
|
includeDotfiles: opts.includeDotfiles,
|
||||||
verbose: opts.verbose,
|
verbose: opts.verbose,
|
||||||
quiet: opts.quiet,
|
|
||||||
deleteDirOnStart: opts.deleteDirOnStart,
|
deleteDirOnStart: opts.deleteDirOnStart,
|
||||||
sourceMapTarget: opts.sourceMapTarget,
|
sourceMapTarget: opts.sourceMapTarget,
|
||||||
},
|
},
|
||||||
|
|||||||
@ -1,12 +1,10 @@
|
|||||||
// @flow
|
|
||||||
|
|
||||||
import readdirRecursive from "fs-readdir-recursive";
|
import readdirRecursive from "fs-readdir-recursive";
|
||||||
import * as babel from "@babel/core";
|
import * as babel from "@babel/core";
|
||||||
import includes from "lodash/includes";
|
import includes from "lodash/includes";
|
||||||
import path from "path";
|
import path from "path";
|
||||||
import fs from "fs";
|
import fs from "fs";
|
||||||
|
|
||||||
export function chmod(src: string, dest: string): void {
|
export function chmod(src, dest) {
|
||||||
fs.chmodSync(dest, fs.statSync(src).mode);
|
fs.chmodSync(dest, fs.statSync(src).mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -15,8 +13,8 @@ type ReaddirFilter = (filename: string) => boolean;
|
|||||||
export function readdir(
|
export function readdir(
|
||||||
dirname: string,
|
dirname: string,
|
||||||
includeDotfiles: boolean,
|
includeDotfiles: boolean,
|
||||||
filter?: ReaddirFilter,
|
filter: ReaddirFilter,
|
||||||
): Array<string> {
|
) {
|
||||||
return readdirRecursive(dirname, (filename, _index, currentDirectory) => {
|
return readdirRecursive(dirname, (filename, _index, currentDirectory) => {
|
||||||
const stat = fs.statSync(path.join(currentDirectory, filename));
|
const stat = fs.statSync(path.join(currentDirectory, filename));
|
||||||
|
|
||||||
@ -31,11 +29,8 @@ export function readdir(
|
|||||||
export function readdirForCompilable(
|
export function readdirForCompilable(
|
||||||
dirname: string,
|
dirname: string,
|
||||||
includeDotfiles: boolean,
|
includeDotfiles: boolean,
|
||||||
altExts?: Array<string>,
|
) {
|
||||||
): Array<string> {
|
return readdir(dirname, includeDotfiles, isCompilableExtension);
|
||||||
return readdir(dirname, includeDotfiles, function(filename) {
|
|
||||||
return isCompilableExtension(filename, altExts);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -50,7 +45,7 @@ export function isCompilableExtension(
|
|||||||
return includes(exts, ext);
|
return includes(exts, ext);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function addSourceMappingUrl(code: string, loc: string): string {
|
export function addSourceMappingUrl(code, loc) {
|
||||||
return code + "\n//# sourceMappingURL=" + path.basename(loc);
|
return code + "\n//# sourceMappingURL=" + path.basename(loc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -58,11 +53,7 @@ const CALLER = {
|
|||||||
name: "@babel/cli",
|
name: "@babel/cli",
|
||||||
};
|
};
|
||||||
|
|
||||||
export function transform(
|
export function transform(filename, code, opts) {
|
||||||
filename: string,
|
|
||||||
code: string,
|
|
||||||
opts: Object,
|
|
||||||
): Promise<Object> {
|
|
||||||
opts = {
|
opts = {
|
||||||
...opts,
|
...opts,
|
||||||
caller: CALLER,
|
caller: CALLER,
|
||||||
@ -77,10 +68,7 @@ export function transform(
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export function compile(
|
export function compile(filename, opts) {
|
||||||
filename: string,
|
|
||||||
opts: Object | Function,
|
|
||||||
): Promise<Object> {
|
|
||||||
opts = {
|
opts = {
|
||||||
...opts,
|
...opts,
|
||||||
caller: CALLER,
|
caller: CALLER,
|
||||||
@ -94,7 +82,7 @@ export function compile(
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export function deleteDir(path: string): void {
|
export function deleteDir(path) {
|
||||||
if (fs.existsSync(path)) {
|
if (fs.existsSync(path)) {
|
||||||
fs.readdirSync(path).forEach(function(file) {
|
fs.readdirSync(path).forEach(function(file) {
|
||||||
const curPath = path + "/" + file;
|
const curPath = path + "/" + file;
|
||||||
@ -112,10 +100,10 @@ export function deleteDir(path: string): void {
|
|||||||
|
|
||||||
process.on("uncaughtException", function(err) {
|
process.on("uncaughtException", function(err) {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
process.exitCode = 1;
|
process.exit(1);
|
||||||
});
|
});
|
||||||
|
|
||||||
export function requireChokidar(): Object {
|
export function requireChokidar() {
|
||||||
try {
|
try {
|
||||||
return require("chokidar");
|
return require("chokidar");
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
@ -127,10 +115,7 @@ export function requireChokidar(): Object {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function adjustRelative(
|
export function adjustRelative(relative, keepFileExtension) {
|
||||||
relative: string,
|
|
||||||
keepFileExtension: boolean,
|
|
||||||
): string {
|
|
||||||
if (keepFileExtension) {
|
if (keepFileExtension) {
|
||||||
return relative;
|
return relative;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,12 +1,10 @@
|
|||||||
{
|
{
|
||||||
"args": [
|
"args": [
|
||||||
"src",
|
"src",
|
||||||
"--out-dir",
|
"--out-dir", "lib",
|
||||||
"lib",
|
|
||||||
"--copy-files",
|
"--copy-files",
|
||||||
"--include-dotfiles",
|
"--include-dotfiles",
|
||||||
"--ignore",
|
"--ignore", "src/foo",
|
||||||
"src/foo",
|
|
||||||
"--verbose"
|
"--verbose"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,12 +1,10 @@
|
|||||||
{
|
{
|
||||||
"args": [
|
"args": [
|
||||||
"src",
|
"src",
|
||||||
"--out-dir",
|
"--out-dir", "lib",
|
||||||
"lib",
|
|
||||||
"--copy-files",
|
"--copy-files",
|
||||||
"--include-dotfiles",
|
"--include-dotfiles",
|
||||||
"--only",
|
"--only", "src/foo",
|
||||||
"src/foo",
|
|
||||||
"--verbose"
|
"--verbose"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,10 +1,3 @@
|
|||||||
{
|
{
|
||||||
"args": [
|
"args": ["src", "--out-dir", "lib", "--copy-files", "--include-dotfiles", "--verbose"]
|
||||||
"src",
|
|
||||||
"--out-dir",
|
|
||||||
"lib",
|
|
||||||
"--copy-files",
|
|
||||||
"--include-dotfiles",
|
|
||||||
"--verbose"
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,11 +1,9 @@
|
|||||||
{
|
{
|
||||||
"args": [
|
"args": [
|
||||||
"src",
|
"src",
|
||||||
"--out-dir",
|
"--out-dir", "lib",
|
||||||
"lib",
|
|
||||||
"--copy-files",
|
"--copy-files",
|
||||||
"--ignore",
|
"--ignore", "src/foo/*",
|
||||||
"src/foo/*",
|
|
||||||
"--verbose"
|
"--verbose"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,11 +1,9 @@
|
|||||||
{
|
{
|
||||||
"args": [
|
"args": [
|
||||||
"src",
|
"src",
|
||||||
"--out-dir",
|
"--out-dir", "lib",
|
||||||
"lib",
|
|
||||||
"--copy-files",
|
"--copy-files",
|
||||||
"--only",
|
"--only", "src/foo/*",
|
||||||
"src/foo/*",
|
|
||||||
"--verbose"
|
"--verbose"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
3
packages/babel-cli/test/fixtures/babel/.stdin --out-file --source-maps/options.json
vendored
Normal file
3
packages/babel-cli/test/fixtures/babel/.stdin --out-file --source-maps/options.json
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"args": ["--source-maps", "--out-file", "test.js"]
|
||||||
|
}
|
||||||
1
packages/babel-cli/test/fixtures/babel/.stdin --out-file --source-maps/out-files/test.js.map
vendored
Normal file
1
packages/babel-cli/test/fixtures/babel/.stdin --out-file --source-maps/out-files/test.js.map
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
{"version":3,"sources":["stdin"],"names":[],"mappings":";;AAAA,GAAG,CAAC,GAAG,CAAC,UAAA,CAAC;SAAI,CAAC,GAAG,CAAC;CAAA,CAAC,CAAC","file":"test.js","sourcesContent":["arr.map(x => x * x);"]}
|
||||||
3
packages/babel-cli/test/fixtures/babel/.stdin --source-maps inline/options.json
vendored
Normal file
3
packages/babel-cli/test/fixtures/babel/.stdin --source-maps inline/options.json
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"args": ["--source-maps", "inline"]
|
||||||
|
}
|
||||||
7
packages/babel-cli/test/fixtures/babel/.stdin --source-maps inline/stdout.txt
vendored
Normal file
7
packages/babel-cli/test/fixtures/babel/.stdin --source-maps inline/stdout.txt
vendored
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
"use strict";
|
||||||
|
|
||||||
|
arr.map(function (x) {
|
||||||
|
return x * x;
|
||||||
|
});
|
||||||
|
|
||||||
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInN0ZGluIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUEsR0FBRyxDQUFDLEdBQUcsQ0FBQyxVQUFBLENBQUM7U0FBSSxDQUFDLEdBQUcsQ0FBQztDQUFBLENBQUMsQ0FBQyIsImZpbGUiOiJzdGRvdXQiLCJzb3VyY2VzQ29udGVudCI6WyJhcnIubWFwKHggPT4geCAqIHgpOyJdfQ==
|
||||||
@ -1,3 +0,0 @@
|
|||||||
class Test {
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1 +0,0 @@
|
|||||||
arr.map(x => x * MULTIPLIER);
|
|
||||||
@ -1,3 +0,0 @@
|
|||||||
{
|
|
||||||
"args": ["src", "--out-dir", "lib", "--out-file", "compiled.js"]
|
|
||||||
}
|
|
||||||
@ -1,2 +0,0 @@
|
|||||||
babel:
|
|
||||||
--out-file and --out-dir cannot be used together
|
|
||||||
@ -1,3 +0,0 @@
|
|||||||
{
|
|
||||||
"args": ["--out-dir", "lib"]
|
|
||||||
}
|
|
||||||
@ -1,2 +0,0 @@
|
|||||||
babel:
|
|
||||||
--out-dir requires filenames
|
|
||||||
@ -1 +0,0 @@
|
|||||||
(() => 42)
|
|
||||||
@ -1 +0,0 @@
|
|||||||
arr.map(x => x * MULTIPLIER);
|
|
||||||
@ -1,3 +0,0 @@
|
|||||||
{
|
|
||||||
"args": ["src", "--out-file", "test.js", "--extensions", ".es"]
|
|
||||||
}
|
|
||||||
@ -1,10 +0,0 @@
|
|||||||
"use strict";
|
|
||||||
|
|
||||||
(function () {
|
|
||||||
return 42;
|
|
||||||
});
|
|
||||||
"use strict";
|
|
||||||
|
|
||||||
arr.map(function (x) {
|
|
||||||
return x * MULTIPLIER;
|
|
||||||
});
|
|
||||||
@ -1,3 +0,0 @@
|
|||||||
class Test {
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1 +0,0 @@
|
|||||||
arr.map(x => x * MULTIPLIER);
|
|
||||||
@ -1,3 +0,0 @@
|
|||||||
{
|
|
||||||
"args": ["src", "--skip-initial-build", "--out-dir", "lib"]
|
|
||||||
}
|
|
||||||
@ -1,2 +0,0 @@
|
|||||||
babel:
|
|
||||||
--skip-initial-build requires --watch
|
|
||||||
@ -1,3 +0,0 @@
|
|||||||
class Test {
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1 +0,0 @@
|
|||||||
arr.map(x => x * MULTIPLIER);
|
|
||||||
@ -1,3 +0,0 @@
|
|||||||
{
|
|
||||||
"args": ["src", "--watch"]
|
|
||||||
}
|
|
||||||
@ -1,2 +0,0 @@
|
|||||||
babel:
|
|
||||||
--watch requires --out-file or --out-dir
|
|
||||||
@ -1 +1 @@
|
|||||||
--out-dir requires filenames
|
filenames required for --out-dir
|
||||||
|
|||||||
@ -1 +1 @@
|
|||||||
--out-file and --out-dir cannot be used together
|
cannot have --out-file and --out-dir
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
{
|
{
|
||||||
"args": ["--relative", "--no-babelrc"],
|
"args": ["--relative"],
|
||||||
"stderrContains": true
|
"stderrContains": true
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1 +1 @@
|
|||||||
--relative requires --out-dir usage
|
output directory required for --relative
|
||||||
|
|||||||
@ -1 +1 @@
|
|||||||
foo.json does not exist
|
foo.json doesn't exist
|
||||||
|
|||||||
@ -1 +0,0 @@
|
|||||||
arr.map(x => x * MULTIPLIER);
|
|
||||||
@ -1,3 +0,0 @@
|
|||||||
{
|
|
||||||
"args": ["script.js", "--out-file", "folder/nested/script.js"]
|
|
||||||
}
|
|
||||||
@ -1,5 +0,0 @@
|
|||||||
"use strict";
|
|
||||||
|
|
||||||
arr.map(function (x) {
|
|
||||||
return x * MULTIPLIER;
|
|
||||||
});
|
|
||||||
@ -1 +0,0 @@
|
|||||||
arr.map(x => x * MULTIPLIER);
|
|
||||||
@ -1,3 +0,0 @@
|
|||||||
{
|
|
||||||
"args": ["--watch", "--out-file", "out.js", "--no-babelrc"]
|
|
||||||
}
|
|
||||||
@ -1,2 +0,0 @@
|
|||||||
babel:
|
|
||||||
--watch requires filenames
|
|
||||||
@ -1,3 +0,0 @@
|
|||||||
{
|
|
||||||
"args": ["index.js"]
|
|
||||||
}
|
|
||||||
@ -1,2 +0,0 @@
|
|||||||
babel:
|
|
||||||
index.js does not exist
|
|
||||||
@ -1,10 +1,3 @@
|
|||||||
{
|
{
|
||||||
"args": [
|
"args": ["script.js", "script2.js", "--source-maps", "inline", "--out-file", "script3.js"]
|
||||||
"script.js",
|
|
||||||
"script2.js",
|
|
||||||
"--source-maps",
|
|
||||||
"inline",
|
|
||||||
"--out-file",
|
|
||||||
"script3.js"
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,9 +1,3 @@
|
|||||||
{
|
{
|
||||||
"args": [
|
"args": ["script.js", "script2.js", "--source-maps", "--out-file", "script3.js"]
|
||||||
"script.js",
|
|
||||||
"script2.js",
|
|
||||||
"--source-maps",
|
|
||||||
"--out-file",
|
|
||||||
"script3.js"
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +0,0 @@
|
|||||||
{
|
|
||||||
"args": ["--filename", "test.js"],
|
|
||||||
"stderrContains": true,
|
|
||||||
"os": ["win32"]
|
|
||||||
}
|
|
||||||
@ -1 +0,0 @@
|
|||||||
SyntaxError: <CWD>\test.js: Unexpected token, expected ";" (2:10)
|
|
||||||
@ -1,3 +0,0 @@
|
|||||||
arr.map(function () {
|
|
||||||
return $]!;
|
|
||||||
});
|
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user