* grammar correction of an option description
(missed in #10589)
* changed description to be consistent with others
Co-Authored-By: Huáng Jùnliàng <jlhwung@gmail.com>
* ran prettier
* [parser] Add support for TS declare modifier on fields (#10484)
* [parser] Add support for TS declare modifier on fields
* Use Object.create(null)
* Comment
* Add support for TS declare types to types and generator (#10544)
* Transform TypeScript "declare" fields (#10546)
* Transform TypeScript "declare" fields
* Remove multiple spaces
* declareFields -> allowDeclareFields
* Update after rebase
* Add error recovery support to @babel/parser
* Update @babel/parser tests to always recover from errors
* Update this.raise usage in @babel/parser:
- expression.js
- lval.js
- statement.js
- estree.js
- flow.js
- jsx/index.js
- tokenizer/index.js
* Update @babel/parser fixtures with recovered errors
* Fix tests out of @babel/parser
* Do not use try/catch for control flow
* Update invalid fixtures
* Do not report invalid lhs in toAssignable
* Do not validate function id multiple times
* Dedupe reserved await errors
* Remove duplicate errors about strict reserved bindings
* Remove duplicated error about yield/await inside params
* Don't error twice for methods in object patterns
* Don't report invalid super() twice
* Remove dup error about reserved param for expr arrows
* Remove double escapes in migrated tests
* Dedupe errors about invalid escapes in identifiers
* Remove duplicated error about decorated constructor
* Remove duplicated error about spread in flow class
* Don't throw for invalid super usage
* Don't fail for object decorators with stage 2
* Fix flow inexact type errors
* Fix flow
* Fix errors about escapes in keywords (ref: #10455)
* Update after rebase
* Fix todo
* Remove duplicated error when using += for defaults
* Remove unnecessary throw
* Nit: use ??
This PR allows legacy decorators to work with strict class fields, which
are now stage 3 and have shipped in a number of browsers. Allowing this will
allow users of the legacy transform (which is currently recommended by the
champions of the decorator proposal) to use the proper class field semantics
for non-decorated fields, which should help prevent breakage later on.
This change is not a breaking change, since users had to explicitly opt into
loose mode in class fields before. This just gives them the option to remove
that opt-in.
* [transform-react-jsx] Add useSpread option to transform JSX
* Add validation for default option
* Add error when using useSpread and useBuiltIns at the same time
* Move useSpread to convertAttribute helper function
* Add useSpread option to presect-react
* Remove casting useSpread to boolean in preset-react option.
Co-Authored-By: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
* feat: implement create-regexp-features-plugin
* fix: test input is not effective
* refactor: leverage create-regexp-features-plugin
* test: add more test cases
* test: update test fixture
* chore: add type annotation to features
* test: add regression test for issue 9892
* add regression test for issue 9199
* address review comments from Nicolò
* address review comments from Brian
* small tweaks
* Enable dotAllFlag when flags includes u
* Flow enums parsing
* Parse exporting enums
* Enums parsing remove lookahead, other improvements
* Enums: add EnumBody and EnumMember aliases, change boolean members to use BooleaLiteral value
* Fix enum member init flow type, now that boolean members have a BooleanLiteral value
* Flow enums: use contextual utils, change members length checks to use logic operators, remove reserved word logic modification
* Flow enums: remove unnecessary code in generator, fix error message
* 🐛 fixed missing errors on assignment pattern in object expression
* ♻️ remove a non-needed comment
* 🐛 missed adding comma in the test input
* 🐛 fixed the failing valid-property-initializer test
* Changes UMD callsite to be more likely to pass in the intended object.
Fixes#10476
Note: This PR should be considered pseudocode and used as an illustration of the proposed fix. I do not know nearly enough about this project to know if this is an appropriate solution to the problem, nor do I have the confidence to update the tests appropriately.
* Update tests
* Make dir for babel --out-file
Currently there's unexpected regression after upgrade from babel 6.
On creating file with any depth like dist/index.js the error about
not existing directory is thrown.
In this diff I modified babel-cli to create deep directory for out-file
command.
I also replaced `mkdirp` with more supported `make-dir` package which
also have official promise support.
* Fix test
* fix: [#10561] _interopRequireWildcard should cache object only
* fix: narrow down cache restriction to object/function type
* test: add interop require null module case
* docs: add homepage link
Adds a homepage link to populate npmjs.com.
Update the repository property syntax.
* Update the repository link
Point to the root repo plus a reference to the subdirectory.
* style: drop HTML extension
The results of these tests will be stored in build artifacts which will be used to compare with test262 runs on PR (future work!). Robin has also done a
lot of work to ensure all babel packages are properly linked to the
test runner. Additionally, Nicolo has helped in mentorship and
contributions to babel-test262-runner which is used here.
We're no longer giving xunit output to CircleCI because once it sees failing tests it will mark babel's master as broken. As a stopgap, it will render the test results in the mocha spec format, which is human readable.
Co-Authored-By: Robin Ricard <rricard2@bloomberg.net>
Co-Authored-By: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
* Exclude catch clause from let identifier error
* Disallow let binding based on parameter
* Add test
* Remove unused getter
* Update packages/babel-parser/src/parser/statement.js
Co-Authored-By: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
* fix: disable caching when babel could not read/write cache
* emit warning when cache folder resides in readonly fs
* fix: always register save handler
* cache: maintain old behaviour
* test: add more test case
* fix: next tick tasks are FIFO
* test: disable test on Windows
* Inject corejs3 imports in Program:exit instead of post
This allows them to be requeued and transformed by other plugins.
* Also entry
* Rebase
* Update packages/babel-preset-env/src/polyfills/corejs3/entry-plugin.js [skip ci]
Co-Authored-By: Brian Ng <bng412@gmail.com>
For some reason, it looks like that the rimraf call didn't properly delete
the folder:
EEXIST: file already exists, mkdir 'C:\Users\travis\build\babel\babel\packages\babel-node\test\tmp'
150 | process.chdir(__dirname);
151 | if (fs.existsSync(tmpLoc)) rimraf.sync(tmpLoc);
> 152 | fs.mkdirSync(tmpLoc);
| ^
153 | process.chdir(tmpLoc);
154 | };
Lets try to reuse the existing folder rather than deleting and recreating it
* Allow duplicate __proto__ keys in patterns, simple case (#6705)
* Update test262 whitelist
* Rename checkDuplicatedProto's parameter and adjust type
* Store first __proto__ redefinition's position
* Don't use args rest/spread to hoist super method calls
* Hoist this in hoisted super method calls
* Make the code more readable
Review by edoardocavazza
* fix: should not remove let binding even it is wrapped in closure
Fixes#10339
* fix: remove bindings defined in blockScope when wrapped in closure
* Move test assertions to the top level to ensure that they run
This adds lots of missing declarations to the types of @babel/types,
including many utility functions useful to plugin authors.
With the typescript types, I tried to make them as useful as possible
for control flow analysis / inference, but Flow doesn't seem to
support overloads and I'm not as familiar with it anyway so it has
simpler types.
* build: add build-babel-types task
* chore: revamp Makefile to for parallel builds
* chore: style fix
* chore: skip install step as we handle yarn in makefile
* test job execution order
When users see errors like
```
Duplicate plugin/preset detected.
If you'd like to use two separate instances of a plugin,
they need separate names, e.g.
plugins: [
['some-plugin', {}],
['some-plugin', {}, 'some unique name'],
]
```
It can be difficult to determine the source of the conflict, especially
in a larger build system.
This commit outputs what is known about the plugins that actually
conflict, which can be helpful for users to determine the root cause of
the conflict.
Partially addresses #9778
* fix: typo
* declare name for flow interface
* add test case for export overload function, typescript
* test: add test
Fixes#10044
* test: update test
* test(flow): add multiple declarations regression test
* re-enable flow test case
# Conflicts:
# packages/babel-plugin-transform-flow-strip-types/test/fixtures/strip-types/def-site-variance/input.js
# packages/babel-plugin-transform-flow-strip-types/test/fixtures/strip-types/strip-declare-statements/input.js
# packages/babel-plugin-transform-flow-strip-types/test/fixtures/strip-types/strip-interfaces-module-and-script/input.js
# packages/babel-plugin-transform-flow-strip-types/test/fixtures/strip-types/strip-iterator/input.js
* test: disable two flow dupl-decl test
* fix: do not declare name for declare function until we figure out a better way
* test: duplicate declare function and function would not throw
* Add windows to travis
* Update
* Do not use sh file on windows
* Fix whitespace
* Unify command
* ./ doesn't work on windows
* Remove all ./ usages
* Run windows test before others
* fix: normalize filename when generating sources
sources should be URL.
* fix: replace normalized path to cwd
* chore: add nodePlatform task options
* fix: normalize preset-env filename output
* chore: replace normalized path to CWD on win32 platform
* limit transform-react-source to run on linux and darwin
* test: escapeRegExp on testcases
* test: add test for babel --filename on windows
* test: double babel-node/cli test timeout
* chore: workaround windows build does not stop
* chore: remove redundant condition
* refactor: rename `nodePlatform` to `os`
* Add test
* Add nonOctalDecimal verification
* Update regex and code style
* Refactor non octal detection
* Add numeric separator test
* Disallow numeric separators in non octals
* Update whitelist
* Better test naming
* Disallow numeric separators in non oct for all numbers
* Specific error above the general error
* Add test for invalid leading zero in num separator
* Add start position to error
* [parser] Disallow numeric separator in unicode scape sequences (#10460)
* raise error only when numeric separator plugin is set
* Adds argument for checking numeric separator
* Fix condition for readability
* Add test for hex escape sequence and rephrase error message
* Remove exposure for allowNumSeparator in readHexChar method
* 🚀 added check to disallow super.private variable access and test case added
* ♻️ change the other linting change back to how it was
* ♻️ change the other linting change back to how it was
* ♻️ added newline at the end test output.json file
* ♻️ changed the linting style to the way it was
* ♻️ updated error message, removed super private member access test cases from whitelist of flow and test 262 suite
* ♻️ added newline in output.json
* Disallow static fields named `constructor` in a class
- Disallowed static fields named `constructor` in a class (previously only non-static were disallowed)
- Updated the text for the error for one consolidated warning, for both static and non-static fields
- Added a test
- Updated an existing test in the `flow` test suite of the parser to reflect the parse error.
Strangely, the test used to pass and started failing when inlining the `isNonstaticConstructor` method, without any changes.
In that test, `constructor` was a field, so in theory it should never have passed.
Would appreciate some feedback on this, as I'm not 100% sure if this is somehow related to Flow
* Update test262 whitelist
* Add comment and fix && operator
Flow maybe types state;
> Maybe types accept the provided type as well as null or undefined. So ?number would mean number, null, or undefined.
So in this case, explicitly allow the type, null, or undefined in the
typescript definition.
Fixes#10403
* feat: v8intrinsic syntax plugin
Implement V8 Intrinsic Syntax Extension. Here we check the execution branch inside the parseSubscript to make sure the V8IntrinsicIdentifier is immediately followed by a call expression.
* feat: disable combining placeholders and v8intrisic
per https://github.com/babel/babel/issues/10104#issuecomment-506950969
* test: add more error cases
* refactor: parse v8 intrinsic in parseExprAtom
This approach is identical to V8’s implementation. Move the test cases as the behaviour changes.
* fix: plugin-name typo
* test: add yield-expression test case
* feat: require startsExpr on modulo for v8intrinsic
* perf: skip eof and braceR check as they must return false
* Print V8IntrinsicIdentifier
* feat: add v8intrinsic to parser typings
* Add generated type helpers
* fix: incorrect type definition
* fix: allow V8IntrinsicIdentifier to be callee
* ♻️ added condition to check for left and right of nullish coalescing operator and if any is a logical expression without a paren then throw an error
* 🐛 bugs fixed and test cases updated for babel parser
* ♻️ code comments added
* 🐛 spell error rectified
* ♻️ failing test updated
* 🐛 push tests after make build
* Skip nullish-coalescing flow precedence tests
They're now incorrect
* ♻️ error message updated, binop priority of other logical operators +1 from ?? and
* ♻️ increaed the binOp for in and instanceOf, added logic to print the brackets in an ?? && || expression, test cases added
* 🐛 failing test fixed and comments updated
* ♻️ new lines added between tests
* ♻️ basic tests for checking the binOp of instanceOf, in and relational operators to be equal added
* ♻️ new lines added in between tests
* fix: transform name capturing regex once
* refactor: early return when pattern contains only lookbehind
* chore: simplify test regex
* chore: run test on >=8.0.0
* Refactor trailing comment adjustment
Following up from https://github.com/babel/babel/pull/10369
- Unify the logic for adjusting trailing comments into a separate
function
- Use it for all three cases, which fixes a bug for ObjectExpressions
and CallExpressions
- Update tests to check for the fixed bug
* Fix tests
- Only modify trailingComments if necessary
- Update snapshots of a couple of affected tests
* Drop the underscore in adjustCommentsAfterTrailingComma_
* Handle ArrayPattern
* Handle ObjectPattern
* Handle import and export declarations
These have to be handled a bit differently, because the node is visited after the and before the declaration. So we intercept when we are going from the last specifier to the source node.
* Remove unnecessary check
* Retain trailing comments in array expressions
This is a proposed fix for https://github.com/babel/babel/issues/10368
with a simple test.
* Move lastElement in the block where it's used
* Test trailing comment after array expression
* Don't move comments after the array expression
* Retain trailing comment after the array expression
Eg, `namespace:foo.bar` used to parse but is invalid in the [spec](https://facebook.github.io/jsx/).
Also, allow `JSXNamespacedName` in the `JSXOpeningElement`/`JSXClosingElement` builders.
Instead of using `convert-source-map`'s `removeComments` method before
parsing the file, we can first parse the file with `@babel/parser` and then
analyze the comments.
This is needed because it is not possible to reliabily detect comments in
JavaScript without fully parsing the file:
https://github.com/thlorenz/convert-source-map/issues/63
* Fix issues in flow-comments to preserve comments and there order (fixes#10324)
* Add support in flow-comments for extends in class declarations (fixes#10323, #10321)
* Refactoring and cleanup of flow-comments plugin
* Fix comments preservation logic of flow-comments
* Fix flow-comments where comments are class identifier and extends keyword
* Add support for logs to transform-fixture-test-runner
* Test some warnings
* Use stderr/stdout, and add a validateLogs test option
* Normalize CWD in logs and rename vars
* Silence preset-env tests
* Restore old methods
* Adds note about two approval policy to PR template
* Adds qualifier to approval policy
Because, although two approvals is the general case, some PRs maybe merged with more or fewer approvals
[skip ci]
Adds a badge showing the number of people helping this repo on CodeTriage.
[](https://www.codetriage.com/babel/babel)
## What is CodeTriage?
CodeTriage is an Open Source app that is designed to make contributing to Open Source projects easier. It works by sending subscribers a few open issues in their inbox. If subscribers get busy, there is an algorithm that backs off issue load so they do not get overwhelmed
[Read more about the CodeTriage project](https://www.codetriage.com/what).
## Why am I getting this PR?
Your project was picked by the human, @schneems. They selected it from the projects submitted to https://www.codetriage.com and hand edited the PR. How did your project get added to [CodeTriage](https://www.codetriage.com/what)? Roughly over 3 years ago, [iamsolankiamit](https://github.com/iamsolankiamit) added this project to CodeTriage in order to start contributing. Since then, 94 people have subscribed to help this repo.
## What does adding a badge accomplish?
Adding a badge invites people to help contribute to your project. It also lets developers know that others are invested in the longterm success and maintainability of the project.
You can see an example of a CodeTriage badge on these popular OSS READMEs:
- [](https://www.codetriage.com/rails/rails) https://github.com/rails/rails
- [](https://www.codetriage.com/crystal-lang/crystal) https://github.com/crystal-lang/crystal
## Have a question or comment?
While I am a bot, this PR was manually reviewed and monitored by a human - @schneems. My job is writing commit messages and handling PR logistics.
If you have any questions, you can reply back to this PR and they will be answered by @schneems. If you do not want a badge right now, no worries, close the PR, you will not hear from me again.
Thanks for making your project Open Source! Any feedback is greatly appreciated.
* Improves the logic to import objects in helpers
* Modified to work with more cases.
* Modified by considering exception cases
* Fixed not using bundler's polyfill
Co-Authored-By: Jordan Harband <ljharb@gmail.com>
* Updated test output files
* Changes to cache logic
* Modified to use if statement
* Decorators legacy: register inserted declaration
For compatibility with the Typescript plugin
Fixes#10264
* Register declaration but also keep replaceWithMultiple
* lint fix
* switch inside do expression
* review comments
* review comments
* make min diff
* adding more test
* review changes
* review changes
* handle block statement and added more test cases
* fix implementation and add more test cases
* fix last swtich case
* disable block fallthrough case
* fix nitpick reviews
* added 'placeholders', 'logicalAssignment', 'partialApplication' to the ParserPlugin type. closes#10186
* put the ParserPlugin names in alphabetical order
* Add ";" token to the end of TS construct signature declaration
* Add ";" token to the end of TS call signature declaration. Update construct signature test fixtures
* Better tdz tests
- Use jest's expect.toThrow/expect.not.toThrow
- Add input/output tests
* Fix basic tdz (a = 2; let a)
Fixes#6848
* Make _guessExecutionStatusRelativeTo more robust
* Add tests
* Return less "unkown" execution status
* "function" execution status does not exist
* Fix recursive functions
* Update helper version
* "finally" blocks are always executed
* Typo
* destructuring private fields with array pattern / object pattern
* wip: new test cases
* destrucuring and rest for private properties
* test case for loose private-loose
* add transform-desturcturing for exec
* update test case
* remove getPrototypeOf imports from get and set
* wip: destructure super assignment
* throw "Destructuring to a super field is not supported yet."
* fix tests and fix assignment pattern
* remove CallExpression from AssignmentPattern
* Create @babel/plugin-proposal-dynamic-import
* Use airbnb/babel-plugin-dynamic-import-node
Do not duplicate code, which will unavoidably lead
to bugs being fixed in one plugin and not in the other.
* Update error message
* Add error callback to amd interop
* Update babel-plugin-dynamic-import-node
* Transform for F#-style await
Inludes support for optimizing single-parameter arrow functions
* Wait until optimization before pushing placeholder into scope
* [legacy decorators] Allow decorating generator methods
The old proposal used LeftHandSideExpression (instead of
AssignmentExpression) to satisfy this usecase:
e240cbc91a
* Update flow whitelist
* fix exportKind types declaration for ExportNamedDeclaration and DeclareExportAllDeclaration in babel-types
* revert `let` in exportKind in babel-parser types
* flow - allow type parameter defaults in function declarations
* fix flow test
* add intern_comments option
* fix flow parser test
* remove allowdefault from flowParseTypeParameterDeclaration
* rename test cases
* Change root package.json#name
I'm pretty sure GitHub's new Dependants feature is based on this package.json. I'm updating it here so it will reflect the new name for the core package.
* Update package.json
This also fixes enum not adding the respective declaration to the scope
during the typescript visitation.
Rewrites:
2080042808b18b005fb54aeaf9ab708f64cb1005 #9944
a6392bd636d07c41579ea5ab443152a09943e096 #10019
* test case for insertBefore for jsx
* fix unshiftContainer and insertBefore
* use path.scope.push
* add test making sure computedKeys var declaration at the right block
* add comment
* nit [skip ci]
This reverts commit 43b83f8ed7545b9c049eeed85541fa162842fb8f.
Fix objectSpread helper breaking old codes
remove tests to regenerate later
renamed output
new name
try using word
add comment as requested
revert inline name changes
add 2 for consistency
Update packages/babel-helpers/src/helpers.js
Co-Authored-By: Daniel Tschinder <daniel@tschinder.de>
* Fix location with optional params in arrow functions
* add test
* Ensure rollup replaces NODE_ENV and create sourcemap in dev
* Ensure finishNod*() is never called twice on a node
* Fix check for already finished nodes
* fix(typescript): erase type exports
* use Set instead of array for tracking and checking TS type declarations
* add a test for an interface exported before its declaration
* Fixed null error in plugin opts and added a test for it
* Remove !opts and add opts === null check to avoid confusion with false and undefined cases
Co-Authored-By: divbhasin <divbest99@gmail.com>
GitHub actions are too slow for this, it takes more than 15 mins.
Publishing to npm from GH actions is a cool idea, but it's a lot faster to
publish locally.
Also, I think that since when I introduced this action I
always killed it; either because it was to slow or because I had to
make some manual tweaks during the release.
* [parser] Allow plugins to extend ScopeHandler
* Directly extend Scope
* Don't use new.target to get the ScopeHandler
* [parser] Add TS enum support to the Scope
* Remove duplicated options in tests
* Fix
* Fix flow
* Rename tests
* Add tests
* Full typescript support in scope
* Remove BIND_SIMPLE_CATCH
SCOPE_SIMPLE_CATCH was used instead
* Export TS types
* Register function declarations
* Fix body-less functions and namespaces
1) Move this.scope.exit() for functions from parseFunctionBody to the callers.
Otherwise the scope of body-less functions was never closed.
Also, it is easier to track scope.exit() if it is near to scope.enter()
2) Register namespace ids for export
* Disallow redeclaration of enum with const enum
This PR fixes a bug in support of JSX pragma in Typescript (introduced in https://github.com/babel/babel/pull/9095).
We've noticed this bug while building a large codebase with webpack+babel+typescript. Some files from our projects are using `/** @jsx h*/` to use a custom function for JSX syntax; and some others are using the React syntax.
We've noticed that our react imports were being removed by babel because the plugin instance was being reused by `babel-loader` and webpack; and it was causing an error :
```
ReferenceError: React is not defined
```
This PR resets the `jsxPragma` being used to the initial value for each new file being processed.
I can't add a unit test for this bug because it requires processing 2 files (one with `/** @jsx something */` then one with the react syntax).
I've tested a build of this PR and it correctly fixes the issue for us.
* Fix super method call in private instance method calling overridden method
* Change return value in test fixtures
* Update tests to verify that overridden method is not called
This fixes an issue where destructuring assignments eligible for the "array unpacking" optimization would fail to compile when the array literal on the right-hand side of the expression contained holes.
Example input:
```js
[a, b] = [, 2];
; // Avoid completion record special case
```
The error message was `Property right of AssignmentExpression expected node to be of a type ["Expression"] but instead got null`.
Now the above code compiles to:
```js
a = void 0;
b = 2;
;
```
This PR also adds a couple of related test cases that were missing, to ensure the change doesn't regress them:
* Normal assignment expression with unpacking
* Declaration with unpacking and a hole on RHS
* @babel/traverse: Fix NodePath.getData
Currently, if the obtained value is `false`, it will be replaced by the given default value, which is invalid. This makes sure that we only set the default value when the value is `undefined`, instead of falsy.
* Add test and fix object protoype
* Allow false as default value
Currently, the "Trigger GitHub release" and "Publish to npm" actions
are run in parallel. Publishing to npm takes about 15 mins (it needs to
run `make bootstrap`), so everyone watching the npm repo for
releases would get the notification before that the new version is
available on npm.
This commit marks the automatically generated GitHub releases as draft,
which then need to be manually "finalized" by real people. This will also
avoid notifying people when for some reason a publish fails.
### `@babel/runtime`
- Added `@babel/runtime-corejs3` package and `corejs: 3` options to `@babel/plugin-transform-runtime`.
- Added support of instance methods, fixes#8928.
- Added flag `proposals` (in `corejs: { version: 3, proposals: true }` format) for support all proposals polyfills from `core-js`.
- Used separate directories in runtime for `core-js` entry points with proposals and without.
- Used `get-iterator-method` helper for getting iterators, fixes#2500.
- As a cheap bonus, added support of IE8- (except some cases of `regenerator`).
### `@babel/polyfill`
- Should be deprecated in favor of separate usage required features from `core-js` and `regenerator-runtime` with an informative message.
### `@babel/preset-env`
- Uses for built-ins data from [`core-js-compat`](https://github.com/zloirock/core-js/tree/master/packages/core-js-compat) instead of `compat-table` since information from `compat-table` [is not enough](https://github.com/zloirock/core-js/tree/master/packages/core-js-compat).
- `useBuilIns` now requires direct setting of `corejs` version option, without it will be used `2` by default and shown deprecation warning.
- Added support of minor `core-js` versions for simplify updating in the future.
- For preventing some order-related problems, polyfills in the both `core-js@3` plugins added on `post` stage in the order of `core-js-compat` data.
- Divided plugins and polyfills parts of `preset-env`, instead of 2 internal plugins for adding polyfills, we have 6: usage and entry versions of plugins for `core-js@2`, ### Current state:
`core-js@3`, `regenerator-runtime`.
- Added support `samsung` target (for Samsung Internet) since `core-js-compat` and `compat-table` now contains mapping for this, fixes#6602.
#### `useBuilIns: entry` with `corejs: 3`
- No longer transforms `@babel/polyfill`.
- Transforms **all possible** `core-js` entry points to import of related modules (based on data from [`core-js-compat`](https://unpkg.com/core-js-compat@3.0.0-beta.15/entries.json)).
- Since of this, we no longer need `shippedProposals` / `proposals` flags with `useBuilIns: entry`.
- Removes `regenerator-runtime/runtime` import where it's not required.
#### `useBuilIns: usage` with `corejs: 3`
- In addition to `shippedProposals`, added flag `proposals` (in `corejs: { version: 3, proposals: true }` format) for polyfill all proposals from `core-js`.
- Fixed list of dependencies in built-in definitions.
- Improved the way of determination method / built-in name and source of this method.
- Adds import of required polyfills on `MemberExpression`, `ObjectPattern`, `in` operator.
- Adds import of required polyfills on access to global object properties.
- Adds import of all required common iterators on all syntax features which use iterators protocol (`for-of`, destructuring, spread, `yield` delegation, etc.).
- Adds import of promises on syntax features which use promises (async functions/generators, dynamic import, etc.), fixes#9250, #7402, etc.
### `core-js@2` stuff
I didn't want to tough `core-js@2`-related stuff, however
- Fixed some serious errors in definitions which breaks `Object.getOwnPropertySymbols`, `Symbol.toStringTag` logic, `Promise#finally`, `Array#forEach`, etc.
- `Array#flatMap` and trim methods moved to stable features as a part of ES2019 and loaded by deprecated `@babel/polyfill` and `@babel/preset-env` with `corejs: 2` option.
This is the last step to make https://github.com/babel/babel/pull/9364 usable in Babel. I'm sorry for opening this PR so late, but I hope to get it in v7.4.
In this PR I added a new option to `@babel/template`, `syntacticPlaceholders: ?boolean`, which toggles between `%%foo%%` placeholders (when `true`) and `FOO` placeholders. If it isn't specified, Babel tries to be "smart" to avoid breaking backward compat: if `%%foo%%` is used `syntacticPlaceholders` defaults to `true`, otherwise to `false`.
0e58e252913efe84eba926cc9c9c19fb18d5c620 commit shows how some templates we used could be simplified by using this new placeholders syntax (we can't actually do it yet because we are importing `template` from `@babel/core` which could be an older version).
NOTE: Since I wanted to keep this PR as small as possible to make it easier to review, I didn't migrate `template.ast` to internally use the new syntax. It is an implementation detail, so it will be possible to change it in a patch release.
Usage of "@babel/plugin-proposal-decorators" with legacy
support causes "abstract" keyword to be preserved.
This fixes it by moving "abstract" node property removal
from "ClassDeclaration" visitor to "Class". Resolves#8172
When traversing a tree parsing for TypeScript syntax and hitting a `TSFunctionType` node, the `typeParameters` and `typeAnnotation` fields are correctly visited but the `parameters` field isn't. As a result visitors by default don't visit `foo` below:
```
var x: (foo) => void; // foo is never visited
```
```
module.exports = function() {
return {
visitor: {
Identifier(path) {
if (path.node.name == "foo") {
// Never hit because it's nested within TSFunctionType.parameters
path.node.name = "bar";
}
}
}
};
}
```
It appears to be a bug in babel-types/src/definitions/typescript.js which omits `parameters` in the visitors list for `fnOrCtr`. Fixed by adding it.
* add partial application syntax and some tests
remove unnecessary error message and hasPartial function from parseNewArguments
add types for PartialExpression
Update the tests
rename PartialExpression to Partial
move Partial from expressions to types and rename to ArgumentPlaceholder
add tests for ArgumentPlaceholder in babel-generator
rename Partial to ArgumentPlaceholder
update the tests
remove alias from the type and undo changes in generated folder
adds a nice error message
better definition for the type
auto-generated files
update the conditional for allowPlaceholder message and tests
update CallExpression definition to accept ArgumentPlaceholder
change description
clean up
indent ArgumentPlaceholder entry and revert unwanted changes
* add Partial Application Plugin
* update unwrapArguments function and add replacePlaceholders.
* update the tests
* remove unnecessary clone
* update readme and description an package.json
* put options.json one level up and add test for not assigned and chained
* add await to fix the test
* use Promise in the test instead of async await
* remove unnecessary method test [#9474]
* push sequenceExpressions to an array [#9474]
* Add parser createParenthesizedExpressions option …
When set to `true` we create `ParenthesizedExpression` nodes instead of
setting `extra.parenthesized`.
* Also update babel-parser.d.ts
* Disallow escape sequences in async
* Disallow escape sequences in get, set and async in class
* invalid escape tests
* Update whitelist
* tests for async in parens
* Add test for invalid newline between params and arrow
* Move canInsertSemilcolon() into shouldPArseAsyncArrow
* add partial application syntax and some tests
* remove unnecessary error message and hasPartial function from parseNewArguments
* add types for PartialExpression
* Update the tests
* rename PartialExpression to Partial
* move Partial from expressions to types and rename to ArgumentPlaceholder
* add tests for ArgumentPlaceholder in babel-generator
* rename Partial to ArgumentPlaceholder
* update the tests
* remove alias from the type and undo changes in generated folder
* adds a nice error message
* better definition for the type
* auto-generated files
* update the conditional for allowPlaceholder message and tests
* update CallExpression definition to accept ArgumentPlaceholder
* change description
* clean up
* indent ArgumentPlaceholder entry and revert unwanted changes
* fix: strip type imports used in Enums and object types
* chore: update failing snapshot
* docs: correct TSPropertySignature comment
* fix: enum value should be considered a reference
* chore: add tests for TSPropertySignature and TSEnumMember
* Refactor parsing object members
* Ensure decorators on rest don’t swallow decorators silently
* Use hasPrecedingLineBreak
* Add test for async with linebreak
* Update flow whitelist
* preset-env: minimally supporting version
This changes the "does browser support X" algorithm to "lowest version such that all higher versions support it".
Eg, given `{ chrome70: true, chrome60: false, chrome50: true }`, the lowest version is chrome70, not chrome50.
This is done to remove Tagged Template Literal support from Safari, which introduced a bug in Safari 12 but correctly implemented the feature in Safari 11-9.
* Add tests
* Fix tests
* Fix comment
Likely because of implicit `equals` (ie, Safari 12 support implies iOS Safari 12), the versions in the `res` hash are not always sorted in version order.
Doing a semver sort reveals some builtins have actually been supported a little longer than we thought!
In https://github.com/babel/babel/issues/9511 (and #9495 is another symptom), @PavelKastornyy reported a node crash becaue the JavaScript heap run out of memory. The problem was that their code was adding enumerable properties to `Object.prototype`: it is something that shouldn't be done, but Babel shouldn't make node crash if someone adds them.
I reduced down the problem to `for...in` loops in `@babel/traverse` that grew the memory consumption exponentially because of that unexpected properties.
* Introduce scope tracking
* Fix tests
* Add new tests
* Remove constructor-super check from transform as it is now in parser
* Correctly handle class properties and class scope
* Fix duplicate name check
* Convert scope identifier storage to array
* Enter a new scope in typescript module blocks
* Add test for duplicate declaration
* Rename error for duplicate exports
* Treat class declarations as lexical declaration
* Update whitelist
* Add tests
* Fix scope tracking for function declarations
* Migrate try-catch duplicate error
* Fix test
* More tests
* One more test
* Make scope a separate class and fix review comments
* Do not allow new.target in top scope arrow function
* Correctly enter new scope for declare module and treat type aliases as lexical declarations
* Tests for typescript scope tracking to not mark type aliases as duplicate
* Fix flow scope tracking
* Remove ident from test names as redundant
* Add test case for var and function
* Improve error messages
* Improve literal regex
* Add parser createParenthesizedExpressions option …
When set to `true` we create `ParenthesizedExpression` nodes instead of
setting `extra.parenthesized`.
* Also update babel-parser.d.ts
* babel-types is* type checks accept null | undefiend as value TS type
* Use | null | undefined instead of any, make Flow type nullable
* Also change flow types of generated src
chokidar 2.0.3 pulled in an older version of braces which is vulnerable to https://www.npmjs.com/advisories/786, this upgrades chokidar up a patch version where its dependencies have been updated resolving this vulnerability.
* Migrate try-catch duplicate error
* Remove exception for functions and let in the same scope
* Migrate duplicate bindings tests to traverse
* Add test for subscope and let/const
* Add more test cases
Bumps to 7.3.2 the version of `@babel/plugin-transform-typescript` used by `@babel/preset-typescript`.
This allows us to use `@babel/preset-typescript` and pick up at least one useful bug fix (#9095).
A similar PR (#9181) was closed as it bumped to a version that didn't have changes. However reading the comments from that PR, I get the sense that bumping the version in this manner should not be necessary, and should be handled by Lerna. Is this correct?
Please let me know if I can make any improvements to this PR, the description or if there's anything else I can do to help.
This reflects how I have been releasing the last versions (https://github.com/babel/notes/issues/78#issuecomment-449519007).
In the future, we'll only need to run `make new-version && git push --tags` and it will run `make publish` from CI/Actions.
Co-authored-by: Henry Zhu <hi@henryzoo.com>
* Remove types on program exit in typescript transform
* Revert changes to typescript transform
* Correctly add visitors for param decorators
* Fix plugin for node 6
* add isSpread field
* use argument
* t.booleanLiteral
* fix typo
* push empty-argument object
* .object
* .value
* object field should be an expression
* lint
* update outputs
* isSpread for the second argument is redundant
* add test
* alternating spread
When the `runtime` flag is on (by default), this plugin adds a new helper which wraps the native `RegExp` class to provide groups support. People nees to use a polyfill (I implemented it in core-js) for browsers that don't support ES6 regexps.
fix#9189
Obviously this code is intended to throw an error if someone tries to reference a class before it's defined, like:
```js
class Foo {
someField = Foo;
}
```
But there's no problem with referencing the class in a type annotation before it's defined, and this is often necessary for tree structures:
```js
class Foo {
[someSymbol]: Foo;
}
```
* check for spaces and tabs before a flow comment
* fix issue with using string index and shift interchangably
* update tests
* Use update charcodes version
* Disallow flow-comments in flow-comments and check for unterminated comments
* Fix running flow on travis and update flow
- ensure bootstrap is run before running flow as we need some generated files for correctly doing typechecks
- ensure that we only ignore the build directory inside the babel folder as currently we ignore everything because travis checks out into ‘/home/travis/build/’
* Fix all flow errors
* Ignore fixture directories that do not contain input or exec
* Fix parser test fixtures structures for some imported esprima tests.
* Warn on test folders that are not empty and do not contain testfiles
* Make @babel/plugin-class-features a normal helper package
This effectively disallows using it directly.
* Rename helper
* Style
* Don't add prefix to plugin name
* Move private methods plugin
When I was reading the code, I see `parent` is not used in `_getComments` function.
so it make me confused why we delivery the `parent` in those functions.
If I'm wrong, please correct me.
* Fix optional chaining bug regarding spread in function calls
* Revamp optional-chain to be top down
Instead of going both upwards and downwards from the first real optional expression, we can just start from the top down.
* Add more tests
* handle disordered rest parameter in function expressions
* remove spaces [lint]
* polish function parameters validation
* add test with arrow function and comma after rest parameter [babel-parser]
* [decorators] Correctly insert `_initialize(this)` after `super()`.
This commit fixes to problem:
1) After `super();` statements, `_initialize(this)` was inserted without
a trailing semicolon.
2) `(0, super())` causes an infinite recursion.
* Fix tests
* Add test
* feat: validate the positions of rest elements and optional elements in tuple types
Adds a validation step to the parser which raises syntax errors if a rest param is not at the end of a tuple, or if a mandatory param follows an optional parameter
* Fix spread after optional case; add test case
These are now enabled by default:
- objectRestSpread (2018)
- asyncGenerators (2018)
- optionalCatchBInding (2019)
- jsonStrings (2019)
TODO (after this commit):
- [ ] Deprecate the `@babel/plugin-syntax-*` packages.
- [ ] Deprecate the `@babel/plugin-proposal-*` packages.
- [ ] Create the `@babel/plugin-transform-*` packages.
* [flow] Add support for parsing as implicit instantiation in call/new
* Update flow tests and fix underscore being a reserved type
* Rebase onto flow-test
* Fix flow commit hash
* master: (222 commits)
Set correct methods name
Use toPropertyKey in the "decorate" helper
Allow function types in type params within arrow return types (#8954)
Fix message when plugin of a wrong type is passed (#8950)
rename colliding let bindings with for loop init (#8937)
edge incomplete support for arrow destructuring (babel #8349) (#8926)
fix single-arg async arrows when retainLines=true (#8868)
[flow] Explicit inexact objects with `...` (#8884)
Update preset-env data (#8898)
Treat break inside block inside loop (#8914)
fixed "source map" formatting in comment (#8878) [skip ci]
fix typo in contributing guidelines (#8901) [skip ci]
fix: Expression x === 'y' && '' should not evaluate to undefined. (#8880)
fixed an extra word
Fixes#8865 (#8866)
v7.1.4
v7.1.3
Bump Babel deps (#8770)
flow-bin@0.82.0 (#8832)
Insertafter jsx fix (#8833)
...
# Conflicts:
# packages/babel-parser/src/tokenizer/index.js
# packages/babel-parser/test/fixtures/experimental/class-private-properties/failure-numeric-literal/options.json
# packages/babel-parser/test/fixtures/experimental/pipeline-operator/invalid-proposal/options.json
* rename colliding let bindings with for loop init
* added complex test case to check if loop init collisions were handled correctly
* updated test files
The babel-parser output documentation has been moved to the babeljs.io website, but the link in CONTRIBUTING.md is still pointing to the repository itself.
This is similar to ec69b4bb1256c061ac76f53dfed09c4283ec6a31, which
was about private instance fields.
Private properties can be non-writable (thanks to decorators), or have
get/set accessors. If we stored this information on the `privateClass`
object, we would need to always use `Object.getOwnPropertyDescriptor`
before reading or writing a property because accessors need to be called
with the correct `this` context (it should be the actual class, not the
object hat stores the private properties). This commit simplifies that
operation a bit by removing the container object.
It also have another advantage, which instance fields already have
thanks to the use of separate weakmaps: unused private static fields
can be tree-shaken away or garbage-collected, while properties of an
object can't. Also, they can be easilier minified.
* Add static Math methods to plugin-transform-runtime
* Remove methods which are not part of TC39 standard
* Use semver to conditionally include Math module
* Fix version badges in monorepo README
Badges caching disabled by removing the maxAge parameter from image URLs to ensure that always the latest version of package is displayed.
* adjust version badges cache time to one hour
* Private Static Class Fields Implementation
* Redo testing without class transform for static private
* Add a call() test for private static
* Use Object.defineProperty in loose mode
* Update parser whitespace for clarity
Has the nice benefit of not requiring a charCode to String conversion.
* Remove test262 exceptions
Per https://github.com/tc39/ecma262/pull/1218#issuecomment-395340891,
ECMA262 follows whatever the latest Unicode version specifies for Zs
Space_Separator category. MONGOLIAN VOWEL SEPARATOR was moved to the Cf
Other_Format category in Unicode 8.
Usage of a `finally` instance method should trigger import of the `es7.promise.finally` polyfill, but it doesn't. This PR adds the missing definition and a test.
Set whether we're in a pipeline in order to determine how to parse the
hash. The error message changes as a result, since the `hash` never
enters the block.
This allows the new parser package to be used in TypeScript projects, with static type checking and auto-completions. IDEs like VSCode will use this to show auto completions even in JavaScript projects, which is a huge benefit to users wanting to use the parser directly.
This PR follows the auto-generated .d.ts that was added to @babel/types in #7101
- took outdated DefinitelyTyped babylon .d.ts and updated it using new site's documentation.
- added "typings" folder to package, with the new .d.ts
- connected new .d.ts via package.json's "types" field. also adjusted "files" so folder will be published.
- definition file uses TypeScript 2.9's new `import('package').Type` syntax.
2018-06-15 01:04:49 +03:00
8231 changed files with 334219 additions and 34761 deletions
* 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 Compliancy**
* **Spec Compliance**
* 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 proplery inheriting labels.
* Fix `ForOfStatement` not properly 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 Compliancy**
* **Spec Compliance**
* `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.
* `for...of` now outputs in a lengthy `try...catch` this is to ensure spec compliance in regards to iterator returns and abrupt completions. See [google/traceur-compiler#1773](https://github.com/google/traceur-compiler/issues/1773) and [babel/babel/#838](https://github.com/babel/babel/issues/838) for more information.
* **Polish**
* **Polish**
* 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)!
* 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)!
* 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 Compliancy**
* **Spec Compliance**
* 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 `minfication.propertyLiterals` and `es3.memberExpressionLiterals`.
* Split up `es3.propertyLiterals` and `es3.memberExpressionLiterals` transformers to `minification.propertyLiterals` and `es3.memberExpressionLiterals`.
## 5.2.6
## 5.2.6
* **Internal**
* **Internal**
* Fix transformer aliases being accidently set as deprecated ones.
* Fix transformer aliases being accidentally 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 Compliancy**
* **Spec Compliance**
* Fix object decorators not using the `initializer` pattern.
* Fix object decorators not using the `initializer` pattern.
Asynchronous Iteration was already added in [6.16.0](http://babeljs.io/blog/2016/09/28/6.16.0#spec-compliancy) under stage-2 but it was moved to stage-3 at the [latest TC-39 meeting](https://github.com/tc39/agendas/blob/master/2016/09.md#agenda-for-the-54th-meeting-of-ecma-tc39).
Asynchronous Iteration was already added in [6.16.0](http://babeljs.io/blog/2016/09/28/6.16.0#spec-compliance) under stage-2 but it was moved to stage-3 at the [latest TC-39 meeting](https://github.com/tc39/agendas/blob/master/2016/09.md#agenda-for-the-54th-meeting-of-ecma-tc39).
* [#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))
* [#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 overidden. This was causing options like `comments: false` not to work correctly.
Fix an issue with defaults not being overridden. 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))
* [#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-compatiblity. 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-compatibility. 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 - definetely 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 - definitely 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
* [#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`.
* [#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 Compliancy**
* **Spec Compliance**
* `babylon`, `babel-generator`, `babel-plugin-transform-regenerator`: [#3190](https://github.com/babel/babel/pull/3190): Remove `await *` from `babylon` and raise an error for that syntax since it was removed from the proposal and was causing an issue at runtime but not at compile time (fixes [T6688](http://phabricator.babeljs.io/T6688)).
* `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` depenency version.
* Bump `invariant` dependency 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.
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
@ -9,7 +11,7 @@ If you are making a change that should have a docs update: submit another PR to
| Q | A <!--(Can use an emoji 👍) -->
| Q | A <!--(Can use an emoji 👍) -->
| ------------------------ | ---
| ------------------------ | ---
| Fixed Issues? | `Fixes #1, Fixes #2`<!-- remove the (`) quotes to link the issues -->
| Fixed Issues? | `Fixes #1, Fixes #2`<!-- remove the (`) quotes and write "Fixes" before the number to link the issues -->
@ -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 hzoo, thejameskyle, sebastian, orloganfsmyth on [Slack](https://slack.babeljs.io/). All
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
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.
- 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://github.com/babel/babel/tree/master/packages/babel-parser#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://babeljs.io/docs/en/next/babel-parser.html#output).
- Check out [`/doc`](https://github.com/babel/babel/tree/master/doc) for information about Babel's internals
- Check out [`/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,6 +32,7 @@ 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
@ -310,7 +311,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/bloc/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/blob/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
<ahref="https://twitter.com/intent/follow?screen_name=babeljs"><imgalt="Follow on Twitter"src="https://img.shields.io/twitter/follow/babeljs.svg?style=social&label=Follow"></a>
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 (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:
- 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 (see below)!
- Giving funds by becoming a sponsor on [Open Collective](https://opencollective.com/babel) or [Patreon](https://www.patreon.com/henryzhu)!
## Open Collective Sponsors
## Sponsors
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)]
Our top sponsors are shown below! [[Become a sponsor](https://opencollective.com/babel#sponsor)]
@ -100,16 +85,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! Please check out our [team page](https://babeljs.io/team)!
Mostly a handful of volunteers, funded by you! Please check out our [team page](https://babeljs.io/team)!
### Looking for support?
For questions and support please 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).
@ -120,12 +105,19 @@ 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 our [CONTRIBUTING.md](CONTRIBUTING.md) to get started with setting up the repo.
Check out:
- If you have already joined Slack, join our [#development](https://babeljs.slack.com/messages/development) channel and say hi!
- Our [#development](https://babeljs.slack.com/messages/development) Slack channel and say hi ([signup](https://slack.babeljs.io))!
- 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.
- Issues with the [good first issue](https://github.com/babel/babel/labels/good%20first%20issue) and [help wanted](https://github.com/babel/babel/labels/help%20wanted) label. We suggest also looking at the [closed ones](https://github.com/babel/babel/issues?utf8=%E2%9C%93&q=is%3Aclosed+label%3A%22good+first+issue%22) to get a sense of the kinds of issues you can tackle.
Some resources:
- Our [CONTRIBUTING.md](CONTRIBUTING.md) to get started with setting up the repo.
[`@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/
- [`@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)
{"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);"]}
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.