Compare commits

..

140 Commits

Author SHA1 Message Date
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
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
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
1765 changed files with 21540 additions and 5369 deletions

View File

@@ -1,11 +1,9 @@
{
"root": true,
"extends": "babel",
"plugins": ["prettier"],
"plugins": ["local-rules", "prettier"],
"rules": {
"curly": ["error", "multi-line"],
"prettier/prettier": "error",
"no-case-declarations": "error"
"prettier/prettier": "error"
},
"env": {
"node": true
@@ -14,8 +12,8 @@
{
"files": ["packages/*/src/**/*.js", "codemods/*/src/**/*.js"],
"rules": {
"no-undefined-identifier": "error",
"no-deprecated-clone": "error"
"local-rules/no-undefined-identifier": "error",
"local-rules/no-deprecated-clone": "error"
}
},
{

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

@@ -11,10 +11,291 @@
_Note: Gaps between patch versions are faulty, broken or test releases._
See [CHANGELOG - v4-v6](/.github/CHANGELOG-v4-v6.md) for the v4.x-v6.x changelog.
See [CHANGELOG - v4](/.github/CHANGELOG-v4.md), [CHANGELOG - v5](/.github/CHANGELOG-v5.md), and [CHANGELOG - v6](/.github/CHANGELOG-v6.md) for v4.x-v6.x changes.
See [CHANGELOG - 6to5](/.github/CHANGELOG-6to5.md) for the pre-4.0.0 version changelog.
See [Babylon's CHANGELOG](packages/babylon/CHANGELOG.md) for the Babylon pre-7.0.0-beta.29 version changelog.
## 7.1.2 (2018-09-28)
Same as v7.1.1, except compiled against Node 6 instead of Node 8 by accident (e.g had `async functions`).
## v7.1.1 (2018-09-28)
> EDIT: had a publish issue here as well where it compiled against Node 8 instead of Node 6 so 7.1.2 will fix this.
> Also force publish `@babel/runtime` and `@babel/runtime-corejs2`. We need to fix the publishing around that since Lerna doesn't pickup the `@babel/helpers` changes as there is no "dependency"
#### :bug: Bug Fix
* `babel-generator`, `babel-parser`, `babel-types`
* [#8755](https://github.com/babel/babel/pull/8755) TypeScript: reserve `unknown` as TSUnknownKeyword. ([@g-plane](https://github.com/g-plane))
* `babel-plugin-transform-destructuring`
* [#8535](https://github.com/babel/babel/pull/8535) Do not unpack array patterns that update a referenced binding. ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo))
* `babel-plugin-proposal-decorators`
* [#8742](https://github.com/babel/babel/pull/8742) [decorators] Support async and generator methods. ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo))
* `babel-helpers`, `babel-plugin-proposal-decorators`
* [#8761](https://github.com/babel/babel/pull/8761) [decorators] Fields are enumerable. ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo))
* `babel-generator`
* [#8751](https://github.com/babel/babel/pull/8751) Fix some missing parens cases with OptionalMemberExpression in generator. ([@existentialism](https://github.com/existentialism))
* [#8727](https://github.com/babel/babel/pull/8727) Handle throw expressions in generator. ([@existentialism](https://github.com/existentialism))
#### :house: Internal
* Other
* [#8780](https://github.com/babel/babel/pull/8780) Run test262 tests for exportNamespaceFrom. ([@existentialism](https://github.com/existentialism))
* `babel-helper-transform-fixture-test-runner`
* [#8768](https://github.com/babel/babel/pull/8768) Use babel-check-duplicated-nodes. ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo))
## v7.1.0 (2018-09-17)
Check http://babeljs.io/blog/2018/09/17/7.1.0
#### :rocket: New Feature
* `babel-cli`, `babel-core`
* [#8660](https://github.com/babel/babel/pull/8660) Better support monorepos by allowing users to opt into automatically resolving 'root' with `rootMode: "upward"`.. ([@loganfsmyth](https://github.com/loganfsmyth))
* `babel-helper-transform-fixture-test-runner`
* [#7582](https://github.com/babel/babel/pull/7582) Allow regular plugins/presets resolution algorithm for packages outsi…. ([@Andarist](https://github.com/Andarist))
* `babel-helpers`, `babel-plugin-proposal-decorators`, `babel-plugin-syntax-decorators`
* [#7976](https://github.com/babel/babel/pull/7976) Add support for the new decorators proposal. ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo))
* `babel-helpers`, `babel-plugin-proposal-class-properties`
* [#8205](https://github.com/babel/babel/pull/8205) Private Static Fields Features: Stage 3. ([@rricard](https://github.com/rricard))
#### :bug: Bug Fix
* `babel-parser`
* [#8698](https://github.com/babel/babel/pull/8698) Fix parsing of newline between 'async' and 'function'. ([@existentialism](https://github.com/existentialism))
* [#8677](https://github.com/babel/babel/pull/8677) Fix typescript parsing typed object shorthand methods. ([@existentialism](https://github.com/existentialism))
* `babel-plugin-transform-typescript`
* [#8682](https://github.com/babel/babel/pull/8682) Fix TSParameterProperty getting lost with transform-classes. ([@existentialism](https://github.com/existentialism))
* [#8695](https://github.com/babel/babel/pull/8695) Adjust TSParameterProperty handling to work with transform-parameters. ([@existentialism](https://github.com/existentialism))
* [#8666](https://github.com/babel/babel/pull/8666) Fix typescript import elision. ([@Retsam](https://github.com/Retsam))
* `babel-preset-env`
* [#8693](https://github.com/babel/babel/pull/8693) Fix es6.string.iterator mapping in babel-preset-env. ([@existentialism](https://github.com/existentialism))
* `babel-core`, `babel-plugin-proposal-class-properties`, `babel-plugin-proposal-decorators`, `babel-plugin-transform-runtime`
* [#8659](https://github.com/babel/babel/pull/8659) Fix version checks in .availableHelper and transform-runtime definitions.. ([@loganfsmyth](https://github.com/loganfsmyth))
* Other
* [#8627](https://github.com/babel/babel/pull/8627) ts generator: allow reserved keywords in interfaces. ([@43081j](https://github.com/43081j))
* `babel-plugin-transform-parameters`
* [#8414](https://github.com/babel/babel/pull/8414) Allow patterns as argument of RestElement. ([@microbouji](https://github.com/microbouji))
* `babel-core`, `babel-plugin-transform-runtime`
* [#8624](https://github.com/babel/babel/pull/8624) Verify 'sourceMap' option with hasOwnProperty, and verify string-typed 'version'. ([@loganfsmyth](https://github.com/loganfsmyth))
* `babel-helpers`, `babel-plugin-proposal-class-properties`
* [#8614](https://github.com/babel/babel/pull/8614) [static private] Unify loose handling of static and instance props. ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo))
#### :nail_care: Polish
* `babel-plugin-transform-runtime`
* [#8581](https://github.com/babel/babel/pull/8581) Fix grammar in error message at @babel/plugin-transform-runtime. ([@tricknotes](https://github.com/tricknotes))
* `babel-parser`
* [#8576](https://github.com/babel/babel/pull/8576) More helpful errorr message for missing decoratorsBeforeExport in parser. ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo))
#### :memo: Documentation
* [#8561](https://github.com/babel/babel/pull/8561) Added pronounciation of babel. ([@siddhant1](https://github.com/siddhant1))
#### :house: Internal
* `babel-core`
* [#8714](https://github.com/babel/babel/pull/8714) Fix Flow error with new versionRange test.. ([@loganfsmyth](https://github.com/loganfsmyth))
* Other
* [#8679](https://github.com/babel/babel/pull/8679) remove force publish, temp tag [skip ci]. ([@hzoo](https://github.com/hzoo))
* `babel-plugin-transform-runtime`
* [#8661](https://github.com/babel/babel/pull/8661) Makefile: run fix json on fix. ([@xtuc](https://github.com/xtuc))
* `babel-*`
* [#8658](https://github.com/babel/babel/pull/8658) Format fixture options.json with Prettier.. ([@loganfsmyth](https://github.com/loganfsmyth))
* `babel-parser`
* [#8630](https://github.com/babel/babel/pull/8630) Bump flow to 0.80 and fix sourceType error. ([@existentialism](https://github.com/existentialism))
* [#8610](https://github.com/babel/babel/pull/8610) types: missing `unambiguous` sourceType. ([@xtuc](https://github.com/xtuc))
* [#8170](https://github.com/babel/babel/pull/8170) @babel/parser: expose a TypeScript definition file from package. ([@AviVahl](https://github.com/AviVahl))
* `babel-*`
* [#8573](https://github.com/babel/babel/pull/8573) add access public to all packages [skip ci]. ([@hzoo](https://github.com/hzoo))
## v7.0.1 (2018-09-11)
Doing a quick patch regarding helpers versioning to prevent future issues: https://github.com/babel/babel/pull/8659
## v7.0.0 (2018-08-27)
No change from rc.4. Finally released as https://babeljs.io/blog/2018/08/27/7.0.0!
## v7.0.0-rc.4 (2018-08-27)
> Similar to removing proposals in `@babel/polyfill`, we are removing them in `transform-runtime`
#### :boom: Breaking Change
* `babel-plugin-transform-runtime`
* [#8547](https://github.com/babel/babel/pull/8547) Remove nonstandard functions and fake prototype methods from babel-runtime. ([@loganfsmyth](https://github.com/loganfsmyth))
* `babel-parser`
* [#8539](https://github.com/babel/babel/pull/8539) Update parser whitespace for clarity. ([@jridgewell](https://github.com/jridgewell))
#### :bug: Bug Fix
* `babel-register`
* [#8553](https://github.com/babel/babel/pull/8553) bump source-map-support. ([@hzoo](https://github.com/hzoo))
* `babel-core`
* [#8546](https://github.com/babel/babel/pull/8546) Default highlightCode:true for the parser highlighting.. ([@loganfsmyth](https://github.com/loganfsmyth))
#### :house: Internal
* Other
* [#8554](https://github.com/babel/babel/pull/8554) Lerna: remove exact [skip ci]. ([@hzoo](https://github.com/hzoo))
* `babel-parser`
* [#8540](https://github.com/babel/babel/pull/8540) Cleanup getLineInfo. ([@jridgewell](https://github.com/jridgewell))
* [#8541](https://github.com/babel/babel/pull/8541) Update to ES6 String methods. ([@jridgewell](https://github.com/jridgewell))
* [#8537](https://github.com/babel/babel/pull/8537) Flatten TokenType class hierarchy. ([@jridgewell](https://github.com/jridgewell))
* [#8539](https://github.com/babel/babel/pull/8539) Update parser whitespace for clarity. ([@jridgewell](https://github.com/jridgewell))
## v7.0.0-rc.3 (2018-08-24)
#### :boom: Breaking Change
* `babel-preset-env`
* [#8509](https://github.com/babel/babel/pull/8509) Add browserslist 4 support.. ([@yavorsky](https://github.com/yavorsky))
* `babel-plugin-transform-runtime`
* [#8518](https://github.com/babel/babel/pull/8518) Make 'useESModules' only toggle CJS vs ESM helpers when importing file is ESM.. ([@loganfsmyth](https://github.com/loganfsmyth))
#### :rocket: New Feature
* `babel-plugin-transform-runtime`
* [#8520](https://github.com/babel/babel/pull/8520) Expose opt-in useESModules:"auto" from transform-runtime to toggle based on 'supportsStaticESM'. ([@loganfsmyth](https://github.com/loganfsmyth))
#### :bug: Bug Fix
* `babel-helpers`, `babel-plugin-transform-classes`, `babel-preset-env`
* [#8501](https://github.com/babel/babel/pull/8501) [_wrapNativeSuper] Don't wrap non-native constructors. ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo))
* `babel-generator`, `babel-traverse`, `babel-types`
* [#8478](https://github.com/babel/babel/pull/8478) Fix path.scope.rename() to not change break clauses. ([@rafeca](https://github.com/rafeca))
* `babel-plugin-proposal-object-rest-spread`
* [#8514](https://github.com/babel/babel/pull/8514) fix: object rest with default values bug. ([@jquense](https://github.com/jquense))
* `babel-traverse`
* [#8505](https://github.com/babel/babel/pull/8505) Rename exported functions where name conflicts with param.. ([@loganfsmyth](https://github.com/loganfsmyth))
#### :house: Internal
* `babel-plugin-transform-object-set-prototype-of-to-assign`
* [#8409](https://github.com/babel/babel/pull/8409) Add LICENSE file to published npm packages [skip ci]. ([@opichals](https://github.com/opichals))
* Other
* [#8504](https://github.com/babel/babel/pull/8504) Update Babel to rc.2. ([@hzoo](https://github.com/hzoo))
## v7.0.0-rc.2 (2018-08-21)
A notable change is the addition of https://github.com/babel/babel/pull/8485 which enables https://github.com/babel/babel-loader/pull/660 (automatically doing `modules: false` for `@babel/preset-env` when using `babel-loader`.
#### :boom: Breaking Change
* `babel-core`
* [#8470](https://github.com/babel/babel/pull/8470) Remove File#resolveModuleSource. ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo))
* [#8473](https://github.com/babel/babel/pull/8473) Allow babel-plugin/preset prefix to not be a prefix, when used in a scope.. ([@loganfsmyth](https://github.com/loganfsmyth))
* `babel-core`, `babel-parser`, `babel-plugin-syntax-decorators`
* [#8465](https://github.com/babel/babel/pull/8465) Require decoratorsBeforeExport option for decorators. ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo))
#### :rocket: New Feature
* `babel-preset-env`
* [#8500](https://github.com/babel/babel/pull/8500) Add missing es7.promise.finally polyfill when using useBuiltIns: usage. ([@jsnajdr](https://github.com/jsnajdr))
* `babel-cli`, `babel-core`, `babel-node`, `babel-preset-env`, `babel-register`
* [#8485](https://github.com/babel/babel/pull/8485) Allow preset-env to toggle module handling based on flags from the caller (like babel-loader). ([@loganfsmyth](https://github.com/loganfsmyth))
* `babel-core`
* [#8474](https://github.com/babel/babel/pull/8474) Preserve 'false'-options for disabled plugins/presets.. ([@loganfsmyth](https://github.com/loganfsmyth))
* [#8473](https://github.com/babel/babel/pull/8473) Allow babel-plugin/preset prefix to not be a prefix, when used in a scope.. ([@loganfsmyth](https://github.com/loganfsmyth))
* `babel-helper-transform-fixture-test-runner`, `babel-plugin-transform-runtime`
* [#8435](https://github.com/babel/babel/pull/8435) Allow transform-runtime to insert runtime references with absolute paths.. ([@loganfsmyth](https://github.com/loganfsmyth))
#### :bug: Bug Fix
* `babel-parser`
* [#8488](https://github.com/babel/babel/pull/8488) Fix trailingComments for FunctionExpression that is CallExpression arguments. ([@jiaxuan](https://github.com/jiaxuan))
* `babel-core`
* [#8493](https://github.com/babel/babel/pull/8493) Take top-level config source into consideration when processing nested env/overrides.. ([@loganfsmyth](https://github.com/loganfsmyth))
* `babel-helpers`, `babel-plugin-proposal-decorators`
* [#7429](https://github.com/babel/babel/pull/7429) Fix default descriptor setting for class properties with decorators. ([@yhpark](https://github.com/yhpark))
* `babel-plugin-transform-parameters`
* [#8479](https://github.com/babel/babel/pull/8479) Fixes setter paratemer default value. ([@nikolayemrikh](https://github.com/nikolayemrikh))
#### :nail_care: Polish
* `babel-core`
* [#8494](https://github.com/babel/babel/pull/8494) Cache individual programmatic descriptors along with the overall list.. ([@loganfsmyth](https://github.com/loganfsmyth))
* [#8493](https://github.com/babel/babel/pull/8493) Take top-level config source into consideration when processing nested env/overrides.. ([@loganfsmyth](https://github.com/loganfsmyth))
#### :house: Internal
* `babel-core`
* [#8493](https://github.com/babel/babel/pull/8493) Take top-level config source into consideration when processing nested env/overrides.. ([@loganfsmyth](https://github.com/loganfsmyth))
* `babel-plugin-transform-classes`
* [#8472](https://github.com/babel/babel/pull/8472) Remove unused file. ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo))
## v7.0.0-rc.1 (2018-08-09)
Same as rc.0 but fixes the peerDep issue #8443. It's changed to just be ^7.0.0-0
## v7.0.0-rc.0 (2018-08-09)
> This had an issue with `peerDependencies` so please use `rc.1`.
Alright finally at the end 🙂. Shouldn't have anymore breaking changes and going to wait some time to fix bugs/regressions
> Summary: `@babel/polyfill` will not include proposal polyfills by default and fixed a regression.
#### :boom: Breaking Change
* `babel-polyfill`
* [#8440](https://github.com/babel/babel/pull/8440) remove proposals polyfills from default import [skip ci]. ([@hzoo](https://github.com/hzoo))
> Will add this to the upgrade guide/polyfill docs. I guess we could include a `babel-upgrade` for this too, not sure.
#### :bug: Bug Fix
* `babel-cli`
* [#8436](https://github.com/babel/babel/pull/8436) Require v1.1.0 so that correct filter params are passed.. ([@loganfsmyth](https://github.com/loganfsmyth))
## v7.0.0-beta.56 (2018-08-03)
- Separate `@babel/runtime`: should work for helpers alone and opt-into core-js if necessary.
- More details in http://babeljs.io/docs/en/next/babel-runtime, http://babeljs.io/docs/en/next/babel-plugin-transform-runtime (via https://github.com/babel/babel/pull/8266, https://github.com/babel/website/pull/1714)
- `babel-upgrade` issue: https://github.com/babel/babel-upgrade/issues/70
#### :boom: Breaking Change
* `babel-plugin-transform-regenerator`, `babel-plugin-transform-runtime`, `babel-runtime-corejs2`, `babel-runtime`
* [#8266](https://github.com/babel/babel/pull/8266) Split @babel/runtime into 2 modules via @babel/runtime-corejs2. ([@loganfsmyth](https://github.com/loganfsmyth))
* `babel-core`, `babel-helper-module-imports`, `babel-helpers`, `babel-plugin-external-helpers`, `babel-plugin-transform-runtime`
* [#8398](https://github.com/babel/babel/pull/8398) Only reference helpers from external/runtime helpers if they are known to be available.. ([@loganfsmyth](https://github.com/loganfsmyth))
#### :rocket: New Feature
* `babel-plugin-transform-regenerator`, `babel-plugin-transform-runtime`, `babel-runtime-corejs2`, `babel-runtime`
* [#8266](https://github.com/babel/babel/pull/8266) Split @babel/runtime into 2 modules via @babel/runtime-corejs2. ([@loganfsmyth](https://github.com/loganfsmyth))
#### :bug: Bug Fix
* `babel-parser`, `babel-plugin-transform-typescript`
* [#8408](https://github.com/babel/babel/pull/8408) Allow TSInterfaceDeclaration to be default export. ([@existentialism](https://github.com/existentialism))
* `babel-preset-env`
* [#8403](https://github.com/babel/babel/pull/8403) Ensure esmodule targets are parsed by browserslist. ([@existentialism](https://github.com/existentialism))
* Other
* [#8024](https://github.com/babel/babel/pull/8024) Run transform-runtime on the standalone bundle so it stays ES5-compatible.. ([@loganfsmyth](https://github.com/loganfsmyth))
#### :memo: Documentation
* [#8412](https://github.com/babel/babel/pull/8412) Update Documentation[skip ci]. ([@leongjiameng](https://github.com/leongjiameng))
## v7.0.0-beta.55 (2018-07-28)
Breaking Change in beta:
> Throws an error on using Stage presets: https://babeljs.io/blog/2018/07/27/removing-babels-stage-presets
#### :boom: Breaking Change
* `babel-core`, `babel-plugin-proposal-class-properties`, `babel-plugin-proposal-decorators`, `babel-preset-stage-0`, `babel-preset-stage-1`, `babel-preset-stage-2`, `babel-preset-stage-3`, `babel-standalone`
* [#8293](https://github.com/babel/babel/pull/8293) Remove Stage presets. ([@hzoo](https://github.com/hzoo))
#### :rocket: New Feature
* `babel-generator`, `babel-parser`, `babel-plugin-transform-typescript`, `babel-types`
* [#7754](https://github.com/babel/babel/pull/7754) TypeScript: Support type arguments on tagged templates. ([@andy-ms](https://github.com/andy-ms))
#### :bug: Bug Fix
* `babel-cli`, `babel-core`, `babel-generator`
* [#8380](https://github.com/babel/babel/pull/8380) Ensure that Identifier source mappings explicitly start and stop on the generated range. ([@loganfsmyth](https://github.com/loganfsmyth))
* `babel-preset-env`
* [#8391](https://github.com/babel/babel/pull/8391) Ensure preset-env doesn't clobber browserslist defaults. ([@existentialism](https://github.com/existentialism))
* `babel-core`
* [#8376](https://github.com/babel/babel/pull/8376) Fix order of optional argument reordering. ([@Qix-](https://github.com/Qix-))
* [#8381](https://github.com/babel/babel/pull/8381) Allow an Array for `babelrcRoots`.. ([@wtgtybhertgeghgtwtg](https://github.com/wtgtybhertgeghgtwtg))
* [#8342](https://github.com/babel/babel/pull/8342) Do not mutate ast. ([@thiagoarrais](https://github.com/thiagoarrais))
* `babel-parser`
* [#8374](https://github.com/babel/babel/pull/8374) Correctly parse interface methods named 'static'. ([@bakkot](https://github.com/bakkot))
#### :nail_care: Polish
* `babel-parser`
* [#8355](https://github.com/babel/babel/pull/8355) remove .then from `dynamic import` parser exception message. ([@dnalborczyk](https://github.com/dnalborczyk))
#### :house: Internal
* `babel-core`, `babel-preset-stage-0`, `babel-preset-stage-1`, `babel-preset-stage-2`, `babel-preset-stage-3`, `babel-standalone`
* [#8397](https://github.com/babel/babel/pull/8397) Remove our own use of stage presets. ([@hzoo](https://github.com/hzoo))
* `babel-helpers`, `babel-plugin-proposal-class-properties`
* [#8318](https://github.com/babel/babel/pull/8318) Save full descriptor instead of only value for private fields.. ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo))
* `babel-core`
* [#8381](https://github.com/babel/babel/pull/8381) Allow an Array for `babelrcRoots`.. ([@wtgtybhertgeghgtwtg](https://github.com/wtgtybhertgeghgtwtg))
* `babel-cli`, `babel-core`, `babel-generator`, `babel-helper-define-map`, `babel-helper-fixtures`, `babel-helper-module-imports`, `babel-helper-module-transforms`, `babel-helper-regex`, `babel-helper-simple-access`, `babel-helper-transform-fixture-test-runner`, `babel-node`, `babel-plugin-transform-block-scoping`, `babel-register`, `babel-template`, `babel-traverse`, `babel-types`
* [#8377](https://github.com/babel/babel/pull/8377) Bumped lodash to 4.17.10. ([@Berkmann18](https://github.com/Berkmann18))
## v7.0.0-beta.54 (2018-07-16)
> Regarding https://github.com/babel/babel/issues/8184, we aren't using `micromatch` for paths, just basic `*/**` substitution now. For anything more complicated we will recommend using a regex/`.js` config.
@@ -2261,7 +2542,7 @@ Also started Babel to compile itself with Babel 7! (We'll be working on making i
#### :nail_care: Polish
* `babel-register`
* [#5411](https://github.com/babel/babel/pull/5411) Seperate version env cache files. ([@pwmckenna](https://github.com/pwmckenna))
* [#5411](https://github.com/babel/babel/pull/5411) Separate version env cache files. ([@pwmckenna](https://github.com/pwmckenna))
#### :memo: Documentation
* `babel-plugin-transform-runtime`

View File

@@ -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,7 +24,7 @@ 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/babel-parser/ast/spec.md) is a bit different from [ESTree](https://github.com/estree/estree). The differences are listed [here](https://github.com/babel/babel/tree/master/packages/babel-parser#output).
- [ASTs](https://en.wikipedia.org/wiki/Abstract_syntax_tree) (Abstract Syntax Tree): The Babel AST [spec](https://github.com/babel/babel/blob/master/packages/babel-parser/ast/spec.md) is a bit different from [ESTree](https://github.com/estree/estree). The differences are listed [here](https://babeljs.io/docs/en/next/babel-parser.html#output).
- Check out [`/doc`](https://github.com/babel/babel/tree/master/doc) for information about Babel's internals
- Check out [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
@@ -310,7 +310,7 @@ Note that the code shown in Chrome DevTools is compiled code and therefore diffe
- Create a new issue that describes the proposal (ex: [#538](https://github.com/babel/babylon/issues/538)). Include any relevant information like proposal repo/author, examples, parsing approaches, meeting notes, presentation slides, and more.
- The pull request should include:
- [ ] An update to the [plugins](https://github.com/babel/babel/tree/master/packages/babel-parser#plugins) part of the readme. Add a new entry to that list for the new plugin flag (and link to the proposal)
- [ ] If any new nodes or modifications need to be added to the AST, update [ast/spec.md](https://github.com/babel/babel/bloc/master/packages/babel-parser/ast/spec.md)
- [ ] If any new nodes or modifications need to be added to the AST, update [ast/spec.md](https://github.com/babel/babel/blob/master/packages/babel-parser/ast/spec.md)
- [ ] Make sure you use the `this.hasPlugin("plugin-name-here")` check in the babel parser so that your new plugin code only runs when that flag is turned on (not default behavior)
- [ ] Add failing/passing tests according to spec behavior
- Start working about the Babel transform itself!

View File

@@ -1,6 +1,6 @@
MIT License
Copyright (c) 2014-2018 Sebastian McKenzie <sebmck@gmail.com>
Copyright (c) 2014-2018 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

View File

@@ -1,6 +1,6 @@
MAKEFLAGS = -j1
FLOW_COMMIT = bea8b83f50f597454941d2a7ecef6e93a881e576
TEST262_COMMIT = f90a52b39609a620c0854e0bd0b3a906c930fd17
FLOW_COMMIT = e192e1a4793dd8e43415fbfe8046d832cb513c8b
TEST262_COMMIT = 69c1efd325deedf54db92a23008399e2b00fa51e
# Fix color output until TravisCI fixes https://github.com/travis-ci/travis-ci/issues/7967
export FORCE_COLOR = true
@@ -47,10 +47,13 @@ flow:
./node_modules/.bin/flow check --strip-root
lint:
./node_modules/.bin/eslint scripts $(SOURCES) '*.js' --format=codeframe --rulesdir="./scripts/eslint_rules"
./node_modules/.bin/eslint scripts $(SOURCES) '*.js' --format=codeframe
fix:
./node_modules/.bin/eslint scripts $(SOURCES) '*.js' --format=codeframe --fix --rulesdir="./scripts/eslint_rules"
fix: fix-json
./node_modules/.bin/eslint scripts $(SOURCES) '*.js' --format=codeframe --fix
fix-json:
./node_modules/.bin/prettier "{packages,codemod}/*/test/fixtures/**/options.json" --write --loglevel warn
clean: test-clean
rm -rf packages/babel-polyfill/browser*
@@ -79,7 +82,7 @@ test-ci-coverage:
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
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:
@@ -93,7 +96,7 @@ test-flow-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
git clone --branch=master --single-branch --shallow-since=2018-11-01 https://github.com/tc39/test262.git ./build/test262
cd build/test262 && git checkout $(TEST262_COMMIT)
test-test262:
@@ -107,18 +110,22 @@ test-test262-update-whitelist:
clone-license:
./scripts/clone-license.sh
publish:
git pull --rebase
prepublish-build:
make clean-lib
rm -rf packages/babel-runtime/helpers
rm -rf packages/babel-runtime-corejs2/helpers
rm -rf packages/babel-runtime-corejs2/core-js
BABEL_ENV=production make build-dist
make test
make clone-license
# not using lerna independent mode atm, so only update packages that have changed since we use ^
prepublish:
git pull --rebase
make prepublish-build
make test
publish: prepublish
# --only-explicit-updates
./node_modules/.bin/lerna publish --force-publish=* --skip-temp-tag
./node_modules/.bin/lerna publish --force-publish="@babel/runtime,@babel/runtime-corejs2" --dangerously-only-publish-explicit-updates-this-is-a-custom-flag-for-babel-and-you-should-not-be-using-it-just-deal-with-more-packages-being-published-it-is-not-a-big-deal
make clean
bootstrap: clean-all

View File

@@ -24,7 +24,7 @@
<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 a community-driven project used by many companies and projects, and is maintained by a group of [volunteers](https://babeljs.io/team). If you'd like to help support the future of the project, please consider:
Babel (pronounced ["babble"](https://soundcloud.com/sebmck/how-to-pronounce-babel)) is a community-driven project used by many companies and projects, and is maintained by a group of [volunteers](https://babeljs.io/team). If you'd like to help support the future of the project, please consider:
- Giving developer time on the project. (Message us on [Twitter](https://twitter.com/babeljs) or [Slack](https://slack.babeljs.io/) for guidance!)
- Giving funds by becoming a sponsor (see below)!
@@ -68,11 +68,14 @@ Become a sponsor and get your logo on our README on Github with a link to your s
Become a sponsor and get your logo on our README on Github with a link to your site. [[Become a sponsor](https://www.patreon.com/henryzhu)]
## Silver
<a href="https://issue.sh/?utm_medium=github&utm_campaign=babel" target="_blank"><img src="https://user-images.githubusercontent.com/5557143/43912065-c8cdff78-9c33-11e8-829a-0b4166ccc215.png"></a>
## Bronze
<a href="http://teamextension.io/" target="_blank"><img src="https://teamextension.io/dist/img/logo/te-logo-compact.png" height="64"></a>
<a href="https://webflow.com/" target="_blank"><img src="https://opencollective.com/proxy/images/?src=https%3A%2F%2Fopencollective-production.s3-us-west-1.amazonaws.com%2F4a5024b0-8cf2-11e7-b1a2-b30b1de1463c.png&height=64"></a>
<a href="https://issue.sh/?utm_medium=github&utm_campaign=babel" target="_blank"><img src="https://user-images.githubusercontent.com/5557143/43912065-c8cdff78-9c33-11e8-829a-0b4166ccc215.png"></a>
<p><a href="https://twitter.com/mikesherov">Mike Sherov</a></p>
## Intro
@@ -104,7 +107,7 @@ Mostly a handful of volunteers! Please check out our [team page](https://babeljs
### Looking for support?
For questions and support please visit join our [Slack Community](https://slack.babeljs.io/) (you can sign-up [here](https://slack.babeljs.io/) for an invite), ask a question on [Stack Overflow](https://stackoverflow.com/questions/tagged/babeljs), or ping us on [Twitter](https://twitter.com/babeljs).
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).
### Is there a Babel song?

View File

@@ -36,7 +36,7 @@ npm install --save-dev @babel/plugin-codemod-object-assign-to-object-spread
**.babelrc**
```json
```jsonc
{
"plugins": ["@babel/plugin-codemod-object-assign-to-object-spread"]
}

View File

@@ -1,23 +1,26 @@
{
"name": "@babel/plugin-codemod-object-assign-to-object-spread",
"version": "7.0.0-rc.4",
"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-rc.4"
"@babel/plugin-syntax-object-rest-spread": "^7.0.0"
},
"peerDependencies": {
"@babel/core": "^7.0.0-0"
},
"devDependencies": {
"@babel/core": "^7.0.0-rc.4",
"@babel/helper-plugin-test-runner": "^7.0.0-rc.4"
"@babel/core": "^7.0.0",
"@babel/helper-plugin-test-runner": "^7.0.0"
},
"publishConfig": {
"access": "public"

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,22 +1,25 @@
{
"name": "@babel/plugin-codemod-optional-catch-binding",
"version": "7.0.0-rc.4",
"version": "7.0.0",
"description": "Remove unused catch bindings",
"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-rc.4"
"@babel/plugin-syntax-optional-catch-binding": "^7.0.0"
},
"peerDependencies": {
"@babel/core": "^7.0.0-0"
},
"devDependencies": {
"@babel/core": "^7.0.0-rc.4",
"@babel/helper-plugin-test-runner": "^7.0.0-rc.4"
"@babel/core": "^7.0.0",
"@babel/helper-plugin-test-runner": "^7.0.0"
}
}

9
eslint-local-rules.js Normal file
View File

@@ -0,0 +1,9 @@
"use strict";
const noDeprecatedClone = require("./scripts/eslint_rules/no-deprecated-clone");
const noUndefinedIdentifier = require("./scripts/eslint_rules/no-undefined-identifier");
module.exports = {
"no-deprecated-clone": noDeprecatedClone,
"no-undefined-identifier": noUndefinedIdentifier,
};

View File

@@ -1,6 +1,6 @@
{
"lerna": "2.11.0",
"version": "7.0.0-rc.4",
"version": "7.1.6",
"changelog": {
"repo": "babel/babel",
"cacheDir": ".changelog",
@@ -18,8 +18,11 @@
"publish": {
"ignore": [
"*.md",
"*.json",
"*.txt",
"test/**",
"codemods/**"
"codemods/**",
"package.json"
]
}
},

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;

View File

@@ -6,25 +6,24 @@
"build": "make build",
"fix": "make fix",
"lint": "make lint",
"precommit": "lint-staged",
"test": "make test"
},
"devDependencies": {
"@babel/cli": "7.0.0-rc.2",
"@babel/core": "7.0.0-rc.2",
"@babel/plugin-transform-runtime": "7.0.0-rc.2",
"@babel/plugin-proposal-class-properties": "7.0.0-rc.2",
"@babel/plugin-proposal-export-namespace-from": "7.0.0-rc.2",
"@babel/plugin-proposal-numeric-separator": "7.0.0-rc.2",
"@babel/plugin-transform-modules-commonjs": "7.0.0-rc.2",
"@babel/preset-env": "7.0.0-rc.2",
"@babel/preset-flow": "7.0.0-rc.2",
"@babel/register": "7.0.0-rc.2",
"@babel/runtime": "7.0.0-rc.2",
"@babel/cli": "^7.1.2",
"@babel/core": "^7.1.2",
"@babel/plugin-proposal-class-properties": "^7.1.0",
"@babel/plugin-proposal-export-namespace-from": "^7.0.0",
"@babel/plugin-proposal-numeric-separator": "^7.0.0",
"@babel/plugin-transform-modules-commonjs": "^7.1.0",
"@babel/plugin-transform-runtime": "^7.1.0",
"@babel/preset-env": "^7.1.0",
"@babel/preset-flow": "^7.0.0",
"@babel/register": "^7.0.0",
"@babel/runtime": "^7.1.2",
"babel-core": "^7.0.0-0",
"babel-eslint": "^8.2.6",
"babel-jest": "^23.4.0",
"babel-loader": "8.0.0-beta.4",
"babel-eslint": "^10.0.1",
"babel-jest": "^23.6.0",
"babel-loader": "^8.0.4",
"babel-plugin-transform-charcodes": "^0.1.0",
"browserify": "^16.2.2",
"bundle-collapser": "^1.2.1",
@@ -32,11 +31,12 @@
"charcodes": "^0.1.0",
"derequire": "^2.0.2",
"enhanced-resolve": "^3.0.0",
"eslint": "^5.3.0",
"eslint-config-babel": "^7.0.2",
"eslint-plugin-flowtype": "^2.50.0",
"eslint": "^5.6.0",
"eslint-config-babel": "^8.0.1",
"eslint-plugin-flowtype": "^2.50.1",
"eslint-plugin-local-rules": "0.1.0",
"eslint-plugin-prettier": "^2.6.2",
"flow-bin": "^0.79.0",
"flow-bin": "^0.82.0",
"graceful-fs": "^4.1.11",
"gulp": "^4.0.0",
"gulp-babel": "^8.0.0-beta.2",
@@ -47,15 +47,15 @@
"gulp-uglify": "^3.0.0",
"gulp-util": "^3.0.7",
"gulp-watch": "^5.0.0",
"husky": "^0.14.3",
"jest": "^23.4.1",
"husky": "^1.0.0-rc.15",
"jest": "^23.6.0",
"lerna": "^2.11.0",
"lerna-changelog": "^0.5.0",
"lint-staged": "^6.0.1",
"lint-staged": "^7.3.0",
"lodash": "^4.17.10",
"merge-stream": "^1.0.1",
"output-file-sync": "^2.0.0",
"prettier": "^1.13.7",
"prettier": "^1.15.1",
"pump": "^1.0.2",
"rimraf": "^2.4.3",
"rollup-plugin-babel": "^4.0.0-beta.0",
@@ -77,9 +77,14 @@
},
"lint-staged": {
"*.js": [
"eslint --format=codeframe --rulesdir='./scripts/eslint_rules'"
"eslint --format=codeframe"
]
},
"husky": {
"hooks": {
"pre-commit": "lint-staged"
}
},
"jest": {
"collectCoverageFrom": [
"packages/*/src/**/*.mjs",

View File

@@ -13,10 +13,10 @@ 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) |
| [`@babel/parser`](/packages/babel-parser) | [![npm](https://img.shields.io/npm/v/@babel/parser.svg?maxAge=2592000)](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=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`.
@@ -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

@@ -1,10 +1,13 @@
{
"name": "@babel/cli",
"version": "7.0.0-rc.4",
"version": "7.1.5",
"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",
@@ -33,8 +36,8 @@
"@babel/core": "^7.0.0-0"
},
"devDependencies": {
"@babel/core": "^7.0.0-rc.4",
"@babel/helper-fixtures": "^7.0.0-rc.4"
"@babel/core": "^7.1.5",
"@babel/helper-fixtures": "^7.0.0"
},
"bin": {
"babel": "./bin/babel.js",

View File

@@ -28,6 +28,11 @@ commander.option(
"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]", "");
@@ -76,7 +81,7 @@ commander.option(
"print a comment after any injected non-user code",
);
// General soucemap formatting.
// General source map formatting.
commander.option("-s, --source-maps [true|false|inline|both]", "", booleanify);
commander.option(
"--source-map-target [string]",
@@ -162,20 +167,20 @@ export default function parseArgv(args: Array<string>) {
filenames.forEach(function(filename) {
if (!fs.existsSync(filename)) {
errors.push(filename + " doesn't exist");
errors.push(filename + " does not exist");
}
});
if (commander.outDir && !filenames.length) {
errors.push("filenames required for --out-dir");
errors.push("--out-dir requires filenames");
}
if (commander.outFile && commander.outDir) {
errors.push("cannot have --out-file and --out-dir");
errors.push("--out-file and --out-dir cannot be used together");
}
if (commander.relative && !commander.outDir) {
errors.push("output directory required for --relative");
errors.push("--relative requires --out-dir usage");
}
if (commander.watch) {
@@ -207,41 +212,56 @@ export default function parseArgv(args: Array<string>) {
}
if (errors.length) {
console.error(errors.join(". "));
console.error("babel:");
errors.forEach(function(e) {
console.error(" " + e);
});
process.exit(2);
}
const opts = commander.opts();
return {
babelOptions: {
presets: opts.presets,
plugins: opts.plugins,
configFile: opts.configFile,
envName: opts.envName,
sourceType: opts.sourceType,
ignore: opts.ignore,
only: opts.only,
retainLines: opts.retainLines,
compact: opts.compact,
minified: opts.minified,
auxiliaryCommentBefore: opts.auxiliaryCommentBefore,
auxiliaryCommentAfter: opts.auxiliaryCommentAfter,
sourceMaps: opts.sourceMaps,
sourceFileName: opts.sourceFileName,
sourceRoot: opts.sourceRoot,
moduleRoot: opts.moduleRoot,
moduleIds: opts.moduleIds,
moduleId: opts.moduleId,
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,
},
// 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,

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,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,10 @@
{
"args": ["src", "--out-dir", "lib", "--copy-files", "--include-dotfiles", "--verbose"]
"args": [
"src",
"--out-dir",
"lib",
"--copy-files",
"--include-dotfiles",
"--verbose"
]
}

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,9 +1,11 @@
{
"args": [
"src",
"--out-dir", "lib",
"--out-dir",
"lib",
"--copy-files",
"--only", "src/foo/*",
"--only",
"src/foo/*",
"--verbose"
]
}

View File

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

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

@@ -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"]
}

View File

@@ -0,0 +1,2 @@
babel:
--out-file and --out-dir cannot be used together

View File

@@ -0,0 +1,3 @@
{
"args": ["--out-dir", "lib"]
}

View File

@@ -0,0 +1,2 @@
babel:
--out-dir requires filenames

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", "--skip-initial-build", "--out-dir", "lib"]
}

View File

@@ -0,0 +1,2 @@
babel:
--skip-initial-build requires --watch

View File

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

View File

@@ -0,0 +1,3 @@
{
"args": ["src", "--watch"]
}

View File

@@ -0,0 +1,2 @@
babel:
--watch requires --out-file or --out-dir

View File

@@ -1 +1 @@
filenames required for --out-dir
--out-dir requires filenames

View File

@@ -1 +1 @@
cannot have --out-file and --out-dir
--out-file and --out-dir cannot be used together

View File

@@ -1,4 +1,4 @@
{
"args": ["--relative"],
"args": ["--relative", "--no-babelrc"],
"stderrContains": true
}

View File

@@ -1 +1 @@
output directory required for --relative
--relative requires --out-dir usage

View File

@@ -1 +1 @@
foo.json doesn't exist
foo.json does not exist

View File

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

View File

@@ -0,0 +1,3 @@
{
"args": ["--watch", "--out-file", "out.js", "--no-babelrc"]
}

View File

@@ -0,0 +1,2 @@
babel:
--watch requires filenames

View File

@@ -0,0 +1,3 @@
{
"args": ["index.js"]
}

View File

@@ -0,0 +1,2 @@
babel:
index.js does not exist

View File

@@ -1,3 +1,10 @@
{
"args": ["script.js", "script2.js", "--source-maps", "inline", "--out-file", "script3.js"]
"args": [
"script.js",
"script2.js",
"--source-maps",
"inline",
"--out-file",
"script3.js"
]
}

View File

@@ -1,3 +1,9 @@
{
"args": ["script.js", "script2.js", "--source-maps", "--out-file", "script3.js"]
"args": [
"script.js",
"script2.js",
"--source-maps",
"--out-file",
"script3.js"
]
}

View File

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

View File

@@ -1 +1 @@
{"version":3,"sources":["stdin"],"names":[],"mappings":";;AAAA,GAAG,CAAC,GAAG,CAAC,UAAA,CAAC;SAAI,CAAC,GAAG,CAAC;CAAA,CAAC,CAAC","file":"test.js","sourcesContent":["arr.map(x => x * x);"]}
{"version":3,"sources":["stdin"],"names":[],"mappings":";;AAAA,GAAG,CAAC,GAAJ,CAAQ,UAAA,CAAC;AAAA,SAAI,CAAC,GAAG,CAAR;AAAA,CAAT","file":"test.js","sourcesContent":["arr.map(x => x * x);"]}

View File

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

View File

@@ -0,0 +1,8 @@
"use strict";
arr.map(function (x) {
return x * x;
});
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInN0ZGluIl0sIm5hbWVzIjpbImFyciIsIm1hcCIsIngiXSwibWFwcGluZ3MiOiI7O0FBQUFBLEdBQUcsQ0FBQ0MsR0FBSixDQUFRLFVBQUFDLENBQUM7QUFBQSxTQUFJQSxDQUFDLEdBQUdBLENBQVI7QUFBQSxDQUFUIiwic291cmNlc0NvbnRlbnQiOlsiYXJyLm1hcCh4ID0+IHggKiB4KTsiXX0=
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IiIsImZpbGUiOiJzdGRvdXQifQ==

View File

@@ -1,14 +1,17 @@
{
"name": "@babel/code-frame",
"version": "7.0.0-rc.4",
"version": "7.0.0",
"description": "Generate errors that contain a code frame that point to source locations.",
"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-code-frame",
"main": "lib/index.js",
"dependencies": {
"@babel/highlight": "^7.0.0-rc.4"
"@babel/highlight": "^7.0.0"
},
"devDependencies": {
"chalk": "^2.0.0",

View File

@@ -1,11 +1,14 @@
{
"name": "@babel/core",
"version": "7.0.0-rc.4",
"version": "7.1.6",
"description": "Babel compiler core.",
"main": "lib/index.js",
"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-core",
"keywords": [
"6to5",
@@ -30,23 +33,23 @@
"./lib/transform-file.js": "./lib/transform-file-browser.js"
},
"dependencies": {
"@babel/code-frame": "^7.0.0-rc.4",
"@babel/generator": "^7.0.0-rc.4",
"@babel/helpers": "^7.0.0-rc.4",
"@babel/parser": "^7.0.0-rc.4",
"@babel/template": "^7.0.0-rc.4",
"@babel/traverse": "^7.0.0-rc.4",
"@babel/types": "^7.0.0-rc.4",
"@babel/code-frame": "^7.0.0",
"@babel/generator": "^7.1.6",
"@babel/helpers": "^7.1.5",
"@babel/parser": "^7.1.6",
"@babel/template": "^7.1.2",
"@babel/traverse": "^7.1.6",
"@babel/types": "^7.1.6",
"convert-source-map": "^1.1.0",
"debug": "^3.1.0",
"json5": "^0.5.0",
"debug": "^4.1.0",
"json5": "^2.1.0",
"lodash": "^4.17.10",
"resolve": "^1.3.2",
"semver": "^5.4.1",
"source-map": "^0.5.0"
},
"devDependencies": {
"@babel/helper-transform-fixture-test-runner": "^7.0.0-rc.4",
"@babel/register": "^7.0.0-rc.4"
"@babel/helper-transform-fixture-test-runner": "^7.0.0",
"@babel/register": "^7.0.0"
}
}

View File

@@ -155,6 +155,7 @@ export function buildRootChain(
}
let { babelrc, babelrcRoots } = opts;
let babelrcRootsDirectory = context.cwd;
const configFileChain = emptyChain();
if (configFile) {
@@ -168,6 +169,7 @@ export function buildRootChain(
babelrc = validatedFile.options.babelrc;
}
if (babelrcRoots === undefined) {
babelrcRootsDirectory = validatedFile.dirname;
babelrcRoots = validatedFile.options.babelrcRoots;
}
@@ -185,11 +187,12 @@ export function buildRootChain(
if (
(babelrc === true || babelrc === undefined) &&
pkgData &&
babelrcLoadEnabled(context, pkgData, babelrcRoots)
babelrcLoadEnabled(context, pkgData, babelrcRoots, babelrcRootsDirectory)
) {
({ ignore: ignoreFile, config: babelrcFile } = findRelativeConfig(
pkgData,
context.envName,
context.caller,
));
if (
@@ -228,6 +231,7 @@ function babelrcLoadEnabled(
context: ConfigContext,
pkgData: FilePackageData,
babelrcRoots: BabelrcSearch | void,
babelrcRootsDirectory: string,
): boolean {
if (typeof babelrcRoots === "boolean") return babelrcRoots;
@@ -242,7 +246,9 @@ function babelrcLoadEnabled(
let babelrcPatterns = babelrcRoots;
if (!Array.isArray(babelrcPatterns)) babelrcPatterns = [babelrcPatterns];
babelrcPatterns = babelrcPatterns.map(pat => {
return typeof pat === "string" ? path.resolve(context.cwd, pat) : pat;
return typeof pat === "string"
? path.resolve(babelrcRootsDirectory, pat)
: pat;
});
// Fast path to avoid having to match patterns if the babelrc is just
@@ -252,10 +258,12 @@ function babelrcLoadEnabled(
}
return babelrcPatterns.some(pat => {
if (typeof pat === "string") pat = pathPatternToRegex(pat, context.cwd);
if (typeof pat === "string") {
pat = pathPatternToRegex(pat, babelrcRootsDirectory);
}
return pkgData.directories.some(directory => {
return matchPattern(pat, context.cwd, directory, context);
return matchPattern(pat, babelrcRootsDirectory, directory, context);
});
});
}
@@ -541,7 +549,7 @@ function normalizeOptions(opts: ValidatedOptions): ValidatedOptions {
// "sourceMap" is just aliased to sourceMap, so copy it over as
// we merge the options together.
if (options.sourceMap) {
if (options.hasOwnProperty("sourceMap")) {
options.sourceMaps = options.sourceMap;
delete options.sourceMap;
}

View File

@@ -24,6 +24,21 @@ const BABELRC_FILENAME = ".babelrc";
const BABELRC_JS_FILENAME = ".babelrc.js";
const BABELIGNORE_FILENAME = ".babelignore";
export function findConfigUpwards(rootDir: string): string | null {
let dirname = rootDir;
while (true) {
if (fs.existsSync(path.join(dirname, BABEL_CONFIG_JS_FILENAME))) {
return dirname;
}
const nextDir = path.dirname(dirname);
if (dirname === nextDir) break;
dirname = nextDir;
}
return null;
}
export function findRelativeConfig(
packageData: FilePackageData,
envName: string,

View File

@@ -11,6 +11,12 @@ import type { CallerMetadata } from "../validation/options";
export type { ConfigFile, IgnoreFile, RelativeConfig, FilePackageData };
export function findConfigUpwards(
rootDir: string, // eslint-disable-line no-unused-vars
): string | null {
return null;
}
export function findPackageData(filepath: string): FilePackageData {
return {
filepath,

View File

@@ -10,6 +10,7 @@ import typeof * as indexType from "./index";
export { findPackageData } from "./package";
export {
findConfigUpwards,
findRelativeConfig,
findRootConfig,
loadConfig,

View File

@@ -132,7 +132,7 @@ function resolveStandardizedName(
} catch (e2) {}
if (resolvedOppositeType) {
e.message += `\n- Did you accidentally pass a ${type} as a ${oppositeType}?`;
e.message += `\n- Did you accidentally pass a ${oppositeType} as a ${type}?`;
}
throw e;

View File

@@ -6,9 +6,43 @@ import { mergeOptions } from "./util";
import { createItemFromDescriptor } from "./item";
import { buildRootChain, type ConfigContext } from "./config-chain";
import { getEnv } from "./helpers/environment";
import { validate, type ValidatedOptions } from "./validation/options";
import {
validate,
type ValidatedOptions,
type RootMode,
} from "./validation/options";
import type { ConfigFile, IgnoreFile } from "./files";
import { findConfigUpwards, type ConfigFile, type IgnoreFile } from "./files";
function resolveRootMode(rootDir: string, rootMode: RootMode): string {
switch (rootMode) {
case "root":
return rootDir;
case "upward-optional": {
const upwardRootDir = findConfigUpwards(rootDir);
return upwardRootDir === null ? rootDir : upwardRootDir;
}
case "upward": {
const upwardRootDir = findConfigUpwards(rootDir);
if (upwardRootDir !== null) return upwardRootDir;
throw Object.assign(
(new Error(
`Babel was run with rootMode:"upward" but a root could not ` +
`be found when searching upward from "${rootDir}"`,
): any),
{
code: "BABEL_ROOT_NOT_FOUND",
dirname: rootDir,
},
);
}
default:
throw new Error(`Assertion failure - unknown rootMode value`);
}
}
export default function loadPrivatePartialConfig(
inputOpts: mixed,
@@ -28,9 +62,18 @@ export default function loadPrivatePartialConfig(
const args = inputOpts ? validate("arguments", inputOpts) : {};
const { envName = getEnv(), cwd = ".", root: rootDir = ".", caller } = args;
const {
envName = getEnv(),
cwd = ".",
root: rootDir = ".",
rootMode = "root",
caller,
} = args;
const absoluteCwd = path.resolve(cwd);
const absoluteRootDir = path.resolve(absoluteCwd, rootDir);
const absoluteRootDir = resolveRootMode(
path.resolve(absoluteCwd, rootDir),
rootMode,
);
const context: ConfigContext = {
filename:

View File

@@ -15,6 +15,7 @@ import type {
RootInputSourceMapOption,
NestingPath,
CallerMetadata,
RootMode,
} from "./options";
export type ValidatorSet = {
@@ -60,6 +61,20 @@ type AccessPath = $ReadOnly<{
}>;
type GeneralPath = OptionPath | AccessPath;
export function assertRootMode(loc: OptionPath, value: mixed): RootMode | void {
if (
value !== undefined &&
value !== "root" &&
value !== "upward" &&
value !== "upward-optional"
) {
throw new Error(
`${msg(loc)} must be a "root", "upward", "upward-optional" or undefined`,
);
}
return value;
}
export function assertSourceMaps(
loc: OptionPath,
value: mixed,

View File

@@ -19,6 +19,7 @@ import {
assertConfigFileSearch,
assertBabelrcSearch,
assertFunction,
assertRootMode,
assertSourceMaps,
assertCompact,
assertSourceType,
@@ -30,6 +31,9 @@ import {
const ROOT_VALIDATORS: ValidatorSet = {
cwd: (assertString: Validator<$PropertyType<ValidatedOptions, "cwd">>),
root: (assertString: Validator<$PropertyType<ValidatedOptions, "root">>),
rootMode: (assertRootMode: Validator<
$PropertyType<ValidatedOptions, "rootMode">,
>),
configFile: (assertConfigFileSearch: Validator<
$PropertyType<ValidatedOptions, "configFile">,
>),
@@ -176,6 +180,7 @@ export type ValidatedOptions = {
babelrcRoots?: BabelrcSearch,
configFile?: ConfigFileSearch,
root?: string,
rootMode?: RootMode,
code?: boolean,
ast?: boolean,
inputSourceMap?: RootInputSourceMapOption,
@@ -260,6 +265,7 @@ export type SourceMapsOption = boolean | "inline" | "both";
export type SourceTypeOption = "module" | "script" | "unambiguous";
export type CompactOption = boolean | "auto";
export type RootInputSourceMapOption = {} | boolean;
export type RootMode = "root" | "upward" | "upward-optional";
export type OptionsSource =
| "arguments"

View File

@@ -1,14 +1,29 @@
// @flow
import type { FileResult } from "./transformation";
export default function transformFile(
filename: string,
opts?: Object = {},
callback: (?Error, FileResult | null) => void,
// duplicated from transform-file so we do not have to import anything here
type TransformFile = {
(filename: string, callback: Function): void,
(filename: string, opts: ?Object, callback: Function): void,
};
export const transformFile: TransformFile = (function transformFile(
filename,
opts,
callback,
) {
if (typeof opts === "function") {
callback = opts;
}
callback(new Error("Transforming files is not supported in browsers"), null);
}: Function);
export function transformFileSync() {
throw new Error("Transforming files is not supported in browsers");
}
export function transformFileAsync() {
return Promise.reject(
new Error("Transforming files is not supported in browsers"),
);
}

View File

@@ -1,5 +0,0 @@
// @flow
export default function transformFileSync() {
throw new Error("Transforming files is not supported in browsers");
}

View File

@@ -9,6 +9,14 @@ import {
type FileResultCallback,
} from "./transformation";
import typeof * as transformFileBrowserType from "./transform-file-browser";
import typeof * as transformFileType from "./transform-file";
// Kind of gross, but essentially asserting that the exports of this module are the same as the
// exports of transform-file-browser, since this file may be replaced at bundle time with
// transform-file-browser.
((({}: any): $Exact<transformFileBrowserType>): $Exact<transformFileType>);
type TransformFile = {
(filename: string, callback: FileResultCallback): void,
(filename: string, opts: ?InputOptions, callback: FileResultCallback): void,

View File

@@ -156,7 +156,7 @@ export default class File {
* helper exists, but was not available for the full given range, it will be
* considered unavailable.
*/
availableHelper(name: string, versionRange: ?string) {
availableHelper(name: string, versionRange: ?string): boolean {
let minVersion;
try {
minVersion = helpers.minVersion(name);
@@ -166,10 +166,30 @@ export default class File {
return false;
}
if (typeof versionRange !== "string") return true;
// semver.intersects() has some surprising behavior with comparing ranges
// with preprelease versions. We add '^' to ensure that we are always
// comparing ranges with ranges, which sidesteps this logic.
// For example:
//
// semver.intersects(`<7.0.1`, "7.0.0-beta.0") // false - surprising
// semver.intersects(`<7.0.1`, "^7.0.0-beta.0") // true - expected
//
// This is because the first falls back to
//
// semver.satisfies("7.0.0-beta.0", `<7.0.1`) // false - surprising
//
// and this fails because a prerelease version can only satisfy a range
// if it is a prerelease within the same major/minor/patch range.
//
// Note: If this is found to have issues, please also revist the logic in
// transform-runtime's definitions.js file.
if (semver.valid(versionRange)) versionRange = `^${versionRange}`;
return (
typeof versionRange !== "string" ||
(!semver.intersects(`<${minVersion}`, versionRange) &&
!semver.intersects(`>=8.0.0`, versionRange))
!semver.intersects(`<${minVersion}`, versionRange) &&
!semver.intersects(`>=8.0.0`, versionRange)
);
}

View File

@@ -94,7 +94,7 @@ export default function mergeSourceMap(
}
function makeMappingKey(item: { line: number, columnStart: number }) {
return JSON.stringify([item.line, item.columnStart]);
return `${item.line}/${item.columnStart}`;
}
function eachOverlappingGeneratedOutputRange(

View File

@@ -1,16 +1,6 @@
// @flow
const pluginNameMap = {
asyncGenerators: {
syntax: {
name: "@babel/plugin-syntax-async-generators",
url: "https://git.io/vb4SY",
},
transform: {
name: "@babel/plugin-proposal-async-generator-functions",
url: "https://git.io/vb4yp",
},
},
classProperties: {
syntax: {
name: "@babel/plugin-syntax-class-properties",
@@ -143,26 +133,6 @@ const pluginNameMap = {
url: "https://git.io/vb4yS",
},
},
objectRestSpread: {
syntax: {
name: "@babel/plugin-syntax-object-rest-spread",
url: "https://git.io/vb4y5",
},
transform: {
name: "@babel/plugin-proposal-object-rest-spread",
url: "https://git.io/vb4Ss",
},
},
optionalCatchBinding: {
syntax: {
name: "@babel/plugin-syntax-optional-catch-binding",
url: "https://git.io/vb4Sn",
},
transform: {
name: "@babel/plugin-proposal-optional-catch-binding",
url: "https://git.io/vb4SI",
},
},
optionalChaining: {
syntax: {
name: "@babel/plugin-syntax-optional-chaining",
@@ -203,6 +173,41 @@ const pluginNameMap = {
url: "https://git.io/vb4Sm",
},
},
// TODO: This plugins are now supported by default by @babel/parser: they can
// be removed from this list. Although removing them isn't a breaking change,
// it's better to keep a nice error message for users using older versions of
// the parser. They can be removed in Babel 8.
asyncGenerators: {
syntax: {
name: "@babel/plugin-syntax-async-generators",
url: "https://git.io/vb4SY",
},
transform: {
name: "@babel/plugin-proposal-async-generator-functions",
url: "https://git.io/vb4yp",
},
},
objectRestSpread: {
syntax: {
name: "@babel/plugin-syntax-object-rest-spread",
url: "https://git.io/vb4y5",
},
transform: {
name: "@babel/plugin-proposal-object-rest-spread",
url: "https://git.io/vb4Ss",
},
},
optionalCatchBinding: {
syntax: {
name: "@babel/plugin-syntax-optional-catch-binding",
url: "https://git.io/vb4Sn",
},
transform: {
name: "@babel/plugin-proposal-optional-catch-binding",
url: "https://git.io/vb4SI",
},
},
};
const getNameURLCombination = ({ name, url }) => `${name} (${url})`;

View File

@@ -769,10 +769,10 @@ describe("api", function() {
options,
function(err) {
expect(err.message).toMatch(
"Support for the experimental syntax 'asyncGenerators' isn't currently enabled (1:15):",
"Support for the experimental syntax 'logicalAssignment' isn't currently enabled (1:3):",
);
expect(err.message).toMatch(
"Add @babel/plugin-proposal-async-generator-functions (https://git.io/vb4yp) to the " +
"Add @babel/plugin-proposal-logical-assignment-operators (https://git.io/vAlRe) to the " +
"'plugins' section of your Babel config to enable transformation.",
);
done();

View File

@@ -1,4 +1 @@
async function* agf() {
await 1;
yield 2;
}
a ||= 2;

View File

@@ -1,3 +1,7 @@
{
"plugins": ["transform-classes", "external-helpers", "transform-block-scoping"]
"plugins": [
"transform-classes",
"external-helpers",
"transform-block-scoping"
]
}

View File

@@ -1,3 +1,8 @@
{
"plugins": ["syntax-flow", "transform-flow-strip-types", "transform-parameters", "transform-block-scoping"]
"plugins": [
"syntax-flow",
"transform-flow-strip-types",
"transform-parameters",
"transform-block-scoping"
]
}

View File

@@ -1,3 +1,7 @@
{
"plugins": ["transform-parameters", "transform-arrow-functions", "transform-block-scoping"]
"plugins": [
"transform-parameters",
"transform-arrow-functions",
"transform-block-scoping"
]
}

View File

@@ -1,10 +1,8 @@
{
"compact": false,
"presets": [
"env"
],
"presets": ["env"],
"plugins": [
"external-helpers",
["external-helpers", { "helperVersion": "7.1.5" }],
"proposal-object-rest-spread"
]
}

View File

@@ -1,3 +1,8 @@
{
"plugins": ["transform-destructuring", "transform-parameters", "transform-block-scoping", "transform-regenerator"]
"plugins": [
"transform-destructuring",
"transform-parameters",
"transform-block-scoping",
"transform-regenerator"
]
}

View File

@@ -1,3 +1,7 @@
{
"plugins": ["external-helpers", "transform-classes", "transform-block-scoping"]
"plugins": [
"external-helpers",
"transform-classes",
"transform-block-scoping"
]
}

View File

@@ -1,5 +1,3 @@
{
"plugins": [
"transform-modules-commonjs"
]
"plugins": ["transform-modules-commonjs"]
}

View File

@@ -400,7 +400,7 @@ describe("addon resolution", function() {
presets: ["testplugin"],
});
}).toThrow(
/Cannot find module 'babel-preset-testplugin'.*\n- Did you accidentally pass a preset as a plugin\?/,
/Cannot find module 'babel-preset-testplugin'.*\n- Did you accidentally pass a plugin as a preset\?/,
);
});
@@ -414,7 +414,7 @@ describe("addon resolution", function() {
plugins: ["testpreset"],
});
}).toThrow(
/Cannot find module 'babel-plugin-testpreset'.*\n- Did you accidentally pass a plugin as a preset\?/,
/Cannot find module 'babel-plugin-testpreset'.*\n- Did you accidentally pass a preset as a plugin\?/,
);
});

View File

@@ -1,24 +1,27 @@
{
"name": "@babel/generator",
"version": "7.0.0-rc.4",
"version": "7.1.6",
"description": "Turns an AST into code.",
"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-generator",
"main": "lib/index.js",
"files": [
"lib"
],
"dependencies": {
"@babel/types": "^7.0.0-rc.4",
"@babel/types": "^7.1.6",
"jsesc": "^2.5.1",
"lodash": "^4.17.10",
"source-map": "^0.5.0",
"trim-right": "^1.0.1"
},
"devDependencies": {
"@babel/helper-fixtures": "^7.0.0-rc.4",
"@babel/parser": "^7.0.0-rc.4"
"@babel/helper-fixtures": "^7.0.0",
"@babel/parser": "^7.1.6"
}
}

View File

@@ -5,7 +5,9 @@ export function UnaryExpression(node: Object) {
if (
node.operator === "void" ||
node.operator === "delete" ||
node.operator === "typeof"
node.operator === "typeof" ||
// throwExpressions
node.operator === "throw"
) {
this.word(node.operator);
this.space();

View File

@@ -111,7 +111,25 @@ export function ArrowFunctionExpression(node: Object) {
t.isIdentifier(firstParam) &&
!hasTypes(node, firstParam)
) {
this.print(firstParam, node);
if (
this.format.retainLines &&
node.loc &&
node.body.loc &&
node.loc.start.line < node.body.loc.start.line
) {
this.token("(");
if (firstParam.loc && firstParam.loc.start.line > node.loc.start.line) {
this.indent();
this.print(firstParam, node);
this.dedent();
this._catchUp("start", node.body.loc);
} else {
this.print(firstParam, node);
}
this.token(")");
} else {
this.print(firstParam, node);
}
} else {
this._params(node);
}

View File

@@ -127,6 +127,9 @@ export function TSIndexSignature(node) {
export function TSAnyKeyword() {
this.word("any");
}
export function TSUnknownKeyword() {
this.word("unknown");
}
export function TSNumberKeyword() {
this.word("number");
}
@@ -238,6 +241,16 @@ export function TSTupleType(node) {
this.token("]");
}
export function TSOptionalType(node) {
this.print(node.typeAnnotation, node);
this.token("?");
}
export function TSRestType(node) {
this.token("...");
this.print(node.typeAnnotation, node);
}
export function TSUnionType(node) {
this.tsPrintUnionOrIntersectionType(node, "|");
}

View File

@@ -209,6 +209,7 @@ export function ConditionalExpression(node: Object, parent: Object): boolean {
t.isBinary(parent) ||
t.isConditionalExpression(parent, { test: node }) ||
t.isAwaitExpression(parent) ||
t.isOptionalMemberExpression(parent) ||
t.isTaggedTemplateExpression(parent) ||
t.isTSTypeAssertion(parent) ||
t.isTSAsExpression(parent)
@@ -219,6 +220,13 @@ export function ConditionalExpression(node: Object, parent: Object): boolean {
return UnaryLike(node, parent);
}
export function OptionalMemberExpression(
node: Object,
parent: Object,
): boolean {
return t.isCallExpression(parent) || t.isMemberExpression(parent);
}
export function AssignmentExpression(node: Object): boolean {
if (t.isObjectPattern(node.left)) {
return true;

View File

@@ -1 +1 @@
{ "plugins": ["jsx"] }
{ "plugins": ["jsx"] }

View File

@@ -1 +0,0 @@
{ "plugins": ["objectRestSpread"] }

View File

@@ -1,6 +1,4 @@
{
"plugins": [
["decorators", { "decoratorsBeforeExport": false }]
],
"plugins": [["decorators", { "decoratorsBeforeExport": false }]],
"decoratorsBeforeExport": false
}

View File

@@ -1,6 +1,4 @@
{
"plugins": [
["decorators", { "decoratorsBeforeExport": false }]
],
"plugins": [["decorators", { "decoratorsBeforeExport": false }]],
"decoratorsBeforeExport": true
}

View File

@@ -1,6 +1,4 @@
{
"plugins": [
["decorators", { "decoratorsBeforeExport": true }]
],
"plugins": [["decorators", { "decoratorsBeforeExport": true }]],
"decoratorsBeforeExport": false
}

View File

@@ -1,6 +1,4 @@
{
"plugins": [
["decorators", { "decoratorsBeforeExport": true }]
],
"plugins": [["decorators", { "decoratorsBeforeExport": true }]],
"decoratorsBeforeExport": true
}

View File

@@ -1 +1 @@
{ "plugins": ["asyncGenerators", "classProperties"] }
{ "plugins": ["classProperties"] }

View File

@@ -0,0 +1,11 @@
var fn = async (
arg
) => {}
async (x)
=> {}
async x => {}
async (x
) => {};

View File

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

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