Compare commits

...

1369 Commits

Author SHA1 Message Date
Nicolò Ribaudo
35f4d12763 v7.7.2 2019-11-07 02:20:52 +03:00
Nicolò Ribaudo
9082e68d6f Parse arrows with params annotations in conditional expressions (#10669) 2019-11-07 02:18:36 +03:00
Vojtech Miksu
bdb4318f47 chore: update convert-source-map dep (#10667) 2019-11-06 14:30:32 -06:00
Maksim Ryzhikov
3ab035bab6 fix: Use the recommended property to specify repository URL (#10665) [ci-skip]
Use recommended by npm property to specify repository URL
https://docs.npmjs.com/files/package.json#repository

Otherwise, it breaks some tools which relay on this convention for example "nlf" package
https://github.com/iandotkelly/nlf/blob/master/lib/nlf.js#L284-L285
2019-11-06 07:34:09 -05:00
Leonid Shevtsov
2cd5ad0c80 fix typo: identifer -> identifier (#10647) 2019-11-06 09:13:08 +01:00
Huáng Jùnliàng
2640e5a27c fix: remove accessibility of constructor (#10658) 2019-11-05 13:52:57 -06:00
Huáng Jùnliàng
0f949990c3 fix: add inList setter for compatibility with babel-minify (#10656) 2019-11-05 12:28:16 -05:00
njlr
f544753bb8 code style: consistent spacing (#10643) [ci-skip]
Makes spacing consistent
2019-11-05 09:40:57 -05:00
Babel Bot
d3db02da30 Add v7.7.1 to CHANGELOG.md [skip ci] 2019-11-05 13:50:36 +00:00
Nicolò Ribaudo
42c8e0fb2f v7.7.1 2019-11-05 14:44:00 +01:00
Nicolò Ribaudo
bf48fca6a0 Revert "throw a TypeError if identifier validation fails (#106… (#10650)
This reverts commit c7d8b8a377.
2019-11-05 14:43:23 +01:00
Archer
f8eb290da1 Fix(babel-preset-env): check api.caller is a function to avoid… (#10649) 2019-11-05 14:39:14 +01:00
Nicolò Ribaudo
5f2240e7ab Add v7.7.0 to CHANGELOG.md [skip ci] 2019-11-05 12:06:52 +01:00
Nicolò Ribaudo
97faa83953 v7.7.0 2019-11-05 11:27:14 +01:00
Nicolò Ribaudo
cdbffe3990 Remove --require-scripts from publish-ci [skip ci] 2019-11-05 11:25:29 +01:00
Huáng Jùnliàng
b114486bc1 Traverse performance (#10480)
* perf: remove this.inList assignment

* perf: convert NodePath.parentKey into accessor function

* perf: compress shouldSkip/shouldStop/removed traverse flags

* perf: lazy initialize this.skipKeys

* perf: lazily initialize NodePath.data

* add code comments before bit operations

* remove unused typeAnnotation property

# Conflicts:
#	packages/babel-traverse/src/path/index.js

* early return when visitor keys are empty
2019-11-05 11:11:58 +01:00
Nicolò Ribaudo
e9c1bce50f Add support for TS declare modifier on fields (#10545)
* [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
2019-11-05 10:56:57 +01:00
Nicolò Ribaudo
87feda7c2a @babel/parser error recovery (#10363)
* 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 ??
2019-11-05 10:15:00 +01:00
Nicolò Ribaudo
d25262ec4b Correctly delegate .return() in async generator (#10422)
* Correctly delegate .return() in async generator

* Add catch param

* minNodeVersion

* Add another test
2019-11-05 00:35:40 +01:00
Nicolò Ribaudo
861844761f [preset-env] Don't use async-to-generator when already using re… (#9481)
* [preset-env] Don't use async-to-generator when already using regenerator

* Add tests

* Update fixtures
2019-11-04 22:53:53 +01:00
Nicolò Ribaudo
43aa7e262c Don't throw when destructuring into a var named as an import (#10628) 2019-11-04 22:50:36 +01:00
Huáng Jùnliàng
5e24016623 fix: remove ExportNamedDeclaration when the specifier is empty (#10638) 2019-11-04 21:51:24 +01:00
Nicolò Ribaudo
d023e105b7 [TS] Parse calls with type args in optional chains (#10631)
* [TS] Parse calls with type args in optional chains

* Test output
2019-11-04 13:25:15 -05:00
Nicolò Ribaudo
abce0ef49d [TS] Correctly transform computed strings and templates in enums (#10555)
* [TS] Correctly transform computed strings and templates in enums

* Typo [skip ci]
2019-11-04 13:22:49 -05:00
Chris Garrett
5c0d8a9de7 add legacy decorators support to strict class fields (#10616)
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.
2019-11-04 13:05:42 -05:00
Nicolò Ribaudo
bea1b0d0af Add support for .cjs config files (#10599)
* Remove duplicate config loading logic and errors

* Add support for .cjs config files

* Add tests

* [tests] Fallback for fs.promises on node 6
2019-11-04 00:24:44 +01:00
Mohammad Ahmadi
58a646be59 corrected the grammar of option descriptions (#10589)
* corrected the grammar of option descriptions

* added comment
2019-11-04 00:24:00 +01:00
Martin Forsgren
c7d8b8a377 throw a TypeError if identifier validation fails (#10621)
* throw a TypeError if Identifier validation fails

* Relax identifier validation, reserved words are ok
2019-11-02 12:04:16 +01:00
Huáng Jùnliàng
d08702c9d2 inputSourceMap should work when it is in an external file (#10623)
* fix: construct comment block for fromMapFileComment

* add test

* small tweak: redundant capturing group
2019-10-31 16:12:44 -04:00
Huáng Jùnliàng
a2b5437b01 chore: remove output-file-sync dependency (#10619) 2019-10-31 11:51:36 -07:00
Linus Unnebäck
0b0edc3e3d chore: bump source-map-support to 0.5.16 (#10615) 2019-10-30 07:56:52 -04:00
Huáng Jùnliàng
e419e5fe42 chore: bump source-map-support to 0.5.14 (#10614) 2019-10-29 19:19:16 -04:00
Nicolò Ribaudo
4e6a4b08bb Create @babel/plugin-syntax-top-level-await (#10573) 2019-10-29 23:27:56 +01:00
Ivan Medina
3d2f365074 [transform-react-jsx] Add useSpread option to transform JSX (#10572)
* [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>
2019-10-29 23:02:53 +01:00
Huáng Jùnliàng
8ffca0475a Merge multiple regex transform plugin (#10447)
* 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
2019-10-29 22:58:04 +01:00
George Zahariev
ec3345bb57 Flow enums parsing (#10344)
* 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
2019-10-29 22:55:12 +01:00
Vivek Nayyar
4b3a19ea9f fixed missing errors on assignment pattern in object expression (#10607)
* 🐛 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
2019-10-29 22:32:02 +01:00
Micah Zoltu
198b4a0fbd Changes UMD callsite to be more likely to pass in the intended… (#10477)
* 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
2019-10-29 22:19:49 +01:00
Nicolò Ribaudo
143d159982 Create parser plugin "topLevelAwait" (#10449)
* Create parser plugin "topLevelAwait"

* Update test262 whitelist

* Update ts typings

* Fix "sourceType: unambiguous" with TLA

* Ambiguous tokens after await

* Update await %x(0)

* typo [skip ci]

* Typo [skip ci]

Co-Authored-By: Brian Ng <bng412@gmail.com>
2019-10-29 22:18:39 +01:00
Georgii Dolzhykov
63f9a3c946 rename assertsModifier to asserts (#10613)
see https://github.com/babel/babel/pull/10543#issuecomment-547571501
2019-10-29 16:25:42 -04:00
Devon Govett
3a5e8a8dd4 Add support for babel.config.json (#10501)
* Add support for babel.config.json root config

* Throw if multiple configuration files are found

* Add tests
2019-10-29 19:37:50 +01:00
Tan Li Hau
38a3063111 add assertions signature for TypeScript (#10543)
* add asserts predicate

* fix flow

* babel-generator for typescript assertions

* babel-types for typescript assertions

* asserts modifier as boolean
2019-10-29 18:51:33 +01:00
Nicolò Ribaudo
4cd93ab5f3 [parser] Enable "exportNamespaceFrom" by default (#10521) 2019-10-29 18:44:32 +01:00
Eugene Myunster
d248e2d188 moving proposalNullishCoalescingOperator and proposalOptionalChaining to stage 3 (#10590) 2019-10-29 18:44:01 +01:00
Nicolò Ribaudo
f47fbd5f39 Nit: Use ?. in the example used by the proposal readme (#10604) 2019-10-29 18:35:15 +01:00
Bogdan Chadkin
be0fcaaf49 Make dir for babel --out-file (#8622)
* 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
2019-10-29 18:29:45 +01:00
彭驰
4e5ac1fd5c Fix #8326, add back --quiet option. (#10399)
* Fix issue #8326, quiet the @babel/cli with --quiet cli option.

* --quiet and --verbose options now conflict with each other.
2019-10-29 18:28:52 +01:00
Nicolò Ribaudo
1d1fab4ea2 [parser] Add support for private fields in TypeScript (#10483)
* [parser] Add support for private fields in TypeScript

* Fix flow
2019-10-29 18:27:54 +01:00
Simen Bekkhus
f1bc6c4e18 feat: if code frame error is on a single line, highlight the w… (#10361)
* feat: if code frame error is on a single line, highlight the whole path

* flow
2019-10-29 18:23:54 +01:00
gr
b6ef9689b2 [parser] Parse only modifiers of actual methods (#10594)
* Parse only modifiers of actual methods

* Throw question token if is used before the real name
2019-10-29 17:56:05 +01:00
Huáng Jùnliàng
01927babe2 chore: update web.immediate support fixtures (#10612) 2019-10-29 16:23:59 +01:00
Mateusz Burzyński
9ada30c207 Use .find instead of .filter to get targetPath in ImportInjector (#10608) 2019-10-27 15:09:03 -04:00
ExE Boss
43065a9e24 fix(babel‑helpers/interopRequireWildcard): Avoid double nullis… (#10585)
* fix(babel‑helpers/interopRequireWildcard): Avoid double nullish check

* Update fixtures
2019-10-24 23:14:44 +02:00
Brian Ng
fce1b74105 Test node@13 on CircleCI (#10600) 2019-10-24 09:28:01 -04:00
Huáng Jùnliàng
562b6c3bbb chore: replace outdated travis-ci.org badges [ci skip] (#10593) 2019-10-22 21:35:02 -04:00
Huáng Jùnliàng
1770dace34 chore: test against Node.js 13 (#10591) 2019-10-23 00:23:20 +02:00
Matthew Whitworth
5b40845afe add test and fix for string literal case (#10578) 2019-10-21 17:39:03 +02:00
samuel kwok
fe258dec04 fix: _interopRequireWildcard should only cache objects (#10574)
* fix: [#10561] _interopRequireWildcard should cache object only

* fix: narrow down cache restriction to object/function type

* test: add interop require null module case
2019-10-19 12:01:38 +02:00
Nicolò Ribaudo
78cd63d9cf Fix invalid test layout in @babel/parser 2019-10-18 11:16:17 +02:00
Nicolò Ribaudo
43b623c1f1 [traverse] Allow skipping nodes inserted with .replaceWith() (#9777)
* Avoid regression
2019-10-18 00:16:35 +02:00
Daniel Arthur Gallagher
b5b8055cc0 docs: add homepage link to @babel/runtime package.json (#10418)
* 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
2019-10-17 23:26:14 +02:00
Jaideep Bhoosreddy
da9c9a64c2 Add master branch workflow for test262 tests (#10556)
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>
2019-10-17 13:52:31 -04:00
Huáng Jùnliàng
8c94b3f209 Bump babel-types to ^7.6.3 (#10568)
* fix incorrect lerna bootstrap options

* chore: bump @babel/types dependencies to v7.6.3

* chore: remove ignore-engines on lerna bootstrap
2019-10-17 07:49:41 -04:00
gr
095f28a913 fix: Exclude catch clause from let identifier error (#10559)
* 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>
2019-10-17 09:30:36 +02:00
Huáng Jùnliàng
487f10f84d fix: disable caching when babel could not read/write cache (#10557)
* 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
2019-10-17 09:30:01 +02:00
piotr
5800fc97b3 [parser] Exception to 8 and 9 in tagged template (#10567) 2019-10-17 00:01:22 +02:00
Nicolò Ribaudo
2254542010 Don't use deprecated "lerna publish --require-scripts" (#10558) [skip ci] 2019-10-16 22:13:21 +02:00
Brian Ng
d234ff6572 Revert "chore: introduce envinfo into environment section (#10553)" (#10564)
This reverts commit 800eccc046.
2019-10-16 10:56:35 -04:00
Huáng Jùnliàng
800eccc046 chore: introduce envinfo into environment section (#10553)
* chore: introduce envinfo into environment section [skip ci]

* Apply suggestions from code review

Co-Authored-By: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>

* Address review comments from Nicolò

* Update .github/ISSUE_TEMPLATE/Bug_report.md [skip ci]

Co-Authored-By: Brian Ng <bng412@gmail.com>

* chore: simplify issue template [skip ci]
2019-10-16 09:12:13 -05:00
Gerald
cd5d3abc32 fix: String#italics is incorrectly defined in babel-preset-env (#10563) 2019-10-16 09:23:47 -04:00
Nicolò Ribaudo
272d85d0ad Inject core-js@3 imports in Program:exit instead of on post() (#10146)
* 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>
2019-10-15 23:46:10 +02:00
Nicolò Ribaudo
686186cabc Attemp fixing @babel/node and cli errors on Travis on Windows (#10547)
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
2019-10-15 23:00:23 +02:00
Alejandro Sánchez
06313a6288 Allow duplicate __proto__ keys in patterns, simple case (#6705) (#10532)
* 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
2019-10-15 00:18:33 +02:00
Huáng Jùnliàng
dcf7d89b8e fix: remove filename annotation in buildCodeFrameError (#10539) 2019-10-14 18:19:55 +02:00
Nicolò Ribaudo
1b19608a5a Update fixtures for core-js new version 2019-10-14 00:59:02 +02:00
Brian Ng
e28c8ac612 Fix generator missing parens around an arrow returning function type (#10519) 2019-10-11 21:22:42 -04:00
Nicolò Ribaudo
99035ca96e Don't use args rest/spread to hoist super method calls (#9939)
* 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
2019-10-11 10:18:54 +02:00
Babel Bot
c455d2af86 Add v7.6.4 to CHANGELOG.md [skip ci] 2019-10-10 14:30:50 +00:00
Nicolò Ribaudo
a422ea64ee v7.6.4 2019-10-10 16:25:04 +02:00
Nicolò Ribaudo
34d30e28d6 Revert "chore: Upgrade source-map to 0.6.1 (#10446)" (#10536)
This reverts commit cc080417b9.
2019-10-10 09:03:49 -05:00
Huáng Jùnliàng
3ad4c70d3a fix prepublish-build (#10530) 2019-10-09 07:40:02 +02:00
Nicolò Ribaudo
34937f13d5 Trailing comma after rest - The final fix (#10491)
* [parser] Track trailing commas in extras instead of state

* Update existing tests

* Update test262 whitelist

* Improve error message and location

* nit

* Use lookaheadCharCode
2019-10-08 23:08:50 +02:00
Babel Bot
c7add11fdc Add v7.6.3 to CHANGELOG.md [skip ci] 2019-10-08 19:33:00 +00:00
Nicolò Ribaudo
d329156ebc v7.6.3 2019-10-08 21:31:40 +02:00
Nicolò Ribaudo
25b35261ca Update test262 [skip ci] 2019-10-08 20:39:07 +02:00
Huáng Jùnliàng
563874c06c Do not remove let bindings even they are wrapped in closure (#10343)
* 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
2019-10-08 19:43:12 +02:00
Tan Li Hau
b0acfb24dd add scope to TSModuleDeclaration (#10119) 2019-10-08 19:35:40 +02:00
Nicolò Ribaudo
599d2ff324 Update yarn.lock [skip ci] 2019-10-08 19:16:36 +02:00
Huáng Jùnliàng
0856618ed5 perf: replace lookahead by lookaheadCharCode (#10371)
* perf: replace lookahead by lookaheadCharCode

* fix: flow ignore

* refactor: add nextTokenStart method

* refactor: duplicated isNewLine code

* refactor: remove lookahead usage from babylon core
2019-10-08 19:09:05 +02:00
Jessica Franco
bc0966a46f Add declarations for more of @babel/types exports (#10504)
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.
2019-10-08 19:07:57 +02:00
Nicolò Ribaudo
3498195ae2 Do not hoist jsx referencing a mutable binding (#10529) 2019-10-08 18:50:03 +02:00
Henry Zhu
fbf3cb0ac4 Misc: also lock old PRs [skip ci] (#10524) 2019-10-03 15:46:07 -05:00
Brian Ng
e6264a0992 Bump jest@24.9.0 (#10520) 2019-10-02 18:32:34 -05:00
Huáng Jùnliàng
0b37ab0362 Use make -j for parallel build (#10506)
* 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
2019-10-03 00:17:04 +02:00
Brian Ng
57ae306457 Bump flow@0.108.0 (#10516) 2019-10-02 12:13:58 -05:00
David J. Hamilton
fa5a40c8d5 assertNoDuplicates throw with more context (#10419)
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
2019-10-02 16:45:03 +02:00
Nicolò Ribaudo
a219b6de7a Disallow await inside async arrow params (#10469)
* Disallow await inside async arrow params

* Use -1 as default for awaitPos/yieldPos
2019-10-02 07:37:40 +02:00
Huáng Jùnliàng
fa5057f9fb Flow: interface identifier should be declared in the scope (#10220)
* 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
2019-10-02 07:32:42 +02:00
Brian Ng
02f2d17e83 Revert "Try different name for used-by feature again [skip ci]" (#10515)
This reverts commit b351f29033.
2019-10-01 23:29:04 -04:00
Henry Zhu
b351f29033 Try different name for used-by feature again [skip ci] (#10513) 2019-10-01 21:36:22 +02:00
Huáng Jùnliàng
298c9a6c33 Add filename to transform error (#10511)
* polish: use “unknown” as a default filename in buildCodeFrameError

* feat: add filename to transform error

* fix: incorrect warning message

* fix: add filename to generate phrase error message

* address review comment from Nicolò
2019-10-01 17:19:29 +02:00
Nicolò Ribaudo
80d99b4d4e Do not allow member expressions to start async arrows (#10332)
* Do not allow member expressions to start async arrows

* Boolean -> boolean
2019-10-01 11:40:42 +02:00
Huáng Jùnliàng
94fcabc4e3 Update test262 whitelist 2019-09-30 11:37:09 -04:00
Huáng Jùnliàng
5f1970433d chore: only apply lazy cjs module transform on cli and core (#10443) 2019-09-27 16:53:27 -04:00
Nicolò Ribaudo
b459f6a0a4 Add windows to travis (#10249)
* 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`
2019-09-26 20:59:17 +02:00
Michael J. Currie
66062c2a8c Template literal validation (#10492)
* add template literal validation

* avoid null/undefined error when validating

* simplify validation logic and fix tests

Co-authored-by: Michael J. Currie <michaeljcurrie136@gmail.com>
2019-09-26 19:58:36 +02:00
Phoenix
8d4f95de45 Fix grammar in doc/design/monorepo.md 🤓 (#10496) [skip ci] 2019-09-26 12:37:15 +02:00
Nicolò Ribaudo
d0f093e716 Update test262 whitelist 2019-09-25 02:03:58 +02:00
Gonzalo Rodríguez
490798a26d [parser] Disallow numeric separators in legacy octal like inte… (#10493)
* Disallow numeric separators in lols

* Update whitelist

* Rename test

* Better syntax when checking
2019-09-25 01:32:50 +02:00
Nicolò Ribaudo
eaa1474541 Enable optional chaining and nullish coalescing plugins (#10494)
* Add optional chaining plugin

* Nullish coalescing
2019-09-24 23:11:56 +02:00
Nicolò Ribaudo
0e9502685a [parser] Don't crash on comment after trailing comma after eli… (#10490) 2019-09-24 17:08:58 +02:00
Huáng Jùnliàng
26be14b24d chore: add access: public where missing (#10489) [skip ci]
* @babel/types
* @babel/plugin-transform-named-capturing-groups-regex
2019-09-24 14:04:54 +02:00
Huáng Jùnliàng
6f3460c767 chore: add access: public to babel parser publish config (#10487) [skip ci] 2019-09-24 10:03:07 +02:00
Corey Farrell
cc080417b9 chore: Upgrade source-map to 0.6.1 (#10446) 2019-09-24 02:01:32 +02:00
Nicolò Ribaudo
a00f371610 Update v7.6.2 changelog [skip ci] 2019-09-23 23:27:03 +02:00
Babel Bot
af66d521bd Add v7.6.2 to CHANGELOG.md [skip ci] 2019-09-23 21:16:32 +00:00
Nicolò Ribaudo
b9cb4af953 v7.6.2 2019-09-23 23:14:37 +02:00
Gonzalo Rodríguez
69d00dc5b0 [parser] Invalid NonOctal Decimal (#10467)
* 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
2019-09-23 23:07:52 +02:00
Ivan Medina
f339d2d034 [parser] Disallow numeric separator in unicode scape sequences (#10468)
* [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
2019-09-23 22:47:18 +02:00
Nicolò Ribaudo
3069747a81 Leave trailing comments after handling a possible trailing com… (#10445)
* Leave trailing comments aftre handling a possible trailing comma

* perf
2019-09-23 19:14:43 +02:00
Tomer Aberbach
962015f7e7 docs: updates docs of findParent and find (#10479) [skip ci]
Makes the documentation of `findParent` and `find` consistent and documents their `null` cases.
2019-09-22 23:00:13 +02:00
Vivek Nayyar
b7333ea97a added check to disallow super.private variable access and test case added (#10472)
* 🚀 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
2019-09-21 00:22:37 +02:00
Nicolò Ribaudo
46c70ad734 Update PULL_REQUEST_TEMPLATE.md (#10473) [skip ci] 2019-09-20 11:27:49 -04:00
Nicolò Ribaudo
3a7b6e1c22 Force update of test262-stream
v1.2.0 doesn't support Test262 v4
2019-09-20 12:54:28 +02:00
Guy Waldman
9c1ad0a9f7 [parser] Disallow static fields named constructor (#10461)
* 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
2019-09-18 01:19:45 +02:00
Huáng Jùnliàng
87dc201411 refactor: replace regexp-tree by regexpu (#10430) 2019-09-17 17:38:15 -05:00
Nicolò Ribaudo
0ef4972295 Ignore regexp tests from test262 (#10458) 2019-09-18 00:14:27 +02:00
Nicolò Ribaudo
cb881e6b3f [parser] Report escapes in kws only if they won't be used as i… (#10455)
We can do it by tokenizing escaped keywords as normal identifiers, so that they won't
be accidentally used as real keywords.
2019-09-18 00:13:51 +02:00
Nicolò Ribaudo
45a484f0a2 Enable optional chaining in test262 (#10457) 2019-09-17 12:10:57 -05:00
Nicolò Ribaudo
99f4f6c3b0 Update Test262 (#10448) 2019-09-17 02:14:14 +02:00
Nicolò Ribaudo
e4b4831100 Update GitHub actions to v2 (#10441)
* Update GitHub actions to v2 [skip ci]

* Only run when needed for issues [skip ci]
2019-09-16 22:38:12 +02:00
Huáng Jùnliàng
256fa5aa04 chore: bump regexpu-core to version 4.6.0 (#10439)
* chore: update test fixtures

* chore: test against regexpu-core 4.6.0

* chore: bump regexpu-core dependency
2019-09-13 17:51:24 +02:00
Huáng Jùnliàng
0ee2c42b55 chore: add lint-ts rule (#10427) 2019-09-11 20:24:08 +02:00
Huáng Jùnliàng
1b352ca8a1 chore: remove tryResolve dependency (#10428) 2019-09-11 12:25:18 +02:00
Huáng Jùnliàng
53af9e8b7a fix: allow the process to exit naturally (#10400) 2019-09-11 12:24:44 +02:00
Huáng Jùnliàng
af04f40ee0 fix: pass optionLoc when validating plugin object (#10402) 2019-09-11 12:23:20 +02:00
Bryan Wain
98b14843ba Remove babel polyfill dependency of babel-node (#10429) 2019-09-11 01:57:44 +02:00
Huáng Jùnliàng
4395c22f3a Miscellaneous perf tweak (#10421)
* refactor: early return on hot path

* refactor: read next2 only when next is dot

* perf: mini refactor
2019-09-10 19:47:52 +02:00
Nicolò Ribaudo
610d6bdc62 Do not guess relative execution status for exported fns (#10417) 2019-09-10 19:47:27 +02:00
Tan Li Hau
8027dca501 fix object rest in array pattern (#10275)
* fix object rest in array pattern

* update test fixtures

* early return

* use path.stop() at the right path
2019-09-10 15:18:45 +02:00
Huáng Jùnliàng
81831032c3 chore: remove trim-right dependency (#10420) 2019-09-10 15:17:22 +02:00
FND
daf25af47c Fix typo in changelog (#10409) [skip ci]
s/compliancy/compliancy/g - seems both correct and consistent with more
recent occurrences
2019-09-09 09:22:33 +02:00
Nicolò Ribaudo
6a5cee8f27 Remove circular dependency (#10405)
* Remove circular dependency

* Move @babel/runtime test to @babel/runtime
2019-09-08 22:53:42 +02:00
Nicolò Ribaudo
2096d0cfcb Update @babel deps (#10407)
* Update @babel deps

* Add core-js to transform-named-capturing-groups-regex devDeps

* Don't use fixed deps (they were added by yarn)

* Lockfile
2019-09-08 22:53:20 +02:00
Babel Bot
a79fbe62e4 Add v7.6.1 to CHANGELOG.md [skip ci] 2019-09-06 20:55:50 +00:00
Nicolò Ribaudo
381b066bd0 v7.6.1 2019-09-06 22:50:54 +02:00
Matt Forster
15b63bc89e fix(types): correct typescript function headers (#10404)
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
2019-09-06 22:38:21 +02:00
Dword
fc8e14264c Remove process.exit(1) from babel-node (#9758)
Because it breaked graceful shutdown of the sub process.
2019-09-06 14:32:45 -04:00
Babel Bot
7e4f48139c Add v7.6.0 to CHANGELOG.md [skip ci] 2019-09-06 17:36:19 +00:00
Nicolò Ribaudo
cbd5a26e57 v7.6.0 2019-09-06 19:25:16 +02:00
Nicolò Ribaudo
42e5974fd4 Remove old uglify option
It's false by default
2019-09-06 19:24:15 +02:00
Nicolò Ribaudo
735abc0ed8 Update lerna
v3.16 includes https://github.com/lerna/lerna/pull/2185,
which fixes an issue we had in the v7.5 releases
2019-09-06 18:40:06 +02:00
Corey Farrell
aa7678f32a Remove core-js from @babel/register. (#9847)
This module doesn't use core-js at all.
2019-09-06 18:11:38 +02:00
Huáng Jùnliàng
b64cb9aaf1 fix: early return when instance is not iterable (#10396)
* fix: early return when instance is not iterable

* chore: update test fixtures

* fix: gaurd against arguments for old browsers
2019-09-06 18:09:57 +02:00
Huáng Jùnliàng
8da9d8b4b8 feat(errors): validate preset when filename is absent (#10181)
* feat(errors): validate preset when filename is absent

Closes #10154

* fix: test overrides for filename compulsory

* docs: rewrite validate error message

per https://github.com/babel/babel/pull/10181#discussion_r301607986

* polish error message
2019-09-06 18:09:19 +02:00
Tim McClure
3e4889d649 Class Private Static Accessors (#10217)
* Remove error for static private accessors

* Private static accessors strict

* Add loose mode support

* Move `value` decl for early return

* Reuse getter/setter template

* Reuse getter/setter templates

* Use `buildUndefinedNode` in accessor templates

* Extract `isAccessor` variable
2019-09-06 18:08:10 +02:00
Huáng Jùnliàng
da0af5fd99 V8intrinsic syntax plugin (#10148)
* 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
2019-09-06 17:43:19 +02:00
Vivek Nayyar
b02e35c19a Fix parenthesis for nullish coalescing (#10269)
* ♻️ 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
2019-09-06 17:35:44 +02:00
Nicolò Ribaudo
3e8a5c5e28 Use "validateLogs" for preset-env's debug fixtures (#10401)
* Add ability to ignore output to the test runner

* Use normal fixtures instead of custom debug-fixtures in preset-env
2019-09-06 17:32:20 +02:00
Bin Xin
8769903284 Add supports for polyfill computed methods (#10398) 2019-09-06 01:35:03 +02:00
Bin Xin
5c859b1117 Don't polyfill if evaluation is not confident (#10397) 2019-09-06 00:29:19 +02:00
Huáng Jùnliàng
2e7bea4a6a fix: transform name capturing regex once (#10395)
* 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
2019-09-05 17:35:57 +02:00
Bin Xin
29734b924a Don't allow instance properties transformation on namespace (#10372) 2019-09-05 10:32:57 -05:00
Huáng Jùnliàng
6813ee02d7 chore: update regexp-tree to version 0.1.13 (#10376) 2019-09-05 10:07:18 -05:00
Adam Ramberg
fcb77de901 [preset-env] Include / exclude module plugins properly (#10218)
* Include / exclude module plugins properly

* Use filter-items to excl / incl module plugins

* Move transform selection to getModulesPluginNames

* Remove unnecessary spread operator

Co-Authored-By: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>

* Adjust tests to changes in #10218
2019-09-05 15:58:29 +02:00
Ajay Sagar
d05bd9edc8 Bumped chokidar dependency of babel-cli to 2.1.8 (#10394) 2019-09-04 21:33:31 -04:00
Nicolò Ribaudo
27ba292774 Silence remaining test warnings (#10392) 2019-09-04 22:56:47 +02:00
Tan Li Hau
a08e856804 fix typescript for babel-types (#10098)
* fix typescript for babel-types

* fix missing typescript/flow types for babel-types

* Add cloneNode to flow.js

* Add cloneNode to typescript.js
2019-09-04 15:35:19 +02:00
Shrey Banga
c0e3fa0081 Refactor trailing comma comment adjustment (#10380)
* 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
2019-09-02 20:35:15 -04:00
Dylan Kirkby
e5afa57cca Allow setting 'allowNamespaces' in typescript preset (#10382)
* Support 'allowNamespaces' in typescript preset

* Remove default for allowNamespaces
2019-09-02 20:33:01 -04:00
Thiago Arrais
e7fa566442 Includes test for #8354 (#10385) 2019-09-02 21:58:54 +02:00
Nicolò Ribaudo
7c0333e12a Move preset-env old changelog
Fixes #9730
2019-09-02 12:41:55 +02:00
Shrey Banga
8a775a32ba Retain trailing comments in array expressions (#10369)
* 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
2019-08-28 14:03:37 -04:00
dependabot[bot]
94e47c30a9 Bump eslint-utils from 1.4.0 to 1.4.2 (#10370)
Bumps [eslint-utils](https://github.com/mysticatea/eslint-utils) from 1.4.0 to 1.4.2.
- [Release notes](https://github.com/mysticatea/eslint-utils/releases)
- [Commits](https://github.com/mysticatea/eslint-utils/compare/v1.4.0...v1.4.2)

Signed-off-by: dependabot[bot] <support@github.com>
2019-08-27 09:50:33 +02:00
Justin Ridgewell
1664cce681 Don't allow JSXNamespacedName to chain (#10366)
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.
2019-08-26 13:16:22 -04:00
Nicolò Ribaudo
a2bf68981f Add TSBigIntKeyword to @babel/types (#10341) 2019-08-20 17:31:45 -05:00
Nicolò Ribaudo
15aa511b8e Do not register ambient classes to the TS scope (#10352) 2019-08-20 17:22:47 -05:00
Henry Zhu
11ed2e2bf5 readme: links/contributing updates (#10206) [skip ci]
* readme: links/contributing updates

* Update README.md
2019-08-19 09:31:37 +02:00
Even Alander
eb3767d58b Add a builder definition including name for tsTypeParameter (#10319) 2019-08-15 19:59:08 +02:00
Nicolò Ribaudo
f0c2364d01 Do not delete "fake" source map comments from strings (#9960)
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
2019-08-14 17:05:55 +02:00
Huáng Jùnliàng
ee344c3e4c Revert "chore: remove FORCE_COLOR workaround" (#10336)
This reverts commit 347ee036becdca3c9e158311d44a48ed89df9a94.
2019-08-14 16:58:01 +02:00
Ziad El Khoury Hanna
64041e1669 Fix flow comments plugin issues (#10329)
* 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
2019-08-14 15:46:26 +02:00
Nicolò Ribaudo
469a5a71cd Allow testing logs with @babel/helper-transform-fixture-test-runner (#10326)
* 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
2019-08-14 08:03:03 +02:00
Huáng Jùnliàng
75090f10e5 fix: assign comment to ObjectProperty only when inside an ObjectExpression (#10292)
Fixes #10230
2019-08-13 13:49:16 -05:00
Huáng Jùnliàng
22df2ae244 Commit generated code (#10331)
* update prettier generated artifacts

* chore: sync babel-helpers to artifacts
2019-08-13 16:31:28 +02:00
Nicolò Ribaudo
051965052c Update @lerna/collect-updates git hash 2019-08-13 12:03:34 +02:00
Thiago Arrais
ee397ff107 Adds note about two approval policy to PR template (#10313)
* 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]
2019-08-12 17:32:31 +02:00
Huáng Jùnliàng
15535cf52c Update preset-env text fixtures (#10318)
* chore: update preset-env text fixtures

* chore: remove FORCE_COLOR workaround
2019-08-12 00:55:27 +02:00
README Bot
682d9f9f09 Add CodeTriage badge to babel/babel (#10088) [skip ci]
Adds a badge showing the number of people helping this repo on CodeTriage.

[![Open Source Helpers](https://www.codetriage.com/babel/babel/badges/users.svg)](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:

- [![Email clients like GMAIL do not render SVG images](https://www.codetriage.com/rails/rails/badges/users.svg)](https://www.codetriage.com/rails/rails) https://github.com/rails/rails
- [![Email clients like GMAIL do not render SVG images](https://www.codetriage.com/crystal-lang/crystal/badges/users.svg)](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.
2019-08-09 19:18:18 +02:00
Serge Havas
a112be2fa0 [fix] jsx helper calls order (#10307)
imitate properly react createElement calls order
2019-08-08 22:43:57 +02:00
ifsnow
9ec26a7d3e Improves the logic to import objects in helpers (#10161)
* 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
2019-08-08 11:11:50 +02:00
Thiago Arrais
ba2c0f7adf fix: register inserted class declaration (#10302)
* Decorators legacy: register inserted declaration

For compatibility with the Typescript plugin

Fixes #10264

* Register declaration but also keep replaceWithMultiple
2019-08-08 07:14:23 +02:00
Huáng Jùnliàng
5fb4d84a33 perf: always return void 0 as undefined node (#10243) 2019-08-01 09:53:40 +02:00
Tan Li Hau
3e4a9d588b Do expressions transform for switch statements (#10070)
* 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
2019-08-01 09:36:35 +02:00
Tan Li Hau
be2cbde560 remove finally from completion record in trystatement (#10277) 2019-08-01 09:24:08 +02:00
Ashwin Ramaswami
66727632e8 fix: replace es.string.reverse with es.array.reverse (#10284) 2019-08-01 09:20:52 +02:00
Brian Donovan
ba28f462bc Fix typo "to" → "so". (#10288) 2019-07-31 16:04:53 -04:00
Huáng Jùnliàng
f08062b1de chore: fix ESLint errors (#10278) 2019-07-29 10:14:11 -05:00
Daniel Tschinder
4f0840ab88 Update dev dependencies and fix linting errors (#10228)
* chore: Uppate dev dependencies

* chore: Fix lint errors

* chore: Format options.json files

* chore: Fix stupid flow errors

* Update test262 whitelist

Seems test262-stream was updated and now these tests work.
2019-07-27 15:09:30 +02:00
Tan Li Hau
6a9d2538e0 fix capturing group for matchAll (#10136)
* fix capturing group for matchAll

* update test case

* add core-js/features/string/match-all to test
2019-07-26 18:53:22 -04:00
Letladi Sebesho
f160522ab0 updated ParsePlugin type definition (#10259)
* added 'placeholders', 'logicalAssignment', 'partialApplication' to the ParserPlugin type. closes #10186

* put the ParserPlugin names in alphabetical order
2019-07-26 10:22:23 +02:00
Serhii Muryhin
4d30379d36 Add ";" token to the end of TS construct & call signature declaration (#10258)
* 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
2019-07-25 10:14:35 +02:00
Letladi Sebesho
4d12c8971b added flow to babel cli (#10244)
* added flow to babel cli

* added 'SourceMapGenerator' as a argument to 'fromObject'
2019-07-25 09:59:41 +02:00
Yuri Karadzhov
4506590557 Add static parameter to class property builder (#10248) 2019-07-25 09:55:03 +02:00
Brian Donovan
1e7ed5c461 Add allowUndeclaredExports option to typings. (#10263)
This should have been included in https://github.com/babel/babel/pull/9864 but was not.
2019-07-25 09:53:56 +02:00
Nicolò Ribaudo
fced5cea43 Fix tdz checks in transform-block-scoping plugin (#9498)
* 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
2019-07-21 06:34:43 +02:00
Nicolò Ribaudo
9bc9571381 Extract release actions to babel/actions 2019-07-20 16:43:22 +02:00
Nicolò Ribaudo
fb910e063c [gh action] Release on tag push 2019-07-20 16:39:10 +02:00
Daniel Tschinder
3b4a86aea4 Separate workflows as otherwise they interfere with eachother 2019-07-20 15:26:52 +02:00
Daniel Tschinder
94b678c949 Fix workflow 2019-07-20 15:22:21 +02:00
Daniel Tschinder
c84a4c8bfa Use latest version of filter action 2019-07-20 15:14:07 +02:00
Daniel Tschinder
dfd59c183e Add 'Needs Info' workflow 2019-07-20 15:13:29 +02:00
Nicolò Ribaudo
718017d896 Use "release" event instead of "push" 2019-07-20 14:30:33 +02:00
Daniel Tschinder
a0cb7b1ab1 Rename github action 2019-07-19 15:46:51 +02:00
Daniel Tschinder
0b886418c8 Use github actions for welcome comment 2019-07-19 14:44:40 +02:00
Babel Bot
0371979a3e Add v7.5.5 to CHANGELOG.md [skip ci] 2019-07-17 21:29:47 +00:00
Nicolò Ribaudo
0407f034f0 v7.5.5 2019-07-17 23:08:08 +02:00
Nicolò Ribaudo
d919ecd254 Move lerna fork to the babel org 2019-07-17 00:02:41 +02:00
Daniel Tschinder
d8da63c929 Use correct extension for typescript fixtures (#10014)
* Use correct extension for typescript fixtures

* Change transform fixtures

* Adjust editorconfig for ts files

* Rename new tests

Co-authored-by: Nicolò Ribaudo (nicolo.ribaudo@gmail.com)
2019-07-15 22:46:03 +02:00
Tan Li Hau
eb3230f9db fix code-frame marker with highlighting (#10211) 2019-07-15 21:16:18 +02:00
Nicolò Ribaudo
7dc5fdb390 Workaround #10179 in proposal-object-rest-spread (#10200) 2019-07-15 19:01:29 +02:00
Tan Li Hau
ee68d6d1b0 add assertShape to validate templateElement (#10198)
* add assertShape to validate templateElement

* Update packages/babel-types/src/definitions/utils.js

Co-Authored-By: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>

* templateElement optional cooked
2019-07-15 01:03:50 +02:00
Tan Li Hau
d3fe22f0e1 destructuring private fields with array pattern / object patte… (#10017)
* 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
2019-07-15 01:00:20 +02:00
James DiGioia
7f47cb65d0 Add Pipeline nodes to ast.spec [skip ci] (#10214) 2019-07-13 19:11:51 +02:00
Tan Li Hau
8b9af1be2f fix transform-flow-comments for import types (#9901)
* fix transform-flow-comments for import types

* update: dependencies
2019-07-13 16:06:42 +02:00
Tan Li Hau
f5ca0587d1 always throw when add missing helpers (#10208) 2019-07-12 12:53:55 -05:00
Sagiv ben giat
a9660cf559 resolve #10205 (#10207) 2019-07-12 11:00:25 -05:00
dependabot[bot]
8107a6faa2 Bump lodash.template from 4.4.0 to 4.5.0 (#10204)
Bumps [lodash.template](https://github.com/lodash/lodash) from 4.4.0 to 4.5.0.
- [Release notes](https://github.com/lodash/lodash/releases)
- [Commits](https://github.com/lodash/lodash/compare/4.4.0...4.5.0)

Signed-off-by: dependabot[bot] <support@github.com>
2019-07-12 10:29:48 +02:00
cybai
42000b9907 Upgrade lodash to 4.17.13 (#10191) 2019-07-12 10:29:06 +02:00
Huáng Jùnliàng
5d9a786b2f perf: match ownKeys perf to the one of objectSpread (#10189) 2019-07-10 21:03:01 -05:00
Huáng Jùnliàng
e88a569e83 fix: custom instOfHandler result should be cast to boolean (#10197) 2019-07-10 23:38:46 +02:00
Babel Bot
4eab157502 Add v7.5.4 to CHANGELOG.md [skip ci] 2019-07-09 18:58:16 +00:00
Nicolò Ribaudo
a9a7f4e690 v7.5.4 2019-07-09 20:52:37 +02:00
Nicolò Ribaudo
fa5ec75c43 Fix _objectSpread2 for real (#10188)
* Fix _objectSpread2 for real

* Tests

* Test 2
2019-07-09 20:50:07 +02:00
Babel Bot
b961d39a4d Add v7.5.3 to CHANGELOG.md [skip ci] 2019-07-09 14:52:52 +00:00
Nicolò Ribaudo
759ff4d6df v7.5.3 2019-07-09 16:41:44 +02:00
Nicolò Ribaudo
9e65472377 [_objectSpread2] Do not use hoisted var from prev iteration (#10180) 2019-07-09 16:38:40 +02:00
Babel Bot
25f040caa4 Add v7.5.2 to CHANGELOG.md [skip ci] 2019-07-08 19:53:06 +00:00
Nicolò Ribaudo
0dbf99bedb v7.5.2 2019-07-08 21:46:49 +02:00
Nicolò Ribaudo
f48b47c1f7 Do not trust Scope when removing TypeScript types (#10174)
* Do not trust Scope when removing TypeScript types

* Warn

* Update warning message

Co-Authored-By: Brian Ng <bng412@gmail.com>

* Add test

* Node 6
2019-07-08 21:44:26 +02:00
Nicolò Ribaudo
406a65c894 Don't rely on getOwnPropertyDescriptors in objectSpread2 (#10171) 2019-07-07 11:24:36 +02:00
Huáng Jùnliàng
075a50242d fix: register injected importDeclaration (#10172) 2019-07-06 10:44:14 -05:00
Babel Bot
c777e81e06 Add v7.5.1 to CHANGELOG.md [skip ci] 2019-07-06 08:13:08 +00:00
Nicolò Ribaudo
d0519fa907 v7.5.1 2019-07-06 10:07:59 +02:00
Nicolò Ribaudo
019fbca3f6 Update lerna 2019-07-06 09:57:20 +02:00
Nicolò Ribaudo
24dde2e8e8 Fix objectSpread2 backward compatibility (#10170) 2019-07-06 09:48:36 +02:00
Wesley Wolfe
bff79e198a Retain typescript export-from-source (#10167) 2019-07-05 20:47:55 +02:00
Henry Zhu
106bb41d47 change pkg name back from used-by [skip ci] 2019-07-04 12:30:56 -04:00
Babel Bot
d19f053482 Add v7.5.0 to CHANGELOG.md [skip ci] 2019-07-04 13:00:18 +00:00
Nicolò Ribaudo
49da9a07c8 v7.5.0 2019-07-04 14:52:17 +02:00
Lidor Avitan
b06663320e Update babel-preset-stage (0,1,2,3) readme files (#10111) [skip ci]
* chore: update docs babel-preset-stage readme [ci skip]

* fix:  by PR request change [ci skip]
2019-07-04 12:24:42 +02:00
Tan Li Hau
d50e78d45b fix await and yield for do expression (#10072) 2019-07-03 09:54:39 -05:00
Artem Butusov
5b86353b35 Added es3 backward compatibility for react helper code (#10155)
* Added es3 backward compatibility for react helper code

* tweak comment [skip ci]
2019-07-03 16:49:20 +02:00
Tan Li Hau
f588e4ec47 BigInt type for Flow (#10091)
* flow BigIntLiteralTypeAnnotation

* numericSeparator for flow test plugins

* fix flow tuple

* fix code review
2019-07-03 16:48:46 +02:00
Brian Ng
cbb482e2f9 Bump compat-table and update preset-env mappings (#10127) 2019-07-03 09:37:06 -05:00
Sebastian Johansson
595a349174 Fix incorrect usage of $o instead of %o in debug (#10157)
It would end up printing the literal "$o" instead of the directory name.
2019-07-03 16:04:31 +02:00
Min ho Kim
0bf0ae3410 Fix typos (#10153) 2019-07-03 15:51:48 +02:00
Nicolò Ribaudo
ef3f555be9 Add proposal-dynamic-import to preset-env (#10109) 2019-06-30 13:58:50 +02:00
Nicolò Ribaudo
38f8bbac1a Create @babel/plugin-proposal-dynamic-import (#9552)
* 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
2019-06-30 13:21:46 +02:00
Thiago Arrais
a4170b5e32 Transform for F# Pipeline (#9984)
* Transform for F#-style await

Inludes support for optimizing single-parameter arrow functions

* Wait until optimization before pushing placeholder into scope
2019-06-30 12:53:22 +02:00
James DiGioia
6b8a37c413 Implement f# pipeline in parser (#9450) 2019-06-30 12:53:22 +02:00
Wesley Wolfe
0a98814329 Implement TypeScript namespace support (#9785)
* Add module tests for typescript namespace transform

Fixes #8244, fixes #10038
2019-06-30 12:15:09 +02:00
Nicolò Ribaudo
8bf9714d69 [legacy decorators] Allow decorating generator methods (#9912)
* [legacy decorators] Allow decorating generator methods

The old proposal used LeftHandSideExpression (instead of
AssignmentExpression) to satisfy this usecase:
e240cbc91a

* Update flow whitelist
2019-06-30 11:32:16 +02:00
Nicolò Ribaudo
ca67637da4 [@babel/parser] Add "allowUndeclaredExports" option (#9864)
Ref: https://github.com/babel/notes/blob/master/2019/04/09.md#export-changes-in-scope-pr-break-meteor-issue
2019-06-30 11:16:05 +02:00
Brian Ng
77fd7cd4c4 Allow defaults query in preset-env (#8897) 2019-06-30 11:00:43 +02:00
Tan Li Hau
1d3f9815df fix import typeof in declare module (#10132) 2019-06-26 13:37:16 -05:00
Letladi Sebesho
31fc1d06bc Babel cli test correction (#10128) 2019-06-25 15:38:32 -05:00
Bogdan Savluk
b8bb93a838 fix exportKind declaration in babel-types (#10126)
* fix exportKind types declaration for ExportNamedDeclaration and DeclareExportAllDeclaration in babel-types

* revert `let` in exportKind in babel-parser types
2019-06-25 22:29:38 +02:00
Erik Arvidsson
8f8a457798 Simplify the helpers for classPrivateField{Get,Set} (#10117)
No need to do the hash lookup twice. If the descriptor is not in the
WeakMap `get` returns `undefined`.
2019-06-22 00:23:26 +02:00
Pig Fang
11fa2461ce Disallow "let" as name at lexical bindings (#10099)
* Disallow "let" as name at lexical bindings

* Simplify

* Clean up
2019-06-18 23:17:00 +02:00
Paul Comanici
505b2cc18d Upgrade jest dependency (#10107) 2019-06-18 16:29:51 +02:00
Sven Sauleau
dcdf7c8fdd [skip ci] docs: update readmes (#10103)
Using our READMEs auto generation, two packages were updated.
2019-06-17 10:57:28 +02:00
Tan Li Hau
fdbbb743b6 flow - allow type parameter defaults in function declarations (#10084)
* 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
2019-06-15 12:31:12 +02:00
Letladi Sebesho
6852bf6415 Change duplicate tests for @babel/highlight getChalk method (#10093)
* removed duplicate tests for @babel/highlight getChalk method

* changed second 'getChalk' test case for when colors are not supported
2019-06-15 09:04:35 +02:00
Jamie Kyle
f92c2ae830 Change root package.json#name (#10021)
* 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
2019-06-04 23:57:38 +02:00
Maël Nison
d7801c644c Prevents exception on PnP (#9951) 2019-06-02 00:55:44 +02:00
Mateusz Burzyński
84961ebb05 Refactor isImportTypeOnly helper function (#10047) 2019-05-31 23:54:44 +02:00
Blaine Bublitz
3144ed131a Use FUNDING.yml in babel/.github repo [ci skip] (#10032) 2019-05-30 09:52:43 +02:00
Martin Zlámal
ce4c374924 Fix printer for explicitly inexact Flow types (#10041)
Closes: https://github.com/babel/babel/issues/10040
2019-05-29 21:17:12 +02:00
Wesley Wolfe
8d492b159b Use scope for typescript export removals. Fixes #10033 (#10034)
This also fixes enum not adding the respective declaration to the scope
during the typescript visitation.

Rewrites:

2080042808 #9944

a6392bd636 #10019
2019-05-29 08:36:04 +02:00
Tan Li Hau
b4c9cb0222 Fixed computed keys for class expression (#10029)
* 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]
2019-05-28 23:07:55 +02:00
Kagami Sascha Rosylight
a596da2822 Retry to fix object spread helper compatibility (#9384)
This reverts commit 43b83f8ed7.

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>
2019-05-25 12:57:13 +02:00
Daniel Tschinder
1cfb92d66a Create SECURITY.md (#10018) 2019-05-25 12:46:59 +02:00
Nicolò Ribaudo
888b9f6940 Remove unused code in the TS parser plugin (#10025) 2019-05-25 08:46:01 +02:00
Tan Li Hau
b6486a22cb fix destructuring rest with template literal (#10013)
* fix destructuring rest with template literal

* update test
2019-05-24 00:03:27 +02:00
Airat Aminev
a6392bd636 fix(typescript): erase default export if exporting a TS type (#10019) 2019-05-23 16:58:24 -05:00
Henry Zhu
9dd8825eff Create funding.yml [skip ci] (#10016) 2019-05-23 21:02:16 +02:00
Nicolò Ribaudo
ecf4667305 Add "PR: Performance" label for the changelog (#10011) [skip ci] 2019-05-21 23:17:18 -04:00
Nicolò Ribaudo
87fb6c4a8b Use injectInitialization to generate ts parameter properties (#9610) 2019-05-21 22:28:55 +02:00
Brian Ng
58cf1a7d48 Bump deps (#10007) 2019-05-21 15:10:29 -05:00
Sebastian Silbermann
c96aef17e1 Add #9902 to changelog (#10010) [skip ci] 2019-05-21 21:33:27 +02:00
Babel Bot
fc38638aeb Add v7.4.5 to CHANGELOG.md [skip ci] 2019-05-21 17:49:18 +00:00
Nicolò Ribaudo
33ab4f1661 v7.4.5 2019-05-21 19:38:26 +02:00
Daniel Tschinder
54d257c105 Fix location for optional params in arrow functions (#9998)
* 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
2019-05-21 18:53:13 +02:00
Matthew Robertson
9c06e4ed4d avoid exceptions for control flow (#9974)
* avoid exceptions for control flow

* review feedback: remove conditional because we know it is "<"

* drop tsTryParseTypeArguments method
2019-05-21 17:23:53 +02:00
Daniel Tschinder
f5b8140580 Do not use lookahead when parsing construct signature declarations (#9995) 2019-05-20 23:27:41 -07:00
Daniel Tschinder
0430a48775 Update preset-env dependencies and fix fixtures (#10002)
* Fix fixtures after core-js update

* Update core-js, caniuse and compat-table
2019-05-20 23:27:19 -07:00
Matthew Schupack
45ca6751fa use console.warn for warning (#9992)
* use console.warn for warning

* fix tests
2019-05-18 00:36:18 +02:00
Daniel Tschinder
b1826bf0a0 Only compute Position if not already in state (#9989)
* Only compute Position if not already in state

* Prioritize start locations
2019-05-17 15:32:34 -07:00
Airat Aminev
2080042808 fix(typescript): erase type exports (#9944)
* 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
2019-05-17 07:22:52 +02:00
Daniel Tschinder
3f0590de2a Do not use lookahead when parsing jsx expression containers (#9988) 2019-05-16 17:27:07 -07:00
Daniel Tschinder
5661de5908 Do not use lookahead when parsing imports in declare module in flow (#9987) 2019-05-16 02:31:37 -07:00
Daniel Tschinder
c2d303f8be Do not use lookahead when parsing declare module or declare module.exports in flow (#9985)
* Do not use lookahead when parsing declare module or declare module.exports in flow

* Improve code
2019-05-16 02:31:21 -07:00
Daniel Tschinder
4da7a01aa9 Avoid unnecessary work during lookahead (#9982)
* Do not call pushComment when doing lookahead

* Do no updateContext when doing lookahead

* Do not clone contexts anymore
2019-05-15 17:02:12 -07:00
Daniel Tschinder
47eb1ddfe0 Do not use lookahead when parsing dynamic import or import.meta (#9983) 2019-05-15 16:34:16 -07:00
Nicolò Ribaudo
9febf63882 Fix mobile browsers support in preset-env (#9978)
* Fix mobile browsers support in preset-env

* Update fixtures

* Alias other mobile browsers, since they aren't included by compat-table
2019-05-15 14:05:37 +02:00
Daniel Tschinder
85432e2c44 Remove guardedHandlers from ASTs (#9979) 2019-05-15 03:37:22 -07:00
Nicolò Ribaudo
1969e6b6aa Update regenerator-transform (#9941) 2019-05-07 15:42:12 -04:00
Divyam Bhasin
7942dc0f07 Fixed null error in plugin opts and added a test for it (#9945)
* 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>
2019-05-07 16:23:01 +02:00
Tan Li Hau
354666aa17 fix: allow shebang directive (#9922)
* fix: allow shebang directive

* Update packages/babel-parser/src/plugins/flow.js

* chore: prettier
2019-05-07 16:22:25 +02:00
Nicolò Ribaudo
9e9b62f77a Update regexp-tree (#9940) 2019-05-06 20:11:46 +02:00
Nicolò Ribaudo
5da94bff87 [babel-node] Do not hardcode node flags (#9914) 2019-05-04 23:40:06 +02:00
Sebastian Silbermann
eae7a33316 Fix destructuring assignments being transpiled for edge 15 (#9902)
* Current behavior for preset-env destructuring and edge

* fix(preset-env): destructuring transpiled in edge 15
2019-05-03 23:35:28 +02:00
Pablo Navarro
16e17c560b Add missing space in error messages (#9909) 2019-04-29 19:52:13 +02:00
Nicolò Ribaudo
555d50a08c Generate missing test output 2019-04-26 23:57:06 +02:00
Babel Bot
18ace84b88 Add v7.4.4 to CHANGELOG.md [skip ci] 2019-04-26 21:06:49 +00:00
Nicolò Ribaudo
2c88694388 v7.4.4 2019-04-26 23:00:07 +02:00
Nicolò Ribaudo
4b8546c07d Force publish @babel/runtime-corejs3 [skip ci] 2019-04-26 22:58:38 +02:00
Nicolò Ribaudo
c5b5c83398 Disable "Publish to npm" in the Release workflow (#9911) [skip ci]
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.
2019-04-26 22:44:29 +02:00
Tan Li Hau
277a2620c6 allow directives and other comments before flow pragma (#9891) 2019-04-26 22:23:35 +02:00
Tan Li Hau
ca3c53ae0b fix flow-comments - class type paramters and implements (#9897) 2019-04-26 22:23:13 +02:00
Tan Li Hau
71013088ef fix flow-comment - object destructuring (#9893) 2019-04-26 22:22:41 +02:00
Nicolò Ribaudo
80a5a2e7dd Allow node 12 and test it (#9907) 2019-04-26 20:57:50 +02:00
Nicolò Ribaudo
8ca323e810 Disable chromeforandroid test in preset-env (#9906) 2019-04-26 20:57:13 +02:00
Nicolò Ribaudo
30d507c915 Add TS support to @babel/parser's Scope (#9766)
* [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
2019-04-26 14:19:53 +02:00
Jeff
293f3c98d2 Fix spelling of "Expressions" (#9896) 2019-04-26 11:57:32 +02:00
Nicolò Ribaudo
cf3668779c Always register global bindings as exportable (#9865) 2019-04-26 10:50:12 +02:00
Brian Ng
d7757f6d08 Fix TypeScript readonly error location (#9887) 2019-04-23 10:47:22 -04:00
Daniel Tschinder
bf17871b82 Fix flow types in traverse/path/family and enable flow (#9870) 2019-04-23 10:46:55 -04:00
Tan Li Hau
4198d91b89 Fix: remove constant context type check for TS (#9869) 2019-04-23 10:46:23 -04:00
Devon Govett
338853b5d3 Fix parsing typescript bodiless methods with the estree plugin also enabled (#9890) 2019-04-23 09:20:42 -05:00
Corey Farrell
8ca99b9f09 Fix: PrivateName Identifier should not be isReferenced. (#9861) 2019-04-15 22:05:16 -05:00
Samy Pessé
66be4aa5e3 Prevent JSX pragma detection in transform-typescript from leaking between files (#9798)
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.
2019-04-15 22:46:19 +02:00
Corey Farrell
f31c72f310 Fix handling of class property value this in module transforms. (#9857)
Prevent module transforms from rewriting `this` to `void 0` when found in the values of private class properties.  Add tests to prevent regressions.
2019-04-15 22:45:10 +02:00
Nicolò Ribaudo
e4072752bc Transpile babel-polyfill to es5, instead of targeting node 6 (#9812)
* Transpile babel-polyfill to es5, instead of targeting node 6

* Update babel.config.js
2019-04-15 20:01:16 +02:00
E. van der Valk
165ef29416 Fix typo in cloneNode. (#9832) 2019-04-08 08:59:57 -04:00
Ryo Ota
b4224ed8f3 Update homepage and issue link (#9826) [skip ci] 2019-04-05 13:55:05 +02:00
Henry Zhu
9f5f688385 update sponsors links [skip ci] (#9821) 2019-04-04 11:09:35 -04:00
Nicolò Ribaudo
3edd4e1a82 Update CHANGELOG.md [skip ci] 2019-04-02 21:59:20 +02:00
Babel Bot
f994d6f3ae Add v7.4.3 to CHANGELOG.md [skip ci] 2019-04-02 19:39:25 +00:00
Nicolò Ribaudo
508fde4009 v7.4.3 2019-04-02 21:36:09 +02:00
Nicolò Ribaudo
e82169dcab Enforce publish of previously missed packages (#9811)
* Fix versions of packages which haven’t been released.

* Do not ignore package.json
2019-04-02 21:19:59 +02:00
Denis Pushkarev
00cae77ec7 fix #9232, add some missed modules to noConflict (#9780) 2019-04-02 21:19:34 +02:00
Nicolò Ribaudo
e03eb17c08 [runtime-corejs3] Only polyfill instance methods when it might be needed (#9754) 2019-04-02 21:18:59 +02:00
Daniel Tschinder
9a8a7316ae Do not ignore package.json 2019-04-02 12:01:28 -07:00
Daniel Tschinder
557a8af3bc Fix versions of packages which haven’t been released. 2019-04-02 12:01:19 -07:00
Sven Sauleau
53e0622b54 Merge pull request #9808 from babel/fix-noconflict-babel-polyfill
refactor: unify polyfill with noConflict mode
2019-04-02 18:15:24 +02:00
Sven Sauleau
17e10509c0 refactor: unify polyfill with noConflict mode 2019-04-02 14:00:58 +02:00
Daniel Tschinder
491b0a8e33 Update test262 (#9806) 2019-04-01 21:47:07 -07:00
Daniel Tschinder
bac2781a20 Upgrade lodash to 4.17.11 as all the other packages (#9807) 2019-04-01 21:46:29 -07:00
Daniel Tschinder
c7587c016e Don't accept '\08' or '\09' in strict mode (#9769) 2019-04-01 19:41:50 -07:00
Andrew Anikin
123fdfd314 Fix lazy option of babel-plugin-transform-modules-commonjs (#9802)
* Fix lazy mode of babel-plugin-transform-modules-commonjs (#9447)

* Update output snapshots for lazy mode of babel-plugin-transform-modules-commonjs (#9447)
2019-04-01 07:59:12 +02:00
Mattias Buelens
3c11a4a930 Fix super method call in private instance method calling overridden method (#9801)
* 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
2019-03-31 18:50:29 -04:00
Denis Pushkarev
ae9b25ac69 Add to preset-env ES3 transforms for ES3 targets (#9781)
* add to preset-env ES3 transforms for ES3 targets

* add `transform-reserved-words`

* fix `transform-reserved-words` plugin in `@babel/standalone`
2019-03-30 23:25:12 +01:00
Moti Zilberman
1f5444e96a Destructuring: Fix handling of impure computed keys with object rest (#9416) 2019-03-26 19:11:44 -07:00
Moti Zilberman
f7bfc774ba Destructuring: Fix array unpacking assignments with holes on RHS (#9412)
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
2019-03-27 01:14:21 +01:00
Grégoire Geis
72161a64b2 @babel/traverse: Fix NodePath.getData (#9415)
* @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
2019-03-26 16:58:38 -07:00
Daniel Tschinder
60d7e940e2 Fix merge error 2019-03-26 15:44:16 -07:00
Daniel Tschinder
6bc9e7ebda Correctly check for-in and for-of loop for invalid left-hand side (#9768)
* Correctly check for-in and for-of loop for invalid left-hand side

* Overwrite with env variable
2019-03-26 15:32:14 -07:00
Daniel Tschinder
7f4427432c Parse right-hand-side of for/of as an assignment expression (#9767) 2019-03-25 18:14:56 -07:00
Tan Li Hau
2867bbf195 [typescript] parsing template literal as type (#9748) 2019-03-25 23:21:11 +01:00
Daniel Tschinder
444daf9224 Optimize parseBindingAtom code to get better error messages (#9762) 2019-03-25 14:23:39 -07:00
Daniel Tschinder
d720c6cfff Explicit labels for tokenTypes (#9761)
* Explicit labels for tokenTypes

* Fix test

* Fix test
2019-03-25 14:23:16 -07:00
Daniel Tschinder
aaefc83a6c Allow HTML comments on first line (#9760) 2019-03-25 14:22:57 -07:00
pnowak
3aaafae053 proper feature call isLoose function #9424 2019-03-24 10:21:44 +01:00
Conrad Buck
ff04d3535c Allow coreJS Symbol to be type object (#9756) 2019-03-24 09:47:09 +01:00
Daniel Tschinder
a559397feb Move array reference into for head initializer (#9698)
* Move array reference into for head initializer

* Update packages/babel-plugin-transform-for-of/src/index.js

Co-Authored-By: danez <daniel@tschinder.de>

* Fix tests
2019-03-23 17:57:17 -07:00
Nicolò Ribaudo
d610289812 Set NPM_TOKEN in .npmrc when publishing (#9735) [skip ci]
* Set NPM_TOKEN in .npmrc when publishing [skip ci]

* Update .github/main.workflow
2019-03-24 01:04:44 +01:00
Denis Pushkarev
adb4701e00 Normalize core-js entry points (#9752)
* normalize `core-js` entry points names

* Update packages/babel-preset-env/src/polyfills/corejs3/entry-plugin.js

Co-Authored-By: zloirock <zloirock@zloirock.ru>

* handle windows paths
2019-03-24 01:03:25 +01:00
Daniel Tschinder
ef0722b4b2 Fix compatibility between estree and TS plugin (#9700) 2019-03-23 16:47:50 -07:00
Ludwig Magnusson
419d8052d3 Upgrade browserslist and caniuse in preset-env (#9747) 2019-03-22 12:38:19 -05:00
Maximilian Lackaw
998024e913 Fix wrong minimum dependency version (#9738) 2019-03-21 10:40:55 -07:00
Daniel Tschinder
596eedd3e7 Change babel-boot email 2019-03-21 10:31:52 -07:00
Babel Bot
e93cd9ff50 Add v7.4.2 to CHANGELOG.md [skip ci] 2019-03-21 09:57:37 +00:00
Nicolò Ribaudo
7dea0f23de v7.4.2 2019-03-21 10:55:50 +01:00
Nicolò Ribaudo
de7dd7f015 Mark the core-js warning as such (#9732) 2019-03-21 10:38:21 +01:00
Nicolò Ribaudo
f2c55d01c4 Create drafts instead of finished releases (#9729) [skip ci]
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.
2019-03-21 08:26:10 +01:00
Nicolò Ribaudo
2201fd839b Modules might be in loose mode when checking for undecl exports (#9725) 2019-03-20 17:57:12 -07:00
Brian Ng
7f8ded9851 Tweak preset-env corejs/useBuiltIns warning and error messages (#9716) 2019-03-20 19:47:30 -05:00
Nicolò Ribaudo
bf94bb9d43 Fix typo in wrapRegExp helper (#9726) 2019-03-21 00:18:43 +01:00
Daniel Tschinder
ab41cb2cda Fix scope checks with enabled flow plugin (#9719) 2019-03-20 16:03:31 -07:00
Denis Pushkarev
92fcd31eac Handle object rest parameters in the corejs3-usage plugin (#9724)
Fixes #9713
2019-03-20 22:29:01 +01:00
Brian Ng
c259ec5408 Bump Babel deps (#9718) 2019-03-20 11:00:58 -05:00
Babel Bot
4cf7d0c828 Add v7.4.1 to CHANGELOG.md [skip ci] 2019-03-19 23:12:21 +00:00
Nicolò Ribaudo
94d1a5e8d7 v7.4.1 2019-03-20 00:10:54 +01:00
Nicolò Ribaudo
6402d8d58c Alias @babel/preset-env/data/built-ins.json.js (#9711)
Fixes vuejs/vue-cli#3671

Even if it has the `.js` extension, `require("@babel/preset-env/data/built-ins.json")` will still work.
2019-03-20 00:09:09 +01:00
Nicolò Ribaudo
c548e789bb Bring back isPluginRequired (#9709) 2019-03-19 23:35:13 +01:00
Babel Bot
8476cf692f Add v7.4.0 to CHANGELOG.md [skip ci] 2019-03-19 20:30:23 +00:00
Nicolò Ribaudo
f1328fb913 v7.4.0 2019-03-19 21:27:16 +01:00
Denis Pushkarev
3303b079c5 Update to core-js@3 (#7646)
### `@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.
2019-03-19 21:07:45 +01:00
Nicolò Ribaudo
7df0d16131 Update main.workflow 2019-03-19 19:02:54 +01:00
Nicolò Ribaudo
f2ee84b6a3 Publish to npm using a GitHub action (#9588) 2019-03-19 18:59:35 +01:00
Mattias Buelens
60005b35e4 Update regenerator-runtime to latest version (#9442) 2019-03-19 18:46:47 +01:00
Tim McClure
e068281e28 Fix super Method Calls in Class Private Methods (#9704)
This fixes an issue with the use of super method calls in class private methods. See https://github.com/babel/babel/issues/9580 for more info re: behavior of the bug.
2019-03-19 18:43:02 +01:00
Daniel Tschinder
48d66eb648 Correctly parse TS TypeAssertions around arrow functions (#9699) 2019-03-18 22:18:47 -07:00
Nicolò Ribaudo
c285d5409e Add %%placeholders%% support to @babel/template (#9648)
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.
2019-03-18 21:23:10 +01:00
Daniel Tschinder
f36a6987e4 Correctly preserve reference to array in for-of loop (#9697)
* Correctly preserve reference to array in for-of loop

* Add more tests
2019-03-17 21:41:35 -07:00
Andrew Goldis
efd2ca9040 Move abstract removal ClassDeclaration > Class. (#9693)
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
2019-03-17 20:44:50 +01:00
Pelle Nielsen
a35e5a314a Fix TSFunctionType visitors definition (#9692)
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.
2019-03-16 09:24:23 +01:00
Tan Li Hau
cc45608423 Add readonly to TypeScript type modifier (#9529)
* add readonly to TSTypeOperator

* add more test cases for readonly
2019-03-16 06:41:51 +01:00
Tan Li Hau
25a3825a1d TypeScript Constant contexts (#9534)
* Add as const fixtures

* parse constant context

* parse constant context

* quick check for literal

* code review, better error message, check array elements

* Removed unneeded test cases
2019-03-16 06:40:39 +01:00
Amir Seljubac
0a69b45126 Remove dependency on home-or-tmp package (#9678) 2019-03-13 17:20:29 -05:00
piotr
a64bf63639 [proposal-object-rest-spread] fix templateLiteral in extractNormalizedKeys (#9628)
Added additional check in extractNormalizedKeys function to handle templates differently than string.
2019-03-13 21:39:50 +01:00
Behrang Yarahmadi
29cd27b545 Partial application plugin (#9474)
* 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]
2019-03-13 12:21:10 +01:00
Brian Ng
a6cb24fa1a Merge pull request #9672 from babel/deps 2019-03-12 19:22:34 -05:00
Tim McClure
81c130ffc9 Private Static Class Methods (Stage 3) (#9446) 2019-03-13 00:11:16 +01:00
Brian Ng
db669a0c6e gulp-uglify@3.0.2 2019-03-12 17:09:54 -05:00
Brian Ng
2f9c4d0045 rollup@1.6.0 2019-03-12 17:09:14 -05:00
Brian Ng
0bf6091305 eslint@5.15.1 2019-03-12 17:05:27 -05:00
Brian Ng
ad2c969097 jest@24.5.0 2019-03-12 17:03:45 -05:00
Brian Ng
b7fb71ffe2 regexpu-core@4.5.4 2019-03-12 16:55:57 -05:00
Daniel Tschinder
cf4bd8bb8d Remove input and length from state (#9646) 2019-03-11 00:42:42 -07:00
Daniel Tschinder
ec318d01fa Switch from rollup-stream to rollup and update deps (#9640) 2019-03-11 00:42:25 -07:00
Guy Bedford
a891b73401 System modules - Hoist classes like other variables (#9639) 2019-03-10 23:33:19 +01:00
Jimmy Jia
dd2ffda387 fix: Don't transpile ES2018 symbol properties (#9650)
This is a repeat of #5195 to work around the same upstream issue.
2019-03-10 23:22:59 +01:00
Daniel Tschinder
b2b96e0b15 Add WarningsToErrorsPlugin to webpack to avoid missing build problems on CI (#9647) 2019-03-07 15:44:36 -08:00
Mathias Bynens
7c909e822f Update regexpu-core dependency (#9642)
This should resolve the issue @danez mentions here:
https://github.com/babel/babel/pull/9636#issuecomment-469870217
2019-03-07 16:40:20 +01:00
Nicolò Ribaudo
15dfce33df Add placeholders support to @babel/types and @babel/generator (#9542) 2019-03-07 11:47:39 +01:00
Daniel Tschinder
095e5c0e09 Generate plugins file 2019-03-06 19:34:08 -08:00
Daniel Tschinder
fb81e8f8b4 Make babel-standalone an ESModule and enable flow (#9025)
* Make babel-standalone an ESModule and enable flow

* autogenerate plugin list

* Make config an array
2019-03-06 14:30:43 -08:00
Daniel Tschinder
d8a5329834 Reorganize token types and use a map for them (#9645) 2019-03-06 14:30:04 -08:00
Matt Tingen
e53be4b387 [TS] Allow context type annotation on getters/setters (#9641)
* Allow context type annotation on getters/setters

* Extract getAccessorsExpectedParamCount
2019-03-06 22:54:42 +01:00
Erik Arvidsson
fba5655a44 Parenthesized expressions (#8025)
* Add parser createParenthesizedExpressions option  …

When set to `true` we create `ParenthesizedExpression` nodes instead of
setting `extra.parenthesized`.

* Also update babel-parser.d.ts
2019-03-06 22:43:36 +01:00
Mathias Bynens
28c71e88e2 Fix label name 2019-03-06 11:41:03 +01:00
Daniel Tschinder
29999007f6 Disallow escape sequences in contextual keywords (#9618)
* 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
2019-03-05 17:20:36 -08:00
Mathias Bynens
349c0d4836 Update babel-plugin-proposal-unicode-property-regex for Unicode v12 (#9636)
https://github.com/tc39/ecma262/issues/1467
https://github.com/tc39/ecma262/pull/1468


Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
2019-03-05 18:06:33 +01:00
Mathias Bynens
54ba6d80c0 Update identifier parsing per Unicode v12 (#9637)
https://github.com/tc39/ecma262/issues/1467
https://github.com/tc39/ecma262/pull/1468
2019-03-05 17:05:03 +01:00
Nicolò Ribaudo
d832c0f434 Add parser support for placeholders (#9364) 2019-03-05 00:45:42 +01:00
Behrang Yarahmadi
c60c4dd375 Partial Application Syntax: Stage 1 (#9343)
* 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
2019-03-05 00:34:02 +01:00
Daniel Tschinder
37a427f692 Update dependencies (#9624) 2019-03-04 14:26:39 -08:00
Daniel Tschinder
38ef4b7467 Add editorconfig for Makefile (#9623) 2019-03-04 14:26:22 -08:00
Nicolò Ribaudo
f195daa092 Don't add params of anonymous exported function decls to the outer scope (#9613)
* Don't add params of anonymous exported function decls to the outer scope

* Test
2019-03-01 00:09:49 +01:00
Daniel Tschinder
17f4195bcc Allow any reserved word in export {} from specifiers (#9616) 2019-02-28 15:07:20 -08:00
Nicolò Ribaudo
f13f4adcbb [TS] Disallow type casts in arrow parameters (#9612) 2019-02-28 23:58:27 +01:00
Evan Henley
d72f3aa758 [plugin-transform-typescript] Strip type imports used in Enums and object types (#9605)
* 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
2019-02-28 22:03:12 +01:00
Daniel Tschinder
98ab1b6428 Refactor parsing object members (#9607)
* Refactor parsing object members

* Ensure decorators on rest don’t swallow decorators silently

* Use hasPrecedingLineBreak

* Add test for async with linebreak

* Update flow whitelist
2019-02-28 11:42:12 -08:00
Daniel Tschinder
208195f425 Disallow duplicate params in methods (#9599)
* Disallow duplicate params in methods

* Fix plugins
2019-02-27 15:54:07 -08:00
Daniel Tschinder
5cb280f986 Fix scope check for 2nd+ lexical bindings (#9600) 2019-02-27 15:53:28 -08:00
Nicolò Ribaudo
9aec606c69 Don't loose "this" in helper-call-delegate (#9601) 2019-02-28 00:34:48 +01:00
Nicolò Ribaudo
5c8cc0d536 Mark FOO in "var { x: FOO }˝ as a binding, not as a reference (#9492) 2019-02-27 00:17:11 +01:00
Daniel Tschinder
43eed1ac92 Check exported bindings are defined (#9589)
* Check exported bindings are defined

* Add tests

* Update flow whitelist

* Add tests for builtins
2019-02-26 13:28:10 -08:00
Sven Sauleau
e883ff295d Merge pull request #9597 from danez/Update-charcodes
Update charcodes
2019-02-26 22:17:59 +01:00
Daniel Tschinder
c1e51e08d3 Update charcodes 2019-02-26 12:29:10 -08:00
Justin Ridgewell
039a74a8b9 preset-env: minimally supporting version (#9596)
* 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
2019-02-26 15:18:52 -05:00
Nicolò Ribaudo
a029071b8f [TS] Correctly forget awaits after parsing async arrows with type args (#9593) 2019-02-26 20:35:18 +01:00
Daniel Tschinder
244e4580e9 Remove always false param allowExpressionBody (#9591) 2019-02-26 11:15:34 -08:00
Justin Ridgewell
e1ff4c47b9 preset-env: Sort versions before determining lowest (#9595)
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!
2019-02-26 11:11:49 -08:00
Nicolò Ribaudo
0345c1bc1d Use for..of Object.keys instead of for..in (#9518)
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.
2019-02-26 20:09:02 +01:00
Brian Ng
f1ab6120d2 Bump Babel deps (#9590) 2019-02-26 11:21:00 -06:00
Florian Adonis
8f26f6df83 change var name for coherence (#9579) 2019-02-26 09:05:43 -06:00
Daniel Tschinder
d0e196d210 Treat for loop body as part of loop scope (#9586) 2019-02-25 18:30:51 -08:00
Daniel Tschinder
e6c1065d19 Fix strict mode prescanning with EmptyStatement (#9585) 2019-02-25 15:20:05 -08:00
Daniel Tschinder
45c96908e9 Update test262 (#9587)
* Update test262

* Also remove unrecognized tests from the whitelist
2019-02-25 15:10:48 -08:00
Brian Ng
434fd32c90 Update esm and electron mappings in preset-env (#9573) 2019-02-25 16:51:38 -06:00
Nicolò Ribaudo
0e3968124c Remove unused file (eslint-local-rules.js) (#9583) 2019-02-25 21:51:17 +01:00
Daniel Tschinder
632552f55d Minify bundles on circle for repl (#9582) 2019-02-25 11:52:40 -08:00
Daniel Tschinder
a7391144b3 Introduce scope tracking in the parser (#9493)
* 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
2019-02-25 11:04:52 -08:00
Babel Bot
918f149a63 Add v7.3.4 to CHANGELOG.md [skip ci] 2019-02-25 18:37:14 +00:00
Nicolò Ribaudo
1f6454cc90 v7.3.4 2019-02-25 19:29:12 +01:00
Nicolò Ribaudo
4540f2653b Update CHAMGELOG.md using the "Trigger GitHub release" action (#9561)
Update CHANGELOG.md using the "Trigger GitHub release" action
2019-02-25 19:18:44 +01:00
Justin Ridgewell
fc1ea7f496 Revert "Parenthesized expressions (#8025)"
This reverts commit dd8b700a2c.
2019-02-25 19:03:00 +01:00
Barthélémy Ledoux
9f3457797f Fix TypeScript parsers missing token check (#9571) (#9572)
* Fix TypeScript parsers missing token check (#9571)

* fix unit test
2019-02-24 13:34:38 +01:00
Nicolò Ribaudo
0b01b5217b Use correct "this" in static fields (#9508) 2019-02-24 08:14:49 +01:00
Denis Pushkarev
cade33c647 Update compat-table (#9566)
fix #9465
2019-02-23 12:47:43 +01:00
Erik Arvidsson
dd8b700a2c Parenthesized expressions (#8025)
* Add parser createParenthesizedExpressions option  …

When set to `true` we create `ParenthesizedExpression` nodes instead of
setting `extra.parenthesized`.

* Also update babel-parser.d.ts
2019-02-23 02:45:25 -05:00
Ian Craig
417e72ebfd Fix flow and TS types of babel-types is* type checks to accept null | undefined (#9539)
* 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
2019-02-22 01:48:27 -08:00
Nicolò Ribaudo
b8d045f5cf Update regenerator-transform (#9558) 2019-02-21 23:24:31 +01:00
Jacob Clark
879a59085b Pull in chokidar 2.0.4 to pull in patched braces (#9550)
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.
2019-02-20 15:07:24 +01:00
Daniel Tschinder
b32d271fee Migrate some duplicate binding tests to traverse (#9532)
* 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
2019-02-19 21:25:49 -08:00
Nicolò Ribaudo
21eb0837e8 Update CHANGELOG.md [skip ci] 2019-02-19 23:50:22 +01:00
Daniel Tschinder
b78fdc0cb1 chore: Enable eqeqeq rule in eslint (#9541) 2019-02-18 21:16:42 -08:00
Daniel Tschinder
a1ea765b95 Make tests spec compliant and avoid duplicate declarations in input files (#9522) 2019-02-18 16:14:35 -08:00
Nicolò Ribaudo
39af228ac4 Add import/no-extraneous-dependencies to ESLint (#9533) 2019-02-19 00:48:19 +01:00
Sven Sauleau
7c0549a923 Merge pull request #9536 from irohitb/patch-1
Update SONG.md
2019-02-18 20:56:59 +01:00
Tim McClure
f44b29522c Remove transform-classes from priv method tests (#9537) 2019-02-18 19:57:29 +01:00
Rohit Bhatia
682534e475 Update SONG.md 2019-02-18 23:28:26 +05:30
Tan Li Hau
bbb4d7b6d7 Fix typescript generator params (#9524)
* Fix typescript generator params

* add TSOptionalType, TSRestType, add more test
2019-02-18 08:22:22 +01:00
Tan Li Hau
5bb1bb080f Fix flow babel-generator function parantheses (#9523) 2019-02-18 00:17:52 +01:00
Daniel Tschinder
058f057426 Also check AssignmentPatterns for export name (#9521) 2019-02-15 22:55:03 -08:00
Nicolò Ribaudo
d1fe2d05f4 v7.3.3 2019-02-15 22:06:01 +01:00
Simon Adcock
b9a3806f9e Upgrade to @babel/preset-typescript to use @babel/plugin-transform-typescript@^7.3.2 (#9497) [skip ci]
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.
2019-02-15 21:59:21 +01:00
Nicolò Ribaudo
b25fea49fe Create a new release after a v*.*.* commit instead of the tag (#9470)
* Create a new release after a v*.*.* commit instead of the tag

* Fix bugs

* Avoid matching things like "v2"
2019-02-15 21:42:51 +01:00
Nicolò Ribaudo
83cbc11d46 Correctly output escapes in directives (#9501) 2019-02-15 21:08:45 +01:00
Daniel Tschinder
0f685d9b42 Only allow Identifiers, Patterns and Rest in parameters of FunctionDeclarations 2019-02-15 12:49:36 +01:00
Nicolò Ribaudo
d86b831364 Add duplicate-package-checker-webpack-plugin (#9517)
We are duplicating semver. It's such a small package that I don't think that it is worth spending much time trying to understand why.
2019-02-15 12:28:00 +01:00
Nicolò Ribaudo
0050266a50 Add missing dependencies (#9516) 2019-02-15 08:50:32 +01:00
Nicolò Ribaudo
b6300a0869 Add importKind to ImportDeclaration in babel/types 2019-02-14 21:53:29 +01:00
Daniel Tschinder
4ba998c5db Add importKind to spec 2019-02-14 21:53:29 +01:00
Nicolò Ribaudo
2fb1f9aed3 Add tests for options to babel-node (#9510) 2019-02-14 13:43:30 +01:00
Alec
85ea5b0b50 Version bump of lodash (#9500)
https://tools.cisco.com/security/center/viewAlert.x?alertId=59546
2019-02-13 16:17:39 +01:00
Daniel Tschinder
d349b74a4f Better error output in parser tests (#9491) 2019-02-11 02:13:24 -08:00
Nicolò Ribaudo
3a9743fce4 Show real version instead of core/preset-env versions in standalone pkgs (#9467) 2019-02-09 17:29:45 +01:00
Daniel Tschinder
2817844e89 Fix regression with let (#9477)
* Fix corner cases with let

* Handle generators correctly

* Fix flow plugin

* Fix typescript plugin
2019-02-08 13:36:37 -08:00
Daniel Tschinder
7943a48cc3 Update flow to 0.92.1 and fix related issues (#9468)
* Update flow to 0.92.1 and fix related issues

* Change isThenable check
2019-02-08 13:27:11 -08:00
Nicolò Ribaudo
953182d44a Exclude generate @babel/types files from coverage report (#9469) 2019-02-08 22:25:19 +01:00
Rubén Norte
045d019149 Fix duplicated assertThisInitialized calls in constructors (#9458) 2019-02-07 23:01:46 +01:00
Downpooooour
d1514f57bd Typescript function destructured params (#9431)
* fix typescript funtion destructured params for array

* update type name
2019-02-07 22:59:50 +01:00
Nicolò Ribaudo
fdb65ab8b1 Update publishing command (#9466) [skip ci]
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>
2019-02-07 22:15:45 +01:00
Daniel Tschinder
81123fb972 Fix typo in comment 2019-02-06 15:12:35 -08:00
Ilya Lesik
738060ebfa Fix support for Flow's DeclareClass type parameters (#9459) 2019-02-06 08:18:07 -06:00
Brian Ng
07b0f22a3f Fix range for TypeScript optional parameter in arrow function (#9463) 2019-02-06 08:17:32 -06:00
Yifei Fu
e03e5ba01d Add TypeScript definitions for parser plugin options. (#9457) 2019-02-06 10:03:54 +01:00
Nicolò Ribaudo
d896ce2b53 v7.3.2 2019-02-04 23:20:05 +01:00
Nicolò Ribaudo
44d8a59361 Use a GitHub Action to generate the changelog (#9434) [skip ci]
* Use a GitHub Action to generate the changelog

* Update main.workflow [skip ci]
2019-02-04 22:15:44 +01:00
Daniel Tschinder
344d35bbe9 Simplify await and yield tracking in params (#9405) 2019-02-04 22:01:17 +01:00
Thiago Arrais
fe71154626 Support for await and yield in pipelines (#9401) 2019-02-04 21:58:46 +01:00
gverni
65cbbc1ef8 Fix duplicate definition error in private class methods (#9453) 2019-02-04 09:19:04 -06:00
Nicolò Ribaudo
d37c958637 Transform private async and generator functions (#9423) 2019-02-04 15:10:46 +01:00
Daniel Tschinder
9eb010da50 Unify reserved word checking and update error messages (#9402)
* Unify reserved word checking and update error messages

* Fix test
2019-01-31 19:02:32 -08:00
Galymzhan Abdugalimov
7e9029e337 Switched gutil.log to fancyLog due to deprecation (#9432) 2019-01-30 08:23:02 -06:00
Galymzhan Abdugalimov
00c3e3c8e0 Fixed link to @babel/parser's issues in README (#9427) 2019-01-30 08:18:43 -06:00
Nicolò Ribaudo
7192546eb8 Run prettier again 2019-01-30 11:35:42 +01:00
Nicolò Ribaudo
4c4c22a316 Run prettier 2019-01-30 11:30:31 +01:00
Rizky
56044c7851 install polyfill & runtime to dependency instead of devDependency [skip ci] (#9409) 2019-01-29 08:09:08 -06:00
Daniel Tschinder
828169e611 Fix line continuation with Unicode line terminators (#9403) 2019-01-28 13:35:35 -08:00
Moti Zilberman
1452e977a0 Destructuring: Create assignments from ForX non-declaration patterns (#9414) 2019-01-28 09:50:24 +01:00
Brian Ng
ede69eef7f Bump deps (#9417) 2019-01-26 22:49:48 -05:00
Dylan Staley
03230eaa9c Retain JSX pragma if defined as a comment (#9095) 2019-01-26 15:36:10 -06:00
Brian Ng
7dc157f9be Fix location/range on TypeScript ExportNamedDeclarations (#9406) 2019-01-24 19:44:22 -06:00
Yuri Karadzhov
854313a759 Correctly visit param decorators to prevent their imports being removed in typescript transform (#8738)
* Remove types on program exit in typescript transform

* Revert changes to typescript transform

* Correctly add visitors for param decorators

* Fix plugin for node 6
2019-01-24 15:07:56 -08:00
Daniel Tschinder
46ba5940c2 Make yield a contextual keyword (#9400) 2019-01-23 14:33:23 -08:00
Daniel Tschinder
42c5d3fc4b Correctly fail for invalid yield in for (#9398) 2019-01-23 13:39:30 -08:00
Brian Ng
d4e045ac24 Fix support for Flow's QualifiedTypeIdentifier (#9396) 2019-01-23 15:19:17 -06:00
Daniel Tschinder
8bc9f9a05f fix: Allow toplevel await when option true and correctly mark await keyword as unexpected (#9371) 2019-01-22 14:56:30 -08:00
Daniel Tschinder
93e1b5e612 Merge pull request #9375 from danez/contextual-let
Make let a contextual keyword
2019-01-22 14:55:49 -08:00
Daniel Tschinder
4f69699b71 Fix parsing in non-declaration places 2019-01-22 13:12:03 -08:00
Daniel Tschinder
f4f5ca2aaa Parse class name in strict mode
The specification defines that the whole class declaration is parsed in strict mode
2019-01-22 13:12:03 -08:00
Daniel Tschinder
8071dca9ad Disallow const let or let let 2019-01-22 13:12:02 -08:00
Daniel Tschinder
178f2d7949 Make let a contextual keyword 2019-01-22 13:12:02 -08:00
Nicolò Ribaudo
65febdd13a Refactor import and export parsing (#9326)
* [parser] Refactor import parsing

* [parser] Refactor export parsing

* Fix types
2019-01-22 19:52:56 +01:00
Brian Ng
f77c450cda Bump prettier (#9373) 2019-01-22 09:16:32 -06:00
Nicolò Ribaudo
f2af6c1170 v7.3.1 2019-01-22 08:07:23 +01:00
Daniel Tschinder
43b83f8ed7 Revert "Differentiate object spread and non-spread properties (#9341)" (#9379)
This reverts commit 3ae5e79ec8.
2019-01-21 23:03:54 -08:00
Daniel Tschinder
af88e63dff fix new keyword broken by recent refactoring (#9377) 2019-01-21 22:25:37 -08:00
Nicolò Ribaudo
f6ee26c3da v7.3.0 2019-01-21 22:22:39 +01:00
Tim McClure
e8de6fa5d4 Private Class Methods Stage 3: Private Accessors (#9101)
* Add accessor loose support

* Add private accessors spec support

* Fix private dupe name check

* Changes from code review

* Add duplicated names tests

* Add get/set-only tests

* Move accessors tests

* Split out updates tests

* Add helper change tests

* Update test output

* Update test options
2019-01-21 22:05:37 +01:00
Kagami Sascha Rosylight
3ae5e79ec8 Differentiate object spread and non-spread properties (#9341)
* 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
2019-01-21 22:04:47 +01:00
Thiago Arrais
e9331aa0c0 Transform for the smart pipeline operator proposal (#9179) 2019-01-21 22:04:14 +01:00
Henry Zhu
ba4141934f add v7 downloads [skip ci] (#9370) 2019-01-21 12:48:15 -05:00
Daniel Tschinder
96a7343142 Merge pull request #9348 from danez/perf
Parser Performance Collection
2019-01-21 02:27:42 -08:00
Armano
a2e6d8e968 Disallow usage of invalid keyword after export abstract statement in Typescript (#9336) 2019-01-19 15:48:05 -06:00
Nicolò Ribaudo
4ce37b7aca Update test262 sha (#9365) 2019-01-19 18:10:28 +01:00
Brian Ng
b92ad318f1 Add support for transform-named-capturing-groups-regex in preset-env (#9345) 2019-01-17 19:51:38 -06:00
Daniel Tschinder
2d6231fd3d Update flow whitelist 2019-01-17 16:16:32 -08:00
Daniel Tschinder
4e5e319d5b perf: remove double check for keywords in readWord
Instead of calling isKeyword we simple check directly if the keyword token is available
2019-01-17 16:16:31 -08:00
Daniel Tschinder
b66d921053 perf: Use === or Set.has instead of array.indexOf for keyword checks 2019-01-17 16:16:30 -08:00
Daniel Tschinder
f12905b531 perf: Use for loops while cloning classes 2019-01-17 16:16:29 -08:00
Daniel Tschinder
f216975378 perf: call isLineTerminator as last check 2019-01-17 16:16:28 -08:00
Daniel Tschinder
3a3d5cbe9c perf: Check for plugin only once before looping 2019-01-17 16:16:28 -08:00
Daniel Tschinder
10555c719e Build the parser also for node 6.9 and up 2019-01-17 16:16:27 -08:00
Daniel Tschinder
58768072ef perf: Ensure canInsertSemicolon is always called last
It does a lot of checks and a regex test
2019-01-17 16:16:26 -08:00
Daniel Tschinder
455e003567 perf: Optimize regex
This saves some steps, as the regex parser does not have to backtrack for character classes, but is has to for alternates
2019-01-17 16:15:07 -08:00
Daniel Tschinder
49f7bcf271 perf: Remove unnecessary check for flow plugin inside of flow plugin 2019-01-17 16:15:07 -08:00
Daniel Tschinder
c2e41588aa perf: run flow code in flow plugin 2019-01-17 16:15:05 -08:00
Daniel Tschinder
a1eac37bd2 Generate prettier comments 2019-01-17 16:15:04 -08:00
Daniel Tschinder
0370af58f1 perf: Use strict equals 2019-01-17 16:15:03 -08:00
Daniel Tschinder
8df0500f55 perf: Simplify reading of tokens.
This avoids checking isIdentifierStart for every single token
2019-01-17 16:15:01 -08:00
Daniel Tschinder
e4b8cfc768 perf: use Set instead of string indexOf 2019-01-17 16:15:00 -08:00
Daniel Tschinder
a7757ec4d0 perf: Use increment operator 2019-01-17 16:14:58 -08:00
Daniel Tschinder
25a8db2a29 perf: use normal equality check in stead of indexOf 2019-01-17 16:14:57 -08:00
Daniel Tschinder
48fd387779 perf: precalculate length 2019-01-17 16:14:56 -08:00
Daniel Tschinder
59c4bbb4ab perf: Make plugins a map instead of object
Fix plugin options
2019-01-17 16:14:55 -08:00
Daniel Tschinder
2dc1c91955 perf: Move input to state and precalculate length
This also fixes a bug with async functions
2019-01-17 16:14:54 -08:00
Daniel Tschinder
ae154c86ed perf: Minor optimizations 2019-01-17 16:14:53 -08:00
unconfident
e9588061d7 Copy "optional" property when cloning Identifier node (#9333)
Fixes #9331
2019-01-17 17:12:16 -05:00
Nicolò Ribaudo
0a88230ec4 Disallow async functions as loop bodies (#9314) 2019-01-17 17:07:48 -05:00
Nicolò Ribaudo
a27b9b4299 Add @babel/plugin-transform-named-capturing-groups-regex (#7105)
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.
2019-01-15 18:21:17 +01:00
Brian Ng
aaec2cd51d Fix handling newline with TypeScript declare and abstract classes (#9328) 2019-01-15 06:56:52 -06:00
Brian Ng
34c9890f41 Fix range on TypeScript index signature parameters (#9335) 2019-01-15 06:52:33 -06:00
Armano
e8038863c3 Fix range on TypeScript this type predicate (#9339) 2019-01-15 10:35:49 +01:00
Nicolò Ribaudo
694e3fd8cf Merge declaration and init of props in parser's state (#9312)
* Merge declaration and init of props in parser's state

* Move type def
2019-01-13 23:54:44 +01:00
Brian Ng
40ae6568a4 Add support for proposal-json-strings in preset-env (#9323) 2019-01-13 08:32:33 -06:00
Henry Zhu
4944e9e180 update sponsor link again [skip ci] 2019-01-13 08:00:46 -05:00
Nicolò Ribaudo
a24206eb96 Fix error for decorators not enabled (#9321)
* Fix error for decorators not enabled

* Update error message
2019-01-13 00:35:22 +01:00
Henry Zhu
d6b4ab75ee fix sponsor link [skip ci] 2019-01-12 10:41:49 -05:00
Nicolò Ribaudo
3e4b608a80 Parse class heritage as strict mode code (#9315) 2019-01-12 14:54:23 +01:00
Henry Zhu
28319eb07e add sponsor [skip ci] 2019-01-11 13:50:48 -05:00
Nicolò Ribaudo
5889620a6a Disallow new import(x) and import(x,) (#9313)
* Disallow "new import(...)"

* Disallow trailing comma inside dynamic import

* Rename test

* Update error message
2019-01-11 18:59:51 +01:00
Nicolò Ribaudo
9764718c32 Disallow trailing comma after rest (#9311)
* Add new tests

* Use state instead of param and disallow comma in [...a,]=[]

* Unify error messages

* Object destructuring

* Update whitelist
2019-01-11 13:08:38 +01:00
Nicolò Ribaudo
28b70e5910 Generate types for TSImportType 2019-01-11 11:46:15 +01:00
Henry Zhu
4c2f8d9337 @babel/generator: Add emit and builder for TSImportType (#9309) 2019-01-10 13:57:00 -05:00
Armano
2cc0376756 @babel/parser(ts): Add parsing of type import (#9302) 2019-01-10 11:14:48 -05:00
Nicolò Ribaudo
8e051cae46 [decorators] Set method names at compile time instead of at runtime (#9244) 2019-01-10 00:45:02 +01:00
Cameron Martin
778a61a3c2 [@babel/types] Moved generators related to babel-types into the babel-types package directory. (#9245) 2019-01-09 00:14:31 +01:00
Armano
46e3f6df1f @babel/parser: include leading character into range of generic ArrowFunctionExpression (#9295) 2019-01-08 07:19:55 -06:00
Brian Ng
03022d169e Throw error if TypeScript class has empty implements (#9292) 2019-01-07 15:27:27 -06:00
David Laban
9803253363 flow type update: babel-types.isType(?string, string): boolean (#9275) 2019-01-07 08:53:01 -06:00
Brian Ng
a55382e4ad Test262 update (#9288) 2019-01-07 08:52:36 -06:00
Sven Sauleau
b211b810d1 Use 2014-present in license (#9290) 2019-01-07 08:52:11 -06:00
James George
25e880d355 Add follow on twitter badge (#9264) [skip ci] 2019-01-07 09:49:20 -05:00
Daniel Tschinder
e43777bb5f Fix location for typescript type assertions in AST (#9284) 2019-01-06 16:39:14 -08:00
Nicolò Ribaudo
efc60a1703 Add test sources to prettierignore (#9287) [skip ci] 2019-01-06 20:59:02 +01:00
Daniel Tschinder
54f072991d Revert "Revert babel-helper-builder-react-jsx change from #4988" (#9119)
This reverts commit dbc07220ae.

# Conflicts:
#	packages/babel-helper-builder-react-jsx/src/index.js
2019-01-05 22:22:49 -08:00
Brian Ng
a58893d1e3 Ensure modifiers are included in TSParameterProperty ranges (#9276) 2019-01-04 10:02:09 -06:00
Nicolò Ribaudo
865eb93c2d [private methods] Define private methods before executing initializers (#9248) 2019-01-03 20:33:44 +01:00
Berlam Henderson
49f52bbcb3 Bump license years for 2019 (#9271) 2019-01-03 09:12:03 -06:00
Nicolò Ribaudo
9d1d0fe57a Add mixins support to the _decorate helper (#9166) 2018-12-29 22:54:30 +01:00
Brian Ng
ea1c436ea1 Fix handling scoped packages in preset-env include/exclude options (#9219) 2018-12-27 09:54:28 -06:00
David Laban
3f9a1c08cc Add tests for babel-types.isType (#9243) 2018-12-27 12:49:34 +01:00
J. S. Choi
c586d4e8ca parser, smart pipes: Add support for yield in pipeline bodies
Fixes #9178.
2018-12-23 17:09:18 +01:00
J. S. Choi
60ffe1d103 parser, smart pipes: Add test for async–await 2018-12-23 17:09:18 +01:00
Armano
b5177ce290 babel-parser: typescript: add missing bigint keyword (#9230) 2018-12-22 17:18:32 -06:00
Henry Zhu
d1aa665657 update sponsors [skip ci] 2018-12-21 21:39:06 -05:00
Nicolò Ribaudo
f130981546 v7.2.5 2018-12-21 23:32:48 +01:00
Nicolò Ribaudo
bc347bab7a Add @babel/helpers to devDependencies of runtime and runtime-corejs2 (#9222) 2018-12-21 10:08:47 +01:00
Nicolò Ribaudo
21228abfde v7.2.4 2018-12-20 13:08:41 +01:00
Nicolò Ribaudo
e417437355 Minify standalone 2018-12-20 12:50:41 +01:00
Nicolò Ribaudo
0bb720401b v7.2.3 2018-12-20 12:18:31 +01:00
Nicolò Ribaudo
d35f2ad92b Update lerna to v3.6.0
Use forked @lerna/collect-updates to prevent publishing of dependents:
this is the same as Lerna 2's --dangerously-only-publish-explicit-etc option.
2018-12-20 11:46:56 +01:00
Nicolò Ribaudo
57759cb1a1 [lerna] Don't ignore .json data files in preset-env (#9200) 2018-12-20 11:43:40 +01:00
Cameron Martin
9e95da4eaa Added type-level mapping between aliases and nodes that have that alias. (#9110) 2018-12-19 10:57:27 +01:00
Nicolò Ribaudo
911c2d0bf4 Use @babel/eslint-plugin-developement (#9206) 2018-12-18 22:59:43 +01:00
cphamlet
116ca22def Minor typo for -f flag in cli (#9201) 2018-12-17 19:29:23 -08:00
Tan Li Hau
52fb884550 Strips flow directive fully (#9197) 2018-12-17 09:27:56 +01:00
Daniel Tschinder
5cb38995c0 Allow keywords to be used in type annotations (#9184) 2018-12-15 12:51:24 -08:00
Andy Edwards
3c8e15dbc1 don't throw classNameTDZError if referenced identifier is within a TypeAnnotation (#9190)
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;
}
```
2018-12-15 15:16:43 +01:00
Nicolò Ribaudo
c1499b13ac v7.2.2 2018-12-15 10:59:56 +01:00
Nicolò Ribaudo
7bcd62cfee Build standalone on prepublish 2018-12-15 10:52:23 +01:00
Daniel Tschinder
47da5cf75a Correctly transform spreads to use proper concat method (#9108)
* Correctly transform spreads to use proper concat method

* Add tests to ensure array spread clones elements
2018-12-13 23:24:43 -08:00
Vikram Rangaraj
72471aff63 Handle flow comments with leading spaces (#9168)
* 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
2018-12-13 22:10:01 -08:00
Patrick Eriksson
b9340bc597 Fix package.json repository URLs (#9176) 2018-12-13 21:15:40 +01:00
Thiago Arrais
731182eee4 Types for pipeline operator (smart proposal) (#9122) 2018-12-13 06:58:58 +01:00
Daniel Tschinder
f4eec5ca79 Add new flag that indicates if a module has exports (#9171) 2018-12-12 21:24:44 -08:00
Nicolò Ribaudo
b60adce4cb Update CHANGELOG.md 2018-12-12 23:56:33 +01:00
Henry Zhu
66c4bc8f64 update list of sponsors [skip ci] 2018-12-12 16:07:49 -05:00
Daniel Tschinder
d2dc28ed2b add triage label to new issues [skip ci] (#9158) 2018-12-12 10:23:54 -08:00
Brian Ng
0514a9f903 Update v7 regression issue template link (#9157) 2018-12-10 12:00:52 -06:00
Nicolò Ribaudo
d1d3c823cc Move decorators transform to @babel/helper-create-class-features-plugin (#9059)
* Move decorators to @babel/plugin-class-features

* Minor refactoring

* Use the new helper package
2018-12-09 12:30:25 +01:00
Nicolò Ribaudo
9b005dedfd Fix --root-mode option in babel-node (#9148) 2018-12-07 22:47:56 +01:00
Rubén Norte
4fdb71151f Inherit properties in function from method in loose mode (#9135) 2018-12-07 15:57:48 +01:00
Brian Ng
f611bb016b Bump Babel deps (#9145) 2018-12-07 08:55:06 -06:00
Kagami Sascha Rosylight
4dff205dc1 Disable parameter-destructuring in Edge 18 (#9140) 2018-12-07 08:14:08 -06:00
Kagami Sascha Rosylight
72fd2d192c Add missing colon to issue template (#9143) 2018-12-07 13:32:36 +01:00
Daniel Tschinder
35815832b5 Move to travis vm based builds (#9133) 2018-12-05 15:02:37 -08:00
Daniel Tschinder
9c45b8faf7 Ensure we always use local versions of babel dependencies in tests (#9132) 2018-12-05 14:14:16 -08:00
Daniel Tschinder
ca2918ab13 Test local version of babel/types 2018-12-05 13:34:36 -08:00
Daniel Tschinder
d915f31bcb Add tests for createTypeAnnotationBasedOnTypeof 2018-12-05 13:24:55 -08:00
Daniel Tschinder
4ca35ef8b9 Fix running flow on travis and update flow (#9128)
* 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
2018-12-05 12:30:30 -08:00
Henry Zhu
4b73818c87 Update issue templates [skip ci] (#9131) 2018-12-05 13:58:53 -05:00
Joel Denning
d305419da6 Not depending on return value of super(). Fixes #9020. (#9060)
* Not depending on return value of super(). Fixes #9020.

* Feedback from nicolo-ribaudo

* Feedback -- fixing bad call to replaceWithMultiple
2018-12-04 21:50:17 +01:00
Nicolò Ribaudo
8b132c0889 v7.2.1 2018-12-04 16:21:47 +01:00
Nicolò Ribaudo
b927fb2a7e Don't use isClassPrivateMethod because is isn't supported in <7.2.0 (#9121) 2018-12-04 08:35:10 +01:00
Nicolò Ribaudo
282129ea66 v7.2.0 2018-12-03 20:00:35 +01:00
Nicolò Ribaudo
fc5d49b6f6 Add access:public to @babel/helper-create-class-features-plugin 2018-12-03 20:00:24 +01:00
Nicolò Ribaudo
6c2771c116 Add @babel/plugin-proposal-private-methods to @babel/standalone (#9115) 2018-12-03 19:40:00 +01:00
Sven Sauleau
fdc869ce16 Merge pull request #8289 from valtech-nyc/implement-smart-pipeline-in-parser
Implement Smart Pipeline proposal in @babel/parser
2018-12-03 19:28:45 +01:00
Daniel Tschinder
fa9df678ac Move tests from babylon to babel-parser and enable one test that works now 2018-12-03 00:46:54 -08:00
Daniel Tschinder
3932830535 Parse non-octals with leading zeros in non strict mode correctly (#9114)
* Parse non-octals with leading zeros in non strict mode correctly

* Better error message
2018-12-03 00:04:37 -08:00
Daniel Tschinder
07eaa3c63f Ignore empty fixture directories and fix fixtures in the parser (#9113)
* 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
2018-12-02 22:55:06 -08:00
Daniel Tschinder
3530d11418 Update find-cache-dir (#9111)
Dropped support for node <6
2018-12-02 12:12:19 -08:00
Kai Cataldo
806e133473 Export @babel/parser#tokTypes in @babel/core (#8986)
* Export @babel/parser in @babel/core

* Expose tokTypes instead of parser
2018-11-30 18:41:58 -08:00
Veaceslav Cotruta
2bf8dde782 Propagates the extensions overrides provided by CLI during files walk (#8668)
* Propagates the extensions overrides provided by CLI during files walk

* Adds tests for issue #7620, PR #8668
2018-11-29 18:57:27 -08:00
Nicolò Ribaudo
4e28459a2f Make @babel/plugin-class-features a normal helper package (#9083)
* 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
2018-11-29 16:42:45 +01:00
wtgtybhertgeghgtwtg
c4d6f6dcce Pass rootMode from @babel/node. (#9078)
* Pass `root-mode` from `@babel/node`.

* Filter `babelOptions`.
2018-11-28 21:29:38 -08:00
Tim McClure
0859535b62 Private class methods stage 3 (#8654)
* Add private method syntax support

* Add private method spec support

* Add private method loose support

* Throw error if static private method is used

* Add more isStatic & isMethod checks

* Remove `writable:false` from private method inits

`writable` is false by default.

* Add private method func obj equality check

* Throw if private accessor is used

* Add check for fields === private method loose mode

* Throw buildCodeFrameErrors instead of Errors

* Move obj destructuring inside for loop

* Remove "computed" from ClassPrivateMethod type def
2018-11-28 16:20:09 -08:00
Daniel Tschinder
6e39b58f8a Add node 11 to CI and remove node 9 (#9096) 2018-11-28 12:36:58 -08:00
Daniel Tschinder
559d649994 Skip minifying standalone (#9094)
Also remove unused dependency on uglify js. gulp-uglify uses its own version.
2018-11-28 12:36:24 -08:00
Brian Ng
3fda01b185 Update mapping for regex unicode plugin in preset-env (#9091) 2018-11-27 22:09:15 -06:00
Daniel Tschinder
4f2eacf615 chore: Fix warning when using prettier in code generators (#9093)
Also add more output to the generation
2018-11-27 19:34:11 -08:00
Gcaufy
0047ae84b3 Remove unused variable (#9089)
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.
2018-11-27 14:03:39 -08:00
Paul Happ
2bb24f996f Fix yield expression transform (#9076) 2018-11-27 09:45:06 -06:00
Nicolò Ribaudo
61f2aed5b0 Disallow await inside arrow functions (#9074)
* Disallow await inside arrow functions

* Update test262 whitelist
2018-11-26 12:43:04 +01:00
Ruben Verborgh
9308c870f5 Fix destructuring assignment in arrow functions. (#8916)
Fixes 8912.
2018-11-25 19:29:58 +01:00
wtgtybhertgeghgtwtg
1b8d664bbe Move fs-readdir-recursive and output-file-sync to devDependencies (#9079)
For `@babel/node`.
2018-11-25 18:04:03 +01:00
Justin Ridgewell
844dd33f3d Microbouji patch/8136 (#9073)
* 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
2018-11-24 09:32:24 -05:00
Nicolò Ribaudo
856edbf95f [flow] Allow type casts in array patterns inside arrow parameters (#9069) 2018-11-24 12:23:49 +01:00
mAAdhaTTah
100b38784d Replace else with fall through 2018-11-21 21:07:03 -05:00
mAAdhaTTah
4cbd22a15f Hardcode "#" in error message
It's not going to be anything else...
2018-11-21 21:05:51 -05:00
Daniel Tschinder
d2971a1959 Fix compatibility between typescript and jsx plugins in interface declarations (#9058) 2018-11-21 15:58:50 -08:00
Brian Ng
4f16a12c03 Fix bug with parsing TS generic async arrow function (#9055) 2018-11-21 15:34:09 -06:00
Brian Ng
e7f0c065cf Bump some deps (#9056) 2018-11-21 15:21:36 -06:00
mAAdhaTTah
70318c9413 s/may/should 2018-11-21 16:02:34 -05:00
mAAdhaTTah
6e84352b51 PrimaryTopicReference -> PipelinePrimaryTopicReference 2018-11-21 15:54:56 -05:00
mAAdhaTTah
0eb9b2463d Move plugin check to pipeline op appearance
No need to recheck it throughout then.
2018-11-21 15:54:26 -05:00
Grigory Moroz
445b14148e Better error for disallowed trailing commas/parameters after rest elements (#9046)
* 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]
2018-11-21 07:49:36 +01:00
Brian Ng
61c1c77a28 Update mappings for node 10 in preset-env (#9048) 2018-11-20 15:29:45 -06:00
Nicolò Ribaudo
5979b0669b Merge class features plugins
* Create @babel/plugin-class-features

* Move class properties transformation logic to enanced-classes (#8130)
2018-11-20 21:14:35 +01:00
Daniel Tschinder
a2afb974be Fix parsing typescript function types with destructuring (#9035)
* Fix parsing typescript function types with destructuring

* Use integer instead of actual stack
2018-11-19 13:55:58 -08:00
Nicolò Ribaudo
c11cdcb6d8 Fix recursive async function expressions (#9039)
* Fix recursive async function expressions

* Update fixtures
2018-11-19 17:19:54 +01:00
Nicolò Ribaudo
8c7d4b55c9 Add plugins name (#8769)
* Add plugins name

* Add missing names found by the plugin

* Add eslint plugin
2018-11-18 23:02:58 +01:00
Sergey Rubanov
88696601e1 Add Node 11 support (#9037) 2018-11-18 08:17:06 -07:00
Logan Smyth
20a9d71016 Normalize presets before merging config with others. (#9034) 2018-11-16 21:23:23 -08:00
Daniel Tschinder
1af57e6f71 Fix test262 tests again! 2018-11-14 23:29:17 -08:00
Nicolò Ribaudo
4e1d6e7ff4 v7.1.6 2018-11-13 22:10:06 +01:00
Henry Zhu
efb71ea12b fix publish command [skip ci] (#8982) 2018-11-13 11:47:05 -08:00
Logan Smyth
cbbb3c7962 Ensure that the arrow nodes have a location before using them. (#9003) 2018-11-12 17:10:49 -08:00
Greg Bergé
4fcee1751a Fix cloneNode with typeAnnotation. (#8997)
Fixes #8996
2018-11-12 17:10:09 -08:00
Tien Pham
efa571a42c Update CHANGELOG.md (#9014) 2018-11-11 23:33:56 +01:00
Alican Çubukçuoğlu
bf8c4785f2 Fix "TypeError: comments is not iterable" (#8701) 2018-11-09 13:58:28 -08:00
Brian Ng
4f206b2416 prettier@1.15.1 (#9001) 2018-11-09 15:25:13 -06:00
Daniel Tschinder
504b331da4 Fix browser files to have the same API as the nodejs ones (#9004) 2018-11-09 13:11:46 -08:00
Daniel Tschinder
74f969b603 Update debug dependency (#8989) 2018-11-09 16:27:41 +01:00
Remi Liu
4dfd801887 [Types] fix generated TS/Flow comment types (#9007) 2018-11-09 09:03:53 -06:00
Daniel Tschinder
62233ed7c9 Update json5 to latest version (#8990) 2018-11-08 17:29:13 -08:00
ylemkimon
7b54ab620b preset-env: fix opera from esmodules target and Browserslist not used (#8555) 2018-11-08 10:29:49 -06:00
Daniel Tschinder
343f776ca5 Rename primitive types to reserved types (#8984) 2018-11-07 16:50:36 -06:00
Daniel Tschinder
756ded4d64 Remove definition of micromatch which was removed. (#8988) 2018-11-07 16:49:27 -06:00
Nicolò Ribaudo
b706e34fc8 [decorators] Correctly insert _initialize(this) after super(). (#8970)
* [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
2018-11-06 21:58:09 -08:00
Daniel Tschinder
5d5cd8612f Fix several edge cases with context expression state (#8972)
* Fix several edge cases with context expression state

* Fix review comments

* Remove unused field
2018-11-06 19:37:24 -08:00
Henry Zhu
afe67a7035 v7.1.5 2018-11-06 17:21:22 -05:00
Nicolò Ribaudo
2fa1984635 Fix await in function name and parameters (#7727)
* Disallow await in function parameters

* Fix await as function name

* Update test whitelists
2018-11-06 08:30:06 +01:00
Retsam
2194842d11 Typescript: Validate tuple type element positions (#8828)
* 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
2018-11-05 23:19:34 -08:00
Daniel Tschinder
e3b2c1afff fix: Do not allow TypeCastExpressions w/o parens (#8956) 2018-11-05 15:34:24 -08:00
James Garbutt
b95cbc4a8e output aliased types in typescript declarations (#8629) 2018-11-05 23:58:57 +01:00
Nicolò Ribaudo
24c4901ff5 Remove Babylon plugins for features already merged to the ECMAScript spec (#8448)
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.
2018-11-05 23:48:06 +01:00
Daniel Tschinder
c125b1dd74 Update test262 commit, as old commit broke for some reason 2018-11-05 10:53:34 -08:00
Jordan Brown
f216a7b06f [flow] Add support for parsing _ as implicit instantiation in call/new (#8883)
* [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
2018-11-05 10:45:40 -08:00
Logan Smyth
c6d2f45cab Resolve babel.config.js 'babelrcRoots' values relative to the config file. (#8910) 2018-11-05 08:51:27 -08:00
Daniel Tschinder
1d4d760ffc Update test262 to latest commit and enable mapping for features
Also added an automated check for new features which are not mapped or ignored
2018-11-04 18:49:53 +01:00
mAAdhaTTah
a0e94ec24d Move PipelineStyle to types.js file 2018-11-03 14:03:17 -04:00
mAAdhaTTah
b593af17a9 Replace codePointToString with ES6 method 2018-11-03 14:00:42 -04:00
mAAdhaTTah
4521204ea0 Merge branch 'master' into implement-smart-pipeline-in-parser
* 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
2018-11-03 14:00:12 -04:00
Nicolò Ribaudo
d35563ee1a Set correct methods name 2018-11-02 13:59:57 +01:00
Nicolò Ribaudo
38397ce11f Use toPropertyKey in the "decorate" helper
This commit also makes the "toPropertyKey" helper call @@toPrimitive
when needed.
2018-11-02 13:59:57 +01:00
Daniel Tschinder
cd81b079ee Allow function types in type params within arrow return types (#8954) 2018-11-01 09:10:46 -05:00
everdimension
e85faec47d Fix message when plugin of a wrong type is passed (#8950) 2018-10-31 14:34:26 -05:00
Byron Luk
0d9e77f559 rename colliding let bindings with for loop init (#8937)
* rename colliding let bindings with for loop init

* added complex test case to check if loop init collisions were handled correctly

* updated test files
2018-10-31 20:28:36 +01:00
Ben Mosher
c82750a48a edge incomplete support for arrow destructuring (babel #8349) (#8926) 2018-10-31 10:15:27 -05:00
Ryan Marsh
de80aefece fix single-arg async arrows when retainLines=true (#8868) 2018-10-30 06:49:11 +01:00
Jordan Brown
e4929e11f6 [flow] Explicit inexact objects with ... (#8884) 2018-10-29 15:09:17 -05:00
Brian Ng
d942d47e10 Update preset-env data (#8898) 2018-10-25 09:48:41 -05:00
Thiago Arrais
84e7884d9c Treat break inside block inside loop (#8914) 2018-10-25 09:46:36 -05:00
0xflotus
9d0dcedb2b fixed "source map" formatting in comment (#8878) [skip ci] 2018-10-20 00:51:46 +02:00
Byron Luk
b576bf4b41 fix typo in contributing guidelines (#8901) [skip ci] 2018-10-19 08:49:33 +02:00
Cyp
e541d6031a fix: Expression x === 'y' && '' should not evaluate to undefined. (#8880)
Fixes https://github.com/babel/minify/issues/908.
2018-10-16 21:25:49 +02:00
Sven Sauleau
5fa3628506 Merge pull request #8873 from vvyomjjain/patch-1
fixed an extra word
2018-10-14 18:53:17 +02:00
Vyom Jain
f71e4660d4 fixed an extra word
"visit join" doesn't sound right. Either there is a word missing or the word 'visit' may be removed.
2018-10-14 22:14:02 +05:30
Byron Luk
929567523c Fixes #8865 (#8866) 2018-10-12 09:28:15 -05:00
Henry Zhu
5080059138 v7.1.4 2018-10-11 13:32:18 -04:00
Henry Zhu
8ee857e268 v7.1.3 2018-10-11 11:52:19 -04:00
Brian Ng
6b8261bbb7 Bump Babel deps (#8770) 2018-10-10 13:55:02 -05:00
Brian Ng
ce1a6526e5 flow-bin@0.82.0 (#8832) 2018-10-10 12:29:23 -05:00
Kevin Thomas
842c164be5 Insertafter jsx fix (#8833)
* Add check for JSXElement

* Add test
2018-10-10 10:10:20 -06:00
Retsam
d2c75c2d38 fix: corrects handling of newline after async with paren-less arrow function (#8830)
If async is followed by a newline, then a paren-less arrow function should be parsed as two expressions
2018-10-09 23:25:31 +02:00
Retsam
3951acbff5 chore: add generated files for #8805 (#8826) 2018-10-08 12:29:33 -05:00
Retsam
08454ece46 Typescript - Tuples can include rest elements (#8805) 2018-10-08 11:32:31 -05:00
Tim von Oldenburg
4b8cb75b74 types: allow jsxEmptyExpression inside jsxExpressionContainer (#8791) 2018-10-07 23:31:03 -04:00
Guy Bedford
3fa4f53d0a System module format - fixes function hoisting failure case (#8820)
* failing test case

* fix function hoist bug
2018-10-07 23:30:02 -04:00
Bruno Macabeus
850bc1d3dd class private methods and properties: should not allow spaces between # and identifier (#8756) 2018-10-02 19:31:06 -07:00
Brian Ng
36d12b5969 Ensure destructuring's computed key handling matches object-rest-spread (#8793) 2018-10-02 20:46:08 -05:00
Brian Ng
2575312d1f Fix parsing of slash after class expression (#8804) 2018-10-02 20:45:53 -05:00
Retsam
a5b5ed928d Typescript - Tuple elements can be optional (#8720) 2018-10-02 11:29:51 -05:00
Nicolò Ribaudo
3c87401714 [decorators] [typescript] Parse type parameters (#8767)
* [decorators] [typescript] Parse type parameters

* Add test for invalid code
2018-10-01 22:04:19 +02:00
Matthew Robertson
07862e7272 Fix perf issue in typescript parser plugin (#8792) 2018-10-01 12:59:16 -05:00
Henry Zhu
ca89212b45 add changelog up to 7.1.2 [skip ci] 2018-09-28 18:28:43 -04:00
Henry Zhu
3f5b7554b8 v7.1.2 2018-09-28 18:19:38 -04:00
Henry Zhu
ead23d7112 v7.1.1 2018-09-28 16:02:43 -04:00
Nicolò Ribaudo
626f47982e Do not unpack array patterns that update a referenced binding (#8535)
Fixes #8528
2018-09-28 11:45:42 -04:00
Brian Ng
55faa27b93 Run test262 tests for exportNamespaceFrom (#8780) 2018-09-27 14:48:58 -05:00
Sampo Kivistö
090c364a90 Improved build performance by optimizing makeMappingKey method. (#8744) 2018-09-26 13:16:40 -07:00
Pig Fang
f38be13113 TypeScript: reserve unknown as TSUnknownKeyword (#8755) 2018-09-25 12:19:32 -05:00
Nicolò Ribaudo
889cdb8da5 Use babel-check-duplicated-nodes (#8768) 2018-09-25 10:00:48 -05:00
Nicolò Ribaudo
af694ebae1 [decorators] Support async and generator methods (#8742) 2018-09-25 10:03:03 +02:00
Brian Ng
a19b72e46d jest@23.6.0 (#8764) 2018-09-24 18:53:41 -05:00
Brian Ng
38cf318f61 Bump lint-related deps (#8765) 2018-09-24 18:09:54 -05:00
Brian Ng
be027fd36c Bump babel-related deps (#8763) 2018-09-24 17:19:01 -05:00
Nicolò Ribaudo
5150f5f500 [decorators] Fields are enumerable (#8761) 2018-09-24 23:36:32 +02:00
Brian Ng
9f407e0735 Fix some missing parens cases with OptionalMemberExpression in generator (#8751) 2018-09-23 10:54:13 -05:00
Logan Smyth
3b0f9a9f1e Delete undefined options so we handle old core versions with new CLI versions. (#8728) 2018-09-19 08:56:40 -07:00
Brian Ng
9e7c7f5683 Handle throw expressions in generator (#8727)
Fixes #8716
2018-09-18 18:10:48 -04:00
Henry Zhu
fad74959f8 v7.1.0 2018-09-17 15:29:37 -04:00
Henry Zhu
2b68181af2 add ignore files [skip ci] 2018-09-17 15:28:38 -04:00
Brian Ng
9b4b436e1f Fix parsing of newline between 'async' and 'function' (#8698) 2018-09-16 22:09:23 -05:00
Logan Smyth
aa33303112 Fix logic/Flow error with versionRange. (#8714) 2018-09-15 15:37:03 -07:00
Logan Smyth
bd0c62dc0c Allow users to choose how the configuration root is selected. (#8660) 2018-09-15 13:03:46 -07:00
Nicolò Ribaudo
aac8118b7f Update helpers version fro 7.0.1 to 7.0.2 (#8703) 2018-09-14 22:55:27 +02:00
Brian Ng
8897b67f40 Fix TSParameterProperty getting lost with transform-classes (#8682) 2018-09-14 10:30:15 -05:00
Brian Ng
380f2a0297 Fix typescript parsing typed object shorthand methods (#8677) 2018-09-14 10:20:59 -05:00
Brian Ng
402bd1cc42 Adjust TSParameterProperty handling to work with transform-parameters (#8695) 2018-09-14 10:20:43 -05:00
Brian Ng
6059637f09 babel-eslint@9.0.0 (#8680) 2018-09-14 10:20:22 -05:00
Brian Ng
880fc1f54e Fix es6.string.iterator mapping in babel-preset-env (#8693) 2018-09-14 10:20:00 -05:00
Henry Zhu
fc1a52cb75 remove force publish, temp tag [skip ci] (#8679) 2018-09-14 10:47:37 -04:00
Nicolò Ribaudo
82a0e681ab Add "decoratorsBeforeExport" to the babel-standalone presets (#8649) 2018-09-13 10:52:40 +02:00
Retsam
8f5e9e143b Fixes the link to the babel-parser output docs (#8678) [skip ci]
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.
2018-09-12 09:18:20 +02:00
Logan Smyth
13798feefb Fix prerelease checks in .availableHelper and transform-runtime definitions. (#8659) 2018-09-10 18:25:21 -07:00
Retsam
9ad8b2bb2c Fix typescript import elision (#8666) 2018-09-10 17:42:22 -05:00
宋铄运
d2b559af59 Add issue.sh to Patreon Silver sponsors (#8647) [skip ci] 2018-09-10 08:48:44 -06:00
James Garbutt
252660f248 ts generator: allow reserved keywords in interfaces (#8627) 2018-09-10 09:22:36 -05:00
Sven Sauleau
0e7d7cfccc Merge pull request #8661 from babel/feat-run-fix-json-on-fix
Makefile: run fix json on fix
2018-09-10 09:41:55 +02:00
Sven SAULEAU
53c6c98bdb chore: fix-json new options 2018-09-10 08:04:32 +02:00
Sven SAULEAU
802fc2ac80 feat: invoke fix-json on fix target 2018-09-10 08:04:20 +02:00
Siddharth Parmar
e372129d00 Add tests for static math methods (#8626) 2018-09-09 18:08:34 -07:00
Logan Smyth
79b2af5997 Format fixture JSON with Prettier. (#8658) 2018-09-09 17:57:52 -07:00
Frederic Germain
45c28fa785 Use eslint-local-rules plugin
This allows to avoid having errors in editors that
supports eslint

cf https://github.com/eslint/eslint/issues/8769
2018-09-07 16:54:07 -07:00
Mateusz Burzyński
1e1a89ca70 Allow regular plugins/presets resolution algorithm for packages outside of the monorepo (#7582) 2018-09-07 16:37:10 -07:00
Jeff Rafter
1b03906da4 Allow users to specify a module for inline scripts (#6223) 2018-09-07 16:33:19 -07:00
Maaz Syed Adeeb
7accee9c24 [TS] Transform multiple assert and assign correctly (#7217)
* Transform multiple assert and assign correctly

* Handling nested TSAsExpressions in the transform
2018-09-07 16:23:18 -07:00
Logan Smyth
7273cf8fe5 Fix a linting error. 2018-09-07 16:09:25 -07:00
Aaron Ang
dad55ef1d6 Test babel-cli --source-maps and errors (#5377) 2018-09-07 15:30:24 -07:00
Nicolò Ribaudo
9aec4ad159 Add support for the new decorators proposal (#7976) 2018-09-07 15:58:42 +02:00
Vikram Rangaraj
29a2878973 Use jsonc to parse babelrc comments in markdown files (#8643) [skip ci]
* [skip ci] use markdown jsonc to parse comments in README files

* [skip ci] change json to jsonc type in other markdown files
2018-09-07 15:50:51 +02:00
Elian Ibaj
9eef660daa Allow patterns as argument of RestElement (#8414) 2018-09-06 22:35:37 +02:00
Nathan Shane
d9149aa2f3 Fix broken links to old changelogs (#8635) [skip ci] 2018-09-06 00:58:50 +02:00
Brian Ng
58017044a3 Bump flow to 0.80 and fix sourceType error (#8630) 2018-09-05 09:00:53 -05:00
Nicolò Ribaudo
c5279eeca4 [static private] Use explicit descriptors instead of an object (#8620)
This is similar to ec69b4bb12, 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.
2018-09-05 15:08:40 +02:00
Logan Smyth
f6643d1804 Merge pull request #8624 from loganfsmyth/misc-fixes
Verify 'sourceMap' option with hasOwnProperty, and verify string-typed 'version'
2018-09-04 09:27:10 -07:00
Sven Sauleau
07fae82a8a fix(types): missing unambiguous sourceType (#8610) 2018-09-04 10:03:48 -05:00
Logan Smyth
fc91b94a86 Fix misplaced dependency from PR #8616 2018-09-03 23:36:34 -07:00
Nicolò Ribaudo
d4e23b5b2a [static private] Unify loose handling of static and instance props (#8614) 2018-09-04 08:10:46 +02:00
Siddharth Parmar
262787bd92 Add static Math methods to plugin-transform-runtime (#8616)
* Add static Math methods to plugin-transform-runtime

* Remove methods which are not part of TC39 standard

* Use semver to conditionally include Math module
2018-09-03 20:49:51 -07:00
Logan Smyth
9232e8b405 Validate the type of the 'version' option for transform-runtime. 2018-09-03 18:44:10 -07:00
Logan Smyth
dd985c3be3 Verify 'sourceMap' with hasOwnProperty since it can be falsy. 2018-09-03 12:22:22 -07:00
Nicolò Ribaudo
4beb977f15 [static private] Use correct min version in helpers (#8613)
* [staic private] Use correct min version in helpers

* Always use patch version
2018-09-03 11:36:26 -07:00
Adam Noakes
679e4b8f37 align regenerator runtime version (#8618) 2018-09-03 10:03:30 -07:00
Sven Sauleau
fc9becfdf2 Merge pull request #8170 from AviVahl/master
@babel/parser: expose a TypeScript definition file from package
2018-09-03 08:15:56 +02:00
Sven Sauleau
6893b7e7d2 fix: [skip ci] consistent naming 2018-09-03 08:09:26 +02:00
Bartosz Kaszubowski
ffc82374d2 Fix version badges in monorepo README (#8534)
* 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
2018-09-02 21:49:01 -07:00
Logan Smyth
2921f6cdb1 Pass missing caller metadata for .babelrc files. (#8601) 2018-09-01 15:46:38 -07:00
Robin Ricard
fb66fa6f90 Private Static Fields Features: Stage 3 (#8205)
* 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
2018-09-01 00:42:18 -04:00
Sven Sauleau
eda804da11 update COC contact (#8591) 2018-08-31 09:33:27 -05:00
Ryunosuke Sato
15f456651a Fix grammar in error message at @babel/plugin-transform-runtime (#8581) 2018-08-29 11:57:36 -07:00
Nicolò Ribaudo
9d244ae66b More helpful error message for missing decoratorsBeforeExport in parser (#8576) 2018-08-29 09:02:18 -05:00
Henry Zhu
04d09cc754 add access public to all packages [skip ci] (#8573)
If people copy paste to make an new package they might miss this and we will get a publish error later so figured we should add it to all.
2018-08-29 09:54:53 -04:00
Sebastian McKenzie
5447a40719 Remove LICENSE email and refer to other contributors (#8574) [skip ci]
Been years since I've been involved in Babel, so I feel like referencing other contributors is more appropriate now.
2018-08-29 09:48:10 -04:00
Sven Sauleau
d45ea2e5ff Merge pull request #8561 from siddhant1/master
Added pronounciation of babel
2018-08-28 07:45:22 +02:00
Henry Zhu
aeefec5f13 add link to audio [skip ci] 2018-08-28 00:32:44 -04:00
siddhant
9a3af17560 Added pronounciation of babel 2018-08-28 08:29:54 +05:30
Henry Zhu
bcec62c0ac update ourselves to 7.0 (#8558) 2018-08-27 19:22:35 -04:00
Henry Zhu
90fb82a535 v7.0.0 2018-08-27 17:41:21 -04:00
Henry Zhu
8a45fba510 testing temp tag [skip ci] 2018-08-27 17:32:28 -04:00
Logan Smyth
079780b432 Make it easier to re-run local prod builds (#8556) [skip ci] 2018-08-27 13:43:45 -04:00
Henry Zhu
4e64807afc use temp tag while having publishing issues [skip ci] 2018-08-27 13:16:39 -04:00
Henry Zhu
814c564c45 v7.0.0-rc.4 2018-08-27 12:42:00 -04:00
Henry Zhu
7a104e3e1d bump source-map-support (#8553) 2018-08-27 12:32:42 -04:00
Henry Zhu
b98799557a Lerna: remove exact [skip ci] (#8554)
We only wanted all the dependencies to be exact in the pre-release because of breaking changes. This will make it use the default `^`
2018-08-27 12:27:32 -04:00
Logan Smyth
1ac46a256d Merge pull request #8547 from loganfsmyth/runtime-cleanup
Remove nonstandard functions and fake prototype methods from babel-runtime
2018-08-26 21:25:50 -07:00
Logan Smyth
50d3c09883 Add support for asyncIterator. 2018-08-26 13:59:33 -07:00
Logan Smyth
508bfad55a Remove non-standard and prototype methods from constructor property use. 2018-08-26 13:59:33 -07:00
Logan Smyth
130814342a Enable a few disabled core-js utils now that we're reading for them in 7.x. 2018-08-26 13:52:19 -07:00
Logan Smyth
e0ee0570be Default highlightCode:true for the parser highlighting. (#8546) 2018-08-26 13:23:43 -07:00
Justin Ridgewell
edbffda091 Cleanup getLineInfo (#8540)
Removes an ignore control comment
2018-08-26 13:27:06 -04:00
Justin Ridgewell
72ee1816a4 Update to ES6 String methods (#8541) 2018-08-26 13:26:51 -04:00
tsangint
e875fc7bc1 Update url in buildUnknownError tips (#8544) 2018-08-26 15:00:32 +02:00
Justin Ridgewell
524d847763 Flatten TokenType class hierarchy (#8537)
`KeywordTokenType` and `BinopTokenType` were just meant to be factory
helpers, there's no reason for a class hierarchy.
2018-08-25 20:02:32 -04:00
Justin Ridgewell
5899940156 Update parser whitespace for clarity (#8539)
* 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.
2018-08-25 19:12:38 -04:00
Logan Smyth
595240f071 Add a 'whitelist' option for the external-helpers plugin to mirror the helper builder. (#8531) 2018-08-24 15:10:46 -07:00
Henry Zhu
cada040bec v7.0.0-rc.3 2018-08-24 14:06:00 -04:00
Nicolò Ribaudo
1f9b2a5c41 [_wrapNativeSuper] Don't wrap non-native constructors (#8501) 2018-08-24 19:58:49 +02:00
Logan Smyth
39fa102ee8 Use supportsStaticESM to toggle runtime module usage. (#8520) 2018-08-24 10:48:47 -07:00
Honza Javorek
e841ccca34 Upgrade slash (#8527) [skip ci]
The 1.x versions do not contain a full license text.
2018-08-24 11:31:27 -04:00
Artem Yavorsky
4249dbc8ea Add browserslist 4 support. (#8509) 2018-08-23 20:09:18 -05:00
Standa Opichal
a7cc3325cd Add LICENSE file to published npm packages [skip ci] (#8409) 2018-08-23 19:49:27 -04:00
Logan Smyth
023044c1d4 Reference the CommonJS helpers when a file is not explicitly a module. (#8518) 2018-08-23 15:09:14 -07:00
Rafael de Oleza
22bcfbe469 Fix path.scope.rename() to not change break clauses (#8478)
* Make labels on break and continue statements not referenced

* Add test for imports and labels with the same name
2018-08-23 14:20:57 -07:00
Jason Quense
47e05d70f3 Fixed issue with non-simple property paths in object-rest-spread loose mode (#8514)
* fix: object rest with default values bug

fixes #8323

* rename variable
2018-08-23 15:53:31 +02:00
Nicolò Ribaudo
c5e3b6d4bc [decorators] Don't set writable on accessors (#8513) 2018-08-23 00:54:28 +02:00
Logan Smyth
b04de1196a Rename exported functions where name conflicts with param. (#8505) 2018-08-21 13:54:29 -07:00
Henry Zhu
d07cef244e Update Babel to rc.2 (#8504) 2018-08-21 15:31:07 -05:00
dnalborczyk
6c68ca8e0a adjust supported npm versions to v3 (#8359) [skip ci] 2018-08-21 15:44:17 -04:00
Henry Zhu
f1d774b34f v7.0.0-rc.2 2018-08-21 15:22:07 -04:00
Jarda Snajdr
8874c5c481 Add missing es7.promise.finally polyfill when using useBuiltIns: usage (#8500)
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.
2018-08-21 14:53:11 -04:00
Yi Li
b439013cd4 Fix trailingComments for FunctionExpression that is CallExpression arguments (#8488) 2018-08-21 12:29:11 -05:00
Nicolò Ribaudo
f8b0a5579f Remove File#resolveModuleSource (#8470) 2018-08-20 12:14:55 -07:00
Logan Smyth
2a4f162366 Merge pull request #8485 from loganfsmyth/caller-option
Allow preset-env to toggle module handling based on flags from the caller (like babel-loader)
2018-08-20 10:44:11 -07:00
Brian Ng
55295cc545 Add initial ES2019 and saf12/elec3 support in env (#8438) 2018-08-20 12:32:18 -05:00
Nicolò Ribaudo
59e9c6322b Remove hub.file usage from babel-core 2018-08-20 19:30:29 +02:00
Yongxu Ren
0fd3da110d Rewrite Hub as interface #5047 2018-08-20 19:30:29 +02:00
Logan Smyth
d60c5e1736 Expose caller.supportsStaticESM as a flag to change preset-env behavior. 2018-08-20 10:27:55 -07:00
Logan Smyth
90bebe7186 Pass the caller.name option in Babel's own callers. 2018-08-20 10:27:54 -07:00
Logan Smyth
8d6ed7e0aa Expose an api.caller(...) handler for presets to access caller metadata. 2018-08-20 10:27:54 -07:00
Logan Smyth
8f4bae8ea4 Expose optional caller metadata to Babel ignore/only/test/include/exclude functions. 2018-08-20 10:27:54 -07:00
Logan Smyth
2c3c12fdf7 Enforce a limited set of cache key values for plugins/presets for future caching. 2018-08-20 10:12:19 -07:00
Logan Smyth
25d2f59018 Ensure that presets properly flatten their options. 2018-08-20 10:12:19 -07:00
Logan Smyth
3a399d1eb9 Cache individual programmatic descriptors along with the overall list. (#8494) 2018-08-20 10:08:21 -07:00
Logan Smyth
c2a2e24965 Take top-level config source into consideration when processing nested env/overrides. (#8493) 2018-08-19 21:46:09 -07:00
Logan Smyth
ef68114d67 Fix typo in sourcemap filtering. 2018-08-19 16:37:29 -07:00
Logan Smyth
ca639b4262 Preserve 'false'-options for disabled plugins/presets so that callers can use that to toggle behavior. (#8474) 2018-08-19 16:22:27 -07:00
wtgtybhertgeghgtwtg
7a51d72345 Bump js-tokens in @babel/highlight. (#8490) 2018-08-19 07:35:16 -04:00
dnalborczyk
ab8555a867 Update dependencies (#8364) 2018-08-17 10:26:25 -05:00
Nicolò Ribaudo
0136a26af7 Fix conflict in tests (#8486) 2018-08-17 11:36:10 +02:00
Yeonghoon Park
c75a00bd56 Fix default descriptor setting for class properties with decorators (#7429)
(legacy decorators)
2018-08-17 10:49:03 +02:00
Logan Smyth
ffa8e6cbae Allow babel-plugin/preset to be in package names outside the prefix, when used in a scope. (#8473) 2018-08-16 15:13:52 -07:00
Nikolay Emrikh
5043ec78bc Fixes setter paratemer default value (#8479)
* Fixes setter paratemer default value

* Not changes doesn't mutate loose variable
2018-08-16 01:54:50 -04:00
Nicolò Ribaudo
3989213e37 Remove unused file (#8472) 2018-08-15 09:08:28 +02:00
Nicolò Ribaudo
d79b5eeeff Require decoratorsBeforeExport option for decorators (#8465)
* Require decoratorsBeforeExport option for syntax-decorators

* Also babylon

* Enable test
2018-08-15 09:04:52 +02:00
Logan Smyth
1e0b649485 Allow transform-runtime to insert runtime references with absolute paths. (#8435) 2018-08-14 16:11:19 -07:00
Laxman
8c65230258 Fix link to babel-parser (#8464) [skip ci] 2018-08-13 15:54:07 +02:00
Mauro Bringolf
427aff559f Fix decorators interop bug with class field tdz
Co-authored-by: Jan Buschtöns <jan@buschtoens.me>
2018-08-13 08:57:09 +02:00
James DiGioia
122906d525 Verify if MemberExpression is computed
If a property access is computed, e.g. a[b], then it's in topic style. Currently,
this isn't accounted for. Test & change ensures this doesn't parse.
2018-08-10 08:06:38 -04:00
James DiGioia
25d01460fd Fix error message for #4 case
This impact private fields as well as smart pipeline, providing a clearer
error message for both.
2018-08-10 07:52:55 -04:00
wtgtybhertgeghgtwtg
de16ac08be Remove lodash where it isn't used. (#8446) 2018-08-09 23:21:41 -04:00
James DiGioia
ba5642d4ee Add test for computer properties
This seems to parse fine. Should it?
2018-08-09 22:08:39 -04:00
James DiGioia
15e6d844ae Remove additional parser logic
These are parsable only in follow-on proposals, not in the base proposal,
so we'll introduce that in a separate PR.
2018-08-09 22:08:23 -04:00
James DiGioia
d1cae2dec2 Remove unneeded comment
This is no longer true, now that we return `tt.hash`.
2018-08-09 21:10:43 -04:00
James DiGioia
11aee13ff2 Swap Yoda condition 2018-08-09 21:04:47 -04:00
Henry Zhu
0a958861c9 v7.0.0-rc.1 2018-08-09 16:06:08 -04:00
Henry Zhu
904bcaffe3 fix peer deps [skip ci] (#8445)
Should be anything 7.x
2018-08-09 15:59:14 -04:00
宋铄运
e855987c51 update sponsor [skip ci] (#8444)
Add issue.sh sponsor from Patreon
2018-08-09 15:58:28 -04:00
Henry Zhu
8b1406127a v7.0.0-rc.0 2018-08-09 11:56:00 -04:00
Henry Zhu
c8bb450032 remove proposals polyfills from default import [skip ci] (#8440)
The default import is replaced with only polyfills that are Stage 4; this is in alignment with how we have removed the Stage presets. This also would mean we would need to add new imports when necessary, but that can be in a future release.
2018-08-09 11:43:45 -04:00
Logan Smyth
b6db036ff7 Require v1.1.0 so that correct filter params are passed. (#8436)
PR #8418 introduced some new logic that uses the third parameter of `fs-readdir-recursive`'s `filter` option, the current directory, but missed that our dependencies only required `^1.0.0`, while that parameter was actually added in `1.1.0`. This means that if some other dependency forced a downgrade in the version to satisfy some range, or the user already had 1.0.0 module installed locally, it could cause problems,
2018-08-07 23:28:36 -04:00
Sam Grace
6476a0d089 Whitelist experimental-modules flag for babel-node (#8336) [skip ci] 2018-08-06 11:45:38 -04:00
Henry Zhu
6695f5e2f7 v7.0.0-beta.56 2018-08-03 21:02:42 -04:00
Henry Zhu
86ce2e4e0d remove old deps [skip ci] 2018-08-03 20:42:45 -04:00
Henry Zhu
8cffbbae75 Split @babel/runtime into 2 modules via @babel/runtime-corejs2 (#8266)
In Babel 6, we had `@babel/runtime` which _always_ uses `core-js` in its helpers, meaning that anyone who wants to use our helpers in a centralized modular way had to also use core-js, which isn't always ideal.

Early in the Babel 7 alpha, we added a `useBuiltins: true` option that would use separate copies of the helpers that would skip loading `core-js`, but this _still_ requires users to have an indirect npm dependency on `core-js`.

This PR splits our setup into two separate runtimes:

* ```
  'plugins': [
    ['transform-runtime'],
  ]
  ```
  with `npm install --save @babel/runtime` that just includes our helpers, and relies on users to globally polyfill any APIs they need.
* ```
  'plugins': [
    ['transform-runtime', { corejs: 2 }],
  ]
  ```
  with `npm install --save @babel/runtime-corejs2` that includes everything `@babel/runtime` does, but also includes a passthrough API for `corejs@2.x` and rewrites all of the helper modules to reference `core-js`.
2018-08-03 15:13:33 -04:00
Jan Schmidle
cb51704745 Babel cli fix recursion in file mode (#8418)
* added test case

* remove unnessecary parameter

* check for type directory as well in readRecursive filter
2018-08-03 09:06:27 -07:00
Logan Smyth
a8224d40e2 Split @babel/runtime into two separate runtime modules. 2018-08-02 19:25:07 -07:00
Logan Smyth
3210a7a873 Default to non-corejs helpers. 2018-08-02 19:24:41 -07:00
Logan Smyth
9c598a8e28 Build an explicit runtime. 2018-08-02 19:23:47 -07:00
Logan Smyth
a149466001 Move build-dist script to the runtime transform. 2018-08-02 19:23:47 -07:00
Logan Smyth
ec8330870e Refactor the runtime build-dist script. 2018-08-02 19:22:23 -07:00
Logan Smyth
363c5923f0 Remove unused options.json file. 2018-08-02 19:21:40 -07:00
Logan Smyth
8173b6e694 Merge pull request #8398 from loganfsmyth/helper-whitelisting
Only reference helpers from external/runtime helpers if they are known to be available.
2018-08-02 19:20:56 -07:00
Logan Smyth
e2d64f146c Only reference helpers from external helpers or runtime helpers if they are known to be available. 2018-08-02 18:44:56 -07:00
Logan Smyth
9392783738 Remove helpersNamespace in favor of helperGenerator. 2018-08-02 18:44:56 -07:00
Logan Smyth
810b7916c2 Expose an API to check if a helper is available in a given version range. 2018-08-02 18:44:56 -07:00
Logan Smyth
eb0e999987 Expose a minimum required Babel version for each helper. 2018-08-02 18:44:56 -07:00
kalenikalexander
5c728ea609 Fix private property parsing in Flow (#8340)
* Fix private property parsing in Flow

* Flow tests updated

* Fix type error

* Appropriate name was given to test folder

* Fix

* Empty

* Correct type annotation

* Add required changes in generator package

* Add required changes in flow-strip-types
2018-08-02 08:38:58 +02:00
Leong Jia Meng
b8f9ebf638 Update Documentation[skip ci] (#8412) 2018-08-01 10:33:11 -05:00
Brian Ng
55ca90b3fc Allow TSInterfaceDeclaration to be default export (#8408)
<!--
Before making a PR, please read our contributing guidelines
https://github.com/babel/babel/blob/master/CONTRIBUTING.md

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
-->

| Q                        | A <!--(Can use an emoji 👍) -->
| ------------------------ | ---
| Fixed Issues?            | Fixes #7118
| Patch: Bug Fix?          | Y
| Major: Breaking Change?  | N
| Minor: New Feature?      | N
| Tests Added + Pass?      | Yes
| Documentation PR Link    | 
| Any Dependency Changes?  |
| License                  | MIT
2018-07-31 12:57:57 -05:00
Brian Ng
1a0fe993f5 Ensure esmodule targets are parsed by browserslist (#8403) 2018-07-31 07:33:02 -05:00
Logan Smyth
02760d0f70 Run transform-runtime on the standalone bundle so it stays ES5-compatible. (#8024) 2018-07-29 16:52:11 -07:00
Henry Zhu
adca165ee9 v7.0.0-beta.55 2018-07-28 18:06:42 -04:00
Henry Zhu
fa86b2ddf0 Remove our own use of stage presets (#8397)
- also update the stage preset error message/readme's to point to the new blog post
2018-07-28 11:24:53 -04:00
Logan Smyth
5eb193c61f Ensure that Identifier source mappings explicitly start and stop on the generated range (#8380)
* Add sourcemap examples for identifiers in code generator.

* Generate sourcemaps with exact mappings for identifiers, even if leading/trailing tokens also use that location.
2018-07-27 16:27:33 -04:00
Nicolò Ribaudo
ec69b4bb12 Save full descriptor instead of only value for private fields. (#8318)
* Save full descriptor instead of only value for private fields.

Decorators can make private fields non-writable, so we need to store this
information somewhere.
The descriptor can also be used to implement private accessors.
2018-07-27 16:24:57 -04:00
Brian Ng
5fdcd29ef9 Ensure preset-env doesn't clobber browserslist defaults (#8391) 2018-07-26 15:22:26 -04:00
Andy
8ee24fdfc0 TypeScript: Support type arguments on tagged templates (#7754)
| Q                        | A
| ------------------------ | ---
| Fixed Issues?            | #7747 (partly)
| Patch: Bug Fix?          | 
| Major: Breaking Change?  | 
| Minor: New Feature?      | Yes
| Tests Added + Pass?      | Yes
| Documentation PR         |
| Any Dependency Changes?  |
| License                  | MIT

@JamesHenry This changes the AST format. CC @DanielRosenwasser for review.
Supports parsing type arguments on tagged template calls.
Should wait on Microsoft/TypeScript#23430 to be merged so we're sure we have the final syntax.
2018-07-26 10:44:43 -05:00
Qix
db2a9fc96e Fix order of optional argument reordering (#8376)
Previously, if the optional `opts` parameter wasn't passed, the _intent_ was to move the function it held into the `callback` parameter and null out the `opts` param - but instead, it was nulling both.
2018-07-26 11:25:35 -04:00
Sven Sauleau
75767e9273 Merge pull request #8381 from wtgtybhertgeghgtwtg/babelrcroots-array
Allow an Array for `babelrcRoots`.
2018-07-25 11:36:57 +02:00
wtgtybhertgeghgtwtg
4346a95b88 Perform check on each member of babelrcroots. 2018-07-24 16:57:24 -07:00
Maximilian Berkmann
26cbbb569f Bumped lodash to 4.17.10 (#8377) 2018-07-24 12:57:43 -04:00
Kevin Gibbons
a811cf78e1 Correctly parse interface methods named 'static' (#8374) 2018-07-24 09:25:55 +02:00
Henry Zhu
c70a32ab9d Throw when using Stage presets (#8293)
* inline stage presets into standalone, throw error with using Stage presets
2018-07-23 22:22:52 -04:00
Thiago Arrais
6f3a800677 Do not mutate ast (#8342)
This clones the given ast prior to working on it to avoid mutating the AST given to `transformFromAST`.
2018-07-23 22:20:55 -04:00
Kevin Gibbons
d781e207c8 Docs: fix typo in path (#8372) [skip ci] 2018-07-23 20:32:44 -04:00
James DiGioia
39e7ee6e65 Switch Pipeline types to extend NodeBase
This doesn't work because the `type` values are not compatible.
2018-07-22 18:55:12 -04:00
James DiGioia
094ef31c01 Wrap callback in try/finally
This ensures we clean up always if the callback throws.
2018-07-22 18:52:07 -04:00
James DiGioia
afd0638b74 Reuse hash token instead of new primaryTopicToken
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.
2018-07-22 18:46:31 -04:00
James DiGioia
6e41edb90f Fix TopicContextState type in Flow 2018-07-22 17:58:51 -04:00
dnalborczyk
8b10a44fe1 remove .then from dynamic import parser exception message (#8355) 2018-07-21 08:26:17 +02:00
dnalborczyk
adae1501ac update jest (major), babel-jest (major) (#8341)
updated `jest` and `babel-jest` to `v23`

fixed breaking change in `jest`:
- https://github.com/facebook/jest/blob/master/CHANGELOG.md#2300
- https://github.com/facebook/jest/pull/5558

_edit:_
forgot to mention. test runner fix is based on: https://github.com/babel/babel/blob/master/packages/babel-parser/test/helpers/runFixtureTests.js#L11
2018-07-19 10:43:35 -04:00
dnalborczyk
c8038f69fe update prettier (#8339) 2018-07-19 09:08:45 -05:00
dnalborczyk
30ea328e97 bump flow (#8338) 2018-07-19 09:41:09 -04:00
dnalborczyk
16b1f8c427 updates eslint, babel-eslint, eslint-plugin-flowtype, eslint-plugin-prettier (#8337) 2018-07-19 09:36:52 -04:00
Henry Zhu
a582cc5bd8 update changelog for .53/.54 [skip ci] 2018-07-18 08:54:05 -04:00
Henry Zhu
84282f199b v7.0.0-beta.54 2018-07-16 13:59:43 -04:00
Logan Smyth
52a569056c Merge pull request #8327 from loganfsmyth/drop-pattern-matching
Treat string ignore/only/test/include/exclude values as paths with only basic pattern matching
2018-07-16 10:11:23 -07:00
Henry Zhu
7446d06911 also default stage 2 to decoratorsLegacy true [skip ci] 2018-07-16 13:07:17 -04:00
James DiGioia
8817fcf03e Fix stage-0/1 import of pipeline/decorators proposals (#8317)
Just default to pipeline "minimal" and true for decorators for ease of use. We are going to remove the stage presets next so it's fine since it will error when using the plugin individually later.
2018-07-16 13:02:54 -04:00
Logan Smyth
6d177ba4c5 Remove micromatch and use a simple pattern matching utility. 2018-07-16 09:57:14 -07:00
Logan Smyth
935533cff3 Ensure that the wildcard interop is used with re-export + default. (#8316) 2018-07-14 12:49:31 -07:00
Logan Smyth
c4f67bfa57 Leave it to users to clear the require cache if they want to. 2018-07-14 12:48:58 -07:00
Logan Smyth
2854a187be Remove dependency on barely-used package. 2018-07-14 12:41:36 -07:00
rugk
62ee1adc85 Add link to audio version of song (#8320) 2018-07-13 15:34:40 -05:00
Logan Smyth
fd9ebf9e1d Remove option-filtering options from the final options results. (#8315)
| Q                        | A <!--(Can use an emoji 👍) -->
| ------------------------ | ---
| Fixed Issues?            | Fixes https://github.com/babel/babel-loader/issues/642
| Patch: Bug Fix?          | Y
| Major: Breaking Change?  | N
| Minor: New Feature?      |
| Tests Added + Pass?      | Yes
| Documentation PR Link    | <!-- If only readme change, add `[skip ci]` to your commits -->
| Any Dependency Changes?  |
| License                  | MIT

Since these were getting left in, things that loaded the config, and then passed in back to Babel would get `test` and such _twice_, which could lead to either bad configuration merging, or no configuration at all if the patterns were relative to different directories, as was the case in https://github.com/babel/babel-loader/issues/642.
2018-07-13 07:01:11 -07:00
James DiGioia
7931f4c241 Rename topicContextState -> .topicContext 2018-07-12 23:11:55 -04:00
James DiGioia
b847d40842 Inline readTopicContextState method 2018-07-12 23:10:07 -04:00
James DiGioia
e91a02cc49 Reuse declared type in function return value 2018-07-12 23:08:11 -04:00
James DiGioia
cc526940ee Quote proposals in error message 2018-07-12 23:07:09 -04:00
James DiGioia
7188820151 Delete commented code 2018-07-12 22:55:01 -04:00
James DiGioia
00845709ce Add comment for number sign 2018-07-12 22:48:53 -04:00
James DiGioia
b50fdc191e Inline function checkSmartPipelineHeadEarlyErrors
It's only used once.
2018-07-12 22:47:45 -04:00
James DiGioia
ef0f723fc5 Reverse yoda conditions
If "smart" proposal is, we'll no longer say.
2018-07-12 22:46:34 -04:00
Daniel Tschinder
dca6125128 Update pirates to 4.0 (#8308) 2018-07-11 16:04:27 -04:00
Henry Zhu
093483c399 remove yearly preset folders [skip ci] 2018-07-11 11:08:33 -04:00
Henry Zhu
b89234b1a2 v7.0.0-beta.53 2018-07-11 09:39:52 -04:00
Ryan Tsao
f2fd9e982e Make env preset build-data scripts reproducible (#8299) 2018-07-10 20:43:45 -05:00
Andy
301db1b921 TypeScript: Support type arguments on JSX opening and self-closing tags (#7799) 2018-07-10 17:19:42 -05:00
J. S. Choi
fbf62b4830 Implement Smart Pipeline proposal in @babel/parser 2018-07-09 22:44:27 -04:00
James DiGioia
19a1705293 Support pipeline proposal flag in @babel/parser (#8291) 2018-07-09 16:59:56 -04:00
Henry Zhu
10910a10f5 Remove yearly presets from repo, inline in standalone (#8274)
These were already deprecated in v6, just didn't remove the folders?
2018-07-09 14:23:25 -04:00
Henry Zhu
dd6da3b3af rm extra changelog [skip ci] 2018-07-07 18:44:43 -04:00
Henry Zhu
d2d2118a44 Move v4, v5, v6 changelogs to separate files [skip ci] (#8286) 2018-07-07 18:43:34 -04:00
Mateusz Burzyński
21de1581aa Fixed fixture tests after merge (#8287) 2018-07-07 18:40:15 -04:00
Mateusz Burzyński
b5e64cb66e Remove unused bindings when excluding keys with rest in loose mode (#8264) 2018-07-07 19:54:51 +02:00
Alan Pierce
44f738bcbf Upgrade upath to avoid yarn failure on node 10 (#8283) [skip ci]
upath 1.0.4 doesn't support node 10, and this was fixed in later versions
( https://github.com/anodynos/upath/pull/15 )
2018-07-07 10:52:55 -04:00
Henry Zhu
13153ede92 add changelog for 6.23.1-3 [skip ci] 2018-07-07 10:28:01 -04:00
Mateusz Burzyński
c0c13ae30f Introduce objectWithoutPropertiesLoose helper (#8261) 2018-07-06 15:03:44 -04:00
Henry Zhu
cea562c009 Revert micromatch upgrade (regression) [skip ci] (#8281)
Original PR: https://github.com/babel/babel/pull/8038
Ref Issue: https://github.com/babel/babel/issues/8184

Windows paths are broken so wanted to get a fix out since I don't see us fixing it correctly soon enough? I think that's more important than fixing the security warnings that don't apply to us until we can actually handle the change, otherwise need a version of the code that doesn't use the old dep but doesn't change the windows behavior or just remove the matching which will take some time.
2018-07-06 14:28:02 -04:00
James DiGioia
f93fa28c90 Improve error messages around pipeline option (#8279) 2018-07-06 13:01:35 -04:00
Brian Ng
430a105ae7 Compile against beta 52 (#8282) 2018-07-06 12:12:19 -04:00
Tatsuyuki Ishi
3e71108f82 Invoke Jest main file directly (#8187) 2018-07-06 10:09:49 -04:00
Tim Kendrick
e9184ed05e [babel-types] Fix isNodesEquivalent() behavior for TemplateElements (#8165)
Fixes #8163

The `isNodesEquivalent()` algorithm incorrectly assumes that any object properties must themselves be AST nodes, which is not the case here, causing the error.
2018-07-06 08:45:25 -04:00
Henry Zhu
663c96db04 v7.0.0-beta.52 2018-07-05 20:59:03 -04:00
Rubén Norte
85b7154f91 Add visitor key for Flow typeArguments in call expressions (#8273)
| Q                        | A <!--(Can use an emoji 👍) -->
| ------------------------ | ---
| Fixed Issues?            | Fixes #8272 <!-- remove the (`) quotes to link the issues -->
| Patch: Bug Fix?          | Yes
| Major: Breaking Change?  |
| Minor: New Feature?      |
| Tests Added + Pass?      | Yes
| Documentation PR         | <!-- If so, add `[skip ci]` to your commit message to skip CI -->
| Any Dependency Changes?  |
| License                  | MIT

The visitor for `typeArguments` in function calls wasn't set in the definition, so type annotations added there weren't visited.

This is required to fix https://github.com/babel/babel-eslint/issues/644
2018-07-05 14:58:15 -05:00
Henry Zhu
f70d7c8dfe update template [skip ci]
link to babel/website
2018-07-05 14:19:15 -04:00
Justin Ridgewell
e229ebbb8a Optimize async to generator (#8267)
* Optimize async to generator

We can reuse the step function, avoiding a closure on every invocation.

* Rename step
2018-07-05 10:51:16 -04:00
dnalborczyk
db1385fb82 upgrades eslint v5 (major), babel-eslint, eslint-plugin-flowtype, eslint-plugin-prettier (#8259)
* upgrade eslint v5 (major), babel-eslint (minor), eslint-plugin-flowtype (minor), eslint-plugin-prettier (patch)

* fix makefile: remove (default) .js file extension, remove non-existing glob pattern

* fix linting errors

* add '*.js' glob back to include babel.config.js for linting
2018-07-05 09:17:01 -05:00
Logan Smyth
b6eba87daa Rename some test fixtures so they run properly. (#8265) 2018-07-04 18:33:26 -07:00
Logan Smyth
2cf2fd544b Ensure that we don't get unexpected output files for tests that throw. (#8208) 2018-07-04 16:06:58 -07:00
Logan Smyth
9bd4b46fd6 Merge pull request #8198 from loganfsmyth/sourcemap-loading
Prefer explicit object maps, and properly load relative maps.
2018-07-04 15:39:42 -07:00
Pierre-Marie Dartus
4d125c391a Typescript: Avoid stripping class properties when a decorator is set (#8238)
The `babel-plugin-transform-typescript` removes class properties without value regardless if decorators are assigned to it or not.
2018-07-04 07:44:33 -04:00
dnalborczyk
afa1207224 upgrade flow to v0.75.0 (#8256) 2018-07-03 11:23:32 -05:00
Rodolfo Rodriguez
c6a4108e57 Update READMEs for yarn (#8215) [skip ci]
Closes https://github.com/babel/babel/pull/8255
2018-07-03 09:03:18 -04:00
John Buffington
236bd9309c remove emojis from cli output (#8243) (#8250) 2018-07-02 09:34:55 +02:00
James DiGioia
eac4c5bc17 Add proposal flag to pipeline plugin (#8196)
This is going to be required so we can add support for other proposals,
as well as later set the accepted proposal as the default.

Update stage-0 and stage-1 presets with `pipelineProposal` to thread down to
the plugin.
2018-06-28 01:19:40 +02:00
Mateusz Burzyński
e1662759ed Remove regenerator hacks in checkDuplicatedNodes (#8220) 2018-06-24 15:40:47 +02:00
Ben Newman
12c75cc08c Update regenerator-{runtime,transform} to latest versions. (#8219)
https://github.com/facebook/regenerator/pull/347
https://github.com/facebook/regenerator/pull/349
https://github.com/facebook/regenerator/pull/350
2018-06-24 10:19:21 +02:00
Sven Sauleau
9283efaeb7 Merge pull request #8197 from loganfsmyth/babel-plugin-allowed
Allow @foo/babel-plugin as an unexpanded plugin name, and @foo as a shorthand for it.
2018-06-20 16:36:03 +02:00
Logan Smyth
532c25c8db Ensure that file-path sourcemaps load relative to the file containing the comment. 2018-06-18 22:06:08 -07:00
Logan Smyth
3c90baaf6c Prefer object sourcemaps over file-inlined sourcemaps. 2018-06-18 21:49:23 -07:00
Logan Smyth
add5f8d0fe Allow @foo/babel-plugin as an unexpanded plugin name, and @foo as a shorthand for it. 2018-06-18 21:36:02 -07:00
Soumya Himanish Mohapatra
cb79473499 remove regression to support output of full directory hierarchy with --out-dir (#8189)
* remove regression to support output of full directory hierarchy with --out-dir

* add mkdirp to package.json
2018-06-18 21:19:46 -07:00
Brian Ng
d383659ca6 Compile against beta 51 (#8158) 2018-06-15 10:28:15 -04:00
Ger Hobbelt
e86d1e0d6a babel/parser: test helpers: write expected throw message to options.json ~ complete jest -u functionality (#8178) [skip ci]
* babel/parser: test helpers: when test fails with an exception and both reference output file and options.json file do not exist, write a simple options.json with the error message to expect when such a file doesn't exist yet. This completes the `jest -u` capability for new tests which are expected to *fail*.
2018-06-15 10:27:19 -04:00
Ger Hobbelt
a2cd264211 jest binary is a bash shell script, not a nodeJS file. (#8179) [skip ci] 2018-06-15 10:18:14 -04:00
Sven Sauleau
8f8b4e8e82 Switch new website in READMEs (#8181) [skip ci] 2018-06-15 10:13:20 -04:00
Ger Hobbelt
07c88e6f0b Use charCodes at more places in the parser (#8176) 2018-06-15 13:21:32 +02:00
Ger Hobbelt
ba98cf782a Removed constant condition in parser (#8177) 2018-06-15 13:14:14 +02:00
kenju
bc64e02bf8 fix issue number of link for #3508 in CHANGELOG (#8175) [skip ci] 2018-06-15 12:12:21 +02:00
Avi Vahl
0e8830f3a8 Fix unneeded uppercasing in comment 2018-06-15 02:46:02 +03:00
Avi Vahl
4cdfee768b Add jsdocs to parse() and parseExpression()
also change parameter name to match docs
2018-06-15 02:42:32 +03:00
Avi Vahl
adbf2a15f9 Clearer naming of interfaces 2018-06-15 01:12:58 +03:00
Avi Vahl
ca65781132 @babel/parser: expose a TypeScript definition file from package
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
dnalborczyk
814fce946d bump flow to v0.74.0 (#8162) 2018-06-13 15:00:09 -04:00
dnalborczyk
6894465df8 fix flow typeof refinement (#8161) [skip ci] 2018-06-13 14:59:57 -04:00
Ben Newman
60c4f30c71 Update regenerator-transform to latest version (0.13.0). (#8154)
| Q                        | A <!--(Can use an emoji 👍) -->
| ------------------------ | ---
| Fixed Issues?            | None
| Patch: Bug Fix?          | No
| Major: Breaking Change?  | No
| Minor: New Feature?      | No
| Tests Added + Pass?      | Existing tests pass
| Documentation PR         | No
| Any Dependency Changes?  | `regenerator-transform` in `@babel/plugin-transform-regenerator`
| License                  | MIT

I recently updated `regenerator`, `regenerator-transform`, and `regenerator-preset` to fix a number of vulnerabilities surfaced by `npm audit`. There was no need to update `regenerator-runtime`, as it does not have any dependencies of its own. I'm happy to report the latest versions of these packages have zero vulnerability warnings according to `npm audit`.

While I was at it, I also updated all dependencies of these packages to their Babel 7 equivalents, so there should hopefully be fewer legacy package dependencies installed because of Regenerator.
2018-06-13 09:36:27 -05:00
Henry Zhu
c313b267f7 v7.0.0-beta.51 2018-06-12 17:18:28 -04:00
Henry Zhu
eb54adb755 use a semver range for core peerDep [skip ci] 2018-06-12 17:10:15 -04:00
Henry Zhu
e0ef50c00f Use older semver range since lerna update does not change peerDeps on publish [skip ci] (#8152) 2018-06-12 16:45:10 -04:00
Henry Zhu
3af623678f v7.0.0-beta.50 2018-06-12 15:46:05 -04:00
Henry Zhu
96528d36df keep lerna version 2018-06-12 15:22:34 -04:00
Henry Zhu
5de12c26f6 update to latest 2.x lerna 2018-06-12 15:02:56 -04:00
Henry Zhu
4b5a55d937 fix merge issue again 2018-06-12 13:59:43 -04:00
Guy Bedford
036c429ce1 system hoisting and export refinements (#8104) 2018-06-12 13:45:53 -04:00
Nicolò Ribaudo
3c46e75b8f Don't split an exported class when renaming an inner binding (#8051) 2018-06-12 13:45:21 -04:00
晏兵兵
106907e605 fix: import Parser as type (#8146) [skip ci] 2018-06-12 13:42:10 -04:00
Nicolò Ribaudo
387cda8fbb isConstantExpression should return true for immuable bindings (#8122)
* isConstantExpression should return true for immuable bindings

* New test

* Don't return undefined
2018-06-12 13:40:52 -04:00
Henry Zhu
86c10ff4f3 fix merge issue 2018-06-12 13:33:07 -04:00
Miguel Albernaz
6d5392554f Adds JSXFragment to plugin-transform-typescript check for the presence of jsx (#7996) 2018-06-12 13:17:25 -04:00
Alexey Zaslavsky
0b25e3327c Fix 'Missing class properties transform' error when parsing class properties with Typescript syntax (#8007) 2018-06-12 13:13:30 -04:00
Brian Ng
b6455c611b Allow ts modifier names to be used as function argument names (#8030) 2018-06-12 08:38:38 -05:00
Yuri Karadzhov
313960e601 Remove preset-env outdated test (#8149) 2018-06-12 08:51:11 -04:00
Yuri Karadzhov
9e4c56f990 Fix Safari TP and regular versions comparison (#8132) 2018-06-11 14:36:45 -04:00
Nicolò Ribaudo
119db23ee3 Don't regenerate babel-types docs in the readme (#8142) 2018-06-11 14:35:21 -04:00
Vincent Chan
3432792568 add jsesc options support (#8143) 2018-06-11 14:34:41 -04:00
Brian Ng
cc4ee350e4 Ensure regex-dot-all runs before unicode-regex in preset-env (#8138)
<!--
Before making a PR please make sure to read our contributing guidelines
https://github.com/babel/babel/blob/master/CONTRIBUTING.md

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.
-->

| Q                        | A <!--(Can use an emoji 👍) -->
| ------------------------ | ---
| Fixed Issues?            | --
| Patch: Bug Fix?          |
| Major: Breaking Change?  |
| Minor: New Feature?      |
| Tests Added + Pass?      | Yes
| Documentation PR         | <!-- If so, add `[skip ci]` to your commit message to skip CI -->
| Any Dependency Changes?  |
| License                  | MIT

Good ol' plugin ordering 🙃

Ref: https://github.com/babel/babel/pull/7065#issuecomment-395959112
2018-06-11 08:09:44 -05:00
Sven Sauleau
5bd79c70a5 Merge pull request #8144 from BeniCheni/add-labels-to-readmes
Add Labels to READMEs Generator & Update README's w. Links To Open Issues (for some pkg's)
2018-06-11 07:32:34 +02:00
BeniCheni
01f6f4c66d Revert babel-types README to "master" 2018-06-11 01:19:18 -04:00
BeniCheni
000fa83b9e For selective packages, update READMES w. links for open issues
babel-generator; babel-node; babel-standalone; babel-template
2018-06-11 00:16:48 -04:00
BeniCheni
efb34aa7dc For selective packages, add items for labels mapping of pkg => labels & update READMES w. links for open issues
babel-generator; babel-node; babel-standalone; babel-template
2018-06-10 23:41:55 -04:00
Brian Ng
ab928713af Bump test262-stream and update test262 tests (#8139) 2018-06-10 10:55:40 +02:00
Serhii Nanovskyi
3de053cc6c Validate @babel/preset-env options (#8031) 2018-06-09 18:38:14 -05:00
Sven Sauleau
110779e9f3 Merge pull request #8133 from alexzherdev/8131-open-issues-link
Link to open issues in READMEs [skip ci]
2018-06-09 15:03:49 +02:00
Alex Zherdev
8070a2204d Link to open issues in READMEs [skip ci] 2018-06-08 20:54:44 -07:00
Nicolò Ribaudo
9f4e2f81d8 [class-properties] Remove unnecessary return and temp variable (#8123)
* Remove unnecessary temp variable

* Update tests
2018-06-08 07:02:36 +02:00
Mathias Bynens
415d79bdfe Update plugin-proposal-unicode-property-regex for Unicode v11 (#8127)
Ref. https://github.com/tc39/ecma262/pulls/1218.
Ref. https://github.com/tc39/ecma262/issues/1219.
2018-06-07 21:54:44 +02:00
Mathias Bynens
62eb32677c ECMAScript follows the latest version of the Unicode Standard. Earlier this week, Unicode v11 was officially released. This patch updates babel-parser to support the new identifier characters. (#8125)
Ref. https://github.com/tc39/ecma262/issues/1219.
2018-06-07 21:54:12 +02:00
Guy Bedford
7da7e760a6 support import.meta in system transform 2018-06-07 13:24:19 -05:00
hassanAli321
bd44902024 update fixture 2018-06-07 13:22:45 -05:00
hassanAli321
6480ae4a9f fix flow-double-nullable-type-cant-be-parsed 2018-06-07 13:22:45 -05:00
Marco Massarotto
80b3362fcc update micromatch to ^3.1.10 (#8038) 2018-06-06 12:44:02 +02:00
Sven SAULEAU
8bc0182489 Merge pull request #8119 from palashmon/fix-package-readmes
fix(typo): in readmes package label
2018-06-05 19:24:25 +02:00
Palash Mondal
e9d861537f [skip ci] updated babel-register readme 2018-06-05 22:43:46 +05:30
Palash Mondal
153ad4c6f3 fix(typo): in readmes package label
"babel-regiser" to "babel-register" and "pkg: regiser" to "pkg: register"
2018-06-05 21:19:51 +05:30
Sven SAULEAU
218d69007e Merge pull request #8112 from babel/feat-add-issues-link-in-readmes
Feat add issues link in readmes
2018-06-05 07:39:41 +02:00
Nicolò Ribaudo
f838a7e9f1 Test on node 10 (#7908)
* Use node 10 on circle an node 9 on travis

* Update v8flag
2018-06-04 22:22:30 +02:00
Nicolò Ribaudo
6349118bed Change decoratorsBeforeExport default to false (#8113) 2018-06-04 21:12:01 +02:00
Sven SAULEAU
8bbb10c021 chore: [skip ci] regen READMEs 2018-06-04 17:33:21 +02:00
Sven SAULEAU
f614809002 feat: [skip ci] add link to issues in READMEs 2018-06-04 17:33:16 +02:00
Sven SAULEAU
b445b79734 Refactor move docs (#8108)
* feat: [skip] generate readme script

* docs: [skip ci] update READMEs

* docs: [skip ci] fix code block type

* chore: [skip ci] move generator script
2018-06-04 10:32:39 -04:00
Sven SAULEAU
b6eaaa2496 Merge pull request #8107 from babel/xtuc-patch-3
docs: [skip ci] update polyfill README
2018-06-04 08:46:51 +02:00
Sven SAULEAU
e2471337f4 docs: [skip ci] update polyfill README 2018-06-04 08:46:08 +02:00
Sven SAULEAU
826edd0bd5 Merge pull request #8106 from babel/xtuc-patch-3
update runtime README
2018-06-04 08:43:15 +02:00
Sven SAULEAU
f434a50829 docs: update runtime README 2018-06-04 08:42:48 +02:00
Brian Ng
5895277b32 Bump prettier to v1.13.2 2018-06-03 07:54:39 -05:00
Brian Ng
62114b807b Remove unneeded prettier call in make fix 2018-06-03 07:54:39 -05:00
chocolateboy
2abd7839e1 Fix ReferenceError in the wrapNativeSuper helper (#8100)
Fix a ReferenceError caused by a typo (`_construct` instead of
`construct`) in the external `wrapNativeSuper` helper. (The typo
doesn't usually cause an error in inline helpers because `_construct`
happens to be the default name given to the `construct` helper
function.)
2018-06-02 18:00:02 +02:00
Nicolò Ribaudo
b8dcd6f593 Remove parser support for decorators optional parentheses (#8037)
* Remove parser support for decorators optional parentheses

* Update fixtures
2018-06-02 13:07:15 +02:00
dnalborczyk
fe556c502d fix folder name (#8074) 2018-06-01 17:58:37 +02:00
Peter Leonov
ab62a94399 make isReferenced() recognise ObjectTypeProperty (#8060)
fixes #8057
2018-05-31 00:07:56 +02:00
Nicolò Ribaudo
d83d141e00 Move tests from babylon/ to babel-parserr/ 2018-05-30 22:12:33 +02:00
Nicolò Ribaudo
cb17f07ac9 Update syntax-decorators options (#7938)
* Add decoratorsBeforeExport to the syntax plugin
* Require legacy: true, like in the transform plugin
2018-05-30 22:00:18 +02:00
Logan Smyth
21b9b2e42d Avoid a race condition in CLI directory creation. (#8082) 2018-05-30 10:35:08 -07:00
Erik Arvidsson
2a8ebbe7ae Remove parenthesizedArgument (#7981)
The extra field parenthesizedArgument was never set to true. It was
always set to false and the code that read this was incorrectly
checking if extra was present.

Fixes #7957
2018-05-29 13:58:21 -07:00
Brian Ng
9add6d88f5 Update regenerator version and test retain lines fixture (#8072) 2018-05-29 10:46:05 -07:00
ilya
2d2f37fa6c Update core-js to v2.5.7 (#8064) 2018-05-29 09:47:15 -05:00
Erik Arvidsson
7846eaebaa Do not quote JSX attribute keys for IdentifierName (#8045)
Given the following

```js
a = <F new/>
```

We used to generate:

```js
a = React.createElement(F, {"new": true})
```

but now we generate

```js
a = React.createElement(F, {new: true})
```

If you need to quote these (ie for ES3 you can use
transform-property-literals)
2018-05-27 12:48:18 -04:00
Nicolò Ribaudo
d45ee5e025 Add "decoratorsBeforeExport" option to @babel/generator (#7948)
* Add "decoratorsBeforeExport" option to @babel/generator

* Docs
2018-05-27 08:50:26 +02:00
Brian Ng
f699f1bbbf flow@0.73.0 (#8032) 2018-05-25 16:53:23 -05:00
Sam Goldman
f0283572a5 Support Flow's proto modifier syntax for declared classes (#7978)
<!--
Before making a PR please make sure to read our contributing guidelines
https://github.com/babel/babel/blob/master/CONTRIBUTING.md

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.
-->

| Q                        | A <!--(Can use an emoji 👍) -->
| ------------------------ | ---
| Fixed Issues?            | <!-- remove the (`) quotes to link the issues -->
| Patch: Bug Fix?          |
| Major: Breaking Change?  | No
| Minor: New Feature?      | Yes
| Tests Added + Pass?      | Yes
| Documentation PR         | <!-- If so, add `[skip ci]` to your commit message to skip CI -->
| Any Dependency Changes?  |
| License                  | MIT

See eb815be907 for more information about this feature.
    
The proto modifier indicates that a property declared using `x: T` syntax is actually present on the prototype object of the class, rather than an own property.
    
The proto and static modifiers are mutually exclusive, as class declarations don't simultaneously define the static prototype object, as they do the instance prototype.
    
This syntax is only supported on declared classes, not object types, interfaces, or runtime class declarations, and as such should only appear in library definitions.
2018-05-25 15:40:56 -05:00
Logan Smyth
90566103a6 v7.0.0-beta.49 2018-05-25 09:00:02 -07:00
Logan Smyth
cf8058e5b6 Handle kebab-case args in babel-node. (#8046) 2018-05-25 08:40:52 -07:00
Nicolò Ribaudo
90a174e7c4 Transform decorated classes from the export visitor (#8047)
Fixes gh-8041

<!--
Before making a PR please make sure to read our contributing guidelines
https://github.com/babel/babel/blob/master/CONTRIBUTING.md

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.
-->

| Q                        | A <!--(Can use an emoji 👍) -->
| ------------------------ | ---
| Fixed Issues?            | #8041
| Patch: Bug Fix?          |👍
| Major: Breaking Change?  |
| Minor: New Feature?      |
| Tests Added + Pass?      | Yes
| Documentation PR         | <!-- If so, add `[skip ci]` to your commit message to skip CI -->
| Any Dependency Changes?  |
| License                  | MIT

<!-- Describe your changes below in as much detail as possible -->
2018-05-25 08:36:30 -07:00
Logan Smyth
9c707f9670 Update docs 2018-05-24 20:57:44 -07:00
Logan Smyth
53e4d74ebe Treat all filenames as absolute paths. (#8044) 2018-05-24 20:56:19 -07:00
Logan Smyth
98ff2ce877 Merge pull request #8023 from loganfsmyth/sync-async
Add a promise-returning *Async version of the transform and parse fns
2018-05-24 19:04:38 -07:00
Henry Zhu
0ffc8ed209 Compile against beta 48 (#8036) 2018-05-24 16:25:39 -07:00
Henry Zhu
e6d198eef5 v7.0.0-beta.48 2018-05-24 15:20:31 -04:00
Logan Smyth
86aacad2bc Disallow coverage on bundles. 2018-05-24 09:15:44 -07:00
Nicolò Ribaudo
6eab6f5863 [Babylon] Take the first set of options for plugins (#7994)
* [Babylon] Take the first set of options for plugins

* Fix test

* Docs
2018-05-24 08:54:32 -07:00
Brian Ng
555ee80f43 Fix some ts test fixtures 2018-05-24 10:03:03 -05:00
Brian Ng
a94cbf760a Set exprAllowed to false when parsing TSNonNullExpression (#7968) 2018-05-24 09:31:08 -05:00
Logan Smyth
0bc3027554 Add a promise version of each of Babel's transform functions. 2018-05-23 21:18:17 -07:00
Logan Smyth
6f3093b557 Track the sync and async implementations in the same files. 2018-05-23 21:18:15 -07:00
Jimmy Jia
7489f8da7b Fix include/exclude syntax in preset-env README [ci skip] (#8020) 2018-05-23 22:09:54 -04:00
Nicolò Ribaudo
dccaec7691 Update types (BigInt) 2018-05-24 00:30:57 +02:00
Nicolò Ribaudo
c992f5b61e Remove duplicated test (in the old babylon folder) 2018-05-24 00:30:57 +02:00
Logan Smyth
5cd1276a27 Expose the Flow 'all' option on the preset too. (#8016)
| Q                        | A <!--(Can use an emoji 👍) -->
| ------------------------ | ---
| Fixed Issues?            | 
| Patch: Bug Fix?          | 
| Major: Breaking Change?  |
| Minor: New Feature?      |
| Tests Added + Pass?      | Yes
| Documentation PR         | <!-- If so, add `[skip ci]` to your commit message to skip CI -->
| Any Dependency Changes?  |
| License                  | MIT

The `all` option landed in https://github.com/babel/babel/pull/7934/files#diff-3a8233bcd2766d2c7d87f23f944f7726R3 but it is only exposed from the plugin, not the preset, so this exposes it there too since the flow preset is what we want people to use.
2018-05-23 13:40:22 -07:00
Justin Ridgewell
2af7a33c4e Fix class inheritance in IE10 (#7969)
* Revert "Move subclass inheritance to end (#7772)"

This reverts commit f8ab9466d3.

* Only use getPrototypeOf if setPrototypeOf is implemented

* Update fixtures

* Helpers updates

* Update fixtures

* Fall back to getPrototypeOf

* Update fixtures
2018-05-23 16:21:21 -04:00
Nicolò Ribaudo
ffe04d9195 [babylon] Refactor mixin plugins handling & validation (#7999) 2018-05-23 15:28:05 -04:00
Nicolò Ribaudo
b33823e7f8 Better error message for invalid decorators syntax (#7986) 2018-05-23 15:26:35 -04:00
Logan Smyth
007bfb6565 Merge pull request #8010 from loganfsmyth/babel-node-options
Add more of babel-cli's options to babel-node too for consistency.
2018-05-23 09:47:58 -07:00
Logan Smyth
c8faa34848 Only set '.babelrc' option if user explicitly set it. 2018-05-23 09:25:43 -07:00
Logan Smyth
5bcca0123a Add --env-name option to babel-node, like babel-cli's option. 2018-05-23 09:25:05 -07:00
Logan Smyth
1d987fb655 Add --config-file option to babel-node, like babel-cli's option. 2018-05-23 09:23:50 -07:00
Logan Smyth
06e5c46c8d Fix typo in option validation. 2018-05-23 09:23:14 -07:00
Sven SAULEAU
52b800decb Add no-babelrc option in babel-node (#5621)
<!-- 
Before making a PR please make sure to read our contributing guidelines 
https://github.com/babel/babel/blob/master/CONTRIBUTING.md

For any 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
-->

| Q                        | A <!--(yes/no) -->
| ------------------------ | ---
| Patch: Bug Fix?          | 
| Major: Breaking Change?  | 
| Minor: New Feature?      | y
| Deprecations?            | 
| Spec Compliancy?         | 
| Tests Added/Pass?        | y/y
| Fixed Tickets            | #5616
| License                  | MIT
| Doc PR                   | <!-- if yes, add `[skip ci]` to your commit message to skip CI builds -->
| Dependency Changes       | 

<!-- Describe your changes below in as much detail as possible -->

Once merged I will make the corresponding documentation changes on the website (in a 7 branch)
2018-05-23 09:19:39 -07:00
Sven SAULEAU
01d969a182 Merge pull request #8009 from babel/xtuc-patch-2
update AST spec - interpreter
2018-05-23 12:57:10 +02:00
Sven SAULEAU
7d99a96f9f docs: [skip ci] add InterpreterDirective 2018-05-23 09:50:23 +02:00
Sven SAULEAU
ad1de09b5f docs: [skip ci] update AST spec 2018-05-23 09:42:33 +02:00
Logan Smyth
6b91d6434d Add a try/catch on inline data-uri sourcemaps too, and add debug logging. 2018-05-22 23:38:16 -07:00
Michael Lavina
18796173ab feat(sourcemap): parse external source maps when normalizing (#7980) 2018-05-22 23:29:10 -07:00
Logan Smyth
eb3334a14e Merge pull request #7955 from loganfsmyth/typescript-filename-required
Verify that files are .ts/.tsx before treating as Typescript files.
2018-05-22 22:41:39 -07:00
Logan Smyth
5e00c96368 Handle Infinity, -Infinity, NaN, and -0 in t.valueToNode(). (#8005)
| Q                        | A <!--(Can use an emoji 👍) -->
| ------------------------ | ---
| Fixed Issues?            | Fixes #8001
| Patch: Bug Fix?          | Y
| Major: Breaking Change?  | Not unless things were relying on a very specific AST structure as output
| Minor: New Feature?      |
| Tests Added + Pass?      | Yes
| Documentation PR         | <!-- If so, add `[skip ci]` to your commit message to skip CI -->
| Any Dependency Changes?  |
| License                  | MIT

The filed bug was for `-0`, but I also realize that `numericLiteral` also shouldn't be getting `-Infinity`/`Infinity` or `NaN` since those just get stringified with the JS-standard stringification logic which means we get a reference to `NaN` or `Infinity` identifiers, which could have been shadowed in a local scope and thus not be the right value. I've avoided that by generating `NaN` as `0/0` and the infinity values as `1/0` and `-1/0`.
2018-05-22 14:37:06 -07:00
Henry Zhu
b4d18f4764 Bigint Support without transform (#8006) 2018-05-22 15:31:34 -04:00
Brian Ng
981bff08e4 Fix some flow issues in @babel/parser flow plugin (#8002) 2018-05-22 10:48:49 -07:00
Nicolò Ribaudo
7d641d2e74 Update babel-types docs (InterpreterDirective) [skip ci] (#8004)
Introduced in #7928
2018-05-22 17:50:15 +02:00
Logan Smyth
f2882d570a Tests for react/ts compat and flow/ts compat. 2018-05-21 21:21:00 -07:00
Logan Smyth
cc5aeb3b50 Allow .ts and .tsx test fixtures. 2018-05-21 20:31:40 -07:00
Logan Smyth
d164f820e6 Merge pull request #7928 from loganfsmyth/shebang-node
Create InterpreterDirective AST node type and use to replace babel/core File's 'shebang' handling
2018-05-21 20:02:12 -07:00
Logan Smyth
43aa61d6be Make the typescript preset require a filename unless the user configured it for general use. 2018-05-21 18:34:50 -07:00
Logan Smyth
ca1c98b255 Allow .overrides and .env inside presets. 2018-05-21 18:23:07 -07:00
Logan Smyth
0963dbddea Rely on Babylon for interpreter directive parsing, instead of babel/core. 2018-05-21 18:19:59 -07:00
Logan Smyth
2058e0686e Add support for an InterpreterDirective AST node. 2018-05-21 18:19:58 -07:00
Logan Smyth
c0013264b7 Add tests for interpreter directive with retainLines and sourcemaps. 2018-05-21 18:08:32 -07:00
Logan Smyth
442ead701c Fix a few out-of-order test results. 2018-05-21 18:08:31 -07:00
Logan Smyth
5fb3696955 Avoid flow errors now that we've renamed Babylon to babel-parser. 2018-05-21 18:06:17 -07:00
Logan Smyth
69cca412eb Make the filename option, as exposed to the plugins, consistently relative to the working directory (#7956)
| Q                        | A <!--(Can use an emoji 👍) -->
| ------------------------ | ---
| Fixed Issues?            | 
| Patch: Bug Fix?          | Y
| Major: Breaking Change?  | N
| Minor: New Feature?      |
| Tests Added + Pass?      | Yes
| Documentation PR         | <!-- If so, add `[skip ci]` to your commit message to skip CI -->
| Any Dependency Changes?  |
| License                  | MIT

Currently the `opts.filename` value exposed to plugins is just whatever the user passed. While it _could_ be relative to the working directory, if Babel was passed an absolute URL, it'll be absolute.

This PR explicitly ensures the filename is a relative path based on the working directory. This also exposes an officially endorsed API for reading the working directory path.
2018-05-21 17:10:57 -07:00
Mike Nason
3bee37b14d fix typo in error message (#7995) 2018-05-21 12:18:09 -07:00
Miguel Albernaz
bc757c8b75 passes the jsxPragma options from preset-typescript to plugin-transform-typescript (#7990) 2018-05-21 14:33:43 -04:00
Conor Hastings
c558dedd7b fix typo of babel in readme (#7992) [skip ci] 2018-05-21 07:42:13 +02:00
Justin Ridgewell
0879a6d608 Subsume json (#7985)
* Add Subsume JSON transform

https://github.com/tc39/proposal-json-superset is at stage 3.

This allows U+2028 LINE SEPARATOR and U+2029 PARAGRAPH SEPARATOR to appear unescaped inside strings and directives.

* Move to Stage 3

* Break diretive parsing

* Update README

* Handle multi-escape sequences

* Remove babylon files after rename
2018-05-19 15:32:05 -04:00
Henry Zhu
51eef099b3 fixes [skip ci] 2018-05-19 00:12:26 -04:00
Chaitanya Kumar Kamatham
daf0ca8680 Rename "babylon" to "@babel/parser" (#7937) 🎉 2018-05-19 00:03:05 -04:00
Justin Ridgewell
0200a3e510 Build InterfaceTypeAnnotation generated type code (#7982) 2018-05-18 14:41:19 -04:00
Justin Ridgewell
27c39c512d Class private properties (#7842)
* Update member-expression-to-functions

1. Babel using British spellings, so `memoise`
2. Provide a helper `AssignmentMemoiser` class, which will assign the memo'd value with the `n`th access.

* Private properties!

* Fixes

* Tests

* Update helper name

* Fix privates that reference other privates

* Don't extend a builtin

* Rebase
2018-05-18 14:03:23 -04:00
Ben Newman
70eb206c03 TypeScript: Fix TSInferType .typeParameter type. (#7967)
Follow-up to https://github.com/babel/babel/pull/7404

There is no TypeParameter type in the Babylon TypeScript AST hierarchy.
Flow does have a TypeParameter type, but it should not be confused with
the TypeScript TSTypeParameter, since Flow !== TypeScript, and the types
have totally different fields. Instead, the .typeParameter.type of a
Babylon-parsed TSInferType node should be TSTypeParameter.

It would probably be fine to leave the declared type of the TSInferType
.typeParameter field as TSType instead of TSTypeParameter, but the more
specific TSTypeParameter type should be safe/correct, since the TypeScript
parseInferType function always uses SyntaxKind.TypeParameter:
66d6e5e6e0/src/compiler/parser.ts (L3006)

I noticed this typo because it has been causing ast-types test failures
lately, e.g. https://travis-ci.org/benjamn/ast-types/jobs/369634972
2018-05-18 10:15:48 -05:00
Nicolò Ribaudo
229179b8aa Update babel-types (flow internal slots) (#7977) 2018-05-18 08:47:31 -05:00
Sam Goldman
6baa36cdc5 Support Flow's inline interface syntax (#7973)
* Support Flow's inline interface syntax

* Fix babel-generator
2018-05-18 08:11:27 -05:00
Sam Goldman
a40f54f847 Add support for explicit type arguments in new and call expressions (#7934)
* Add all option to babel-plugin-syntax-flow

The Flow parser has some conditional logic based on whether types should
be parsed or not, which is based on either (a) the @flow pragma in the
docblock of the file of (b) the `all` configuration, provided via
command line or .flowconfig.

This commit adds the ability to provide the `all` configuration to
Babel as well, via the syntax-flow plugin. This should be set to `true`
if the project uses all=true.

* Parse @flow pragma

The Flow parser has some conditional logic based on whether types should
be parsed or not, which is based on either (a) the @flow pragma in the
docblock of the file of (b) the `all` configuration, provided via
command line or .flowconfig.

This commit parses the @flow (or @noflow) pragma from the first comment
in the source file. Directives are allowed to appear before the comment.

* WIP: add tests for explicit type arguments

This commit includes tests which have unexpected output, but will change
to the expected output as later commits add parsing support for various
features.

* Parse type arguments in new expressions

* Parse type arguments in call expressions

* Parse optional call expressions with explicit type args

* Add explicit type arguments to babel-types

Flow calls these typeArguments instead of typeParameters, which clearly
separates formal/actual parameters, and mirrors the existing arguments
key.

The existing definitions to support TypeScript also included Flow's
TypeParameterInstantiation node type, which I've moved to the the new
field.

* Add support for explicit type arguments to babel-generator

* Add test for explicit type args to transform-flow-strip-types plugin

* Oops. Forgot to regenerate the babel-types README.

* Fix Flow parser shouldParseTypes() function

I was looking at `options.all`, but the correct property ws
`options.flowAll`. Oops!

* Remove typeapp_call from whitelist of expected failures

Now that Babylon parses this syntax extension, we can remove the
typeapp_call tests from the list of expected differences.

Note that I am using the `flowAll` option, mirroring the behavior of the
Flow tests, which assume types without requiring the `@flow` pragma.

* Use Babylon plugin options instead of parser options

* Parse optional call expressions type arguments unambiguously
2018-05-18 08:05:16 -05:00
Nicolò Ribaudo
6226c52f43 Add "legacy" prefix to legacy decorators tests (#7975) 2018-05-18 14:46:07 +02:00
Lars Willighagen
25153359f7 helper-plugin-utils: Move README [skip ci] (#7972)
Move README from src to package root, as in other packages.

Closes #7971
2018-05-18 10:00:25 +02:00
Nicolò Ribaudo
2351a638b5 Fix bugs in the _wrapNativeSuper helper (#7533)
* Remove second wrapper from _wrapNativeSuper

* Fix tests on node 4

I DON'T KNOW WHY IT WORKS.

* Update fixtures

* Use Reflect.construct

* Parens

* Fix things

* Fix things

* Undo changes

* Fix with sham

* Typo
2018-05-18 00:04:12 +02:00
Rubén Norte
bc6f0f989d Re-add support for local Flow bindings (TypeAlias, OpaqueTypeAlias and Interface) (#7900) 2018-05-17 10:54:14 -07:00
Sam Goldman
af7ab71486 Allow flow internal slot properties to be optional (#7959)
See 23d1b1c5f2
2018-05-17 19:01:03 +02:00
Logan Smyth
ac13c302f7 Merge pull request #7929 from loganfsmyth/cli-refactoring
Refactor babel-cli to use async functions for async handling, and centralize option loading
2018-05-16 20:58:46 -07:00
Sam Goldman
b396cdcbe5 Internal slot properties (#7947)
* Support internalSlots to babel-types and babel-generator

* Parsing support for internal slot properties

* Print internal slots in babel-generator

* Add whitespace before first internal slot property
2018-05-16 22:48:12 -05:00
Michal Artazov
8dcfabd0d7 update core-js to 2.5.6 (#7950) 2018-05-16 10:08:19 -07:00
Nicolò Ribaudo
e45d5c3b65 Add an option to Babylon to have decorators before export (#7869)
* Add support for plugin options in Babylon

They work similarly to how they work in Babel. e.g.
  babylon.parse({
    options: [
      "plugin1",
      ["plugin2", { option: true }]
    ]
  });

The inernal api to get an option is
  this.getPluginOption("pluginName", "option")
If the plugin isn't defined, it returns undefined.

* Add Babylon option decorators.secoratorsBeforeExport

* Nit
2018-05-15 11:39:53 -05:00
Logan Smyth
8ff675ad69 Refactor CLI to use promises/async fns. 2018-05-14 23:07:50 -07:00
Logan Smyth
a955efa3e3 Ensure that calling register fully resets the state. (#7930) 2018-05-14 23:04:56 -07:00
Logan Smyth
51db3e9a5d Bug fixing for Node 10 (#7931) 2018-05-14 23:02:01 -07:00
Logan Smyth
41ca312545 Define a clear separation between Babel and CLI options. 2018-05-14 22:03:47 -07:00
Logan Smyth
a192f8beb4 Limit node version to current LTS. 2018-05-14 21:54:16 -07:00
Henry Zhu
f03adbadf4 v7.0.0-beta.47 2018-05-14 17:15:44 -07:00
Henry Zhu
97145ad01e add publishConfig for new packages [skip ci] 2018-05-14 17:12:13 -07:00
Caleb Eby
25810d2609 Fix handling of different JSX pragmas in Typescript (#7878)
Fixes #7631

Before, if a JSX pragma was imported, the import was removed because
it did not think it was used as a value. This changes it so it knows
that the import is being used as a JSX pragma
2018-05-14 15:01:45 -07:00
pravdomil
5f58117790 update @babel/preset-latest docs (#7854) [skip ci] 2018-05-14 14:59:21 -07:00
Logan Smyth
dca2631ef0 Merge pull request #7911 from loganfsmyth/config-babelrcroots
Allow 'babelrc' and 'babelrcRoots' in config files (but not .babelrc/extends)
2018-05-14 10:41:22 -07:00
Nicolò Ribaudo
ba11d9fa7c Update test262 and flow tests (#7925) 2018-05-14 12:26:28 -05:00
Stian Håklev
e06cf20d2e Update babel/core README.md (#7913) [skip ci] 2018-05-14 10:25:53 -07:00
Logan Smyth
df1afa3160 Fix watch bug with output-dir paths. (#7875) 2018-05-13 08:54:04 -05:00
Karl Alnebratt
cec93c01ce Babel-cli update dependencie chokidar (#7853) 2018-05-13 10:58:33 +02:00
Nicolò Ribaudo
0a8367c979 Use the correct Babylon plugins for Test262 tests (#7916) 2018-05-13 10:52:19 +02:00
Mathias Bynens
ac5d2ba984 Update regexpu-core to v4.1.4 (#7917)
Fixes #7891.
2018-05-12 18:46:11 -07:00
Dennis Czombera
040ba2bf53 Remove no longer needed #__PURE__ annotations for taggedTemplateLiteral helper (#7914)
* Remove pure comment annotation

* Update outputs
2018-05-12 15:19:33 +02:00
Logan Smyth
98f0808a22 Ensure the the config file isn't re-processed when users load a partial config and then pass it back to Babel. 2018-05-11 17:49:12 -07:00
Logan Smyth
bdcfb697a6 Use 'babelrc' and 'babelrcRoots' from config file, if not specified. 2018-05-11 17:49:11 -07:00
Logan Smyth
0341d299c8 Validate different file types with different rules. 2018-05-11 16:51:43 -07:00
Logan Smyth
1a7765712e Validate the file before loading chain. 2018-05-11 15:29:28 -07:00
Nicolò Ribaudo
b87c43d894 Update @babel/plugin-codemod-object-assign-to-object-spread version (#7906) 2018-05-11 13:14:17 -04:00
Brian Ng
02c4a28608 Fix typescript decorator test (#7904) 2018-05-10 17:31:38 -05:00
Dennis Czombera
4260ffd7ec Lazy load tagged template literal strings (#7855)
* Lazy load tagged template literal strings

* Update snapshots to reflect lazy loading

* Use pure annotation and remove unnecessary parenthesized expression

* Update snapshots

* Optimize lazy loading by doing assignment within logical expression

* Update snapshots to reflect optimization

* Use re-define function pattern to avoid hitting function size deopts

* Update snapshots to reflect the usage of the redefining function pattern
2018-05-10 14:54:10 -04:00
Nicolò Ribaudo
25c3f0d689 Rename decorators&decorators2 plugins to decorators-legacy&decorators. (#7821)
Reasons:
1) Naming consistency with Babel plugins
2) Sooner or later the decorators2 plugin should become decorators anyway
2018-05-10 20:01:35 +02:00
Brian Ng
21b03c35d3 Fix lint and yarn.lock 2018-05-10 09:22:45 -05:00
Brian Ng
ee1ee0e7ae Clean up and add some additional polyfill mappings in preset-env (#7809) 2018-05-10 09:09:38 -05:00
Willa Wang
73f8059ea0 Fix typo in rewrite-live-references.js (#7896) [skip ci] 2018-05-09 20:30:02 -04:00
Daniel Taveras
70e3454d7a Fix a typo in a babylon flow plugin comment [skip ci] (#7898) 2018-05-09 20:29:22 -04:00
Rocky Meza
9dab691302 Fix typo [skip-ci] (#7897)
Thanks!
2018-05-09 20:28:34 -04:00
Carlos Villavicencio
95fc38cecf Bumped lodash version (#7895)
* Bumped lodash version

* Fixed typo

* Fixed typos

* Revert "Fixed typo"

This reverts commit 06cfe9d4edba0b99257cbffc6dc08ae2f3460d78.

* Revert "Fixed typos"

This reverts commit ec3975c7392df9a0a42682ee4f32eadd2615c69c.

* Fixed json typos
2018-05-09 15:47:52 -07:00
Michael Mantel
84e76e2d49 TypeScript: Allow non-null and type assertions as lvalues. (Fixes #7638) (#7888) 2018-05-09 16:45:50 -05:00
Sven SAULEAU
0d9eef4750 Merge pull request #7893 from aaronabramov/patch-1
fix typo in a comment
2018-05-09 18:30:59 +02:00
Sven SAULEAU
d2ed7bbc8d Update output.js 2018-05-09 18:21:14 +02:00
Aaron Abramov
5b5ac1f366 fix typo in a comment
as title
2018-05-09 12:09:45 -04:00
Tim Seckinger
fa1547d8f8 fix(transform-typescript): do not elide injected imports (#7833) 2018-05-09 10:05:29 -05:00
Brian Ng
b42b21f25c Fix bug with handling minor versions when parsing compat-data (#7884) 2018-05-08 10:52:44 -05:00
Brian Ng
6dca0ff9bf Improve useBuiltIns: usage mappins in preset-env (#7810) 2018-05-07 11:45:09 -05:00
Henry Zhu
3e9b59c0f1 reorg lock yml [skip ci] 2018-05-07 11:28:25 -04:00
Henry Zhu
3f6c475aae update patreon sponsors [skip ci] 2018-05-07 11:04:05 -04:00
Henry Zhu
5c31e501d7 update issue templates [skip ci] 2018-05-04 09:40:18 -07:00
Henry Zhu
ed6b4e0e40 fix line endings [skip ci] 2018-05-04 09:37:42 -07:00
Henry Zhu
8615b6fe57 Support issue template [skip ci] (#7863) 2018-05-03 16:45:00 -07:00
Henry Zhu
95fa5a66b1 issue templates [skip ci] (#7862) 2018-05-03 15:09:25 -07:00
Henry Zhu
c94355c1c9 update issue templates [skip ci] (#7861) 2018-05-03 15:00:33 -07:00
Henry Zhu
839bf68d1f [skip ci] 2018-05-03 14:44:19 -07:00
Henry Zhu
8198b1b334 lock old issues only (temporary) [skip ci] 2018-05-03 14:26:58 -07:00
Brian Ng
d608535719 Allow parsing of decorators with TypeScript abstract classes (#7850)
* Allow parsing of decorators with TypeScript abstract classes

* avoid lookahead
2018-05-02 13:49:46 -05:00
Brian Ng
0353ce9ed5 Disallow flow type parameter defaults in some cases 2018-05-02 08:56:54 -05:00
Brian Ng
65ca968f8b Allow static? as identifier in ObjectTypeProperty 2018-05-02 08:56:54 -05:00
Brian Ng
77445cb044 Enable dynamicImport plugin for flow tests 2018-05-02 08:56:54 -05:00
Brian Ng
7c4509e280 Retry flow tests in script mode only if it is supposed to succeed 2018-05-02 08:56:54 -05:00
Henry Zhu
87ae286bc3 changed to 3 months of no-activity on a closed issue [skip ci] 2018-05-01 22:33:37 -07:00
Henry Zhu
9c1b3e8dc1 Add support/regression issue templates [skip ci] (#7851) 2018-05-01 22:06:11 -07:00
Henry Zhu
39d07638cf remove custom [skip ci] 2018-05-01 20:48:55 -07:00
Henry Zhu
e887eecda4 Update issue templates [skip ci] 2018-05-01 20:47:02 -07:00
Logan Smyth
a3e622ad15 Fix inputSourcemapMerge when no JS content is output. 2018-05-01 20:31:29 -07:00
Hana Shiro
494a56df5f Unify main property in package.json [skip ci] (#7825) 2018-05-01 09:15:02 -07:00
Michael Mantel
8060ae5dae Improve README's for several plugins. [skip ci] (#7844) 2018-05-01 10:24:53 -05:00
Henry Zhu
bd4ebc11c1 add a label when locking old issues [skip ci] 2018-05-01 07:16:26 -07:00
Henry Zhu
80cefaff2f add lock bot for old closed issues [skip ci] (#7839) 2018-04-30 22:28:23 -07:00
Brian Ng
e9d5073af1 Remove duplicate text in browserslist rec inside preset-env [skip ci] 2018-04-30 17:01:34 -05:00
Andrey Sitnik
c8fb48ffd6 Change babel-preset-env docs according Browserslist best practices (#7835) 2018-04-30 16:25:32 -05:00
jugglinmike
55ef39eb87 Correct typo [skip ci] (#7834) 2018-04-28 15:48:53 -07:00
Andrey Sitnik
91e1e1728c Use queries according Browserslist Best Practices (#7828) [skip ci] 2018-04-27 18:50:26 -04:00
Logan Smyth
acf509bab5 Upgrade Babel to self-host with beta.46 (#7784) 2018-04-27 15:04:37 -07:00
James DiGioia
4f312f5739 Add syntax error test for arrow w/ paren'd args 2018-04-27 23:15:21 +02:00
James DiGioia
696f84468e Add test for params w/ parens around them 2018-04-27 23:15:21 +02:00
James DiGioia
71fd37067e Avoid lookahead when parsing pipeline
The error message is worse, but it is much more performant.
2018-04-27 23:15:21 +02:00
James DiGioia
7142a79eb9 Bring pipelineOperator flag in line with minimal
The minimal proposal requires parentheses around arrow functions
and bans await from the pipeline.
2018-04-27 23:15:21 +02:00
Renée Kooi
1a6855eff2 Fix default sourceFileName. (#7764)
* Fix default sourceFileName.

This deals with a problem mentioned in [babel/babelify#255][0]. I'm not
super sure about the implications, but it seems this may have been a
regression from Babel 6.

In babel@6, the default `sourceFileName` was the basename of the input
file:

```js
require('babel-core').transform('var a = 10', {
  filename: __filename,
  sourceMaps: true
}).map
// { version: 3,
//   sources: [ 'index.js' ],
//   names: [ 'a' ],
//   mappings: 'AAAA,IAAIA,IAAI,EAAR',
//   file: 'index.js',
//   sourcesContent: [ 'var a = 10' ] } }
```

Currently however, the full file path is used:

```js
require('@babel/core').transformSync('var a = 10', {
  filename: __filename,
  sourceMaps: true
}).map
// { version: 3,
//   sources: [ '/home/goto-bus-stop/Code/babel/repro-babelify-255/index.js' ],
//   names: [ 'a' ],
//   mappings: 'AAAA,IAAIA,IAAI,EAAR',
//   file: '/home/goto-bus-stop/Code/babel/repro-babelify-255/index.js',
//   sourcesContent: [ 'var a = 10' ] } }
```

This patch adds the `path.basename()` call that [Babel 6 used][1] to
@babel/core's default options, so it's the same as back then.

```js
require('../babel/packages/babel-core').transform('var a = 10', {
  filename: __filename,
  sourceMaps: true
}).map
// { version: 3,
//   sources: [ 'index.js' ],
//   names: [ 'a' ],
//   mappings: 'AAAA,IAAIA,IAAI,EAAR',
//   sourcesContent: [ 'var a = 10' ] }
```

This is the desired behaviour for browserify at least, as it expects
relative paths in the source maps and rebases them to a root directory
when generating the final source map.

[0]: https://github.com/babel/babelify/pull/255
[1]: 6689d2d23c/packages/babel-core/src/transformation/file/index.js (L163-L172)

* Use cwd-relative path for sourceFileName.

* Revert sourceMap `file` property change.

* fixup! Revert sourceMap `file` property change.

* Fix whitespace change from merge conflict

* Revert to using basename in source map outputs.
2018-04-27 13:28:23 -07:00
Michael Mantel
1de36948ac Expand README for plugin-transform-instanceof [skip ci] (#7827) 2018-04-27 15:21:09 -05:00
Hana Shiro
b28ffedead Fix configuration of lerna-changelog (#7803) [skip ci] 2018-04-26 22:52:02 -04:00
Michael McGlynn
a5edab7393 Change const to var inside helper 2018-04-26 23:33:12 +02:00
Justin Ridgewell
725e6a01c0 Don't fold class property calls (#7814)
This undoes the property call folding from #6656.

It complicates the private property transforms, since they boil down to `map.set(this, vlaue)` and we definitely don't want the next call define a property on the map.

/cc @Andarist
2018-04-26 15:06:18 -05:00
Evan You
224ce38882 fix(preset-stage-3): pass along loose flag to proposal-object-rest-spread (#7819) 2018-04-26 11:04:34 -05:00
Justin Ridgewell
8c46fd159f Class Props: Don't rename constructor collisions with static props (#7813)
Static props aren't evaluated inside the constructor, so there can't be a collision.
2018-04-25 23:45:52 -04:00
Brian Ng
47201db61e Bump compat-table for preset-env (#7808) 2018-04-25 16:23:49 -05:00
Logan Smyth
138d60922c Merge pull request #7761 from loganfsmyth/bad-map-merge
Reimplement input sourcemap merging using range matching instead of closest-position matching
2018-04-25 12:29:19 -07:00
Logan Smyth
cfb386ff03 Reimplement input sourcemap merging. 2018-04-25 12:02:05 -07:00
Logan Smyth
9e7fe0ab49 Add type definitions for source-map library. 2018-04-25 12:02:05 -07:00
Logan Smyth
e31e907d5f Split sourcemap merging logic into its own file. 2018-04-25 12:02:05 -07:00
Logan Smyth
4da4728bf5 Add an example of an extremely bad sourcemap merge. 2018-04-25 12:02:05 -07:00
Brian Ng
0112479ba9 Upgrade to gulp@4 (#7811) 2018-04-25 15:01:35 -04:00
Brian Ng
408124438a Update shippedProposals in preset-env docs [skip ci] (#7807) 2018-04-25 09:16:03 -05:00
chocolateboy
eab4c0e93e Fix typo [skip ci] (#7805) 2018-04-25 09:06:12 -05:00
Lars Willighagen
d06bf993db Change SO link to HTTPS
Since SO supports HTTPS now.
2018-04-25 11:53:15 +02:00
Henry Zhu
1076018c4c Internal: compile with loose to object rest/spread (#7794) 2018-04-24 10:41:05 -04:00
Henry Zhu
07ff8f30f5 preset-env update targets recommendation [skip ci] (#7790) 2018-04-24 10:33:52 -04:00
Hana Shiro
e6ba0ab82c Fix indent in .travis.yml (#7792) 2018-04-24 08:47:20 -05:00
Justin Ridgewell
2afe9404fe Use Object Spread Syntax (#7777)
* Use Object Spread Syntax

* Nits
2018-04-23 21:44:27 -04:00
Henry Zhu
037fee8ffb Target Node 6 in production (#7782) 2018-04-23 17:20:48 -04:00
Logan Smyth
3a2aa9b862 v7.0.0-beta.46 2018-04-22 21:29:42 -07:00
Logan Smyth
c8b57f777a Ensure that the internal plugin load does not read the user's config. (#7783) 2018-04-22 20:32:52 -07:00
Henry Zhu
b414387bb1 v7.0.0-beta.45 2018-04-22 21:55:16 -04:00
Evan Scott
0bb71caad3 Add noConflict entry mode to @babel/polyfill + change error to warning (#6371)
* feat: add noConflict polyfill entry
* use a warning
2018-04-22 19:11:50 -04:00
Logan Smyth
d6dcbdad48 Merge pull request #7358 from loganfsmyth/babelrc-resolution-changes
Allow more flexible file-based configuration while preventing .babelrcs from breaking things
2018-04-22 13:28:05 -07:00
Logan Smyth
8606b76438 Split babelrc option into babelrcRoots. 2018-04-22 13:00:28 -07:00
Justin Ridgewell
34d73ebef0 Correct update expression Number coercion (#7766)
* Correct update expression Number coercion

You have to `ToNumber` whatever the `UpdateExpression` argument is.

* Fix systemjs update expression
2018-04-22 13:50:11 -04:00
Justin Ridgewell
890a45216f Update super property get/set/call in loose mode (#7774)
* Update super property get/set/call in loose mode

Follows the plan laid out in https://github.com/babel/babel/pull/7553#issuecomment-381434519.

With #7691, this closes #7553, closes #4312.

* Post #7772

* Memoized property
2018-04-22 13:49:19 -04:00
Justin Ridgewell
0a257e8972 Move more class state out of replaceSupers (#7750)
Yes, the output is uglier. But, this is necessary for me to refactor
`replaceSupers` for #7733, which is necessary for both #7555 and
https://github.com/babel/babel/pull/7553#issuecomment-381434519.

I'm still in the middle of cleaning up all this code. Don't expect
`transformClass` to survive much longer as it's written currently.
2018-04-21 22:56:14 -04:00
Justin Ridgewell
3616137864 Memoize computed super properties (#7776)
Fixes #7775.
2018-04-21 22:15:02 -04:00
Justin Ridgewell
f8ab9466d3 Move subclass inheritance to end (#7772)
We were using `Object.create` to setup the prototype chain at the start of the class definition, which lead to #7771.

I was a bit worried about a speed hit, but it seems everyone optimizes the two patterns the same way.
https://jsbench.github.io/#f9fca52407643d96458a35763b201215

Fixes #7771.
2018-04-21 17:31:44 -04:00
Justin Ridgewell
8f24f91166 Implement MemberExpressionToFunctions helper (#7763)
* Implement MemberExpressionToFunctions helper

Fixes #7733.

This will also be used to simplify the Private Fields transform, which had [almost the same code](ccd941057a/packages/babel-plugin-proposal-class-properties/src/index.js (L114-L217)) hand written.

* Cleanup

* Little more comment cleanup

* Use unary plus

This can't be redefined, unlike the `Number` identifier.

* Review comments

* Remove unused deps
2018-04-21 13:13:42 -04:00
Henry Zhu
dbdce0e4e4 add overwrite for tests [skip ci] 2018-04-21 11:46:15 -04:00
Vinh Le
4595c7fdfd Correct test running command (#7768) [skip ci]
* Correct test running command

* Also refine test/index.js content
2018-04-21 11:35:48 -04:00
Yosuke Kurami
1f97b91655 fix: don't write ': ' token when name is null (#7769) 2018-04-21 11:34:24 -04:00
Christopher Hiller
b0e1e84471 drop support for Node.js v4 (#7755)
* drop support for Node.js v4; closes #7753

- remove version 4 from Travis build matrix
- update environment support doc
- update `CONTRIBUTING.md`
- update `engines` field of root `package.json`

Signed-off-by: Christopher Hiller <boneskull@boneskull.com>

* update engines for babylon

Signed-off-by: Christopher Hiller <boneskull@boneskull.com>
2018-04-21 01:09:10 -04:00
Logan Smyth
f7c26bf2bf Add some docs for config searching. 2018-04-20 17:00:54 -07:00
Logan Smyth
a67eb25547 Only search for .babelrc files in the 'root' package by default. 2018-04-20 17:00:53 -07:00
Logan Smyth
485e37fcb0 Support a babel.config.fs file in a 'root' directory. 2018-04-20 17:00:53 -07:00
Logan Smyth
f013dab5fb Restrict .babelrc resolution to within a given package. 2018-04-20 17:00:53 -07:00
Brian Ng
e45b58dcb1 Fix small typo with decorators legacy option [skip ci] (#7762) 2018-04-19 20:26:54 -05:00
Henry Zhu
339dfddca5 Merge pull request #7734 from nicolo-ribaudo/decorators-legacy-option
Decorators legacy option
2018-04-19 14:36:18 -04:00
Brian Ng
0cd868a5f2 fixup tests 2018-04-19 09:17:33 -05:00
Nicolò Ribaudo
29db23ed87 Remove old comment 2018-04-19 09:08:15 -05:00
Nicolò Ribaudo
2679d6775c Add "decoratorsLegacy" to presets 2018-04-19 09:08:15 -05:00
Nicolò Ribaudo
96316dcf88 Add legacy option to plugin-proposal-decorators. 2018-04-19 09:08:14 -05:00
Logan Smyth
42244123e1 Update the docs to correctly reflect default value changed in #7436. [skip ci] 2018-04-18 23:33:34 -07:00
Andy
4b97e837ea Fix type error (#7752) 2018-04-18 15:31:15 -04:00
Brian Ng
3299086955 Add support for flow implements (#7741) 2018-04-18 08:54:30 -05:00
Jason Quense
2bded404f3 Improve asyncIterator error (#7745)
* Improve asyncIterator error

When an object is has neither asyncIterator or iterator defined, throw the "not an async iterable" error

* Correct logic

* reduce access

* Update helpers.js
2018-04-17 21:02:53 -05:00
Justin Ridgewell
21c7ff3f37 Classes cleanup (#7737)
* Cleanup

* Move verifyConstructorVisitor out of closure
2018-04-17 17:52:43 -04:00
Nicolò Ribaudo
341bdab90c Update decorators parsing (#7719)
* Update decorators parsing

This commit introduces three changes:
1) Class properties can be decorated
2) Decorators can contain arbitrary expressions, using @(...)
3) The Decorator node type has a new property, "arguments". This
    makes it possible do distinguish @dec() and @(dec()), which have
    different behaviors because @(dec()) is equivalent to @(dec())().

* Rename Decorator#expression to Decorator#callee

* Add test for @dec()()
2018-04-17 16:22:03 -05:00
Brian Ng
81149a5cc9 Add initial support for ES2018 in preset-env (#7658) 2018-04-17 16:16:33 -05:00
Mateusz Burzyński
5166eef103 Optimize class properties output (#6656) 2018-04-15 01:03:47 -04:00
Justin Ridgewell
0ee9a4e612 Fix default class super inheritance (#7732)
Fixes #7683.
2018-04-14 15:15:40 -04:00
Henry Zhu
858a2c74e7 update readme [skip ci] 2018-04-14 15:13:31 -04:00
Justin Ridgewell
668358c4d0 Fix class properties after nested class' bare super (#7671)
* Fix class properties after nested class' bare super

Fixes #7371.

* Fix node 4 test

* This damn node 4 test

* All of the ClassBody, but not the methods or field inits

* tmp

* tmp

* Use common class environment visitor

* Tests

* Use skipKey to avoid recursive traversal

* Remove old state

* Use jest expect
2018-04-14 13:48:38 -04:00
Justin Ridgewell
39b05598a0 Drop Chai from packages (#7729) 2018-04-14 09:01:38 -04:00
Justin Ridgewell
29eafbbf44 Remove tagged template literal global caching (#7722)
* Remove tagged template literal global caching

Fixes #7350.

* Review comments

* assert output
2018-04-13 11:51:00 -04:00
Henry Zhu
7a106025ea Merge pull request #7720 from devenbansod/migrate_to_jest_expect-3
Migrate more packages' tests to use jest expect assertions
2018-04-13 11:04:44 -04:00
Deven Bansod
4f1473da3d Remove global chai.assert in fixture runner's test context 2018-04-13 19:14:30 +05:30
Deven Bansod
c62b202e6a Migrate remaining test assertions to jest-expect 2018-04-13 19:14:03 +05:30
Deven Bansod
a084339a15 Migrate -computed-properties and -jscript tests to use jest expect assertions 2018-04-13 16:30:06 +05:30
Deven Bansod
d7987fbbd2 Migrate -transform-object-super tests to use jest expect assertions 2018-04-13 14:21:02 +05:30
Deven Bansod
8a31eabf5e Migrate -transform-classes tests to use jest expect assertions 2018-04-13 14:20:51 +05:30
Deven Bansod
80428dec47 Migrate -optional-catch-binding, -block-scoping to use jest expect assertions 2018-04-13 14:19:49 +05:30
Dennis Czombera
61ec5ce957 Provide better error message for invalid default export declaration (#7717) 2018-04-12 17:07:41 -05:00
Alexander Pepper
1e41f613bb [babel-preset-typescript] Fixed link of plugin-transform-typescript. (#7700) [skip ci] 2018-04-12 16:44:43 -04:00
Nicolò Ribaudo
a86d14de61 Disallow super() in class properties 2018-04-12 22:41:28 +02:00
Nicolò Ribaudo
a62cfe9045 Disallow arguments in class properties 2018-04-12 22:41:28 +02:00
Nicolò Ribaudo
f797454a18 Disallow super in functions in class properties 2018-04-12 22:41:28 +02:00
Justin Ridgewell
ec882be44d Uncomment super increment expression set tests (#7721)
This was failing because of the bugs fixed by #7687.
2018-04-12 13:24:07 -04:00
Justin Ridgewell
ecbf0dd53c Fix super nested class bugs (#7691)
* Properly traverse nested class for supers

* Add object nested in class cases

* Add object nested object cases

* Test class properties

* Undo changes to lerna.json

* Add tests arournd prefix/postfix super increment

* tmp

* Use sets
2018-04-12 13:02:26 -04:00
Nicolò Ribaudo
af3d6526e7 Add slack links to CONTRIBUTING.md (#7713) 2018-04-11 21:56:45 -05:00
Deven Bansod
95894397eb Migrate babel-cli and babel-generator tests to use jest-expect (#7549) 2018-04-11 13:12:56 -05:00
Justin Ridgewell
b1c9af3f05 Use new isInStrictMode (#7714) 2018-04-11 12:17:01 -04:00
Justin Ridgewell
ec3722b3f9 Get set helpers (#7687)
* Improve get/set helper

* fixtures

* Edge cases

* Add loose edge cases

* Spec compliant

* Add issue case

* Even more edge cases!

* Final updates

* Fix name

* Use Reflect.{get, set} when available

* Avoid block scoping in loose

* Remove semicolon

* Do not redefine a non-enumerable

* Get strictness from call site, not helpers

* Add called assertions

* Classes are always strict

* Update test fixture
2018-04-11 11:56:59 -04:00
Justin Ridgewell
7ae724f553 Add Path#isInStrictMode (#7712)
* Add Path#isInStrictMode

* Fix undefined directives

* Explicitly return for arrow expressions
2018-04-11 09:13:38 -04:00
Markus Török
6597a472b3 Add "use strict" directive (#7411)
* #7349
- Add "use strict" directive to transformed class bodies

* Update tests (#7349)

* Add test for program with use strict directive (#7349)

* Update tests (#7349)

* Update source mapping (#7349)

* Add test for parent blockStatement with use strict directive (#7349)

* Update tests (#7349)

* Update tests (#7349)

* Update tests (#7349)

* Add test for constructor-only class (#7349)

* Constructor only classes are strict, too

But constructor only that use non-simple parameters must use a strict function wrapper.

* Fix test

* Wrapper not needed if class is already strict

* Revert change to lerna.json
2018-04-10 17:33:38 -04:00
Hendrik Niemann
fdd0789936 Fix literal type annotation argument number (#7706)
Added the value argument to the visitors of flow literal type
annotations.
Literal type annotations need a value since they work very much like
primitive literals in normal JavaScript.

Fixes #7697
2018-04-10 09:38:20 -04:00
Guy Bedford
5b1332457c arrayWithHoles internal function name consistency (#7709) [skip ci] 2018-04-10 09:33:54 -04:00
Justin Ridgewell
3177f05904 ESLint: Ignore lerna.json and .git (#7708)
* Ignore lerna.json

* Oh, and ignore .git
2018-04-10 08:47:50 -04:00
Sven SAULEAU
9dc178df9a Merge pull request #7704 from babel/use-circle-yarn
Use yarn provided by circle
2018-04-10 07:38:41 +02:00
Brian Ng
75bc9422b8 Use yarn provided by circle 2018-04-09 22:11:17 -05:00
Axel Nyffenegger
bd98041321 Fix function name computation for literal values (#7435)
* Fix name computation for literal values

* Add more computed literal test cases

* Always return a string in getNameFromLiteralId

- Also concatenate quasis id for regex literal

* Add a test clarifying function name for template literals

* Remove useless else ifs
2018-04-09 21:00:55 -04:00
Devon Govett
6a8c4ab433 Make babel-types type checking functions 36% faster (#7685)
* Precompile 25% faster type checking functions

* Pre-fetch type-check function when generating NodePath methods

Additional ~11% speed improvement.

* Slightly faster assert calls
2018-04-09 15:11:04 -04:00
Justin Ridgewell
637bfe76b1 Cleanup object super traversal (#7681) 2018-04-06 20:39:57 +01:00
Justin Ridgewell
3f72f1d637 Add option to overwrite failing output fixtures (#7679) 2018-04-06 12:13:10 -05:00
Henry Zhu
20de23f895 update sponsors, move up [skip ci] (#7676) 2018-04-06 10:02:30 -05:00
Justin Ridgewell
d17adf40df Use construct helper in New Spread (#7677)
* Use construct helper in New Spread

* CircleCI
2018-04-06 10:40:38 +01:00
Justin Ridgewell
450a1678f2 Use getProto and setProto helpers (#7675)
Depends on #7674.
2018-04-06 02:54:08 +01:00
Justin Ridgewell
e9ed0f5f21 Split _wrapNativeSuper into helpers (#7674)
These can be reused in a few transforms.
2018-04-06 01:18:44 +01:00
Justin Ridgewell
29d249e3b7 Cleanup isReferenced a bit (#7669)
* Cleanup isReferenced a bit

* Optimize isReferenced inside Functions

* Group return falses
2018-04-05 19:09:58 +01:00
Justin Ridgewell
6f9b0546ef Class Properties Tests (#7670)
* Round out class properties tests

* Rename in preperation for private tests

* Fix options
2018-04-05 17:49:34 +01:00
Nicolò Ribaudo
fa2c6c5164 Never extract class fields into an initializer function. (#7659)
It was needed to avoid collision of identifiers used in fields
initializers with variables declared in the constructor, but it
broke `this` handling.
This commit removes that behavior and instead renames the
colliding variables.
2018-04-05 16:20:47 +01:00
Justin Ridgewell
43040a4181 Private Properties phase 1 (#7666)
* Private Properties phase 1

Co-authored-by: CodingItWrong

* Private fields are optional

* Docs update
2018-04-05 11:17:34 +01:00
Justin Ridgewell
01f4c2368e OptionalMemberExpression properties are not referenced (#7668)
Fixes #7642.
2018-04-05 02:44:32 +01:00
hirochachacha
56cb4baf46 Add missing exponential operators to ast spec (#7663) [skip ci] 2018-04-04 14:27:19 -04:00
hirochachacha
b051243a63 Fix typo in ast spec (#7662) [skip ci] 2018-04-04 14:26:06 -04:00
Henry Zhu
e808b63c15 Bump to babel@7.0.0-beta.44 (#7656) 2018-04-02 19:47:25 -05:00
Henry Zhu
a6df92f245 v7.0.0-beta.44 2018-04-02 18:19:30 -04:00
Logan Smyth
f4b81ab101 Merge pull request #7655 from babel/babel-env-make
Remove setting BABEL_ENV to test by default in makefile
2018-04-02 13:57:47 -07:00
Brian Ng
360b632881 Remove setting BABEL_ENV to test by default in makefile 2018-04-02 15:18:50 -05:00
Henry Zhu
bdfeeb38c6 v7.0.0-beta.43 2018-04-02 12:47:55 -04:00
Henry Zhu
47ada5ab3a revert prev pr to temp fix osx (#7652) 2018-04-02 12:40:03 -04:00
John-David Dalton
59ba3959dc Add options.allowAwaitOutsideFunction. (#7637) 2018-03-29 10:41:14 -04:00
unconfident
0200e6256a Allow StringLiteral to be used as ObjectTypeProperty.key (#7639) 2018-03-28 09:20:46 -05:00
Henry Zhu
9a26c2b07a Merge pull request #7471 from yakotika/master
added support Node's --require and -r flags in babel-node
2018-03-27 14:44:35 -04:00
Henry Zhu
901571d72f Merge pull request #7579 from devenbansod/migrate-to-jest-expect-2
Migrate a few packages' tests to use Jest Expect (see below)
2018-03-27 14:43:44 -04:00
Deven Bansod
b09c729675 Use expect's instanceOf and toHaveProperty methods 2018-03-27 22:34:25 +05:30
Sven SAULEAU
a36525be45 Merge pull request #7615 from babel/fix-clean-makefile
clean makefile a bit
2018-03-27 08:36:16 +02:00
Logan Smyth
a10c91790f Merge pull request #7588 from loganfsmyth/register-cycle-fixes
Have @babel/core lazy-load all dependencies and make @babel/register not explode because of that
2018-03-25 15:24:00 -07:00
Justin Ridgewell
ab7d1231ad Fix flow errors with Logical Assignment Operators (#7629)
* Fix flow errors with logical assignment

* Fix column numbers
2018-03-25 22:47:48 +01:00
Logan Smyth
a5df709bc3 Lazy-load @babel/core's dependencies to decrease up-front load times. 2018-03-25 14:22:32 -07:00
Logan Smyth
1dbed5f458 Have @babel/register explicitly skip re-entrant plugins/presets. 2018-03-25 14:22:32 -07:00
Logan Smyth
40e38646e4 Include stdout in error messages to aid debugging. 2018-03-25 12:50:35 -07:00
Logan Smyth
9e4dd861ee Ensure that sourceMapSupport is installed in all branches. 2018-03-25 12:50:35 -07:00
Justin Ridgewell
a7bddc02ba Add ??= to Logical Assignment Operators (#7623)
`??=` is being merged into the Logical Assignment Operator proposal, and the overall proposal will wait until nullish coalescing is finalized.
2018-03-25 18:58:51 +01:00
Justin Ridgewell
023f8bd1cb Move Logical Assignment Ops to Stage 1 (#7625) 2018-03-25 17:49:21 +01:00
Deven Bansod
c9b99af5a6 Remove assert.* from commented out assertions 2018-03-24 16:22:20 +05:30
Deven Bansod
c8d82d6483 Migrate all remaining fixtures to jest expect 2018-03-24 16:22:20 +05:30
Deven Bansod
db42a5d70f Migrate babel-preset-es2015 and -next-target tests to use jest expect 2018-03-24 16:22:19 +05:30
Deven Bansod
0856f89882 Migrate -transform-block-scoping and -transform-classes to jest expect 2018-03-24 16:22:18 +05:30
Deven Bansod
921702ef8c Migrate babel-plugin-proposal-do-expressions tests to jest-expect 2018-03-24 16:22:18 +05:30
Deven Bansod
8b57a3e3b9 Migrate a few packages' tests to use Jest Expect (see below)
* Migrate the following packages' tests:
    * babel-helper-annotate-as-pure
    * babel-helper-module-imports
    * babel-helper-transform-fixture-test-runner
    * babel-highlight
    * babel-node
    * babel-plugin-transform-modules-commonjs
    * babel-preset-env-standalone
    * babel-preset-env
    * babel-preset-es2015
    * babel-preset-react
    * babel-standalone
    * babel-template
    * babel-traverse
    * babel-types
2018-03-24 16:22:10 +05:30
Logan Smyth
21309cc8d4 Make these tests re-throw the same error to keep the trace. 2018-03-23 21:26:50 -07:00
Andy
19708e0154 TypeScript: support mapped type modifiers syntax (#7383) 2018-03-23 14:34:15 -04:00
Mateusz Burzyński
f98dff9189 Allow placeholders in JSXElements when parsing templates (#7583) 2018-03-23 09:27:51 +01:00
Brian Ng
840ba187a7 Prevent duplicate regex flags (#7617) 2018-03-22 10:25:26 -05:00
Sven SAULEAU
de00d939f0 fix: clean makefile 2018-03-22 10:29:25 +01:00
Brian Ng
e80488f1d5 Update to beta.42 (#7609) 2018-03-21 10:39:46 -05:00
Michał Pierzchała
81c1b49f6a Disable flow on transformClass, fix preset-env errors (#7605) 2018-03-20 18:42:11 -05:00
Justin Ridgewell
55bf55398a Logical Assignment: ensure computed key isn't recomputed (#7604)
* Logical Assignment: ensure computed key isn't recomputed

* More tests
2018-03-20 23:06:09 +00:00
Daniel Tschinder
f0d681a238 Remove obsolete max-len eslint rule and reformat some stuff to fit (#7602) 2018-03-20 08:51:47 -05:00
Logan Smyth
6d6fe844fd Centralize Babel's own compilation config to make it easier to follow. (#7599) 2018-03-19 21:49:17 -07:00
Logan Smyth
edb0a70e14 Run prettier to format all JSON. 2018-03-19 18:26:55 -07:00
Brian Ng
669f6b97b2 Tweak es2015-related plugin order in preset-env (#7586) 2018-03-19 14:19:42 -05:00
Michał Pierzchała
e2c5f25e97 Refactored quirky inheritance in babel-plugin-transform-classes (#7444)
* chore(plugin-transform-classes): refactor inheritance

* path some flow types

* remove unused export

* get rid of class

* temporarily rename to vanilla for diff readability

* more setState with minor adjustments

* rename 'private' methods

* explicit null check

* adjust import ordering

* Rename createConstructor -> maybeCreateConstructor

* Rename vanilla.js -> transformClass.js
2018-03-19 16:37:59 +01:00
Amin Marashi
8eee435cd6 Add RegExp support to include/exclude preset-env options (#7242)
* Add support for RegExp includes/excludes

* Keep the plugin order

* Detect invalid modules in regexp

* Add more tests for regexp

* Cover builtins, and unnormalized in the RegExp tests

* Remove babel-plugin- in all positions

* Change babel-plugin- prefix to string

* Add a test for the same module in include/exclude

* Handle partial matches explicitly

* Remove extra valid regexp check

* Optimise validation of plugins

* Optimise selecting the plugins

* Fix undefined include/exclude option

* Update documentation to reflect the new include matching

* Fix typo

* Apply reviews

Use regexp.test instead of string.match (slower)

Define flatten helper

Do not normalize babel-plugin anywhere in the string
2018-03-18 15:54:43 +01:00
Henry Zhu
d260bfaec4 v7.0.0-beta.42 2018-03-15 16:50:03 -04:00
Logan Smyth
c662c2ada2 Use strict namespace behavior for mjs files. (#7545) 2018-03-15 13:27:01 -07:00
Ben Wiley
b6e54800b4 Remove outdated spec deviation note [skip ci] (#7571)
`JSXText` was added to the JSX spec [here](https://github.com/facebook/jsx/pull/80).
2018-03-15 16:20:14 -04:00
Henry Zhu
ae210a46d1 Merge pull request #7562 from babel/pr/7534
Use helper-module-import inside preset-env
2018-03-15 16:19:03 -04:00
Logan Smyth
017d0e7078 Ensure that the backward-compat logic for plugin-utils copies over the version API properly. (#7580) 2018-03-15 11:45:53 -07:00
Josh Justice
b8d1d221f8 Rename actual/expected test files to input/output (#7578)
These files appear to have been missed in the update of test file naming from actual/expected.js to input/output.js. As a result, they were silently not being run. I've confirmed that they were not running, updated the names, then confirmed that they are running now.
2018-03-15 19:02:41 +01:00
Brian Ng
fed530f6bf Use helper-module-import inside entry plugin too 2018-03-15 09:21:20 -05:00
Gaël Gillard
29d44193cd Use helper-module-imports instead of custom import (#7457) 2018-03-15 09:21:19 -05:00
Melvin Groenhoff
82994ce087 Fix "Module build failed: Error: Cannot find module '@babel/types'" (#7575)
* @babel/template and @babel/types are dependencies instead of devDependencies (fixes #7573).

* Use @babel/types and @babel/template via @babel/core
2018-03-15 14:45:26 +01:00
Mateusz Burzyński
586d3b5929 Wrap wrapNativeSuper helpers in redefining functions for better tree-shakeability (#7188) 2018-03-14 23:48:33 +01:00
Mateusz Burzyński
d682e32529 Favour extends helper over objectWithoutProperties when whole object gets copied anyway (#7390) 2018-03-14 22:59:02 +01:00
Simon Kjellberg
07ab02f6b2 Fix incorrect value of _cache in _wrapNativeSuper (#7570)
The boolean expressions returns false in environments where Map is missing.
This change explicitly sets _cache to undefined in such cases, to ensure the cache methods will be ignored.
2018-03-14 16:37:51 -04:00
Nicolò Ribaudo
91a114f74a [transform-classes] Fix typo in _wrapNativeSuper helper 2018-03-14 19:23:10 +01:00
Nicolò Ribaudo
6d9887fc0f [typeof-symbol] Guard against undefined built-in globals 2018-03-14 19:23:10 +01:00
Henry Zhu
d2a3a8151e update to beta.41 (#7568) 2018-03-14 12:40:59 -05:00
Daniel Tschinder
da2aea31f5 Fix —require 2018-03-14 13:26:07 +01:00
Abu Shamsutdinov
8317f8ab14 added support Node's --require and -r flags in babel-node 2018-03-07 12:38:57 +03:00
18338 changed files with 747724 additions and 435584 deletions

View File

@@ -1,5 +0,0 @@
# Ensure babel-register won't compile fixtures, or try to recompile compiled code.
packages/*/test/fixtures
packages/*/lib
packages/babel-standalone/babel.js
packages/babel-preset-env-standalone/babel-preset-env.js

View File

@@ -1,48 +0,0 @@
"use strict";
const env = process.env.BABEL_ENV || process.env.NODE_ENV;
const envOpts = {
loose: true,
};
switch (env) {
case "development":
envOpts.debug = true;
// fall-through
case "test":
case "cov":
envOpts.targets = {
node: "current",
};
}
const config = {
comments: false,
presets: [["@babel/env", envOpts]],
plugins: [
// TODO: Use @babel/preset-flow when
// https://github.com/babel/babel/issues/7233 is fixed
"@babel/plugin-transform-flow-strip-types",
["@babel/proposal-class-properties", { loose: true }],
"@babel/proposal-export-namespace-from",
"@babel/proposal-numeric-separator",
["@babel/proposal-object-rest-spread", { useBuiltIns: true }],
],
overrides: [
{
test: "packages/babylon",
plugins: [
"babel-plugin-transform-charcodes",
["@babel/transform-for-of", { assumeArray: true }],
],
},
],
};
// we need to do this as long as we do not test everything from source
if (env === "cov") {
config.auxiliaryCommentBefore = "istanbul ignore next";
config.plugins.push("babel-plugin-istanbul");
}
module.exports = config;

View File

@@ -1,16 +0,0 @@
"use strict";
const cloneDeep = require("lodash/cloneDeep");
const babelrc = require("./.babelrc.js");
const config = cloneDeep(babelrc);
const presetEnv = config.presets.find(preset => preset[0] === "@babel/env");
if (!presetEnv) {
throw new Error("Error while extracting @preset/env from .babelrc.js");
}
presetEnv[1].modules = false;
module.exports = config;

View File

@@ -18,11 +18,6 @@ aliases:
- ~/.yarn-cache
key: v1-yarn-cache
- &yarn-install
run: |
sudo npm i -g yarn@^1.5.1
yarn --version
- &artifact_babel
path: ~/babel/packages/babel-standalone/babel.js
@@ -35,19 +30,28 @@ aliases:
- &artifact_env_min
path: ~/babel/packages/babel-preset-env-standalone/babel-preset-env.min.js
- &test262_workdir
working_directory: ~/babel/babel-test262-runner
- &artifact_test262_tap
path: ~/test262.tap
- &artifact_test262_xunit
path: ~/test-results
jobs:
build:
test:
working_directory: ~/babel
docker:
- image: circleci/node:9
- image: circleci/node:13
steps:
- checkout
- restore-cache: *restore-yarn-cache
- restore-cache: *restore-node-modules-cache
- *yarn-install
- run: yarn --version
- run: make test-ci-coverage
# Builds babel-standalone with the regular Babel config
- run: make build
- run: IS_PUBLISH=true make build
# test-ci-coverage doesn't test babel-standalone, as trying to gather coverage
# data for a JS file that's several megabytes large is bound to fail. Here,
# we just run the babel-standalone test separately.
@@ -58,4 +62,60 @@ jobs:
- store_artifacts: *artifact_env
- store_artifacts: *artifact_env_min
- 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

View File

@@ -6,9 +6,12 @@ charset = utf-8
trim_trailing_whitespace = true
end_of_line = lf
[*.{js,json}]
[*.{js,json,ts,tsx}]
indent_style = space
indent_size = 2
[Makefile]
indent_style = tab
[*.{md,markdown}]
trim_trailing_whitespace = false

View File

@@ -1,9 +1,12 @@
/lib
/build
/.git
package.json
lerna.json
packages/babel-runtime
!packages/babel-runtime/scripts
!packages/babel-runtime/core-js.js
!packages/babel-plugin-transform-runtime/scripts
packages/babel-runtime-corejs2
packages/babel-runtime-corejs3
packages/*/node_modules
packages/*/lib
packages/*/dist
@@ -20,4 +23,4 @@ packages/babel-preset-env-standalone/babel-preset-env.js
packages/babel-preset-env-standalone/babel-preset-env.min.js
packages/babel-standalone/babel.js
packages/babel-standalone/babel.min.js
packages/babylon/test/expressions
packages/babel-parser/test/expressions

View File

@@ -1,11 +1,9 @@
{
"root": true,
"plugins": ["prettier", "@babel/development", "import"],
"extends": "babel",
"plugins": ["prettier"],
"rules": {
"curly": ["error", "multi-line"],
"prettier/prettier": "error",
"no-case-declarations": "error"
"prettier/prettier": "error"
},
"env": {
"node": true
@@ -14,19 +12,30 @@
{
"files": ["packages/*/src/**/*.js", "codemods/*/src/**/*.js"],
"rules": {
"no-undefined-identifier": "error",
"no-deprecated-clone": "error"
"@babel/development/no-undefined-identifier": "error",
"@babel/development/no-deprecated-clone": "error",
"import/no-extraneous-dependencies": "error",
"guard-for-in": "error"
}
},
{
"files": [
"packages/*/test/**/*.js",
"codemods/*/test/**/*.js",
"packages/babel-helper-transform-fixture-test-runner/src/helpers.js",
"test/**/*.js"
],
"env": {
"jest": true
}
},
{
"files": ["packages/babel-plugin-*/src/index.js"],
"excludedFiles": ["packages/babel-plugin-transform-regenerator/**/*.js"],
"rules": {
"@babel/development/plugin-name": "error",
"eqeqeq": ["error", "always", { "null": "ignore" }]
}
}
]
}

View File

@@ -1,10 +1,10 @@
[ignore]
.*/build/.*
.*/packages/.*/lib
.*/packages/.*/test
.*/codemods/.*/lib
.*/codemods/.*/test
.*/node_modules/conventional-changelog-core/
<PROJECT_ROOT>/build/.*
<PROJECT_ROOT>/packages/.*/lib
<PROJECT_ROOT>/packages/.*/test
<PROJECT_ROOT>/codemods/.*/lib
<PROJECT_ROOT>/codemods/.*/test
<PROJECT_ROOT>/node_modules/module-deps/
[include]
packages/*/src
@@ -24,4 +24,6 @@ suppress_comment= \\(.\\|\n\\)*\\$FlowIgnore
suppress_type=$FlowFixMe
suppress_type=$FlowSubtype
esproposal.export_star_as=enable
esproposal.optional_chaining=enable
esproposal.nullish_coalescing=enable
module.name_mapper='^@babel\/\([a-zA-Z0-9_\-]+\)$' -> '<PROJECT_ROOT>/packages/babel-\1/src/index'

View File

@@ -84,7 +84,7 @@
* More performance improvements.
* Parsing is now ~30% faster thanks to [marijnh/acorn@7264bc0178e7e6af7cfe02e9e0c6b26ee0e6007f](https://github.com/marijnh/acorn/commit/7264bc0178e7e6af7cfe02e9e0c6b26ee0e6007f).
* **New Feature**
* Optional `es6.blockScopingTDZ` is now completely functional and handles all edgecases.
* Optional `es6.blockScopingTDZ` is now completely functional and handles all edge cases.
* `super` in object literals.
* 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.
* **Bug Fix**
* Fix source maps not tracking end of node locations.
* **Spec Compliancy**
* **Spec Compliance**
* Use static super references as the home object is actually done at definition time.
* **Polish**
* Force the `es6.destructuring` transformer to be whitelisted when the `es7.objectSpread` transformer is.
@@ -474,12 +474,12 @@
* **Polish**
* Rest parameters now allocate the array before populating.
* **Internal**
* `for...in` loops have been changed to optimized `for` loops - better performance and no enumeration of protoype keys.
* `for...in` loops have been changed to optimized `for` loops - better performance and no enumeration of prototype keys.
* Parts of the code generator have now been optimized thanks to [gaearon](https://github.com/gaearon).
## 2.12.3
* **Spec Compliancy**
* **Spec Compliance**
* Optional `typeof` transformer checks for `undefined` before passing it to the helper.
* Class methods are now named.
@@ -551,7 +551,7 @@
* Add `classesFastSuper` optional transformer that doesn't support parent getters and prototype changing.
* Add `forOfFast` transformer that speeds up `for...of` on arrays but produces more code.
* Add `--react-compat` to `bin/6to5`.
* **Spec Compliancy**
* **Spec Compliance**
* Disallow setters without a single parameter.
* Add `configurable` and `writable` to defined properties.
* Use define instead of assignment for class methods.
@@ -619,7 +619,7 @@
## 2.7.0
* **Spec Compliancy**
* **Spec Compliance**
* Disallow reassignments of imports.
* **New Feature**
* `reactCompat` option to enable pre-v0.12 react components.
@@ -643,7 +643,7 @@
* **Bug Fix**
* Better handling of number literal property keys.
* Handle `NewExpression` paren insertion edegcases better.
* Handle `NewExpression` paren insertion edge cases better.
* **Internal**
* Fix incorrect AST node `identifier("this")`.
* Better `toIdentifier` method that handles reserved words.
@@ -662,7 +662,7 @@
* **Polish**
* Move `"use strict";` to inside module bodies instead of at the top of the file.
* Better handling of dynamic imports.
* **Spec Compliancy**
* **Spec Compliance**
* Class inheritance now has a `function` or `null` type check.
* Add `interopRequireWildcard` around wildcard imports and exports to handle non-object exports.
@@ -850,7 +850,7 @@
## 1.14.10
* Fix let scoping unneccesary override.
* Fix let scoping unnecessary override.
## 1.14.6
@@ -973,7 +973,7 @@
## 1.12.21
* Fix unneccesary let scoping replacement.
* Fix unnecessary let scoping replacement.
* Add `commonInterop` module formatter. Thanks [@Naddiseo](https://github.com/Naddiseo).
* Fix `return` outside of function body bug. Thanks [@brentburg](https://github.com/brentburg).
* Add more flexible option types.
@@ -1020,7 +1020,7 @@
## 1.12.12
* Make scope tracker more reliable to handle all edgecases.
* Make scope tracker more reliable to handle all edge cases.
## 1.12.11

287
.github/CHANGELOG-v4.md vendored Normal file
View File

@@ -0,0 +1,287 @@
# Babel v4 Changelog
## 4.7.16
* **Bug Fix**
* Fix constructor spreading of typed arrays.
* Fix break/continue/return aliasing of non-loops in block scoping transformer.
## 4.7.15
* **Bug Fix**
* Fix constructor spreading of collections.
## 4.7.14
* **Bug Fix**
* Fix constructor spreading of `Promise`.
* **Internal**
* Deprecate remaining playground transformers and abstract references.
## 4.7.13
* **Bug Fix**
* Handle comments on use strict directives.
* Fix assignment patterns with a left side pattern.
* **Polish**
* Special case `this` when doing expression memoisation.
## 4.7.12
* **Bug Fix**
* Deprecate `playground.methodBinding`.
## 4.7.11
* **Bug Fix**
* Fix unicode regexes stripping their unicode flag before being passed on two `regexpu`.
## 4.7.10
* **Internal**
* Deprecate `playground.methodBinding` and `playground.objectGetterMemoization`.
* **Bug Fix**
* Fix `inputSourceMap` option. Thanks [@Rich-Harris](https://github.com/Rich-Harris)!
## 4.7.9
* **Polish**
* Allow `inputSourceMap` to be set to `false` to skip the source map inference.
* Infer computed literal property names.
* **Bug Fix**
* Fix nested labeled for-ofs.
* Fix block scoping `break` colliding with the parent switch case.
* **Internal**
* Upgrade `acorn-babel`.
## 4.7.8
* **Bug Fix**
* Fix computed classes not properly setting symbols.
## 4.7.7
* **Bug Fix**
* Fix `types` API exposure.
## 4.7.6
* **Bug Fix**
* Fix non-Identifier/Literal computed class methods.
* **Polish**
* Add a fallback if `stack` on an error is unconfigurable.
* Hoist `esModule` module declarations to the top of the file to handle circular dependencies better.
## 4.7.5
* **Bug Fix**
* Don't remap` break`s to call the iterator return.
* **Polish**
* Use a different helper for computed classes for much nicer output. Also fixes a bug in symbols being non-enumerable so they wouldn't be set on the class.
## 4.7.4
* **Bug Fix**
* Rewrite named function expressions in optional async function transformers.
* Hoist directives.
* Remove `Number` from the list of valid `runtime` constructors.
* **Internal**
* `spec.typeofSymbol` transformer has been renamed to `es6.symbols`.
## 4.7.2
* **New Feature**
* `"both"` option for `sourceMap`.
* Add output types to external helpers. Thanks [@neVERberleRfellerER](https://github.com/neVERberleRfellerER)!
* **Bug Fix**
* Fix node duplication sometimes resulting in a recursion error.
* Ignore `break`s within cases inside `for...of`.
* **Polish**
* Split up variable declarations and export declarations to allow easier transformation.
## 4.7.0
* **Bug Fix**
* Add `alternate` to list of `STATEMENT_OR_BLOCK` keys.
* Add support for module specifiers to `t.isReferenced`.
* **New Feature**
* Add `inputSourceMap` option.
* **Polish**
* Throw an error on different `babel` and `babel-runtime` versions.
* Replicate module environment for `babel-node` eval.
* Clean up classes output.
* **Spec Compliance**
* Make it illegal to use a rest parameter on a setter.
## 4.6.6
* **Bug Fix**
* Fix incorrect method call in `utility.deadCodeElimination` transformer.
* Fix `es6.blockScopingTDZ` transformer duplicating binding nodes.
## 4.6.5
* **Internal**
* `useStrict` transformer has been renamed to `strict`.
## 4.6.4
* **Bug Fix**
* Fix `ForOfStatement` not properly inheriting labels.
* When in closure mode in block scoping transformer, properly check for variable shadowing.
* **New Feature**
* New `utility.inlineEnvironmentVariables` and `utility.inlineExpression` transformers.
## 4.6.3
* **Bug Fix**
* Fix `arguments` being incorrectly aliased in arrow function rest parameter optimisation.
* Make deoptimisation trigger safer.
* **New Feature**
* Flow types are now retained when blacklisting the `flow` transformer.
## 4.6.1
* **Bug Fix**
* Fix generators in template directory being transformed.
* Fix exposure of `util` for plugins.
## 4.6.0
* **New Feature**
* Desugar sticky regexes to a new constructor expression so it can be handled by a polyfill.
* **Spec Compliance**
* `for...of` now outputs in a lengthy `try...catch` this is to ensure spec compliance in regards to iterator returns and abrupt completions. See [google/traceur-compiler#1773](https://github.com/google/traceur-compiler/issues/1773) and [babel/babel/#838](https://github.com/babel/babel/issues/838) for more information.
* **Polish**
* Rest parameters that are only referred to via number properties on member expressions are desugared into a direct `arguments` reference. Thanks [@neVERberleRfellerER](https://github.com/neVERberleRfellerER)!
* `$ babel` no longer exits on syntax errors.
* **Internal**
* Upgrade `browserify`.
* Upgrade `source-map`.
* Publicly expose more internals.
## 4.5.5
* **Polish**
* Delete old extensions when overriding them in `babel/register`.
## 4.5.3
* **Bug Fix**
* Fix whitelisting logic for helper build script.
## 4.5.2
* **New Feature**
* `returnUsedHelpers` option and add whitelist to `buildHelpers`.
* **Bug Fix**
* Fix function arity on self referencing inferred named functions.
* **Internal**
* Bump `acorn-babel`.
* Start converting source to ES6...
## 4.5.1
**Babel now compiles itself!**
![holy shit](http://gifsec.com/wp-content/uploads/GIF/2014/03/OMG-GIF_2.gif)
## 4.5.0
* **New Feature**
* Add `.babelrc` support.
* **Bug Fix**
* Move use strict directives to the module formatter bodies.
* **Internal**
* Make default `bin/babel` behaviour to ignore non-compilable files and add a `--copy-files` flag to revert to the old behaviour.
## 4.4.6
* **Bug Fix**
* Fix extending a class expression with no methods/only constructor. Thanks [@neVERberleRfellerER](https://github.com/neVERberleRfellerER)!
* Allow `MemberExpression` as a valid `left` of `ForOfStatement`.
* **Polish**
* Throw an error when people try and transpile code with the `@jsx React.DOM` pragma as it conflicts with the custom jsx constructo method detection.
* Crawl all comments for `@jsx` pragma.
* **Internal**
* Upgrade `chalk`.
* Upgrade `core-js`.
## 4.4.5
* **Internal**
* Remove function self reference optimisation.
## 4.4.4
* **Bug Fix**
* Handle inferred function ids to be reassigned and deopt to a slower but working equivalent.
* Don't unpack array patterns that have more elements than their right hand array expression.
* **Polish**
* Improve syntax highlighting in the code frame. Thanks [@lydell](https://github.com/lydell)!
* **Internal**
* Upgrade `acorn-babel`.
## 4.4.3
* **Bug Fix**
* Fix `for...of` iterator break returns being duplicated.
* Only call `return` on the iterator if it exists.
* **Internal**
* Rename `selfContained` transformer to `runtime`.
## 4.4.2
* **New Feature**
* Add `moduleId` option for specifying a custom module id.
## 4.4.0
* **New Feature**
* `/*** @jsx NAMESPACE **/` comments are now honored by the `react` transformer.
* `getModuleName` option.
* Infer function expression names. Thanks [@RReverser](https://github.com/RReverser)!
* **Bug Fix**
* Add proper control flow for tail recursion optimisation.
* **Internal**
* Remove useless `format` options and move the `format.compact` option to `format`.
* **Polish**
* Newline handling of the code generator has been heavily improved.
* Code generator now deopts whitespace if the input size is >100KB.
## 4.3.0
* **Breaking Change**
* Remove `commonStandard` module formatter and make it the default behaviour of all the strict module formatters.
## 4.2.1
* **Polish**
* Add auxiliary comment to let scoping closure flow control.
## 4.2.0
* **Polish**
* Use an assignment instead of a define for `__esModule` in loose mode.
* **Internal**
* Add error for `eval();` usage and enable strict mode for parsing.
## 4.1.0
* **New Feature**
* Add `BABEL_CACHE_PATH` and `BABEL_DISABLE_CACHE` environment variables.
* **Internal**
* Replace many internal util functions with modules. Thanks [@sindresorhus](https://github.com/sindresorhus)!
## 4.0.2
* **Bug Fix**
* Fix generators not properly propagating their internal declarations.
* **Polish**
* Update setter param length error message.
* Use ranges on dependencies.
## 4.0.0
* 6to5 is now known as Babel.
* Global helpers/runtime has now been given the more descriptive name of "external helpers".

838
.github/CHANGELOG-v5.md vendored Normal file
View File

@@ -0,0 +1,838 @@
# Babel v5 Changelog
## 5.8.26
* **Internal**
* Republish to get fix for runtime `typeof-react-element` helper.
## 5.8.25
* **Internal**
* Rename `define` method to avoid webpack assuming those files are AMD.
## 5.8.24
* **Spec Compliance**
* Updated `optimisation.react.inlineElements` transformer to React 0.14 output. Thanks [@spicyj](https://github.com/spicyj)!
* **Polish**
* Add support for evaluating more static nodes. Thanks [@hzoo](https://github.com/hzoo)!
## 5.8.23
* **Bug Fix**
* Fix a bug where pushed scope bindings weren't properly being registered.
## 5.8.22
* **Bug Fix**
* Fix bug causing regexes to cause a syntax error after a block.
* **Internal**
* Expose `File`.
## 5.8.21
* **New Feature**
* Add support for Flow export types.
* **Bug Fix**
* Fix flow type annotations on object properties being lost.
* Fix bug effecting nested arrow functions.
* Check valid `export default` `function`/`class` token when parsing export default before converting to a declaration to avoid turning expressions into declarations.
* **Polish**
* Add an exception to non-existent bindings when checking if we need to wrap block scoping blocks in a closure.
* Make comment retainment for multiple replacement nodes more predictable.
* **Internal**
* Remove `operator` property from `AssignmentPattern` nodes.
* Update `es7.asyncFunctions` and `es7.objectRestSpread` to stage 2.
## 5.8.13-5.8.20
**The CHANGELOG was broken for these releases. Git tags were not pushed in the correct order and are therefore incorrect. It's recommended you NOT use any versions within this range.**
* **New Feature**
* Add `es6.spec.modules` transformer.
* **Bug Fix**
* Don't register export declarations as a module binding.
* Register import bindings to the specifier instead of the declaration.
* `export *` should not export `default`.
* Clear `rawValue from JSX attribute values to avoid outputting the raw source verbatim.
* Add support for boolean flow literals.
* Fix bug where files that babel can compile weren't being written when ignored with the `--copy-files` flag.
* Create new raw identifiers instead of cloning the original user one when exploding export specifiers to fix source map issues resulting in incorrect locations.
* Break on hitting a terminator paren triggering character to avoid pushing multiple starting parens.
* Consider comment starting character to be a terminatorless separator to avoid starting comments breaking terminatorless nodes.
* **Internal**
* Use `json5` for parsing `.babelrc` files and `JSON` for `package.json`.
* Update Regenerator dependency to `0.8.35`.
* Remove flow types from being scope tracked.
* **Polish**
* Only register export declarations in scope tracking if they're of a valid type.
* Only output code frame and message on syntax errors in CLI.
* Set decorated initialisers that have no `initialiser` to `undefined`.
* Optimise common `typeof` cases in `es6.spec.symbols` transformer.
## 5.8.12
* **Bug Fix**
* Fix bug in lookahead causing decorators to be cleared.
## 5.8.11
* **Bug Fix**
* Check if module options are nully instead of falsy to allow empty strings as `moduleRoot` etc.
* Fix bug where reassigning the rest parameter wouldn't result in a deoptimisation.
## 5.8.9
* **Bug Fix**
* Fix issue in parser where the flow plugin wasn't using state to refer to whether it as in a type or not causing lookaheads to cause breakages.
## 5.8.8
* **Bug Fix**
* Fix comments not being attached if they're touching the start of their node.
## 5.8.7
* Never published, environment issues, again.
## 5.8.6
* **Bug Fix**
* Remove `rawValue` for JSX inner text.
## 5.8.5
* **Polish**
* Rewrite parentheses insertion for terminatorless nodes such as `BreakStatement` to be much more stable and cleaner.
* Use `Object.setPrototypeOf` and fallback to `__proto__` in `inherits` helper.
## 5.8.2-5.8.4
Issues with publish process.
## 5.8.1
* **Bug Fix**
* Fix regression where async arrow functions couldn't have type annotation parameters.
* Output type annotations of type instantiation parameters.
* **Polish**
* Prepend to highest loop when performing rest parameter allocation optimisation.
* Add comment attachment to parser.
* Add support for retaining inner comments of empty blocks.
## 5.8.0
* Never released due to publish environment issues.
## 5.7.4
* **Bug Fix**
* Fix comments containg `@flow` being completely removed from output rather than just the specific directive.
## 5.7.3
* **Bug Fix**
* Add shim file for broken file path that old versions of the CLI would attempt to use.
## 5.7.2
* **Bug Fix**
* Fix performance issue in code generator when comment columns would attempt to match up in `compact` mode causing large amounts of whitespace.
* Fix single line comments not outputting a newline in `compact` mode.
* **Polish**
* Add support for flow return types for arrow functions.
## 5.7.1
* **Bug Fix**
* Add back mistakenly removed `replaceWithSourceString` method.
## 5.7.0
* **Bug Fix**
* Deopt on spread elements when performing array destructuring unpack optimisation.
* **New Feature**
* Add `shouldPrintComment` option to control comment output.
* Add `.babelignore` file to be consistent with other tools.
* Allow `.babelrc` configs to be specified via `package.json`.
* **Polish**
* Don't ignore comments when using `compact: true` option.
* Add support for Flow `import typeof`.
* Fix incorrect inheritance method position when using loose mode classes and constructor isn't the first item.
* **Internal**
* Completely fork Acorn with `babylon`.
* Rewrite build system to accommodate for multiple packages.
## 5.6.17
* **Bug Fix**
* Fix `CodeGenerator.findCommonStringDelimiter` causing a stack overflow.
## 5.6.16
* **Internal**
* Fix `recast` version to avoid pulling in a newer version.
* **New Feature**
* Add support for functions in `util.shouldIgnore`.
* **Polish**
* Strip flow directives in flow transformer.
* Add a check for out of bounds default parameters, drastically improving performance and removes engine deoptimisations.
* Various performance optimisations by [@samccone](https://github.com/samccone) 💅✨
* Delay `this` assignment when referencing this inside an arrow function pre-bare super in derived class constructors.
* Split up class body pushing if the constructor is in the wrong order.
* **Bug Fix**
* Fix hoisting of `ForInStatement` `init` variables in `system` module formatter.
* `PathHoister`: Don't hoist to the same function as their original paths function parent.
* `PathHoister`: Push each violation paths ancestry to the breakOnScopePaths collection to avoid constant hoisting to nested paths.fix tail call recursion on functions with less arguments than parameters.
* Disallow `super.*` before `super()` in derived class constructors.
* Properly regenerate scope for replaced nodes. Thanks [@loganfsmyth](https://github.com/loganfsmyth)!
* Move up template literal simplification logic to avoid breaking on single elements.
## 5.6.13-5.6.15
* Setting up automatic Travis releases.
## 5.6.12
* **Bug Fix**
* Fix finding parent for top-level shadowed functions.
## 5.6.11
** **Internal**
* Merge `es6.parameters.rest` and `es6.parameters.default` transformers. See commit [c0fd4c1f9e0b18231f585c4fa793e4cb0e01aed1](https://github.com/babel/babel/commit/c0fd4c1f9e0b18231f585c4fa793e4cb0e01aed1) for more info.
## 5.6.10
* **Bug Fix**
* Fix faulty internal require check.
* **Polish**
* Add support for trailing commas in arrow function parameter lists.
## 5.6.8
* **Bug Fix**
* Fix binary expressions colliding with unary expression operators in compact mode.
* Fix node properties being set to `null` when using computed properties.
## 5.6.7
* **Bug Fix**
* Fix hoisting of `ForXStatement` `left` `var`s when inserting a block scoping IIFE.
* **Polish**
* Combine all leading computed property initialisers into the root object in loose mode.
* **Internal**
* Deprecate returning of replacement strings from visitor methods.
## 5.6.6
* **Bug Fix**
* Fix weird parser bug where `void` type annotations were being parsed as keywords causing the tokeniser to lose track of context.
## 5.6.5
* **Bug Fix**
* Fix nested functions causing rest parameter optimisation to not properly detect when it should deopt on a reference.
* **Internal**
* Update Regenerator `0.8.31`.
## 5.6.4
* **Internal**
* Add `ParenthesizedExpression` node type.
## 5.6.3
* **Bug Fix**
* Fix rest parameter array allocation loop being incorrectly aliased.
## 5.6.2
* **Bug Fix**
* Fix method key literals not turning into computed member expression in loose mode.
* Elect rest parameters in spread element position as candidates instead of replacing them in place.
## 5.6.0
* **Bug Fix**
* Fix istanbul interop for register hook when registering for non-existence extension.
* Fix super class constructor call differing for no constructor in derived classes.
* Disable module import receiver when in loose mode.
* Fix duplicate filenames when using `babel` CLI when passing multiple matching patterns.
* Register labels as bindings to fix undeclared variable checks.
* **Polish**
* Remove unnecessary string binary expressions when transforming template literals.
* Support module live bindings in arbitrary positions not in Program statement position.
* Throw error when attempting 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.
* Generate original number representation when value was not changed.
* Check for invalid binding identifiers when generating inferred method names.
* Don't terminate CLI when watching files fail compilation on init.
* **New Feature**
* Add new plugin API.
* **Internal**
* Split react displayName addition into a plugin.
* Add check for `JSXMemberExpression` to `t.isReferenced`.
* Move `validation.undeclaredVariableCheck` transformer up.
* Start great core-to-plugin exodus.
* Add `BindingIdentifier` virtual type.
* Hidden class optimisations.
* Array allocation optimisations.
* Update `regenerator`.
* Update `js-tokens`.
* Sync with upstream Acorn.
## 5.5.8
* **Internal**
* Remove extremely unprofessional and harsh error message for those hotlinking to `resolve-rc`.
## 5.5.7
* **Bug Fix**
* Push newline after decorators when doing code gen.
* Rewriting error handling to normalise options before merging them.
* Remove duplicate keys in `alias-keys.json` causing errors in strict mode.
* Fix `$ babel --help` not showing optional transformers as such.
* **New Feature**
* Add `auxiliaryCommentBefore` and `auxiliaryCommentAfter` options.
## 5.5.6
* **Bug Fix**
* Fix `let` binding collision in loop head not properly replacing `AssignmentExpression`s.
## 5.5.5
* **Bug Fix**
* Fix `file.opts` not being set before `file.log.deprecate` was called causing a `ReferenceError` as it was checking for a property on it.
## 5.5.4
* **Bug Fix**
* Add back missing `shouldIgnore` check.
* Log message on deprecated options rather than throw an error.
* Fix name of `auxiliaryComment` option when attempting Istanbul interop in `babel/register`.
## 5.5.3
* **Bug Fix**
* Fix weird state bug when traversing overa `node` `ClassProperty` instead of `path` in the `es6.classes` transformer.
## 5.5.2
* **Bug Fix**
* Fix `NodePath#isPure` on `Property` nodes.
* Use cwd instead of entry file directory when working out relative directory for `babel/register`.
* **Internal**
* Add scary warning for those few who choose to use the WIP experimental transformers.
## 5.5.1
* **Bug Fix**
* Remove `ClassProperty` nodes always in the `Flow` transformer. This is fine now since class properties aren't supported in any engine that supports classes but the `es7.classProperties` transformer will need to be updated in the future to desugar to ES6 classes instead of relying on the `es6.classes` transformer from being ran.
## 5.5.0
* **Bug Fix**
* Allow pushing declarations to `SwitchStatement`s.
* Fix `minification.removeDebugger` to remove `DebuggerStatement`s rather than `ExpressionStatement`s with an identifier of `debugger`.
* Check LHS in `ForInStatement` and `ForOfStatement` for constant violations.
* Register function `id` as a reference when naming methods to avoid collisions.
* Support key literals when checking for the existence of `displayName` property when attempting to add it for `React.createClass`.
* Remove `ExportDefaultSpecifier` check from `t.isDefaultSpecifier`.
* Don't consider `JSXIdentifier` HTML tag identifiers to be references.
* **Polish**
* Update `minification.deadCodeElimination` transformer to remove all statements after completion statements.
* Update `minification.deadCodeElimination` transformer to not inline single used bindings that exist in different scopes.
* When performing Istanbul interop in `babel/register`, add the auxiliary comment `"istanbul ignore text"` to get more accurate coverage.
* Add `--nolazy` argument to `babel-node`.
* Add support for `cluster` forking.
* Perform scope tracking in a single pass instead of multiple.
* Smarten up type inferrence and resolution to support the whole array of language constructs.
* Optimise module metadata retrieval into a single pass.
* Ignore trailing commas when inferring newlines.
* Rename `minification.inlineExpressions` transformer to `minification.constantFolding`.
* Check path relative to entry file when checking to see if we're inside `node_modules` when using `babel/register`.
* Upgrade `regenerator`.
## 5.4.7
* **Bug Fix**
* Don't consider `JSXAttribute` `names` to be valid `ReferencedIdentifier`s.
## 5.4.6
* **Bug Fix**
* Fix `spec.functionName` transformer incorrectly attempting to rename a binding that doesn't exist as it's a global.
* **Internal**
* Deprecate custom module formatters.
## 5.4.5
* **Bug Fix**
* Add `JSXIdentifier` as a valid `ReferencedIdentifier` visitor virtual type.
* Ignore `CallExpression` `_prettyCall` when the `retainLines` option is enabled.
* Inherit comments to new declaration node when exploding module declarations.
* Fix `es6.tailCall` transformer failing on calls that exceed the max parameters of the function.
## 5.4.4
* **Bug Fix**
* Fix bug where replacing variable declarations in the head of a `for` loop would turn them into `ExpressionStatement`s.
* Fix renaming of assignment expressions that were non-identifiers ie. patterns.
* Force space before `class` `id` to avoid breaking named classes when using `compact` mode.
* Add assignment pattern explosion to avoid initial duplicate nodes.
* Ignore this and arguments when performing TCO on shadowed functions.
* **Polish**
* Rename `sourceMapName` option to `sourceMapTarget`. Thanks [@getify](https://github.com/getify)!
* Better detection of completion records, ignore those in `Function`s.
* Clarified descriptions of the options that are enabled by default.
* Resolve `\`babel-plugin-${name}\`` plugin names **before** just checking the `name`. Thanks [@jquense](https://github.com/jquense)!
* Update AMD module formatter to add import default remapping.
## 5.4.3
* **Bug Fix**
* Fix `module` being incorrectly rewritten when used as in an export declaration.
* When performing single-reference inlining, ensure that the single reference isn't a child of the binding itself.
* Fix a bug in `minification.deadCodeElimination` where a new binding instance was being created for local class bindings instead of just inheriting the parent one.
* Fix bug with paren printing in `compact` and `retainLines` mode where a left paren was already printed before catching up.
* **Internal**
* Handle contexts for paths much better. This will ensure that the path node location info is in sync.
## 5.4.2
* **Polish**
* `ignore` and `only` patterns are now **very** liberal. The pattern can now exist anywhere in the path.
## 5.4.1
* **Bug Fix**
* Add missing `slash` dependency. Thanks [@browncolyn](https://github.com/browncolyn)!
* **Polish**
* Clean up `shouldIgnore` algorithm to work how you'd expect rather than being a hacky piece of shit. It now crawls the entire path, checking each section of it against the input ignore/only patterns. This means that the pattern `foo` will ignore the paths `foo/bar.js`, `bar/foo` etc.
## 5.4.0
* **New Feature**
* Added [function bind syntax](https://github.com/zenparsing/es-function-bind) behind stage 0. Thanks [@RReverser](https://github.com/rreverser)!
* Added `env` option. Especially handy when using the `.babelrc`.
* **Bug Fix**
* Fix files not properly being ignored when `babel.transform` ignores them when using `$ babel`.
* Fix scope tracking registering loop head bindings to their `VariableDeclaration` instead of `VariableDeclarator`.
* **Polish**
* Normalise path separators for souce map paths when using `$ babel`.
* Rework `PathHoister` to ignore global references and to not deopt on reassignments to referenced bindings, instead it tries to hoist to the highest scope.
* Added missing exponential operator inlining. Thanks [@nkt](https://github.com/nkt)!
* Optimise `regenerator` transformer. Thanks [@benjamn](https://github.com/benjamn)!
## 5.3.3
* **Bug Fix**
* Fix `minification.deadCodeElimination` transformer incorrectly trying to inline import declarations.
* Fix `minification.inlineExpression` transformer getting into an infinite loop.
## 5.3.2
* **Bug Fix**
* Fix patterns not being considered when hoisting variables in the `es6.blockScoping` transformer.
## 5.3.1
* **Bug Fix**
* Fix unique export specifiers not being cloned when exploding class and function exports,
* **Polish**
* Turn import remaps to sequence expressions to remove their context and improve performance.
## 5.3.0
**Speeeeeeed**
![gifs lol](https://31.media.tumblr.com/568205a0e37ae15eca510fa639589a59/tumblr_n8kw8kpcSb1sg6cg8o1_500.gif)
* **Spec Compliance**
* Allow trailing param commas for methods when using the `es7.trailingCommas` transformer.
* **Bug Fix**
* Fix `es6.blockScoping` transformer not properly ignoring `break` in `SwitchCase`.
* Fix lookahead context saving to avoid weird tokenizer state.
* Explode duplicate identifiers in export/import specifiers and property shorthand to create unique objects.
* Skip loose mode for class methods when they have decorators.
* When removing nodes, share their comments with their siblings.
* Properly hoist temp param declarations when doing TCO.
* **Internal**
* Add `--harmony_generators` flag to `$ babel-node`.
* Internal AST traversals have been minimised **drastically**. Transformers have been grouped together which means entire tree traversals are much fewer. Visiting nodes is now also skipped if the traversal context can detect that the handler is a noop. This sames precious cycles as it avoids constructing traversal paths and creating a new traversal context. See issues [#1472](https://github.com/babel/babel/issues/1472) and [#1486](https://github.com/babel/babel/issues/1486) for related discussion.
* **Polish**
* Move many `utility` transformers to `minification`.
## 5.2.17
* **Bug Fix**
* Fix auxiliary comments not properly being attached to function declaration helpers.
* Add `Super` node type to `ast-types` patch.
* Ignore parameter bindings when attempting to inline them in the `minification.deadCodeElimination` transformer.
* Correct `extensions` arguments when using the Babel CLI.
## 5.2.16
* **Bug Fix**
* Fix plugins being disabled when using the whitelist.
* Fix correct function scope being passed to `nameMethod.property` when inferring the function name for class methods.
* Fix incorrect extensions reference causing weird issues when using the Babel CLI.
* Fix destructuring param reference replacements not inheriting from their original param.
* **Spec Compliance**
* Fix order that method decorators are ran in.
## 5.2.15
* **Bug Fix**
* Fix initializer descriptor add attempt if it doesn't exist.
## 5.2.14
* **Bug Fix**
* Fix bug with initializer decorators where the descriptors weren't being defined if there was no `initializer` property.
* **Internal**
* Expose `retainLines` option to CLI.
* Fix `retainLines` option not being taken into consideration when doing multiple variable declaration declarators generation.
* Expose minified and unminified copies of dist scripts.
## 5.2.13
* **Bug Fix**
* Fix `ExportDeclaration`s being incorrectly removed when using the `utility.deadCodeElimination` transformer.
* Fix position of `utility` transformers.
* **New Feature**
* Add built-in `esquery` support.
* **Internal**
* Consolidate notion of "virtual types".
## 5.2.12
* **Polish**
* Make UID generation based on module declarations **much** nicer.
* **Internal**
* Remove internal check for traversal path replacement of self. This is a pattern that **could** come up in the wild and it could lead to pretty nasty code and may lead to internal regressions as the test coverage isn't 100% :( Instead, just put it in the fast path.
## 5.2.11
* **Internal**
* Rename `getModuleName` option to `getModuleId`, doh.
## 5.2.10
* **Bug Fix**
* Fix numerous issues in `replaceWithSourceString`. Thanks [@pangratz](https://github.com/pangratz)!
* **New Feature**
* Add `getModuleName` option. Thanks [@jayphelps](https://github.com/jayphelps)!
## 5.2.9
* **Bug Fix**
* Fix `_blockHoist` transformer incorrectly sorting nodes on shitty environments that aren't spec compliant in their key order.
* Fix broken `parse` API method reference to an undeclared import.
## 5.2.7
* **Bug Fix**
* Move `utility.deadCodeElimination` transformer up to avoid race conditions.
* Fix shorthand property scope binding renaming.
* **Polish**
* Turn helper variable declarations into function declarations if possible.
* **Internal**
* Removed native inheritance support from classes.
* Added `replaceWithSourceString` path API.
* Split up `es3.propertyLiterals` and `es3.memberExpressionLiterals` transformers to `minification.propertyLiterals` and `es3.memberExpressionLiterals`.
## 5.2.6
* **Internal**
* Fix transformer aliases being accidentally set as deprecated ones.
* Expose `Pipeline` as `TransformerPipeline` instead.
## 5.2.5
* **Bug Fix**
* Fix `parse` API not adding all the correct pipeline transformers.
## 5.2.4
* **Bug Fix**
* Fix race condition with the Node API being loaded awkwardly and not being able to initialise itself when used in the browser.
* **Internal**
* Expose `transform.pipeline`.
## 5.2.3
* **Bug Fix**
* Fix plugin containers being called with an undefined import. Thanks [@timbur](https://github.com/timbur)!
* Allow Flow object separators to be commas. Thanks [@monsanto](https://github.com/monsanto)!
* Add missing `Statement` and `Declaration` node aliases to flow types.
## 5.2.2
* **Internal**
* Allow `util.arrayify` to take arbitrary types and coerce it into an array.
## 5.2.1
* **Bug Fix**
* Fix regression in `node/register` that caused `node_modules` to not be ignored.
## 5.2.0
* **Bug Fix**
* Fix plugin strings splitting arbitrarily on `:` which caused full paths on Windows to fail as they include `:` after the drive letter.
* Call class property `initializer`s with their target instead of their descriptor.
* Fix `ignore` and `only` not properly working on Windows path separators. Thanks [@stagas](https://github.com/stagas)!
* Fix `resolveRc` running on files twice causing issues. Thanks [@lukescott](https://github.com/lukescott)!
* Fix shorthand properties not correctly being target for `isReferenced` checks. Thanks [@monsanto](https://github.com/monsanto)!
* **Polish**
* Allow passing an array of globs to `babel/register` `only` and `ignore` options. Thanks [@Mark-Simulacrum](https://github.com/Mark-Simulacrum)!
* When inferring function names that collide with upper bindings, instead of doing the wrapper, instead rename them.
* Consider constant-like variable declaration functions to always refer to themselves so TOC can be performed.
* Process globs manually when using `$ babel` as some shells such as Windows don't explode them. Thanks [@jden](https://github.com/jden)!
* Add alternative way to execute plugins via a closure that's called with the current Babel instance.
* **Internal**
* Remove multiple internal transformers in favor of directly doing things when we need to. Previously, declarations such as `_ref` that we needed to create in specific scopes were done at the very end via the `_declarations` transformer. Now, they're done and added to the scope **right** when they're needed. This gets rid of the crappy `_declarations` property on scope nodes and fixes the crappy regenerator bug where it was creating a new `BlockStatement` so the declarations were being lost.
* Rework transformer traversal optimisation. Turns out that calling a `check` function for **every single node** in the AST is ridiculously expensive. 300,000 nodes timesed by ~30 transformers meant that it took tens of seconds to perform while it's quicker to just do the unnecessary traversal. Seems obvious in hindsight.
* **New Feature**
* Add `jscript` transformer that turns named function expressions into function declarations to get around [JScript's horribly broken function expression semantics](https://kangax.github.io/nfe/#jscript-bugs). Thanks [@kondi](https://github.com/kondi)!
* Add `@@hasInstance` support to objects when using the `es6.spec.symbols` transformer.
* Add `retainLines` option that retains the line (but not the columns!) of the input code.
## 5.1.13
* **Polish**
* Remove symbol check from `defineProperty` helper.
## 5.1.12
* **Bug Fix**
* Fix `resolveModuleSource` not being ran on `ExportAllDeclaration`s.
* Fix `.babelrc` being resolved multiple times when using the require hook.
* Fix parse error on spread properties in assignment position.
* Fix `externalHelpers` option being incorrectly listed as type `string`.
* **Internal**
* Upgrade `core-js` to `0.9.0`.
* **Spec Compliance**
* Fix object decorators not using the `initializer` pattern.
* Remove property initializer descriptor reflection.
## 5.1.11
* **Bug Fix**
* Memoise and bind member expression decorators.
* Move JSX children cleaning to opening element visitor. Fixes elements not being cleaned in certain scenarios.
* Consider `SwitchStatement`s to be `Scopable`.
* Fix `bluebirdCoroutines` calling `interopRequireWildcard` before it's defined.
* Add space to `do...while` code generation.
* Validate `super` use before `this` on `super` exit rather than entrance.
* **Polish**
* Add Babel name to logger.
## 5.1.10
* **Bug Fix**
* Remove `makePredicate` from acorn in favor of an `indexOf`.
* Remove statements to expression explosion when inserting a block statement.
* **Internal**
* Remove runtime compatibility check.
## 5.1.9
* **Bug Fix**
* Fix class property initializers with `undefined` values not being correctly writable.
* Fix self inferring generators incorrectly causing a stack error.
* Fix default export specifiers not triggering AMD `module` argument inclusion.
* Fix assignments not having their module references properly remapped.
* **Internal**
* Upgrade to latest `acorn`.
* **Polish**
* Make invalid LHS pattern error messages nicer.
## 5.1.8
* **Bug Fix**
* Only make parenthesized object pattern LHS illegal.
## 5.1.7
* **Internal**
* Add `parse` node API.
## 5.1.6
* **Bug Fix**
* Fix `runtime` built-in catchall not properly checking for local variables.
## 5.1.5
* **Internal**
* Bump `core-js` version.
## 5.1.4
* **Polish**
* Add missing `Reflect` methods to runtime transformer.
## 5.1.3
* **Internal**
* Switch entirely to vanilla regenerator.
* Clean up and make the parsing of decorators stateless.
* **Bug Fix**
* Don't do TCO on generators and async functions.
* Add missing `core-js` runtime definitions.
## 5.1.2
* **Bug Fix**
* Add `getIterator` and `isIterable` to `babel-runtime` build script.
## 5.1.1
* **Bug Fix**
* Add missing runtime symbol definitions.
## 5.1.0
* **Bug Fix**
* Fix super reference when using decorators.
* Don't do array unpack optimisation when member expressions are present.
* Add missing descriptors for undecorated class properties.
* Don't consider `arguments` and `eval` valid function names when doing function name inferrence.
* Fix scope tracking of constants in loop heads.
* Parse `AwaitExpression` as a unary instead of an assignment.
* Fix regex evaluation when attempting static evaluation.
* Don't emit tokens when doing a lookahead.
* Add missing `test` declaration to `utility.deadCodeElimination` transformer.
* **Internal**
* Upgrade `regenerator` to the latest and use my branch with the hope of eventually switching to vanilla regenerator.
* Add support for the replacement of for loop `init`s with statements.
* Upgrade dependencies.
* **Polish**
* When adding the scope IIFE when using default parameters, don't shadow the function expression, just `apply` `this` and `arguments` if necessary.
* Use path basename as non-default import fallback.
* **New Feature**
* Add [trailing function comma proposal](https://github.com/jeffmo/es-trailing-function-commas). Thanks [@AluisioASG](https://github.com/AluisioASG)!
* Add support for object literal decorators.
* Make core-js modular when using the `runtime` transformer.
## 5.0.12
* **Bug Fix**
* Fix incorrect remapping of module references inside of a function id redirection container.
## 5.0.11
* **Bug Fix**
* Fix new `for...of` loops not properly inheriting their original loop.
* **Internal**
* Disable scope instance cache.
* **Polish**
* Allow comments in `.babelrc` JSON.
## 5.0.9
* **Polish**
* Use `moduleId` for UMD global name if available.
* **Bug Fix**
* Fix UMD global `module` variable shadowing the `amd`/`common` `module` variable.
* Fix Flow param type annotation regression.
* Fix function name collision `toString` wrapper. Thanks [@alawatthe](https://github.com/alawatthe)!
## 5.0.8
* **Bug Fix**
* Fix falsy static class properties not being writable.
* Fix block scoping collisions not properly detecting modules and function clashes.
* Skip `this` before `super` for derived constructors on functions.
## 5.0.7
* **New Feature**
* Add `--ignore` and `--only` support to the CLI.
* **Bug Fix**
* Remove `HOMEPATH` environment variable from home resolution in `babel/register` cache.
* **Internal**
* Disable WIP path resolution introducing infinite recursion in some code examples.
* **Polish**
* Add live binding to CommonJS default imports.
## 5.0.6
* **Bug Fix**
* Fix mangling of import references that collide with properties on `Object.prototype`.
* Fix duplicate declarations incorrectly being reported for `var`.
## 5.0.5
* **Internal**
* Upgrade `core-js`.
* **Bug Fix**
* Fix arrays not being supported in `util.list`.
## 5.0.4
* **Polish**
* Check for top level `breakConfig` in `resolveRc`.
## 5.0.3
* **Bug Fix**
* Make relative location absolute before calling `resolveRc`.
* **Internal**
* Switch to global UID registry.
* Add `breakConfig` option to prevent Babel from erroring when hitting that option.
## 5.0.1
* **Bug Fix**
* Fix duplicate declaration regression.
* Fix not being able to call non-writable methods.
## 5.0.0
* **New Feature**
* Decorators based on [@wycat's](https://github.com/wycats) [stage 1 proposal](https://github.com/wycats/javascript-decorators).
* Class property initializers based on [@jeffmo's](https://github.com/jeffmo) [stage 0 proposal](https://gist.github.com/jeffmo/054df782c05639da2adb).
* Export extensions based on [@leebyron's](https://github.com/leebyron) [stage 1 proposal](https://github.com/leebyron/ecmascript-more-export-from).
* UMD module formatter now supports globals.
* Add `es3.runtime`, `optimisation.react.inlineElements` and `optimisation.react.constantElements` transformers.
* Add stage option that replaces the experimental one.
* Allow ES7 transformer to be enabled via `optional` instead of only via `stage`.
* Infer string quotes to use in the code generator.
* Consider `export { foo as default };` to be the same as `export default foo;`.
* Add `nonStandard` option that can be set to `false` to remove parser support for JSX and Flow.
* Add `jsxPragma` option.
* Automatically generate CLI options based on internal API options.
* Add support for `.babelrc` on absolute paths.
* Plugin API!
* **Internal**
* Export `options` in browser API.
* Rewritten parser.
* Don't block hoist when runtime transformer is enabled in system module formatter.
* Rewritten the internal traversal and node replacement API to use "paths" that abstracts out node relationships.
* **Polish**
* JSX output is now more inline with the official JSX transformer.
* Hoist block scoping IIFE - this improves memory usage and performance.
* Better IIFE detection - references are now checked to see if they're referencing the binding we're searching for.
* Check for import reassignments in constants transformer.
* Make method definitions with expression bodies illegal.
* Save register cache on tick instead of `SIGINT`.
* Enable strict mode on babel-node eval flag.
* **Bug Fixes**
* Add support for live bindings. This change also increases the reliability of export specifier renaming.
* Add support for super update and non equals assignment expressions.
* Rename shadow constructor binding in classes.
* Seed next iteration bindings with previous fresh bindings when reassigning loop block scoped variables.
* Fix new expression spread referencing the wrong constructor.
* Call `resolveModuleSource` on dynamic imports.
* Added `param` to list of duplicate declaration kinds.
* **Breaking Changes**
* The Babel playground has been removed.
* ES7 Abstract References have been removed.
* Experimental option has been removed in favor of a stage option.
* Rename `returnUsedHelpers` to `metadataUsedHelpers`.

4016
.github/CHANGELOG-v6.md vendored Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -1,63 +1,6 @@
<!---
Thanks for filing an issue 😄 ! Before you submit, please read the following:
Check the other issue templates if you are trying to submit a bug report, feature request, or question
Search open/closed issues before submitting since someone might have asked the same thing before!
If you have a support request or question please submit them to one of this resources:
* Slack Community: https://slack.babeljs.io/
* StackOverflow: http://stackoverflow.com/questions/tagged/babeljs using the tag `babeljs`
* Also have a look at the readme for more information on how to get support:
https://github.com/babel/babel/blob/master/README.md
Issues on GitHub are only related to problems of Babel itself and we cannot answer
support questions here.
-->
Choose one: is this a bug report or feature request?
<!--- Provide a general summary of the issue in the title above -->
### Input Code
<!--- If you're describing a bug, please let us know which sample code reproduces your problem -->
<!--- If you have link to our REPL or a standalone repo please link that! -->
```js
var your => (code) => here;
```
### Babel/Babylon Configuration (.babelrc, package.json, cli command)
<!--- If describing a bug, tell us what your babel configuration looks like -->
```js
{
"your": { "config": "here" }
}
```
### Expected Behavior
<!--- If you're describing a bug, tell us what should happen -->
<!--- If you're suggesting a change/improvement, tell us how it should work -->
### Current Behavior
<!--- If describing a bug, tell us what happens instead of the expected behavior -->
<!--- If suggesting a change/improvement, explain the difference from current behavior -->
### Possible Solution
<!--- Not obligatory, but suggest a fix/reason for the bug, -->
<!--- or ideas how to implement the addition or change -->
### Context
<!--- How has this issue affected you? What are you trying to accomplish? -->
<!--- Providing context helps us come up with a solution that is most useful in the real world -->
### Your Environment
<!--- Include as many relevant details about the environment you experienced the bug in -->
| software | version(s)
| ---------------- | -------
| Babel |
| Babylon | <!-- This is only needed if you are using Babylon directly -->
| node |
| npm |
| Operating System |

44
.github/ISSUE_TEMPLATE/Bug_report.md vendored Normal file
View File

@@ -0,0 +1,44 @@
---
name: "\U0001F41B Bug Report"
about: "If something isn't working as expected \U0001F914."
title: ''
labels: 'i: bug, i: needs triage'
assignees: ''
---
## Bug Report
**Current Behavior**
A clear and concise description of the behavior.
**Input Code**
- REPL or Repo link if applicable:
```js
var your => (code) => here;
```
**Expected behavior/code**
A clear and concise description of what you expected to happen (or code).
**Babel Configuration (.babelrc, package.json, cli command)**
```js
{
"your": { "config": "here" }
}
```
**Environment**
- Babel version(s): [e.g. v6.0.0, v7.0.0-beta.34]
- Node/npm version: [e.g. Node 8/npm 5]
- OS: [e.g. OSX 10.13.4, Windows 10]
- Monorepo: [e.g. yes/no/Lerna]
- How you are using Babel: [e.g. `cli`, `register`, `loader`]
**Possible Solution**
<!--- Only if you have suggestions on a fix for the bug -->
**Additional context/Screenshots**
Add any other context about the problem here. If applicable, add screenshots to help explain.

View File

@@ -0,0 +1,23 @@
---
name: "\U0001F680 Feature Request"
about: "I have a suggestion (and may want to implement it \U0001F642)!"
title: ''
labels: 'i: enhancement, i: needs triage'
assignees: ''
---
## Feature Request
**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I have an issue when [...]
**Describe the solution you'd like**
A clear and concise description of what you want to happen. Add any considered drawbacks.
**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.
**Teachability, Documentation, Adoption, Migration Strategy**
If you can, explain how users will be able to use this and possibly write out a version the docs.
Maybe a screenshot or design?

45
.github/ISSUE_TEMPLATE/Regression-v7.md vendored Normal file
View File

@@ -0,0 +1,45 @@
---
name: "\U0001F4A5 v7 Regression"
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
> First check out: https://babeljs.io/docs/en/v7-migration
> Also a partial upgrade tool: https://github.com/babel/babel-upgrade
**Potential Commit/PR that introduced the regression**
If you have time to investigate, what PR/date introduced this issue.
**Describe the regression**
A clear and concise description of what the regression is.
**Input Code**
<!--- If you have link to our REPL or a standalone repo please link that! -->
```js
var your => (code) => here;
```
**Babel Configuration (.babelrc, package.json, cli command)**
```js
{
"your": { "config": "here" }
}
```
**Expected behavior/code**
A clear and concise description of what you expected to happen (or code).
**Environment**
- Babel version(s): [e.g. v6.0.0, v7.0.0-beta.34]
- Node/npm version: [e.g. Node 8/npm 5]
- OS: [e.g. OSX 10.13.4, Windows 10]
- Monorepo [e.g. yes/no/Lerna]
- How you are using Babel: [e.g. `cli`, `register`, `loader`]

View File

@@ -0,0 +1,19 @@
---
name: "\U0001F917 Support Question"
about: "If you have a question \U0001F4AC, please check out our Slack or StackOverflow!"
title: ''
labels: 'i: question, i: needs triage'
assignees: ''
---
--------------^ Click "Preview" for a nicer view!
We primarily use GitHub as an issue tracker; for usage and support questions, please check out these resources below. Thanks! 😁.
---
* Slack Community Chat: https://babeljs.slack.com (you can sign-up at https://slack.babeljs.io/ for an invite)
* StackOverflow: https://stackoverflow.com/questions/tagged/babeljs using the tag `babeljs`
* Twitter: If it's just a quick question you can ping our Twitter: https://twitter.com/babeljs
* Also have a look at the readme for more information on how to get support:
https://github.com/babel/babel/blob/master/README.md

28
.github/ISSUE_TEMPLATE/Support_us.md vendored Normal file
View File

@@ -0,0 +1,28 @@
---
name: "\U0001F91D Support us on Babel"
about: "If you would like to support our efforts in maintaining this community-driven
project \U0001F64C!"
title: ''
labels: ''
assignees: ''
---
--------------^ Click "Preview" for a nicer view!
> Open Collective: https://opencollective.com/babel
> Henry's Patreon: https://www.patreon.com/henryzhu
Help support Babel!
Babel has always been a community project, not really backed or owned by any single (or group) of companies. While some maintainers used to work at Facebook (and Henry at Adobe) no one was working on it full time and there certainly isn't a huge company or team anywhere doing all this work.
---
As a group of volunteers you can help us in a few ways
- Giving developer time on the project. (Message us on [Twitter](https://twitter.com/babeljs) or [Slack](https://slack.babeljs.io/) for guidance). Companies should be paying their employees to contribute back to the open source projects they use everyday.
- Giving funds by becoming one of our sponsors/donators!
If you'd like to sustain the future of the project as a whole, we have an [Open Collective](https://opencollective.com/babel) that you can donate to. This is a way for funds to be allocated to the core team.
You can also support [Henry](https://github.com/hzoo) directly since I [left my job to work on Babel and Open Source full time](https://twitter.com/left_pad/status/969793227862790144) at my [Patreon](https://www.patreon.com/henryzhu).

View File

@@ -1,18 +1,22 @@
<!--
Before making a PR please make sure to read our contributing guidelines
Before making a PR, please read our contributing guidelines
https://github.com/babel/babel/blob/master/CONTRIBUTING.md
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.
Please note that the Babel Team requires two approvals before merging most PRs.
For issue references: Add a comma-separated list of a [closing word](https://help.github.com/articles/closing-issues-via-commit-messages/) followed by the ticket number fixed by the PR. (it should be underlined in the preview if done correctly)
If you are making a change that should have a docs update: submit another PR to https://github.com/babel/website
-->
| Q                       | A <!--(Can use an emoji 👍) -->
| ------------------------ | ---
| Fixed Issues? | `Fixes #1, Fixes #2` <!-- remove the (`) quotes to link the issues -->
| Fixed Issues? | `Fixes #1, Fixes #2` <!-- remove the (`) quotes and write "Fixes" before the number to link the issues -->
| Patch: Bug Fix? |
| Major: Breaking Change? |
| Minor: New Feature? |
| Tests Added + Pass? | Yes
| Documentation PR | <!-- If so, add `[skip ci]` to your commit message to skip CI -->
| Documentation PR Link | <!-- If only readme change, add `[skip ci]` to your commits -->
| Any Dependency Changes? |
| License | MIT

12
.github/lock.yml vendored Normal file
View File

@@ -0,0 +1,12 @@
# Configuration for lock-threads - https://github.com/dessant/lock-threads
# Number of days of inactivity before a closed issue or pull request is locked
daysUntilLock: 91
# Comment to post before locking. Set to `false` to disable
lockComment: false
# The label to be applied when an issue is locked
lockLabel: 'outdated'
# Issues or pull requests with these labels will not be locked
# exemptLabels:
# - no-locking

81
.github/workflows/issue-triage.yml vendored Normal file
View File

@@ -0,0 +1,81 @@
name: Issue Triage
on:
issues:
types: [opened, labeled]
jobs:
welcome:
name: Welcome comment
runs-on: ubuntu-latest
steps:
- name: Check if Babel member
id: is_babel_member
if: github.event.action == 'opened'
uses: babel/actions/is-org-member@v2
with:
org: babel
username: ${{ github.event.issue.user.login }}
token: ${{ secrets.GITHUB_TOKEN }}
- name: Create Welcome Comment
uses: babel/actions/create-comment@v2
if: |
github.event.action == 'opened' &&
steps.is_babel_member.outputs.result == 0
with:
token: ${{ secrets.BOT_TOKEN }}
issue: ${{ github.event.issue.number }}
comment: >
Hey @${{ github.event.issue.user.login }}!
We really appreciate you taking the time to report an issue. The
collaborators on this project attempt to help as many people as
possible, but we're a limited number of volunteers, so it's
possible this won't be addressed swiftly.
If you need any help, or just have general Babel or JavaScript questions, we have a
vibrant [Slack community](https://babeljs.slack.com) that typically always has someone
willing to help. You can sign-up [here](https://slack.babeljs.io/) for an invite."
needs_info:
name: Needs Info
runs-on: ubuntu-latest
steps:
- name: Create Needs Info Comment
uses: babel/actions/create-comment@v2
if: |
github.event.action == 'labeled' &&
github.event.label.name == 'Needs Info'
with:
token: ${{ secrets.BOT_TOKEN }}
issue: ${{ github.event.issue.number }}
comment: >
Hi @${{ github.event.issue.user.login }}!
This issue is missing some important information we'll need
to be able to reproduce this issue.
Please understand that we receive a high volume of issues,
and there are only a limited number of volunteers that help
maintain this project. The easier it is for us to decipher an
issue with the info provided, the more likely it is that we'll
be able to help.
Please make sure you have the following information documented in
this ticket:
1. Your Babel configuration (typically from `.babelrc` or `babel.config.js`)
2. The current (incorrect) behavior you're seeing
3. The behavior you expect
4. A [short, self-contained example](http://sscce.org/)
Please provide either a link to the problem via the
[`repl`](https://babeljs.io/repl/), or if the `repl` is
insufficient, a new and minimal repository with instructions on
how to build/replicate the issue.

53
.github/workflows/release.yml vendored Normal file
View File

@@ -0,0 +1,53 @@
name: Release
on:
push:
tags: ["v*"]
jobs:
github_release:
name: Trigger GitHub release
runs-on: ubuntu-latest
steps:
- name: Checkout the new tag
uses: actions/checkout@v1.0.0
- name: Get tag info
id: tags
uses: babel/actions/get-release-tags@v2
- name: Generate the changelog
id: changelog
uses: babel/actions/generate-lerna-changelog@v2
with:
from: ${{ steps.tags.outputs.old }}
to: ${{ steps.tags.outputs.new }}
env:
GITHUB_AUTH: ${{ secrets.GITHUB_TOKEN }}
- name: Create a draft GitHub release
uses: babel/actions/publish-github-release@v2
with:
tag: ${{ steps.tags.outputs.new }}
changelog: ${{ steps.changelog.outputs.changelog }}
token: ${{ secrets.BOT_TOKEN }}
- name: Check if releasing from master
id: is_master
uses: babel/actions/ref-matches-branch@v2
with:
name: master
- name: Update CHANGELOG.md
if: steps.is_master.outputs.result == 1
uses: babel/actions/update-changelog@v2
with:
changelog: ${{ steps.changelog.outputs.changelog }}
- name: Commit CHANGELOG.md
if: steps.is_master.outputs.result == 1
run: |
git add CHANGELOG.md
git -c user.name="Babel Bot" -c user.email="babel-bot@users.noreply.github.com" \
commit -m "Add ${{ steps.tags.outputs.new }} to CHANGELOG.md [skip ci]" --no-verify --quiet
git push "https://babel-bot:${{ secrets.BOT_TOKEN }}@github.com/${GITHUB_REPOSITORY}.git" master

46
.gitignore vendored
View File

@@ -1,6 +1,12 @@
.npmrc
.DS_Store
/node_modules
/.github/actions/*/node_modules
/packages/*/node_modules
/packages/*/LICENSE
!/packages/babel-parser/LICENSE
!/packages/babel-plugin-transform-object-assign/LICENSE
*.log
*.cache
/build
@@ -12,24 +18,33 @@ coverage
dist
/.package.json
package-lock.json
/packages/babel-runtime/core-js/**/*.js
!/packages/babel-runtime/core-js/map.js
!/.github/actions/*/package-lock.json
/packages/babel-runtime/helpers/*.js
!/packages/babel-runtime/helpers/toArray.js
!/packages/babel-runtime/helpers/iterableToArray.js
!/packages/babel-runtime/helpers/temporalRef.js
/packages/babel-runtime/helpers/builtin/*.js
!/packages/babel-runtime/helpers/builtin/toArray.js
!/packages/babel-runtime/helpers/builtin/iterableToArray.js
!/packages/babel-runtime/helpers/builtin/temporalRef.js
/packages/babel-runtime/helpers/builtin/es6/*.js
!/packages/babel-runtime/helpers/builtin/es6/toArray.js
!/packages/babel-runtime/helpers/builtin/es6/iterableToArray.js
!/packages/babel-runtime/helpers/builtin/es6/temporalRef.js
/packages/babel-runtime/helpers/es6/*.js
!/packages/babel-runtime/helpers/es6/toArray.js
!/packages/babel-runtime/helpers/es6/iterableToArray.js
!/packages/babel-runtime/helpers/es6/temporalRef.js
/packages/babel-runtime/helpers/esm/*.js
!/packages/babel-runtime/helpers/esm/toArray.js
!/packages/babel-runtime/helpers/esm/iterableToArray.js
!/packages/babel-runtime/helpers/esm/temporalRef.js
/packages/babel-runtime-corejs2/helpers/*.js
!/packages/babel-runtime-corejs2/helpers/toArray.js
!/packages/babel-runtime-corejs2/helpers/iterableToArray.js
!/packages/babel-runtime-corejs2/helpers/temporalRef.js
/packages/babel-runtime-corejs2/helpers/esm/*.js
!/packages/babel-runtime-corejs2/helpers/esm/toArray.js
!/packages/babel-runtime-corejs2/helpers/esm/iterableToArray.js
!/packages/babel-runtime-corejs2/helpers/esm/temporalRef.js
/packages/babel-runtime-corejs2/core-js/**/*.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-cli/test/tmp
/packages/babel-node/test/tmp
@@ -42,5 +57,6 @@ packages/babel-preset-env-standalone/babel-preset-env.js
packages/babel-preset-env-standalone/babel-preset-env.min.js
/codemods/*/lib
/codemods/*/node_modules
/packages/babylon/build
/packages/babel-parser/build
.idea/
/.changelog

View File

@@ -1 +1,5 @@
package.json
packages/babel-preset-env/data
packages/*/test/fixtures/**/input.*
packages/*/test/fixtures/**/exec.*
packages/*/test/fixtures/**/output.*

View File

@@ -7,7 +7,6 @@
"bracketSpacing": true,
"jsxBracketSameLine": false,
"tabWidth": 2,
"parser": "babylon",
"printWidth": 80,
"overrides": [{
"files": [
@@ -16,6 +15,7 @@
"**/packages/*/src/**/*.js",
"**/packages/*/test/**/*.js"
],
"parser": "babylon",
"options": {
"trailingComma": "all"
}

View File

@@ -1,46 +1,49 @@
git:
depth: 10
sudo: false
depth: 5
language: node_js
cache:
yarn: true
directories:
- node_modules
node_js:
# We test the latest version on circleci
- '8'
- '6'
- '4'
os: linux
env:
global:
- PATH=$HOME/.yarn/bin:$PATH
- JOB=test
before_install:
- curl -o- -L https://yarnpkg.com/install.sh | bash
install: yarn --ignore-engines
install: skip
before_script:
- 'if [ "$JOB" = "babylon-flow-tests" ]; then make bootstrap-flow; fi'
- 'if [ "$JOB" = "babylon-test262-tests" ]; then make bootstrap-test262; fi'
- curl -o- -L https://yarnpkg.com/install.sh | bash
- if [ "$TRAVIS_OS_NAME" = "windows" ]; then choco install make; fi
script:
- 'if [ "$JOB" = "test" ]; then make test-ci; fi'
- 'if [ "$JOB" = "lint" ]; then make lint && make flow; fi'
- 'if [ "$JOB" = "babylon-flow-tests" ]; then make test-flow-ci; fi'
- 'if [ "$JOB" = "babylon-test262-tests" ]; then make test-test262-ci; fi'
- if [ "$JOB" = "test" ]; then make -j test-ci; fi
- if [ "$JOB" = "lint" ]; then make -j code-quality-ci; fi
- if [ "$JOB" = "babel-parser-flow-tests" ]; then make -j test-flow-ci; fi
- if [ "$JOB" = "babel-parser-test262-tests" ]; then make -j test-test262-ci; fi
matrix:
fast_finish: true
include:
- node_js: "node"
env: JOB=lint
# We test the latest version on circleci
- node_js: "12"
# Move `windows` build to be the third since it is slow
- os: windows
node_js: "node"
env:
- JOB=test
# https://travis-ci.community/t/build-doesnt-finish-after-completing-tests/288/9
- YARN_GPG=no
# Continue node_js matrix
- node_js: "6"
- node_js: "10"
- node_js: "8"
- node_js: "node"
env: JOB=babylon-flow-tests
env: JOB=babel-parser-flow-tests
- node_js: "node"
env: JOB=babylon-test262-tests
env: JOB=babel-parser-test262-tests
notifications:
slack:

File diff suppressed because it is too large Load Diff

View File

@@ -3,7 +3,7 @@
## Our Pledge
In the interest of fostering an open and welcoming environment, we as
contributors and maintainers pledge to making participation in our project and
contributors and maintainers pledge to make participation in our project and
our community a harassment-free experience for everyone, regardless of age, body
size, disability, ethnicity, gender identity and expression, level of experience,
nationality, personal appearance, race, religion, or sexual identity and
@@ -55,7 +55,7 @@ further defined and clarified by project maintainers.
## Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting hzoo, thejameskyle, sebastian, or loganfsmyth 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
is deemed necessary and appropriate to the circumstances. The project team is
obligated to maintain confidentiality with regard to the reporter of an incident.

View File

@@ -24,23 +24,25 @@ contributing, please read the
## Not sure where to start?
- If you aren't just making a documentation change, you'll probably want to learn a bit about a few topics.
- [ASTs](https://en.wikipedia.org/wiki/Abstract_syntax_tree) (Abstract Syntax Tree): The Babel AST [spec](https://github.com/babel/babel/blob/master/packages/babylon/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/babylon#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 [the Babel Plugin Handbook](https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#babel-plugin-handbook) - core plugins are written the same way as any other plugin!
- Check out [AST Explorer](http://astexplorer.net/#/scUfOmVOG5) to learn more about ASTs or make your own plugin in the browser
- When you feel ready to jump into the Babel source code, a good place to start is to look for issues tagged with [help wanted](https://github.com/babel/babel/labels/help%20wanted) and/or [good first issue](https://github.com/babel/babel/labels/good%20first%20issue).
- Follow along with what we are working on by joining our Slack, following our announcements on [Twitter](https://twitter.com/babeljs), and reading (or participating!) in our [meeting notes](https://github.com/babel/notes).
- 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).
- Check out our [website](http://babeljs.io/) and the [repo](https://github.com/babel/website)
- You can contribute by triaging issues which may include reproducing bug reports or asking for vital information, such as version numbers or reproduction instructions. If you would like to start triaging issues, one easy way to get started is to [subscribe to babel on CodeTriage](https://www.codetriage.com/babel/babel). [![Open Source Helpers](https://www.codetriage.com/babel/babel/badges/users.svg)](https://www.codetriage.com/babel/babel)
## Chat
Feel free to check out the `#discussion`/`#development` channels on our [Slack](https://slack.babeljs.io). Some of us are always online to chat!
Feel free to check out the `#discussion`/`#development` channels on our [Slack](https://slack.babeljs.io) (you can sign-up [here](https://slack.babeljs.io/) for an invite). Some of us are always online to chat!
## Developing
**Note:** Versions `< 5.1.10` can't be built.
Babel is built for Node 4 and up but we develop using Node 8 and yarn. You can check this with `node -v`.
Babel is built for Node 6 and up but we develop using Node 8 and yarn. You can check this with `node -v`.
Make sure that Yarn is installed with version >= `0.28.0`.
Installation instructions can be found here: https://yarnpkg.com/en/docs/install.
@@ -139,6 +141,12 @@ $ TEST_DEBUG=true make test
You can combine `TEST_DEBUG` with `TEST_GREP` or `TEST_ONLY` to debug a subset of tests. If you plan to stay long in the debugger (which you'll likely do!), you may increase the test timeout by editing [test/mocha.opts](https://github.com/babel/babel/blob/master/test/mocha.opts).
To overwrite any test fixtures when fixing a bug or anything, add the env variable `OVERWRITE=true`
```sh
$ OVERWRITE=true TEST_ONLY=babel-plugin-transform-classes make test-only
```
To test the code coverage, use:
```sh
@@ -179,7 +187,7 @@ For example, in [`@babel/plugin-transform-exponentiation-operator/test`](https:/
- If you need to expect an error, you can ignore creating the `output.js` file and pass a new `throws` key to the `options.json` that contains the error string that is created.
- The second and preferred type is a test that actually evaluates the produced code and asserts that certain properties are true or false. We do this by creating an [`exec.js`](https://github.com/babel/babel/blob/master/packages/babel-plugin-transform-exponentiation-operator/test/fixtures/exponentian-operator/comprehensive/exec.js) file.
In a fixture test, you simply write out the code you want transformed in `input.js`.
In a fixture test, you simply write out the code you want to transform in `input.js`.
```js
// input.js
@@ -196,8 +204,8 @@ In an `exec.js` test, we run or check that the code actually does what it's supp
```js
// exec.js
assert.equal(8, 2 ** 3);
assert.equal(24, 3 * 2 ** 3);
expect(2 ** 3).toBe(8);
expect(3 * 2 ** 3).toBe(24);
```
If you need to check for an error that is thrown you can add to the `options.json`
@@ -219,19 +227,19 @@ If the test requires a minimum Node version, you can add `minNodeVersion` (must
}
```
#### `babylon`
#### `@babel/parser` (babylon)
Writing tests for Babylon is very
Writing tests for the babel parser is very
similar to the other packages.
Inside the `packages/babylon/tests/fixtures` folder are categories/groupings of test fixtures (es2015, flow,
Inside the `packages/babel-parser/test/fixtures` folder are categories/groupings of test fixtures (es2015, flow,
etc.). To add a test, create a folder under one of these groupings (or create a new one) with a
descriptive name, and add the following:
* Create an `input.js` file that contains the code you want Babylon to parse.
* Create an `input.js` file that contains the code you want the babel parser to parse.
* Add an `output.json` file with the expected parser output. For added convenience, if there is no `output.json` present, the test runner will generate one for you.
After writing tests for babylon, just build it by running:
After writing tests for @babel/parser, just build it by running:
```sh
$ make build
@@ -240,17 +248,17 @@ $ make build
Then, to run the tests, use:
```sh
$ TEST_ONLY=babylon make test-only
$ TEST_ONLY=babel-parser make test-only
```
#### Bootstrapping expected output
For both `@babel/plugin-x` and `babylon`, you can easily generate an `output.js`/`output.json` automatically by just providing `input.js` and running the tests as you usually would.
For both `@babel/plugin-x` and `@babel/parser`, you can easily generate an `output.js`/`output.json` automatically by just providing `input.js` and running the tests as you usually would.
```
// Example
- packages
- babylon
- babel-parser
- test
- fixtures
- comments
@@ -302,14 +310,14 @@ 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.
- The pull request should include:
- [ ] An update to the [plugins](https://github.com/babel/babel/tree/master/packages/babylon#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/babylon/ast/spec.md)
- [ ] Make sure you use the `this.hasPlugin("plugin-name-here")` check in Babylon so that your new plugin code only runs when that flag is turned on (not default behavior)
- [ ] 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)
- [ ] 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
- Start working about the Babel transform itself!
## Internals
- AST spec ([babylon/ast/spec.md](https://github.com/babel/babel/blob/master/packages/babylon/ast/spec.md))
- AST spec ([babel-parser/ast/spec.md](https://github.com/babel/babel/blob/master/packages/babel-parser/ast/spec.md))
- Versioning ([doc/design/versioning.md](https://github.com/babel/babel/blob/master/doc/design/versioning.md))
- Monorepo ([doc/design/monorepo.md](https://github.com/babel/babel/blob/master/doc/design/monorepo.md))
- Compiler environment support ([doc/design/compiler-environment-support.md](https://github.com/babel/babel/blob/master/doc/design/compiler-environment-support.md))

View File

@@ -5,44 +5,33 @@ const through = require("through2");
const chalk = require("chalk");
const newer = require("gulp-newer");
const babel = require("gulp-babel");
const watch = require("gulp-watch");
const gutil = require("gulp-util");
const gulpWatch = require("gulp-watch");
const fancyLog = require("fancy-log");
const filter = require("gulp-filter");
const gulp = require("gulp");
const path = require("path");
const webpack = require("webpack");
const merge = require("merge-stream");
const rollup = require("rollup-stream");
const source = require("vinyl-source-stream");
const buffer = require("vinyl-buffer");
const rollup = require("rollup");
const rollupBabel = require("rollup-plugin-babel");
const rollupNodeResolve = require("rollup-plugin-node-resolve");
const registerStandalonePackageTask = require("./scripts/gulp-tasks")
.registerStandalonePackageTask;
const rollupReplace = require("rollup-plugin-replace");
const { registerStandalonePackageTask } = require("./scripts/gulp-tasks");
const sources = ["codemods", "packages"];
const defaultSourcesGlob = "./@(codemods|packages)/*/src/**/*.js";
function swapSrcWithLib(srcPath) {
const parts = srcPath.split(path.sep);
parts[1] = "lib";
parts[2] = "lib";
return parts.join(path.sep);
}
function getGlobFromSource(source) {
return `./${source}/*/src/**/*.js`;
}
function getIndexFromPackage(name) {
return `${name}/src/index.js`;
}
function compilationLogger(rollup) {
function compilationLogger() {
return through.obj(function(file, enc, callback) {
gutil.log(
`Compiling '${chalk.cyan(file.relative)}'${
rollup ? " with rollup " : ""
}...`
);
fancyLog(`Compiling '${chalk.cyan(file.relative)}'...`);
callback(null, file);
});
}
@@ -50,7 +39,7 @@ function compilationLogger(rollup) {
function errorsLogger() {
return plumber({
errorHandler(err) {
gutil.log(err.stack);
fancyLog(err.stack);
},
});
}
@@ -62,79 +51,90 @@ function rename(fn) {
});
}
function buildBabel(exclude) {
return merge(
sources.map(source => {
const base = path.join(__dirname, source);
function buildBabel(exclude, sourcesGlob = defaultSourcesGlob) {
const base = __dirname;
let stream = gulp.src(getGlobFromSource(source), { base: base });
let stream = gulp.src(sourcesGlob, { base: __dirname });
if (exclude) {
const filters = exclude.map(p => `!**/${p}/**`);
filters.unshift("**");
stream = stream.pipe(filter(filters));
}
if (exclude) {
const filters = exclude.map(p => `!**/${p}/**`);
filters.unshift("**");
stream = stream.pipe(filter(filters));
}
return stream
.pipe(errorsLogger())
.pipe(newer({ dest: base, map: swapSrcWithLib }))
.pipe(compilationLogger())
.pipe(babel())
.pipe(
// Passing 'file.relative' because newer() above uses a relative
// path and this keeps it consistent.
rename(file => path.resolve(file.base, swapSrcWithLib(file.relative)))
)
.pipe(gulp.dest(base));
})
);
return stream
.pipe(errorsLogger())
.pipe(newer({ dest: base, map: swapSrcWithLib }))
.pipe(compilationLogger())
.pipe(babel())
.pipe(
// Passing 'file.relative' because newer() above uses a relative
// path and this keeps it consistent.
rename(file => path.resolve(file.base, swapSrcWithLib(file.relative)))
)
.pipe(gulp.dest(base));
}
function buildRollup(packages) {
return merge(
return Promise.all(
packages.map(pkg => {
return rollup({
input: getIndexFromPackage(pkg),
format: "cjs",
plugins: [
rollupBabel({
babelrc: false,
extends: "./.babelrc.rollup.js",
}),
rollupNodeResolve(),
],
})
.pipe(source("index.js"))
.pipe(buffer())
.pipe(errorsLogger())
.pipe(compilationLogger(/* rollup */ true))
.pipe(gulp.dest(path.join(pkg, "lib")));
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",
});
});
})
);
}
gulp.task("default", ["build"]);
const bundles = ["packages/babel-parser"];
gulp.task("build", function() {
const bundles = ["packages/babylon"];
gulp.task("build-rollup", () => buildRollup(bundles));
gulp.task("build-babel", () => buildBabel(/* exclude */ bundles));
gulp.task("build-babel-types", () =>
buildBabel(/* exclude */ bundles, "packages/babel-types/src/**/*.js")
);
gulp.task("build", gulp.parallel("build-rollup", "build-babel"));
return merge([buildBabel(/* exclude */ bundles), buildRollup(bundles)]);
});
gulp.task("default", gulp.series("build"));
gulp.task("build-no-bundle", () => buildBabel());
gulp.task("watch", ["build-no-bundle"], function() {
watch(sources.map(getGlobFromSource), { debounceDelay: 200 }, function() {
gulp.start("build-no-bundle");
});
});
gulp.task(
"watch",
gulp.series("build-no-bundle", function watch() {
gulpWatch(
defaultSourcesGlob,
{ debounceDelay: 200 },
gulp.task("build-no-bundle")
);
})
);
registerStandalonePackageTask(
gulp,
"babel",
"Babel",
path.join(__dirname, "packages"),
require("./packages/babel-core/package.json").version
require("./packages/babel-standalone/package.json").version
);
const presetEnvWebpackPlugins = [
@@ -163,6 +163,6 @@ registerStandalonePackageTask(
"babel-preset-env",
"babelPresetEnv",
path.join(__dirname, "packages"),
require("./packages/babel-preset-env/package.json").version,
require("./packages/babel-preset-env-standalone/package.json").version,
presetEnvWebpackPlugins
);

View File

@@ -1,6 +1,6 @@
MIT License
Copyright (c) 2014-2018 Sebastian McKenzie <sebmck@gmail.com>
Copyright (c) 2014-present Sebastian McKenzie and other contributors
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the

242
Makefile
View File

@@ -1,8 +1,5 @@
MAKEFLAGS = -j1
FLOW_COMMIT = 622bbc4f07acb77eb1109830c70815f827401d90
TEST262_COMMIT = 52f70e2f637731aae92a9c9a2d831310c3ab2e1e
export NODE_ENV = test
FLOW_COMMIT = 09669846b7a7ca5a6c23c12d56bb3bebdafd67e9
TEST262_COMMIT = 8688c4ab79059c3097098605e69f1ee5eda6c409
# Fix color output until TravisCI fixes https://github.com/travis-ci/travis-ci/issues/7967
export FORCE_COLOR = true
@@ -11,56 +8,113 @@ SOURCES = packages codemods
.PHONY: build build-dist watch lint fix clean test-clean test-only test test-ci publish bootstrap
build: clean
make 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
# generate docs
node scripts/generators/docs.js > ./packages/babel-types/README.md
ifneq ("$(BABEL_ENV)", "cov")
make build-standalone
make build-preset-env-standalone
build: build-bundle
ifneq ("$(BABEL_COVERAGE)", "true")
$(MAKE) build-standalone
endif
build-standalone:
./node_modules/.bin/gulp build-babel-standalone
build-bundle: clean clean-lib
yarn gulp build
$(MAKE) generate-standalone generate-type-helpers
# call build again as the generated files might need to be compiled again.
yarn gulp build
$(MAKE) build-typings
$(MAKE) build-dist
build-bundle-ci: bootstrap-only
$(MAKE) build-bundle
generate-standalone:
node packages/babel-standalone/scripts/generate.js
generate-type-helpers:
node packages/babel-types/scripts/generateTypeHelpers.js
build-typings: build-flow-typings build-typescript-typings
build-flow-typings:
node packages/babel-types/scripts/generators/flow.js > packages/babel-types/lib/index.js.flow
build-typescript-typings:
node packages/babel-types/scripts/generators/typescript.js > packages/babel-types/lib/index.d.ts
build-standalone: build-babel-standalone build-preset-env-standalone
build-standalone-ci: build-bundle-ci
$(MAKE) build-standalone
build-babel-standalone:
yarn gulp build-babel-standalone
build-preset-env-standalone:
./node_modules/.bin/gulp build-babel-preset-env-standalone
yarn gulp build-babel-preset-env-standalone
build-dist: build
prepublish-build-standalone:
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; \
scripts/build-dist.sh
cd packages/babel-runtime; \
build-plugin-transform-runtime-dist:
cd packages/babel-plugin-transform-runtime; \
node scripts/build-dist.js
watch: clean
make clean-lib
build-no-bundle: clean clean-lib
BABEL_ENV=development yarn gulp build-no-bundle
# Ensure that build artifacts for types are created during local
# development too.
BABEL_ENV=development ./node_modules/.bin/gulp build-no-bundle
node ./packages/babel-types/scripts/generateTypeHelpers.js
node scripts/generators/flow.js > ./packages/babel-types/lib/index.js.flow
BABEL_ENV=development ./node_modules/.bin/gulp watch
$(MAKE) generate-type-helpers
$(MAKE) build-typings
watch: build-no-bundle
BABEL_ENV=development yarn gulp watch
code-quality-ci: flowcheck-ci lint-ci
flowcheck-ci: bootstrap-flowcheck
$(MAKE) flow
code-quality: flow lint
flow:
./node_modules/.bin/flow check --strip-root
yarn flow check --strip-root
lint:
./node_modules/.bin/eslint scripts $(SOURCES) '*.js' '**/.*.js' --format=codeframe --rulesdir="./scripts/eslint_rules"
bootstrap-flowcheck: bootstrap-only
yarn gulp build-babel-types
$(MAKE) build-typings
fix:
# The config is hardcoded because otherwise prettier searches for it and also picks up some broken package.json files from tests
./node_modules/.bin/prettier --config .prettierrc --write --ignore-path .eslintignore '**/*.json'
./node_modules/.bin/eslint scripts $(SOURCES) '*.js' '**/.*.js' --format=codeframe --fix --rulesdir="./scripts/eslint_rules"
lint-ci: lint-js-ci lint-ts-ci
lint-js-ci: bootstrap-only
$(MAKE) lint-js
lint-ts-ci: bootstrap-flowcheck
$(MAKE) lint-ts
lint: lint-js lint-ts
lint-js:
yarn eslint scripts $(SOURCES) '*.js' --format=codeframe
lint-ts:
scripts/tests/typescript/lint.sh
fix: fix-json fix-js
fix-js:
yarn eslint scripts $(SOURCES) '*.js' --format=codeframe --fix
fix-json:
yarn prettier "{packages,codemod}/*/test/fixtures/**/options.json" --write --loglevel warn
clean: test-clean
rm -f .npmrc
rm -rf packages/babel-polyfill/browser*
rm -rf packages/babel-polyfill/dist
rm -rf coverage
@@ -70,86 +124,118 @@ test-clean:
$(foreach source, $(SOURCES), \
$(call clean-source-test, $(source)))
# Does not work on Windows; use "yarn jest" instead
test-only:
./scripts/test.sh
make test-clean
BABEL_ENV=test ./scripts/test.sh
$(MAKE) test-clean
test: lint test-only
test-ci:
make bootstrap
make test-only
test-ci: jest-ci
jest-ci: build-standalone-ci
BABEL_ENV=test yarn jest --maxWorkers=4 --ci
$(MAKE) test-clean
# Does not work on Windows
test-ci-coverage: SHELL:=/bin/bash
test-ci-coverage:
BABEL_ENV=cov make bootstrap
TEST_TYPE=cov ./scripts/test-cov.sh
BABEL_COVERAGE=true BABEL_ENV=test $(MAKE) bootstrap
BABEL_ENV=test TEST_TYPE=cov ./scripts/test-cov.sh
bash <(curl -s https://codecov.io/bash) -f coverage/coverage-final.json
bootstrap-flow:
rm -rf ./build/flow
mkdir -p ./build
git clone --branch=master --single-branch --shallow-since=2017-01-01 https://github.com/facebook/flow.git ./build/flow
rm -rf build/flow
mkdir -p build
git clone --branch=master --single-branch --shallow-since=2018-11-01 https://github.com/facebook/flow.git build/flow
cd build/flow && git checkout $(FLOW_COMMIT)
test-flow:
node scripts/tests/flow/run_babylon_flow_tests.js
node scripts/tests/flow/run_babel_parser_flow_tests.js
test-flow-ci:
make bootstrap
make test-flow
test-flow-ci: build-bundle-ci bootstrap-flow
$(MAKE) test-flow
test-flow-update-whitelist:
node scripts/tests/flow/run_babylon_flow_tests.js --update-whitelist
node scripts/tests/flow/run_babel_parser_flow_tests.js --update-whitelist
bootstrap-test262:
rm -rf ./build/test262
mkdir -p ./build
git clone --branch=master --single-branch --shallow-since=2017-01-01 https://github.com/tc39/test262.git ./build/test262
rm -rf build/test262
mkdir -p build
git clone --branch=master --single-branch --shallow-since=2019-09-01 https://github.com/tc39/test262.git build/test262
cd build/test262 && git checkout $(TEST262_COMMIT)
test-test262:
node scripts/tests/test262/run_babylon_test262.js
node scripts/tests/test262/run_babel_parser_test262.js
test-test262-ci:
make bootstrap
make test-test262
test-test262-ci: build-bundle-ci bootstrap-test262
$(MAKE) test-test262
test-test262-update-whitelist:
node scripts/tests/test262/run_babylon_test262.js --update-whitelist
node scripts/tests/test262/run_babel_parser_test262.js --update-whitelist
publish:
# Does not work on Windows
clone-license:
./scripts/clone-license.sh
prepublish-build: clean-lib clean-runtime-helpers
NODE_ENV=production BABEL_ENV=production $(MAKE) build
$(MAKE) clone-license
prepublish:
$(MAKE) bootstrap-only
$(MAKE) prepublish-build
$(MAKE) test
new-version:
git pull --rebase
make clean-lib
rm -rf packages/babel-runtime/helpers
rm -rf packages/babel-runtime/core-js
BABEL_ENV=production make build-dist
make test
# not using lerna independent mode atm, so only update packages that have changed since we use ^
# --only-explicit-updates
./node_modules/.bin/lerna publish --force-publish=* --exact --skip-temp-tag
make clean
yarn lerna version --force-publish="@babel/runtime,@babel/runtime-corejs2,@babel/runtime-corejs3,@babel/standalone,@babel/preset-env-standalone"
bootstrap:
make clean-all
# NOTE: Run make new-version first
publish: prepublish
yarn lerna publish from-git
$(MAKE) clean
publish-ci: prepublish
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
./node_modules/.bin/lerna bootstrap -- --ignore-engines
make build
cd packages/babel-runtime; \
node scripts/build-dist.js
lerna-bootstrap: yarn-install
yarn lerna bootstrap
bootstrap: bootstrap-only
$(MAKE) build
clean-lib:
$(foreach source, $(SOURCES), \
$(call clean-source-lib, $(source)))
clean-runtime-helpers:
rm -rf packages/babel-runtime/helpers
rm -rf packages/babel-runtime-corejs2/helpers
rm -rf packages/babel-runtime-corejs2/core-js
clean-all:
rm -rf node_modules
rm -rf package-lock.json
rm -rf .changelog
$(foreach source, $(SOURCES), \
$(call clean-source-all, $(source)))
make clean
$(MAKE) clean
define clean-source-lib
rm -rf $(1)/*/lib

134
README.md
View File

@@ -9,11 +9,15 @@
</p>
<p align="center">
<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="v7 npm Downloads" src="https://img.shields.io/npm/dm/@babel/core.svg?maxAge=43200&label=v7%20downloads"></a>
<a href="https://www.npmjs.com/package/babel-core"><img alt="v6 npm Downloads" src="https://img.shields.io/npm/dm/babel-core.svg?maxAge=43200&label=v6%20downloads"></a>
</p>
<p align="center">
<a href="https://travis-ci.com/babel/babel"><img alt="Travis Status" src="https://img.shields.io/travis/com/babel/babel/master.svg?label=travis&maxAge=43200"></a>
<a href="https://circleci.com/gh/babel/babel"><img alt="CircleCI Status" src="https://img.shields.io/circleci/project/github/babel/babel/master.svg?label=circle&maxAge=43200"></a>
<a href="https://codecov.io/github/babel/babel"><img alt="Coverage Status" src="https://img.shields.io/codecov/c/github/babel/babel/master.svg?maxAge=43200"></a>
<a href="https://slack.babeljs.io/"><img alt="Slack Status" src="https://slack.babeljs.io/badge.svg"></a>
<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>
<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>
</p>
<h2 align="center">Supporting Babel</h2>
@@ -24,10 +28,30 @@
<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>
Babel is community-driven and thus mostly maintained by a group of [volunteers](https://babeljs.io/team). It has a lot of [companies and projects](https://babeljs.io/users) using it but almost no sponsors/people funded to work on it. If you'd like to help maintain 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/))
- [Giving funds by becoming a backer/sponsor on OpenCollective](https://opencollective.com/babel)
- 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)!
## Sponsors
Our top sponsors are shown below! [[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/1/website" target="_blank"><img src="https://opencollective.com/babel/sponsor/1/avatar.svg"></a>
<a href="https://opencollective.com/babel/sponsor/2/website" target="_blank"><img src="https://opencollective.com/babel/sponsor/2/avatar.svg"></a>
<a href="https://opencollective.com/babel/sponsor/3/website" target="_blank"><img src="https://opencollective.com/babel/sponsor/3/avatar.svg"></a>
<a href="https://opencollective.com/babel/sponsor/4/website" target="_blank"><img src="https://opencollective.com/babel/sponsor/4/avatar.svg"></a>
<a href="https://opencollective.com/babel/sponsor/5/website" target="_blank"><img src="https://opencollective.com/babel/sponsor/5/avatar.svg"></a>
<a href="https://opencollective.com/babel/sponsor/6/website" target="_blank"><img src="https://opencollective.com/babel/sponsor/6/avatar.svg"></a>
<a href="https://opencollective.com/babel/sponsor/7/website" target="_blank"><img src="https://opencollective.com/babel/sponsor/7/avatar.svg"></a>
<a href="https://opencollective.com/babel/sponsor/8/website" target="_blank"><img src="https://opencollective.com/babel/sponsor/8/avatar.svg"></a>
<a href="https://opencollective.com/babel/sponsor/9/website" target="_blank"><img src="https://opencollective.com/babel/sponsor/9/avatar.svg"></a>
<a href="https://opencollective.com/babel/sponsor/10/website" target="_blank"><img src="https://opencollective.com/babel/sponsor/10/avatar.svg"></a>
<a href="https://opencollective.com/babel/sponsor/11/website" target="_blank"><img src="https://opencollective.com/babel/sponsor/11/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/14/website" target="_blank"><img src="https://opencollective.com/babel/sponsor/14/avatar.svg"></a>
## Intro
@@ -50,24 +74,19 @@ Babel is a tool that helps you write code in the latest version of JavaScript. W
Try it out at our [REPL](https://babeljs.io/repl/build/master#?code_lz=NoRgNATGDMC6B0BbAhgBwBQDsAEBeAfNjgNTYgCUA3EA&lineWrap=true&presets=es2015%2Ces2016%2Ces2017&version=7.0.0-beta.2).
- [FAQ](#faq)
- [Backers](#backers)
- [Sponsors](#sponsors)
- [License](#license)
## FAQ
### Who maintains Babel?
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/), ask a question on [Stack Overflow](https://stackoverflow.com/questions/tagged/babeljs), or ping us on [Twitter](https://twitter.com/babeljs).
Mostly a handful of volunteers, funded by you! Please check out our [team page](https://babeljs.io/team)!
### 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). 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?
@@ -79,87 +98,24 @@ Please read through our [CONTRIBUTING.md](CONTRIBUTING.md) and fill out the issu
### Want to contribute to Babel?
Check out our [CONTRIBUTING.md](CONTRIBUTING.md) to get started with setting up the repo.
Check out:
- If you have already joined Slack, join our [#development](https://babeljs.slack.com/messages/development) channel and say hi!
- Check out the issues with the [good first issue](https://github.com/babel/babel/labels/good%20first%20issue) and [help wanted](https://github.com/babel/babel/labels/help%20wanted) label. We suggest also looking at the closed ones to get a sense of the kinds of issues you can tackle.
- Our [#development](https://babeljs.slack.com/messages/development) Slack channel and say hi ([signup](https://slack.babeljs.io))!
- Issues with the [good first issue](https://github.com/babel/babel/labels/good%20first%20issue) and [help wanted](https://github.com/babel/babel/labels/help%20wanted) label. We suggest also looking at the [closed ones](https://github.com/babel/babel/issues?utf8=%E2%9C%93&q=is%3Aclosed+label%3A%22good+first+issue%22) to get a sense of the kinds of issues you can tackle.
Some resources:
- Our [CONTRIBUTING.md](CONTRIBUTING.md) to get started with setting up the repo.
- Our discussions/notes/roadmap: [babel/notes](https://github.com/babel/notes)
- Our progress on TC39 proposals: [babel/proposals](https://github.com/babel/proposals)
- Our blog which contains release posts and 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?
The Babel repo is managed as a [monorepo](doc/design/monorepo.md) that is composed of many [npm packages](packages/README.md).
## Backers
Support us with a monthly donation and help us continue our activities. [[Become a backer](https://opencollective.com/babel#backer)]
<a href="https://opencollective.com/babel/backer/0/website" target="_blank"><img src="https://opencollective.com/babel/backer/0/avatar.svg"></a>
<a href="https://opencollective.com/babel/backer/1/website" target="_blank"><img src="https://opencollective.com/babel/backer/1/avatar.svg"></a>
<a href="https://opencollective.com/babel/backer/2/website" target="_blank"><img src="https://opencollective.com/babel/backer/2/avatar.svg"></a>
<a href="https://opencollective.com/babel/backer/3/website" target="_blank"><img src="https://opencollective.com/babel/backer/3/avatar.svg"></a>
<a href="https://opencollective.com/babel/backer/4/website" target="_blank"><img src="https://opencollective.com/babel/backer/4/avatar.svg"></a>
<a href="https://opencollective.com/babel/backer/5/website" target="_blank"><img src="https://opencollective.com/babel/backer/5/avatar.svg"></a>
<a href="https://opencollective.com/babel/backer/6/website" target="_blank"><img src="https://opencollective.com/babel/backer/6/avatar.svg"></a>
<a href="https://opencollective.com/babel/backer/7/website" target="_blank"><img src="https://opencollective.com/babel/backer/7/avatar.svg"></a>
<a href="https://opencollective.com/babel/backer/8/website" target="_blank"><img src="https://opencollective.com/babel/backer/8/avatar.svg"></a>
<a href="https://opencollective.com/babel/backer/9/website" target="_blank"><img src="https://opencollective.com/babel/backer/9/avatar.svg"></a>
<a href="https://opencollective.com/babel/backer/10/website" target="_blank"><img src="https://opencollective.com/babel/backer/10/avatar.svg"></a>
<a href="https://opencollective.com/babel/backer/11/website" target="_blank"><img src="https://opencollective.com/babel/backer/11/avatar.svg"></a>
<a href="https://opencollective.com/babel/backer/12/website" target="_blank"><img src="https://opencollective.com/babel/backer/12/avatar.svg"></a>
<a href="https://opencollective.com/babel/backer/13/website" target="_blank"><img src="https://opencollective.com/babel/backer/13/avatar.svg"></a>
<a href="https://opencollective.com/babel/backer/14/website" target="_blank"><img src="https://opencollective.com/babel/backer/14/avatar.svg"></a>
<a href="https://opencollective.com/babel/backer/15/website" target="_blank"><img src="https://opencollective.com/babel/backer/15/avatar.svg"></a>
<a href="https://opencollective.com/babel/backer/16/website" target="_blank"><img src="https://opencollective.com/babel/backer/16/avatar.svg"></a>
<a href="https://opencollective.com/babel/backer/17/website" target="_blank"><img src="https://opencollective.com/babel/backer/17/avatar.svg"></a>
<a href="https://opencollective.com/babel/backer/18/website" target="_blank"><img src="https://opencollective.com/babel/backer/18/avatar.svg"></a>
<a href="https://opencollective.com/babel/backer/19/website" target="_blank"><img src="https://opencollective.com/babel/backer/19/avatar.svg"></a>
<a href="https://opencollective.com/babel/backer/20/website" target="_blank"><img src="https://opencollective.com/babel/backer/20/avatar.svg"></a>
<a href="https://opencollective.com/babel/backer/21/website" target="_blank"><img src="https://opencollective.com/babel/backer/21/avatar.svg"></a>
<a href="https://opencollective.com/babel/backer/22/website" target="_blank"><img src="https://opencollective.com/babel/backer/22/avatar.svg"></a>
<a href="https://opencollective.com/babel/backer/23/website" target="_blank"><img src="https://opencollective.com/babel/backer/23/avatar.svg"></a>
<a href="https://opencollective.com/babel/backer/24/website" target="_blank"><img src="https://opencollective.com/babel/backer/24/avatar.svg"></a>
<a href="https://opencollective.com/babel/backer/25/website" target="_blank"><img src="https://opencollective.com/babel/backer/25/avatar.svg"></a>
<a href="https://opencollective.com/babel/backer/26/website" target="_blank"><img src="https://opencollective.com/babel/backer/26/avatar.svg"></a>
<a href="https://opencollective.com/babel/backer/27/website" target="_blank"><img src="https://opencollective.com/babel/backer/27/avatar.svg"></a>
<a href="https://opencollective.com/babel/backer/28/website" target="_blank"><img src="https://opencollective.com/babel/backer/28/avatar.svg"></a>
<a href="https://opencollective.com/babel/backer/29/website" target="_blank"><img src="https://opencollective.com/babel/backer/29/avatar.svg"></a>
## 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)]
<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/2/website" target="_blank"><img src="https://opencollective.com/babel/sponsor/2/avatar.svg"></a>
<a href="https://opencollective.com/babel/sponsor/3/website" target="_blank"><img src="https://opencollective.com/babel/sponsor/3/avatar.svg"></a>
<a href="https://opencollective.com/babel/sponsor/4/website" target="_blank"><img src="https://opencollective.com/babel/sponsor/4/avatar.svg"></a>
<a href="https://opencollective.com/babel/sponsor/5/website" target="_blank"><img src="https://opencollective.com/babel/sponsor/5/avatar.svg"></a>
<a href="https://opencollective.com/babel/sponsor/6/website" target="_blank"><img src="https://opencollective.com/babel/sponsor/6/avatar.svg"></a>
<a href="https://opencollective.com/babel/sponsor/7/website" target="_blank"><img src="https://opencollective.com/babel/sponsor/7/avatar.svg"></a>
<a href="https://opencollective.com/babel/sponsor/8/website" target="_blank"><img src="https://opencollective.com/babel/sponsor/8/avatar.svg"></a>
<a href="https://opencollective.com/babel/sponsor/9/website" target="_blank"><img src="https://opencollective.com/babel/sponsor/9/avatar.svg"></a>
<a href="https://opencollective.com/babel/sponsor/10/website" target="_blank"><img src="https://opencollective.com/babel/sponsor/10/avatar.svg"></a>
<a href="https://opencollective.com/babel/sponsor/11/website" target="_blank"><img src="https://opencollective.com/babel/sponsor/11/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/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>
## License
[MIT](LICENSE)

19
SECURITY.md Normal file
View File

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

25
SONG.md
View File

@@ -1,5 +1,7 @@
## Hallelujah—In Praise of Babel
➤ [🎶 Audio version here!](https://youtu.be/40abpedBKK8)
I heard there was a clever trick
That rewrote all your JavaScript
But you dont really care for magic, do you
@@ -17,7 +19,8 @@ Generators, const and let
I used them all without regret
And its a terse and a destructured Hallelujah
Hallelujah etc.
Hallelujah, Hallelujah
Hallelujah, Hallelujah
Well my faith was strong but I needed proof
The standard was my source of truth
@@ -26,7 +29,9 @@ So even though you werent impressed
I checked the build against the spec
And its a more-or-less compliant Hallelujah
Hallelujah etc.
Hallelujah, Hallelujah
Hallelujah, Hallelujah
Now you say the build steps too complex
And you claim no need for ES Next
@@ -35,7 +40,9 @@ But your code grows older with each line
Its a joyless dirge on a withered vine
Its a threnody for a bygone Hallelujah
Hallelujah etc.
Hallelujah, Hallelujah
Hallelujah, Hallelujah
Yes I learned about the danger signs
How theyd polyfilled a thousand lines
@@ -44,7 +51,9 @@ Still I disregarded common sense
Now my source is small but the builds immense
And its a slow and unresponsive Hallelujah
Hallelujah etc.
Hallelujah, Hallelujah
Hallelujah, Hallelujah
There was a time when they let me know
Whats really going on below
@@ -53,7 +62,9 @@ And debuggings not a progress march
Its a frenzied fumble in the dark
Its a labyrinthine search for Hallelujah
Hallelujah etc.
Hallelujah, Hallelujah
Hallelujah, Hallelujah
Well, maybe theres a god up there
But all I ever got from prayers
@@ -62,6 +73,8 @@ And that anguished cry you hear at night
Is the plugin I forgot to write
Its a cold and its a broken Hallelujah
Hallelujah etc.
Hallelujah, Hallelujah
Hallelujah, Hallelujah
[Angus Croll](https://github.com/angus-c)

140
babel.config.js Normal file
View File

@@ -0,0 +1,140 @@
"use strict";
module.exports = function(api) {
const env = api.env();
const includeCoverage = process.env.BABEL_COVERAGE === "true";
const envOptsNoTargets = {
loose: true,
modules: false,
exclude: ["transform-typeof-symbol"],
};
const envOpts = Object.assign({}, envOptsNoTargets);
let convertESM = true;
let ignoreLib = true;
let includeRuntime = false;
const nodeVersion = "6.9";
switch (env) {
// Configs used during bundling builds.
case "babel-parser":
convertESM = false;
ignoreLib = false;
envOpts.targets = {
node: nodeVersion,
};
break;
case "standalone":
convertESM = false;
ignoreLib = false;
includeRuntime = true;
break;
case "production":
// Config during builds before publish.
envOpts.targets = {
node: nodeVersion,
};
break;
case "development":
envOpts.debug = true;
envOpts.targets = {
node: "current",
};
break;
case "test":
envOpts.targets = {
node: "current",
};
break;
}
const config = {
// Our dependencies are all standard CommonJS, along with all sorts of
// other random files in Babel's codebase, so we use script as the default,
// and then mark actual modules as modules farther down.
sourceType: "script",
comments: false,
ignore: [
// These may not be strictly necessary with the newly-limited scope of
// babelrc searching, but including them for now because we had them
// in our .babelignore before.
"packages/*/test/fixtures",
ignoreLib ? "packages/*/lib" : null,
"packages/babel-standalone/babel.js",
"packages/babel-preset-env-standalone/babel-preset-env.js",
].filter(Boolean),
presets: [["@babel/env", envOpts]],
plugins: [
// TODO: Use @babel/preset-flow when
// https://github.com/babel/babel/issues/7233 is fixed
"@babel/plugin-transform-flow-strip-types",
["@babel/proposal-class-properties", { loose: true }],
"@babel/proposal-export-namespace-from",
"@babel/proposal-numeric-separator",
[
"@babel/proposal-object-rest-spread",
{ useBuiltIns: true, loose: true },
],
"@babel/plugin-proposal-optional-chaining",
"@babel/plugin-proposal-nullish-coalescing-operator",
convertESM ? "@babel/transform-modules-commonjs" : null,
].filter(Boolean),
overrides: [
{
test: "packages/babel-parser",
plugins: [
"babel-plugin-transform-charcodes",
["@babel/transform-for-of", { assumeArray: true }],
],
},
{
test: ["./packages/babel-cli", "./packages/babel-core"],
plugins: [
// Explicitly use the lazy version of CommonJS modules.
convertESM
? ["@babel/transform-modules-commonjs", { lazy: true }]
: null,
].filter(Boolean),
},
{
test: "./packages/babel-polyfill",
presets: [["@babel/env", envOptsNoTargets]],
},
{
// The vast majority of our src files are modules, but we use
// unambiguous to keep things simple until we get around to renaming
// the modules to be more easily distinguished from CommonJS
test: [
"packages/*/src",
"packages/*/test",
"codemods/*/src",
"codemods/*/test",
],
sourceType: "unambiguous",
},
{
// The runtime transform shouldn't process its own runtime or core-js.
exclude: [
"packages/babel-runtime",
/[\\/]node_modules[\\/](?:@babel\/runtime|babel-runtime|core-js)[\\/]/,
],
plugins: [
includeRuntime
? ["@babel/transform-runtime", { version: "7.4.4" }]
: null,
].filter(Boolean),
},
].filter(Boolean),
};
// we need to do this as long as we do not test everything from source
if (includeCoverage) {
config.auxiliaryCommentBefore = "istanbul ignore next";
config.plugins.push("babel-plugin-istanbul");
}
return config;
};

View File

@@ -8,3 +8,5 @@ coverage:
target: "80%"
patch:
enabled: false
ignore:
- packages/babel-types/src/*/generated/index.js

View File

@@ -0,0 +1,57 @@
# @babel/plugin-codemod-object-assign-to-object-spread
Transforms old code that uses `Object.assign` with an Object Literal as
the first param to use Object Spread syntax.
## Examples
```js
const obj = Object.assign({
test1: 1,
}, other, {
test2: 2,
}, other2);
```
Is transformed to:
```js
const obj = {
test1: 1,
...other,
test2: 2,
...other2,
};
```
## Installation
```sh
npm install --save-dev @babel/plugin-codemod-object-assign-to-object-spread
```
## Usage
### Via `.babelrc` (Recommended)
**.babelrc**
```jsonc
{
"plugins": ["@babel/plugin-codemod-object-assign-to-object-spread"]
}
```
### Via CLI
```sh
babel --plugins @babel/plugin-codemod-object-assign-to-object-spread script.js
```
### Via Node API
```javascript
require("@babel/core").transform("code", {
plugins: ["@babel/plugin-codemod-object-assign-to-object-spread"]
});
```

View File

@@ -0,0 +1,28 @@
{
"name": "@babel/plugin-codemod-object-assign-to-object-spread",
"version": "7.0.0",
"description": "Transforms Object.assign into object spread syntax",
"repository": "https://github.com/babel/babel/tree/master/codemods/babel-plugin-codemod-object-assign-to-object-spread",
"license": "MIT",
"publishConfig": {
"access": "public"
},
"main": "lib/index.js",
"keywords": [
"@babel/codemod",
"@babel/plugin"
],
"dependencies": {
"@babel/plugin-syntax-object-rest-spread": "^7.0.0"
},
"peerDependencies": {
"@babel/core": "^7.0.0-0"
},
"devDependencies": {
"@babel/core": "^7.0.0",
"@babel/helper-plugin-test-runner": "^7.0.0"
},
"publishConfig": {
"access": "public"
}
}

View File

@@ -0,0 +1,35 @@
import syntaxObjectRestSpread from "@babel/plugin-syntax-object-rest-spread";
export default function({ types: t }) {
return {
inherits: syntaxObjectRestSpread,
visitor: {
CallExpression(path) {
if (!path.get("callee").matchesPattern("Object.assign")) return;
const args = path.get("arguments");
if (args.length === 0) return;
const [objPath] = args;
if (!objPath.isObjectExpression()) return;
const obj = objPath.node;
const { properties } = obj;
for (let i = 1; i < args.length; i++) {
const arg = args[i];
const { node } = arg;
if (arg.isObjectExpression()) {
properties.push(...node.properties);
} else {
properties.push(t.spreadElement(node));
}
}
path.replaceWith(obj);
},
},
};
}

View File

@@ -0,0 +1 @@
Object.assign({test: 1}, test2, {test: 2}, test3);

View File

@@ -0,0 +1,3 @@
{
"plugins": ["../../../../lib"]
}

View File

@@ -0,0 +1,6 @@
({
test: 1,
...test2,
test: 2,
...test3
});

View File

@@ -0,0 +1,3 @@
{
"plugins": ["../../../../lib"]
}

View File

@@ -34,7 +34,7 @@ npm install --save-dev @babel/plugin-codemod-optional-catch-binding
**.babelrc**
```json
```jsonc
{
"plugins": ["@babel/plugin-codemod-optional-catch-binding"]
}

View File

@@ -1,21 +1,25 @@
{
"name": "@babel/plugin-codemod-optional-catch-binding",
"version": "7.0.0-beta.41",
"version": "7.0.0",
"description": "Remove unused catch bindings",
"repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-remove-unused-catch-binding",
"repository": "https://github.com/babel/babel/tree/master/codemods/babel-plugin-codemod-remove-unused-catch-binding",
"license": "MIT",
"publishConfig": {
"access": "public"
},
"main": "lib/index.js",
"keywords": [
"@babel/codemod",
"@babel/plugin"
],
"dependencies": {
"@babel/plugin-syntax-optional-catch-binding": "7.0.0-beta.41"
"@babel/plugin-syntax-optional-catch-binding": "^7.0.0"
},
"peerDependencies": {
"@babel/core": "7.0.0-beta.41"
"@babel/core": "^7.0.0-0"
},
"devDependencies": {
"@babel/core": "7.0.0-beta.41",
"@babel/helper-plugin-test-runner": "7.0.0-beta.41"
"@babel/core": "^7.0.0",
"@babel/helper-plugin-test-runner": "^7.0.0"
}
}

View File

@@ -1,7 +1,6 @@
import syntaxOptionalCatchBinding from "@babel/plugin-syntax-optional-catch-binding";
import { types as t } from "@babel/core";
export default function() {
export default function({ types: t }) {
return {
inherits: syntaxOptionalCatchBinding,

View File

@@ -1,5 +0,0 @@
try {
throw 0;
} catch (e) {
let e = new TypeError('Duplicate variable declaration; will throw an error.');
}

View File

@@ -1,4 +0,0 @@
{
"plugins": ["../../../../lib"],
"throws": "Duplicate declaration \"e\""
}

View File

@@ -1 +1 @@
The [AST specification](https://github.com/babel/babel/blob/master/packages/babylon/ast/spec.md) has been moved to the Babylon package, `packages/babylon`.
The [AST specification](https://github.com/babel/babel/blob/master/packages/babel-parser/ast/spec.md) has been moved to the babel parser package, `packages/babel-parser`.

View File

@@ -7,7 +7,7 @@
The Babel compiler is **only** supported in these environments:
- Modern browsers such as Chrome, Firefox, Safari, Edge etc.
- Node.js 4 and upper versions
- Node.js 6 and newer versions
## Unsupported environments

View File

@@ -15,7 +15,7 @@ This is quite taboo but let's look at the pros and cons:
* Easy to coordinate changes across modules.
* Single place to report issues.
* Easier to setup a development environment.
* Tests across modules are run together which finds bugs that touch multiple modules easier.
* Tests across modules are run together which finds bugs that touch multiple modules more easily.
**Cons:**

View File

@@ -1,31 +1,34 @@
{
"lerna": "2.0.0-rc.4",
"version": "7.0.0-beta.41",
"version": "7.7.2",
"changelog": {
"repo": "babel/babel",
"cacheDir": ".changelog",
"labels": {
"PR: Spec Compliancy :eyeglasses:": ":eyeglasses: Spec Compliancy",
"PR: Spec Compliance :eyeglasses:": ":eyeglasses: Spec Compliance",
"PR: Breaking Change :boom:": ":boom: Breaking Change",
"PR: New Feature :rocket:": ":rocket: New Feature",
"PR: Bug Fix :bug:": ":bug: Bug Fix",
"PR: Polish :nail_care:": ":nail_care: Polish",
"PR: Docs :memo:": ":memo: Documentation",
"PR: Internal :house:": ":house: Internal"
"PR: Internal :house:": ":house: Internal",
"PR: Performance :running_woman:": ":running_woman: Performance"
}
},
"cacheDir": ".changelog",
"commands": {
"command": {
"publish": {
"ignore": [
"ignoreChanges": [
"*.md",
"*.txt",
"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/*"
"codemods/*",
"packages/*"
],
"npmClient": "yarn",
"npmClientArgs": [

View File

@@ -2,12 +2,6 @@
* 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 export default {
sync: (string, {| basedir: string |}) => string;
@@ -26,22 +20,153 @@ declare module "lodash/defaults" {
declare module "lodash/clone" {
declare export default <T>(obj: T) => T;
}
}
declare module "lodash/merge" {
declare export default <T: Object>(T, Object) => T;
}
declare module "convert-source-map" {
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: {
SemVer: SemVer;
coerce(version: string | SemVer): SemVer | null;
gt(v1: string, v2: string): boolean;
intersects(r1: string, r2: string): boolean;
lt(v1: string, v2: string): boolean;
major(v: string): number;
minor(v: string): number;
patch(v: string): number;
satisfies(v1: string, r1: string): boolean;
valid(v: string): boolean;
}
}
declare module "source-map" {
declare export type SourceMap = {
version: 3,
file: ?string,
sourceRoot: ?string,
sources: [?string],
sourcesContent: [?string],
names: [?string],
mappings: string,
};
declare module.exports: {
SourceMapConsumer: typeof SourceMapConsumer,
SourceMapGenerator: typeof SourceMapGenerator,
}
declare class SourceMapConsumer {
static GENERATED_ORDER: 1;
static ORIGINAL_ORDER: 2;
file: string | null;
sourceRoot: string | null;
sources: Array<string>;
constructor(?SourceMap): this;
computeColumnSpans(): string;
originalPositionFor({
line: number,
column: number,
}): {|
source: string,
line: number,
column: number,
name: string | null
|} | {|
source: null,
line: null,
column: null,
name: null
|};
generatedPositionFor({
source: string,
line: number,
column: number,
}): {|
line: number,
column: number,
lastColumn: number | null | void,
|} | {|
line: null,
column: null,
lastColumn: null | void,
|};
allGeneratedPositionsFor({
source: string,
line: number,
column: number,
}): Array<{|
line: number,
column: number,
lastColumn: number,
|}>;
sourceContentFor(string, boolean | void): string | null;
eachMapping(
({|
generatedLine: number,
generatedColumn: number,
source: string,
originalLine: number,
originalColumn: number,
name: string | null,
|} | {|
generatedLine: number,
generatedColumn: number,
source: null,
originalLine: null,
originalColumn: null,
name: null,
|}) => mixed,
context: mixed,
order: ?(1 | 2),
): void;
}
declare class SourceMapGenerator {
constructor(?{
file?: string | null,
sourceRoot?: string | null,
skipValidation?: boolean | null,
}): this;
addMapping({
generated: {
line: number,
column: number,
}
}): void;
setSourceContent(string, string): void;
toJSON(): SourceMap;
}
}
declare module "convert-source-map" {
import type { SourceMap, SourceMapGenerator } from "source-map";
declare class Converter {
toJSON(): string;
toBase64(): string;
@@ -52,15 +177,31 @@ declare module "convert-source-map" {
declare module.exports: {
SourceMap: SourceMap,
Converter: Converter,
fromObject(obj: SourceMap): Converter,
fromObject(obj: SourceMap | SourceMapGenerator): Converter,
fromJSON(str: string): Converter,
fromBase64(str: string): Converter,
fromComment(str: string): Converter,
fromMapFileComment(str: string): Converter,
fromMapFileComment(str: string, dir: string): Converter,
fromSource(str: string): Converter,
fromMapFileSource(str: string): Converter,
fromMapFileSource(str: string, dir: string): Converter,
removeComments(str: string): string,
removeMapFileComments(str: string): string,
generateMapFileComment(path: string, options?: ?{ multiline: boolean }): string,
};
}
declare module "js-levenshtein" {
declare module.exports: {
(string, string): number,
};
}
declare module "core-js-compat/data" {
declare type Target = "node" | "chrome" | "opera" | "edge" | "firefox" | "safari" | "ie" | "ios" | "android" | "electron" | "samsung";
declare module.exports: {
[key: string]: {
[target: Target]: string;
}
}
}

View File

@@ -6,77 +6,90 @@
"build": "make build",
"fix": "make fix",
"lint": "make lint",
"precommit": "lint-staged",
"test": "make test"
},
"devDependencies": {
"@babel/cli": "7.0.0-beta.40",
"@babel/core": "7.0.0-beta.40",
"@babel/preset-env": "7.0.0-beta.40",
"@babel/preset-flow": "7.0.0-beta.40",
"@babel/preset-stage-0": "7.0.0-beta.40",
"@babel/register": "7.0.0-beta.40",
"babel-core": "^7.0.0-0",
"babel-eslint": "^8.0.1",
"babel-jest": "^22.4.1",
"babel-loader": "8.0.0-beta.0",
"babel-plugin-transform-charcodes": "^0.1.0",
"babylon": "7.0.0-beta.40",
"browserify": "^13.1.1",
"@babel/cli": "^7.6.0",
"@babel/core": "^7.6.0",
"@babel/eslint-plugin-development": "^1.0.1",
"@babel/plugin-proposal-class-properties": "^7.5.5",
"@babel/plugin-proposal-export-namespace-from": "^7.5.2",
"@babel/plugin-proposal-nullish-coalescing-operator": "^7.4.4",
"@babel/plugin-proposal-numeric-separator": "^7.2.0",
"@babel/plugin-proposal-optional-chaining": "^7.6.0",
"@babel/plugin-transform-modules-commonjs": "^7.6.0",
"@babel/plugin-transform-runtime": "^7.6.0",
"@babel/preset-env": "^7.6.0",
"@babel/preset-flow": "^7.0.0",
"@babel/register": "^7.6.0",
"@babel/runtime": "^7.6.0",
"babel-eslint": "^11.0.0-beta.0",
"babel-jest": "^24.9.0",
"babel-loader": "^8.0.6",
"babel-plugin-transform-charcodes": "^0.2.0",
"browserify": "^16.2.3",
"bundle-collapser": "^1.2.1",
"chai": "^4.1.0",
"chalk": "^2.3.2",
"charcodes": "^0.1.0",
"chalk": "^2.4.2",
"charcodes": "^0.2.0",
"derequire": "^2.0.2",
"duplicate-package-checker-webpack-plugin": "^2.1.0",
"enhanced-resolve": "^3.0.0",
"eslint": "^4.18.2",
"eslint-config-babel": "^7.0.2",
"eslint-plugin-flowtype": "^2.20.0",
"eslint-plugin-prettier": "^2.5.0",
"flow-bin": "^0.66.0",
"graceful-fs": "^4.1.11",
"gulp": "^3.9.0",
"gulp-babel": "^8.0.0-beta.0",
"eslint": "^6.0.1",
"eslint-config-babel": "^9.0.0",
"eslint-plugin-flowtype": "^3.8.2",
"eslint-plugin-import": "^2.17.2",
"eslint-plugin-prettier": "^3.1.0",
"fancy-log": "^1.3.3",
"flow-bin": "^0.108.0",
"graceful-fs": "^4.1.15",
"gulp": "^4.0.2",
"gulp-babel": "^8.0.0",
"gulp-filter": "^5.1.0",
"gulp-newer": "^1.0.0",
"gulp-plumber": "^1.0.1",
"gulp-rename": "^1.2.2",
"gulp-uglify": "^3.0.0",
"gulp-util": "^3.0.7",
"gulp-watch": "^4.3.5",
"husky": "^0.14.3",
"jest": "^22.4.2",
"lerna": "2.0.0",
"gulp-plumber": "^1.2.1",
"gulp-rename": "^1.4.0",
"gulp-uglify": "^3.0.2",
"gulp-watch": "^5.0.1",
"husky": "^3.0.0",
"jest": "^24.9.0",
"lerna": "^3.16.0",
"lerna-changelog": "^0.5.0",
"lint-staged": "^6.0.1",
"lodash": "^4.2.0",
"merge-stream": "^1.0.1",
"lint-staged": "^9.2.0",
"lodash": "^4.17.13",
"output-file-sync": "^2.0.0",
"prettier": "1.11.1",
"pump": "^1.0.2",
"rimraf": "^2.4.3",
"rollup-plugin-babel": "^4.0.0-beta.0",
"rollup-plugin-node-resolve": "^3.0.2",
"rollup-stream": "^1.24.1",
"test262-stream": "^1.1.0",
"prettier": "^1.17.1",
"pump": "^3.0.0",
"rimraf": "^2.6.3",
"rollup": "^1.12.0",
"rollup-plugin-babel": "^4.0.0",
"rollup-plugin-node-resolve": "^5.0.0",
"rollup-plugin-replace": "^2.2.0",
"test262-stream": "^1.3.0",
"through2": "^2.0.0",
"uglify-js": "^2.4.16",
"vinyl-buffer": "^1.0.1",
"vinyl-source-stream": "^2.0.0",
"typescript": "^3.6.3",
"warnings-to-errors-webpack-plugin": "^2.0.0",
"webpack": "^3.4.1",
"webpack-dependency-suite": "^2.4.4",
"webpack-stream": "^4.0.0"
},
"resolutions": {
"@lerna/**/@lerna/collect-updates": "https://github.com/babel/lerna.git#babel-collect-updates"
},
"engines": {
"node": ">= 4.x <= 9.x",
"npm": ">= 2.x <= 5.x",
"node": ">= 6.9.0 < 14.0.0",
"npm": ">= 3.x <= 6.x",
"yarn": ">=0.27.5 || >=1.0.0-20170811"
},
"lint-staged": {
"*.js": [
"eslint --format=codeframe --rulesdir='./scripts/eslint_rules'"
"eslint --format=codeframe"
]
},
"husky": {
"hooks": {
"pre-commit": "lint-staged"
}
},
"jest": {
"collectCoverageFrom": [
"packages/*/src/**/*.mjs",
@@ -89,7 +102,7 @@
"/node_modules/",
"/test/fixtures/",
"/test/debug-fixtures/",
"/babylon/test/expressions/",
"/babel-parser/test/expressions/",
"/test/tmp/",
"/test/__data__/",
"/test/helpers/",
@@ -98,7 +111,9 @@
"_browser\\.js"
],
"testEnvironment": "node",
"setupTestFrameworkScriptFile": "<rootDir>/test/testSetupFile.js",
"setupFilesAfterEnv": [
"<rootDir>/test/testSetupFile.js"
],
"transformIgnorePatterns": [
"/node_modules/",
"<rootDir>/packages/babel-standalone/babel(\\.min)?\\.js",
@@ -106,11 +121,20 @@
"/test/(fixtures|tmp|__data__)/",
"<rootDir>/(packages|codemods)/[^/]+/lib/"
],
"coveragePathIgnorePatterns": [
"/node_modules/",
"<rootDir>/packages/babel-standalone/babel(\\.min)?\\.js",
"<rootDir>/packages/babel-preset-env-standalone/babel-preset-env(\\.min)?\\.js",
"/test/(fixtures|tmp|__data__)/"
],
"modulePathIgnorePatterns": [
"/test/fixtures/",
"/test/tmp/",
"/test/__data__/",
"<rootDir>/build/"
]
],
"moduleNameMapper": {
"^@babel/([a-zA-Z0-9_-]+)$": "<rootDir>/packages/babel-$1/"
}
}
}

View File

@@ -13,22 +13,22 @@ A monorepo, muhahahahahaha. See the [monorepo design doc](/doc/design/monorepo.m
| Package | Version | Dependencies |
|--------|-------|------------|
| [`@babel/core`](/packages/babel-core) | [![npm](https://img.shields.io/npm/v/@babel/core.svg?maxAge=2592000)](https://www.npmjs.com/package/@babel/core) | [![Dependency Status](https://david-dm.org/babel/babel.svg?path=packages/babel-core)](https://david-dm.org/babel/babel?path=packages/babel-core) |
| [`babylon`](/packages/babylon) | [![npm](https://img.shields.io/npm/v/babylon.svg?maxAge=2592000)](https://www.npmjs.com/package/babylon) | [![Dependency Status](https://david-dm.org/babel/babel.svg?path=packages/babylon)](https://david-dm.org/babel/babel?path=packages/babylon) |
| [`@babel/traverse`](/packages/babel-traverse) | [![npm](https://img.shields.io/npm/v/@babel/traverse.svg?maxAge=2592000)](https://www.npmjs.com/package/@babel/traverse) | [![Dependency Status](https://david-dm.org/babel/babel.svg?path=packages/babel-traverse)](https://david-dm.org/babel/babel?path=packages/babel-traverse) |
| [`@babel/generator`](/packages/babel-generator) | [![npm](https://img.shields.io/npm/v/@babel/generator.svg?maxAge=2592000)](https://www.npmjs.com/package/@babel/generator) | [![Dependency Status](https://david-dm.org/babel/babel.svg?path=packages/babel-generator)](https://david-dm.org/babel/babel?path=packages/babel-generator) |
| [`@babel/core`](/packages/babel-core) | [![npm](https://img.shields.io/npm/v/@babel/core.svg?maxAge=3600)](https://www.npmjs.com/package/@babel/core) | [![Dependency Status](https://david-dm.org/babel/babel.svg?path=packages/babel-core)](https://david-dm.org/babel/babel?path=packages/babel-core) |
| [`@babel/parser`](/packages/babel-parser) | [![npm](https://img.shields.io/npm/v/@babel/parser.svg?maxAge=3600)](https://www.npmjs.com/package/@babel/parser) | [![Dependency Status](https://david-dm.org/babel/babel.svg?path=packages/babel-parser)](https://david-dm.org/babel/babel?path=packages/babel-parser) |
| [`@babel/traverse`](/packages/babel-traverse) | [![npm](https://img.shields.io/npm/v/@babel/traverse.svg?maxAge=3600)](https://www.npmjs.com/package/@babel/traverse) | [![Dependency Status](https://david-dm.org/babel/babel.svg?path=packages/babel-traverse)](https://david-dm.org/babel/babel?path=packages/babel-traverse) |
| [`@babel/generator`](/packages/babel-generator) | [![npm](https://img.shields.io/npm/v/@babel/generator.svg?maxAge=3600)](https://www.npmjs.com/package/@babel/generator) | [![Dependency Status](https://david-dm.org/babel/babel.svg?path=packages/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`.
The compiler can be broken down into 3 parts:
- The parser: [`babylon`](/packages/babylon)
- The parser: [`@babel/parser`](/packages/babel-parser)
- The transformer[s]: All the plugins/presets
- These all use [`@babel/traverse`](/packages/babel-traverse) to traverse through the AST
- The generator: [`@babel/generator`](/packages/babel-generator)
The flow goes like this:
input string -> `babylon` parser -> `AST` -> transformer[s] -> `AST` -> `@babel/generator` -> output string
input string -> `@babel/parser` parser -> `AST` -> transformer[s] -> `AST` -> `@babel/generator` -> output string
Check out the [`babel-handbook`](https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#introduction) for more information on this.
@@ -36,14 +36,14 @@ Check out the [`babel-handbook`](https://github.com/thejameskyle/babel-handbook/
| Package | Version | Dependencies |
|--------|-------|------------|
| [`@babel/cli`](/packages/babel-cli) | [![npm](https://img.shields.io/npm/v/@babel/cli.svg?maxAge=2592000)](https://www.npmjs.com/package/@babel/cli) | [![Dependency Status](https://david-dm.org/babel/babel.svg?path=packages/babel-cli)](https://david-dm.org/babel/babel?path=packages/babel-cli) |
| [`@babel/types`](/packages/babel-types) | [![npm](https://img.shields.io/npm/v/@babel/types.svg?maxAge=2592000)](https://www.npmjs.com/package/@babel/types) | [![Dependency Status](https://david-dm.org/babel/babel.svg?path=packages/babel-types)](https://david-dm.org/babel/babel?path=packages/babel-types) |
| [`@babel/polyfill`](/packages/babel-polyfill) | [![npm](https://img.shields.io/npm/v/@babel/polyfill.svg?maxAge=2592000)](https://www.npmjs.com/package/@babel/polyfill) | [![Dependency Status](https://david-dm.org/babel/babel.svg?path=packages/babel-polyfill)](https://david-dm.org/babel/babel?path=packages/babel-polyfill) |
| [`@babel/runtime`](/packages/babel-runtime) | [![npm](https://img.shields.io/npm/v/@babel/runtime.svg?maxAge=2592000)](https://www.npmjs.com/package/@babel/runtime) | [![Dependency Status](https://david-dm.org/babel/babel.svg?path=packages/babel-runtime)](https://david-dm.org/babel/babel?path=packages/babel-runtime) |
| [`@babel/register`](/packages/babel-register) | [![npm](https://img.shields.io/npm/v/@babel/register.svg?maxAge=2592000)](https://www.npmjs.com/package/@babel/register) | [![Dependency Status](https://david-dm.org/babel/babel.svg?path=packages/babel-register)](https://david-dm.org/babel/babel?path=packages/babel-register) |
| [`@babel/template`](/packages/babel-template) | [![npm](https://img.shields.io/npm/v/@babel/template.svg?maxAge=2592000)](https://www.npmjs.com/package/@babel/template) | [![Dependency Status](https://david-dm.org/babel/babel.svg?path=packages/babel-template)](https://david-dm.org/babel/babel?path=packages/babel-template) |
| [`@babel/helpers`](/packages/babel-helpers) | [![npm](https://img.shields.io/npm/v/@babel/helpers.svg?maxAge=2592000)](https://www.npmjs.com/package/@babel/helpers) | [![Dependency Status](https://david-dm.org/babel/babel.svg?path=packages/babel-helpers)](https://david-dm.org/babel/babel?path=packages/babel-helpers) |
| [`@babel/code-frame`](/packages/babel-code-frame) | [![npm](https://img.shields.io/npm/v/@babel/code-frame.svg?maxAge=2592000)](https://www.npmjs.com/package/@babel/code-frame) | [![Dependency Status](https://david-dm.org/babel/babel.svg?path=packages/babel-code-frame)](https://david-dm.org/babel/babel?path=packages/babel-code-frame) |
| [`@babel/cli`](/packages/babel-cli) | [![npm](https://img.shields.io/npm/v/@babel/cli.svg?maxAge=3600)](https://www.npmjs.com/package/@babel/cli) | [![Dependency Status](https://david-dm.org/babel/babel.svg?path=packages/babel-cli)](https://david-dm.org/babel/babel?path=packages/babel-cli) |
| [`@babel/types`](/packages/babel-types) | [![npm](https://img.shields.io/npm/v/@babel/types.svg?maxAge=3600)](https://www.npmjs.com/package/@babel/types) | [![Dependency Status](https://david-dm.org/babel/babel.svg?path=packages/babel-types)](https://david-dm.org/babel/babel?path=packages/babel-types) |
| [`@babel/polyfill`](/packages/babel-polyfill) | [![npm](https://img.shields.io/npm/v/@babel/polyfill.svg?maxAge=3600)](https://www.npmjs.com/package/@babel/polyfill) | [![Dependency Status](https://david-dm.org/babel/babel.svg?path=packages/babel-polyfill)](https://david-dm.org/babel/babel?path=packages/babel-polyfill) |
| [`@babel/runtime`](/packages/babel-runtime) | [![npm](https://img.shields.io/npm/v/@babel/runtime.svg?maxAge=3600)](https://www.npmjs.com/package/@babel/runtime) | [![Dependency Status](https://david-dm.org/babel/babel.svg?path=packages/babel-runtime)](https://david-dm.org/babel/babel?path=packages/babel-runtime) |
| [`@babel/register`](/packages/babel-register) | [![npm](https://img.shields.io/npm/v/@babel/register.svg?maxAge=3600)](https://www.npmjs.com/package/@babel/register) | [![Dependency Status](https://david-dm.org/babel/babel.svg?path=packages/babel-register)](https://david-dm.org/babel/babel?path=packages/babel-register) |
| [`@babel/template`](/packages/babel-template) | [![npm](https://img.shields.io/npm/v/@babel/template.svg?maxAge=3600)](https://www.npmjs.com/package/@babel/template) | [![Dependency Status](https://david-dm.org/babel/babel.svg?path=packages/babel-template)](https://david-dm.org/babel/babel?path=packages/babel-template) |
| [`@babel/helpers`](/packages/babel-helpers) | [![npm](https://img.shields.io/npm/v/@babel/helpers.svg?maxAge=3600)](https://www.npmjs.com/package/@babel/helpers) | [![Dependency Status](https://david-dm.org/babel/babel.svg?path=packages/babel-helpers)](https://david-dm.org/babel/babel?path=packages/babel-helpers) |
| [`@babel/code-frame`](/packages/babel-code-frame) | [![npm](https://img.shields.io/npm/v/@babel/code-frame.svg?maxAge=3600)](https://www.npmjs.com/package/@babel/code-frame) | [![Dependency Status](https://david-dm.org/babel/babel.svg?path=packages/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/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 |
|--------|-------|------------|---|
| [`@babel/preset-env`](/packages/babel-preset-env) | [![npm](https://img.shields.io/npm/v/@babel/preset-env.svg?maxAge=2592000)](https://www.npmjs.com/package/@babel/preset-env) | [![Dependency Status](https://david-dm.org/babel/babel/status.svg?path=packages/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) | [![npm](https://img.shields.io/npm/v/@babel/preset-env.svg?maxAge=?maxAge=3600)](https://www.npmjs.com/package/@babel/preset-env) | [![Dependency Status](https://david-dm.org/babel/babel/status.svg?path=packages/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)

View File

@@ -2,20 +2,18 @@
> Babel command line.
In addition, various entry point scripts live in the top-level package at `@babel/cli/bin`.
There is a shell-executable utility script, `babel-external-helpers.js`, and the main Babel cli script, `babel.js`.
See our website [@babel/cli](https://babeljs.io/docs/en/next/babel-cli.html) for more information or the [issues](https://github.com/babel/babel/issues?utf8=%E2%9C%93&q=is%3Aissue+label%3A%22pkg%3A%20cli%22+is%3Aopen) associated with this package.
## Install
```sh
npm install --save-dev @babel/core @babel/cli
```
## Usage
Using npm:
```sh
babel script.js
npm install --save-dev @babel/cli
```
For more in depth documentation see: http://babeljs.io/docs/usage/cli/
or using yarn:
```sh
yarn add @babel/cli --dev
```

View File

@@ -1,10 +1,13 @@
{
"name": "@babel/cli",
"version": "7.0.0-beta.41",
"version": "7.7.0",
"description": "Babel command line.",
"author": "Sebastian McKenzie <sebmck@gmail.com>",
"homepage": "https://babeljs.io/",
"license": "MIT",
"publishConfig": {
"access": "public"
},
"repository": "https://github.com/babel/babel/tree/master/packages/babel-cli",
"keywords": [
"6to5",
@@ -18,22 +21,22 @@
"dependencies": {
"commander": "^2.8.1",
"convert-source-map": "^1.1.0",
"fs-readdir-recursive": "^1.0.0",
"fs-readdir-recursive": "^1.1.0",
"glob": "^7.0.0",
"lodash": "^4.2.0",
"output-file-sync": "^2.0.0",
"slash": "^1.0.0",
"lodash": "^4.17.13",
"make-dir": "^2.1.0",
"slash": "^2.0.0",
"source-map": "^0.5.0"
},
"optionalDependencies": {
"chokidar": "^1.6.1"
"chokidar": "^2.1.8"
},
"peerDependencies": {
"@babel/core": "7.0.0-beta.41"
"@babel/core": "^7.0.0-0"
},
"devDependencies": {
"@babel/core": "7.0.0-beta.41",
"@babel/helper-fixtures": "7.0.0-beta.41"
"@babel/core": "^7.7.0",
"@babel/helper-fixtures": "^7.6.3"
},
"bin": {
"babel": "./bin/babel.js",

View File

@@ -1,7 +1,12 @@
// @flow
import commander from "commander";
import { buildExternalHelpers } from "@babel/core";
function collect(value, previousValue): Array<string> {
function collect(
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 (typeof value !== "string") return previousValue;

View File

@@ -1,170 +1,152 @@
// @flow
import defaults from "lodash/defaults";
import outputFileSync from "output-file-sync";
import { sync as makeDirSync } from "make-dir";
import slash from "slash";
import path from "path";
import fs from "fs";
import * as util from "./util";
import { type CmdOptions } from "./options";
let compiledFiles = 0;
function outputFileSync(filePath: string, data: string | Buffer): void {
makeDirSync(path.dirname(filePath));
fs.writeFileSync(filePath, data);
}
export default function(commander, filenames, opts) {
function write(src, relative, base, callback) {
if (typeof base === "function") {
callback = base;
base = undefined;
}
if (!util.isCompilableExtension(relative, commander.extensions)) {
return process.nextTick(callback);
export default async function({
cliOptions,
babelOptions,
}: CmdOptions): Promise<void> {
const filenames = cliOptions.filenames;
async function write(src: string, base: string): Promise<boolean> {
let relative = path.relative(base, src);
if (!util.isCompilableExtension(relative, cliOptions.extensions)) {
return false;
}
// remove extension and then append back on .js
relative = util.adjustRelative(relative, commander.keepFileExtension);
relative = util.adjustRelative(relative, cliOptions.keepFileExtension);
const dest = getDest(commander, relative, base);
const dest = getDest(relative, base);
util.compile(
src,
defaults(
{
sourceFileName: slash(path.relative(dest + "/..", src)),
},
opts,
),
function(err, res) {
if (err) return callback(err);
if (!res) return callback();
try {
const res = await util.compile(
src,
defaults(
{
sourceFileName: slash(path.relative(dest + "/..", src)),
},
babelOptions,
),
);
// we've requested explicit sourcemaps to be written to disk
if (
res.map &&
commander.sourceMaps &&
commander.sourceMaps !== "inline"
) {
const mapLoc = dest + ".map";
res.code = util.addSourceMappingUrl(res.code, mapLoc);
res.map.file = path.basename(relative);
outputFileSync(mapLoc, JSON.stringify(res.map));
}
if (!res) return false;
outputFileSync(dest, res.code);
util.chmod(src, dest);
compiledFiles += 1;
util.log(src + " -> " + dest);
return callback(null, true);
},
);
}
function getDest(commander, filename, base) {
if (commander.relative) return path.join(base, commander.outDir, filename);
return path.join(commander.outDir, filename);
}
function outputDestFolder(outDir) {
const outDirPath = path.resolve(outDir);
if (!fs.existsSync(outDirPath)) {
fs.mkdirSync(outDirPath);
}
}
function handleFile(src, filename, base, callback) {
if (typeof base === "function") {
callback = base;
base = undefined;
}
write(src, filename, base, function(err, res) {
if (err) return callback(err);
if (!res && commander.copyFiles) {
const dest = getDest(commander, filename, base);
outputFileSync(dest, fs.readFileSync(src));
util.chmod(src, dest);
// we've requested explicit sourcemaps to be written to disk
if (
res.map &&
babelOptions.sourceMaps &&
babelOptions.sourceMaps !== "inline"
) {
const mapLoc = dest + ".map";
res.code = util.addSourceMappingUrl(res.code, mapLoc);
res.map.file = path.basename(relative);
outputFileSync(mapLoc, JSON.stringify(res.map));
}
return callback();
});
}
outputFileSync(dest, res.code);
util.chmod(src, dest);
function sequentialHandleFile(files, dirname, index, callback) {
if (files.length === 0) {
outputDestFolder(commander.outDir);
return;
}
if (typeof index === "function") {
callback = index;
index = 0;
}
const filename = files[index];
const src = path.join(dirname, filename);
handleFile(src, filename, dirname, function(err) {
if (err) return callback(err);
index++;
if (index !== files.length) {
sequentialHandleFile(files, dirname, index, callback);
} else {
callback();
}
});
}
function handle(filename, callback) {
if (!fs.existsSync(filename)) return;
const stat = fs.statSync(filename);
if (stat.isDirectory(filename)) {
const dirname = filename;
if (commander.deleteDirOnStart) {
util.deleteDir(commander.outDir);
if (cliOptions.verbose) {
console.log(src + " -> " + dest);
}
const files = util.readdir(dirname, commander.includeDotfiles);
sequentialHandleFile(files, dirname, callback);
return true;
} catch (err) {
if (cliOptions.watch) {
console.error(err);
return false;
}
throw err;
}
}
function getDest(filename: string, base: string): string {
if (cliOptions.relative) {
return path.join(base, cliOptions.outDir, filename);
}
return path.join(cliOptions.outDir, filename);
}
async function handleFile(src: string, base: string): Promise<boolean> {
const written = await write(src, base);
if (!written && cliOptions.copyFiles) {
const filename = path.relative(base, src);
const dest = getDest(filename, base);
outputFileSync(dest, fs.readFileSync(src));
util.chmod(src, dest);
}
return written;
}
async function handle(filenameOrDir: string): Promise<number> {
if (!fs.existsSync(filenameOrDir)) return 0;
const stat = fs.statSync(filenameOrDir);
if (stat.isDirectory()) {
const dirname = filenameOrDir;
let count = 0;
const files = util.readdir(dirname, cliOptions.includeDotfiles);
for (const filename of files) {
const src = path.join(dirname, filename);
const written = await handleFile(src, dirname);
if (written) count += 1;
}
return count;
} else {
write(
filename,
path.basename(filename),
path.dirname(filename),
callback,
const filename = filenameOrDir;
const written = await handleFile(filename, path.dirname(filename));
return written ? 1 : 0;
}
}
if (!cliOptions.skipInitialBuild) {
if (cliOptions.deleteDirOnStart) {
util.deleteDir(cliOptions.outDir);
}
makeDirSync(cliOptions.outDir);
let compiledFiles = 0;
for (const filename of cliOptions.filenames) {
compiledFiles += await handle(filename);
}
if (!cliOptions.quiet) {
console.log(
`Successfully compiled ${compiledFiles} ${
compiledFiles !== 1 ? "files" : "file"
} with Babel.`,
);
}
}
function sequentialHandle(filenames, index = 0) {
const filename = filenames[index];
handle(filename, function(err) {
if (err) throw new Error(err);
index++;
if (index !== filenames.length) {
sequentialHandle(filenames, index);
} else {
util.log(
`🎉 Successfully compiled ${compiledFiles} ${
compiledFiles > 1 ? "files" : "file"
} with Babel.`,
true,
);
}
});
}
if (!commander.skipInitialBuild) {
sequentialHandle(filenames);
}
if (commander.watch) {
if (cliOptions.watch) {
const chokidar = util.requireChokidar();
filenames.forEach(function(dirname) {
const watcher = chokidar.watch(dirname, {
filenames.forEach(function(filenameOrDir) {
const watcher = chokidar.watch(filenameOrDir, {
persistent: true,
ignoreInitial: true,
awaitWriteFinish: {
@@ -175,14 +157,14 @@ export default function(commander, filenames, opts) {
["add", "change"].forEach(function(type) {
watcher.on(type, function(filename) {
const relative = path.relative(dirname, filename) || filename;
try {
handleFile(filename, relative, function(err) {
if (err) throw err;
});
} catch (err) {
console.error(err.stack);
}
handleFile(
filename,
filename === filenameOrDir
? path.dirname(filenameOrDir)
: filenameOrDir,
).catch(err => {
console.error(err);
});
});
});
});

View File

@@ -1,32 +1,40 @@
// @flow
import convertSourceMap from "convert-source-map";
import defaults from "lodash/defaults";
import sourceMap from "source-map";
import slash from "slash";
import { sync as makeDirSync } from "make-dir";
import path from "path";
import fs from "fs";
import * as util from "./util";
import { type CmdOptions } from "./options";
export default function(commander, filenames, opts) {
if (commander.sourceMaps === "inline") {
opts.sourceMaps = true;
}
type CompilationOutput = {
code: string,
map: Object,
};
let results = [];
const buildResult = function() {
export default async function({
cliOptions,
babelOptions,
}: CmdOptions): Promise<void> {
function buildResult(fileResults: Array<Object>): CompilationOutput {
const map = new sourceMap.SourceMapGenerator({
file:
commander.sourceMapTarget ||
path.basename(commander.outFile || "") ||
cliOptions.sourceMapTarget ||
path.basename(cliOptions.outFile || "") ||
"stdout",
sourceRoot: opts.sourceRoot,
sourceRoot: babelOptions.sourceRoot,
});
let code = "";
let offset = 0;
results.forEach(function(result) {
for (const result of fileResults) {
if (!result) continue;
code += result.code + "\n";
if (result.map) {
@@ -61,13 +69,13 @@ export default function(commander, filenames, opts) {
offset = code.split("\n").length - 1;
}
});
}
// add the inline sourcemap comment if we've either explicitly asked for inline source
// maps, or we've requested them without any output file
if (
commander.sourceMaps === "inline" ||
(!commander.outFile && commander.sourceMaps)
babelOptions.sourceMaps === "inline" ||
(!cliOptions.outFile && babelOptions.sourceMaps)
) {
code += "\n" + convertSourceMap.fromObject(map).toComment();
}
@@ -76,57 +84,65 @@ export default function(commander, filenames, opts) {
map: map,
code: code,
};
};
}
const output = function() {
const result = buildResult();
function output(fileResults: Array<string>): void {
const result = buildResult(fileResults);
if (cliOptions.outFile) {
makeDirSync(path.dirname(cliOptions.outFile));
if (commander.outFile) {
// we've requested for a sourcemap to be written to disk
if (commander.sourceMaps && commander.sourceMaps !== "inline") {
const mapLoc = commander.outFile + ".map";
if (babelOptions.sourceMaps && babelOptions.sourceMaps !== "inline") {
const mapLoc = cliOptions.outFile + ".map";
result.code = util.addSourceMappingUrl(result.code, mapLoc);
fs.writeFileSync(mapLoc, JSON.stringify(result.map));
}
fs.writeFileSync(commander.outFile, result.code);
fs.writeFileSync(cliOptions.outFile, result.code);
} else {
process.stdout.write(result.code + "\n");
}
};
}
const stdin = function() {
let code = "";
function readStdin(): Promise<string> {
return new Promise((resolve: Function, reject: Function): void => {
let code = "";
process.stdin.setEncoding("utf8");
process.stdin.setEncoding("utf8");
process.stdin.on("readable", function() {
const chunk = process.stdin.read();
if (chunk !== null) code += chunk;
process.stdin.on("readable", function() {
const chunk = process.stdin.read();
// $FlowIgnore
if (chunk !== null) code += chunk;
});
process.stdin.on("end", function() {
resolve(code);
});
process.stdin.on("error", reject);
});
}
process.stdin.on("end", function() {
util.transform(
commander.filename,
code,
defaults(
{
sourceFileName: "stdin",
},
opts,
),
function(err, res) {
if (err) throw err;
results.push(res);
output();
async function stdin(): Promise<void> {
const code = await readStdin();
const res = await util.transform(
cliOptions.filename,
code,
defaults(
{
sourceFileName: "stdin",
},
);
});
};
babelOptions,
),
);
const walk = function() {
output([res]);
}
async function walk(filenames: Array<string>): Promise<void> {
const _filenames = [];
results = [];
filenames.forEach(function(filename) {
if (!fs.existsSync(filename)) return;
@@ -136,7 +152,11 @@ export default function(commander, filenames, opts) {
const dirname = filename;
util
.readdirForCompilable(filename, commander.includeDotfiles)
.readdirForCompilable(
filename,
cliOptions.includeDotfiles,
cliOptions.extensions,
)
.forEach(function(filename) {
_filenames.push(path.join(dirname, filename));
});
@@ -145,46 +165,54 @@ export default function(commander, filenames, opts) {
}
});
let filesProcessed = 0;
const results = await Promise.all(
_filenames.map(async function(filename: string): Promise<Object> {
let sourceFilename = filename;
if (cliOptions.outFile) {
sourceFilename = path.relative(
path.dirname(cliOptions.outFile),
sourceFilename,
);
}
sourceFilename = slash(sourceFilename);
_filenames.forEach(function(filename, index) {
let sourceFilename = filename;
if (commander.outFile) {
sourceFilename = path.relative(
path.dirname(commander.outFile),
sourceFilename,
);
}
sourceFilename = slash(sourceFilename);
util.compile(
filename,
defaults(
{
sourceFileName: sourceFilename,
},
opts,
),
function(err, res) {
if (err) throw err;
filesProcessed++;
if (res) results[index] = res;
if (filesProcessed === _filenames.length) {
output();
try {
return await util.compile(
filename,
defaults(
{
sourceFileName: sourceFilename,
// Since we're compiling everything to be merged together,
// "inline" applies to the final output file, but not to the individual
// files being concatenated.
sourceMaps:
babelOptions.sourceMaps === "inline"
? true
: babelOptions.sourceMaps,
},
babelOptions,
),
);
} catch (err) {
if (!cliOptions.watch) {
throw err;
}
},
);
});
};
const files = function() {
if (!commander.skipInitialBuild) {
walk();
console.error(err);
return null;
}
}),
);
output(results);
}
async function files(filenames: Array<string>): Promise<void> {
if (!cliOptions.skipInitialBuild) {
await walk(filenames);
}
if (commander.watch) {
if (cliOptions.watch) {
const chokidar = util.requireChokidar();
chokidar
.watch(filenames, {
@@ -195,26 +223,27 @@ export default function(commander, filenames, opts) {
pollInterval: 10,
},
})
.on("all", function(type, filename) {
if (!util.isCompilableExtension(filename, commander.extensions)) {
.on("all", function(type: string, filename: string) {
if (!util.isCompilableExtension(filename, cliOptions.extensions)) {
return;
}
if (type === "add" || type === "change") {
util.log(type + " " + filename);
try {
walk();
} catch (err) {
console.error(err.stack);
if (cliOptions.verbose) {
console.log(type + " " + filename);
}
walk(filenames).catch(err => {
console.error(err);
});
}
});
}
};
}
if (filenames.length) {
files();
if (cliOptions.filenames.length) {
await files(cliOptions.filenames);
} else {
stdin();
await stdin();
}
}

View File

@@ -1,271 +1,17 @@
#!/usr/bin/env node
import fs from "fs";
import commander from "commander";
import { version } from "@babel/core";
import uniq from "lodash/uniq";
import glob from "glob";
import parseArgv from "./options";
import dirCommand from "./dir";
import fileCommand from "./file";
import pkg from "../../package.json";
const opts = parseArgv(process.argv);
function booleanify(val: any): boolean | any {
if (val === "true" || val == 1) {
return true;
}
if (val === "false" || val == 0 || !val) {
return false;
}
return val;
if (opts) {
const fn = opts.cliOptions.outDir ? dirCommand : fileCommand;
fn(opts).catch(err => {
console.error(err);
process.exitCode = 1;
});
} else {
process.exitCode = 2;
}
function collect(value, previousValue): Array<string> {
// If the user passed the option with no value, like "babel file.js --presets", do nothing.
if (typeof value !== "string") return previousValue;
const values = value.split(",");
return previousValue ? previousValue.concat(values) : values;
}
/* eslint-disable max-len */
// Standard Babel input configs.
commander.option(
"-f, --filename [filename]",
"filename to use when reading from stdin - this will be used in source-maps, errors etc",
);
commander.option(
"--presets [list]",
"comma-separated list of preset names",
collect,
);
commander.option(
"--plugins [list]",
"comma-separated list of plugin names",
collect,
);
commander.option("--config-file [path]", "Path a to .babelrc file to use");
commander.option(
"--env-name [name]",
"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'.",
);
// Basic file input configuration.
commander.option("--source-type [script|module]", "");
commander.option(
"--no-babelrc",
"Whether or not to look up .babelrc and .babelignore files",
);
commander.option(
"--ignore [list]",
"list of glob paths to **not** compile",
collect,
);
commander.option(
"--only [list]",
"list of glob paths to **only** compile",
collect,
);
// Misc babel config.
commander.option(
"--no-highlight-code",
"enable/disable ANSI syntax highlighting of code frames (on by default)",
);
// General output formatting.
commander.option(
"--no-comments",
"write comments to generated output (true by default)",
);
commander.option(
"--retain-lines",
"retain line numbers - will result in really ugly code",
);
commander.option(
"--compact [true|false|auto]",
"do not include superfluous whitespace characters and line terminators",
booleanify,
);
commander.option("--minified", "save as much bytes when printing [true|false]");
commander.option(
"--auxiliary-comment-before [string]",
"print a comment before any injected non-user code",
);
commander.option(
"--auxiliary-comment-after [string]",
"print a comment after any injected non-user code",
);
// General soucemap formatting.
commander.option("-s, --source-maps [true|false|inline|both]", "", booleanify);
commander.option(
"--source-map-target [string]",
"set `file` on returned source map",
);
commander.option(
"--source-file-name [string]",
"set `sources[0]` on returned source map",
);
commander.option(
"--source-root [filename]",
"the root from which all sources are relative",
);
// Config params for certain module output formats.
commander.option(
"--module-root [filename]",
"optional prefix for the AMD module formatter that will be prepend to the filename on module definitions",
);
commander.option("-M, --module-ids", "insert an explicit id for modules");
commander.option(
"--module-id [string]",
"specify a custom name for module ids",
);
// "babel" command specific arguments that are not passed to @babel/core.
commander.option(
"-x, --extensions [extensions]",
"List of extensions to compile when a directory has been input [.es6,.js,.es,.jsx,.mjs]",
collect,
);
commander.option(
"--keep-file-extension",
"Preserve the file extensions of the input files",
);
commander.option("-w, --watch", "Recompile files on changes");
commander.option(
"--skip-initial-build",
"Do not compile files before watching",
);
commander.option(
"-o, --out-file [out]",
"Compile all input files into a single file",
);
commander.option(
"-d, --out-dir [out]",
"Compile an input directory of modules into an output directory",
);
commander.option(
"--relative",
"Compile into an output directory relative to input directory or file. Requires --out-dir [out]",
);
commander.option(
"-D, --copy-files",
"When compiling a directory copy over non-compilable files",
);
commander.option(
"--include-dotfiles",
"Include dotfiles when compiling and copying non-compilable files",
);
commander.option("--verbose", "Log everything");
commander.option(
"--delete-dir-on-start",
"Delete the out directory before compilation",
);
/* eslint-enable max-len */
commander.version(pkg.version + " (@babel/core " + version + ")");
commander.usage("[options] <files ...>");
commander.parse(process.argv);
//
const errors = [];
let filenames = commander.args.reduce(function(globbed, input) {
let files = glob.sync(input);
if (!files.length) files = [input];
return globbed.concat(files);
}, []);
filenames = uniq(filenames);
filenames.forEach(function(filename) {
if (!fs.existsSync(filename)) {
errors.push(filename + " doesn't exist");
}
});
if (commander.outDir && !filenames.length) {
errors.push("filenames required for --out-dir");
}
if (commander.outFile && commander.outDir) {
errors.push("cannot have --out-file and --out-dir");
}
if (commander.relative && !commander.outDir) {
errors.push("output directory required for --relative");
}
if (commander.watch) {
if (!commander.outFile && !commander.outDir) {
errors.push("--watch requires --out-file or --out-dir");
}
if (!filenames.length) {
errors.push("--watch requires filenames");
}
}
if (commander.skipInitialBuild && !commander.watch) {
errors.push("--skip-initial-build requires --watch");
}
if (commander.deleteDirOnStart && !commander.outDir) {
errors.push("--delete-dir-on-start requires --out-dir");
}
if (
!commander.outDir &&
filenames.length === 0 &&
typeof commander.filename !== "string" &&
commander.babelrc !== false
) {
errors.push(
"stdin compilation requires either -f/--filename [filename] or --no-babelrc",
);
}
if (errors.length) {
console.error(errors.join(". "));
process.exit(2);
}
//
const opts = commander.opts();
//the configFile CLI option maps to the extends option in the node API
if (opts.configFile) {
opts.extends = opts.configFile;
}
// Delete options that are specific to @babel/cli and shouldn't be passed to @babel/core.
delete opts.version;
delete opts.extensions;
delete opts.watch;
delete opts.skipInitialBuild;
delete opts.outFile;
delete opts.outDir;
delete opts.copyFiles;
delete opts.includeDotfiles;
delete opts.verbose;
delete opts.configFile;
delete opts.deleteDirOnStart;
delete opts.keepFileExtension;
delete opts.relative;
delete opts.sourceMapTarget;
// 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.
if (opts.babelrc === true) opts.babelrc = undefined;
if (opts.comments === true) opts.comments = undefined;
if (opts.highlightCode === true) opts.highlightCode = undefined;
const fn = commander.outDir ? dirCommand : fileCommand;
fn(commander, filenames, opts);

View File

@@ -0,0 +1,323 @@
// @flow
import fs from "fs";
import commander from "commander";
import { version } from "@babel/core";
import uniq from "lodash/uniq";
import glob from "glob";
import pkg from "../../package.json";
// Standard Babel input configs.
commander.option(
"-f, --filename [filename]",
"The filename to use when reading from stdin. This will be used in source-maps, errors etc.",
);
commander.option(
"--presets [list]",
"A comma-separated list of preset names.",
collect,
);
commander.option(
"--plugins [list]",
"A comma-separated list of plugin names.",
collect,
);
commander.option("--config-file [path]", "Path to a .babelrc file to use.");
commander.option(
"--env-name [name]",
"The name of the 'env' to use when loading configs and plugins. " +
"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.
commander.option("--source-type [script|module]", "");
commander.option(
"--no-babelrc",
"Whether or not to look up .babelrc and .babelignore files.",
);
commander.option(
"--ignore [list]",
"List of glob paths to **not** compile.",
collect,
);
commander.option(
"--only [list]",
"List of glob paths to **only** compile.",
collect,
);
// Misc babel config.
commander.option(
"--no-highlight-code",
"Enable or disable ANSI syntax highlighting of code frames. (on by default)",
);
// General output formatting.
commander.option(
"--no-comments",
"Write comments to generated output. (true by default)",
);
commander.option(
"--retain-lines",
"Retain line numbers. This will result in really ugly code.",
);
commander.option(
"--compact [true|false|auto]",
"Do not include superfluous whitespace characters and line terminators.",
booleanify,
);
commander.option("--minified", "save as much bytes when printing [true|false]");
commander.option(
"--auxiliary-comment-before [string]",
"Print a comment before any injected non-user code.",
);
commander.option(
"--auxiliary-comment-after [string]",
"Print a comment after any injected non-user code.",
);
// General source map formatting.
commander.option("-s, --source-maps [true|false|inline|both]", "", booleanify);
commander.option(
"--source-map-target [string]",
"Set `file` on returned source map.",
);
commander.option(
"--source-file-name [string]",
"Set `sources[0]` on returned source map.",
);
commander.option(
"--source-root [filename]",
"The root from which all sources are relative.",
);
// Config params for certain module output formats.
commander.option(
"--module-root [filename]",
// eslint-disable-next-line max-len
"Optional prefix for the AMD module formatter that will be prepended to the filename on module definitions.",
);
commander.option("-M, --module-ids", "Insert an explicit id for modules.");
commander.option(
"--module-id [string]",
"Specify a custom name for module ids.",
);
// "babel" command specific arguments that are not passed to @babel/core.
commander.option(
"-x, --extensions [extensions]",
"List of extensions to compile when a directory has been the input. [.es6,.js,.es,.jsx,.mjs]",
collect,
);
commander.option(
"--keep-file-extension",
"Preserve the file extensions of the input files.",
);
commander.option("-w, --watch", "Recompile files on changes.");
commander.option(
"--skip-initial-build",
"Do not compile files before watching.",
);
commander.option(
"-o, --out-file [out]",
"Compile all input files into a single file.",
);
commander.option(
"-d, --out-dir [out]",
"Compile an input directory of modules into an output directory.",
);
commander.option(
"--relative",
"Compile into an output directory relative to input directory or file. Requires --out-dir [out]",
);
commander.option(
"-D, --copy-files",
"When compiling a directory copy over non-compilable files.",
);
commander.option(
"--include-dotfiles",
"Include dotfiles when compiling and copying non-compilable files.",
);
commander.option(
"--verbose",
"Log everything. This option conflicts with --quiet",
);
commander.option(
"--quiet",
"Don't log anything. This option conflicts with --verbose",
);
commander.option(
"--delete-dir-on-start",
"Delete the out directory before compilation.",
);
commander.version(pkg.version + " (@babel/core " + version + ")");
commander.usage("[options] <files ...>");
export type CmdOptions = {
babelOptions: Object,
cliOptions: Object,
};
export default function parseArgv(args: Array<string>): CmdOptions | null {
//
commander.parse(args);
const errors = [];
let filenames = commander.args.reduce(function(globbed, input) {
let files = glob.sync(input);
if (!files.length) files = [input];
return globbed.concat(files);
}, []);
filenames = uniq(filenames);
filenames.forEach(function(filename) {
if (!fs.existsSync(filename)) {
errors.push(filename + " does not exist");
}
});
if (commander.outDir && !filenames.length) {
errors.push("--out-dir requires filenames");
}
if (commander.outFile && commander.outDir) {
errors.push("--out-file and --out-dir cannot be used together");
}
if (commander.relative && !commander.outDir) {
errors.push("--relative requires --out-dir usage");
}
if (commander.watch) {
if (!commander.outFile && !commander.outDir) {
errors.push("--watch requires --out-file or --out-dir");
}
if (!filenames.length) {
errors.push("--watch requires filenames");
}
}
if (commander.skipInitialBuild && !commander.watch) {
errors.push("--skip-initial-build requires --watch");
}
if (commander.deleteDirOnStart && !commander.outDir) {
errors.push("--delete-dir-on-start requires --out-dir");
}
if (commander.verbose && commander.quiet) {
errors.push("--verbose and --quiet cannot be used together");
}
if (
!commander.outDir &&
filenames.length === 0 &&
typeof commander.filename !== "string" &&
commander.babelrc !== false
) {
errors.push(
"stdin compilation requires either -f/--filename [filename] or --no-babelrc",
);
}
if (errors.length) {
console.error("babel:");
errors.forEach(function(e) {
console.error(" " + e);
});
return null;
}
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 {
babelOptions,
cliOptions: {
filename: opts.filename,
filenames,
extensions: opts.extensions,
keepFileExtension: opts.keepFileExtension,
watch: opts.watch,
skipInitialBuild: opts.skipInitialBuild,
outFile: opts.outFile,
outDir: opts.outDir,
relative: opts.relative,
copyFiles: opts.copyFiles,
includeDotfiles: opts.includeDotfiles,
verbose: opts.verbose,
quiet: opts.quiet,
deleteDirOnStart: opts.deleteDirOnStart,
sourceMapTarget: opts.sourceMapTarget,
},
};
}
function booleanify(val: any): boolean | any {
if (val === "true" || val == 1) {
return true;
}
if (val === "false" || val == 0 || !val) {
return false;
}
return val;
}
function collect(value, previousValue): Array<string> {
// If the user passed the option with no value, like "babel file.js --presets", do nothing.
if (typeof value !== "string") return previousValue;
const values = value.split(",");
return previousValue ? previousValue.concat(values) : values;
}

View File

@@ -1,11 +1,12 @@
import commander from "commander";
// @flow
import readdirRecursive from "fs-readdir-recursive";
import * as babel from "@babel/core";
import includes from "lodash/includes";
import path from "path";
import fs from "fs";
export function chmod(src, dest) {
export function chmod(src: string, dest: string): void {
fs.chmodSync(dest, fs.statSync(src).mode);
}
@@ -14,20 +15,27 @@ type ReaddirFilter = (filename: string) => boolean;
export function readdir(
dirname: string,
includeDotfiles: boolean,
filter: ReaddirFilter,
) {
return readdirRecursive(
dirname,
filename =>
(includeDotfiles || filename[0] !== ".") && (!filter || filter(filename)),
);
filter?: ReaddirFilter,
): Array<string> {
return readdirRecursive(dirname, (filename, _index, currentDirectory) => {
const stat = fs.statSync(path.join(currentDirectory, filename));
if (stat.isDirectory()) return true;
return (
(includeDotfiles || filename[0] !== ".") && (!filter || filter(filename))
);
});
}
export function readdirForCompilable(
dirname: string,
includeDotfiles: boolean,
) {
return readdir(dirname, includeDotfiles, isCompilableExtension);
altExts?: Array<string>,
): Array<string> {
return readdir(dirname, includeDotfiles, function(filename) {
return isCompilableExtension(filename, altExts);
});
}
/**
@@ -42,37 +50,51 @@ export function isCompilableExtension(
return includes(exts, ext);
}
export function addSourceMappingUrl(code, loc) {
export function addSourceMappingUrl(code: string, loc: string): string {
return code + "\n//# sourceMappingURL=" + path.basename(loc);
}
export function log(msg, force) {
if (force === true || commander.verbose) console.log(msg);
}
const CALLER = {
name: "@babel/cli",
};
export function transform(filename, code, opts, callback) {
opts = Object.assign({}, opts, {
export function transform(
filename: string,
code: string,
opts: Object,
): Promise<Object> {
opts = {
...opts,
caller: CALLER,
filename,
});
};
babel.transform(code, opts, callback);
}
export function compile(filename, opts, callback) {
babel.transformFile(filename, opts, function(err, res) {
if (err) {
if (commander.watch) {
console.error(err);
return callback(null, null);
} else {
return callback(err);
}
}
return callback(null, res);
return new Promise((resolve, reject) => {
babel.transform(code, opts, (err, result) => {
if (err) reject(err);
else resolve(result);
});
});
}
export function deleteDir(path) {
export function compile(
filename: string,
opts: Object | Function,
): Promise<Object> {
opts = {
...opts,
caller: CALLER,
};
return new Promise((resolve, reject) => {
babel.transformFile(filename, opts, (err, result) => {
if (err) reject(err);
else resolve(result);
});
});
}
export function deleteDir(path: string): void {
if (fs.existsSync(path)) {
fs.readdirSync(path).forEach(function(file) {
const curPath = path + "/" + file;
@@ -90,10 +112,10 @@ export function deleteDir(path) {
process.on("uncaughtException", function(err) {
console.error(err);
process.exit(1);
process.exitCode = 1;
});
export function requireChokidar() {
export function requireChokidar(): Object {
try {
return require("chokidar");
} catch (err) {
@@ -105,7 +127,10 @@ export function requireChokidar() {
}
}
export function adjustRelative(relative, keepFileExtension) {
export function adjustRelative(
relative: string,
keepFileExtension: boolean,
): string {
if (keepFileExtension) {
return relative;
}

View File

@@ -1,10 +1,12 @@
{
"args": [
"src",
"--out-dir", "lib",
"--out-dir",
"lib",
"--copy-files",
"--include-dotfiles",
"--ignore", "src/foo",
"--ignore",
"src/foo",
"--verbose"
]
}

View File

@@ -1,2 +1,2 @@
src/index.js -> lib/index.js
🎉 Successfully compiled 1 file with Babel.
Successfully compiled 1 file with Babel.

View File

@@ -1,10 +1,12 @@
{
"args": [
"src",
"--out-dir", "lib",
"--out-dir",
"lib",
"--copy-files",
"--include-dotfiles",
"--only", "src/foo",
"--only",
"src/foo",
"--verbose"
]
}

View File

@@ -1,3 +1,3 @@
src/foo/.foo.js -> lib/foo/.foo.js
src/foo/bar.js -> lib/foo/bar.js
🎉 Successfully compiled 2 files with Babel.
Successfully compiled 2 files with Babel.

View File

@@ -1,3 +1,10 @@
{
"args": ["src", "--out-dir", "lib", "--copy-files", "--include-dotfiles", "--verbose"]
"args": [
"src",
"--out-dir",
"lib",
"--copy-files",
"--include-dotfiles",
"--verbose"
]
}

View File

@@ -1,4 +1,4 @@
src/.foo.js -> lib/.foo.js
src/bar/index.js -> lib/bar/index.js
src/foo/foo.js -> lib/foo/foo.js
🎉 Successfully compiled 3 files with Babel.
Successfully compiled 3 files with Babel.

View File

@@ -1,9 +1,11 @@
{
"args": [
"src",
"--out-dir", "lib",
"--out-dir",
"lib",
"--copy-files",
"--ignore", "src/foo/*",
"--ignore",
"src/foo/*",
"--verbose"
]
}

View File

@@ -1,2 +1,2 @@
src/index.js -> lib/index.js
🎉 Successfully compiled 1 file with Babel.
Successfully compiled 1 file with Babel.

View File

@@ -1,9 +1,11 @@
{
"args": [
"src",
"--out-dir", "lib",
"--out-dir",
"lib",
"--copy-files",
"--only", "src/foo/*",
"--only",
"src/foo/*",
"--verbose"
]
}

View File

@@ -1,2 +1,2 @@
src/foo/bar.js -> lib/foo/bar.js
🎉 Successfully compiled 1 file with Babel.
Successfully compiled 1 file with Babel.

View File

@@ -1,3 +1,3 @@
src/bar/index.js -> lib/bar/index.js
src/foo/foo.js -> lib/foo/foo.js
🎉 Successfully compiled 2 files with Babel.
Successfully compiled 2 files with Babel.

View File

@@ -1,2 +1,2 @@
src/foobar/foo.js -> lib/foobar/foo.js
🎉 Successfully compiled 1 file with Babel.
Successfully compiled 1 file with Babel.

View File

@@ -2,4 +2,4 @@ src/a.js -> lib/a.js
src/b.js -> lib/b.js
src/baz/c.js -> lib/baz/c.js
src/foo.js -> lib/foo.js
🎉 Successfully compiled 4 files with Babel.
Successfully compiled 4 files with Babel.

View File

@@ -1,2 +1,2 @@
src/bar/index.js -> lib/bar/index.js
🎉 Successfully compiled 1 file with Babel.
Successfully compiled 1 file with Babel.

View File

@@ -1,3 +1,3 @@
src/a.foo.js -> lib/a.foo.js
src/baz/b.foo.js -> lib/baz/b.foo.js
🎉 Successfully compiled 2 files with Babel.
Successfully compiled 2 files with Babel.

View File

@@ -1,2 +1,2 @@
src/bar/index.js -> lib/bar/index.js
🎉 Successfully compiled 1 file with Babel.
Successfully compiled 1 file with Babel.

View File

@@ -1,3 +0,0 @@
{
"args": ["--source-maps", "--out-file", "test.js"]
}

View File

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

View File

@@ -1,3 +0,0 @@
{
"args": ["--source-maps", "inline"]
}

View File

@@ -1,7 +0,0 @@
"use strict";
arr.map(function (x) {
return x * x;
});
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInN0ZGluIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUEsR0FBRyxDQUFDLEdBQUcsQ0FBQyxVQUFBLENBQUM7U0FBSSxDQUFDLEdBQUcsQ0FBQztDQUFBLENBQUMsQ0FBQyIsImZpbGUiOiJzdGRvdXQiLCJzb3VyY2VzQ29udGVudCI6WyJhcnIubWFwKHggPT4geCAqIHgpOyJdfQ==

View File

@@ -1,2 +1,2 @@
src/foo.js -> lib/foo.js
🎉 Successfully compiled 1 file with Babel.
Successfully compiled 1 file with Babel.

View File

@@ -1,3 +1,3 @@
src/bar.mjs -> lib/bar.mjs
src/foo.js -> lib/foo.js
🎉 Successfully compiled 2 files with Babel.
Successfully compiled 2 files with Babel.

View File

@@ -0,0 +1,3 @@
class Test {
}

View File

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

View File

@@ -0,0 +1,3 @@
{
"args": ["src", "--out-dir", "lib", "--out-file", "compiled.js"]
}

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